Closed
Bug 657537
Opened 13 years ago
Closed 13 years ago
Make CESU8 boolean into a behaviory enum
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: cdleary, Assigned: cdleary)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(2 files, 1 obsolete file)
15.66 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
47.39 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
Readability fix requested by Waldo in bug 654301.
Assignee | ||
Comment 1•13 years ago
|
||
Attachment #533069 -
Flags: review?
Assignee | ||
Updated•13 years ago
|
Attachment #533069 -
Attachment description: 0. Add CESU8 parameter. → 0. Add CESU8 behavior parameter.
Attachment #533069 -
Flags: review? → review?(jwalden+bmo)
Assignee | ||
Comment 2•13 years ago
|
||
Attachment #533071 -
Flags: review?(jwalden+bmo)
Assignee | ||
Updated•13 years ago
|
Attachment #533071 -
Attachment description: Namespace and comment in/de-flation helpers. → 1. Namespace and comment in/de-flation helpers.
Assignee | ||
Comment 3•13 years ago
|
||
Whoops, was missing some browser files.
Attachment #533071 -
Attachment is obsolete: true
Attachment #533071 -
Flags: review?(jwalden+bmo)
Attachment #533130 -
Flags: review?(jwalden+bmo)
Comment 4•13 years ago
|
||
Comment on attachment 533069 [details] [diff] [review] 0. Add CESU8 behavior parameter. Review of attachment 533069 [details] [diff] [review]: ----------------------------------------------------------------- "FlationCoding" is a weird name; it seems to me "Encoding" would be a better name, if perhaps only marginally better. I guess at that point the name of the corresponding variable has to pick up the slack. I'd suggest |srcEncoding|, |inflatedEncoding|, etc. for variable/parameter names to help. Also, NormalEncoding doesn't mean anything. It should be named more precisely, e.g. ISO88591Encoding or Latin1Encoding. I'd prefer the former, but I could take either. ::: js/src/jsstr.h @@ +1115,4 @@ > * CESU-8 (Compatibility Encoding Scheme for UTF-16: 8-bit) is a > * variant of UTF-8 that allows us to store any wide character > * string as a narrow character string. For strings containing > * mostly ascii, it saves space. Rewrap this paragraph to wrap at 80/79 characters.
Attachment #533069 -
Flags: review?(jwalden+bmo) → review+
Comment 5•13 years ago
|
||
Comment on attachment 533130 [details] [diff] [review] 1. Namespace and comment in/de-flation helpers. Review of attachment 533130 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jscntxt.cpp @@ +1018,5 @@ > JS_ASSERT(expandedArgs == argCount); > *out = 0; > cx->free_(buffer); > + *messagep = DeflateString(cx, reportp->ucmessage, > + (size_t)(out - reportp->ucmessage)); Make that a size_t() C++-style cast. ::: js/src/jsstr.cpp @@ +4074,5 @@ > return NULL; > } > > jschar * > +js::InflateString(JSContext *cx, const char *bytes, size_t *lengthp, FlationCoding fc) I think generally we dump functions inside namespace js blocks when defining them, rather than use a js:: prefix to indicate that we're defining the namespace-nested function. @@ +4112,5 @@ > /* > * May be called with null cx. > */ > char * > +js::DeflateString(JSContext *cx, const jschar *chars, size_t nchars) Ditto. @@ +4138,5 @@ > return bytes; > } > > size_t > +js::GetDeflatedStringLength(JSContext *cx, const jschar *chars, size_t nchars) Ditto. (And at some point you get enough that the block makes more sense even on its own merits.) @@ +4151,5 @@ > * May be called with null cx through public API, see below. > */ > size_t > +js::GetDeflatedUTF8StringLength(JSContext *cx, const jschar *chars, > + size_t nchars, FlationCoding fc) La la la @@ +4197,5 @@ > } > > +bool > +js::DeflateStringToBuffer(JSContext *cx, const jschar *src, size_t srclen, > + char *dst, size_t *dstlenp) La @@ +4223,5 @@ > } > > +bool > +js::DeflateStringToUTF8Buffer(JSContext *cx, const jschar *src, size_t srclen, > + char *dst, size_t *dstlenp, FlationCoding fc) La @@ +4287,5 @@ > } > > +bool > +js::InflateStringToBuffer(JSContext *cx, const char *src, size_t srclen, > + jschar *dst, size_t *dstlenp) La! @@ +4314,5 @@ > } > > +bool > +js::InflateUTF8StringToBuffer(JSContext *cx, const char *src, size_t srclen, > + jschar *dst, size_t *dstlenp, FlationCoding fc) LA! ::: js/src/jsstr.h @@ +1116,5 @@ > + * - Some string functions have an optional FlationCoding argument that allow > + * the caller to force CESU-8 encoding handling. > + * - Functions that don't take a FlationCoding base their NormalEncoding > + * behavior on the js_CStringsAreUTF8 value. NormalEncoding is either raw > + * (simple zero-extension) or UTF-8 depending on js_CStringsAreUTF8. ...wait. I hate this interface. I guess take back what I said about ISO88591Encoding in the previous review.
Attachment #533130 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 6•13 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/2781c17e531d
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Comment 7•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/2781c17e531d
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•