Last Comment Bug 754795 - OSFileConstants.cpp fails to compile on mingw-w64
: OSFileConstants.cpp fails to compile on mingw-w64
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM (show other bugs)
: Trunk
: x86_64 Windows Vista
: -- normal (vote)
: mozilla15
Assigned To: Jacek Caban
:
Mentors:
Depends on:
Blocks: 747872
  Show dependency treegraph
 
Reported: 2012-05-14 02:47 PDT by Jacek Caban
Modified: 2013-04-04 13:52 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix v1.0 (926 bytes, patch)
2012-05-14 02:47 PDT, Jacek Caban
dteller: review+
Details | Diff | Splinter Review

Description Jacek Caban 2012-05-14 02:47:11 PDT
Created attachment 623619 [details] [diff] [review]
fix v1.0

GCC considers direct 64-bit pointer to 32-bit integer as an error and that's what happens with INVALID_HANDLE_VALUE. INVALID_HANDLE_VALUE is of type HANDLE, which is void*, but guaranteed to be 32-bit value. Thus casting is fine, but needs to be done a bit differently. The attached patch changes the cast to use INT_PTR, which is later implicitly casted to 32-bit int.
Comment 1 David Rajchenbach-Teller [:Yoric] (please use "needinfo") 2012-05-14 02:54:58 PDT
Comment on attachment 623619 [details] [diff] [review]
fix v1.0

Fine with me. I assume that you have tested that this does not prevent compilation with VC++?
Comment 2 :Ms2ger (⌚ UTC+1/+2) 2012-05-14 05:06:23 PDT
Comment on attachment 623619 [details] [diff] [review]
fix v1.0

Review of attachment 623619 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/system/OSFileConstants.cpp
@@ +216,5 @@
>    INT_CONSTANT(FILE_ATTRIBUTE_READONLY),
>    INT_CONSTANT(FILE_ATTRIBUTE_TEMPORARY),
>  
>    // SetFilePointer error constant
> +  { "INVALID_HANDLE_VALUE", INT_TO_JSVAL((INT_PTR)INVALID_HANDLE_VALUE) },

This should be INT_PTR(INVALID_HANDLE_VALUE)
Comment 3 Jacek Caban 2012-05-15 03:21:13 PDT
Thanks for the reviews. Yes, I've tested compilation with VC++. Pushed to m-i addressing Ms2ger's comment:

https://hg.mozilla.org/integration/mozilla-inbound/rev/26fd69b1eec3
Comment 4 Ed Morley [:emorley] 2012-05-16 03:56:17 PDT
https://hg.mozilla.org/mozilla-central/rev/26fd69b1eec3

Note You need to log in before you can comment on or make changes to this bug.