Closed
Bug 655168
Opened 14 years ago
Closed 14 years ago
add facilities to read binary files in the shell
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: gal, Assigned: gal)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
3.71 KB,
patch
|
cdleary
:
review+
|
Details | Diff | Splinter Review |
Syntax: snarf(path, "binary") => returns a Uint8Array with the binary data
Assignee | ||
Comment 1•14 years ago
|
||
Assignee: general → gal
Comment 2•14 years ago
|
||
Comment on attachment 530452 [details] [diff] [review]
patch
Review of attachment 530452 [details] [diff] [review]:
Yay for shell functionality!
::: js/src/shell/js.cpp
@@ +1168,5 @@
+ return NULL;
+ }
+
+ JSObject *obj = NULL;
+ if (fseek(file, 0, SEEK_END) == EOF) {
Nonzero instead of EOF? C99 spec just says "The fseek function returns nonzero only for a request that cannot be satisfied." for this and ftell.
@@ +4505,5 @@
+ JS_GUARD_OBJECT_NOTIFIER_INIT;
+ }
+
+ ~FreeOnReturn() {
+#ifdef XP_UNIX
FreeOnReturn class that only frees on XP_UNIX should probably be called either XPFreeOnReturn or you should pass an |enable| bool to the constructor that's the value of defined(XP_UNIX).
@@ +4535,5 @@
#ifdef XP_UNIX
pathname = MakeAbsolutePathname(cx, script->filename, filename.ptr());
if (!pathname)
return JS_FALSE;
+ FreeOnReturn _(cx, pathname);
I think _ is technically an illegal variable name. "Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace." pnGuard?
Attachment #530452 -
Flags: review+
Comment 3•14 years ago
|
||
Comment on attachment 530452 [details] [diff] [review]
patch
Review of attachment 530452 [details] [diff] [review]:
::: js/src/shell/js.cpp
@@ +4535,5 @@
#ifdef XP_UNIX
pathname = MakeAbsolutePathname(cx, script->filename, filename.ptr());
if (!pathname)
return JS_FALSE;
+ FreeOnReturn _(cx, pathname);
"in the global namespace", right? This is inside a function. I think it's safe to use here, by that language, if I understand it correctly.
Assignee | ||
Comment 4•14 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 5•14 years ago
|
||
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/e04165ece84c
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•