Last Comment Bug 776902 - nsFilePicker nullptr related build error with vc11
: nsFilePicker nullptr related build error with vc11
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Widget: Win32 (show other bugs)
: Trunk
: x86_64 Windows 7
: -- normal (vote)
: mozilla17
Assigned To: Nobody; OK to take it and work on it
:
: Jim Mathies [:jimm]
Mentors:
Depends on:
Blocks: 626472 VC11
  Show dependency treegraph
 
Reported: 2012-07-24 06:43 PDT by Jim Mathies [:jimm]
Modified: 2012-07-26 05:13 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (2.02 KB, patch)
2012-07-24 07:07 PDT, Jim Mathies [:jimm]
netzen: review+
Details | Diff | Splinter Review

Description Jim Mathies [:jimm] 2012-07-24 06:43:03 PDT
nsFilePicker.cpp
f:/Mozilla/firefox/mc/widget/windows/nsFilePicker.cpp(542) : error C2440: '=' : cannot convert from 'nullptr' to 'int'
        A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
f:/Mozilla/firefox/mc/widget/windows/nsFilePicker.cpp(551) : error C2440: '=' : cannot convert from 'nullptr' to 'LPARAM'
        A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
f:/Mozilla/firefox/mc/widget/windows/nsFilePicker.cpp(780) : error C2440: '=' : cannot convert from 'nullptr' to 'WCHAR'
        A native nullptr can only be converted to bool or, using reinterpret_cast, to an integral type
make[4]: *** [nsFilePicker.obj] Error 2
Comment 1 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-07-24 06:51:56 PDT
Should be 0, 0, L'\0' respectively.  Making them all 0 would work too.
Comment 2 Jim Mathies [:jimm] 2012-07-24 07:07:41 PDT
Created attachment 645286 [details] [diff] [review]
patch
Comment 3 Jim Mathies [:jimm] 2012-07-24 07:08:20 PDT
I made use of NULL instead for the string pointers.
Comment 4 Jim Mathies [:jimm] 2012-07-24 07:08:52 PDT
(and function pointers)
Comment 5 Aryeh Gregor (:ayg) (next working March 28-April 26) 2012-07-24 07:26:10 PDT
(In reply to Jim Mathies [:jimm] from comment #3)
> I made use of NULL instead for the string pointers.

There are no string pointers or function pointers here.  The first one is an int, and the last is a WCHAR (= wchar_t).  NULL will work too because it's defined to be 0 anyway, but IMO it's clearer only to use it for pointers.
Comment 6 Jim Mathies [:jimm] 2012-07-24 07:38:18 PDT
Ah, your right, iImage is an int. lpfn is a function though, which is fine with NULL, and the NULL terminator I can make a '\0'.
Comment 7 Brian R. Bondy [:bbondy] 2012-07-24 07:44:54 PDT
Comment on attachment 645286 [details] [diff] [review]
patch

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

::: widget/windows/nsFilePicker.cpp
@@ +538,5 @@
>    browserInfo.pszDisplayName = (LPWSTR)dirBuffer;
>    browserInfo.lpszTitle      = mTitle.get();
>    browserInfo.ulFlags        = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
>    browserInfo.hwndOwner      = adtw.get(); 
> +  browserInfo.iImage         = NULL;

This is an index so you might as well use 0 here too.

@@ +776,5 @@
>            if (GetLastError() == ERROR_INVALID_PARAMETER ||
>                CommDlgExtendedError() == FNERR_INVALIDFILENAME) {
>              // Probably the default file name is too long or contains illegal
>              // characters. Try again, without a starting file name.
> +            ofn.lpstrFile[0] = NULL;

Agreed with previous comment. But use L'\0'
Comment 8 Ed Morley [:emorley] 2012-07-26 05:13:48 PDT
https://hg.mozilla.org/mozilla-central/rev/34e8766ffabd

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