mingw: nsWindowsRegKey.cpp build error: invalid conversion from `const PRUnichar*' to `const WCHAR*'

VERIFIED FIXED

Status

()

defect
VERIFIED FIXED
14 years ago
14 years ago

People

(Reporter: bugzilla, Assigned: wtc)

Tracking

Trunk
x86
Windows XP
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Reporter

Description

14 years ago
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::Open(PRUint32, const nsAString_internal&, PRUint32)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:167: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::Create(PRUint32, const nsAString_internal&, PRUint32)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:186: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::GetChildName(PRUint32, nsAString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:262: error: invalid conversion from `PRUnichar*' to `WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::HasChild(const nsAString_internal&, PRBool*)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:295: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::GetValueName(PRUint32, nsAString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:333: error: invalid conversion from `PRUnichar*' to `WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::HasValue(const nsAString_internal&, PRBool*)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:361: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::RemoveChild(const nsAString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:378: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::RemoveValue(const nsAString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:393: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::GetValueType(const nsAString_internal&, PRUint32*)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:409: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::ReadStringValue(const nsAString_internal&, nsAString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:429: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:453: warning: comparison between signed and unsigned integer expressions
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:457: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:480: warning: comparison between signed and unsigned integer expressions
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::ReadIntValue(const nsAString_internal&, PRUint32*)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:502: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::ReadInt64Value(const nsAString_internal&, PRUint64*)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:521: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::ReadBinaryValue(const nsAString_internal&, nsACString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:540: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:551: warning: comparison between signed and unsigned integer expressions
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:556: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::WriteStringValue(const nsAString_internal&, const nsAString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:579: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::WriteIntValue(const nsAString_internal&, PRUint32)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:600: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::WriteInt64Value(const nsAString_internal&, PRUint64)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:618: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp: In member function `virtual nsresult nsWindowsRegKey::WriteBinaryValue(const nsAString_internal&, const nsACString_internal&)':
d:/Mozilla/mozilla/xpcom/ds/nsWindowsRegKey.cpp:637: error: invalid conversion from `const PRUnichar*' to `const WCHAR*'

Comment 1

14 years ago
This was caused by the patch to Bug #326168
Depends on: 326168

Comment 2

14 years ago
What is PRUnichar* in mingw that it won't convert to WCHAR*?
Component: File Handling → XPCOM
Product: Firefox → Core
QA Contact: file.handling → xpcom
Summary: unable to build xpcom/ds/nsWindowsRegKey.cpp with gcc on Windows → mingw: nsWindowsRegKey.cpp build error: invalid conversion from `const PRUnichar*' to `const WCHAR*'
Version: unspecified → Trunk
Reporter

Comment 3

14 years ago
(In reply to comment #2)
> What is PRUnichar* in mingw that it won't convert to WCHAR*?
> 

is there a way to see/investigate this?

Comment 4

14 years ago
Sure, you can read through prtypes.h or read through a generated .i file.

Comment 5

14 years ago
In prtypes.h, PRUnichar is defined with the following code:
(see bug 326168 comment #12)

 #if (defined(__MWERKS__) || defined(_MSC_VER)) && defined(WIN32)
 typedef wchar_t PRUnichar;
 #else
 typedef PRUint16 PRUnichar;
 #endif

This is an attempt to 'emulate' the following in nscore.h:

399   #if defined(HAVE_CPP_2BYTE_WCHAR_T) && defined(NS_WIN32)
400     typedef wchar_t PRUnichar;
401   #else
402     typedef PRUint16 PRUnichar;
403   #endif

However, that fails for mingw because HAVE_CPP_2BYTE_WCHAR_T for mingw apparently comes from autoconf. 
Assignee: nobody → wtchang

Comment 6

14 years ago
(In reply to comment #5)

> However, that fails for mingw because HAVE_CPP_2BYTE_WCHAR_T for mingw
> apparently comes from autoconf. 

That is, in prtypes.h, PRUnichar is typedef'd as PRUint16 (= unsigned short) for mingw while it used to be typedef'd as wchar_t for both MSVC and mingw in nscore.h   

Comment 7

14 years ago
(In reply to comment #5)
> In prtypes.h, PRUnichar is defined with the following code:

>  #if (defined(__MWERKS__) || defined(_MSC_VER)) && defined(WIN32)
>  typedef wchar_t PRUnichar;

Does replacing the above two lines with the following two lines work? 

#if (defined(__MWERKS__) || defined(_MSC_VER) || defined(__MINGW32__)) && \
    defined(WIN32)
typedef wchar_t PRUnichar;

Assignee

Comment 8

14 years ago
jshin, I like your suggestion of testing __MINGW32__.  Since
MSVC and gcc/MinGW are the only two compilers we support on
Windows, and I believe any other compiler we support on Windows
will have to match Microsoft's definition of wchar_t, we can
also just revert to the original code.  That's what this patch
does.

When I wrote the new code, I forgot that the HAVE_CPP_2BYTE_WCHAR_T
macro could also be defined on the compiler command line by
configure.in.
Assignee

Comment 9

14 years ago
I checked in the patch on the NSPRPUB_PRE_4_2_CLIENT_BRANCH
for the Mozilla trunk (1.9 alpha).

Checking in mozilla/nsprpub/pr/include/prtypes.h;
/cvsroot/mozilla/nsprpub/pr/include/prtypes.h,v  <--  prtypes.h
new revision: 3.20.4.14; previous revision: 3.20.4.13
done

If this fixes the build, please mark the bug VERIFIED.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED

Comment 10

14 years ago
It seems to me that fixed the problem. Many thanks.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.