Closed
Bug 170852
Opened 22 years ago
Closed 19 years ago
Remove #ifdef MOZ_UNICODE and MOZ_AIMM
Categories
(Core :: Internationalization, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: tetsuroy, Assigned: smontagu)
Details
(Keywords: intl)
Attachments
(3 files, 2 obsolete files)
52.56 KB,
patch
|
shanjian
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
74.04 KB,
patch
|
Details | Diff | Splinter Review | |
949 bytes,
patch
|
bryner
:
review+
|
Details | Diff | Splinter Review |
Now the flag (MOZ_UNICODE) is _ON_ by default, we need to remove them for improved readability and maintainability of the code.
Reporter | ||
Updated•22 years ago
|
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.2beta
code issue, QA to yokoyama@netscape.com for now.
Keywords: intl
QA Contact: ruixu → yokoyama
Reporter | ||
Comment 2•22 years ago
|
||
MOZ_AIMM should be removed as well.
Reporter | ||
Comment 3•22 years ago
|
||
updating summary. MOZ_UNICODE is no longer exclusive to widget module. webshell/test app also contains the ifdef.
Summary: Remove #ifdef MOZ_UNICODE from /widget → Remove #ifdef MOZ_UNICODE and MOZ_AIMM
Reporter | ||
Comment 4•22 years ago
|
||
bulk milestone change
Target Milestone: mozilla1.2beta → mozilla1.3alpha
Reporter | ||
Comment 5•22 years ago
|
||
shanjian: can you review?
Comment 6•22 years ago
|
||
Comment on attachment 105996 [details] [diff] [review] cleanup r=shanjian
Attachment #105996 -
Flags: review+
Comment 7•22 years ago
|
||
virtual LPCWSTR WindowClassW(); -#endif /* MOZ_UNICODE */ virtual LPCTSTR WindowClass(); is the non-W version still needed?
Comment on attachment 105996 [details] [diff] [review] cleanup I just noticed that |WindowClass()| and |WindowPopupClass()| are implemented like this: LPCTSTR nsWindow::WindowClass() { return (NS_ConvertUCS2toUTF8(WindowClassW()).get()); } LPCTSTR nsWindow::WindowPopupClass() { return (NS_ConvertUCS2toUTF8(WindowPopupClassW()).get()); } I think this is a problem because it returns a pointer to the buffer in the temporary NS_ConvertUCS2toUTF8 object, but the object will have it's destructor called after returning from the function, so the caller will get a pointer to memory that was already free'd ... right? This needs to be addressed.
Comment 9•22 years ago
|
||
that could be replaced with return ToNewUTF8String(WindowClassW); I think
Reporter | ||
Comment 10•22 years ago
|
||
I don't think calling the ToNewUTF8String(WindowClassW); is a good idea. It will create a buffer in the heap and we need to explicitly free the memory. We need to create the buffer in stack, just like the original nsWindow::WindowClass() { const LPCTSTR className = "MozillaWindowClass"; ... return className; } I think the following is better. nsWindow::WindowClass() { NS_ConvertUCS2toUTF8 className(WindowPopupClassW()).get()); return (className.get()); } This way className gets freed when function gets out of scope ( ie. at '}' line ) kin: comment?
Reporter | ||
Comment 11•22 years ago
|
||
Oops bad syntax. It should be NS_ConvertUCS2toUTF8 className(WindowPopupClassW());
Comment 12•22 years ago
|
||
but your suggestion will not work. the string buffer is freed when the function returns and its contents are undefined.
Comment 13•22 years ago
|
||
ah yeah, and to fix that, you either need a global variable, or you must allocate from heap.
Comment 14•22 years ago
|
||
yokoyama, your proposed solution above, that uses a local className is identical to what we have now so it doesn't fix anything. The only reason why something like this works: { char *classname = "foobar"; ... return classname; } is because the "foobar" is a static constant string that never gets freed.
Comment 15•22 years ago
|
||
So like cbiesinger asked, do we still need non-W versions? Who is still calling the non-W versions? If for some reason they are still needed, perhaps a workaround would be something like this: LPCTSTR nsWindow::WindowClass() { // Call into the wide version to make sure things get // registered properly. WindowClassW(); // XXX: The class name used here must be kept in sync with // the classname used in WindowClassW(); return "MozillaWindowClass"; }
Reporter | ||
Comment 16•22 years ago
|
||
>do we still need non-W versions?
I kept the non-W version for just being safe. I believe we can
remove the non-W version.
Thanks for comments, Christian & kin. I'll post a new patch soon.
Reporter | ||
Comment 17•22 years ago
|
||
Remove WindowClass() and WindowPopupClass(). Rename WindowClassW() and WindowPopupClassW() to WindowClass() and WindowPopupClass(). kin: can you super review?
Attachment #105996 -
Attachment is obsolete: true
Reporter | ||
Comment 18•22 years ago
|
||
shanjian: can you review the latest patch?
Reporter | ||
Comment 19•22 years ago
|
||
hold on. It looks like flash plugins are calling nsWindow::WindowClass() and we shouldn't remove it. It look like we have to do what kin suggested to do here: http://bugzilla.mozilla.org/show_bug.cgi?id=170852#c15 I'll post a new patch soon.
Reporter | ||
Comment 20•22 years ago
|
||
Comment on attachment 106436 [details] [diff] [review] remove non-W functions and rename W functions invalidating
Attachment #106436 -
Attachment is obsolete: true
Reporter | ||
Comment 21•22 years ago
|
||
Reporter | ||
Comment 22•22 years ago
|
||
Comment on attachment 108069 [details] [diff] [review] Similar to the first reviewed patch except nsWindow::WindowPopupClass() and WindowClass() can you review?
Attachment #108069 -
Flags: review?(shanjian)
Updated•22 years ago
|
Attachment #108069 -
Flags: review?(shanjian) → review+
Reporter | ||
Comment 23•22 years ago
|
||
Comment on attachment 108069 [details] [diff] [review] Similar to the first reviewed patch except nsWindow::WindowPopupClass() and WindowClass() I saw a weired behavior while I was debugging the plugin stuff when WindowClass()/WindowPopupClass() are omitted. It's better to keep them for now. kin: can you super review?
Attachment #108069 -
Flags: superreview?(kin)
Comment 24•22 years ago
|
||
Comment on attachment 108069 [details] [diff] [review] Similar to the first reviewed patch except nsWindow::WindowPopupClass() and WindowClass() If you're looking for a review by days end to meet the 1.3alpha deadline ... I won't be able to get to this.
Comment on attachment 108069 [details] [diff] [review] Similar to the first reviewed patch except nsWindow::WindowPopupClass() and WindowClass() stealing from kin's request queue. sr=roc+moz
Attachment #108069 -
Flags: superreview?(kin) → superreview+
Comment 26•21 years ago
|
||
yokoyama, can you checkin the patch or update it if needed?
Reporter | ||
Comment 27•21 years ago
|
||
I am not actively working on mozilla at the moment. assign to ftang
Assignee: yokoyama → ftang
Status: ASSIGNED → NEW
Target Milestone: mozilla1.3alpha → mozilla1.3final
Comment 28•21 years ago
|
||
ftang, can you checkin the patch after the 1.4a freeze cycle is over?
Comment 29•21 years ago
|
||
This is the above patch updated to trunk. It doesn't include any Makefile changes, because NSPR header files have some #ifdef MOZ_UNICODE parts, and I were afraid that those parts might be needed by #ifdef MOZ_UNICODE mozilla code. I plan to check this in tomorrow, assuming the above review/super-review still applies.
Comment 30•21 years ago
|
||
the "patch updated, w/o makefile changes" attachment has been checked in.
Comment 31•21 years ago
|
||
I backed out the nsMsgCompose changes that were part of the latest patch here because they broke attaching files with non-ascii filenames on non-windows platforms (or at least the display of their names in the compose window)
Comment 32•21 years ago
|
||
Updated•21 years ago
|
Attachment #131118 -
Flags: review?(leaf)
Updated•21 years ago
|
Attachment #131118 -
Flags: review?(leaf) → review?(bryner)
Updated•21 years ago
|
Attachment #131118 -
Flags: review?(bryner) → review+
Comment 33•19 years ago
|
||
-> to default owner (rather than ftang's WONTFIX)
Assignee: ftang → smontagu
QA Contact: tetsuroy → amyy
Target Milestone: mozilla1.3final → ---
Assignee | ||
Comment 34•19 years ago
|
||
Checked in the last patch (sr=neil on IRC)
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•