Closed Bug 569586 Opened 10 years ago Closed 10 years ago

XPCOM compilation failure on mingw-w64 due to pointer to int cast loosing precision.


(Core :: XPCOM, defect)

Not set





(Reporter: jacek, Assigned: jacek)




(1 file)

Attached patch fix v1.0Splinter Review
I get following errors:

xpcom/base/nsStackWalk.cpp:1034:29: error: cast from 'void*' to 'DWORD' loses precision
xpcom/ds/nsWindowsRegKey.cpp:142:40: error: cast from 'HKEY__*' to 'PRUint32' loses precision
xpcom/ds/nsWindowsRegKey.cpp:160:42: error: cast from 'HKEY__*' to 'PRUint32' loses precision

All of those casts are intentional, so proper casts are all we need. The attached patch fixes the problem.
Attachment #448752 - Attachment is patch: true
Attachment #448752 - Flags: review?(benjamin)
Attachment #448752 - Flags: review?(benjamin) → review+
Thanks for quick review.
Keywords: checkin-needed
Assignee: nobody → jacek
Blocks: 570342
Sorry, I believe the nsWindowsRegKey changes are incorrect, because  nsWindowsRegKey::Open [1] takes a PRUint32, since it's an IDL method taking an unsigned long [2].  An HKEY is pointer-sized, so the current patch would truncate the handle.  I have an old patch [3] that works, but I'm not quite comfortable with changing the interface - I think it's doable to make the current open() implementation internal and (on win64 at last) add a stub for the predefined HKEYs, but haven't had time to really do it yet :(

My patch doesn't really change anything. These casts are already in the code, all my patch does is a different way of casting that is acceptable for mingw-w64. There even is a comment about the problem:

 * NOTE: On 32-bit Windows, it is valid to pass any HKEY as the rootKey
 * parameter of this function.  However, for compatibility with 64-bit
 * Windows, that usage should probably be avoided in favor of openChild.

And the comment is also quite not right. HKEY is in fact a system HANDLE and such handles, although have 8-bytes size, use only 4 bytes values. so there is no problem with the code (except ugly casts).
Closed: 10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.