Closed Bug 526970 Opened 16 years ago Closed 16 years ago

Handle wide string literals in lazy_tree_string

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: philip, Assigned: taras.mozilla)

References

Details

Attachments

(1 file, 2 obsolete files)

lazy_tree_string calls convert_char_star which calls JS_NewStringCopyZ, for all strings. This fails when it's a wchar_t* string (it only copies the first byte before hitting a null byte and stopping), and makes it impossible to access the string contents from scripts. Strings with non-char precision ought to be converted properly into Unicode JS strings.
Attached patch rough patch (obsolete) — Splinter Review
This is a nasty hack - I don't know the right way to implement the feature. But this at least worked for me. Also it fixes handling of non-wide strings with embedded null characters.
Philip can you attach a testcase with instructions on how to run it?
Attached patch test case (obsolete) — Splinter Review
A test case (which the patch passes), using the standard Treehydra test runner. (I'd prefer it if the string was exposed as 't.string.str' or 't.string', rather than 't.string.str_full', but the latter seemed easiest to implement given that I don't quite understand how the code works.)
nice hack! I think the right thing to do here is some magic. I think t.string.str should do the unicode conversion that your .str_full hack does. Patch coming right up.
Attached patch my versionSplinter Review
Thank you for the excellent exploratory patch. It made it really easy to turn into something landable. Please confirm that this works for you and I'll land it.
Attachment #410747 - Attachment is obsolete: true
Attachment #410819 - Attachment is obsolete: true
Attachment #410852 - Flags: review?(philip.taylor)
Blocks: 437502
Comment on attachment 410852 [details] [diff] [review] my version The only problem is I get a compiler error "treehydra.c:223: error: expected ‘)’ before ‘uint16_t’". If I #include <stdint.h> then it looks like it works fine.
Attachment #410852 - Flags: review?(philip.taylor) → review+
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Assignee: nobody → tglek
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: