Note: There are a few cases of duplicates in user autocompletion which are being worked on.

nsFilePicker nullptr related build error with vc11

RESOLVED FIXED in mozilla17

Status

()

Core
Widget: Win32
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jimm, Unassigned)

Tracking

Trunk
mozilla17
x86_64
Windows 7
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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
Should be 0, 0, L'\0' respectively.  Making them all 0 would work too.
(Reporter)

Comment 2

5 years ago
Created attachment 645286 [details] [diff] [review]
patch
(Reporter)

Comment 3

5 years ago
I made use of NULL instead for the string pointers.
(Reporter)

Comment 4

5 years ago
(and function pointers)
(Reporter)

Updated

5 years ago
Attachment #645286 - Flags: review?(netzen)
(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.
Attachment #645286 - Flags: review?(netzen) → review+
(Reporter)

Comment 6

5 years ago
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 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

5 years ago
https://hg.mozilla.org/mozilla-central/rev/34e8766ffabd
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.