Closed
Bug 552548
Opened 14 years ago
Closed 14 years ago
Use JSString accessors in ctypes instead of JS_GetStringChars
Categories
(Core :: js-ctypes, defect, P1)
Core
js-ctypes
Tracking
()
RESOLVED
FIXED
People
(Reporter: dwitte, Assigned: dwitte)
References
Details
Attachments
(1 file)
9.78 KB,
patch
|
mozilla+ben
:
review+
|
Details | Diff | Splinter Review |
JS_GetStringChars can allocate, to guarantee a null-terminated buffer. That's bad; we don't need it, and it can fail. This requires moving ctypes into js/src.
Assignee | ||
Comment 1•14 years ago
|
||
P1, need this for 1.9.3. (Trivial to fix and it's a correctness bug.)
Assignee | ||
Updated•14 years ago
|
Priority: -- → P1
Assignee | ||
Comment 2•14 years ago
|
||
Comment 3•14 years ago
|
||
Comment on attachment 438005 [details] [diff] [review] like so > static JS_ALWAYS_INLINE bool > IsEllipsis(jsval v) > { > if (!JSVAL_IS_STRING(v)) > return false; > JSString* str = JSVAL_TO_STRING(v); >- if (JS_GetStringLength(str) != 3) >- return false; >- jschar* chars = JS_GetStringChars(str), dot('.'); >+ if (str->length() != 3) >+ return false; >+ const jschar* chars = str->chars(), dot('.'); > return (chars[0] == dot && > chars[1] == dot && > chars[2] == dot); > } It's a shame how the `chars`s don't all line up vertically now.
Attachment #438005 -
Flags: review?(bnewman) → review+
Comment 4•14 years ago
|
||
(In reply to comment #3) > It's a shame how the `chars`s don't all line up vertically now. Actually, it is kind of cool how the `char` part still aligns: const jschar return (char char char r=me, after all
Assignee | ||
Comment 5•14 years ago
|
||
Comment on attachment 438005 [details] [diff] [review] like so http://hg.mozilla.org/tracemonkey/rev/3db08f1327b2
Assignee | ||
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•