Closed Bug 291861 Opened 20 years ago Closed 20 years ago

XPCDispInterface.cpp fails to compile with Microsoft Visual Studio 2005 Beta 2

Categories

(Core :: XPConnect, defect)

x86
Windows XP
defect
Not set
blocker

Tracking

()

RESOLVED FIXED

People

(Reporter: stdowa+bugzilla, Assigned: dbradley)

References

Details

Attachments

(1 file, 1 obsolete file)

c:/Mozilla/mozilla/js/src/xpconnect/src/XPCDispInterface.cpp(183) : error C2664: 'JS_InternUCStringN' : cannot convert parameter 2 from 'BST R' to 'const jschar *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I think that the real fix would be to change jschar definition in js\src\jspubtd.h to: "typedef wchar_t jschar;" (same as PRUnichar definition) If it is not possible to change the definition then just cast to (const jschar *) ?
We should NS_STATIC_CAST here, just as we do elsewhere.
Re: comment 2: absolutely not, jschar is uint16 per ECMA-262 Edition 3. /be
Brendan meant the wchar_t change at comment 1; he has trouble with numbers sometimes.
Attached patch Cast until it compiles (obsolete) — Splinter Review
Attachment #182649 - Flags: review?(shaver)
I think that the cast in XPCDispTypeInfo.cpp should be: - mName = nsString(chars, len); + mName = nsString(NS_REINTERPRET_CAST(const PRUnichar *, chars), len); About all those casts, I think that it's because of this compiler change: (from http://msdn2.microsoft.com/library/ms177253(en-us,vs.80).aspx) /Zc:wchar_t now on by default This is Standard C++ behavior: A wchar_t variable will default to the built in type instead of a short unsigned integer. This change will break binary compatibility when client code is linked with libraries that were compiled without /Zc:wchar_t. Use /Zc:wchar_t- to revert to the old, non-standard behavior. This change was introduced to create conformant code by default. I don't really understand the binary compatibility problem, though... See also, fwiw, this can break things: /Zc:forScope now on by default This is Standard C++ behavior: Code that depends on the use of a variable declared in a for loop after the for loop scope has ended will now fail to compile. Use /Zc:forScope- to revert to the old, non-standard behavior. This change was introduced to create conformant code by default.
Comment on attachment 182649 [details] [diff] [review] Cast until it compiles r+a again, more compiler fixes.
Attachment #182649 - Flags: review?(shaver)
Attachment #182649 - Flags: review+
Attachment #182649 - Flags: approval1.8b2+
Attachment #182649 - Attachment is obsolete: true
Attachment #182649 - Flags: approval1.8b2+
Comment on attachment 182656 [details] [diff] [review] Cast to const PRUnichar * instead Yeah, that's better. Thanks for checking in, r+a.
Attachment #182656 - Flags: review+
Attachment #182656 - Flags: approval1.8b2+
checked in by db48x
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: