Bug 784739 - Switch from NULL to nullptr in widget/windows/ (1/3); r=ehsan

--HG--
extra : rebase_source : 02a90b963833b2e9bf2938b32f401746730adf84
This commit is contained in:
Birunthan Mohanathas 2013-10-08 14:48:02 -04:00
parent 8b865229fc
commit 123d79927e
16 changed files with 172 additions and 157 deletions

View File

@ -125,7 +125,7 @@ RecvAudioSessionData(const nsID& aID,
aIconPath);
}
AudioSession* AudioSession::sService = NULL;
AudioSession* AudioSession::sService = nullptr;
AudioSession::AudioSession()
{
@ -187,7 +187,7 @@ AudioSession::Start()
// Don't check for errors in case something already initialized COM
// on this thread.
CoInitialize(NULL);
CoInitialize(nullptr);
if (mState == UNINITIALIZED) {
mState = FAILED;
@ -215,7 +215,7 @@ AudioSession::Start()
// XXXkhuey we should provide a way for a xulrunner app to specify an icon
// that's not in the product binary.
::GetModuleFileNameW(NULL, buffer, MAX_PATH);
::GetModuleFileNameW(nullptr, buffer, MAX_PATH);
nsCOMPtr<nsIUUIDGenerator> uuidgen =
do_GetService("@mozilla.org/uuid-generator;1");
@ -230,7 +230,7 @@ AudioSession::Start()
nsRefPtr<IMMDeviceEnumerator> enumerator;
hr = ::CoCreateInstance(CLSID_MMDeviceEnumerator,
NULL,
nullptr,
CLSCTX_ALL,
IID_IMMDeviceEnumerator,
getter_AddRefs(enumerator));
@ -250,31 +250,31 @@ AudioSession::Start()
nsRefPtr<IAudioSessionManager> manager;
hr = device->Activate(IID_IAudioSessionManager,
CLSCTX_ALL,
NULL,
nullptr,
getter_AddRefs(manager));
if (FAILED(hr))
return NS_ERROR_FAILURE;
hr = manager->GetAudioSessionControl(NULL,
hr = manager->GetAudioSessionControl(nullptr,
FALSE,
getter_AddRefs(mAudioSessionControl));
if (FAILED(hr))
return NS_ERROR_FAILURE;
hr = mAudioSessionControl->SetGroupingParam((LPCGUID)&mSessionGroupingParameter,
NULL);
nullptr);
if (FAILED(hr)) {
StopInternal();
return NS_ERROR_FAILURE;
}
hr = mAudioSessionControl->SetDisplayName(mDisplayName.get(), NULL);
hr = mAudioSessionControl->SetDisplayName(mDisplayName.get(), nullptr);
if (FAILED(hr)) {
StopInternal();
return NS_ERROR_FAILURE;
}
hr = mAudioSessionControl->SetIconPath(mIconPath.get(), NULL);
hr = mAudioSessionControl->SetIconPath(mIconPath.get(), nullptr);
if (FAILED(hr)) {
StopInternal();
return NS_ERROR_FAILURE;
@ -297,7 +297,7 @@ AudioSession::StopInternal()
static const nsID blankId = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} };
if (mAudioSessionControl) {
mAudioSessionControl->SetGroupingParam((LPCGUID)&blankId, NULL);
mAudioSessionControl->SetGroupingParam((LPCGUID)&blankId, nullptr);
mAudioSessionControl->UnregisterAudioSessionNotification(this);
mAudioSessionControl = nullptr;
}

View File

@ -155,7 +155,8 @@ static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, nsAS
case REG_DWORD: {
// We only use this for vram size
dwcbData = sizeof(dValue);
result = RegQueryValueExW(key, keyName, NULL, &resultType, (LPBYTE)&dValue, &dwcbData);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)&dValue, &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_DWORD) {
dValue = dValue / 1024 / 1024;
destString.AppendInt(int32_t(dValue));
@ -169,7 +170,8 @@ static nsresult GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, nsAS
WCHAR wCharValue[1024];
dwcbData = sizeof(wCharValue);
result = RegQueryValueExW(key, keyName, NULL, &resultType, (LPBYTE)wCharValue, &dwcbData);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
(LPBYTE)wCharValue, &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ) {
// This bit here could probably be cleaner.
bool isValid = false;
@ -256,7 +258,7 @@ GfxInfo::Init()
mDeviceKeyDebug = NS_LITERAL_STRING("PrimarySearch");
while (EnumDisplayDevicesW(NULL, deviceIndex, &displayDevice, 0)) {
while (EnumDisplayDevicesW(nullptr, deviceIndex, &displayDevice, 0)) {
if (displayDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) {
mDeviceKeyDebug = NS_LITERAL_STRING("NullSearch");
break;
@ -264,10 +266,10 @@ GfxInfo::Init()
deviceIndex++;
}
// make sure the string is NULL terminated
// make sure the string is nullptr terminated
if (wcsnlen(displayDevice.DeviceKey, ArrayLength(displayDevice.DeviceKey))
== ArrayLength(displayDevice.DeviceKey)) {
// we did not find a NULL
// we did not find a nullptr
return rv;
}
@ -290,7 +292,7 @@ GfxInfo::Init()
// provides features and functionaltiy that can give a good D3D10 +
// D2D + DirectWrite experience emulated via a software GPU.
//
// Unfortunately, the Device ID is NULL, and we can't enumerate
// Unfortunately, the Device ID is nullptr, and we can't enumerate
// it using the setup infrastructure (SetupDiGetClassDevsW below
// will return INVALID_HANDLE_VALUE).
if (mWindowsVersion == gfxWindowsPlatform::kWindows8 &&
@ -311,7 +313,7 @@ GfxInfo::Init()
}
/* create a device information set composed of the current display device */
HDEVINFO devinfo = SetupDiGetClassDevsW(NULL, mDeviceID.get(), NULL,
HDEVINFO devinfo = SetupDiGetClassDevsW(nullptr, mDeviceID.get(), nullptr,
DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
if (devinfo != INVALID_HANDLE_VALUE) {
@ -330,17 +332,18 @@ GfxInfo::Init()
if (SetupDiGetDeviceRegistryPropertyW(devinfo,
&devinfoData,
SPDRP_DRIVER,
NULL,
nullptr,
(PBYTE)value,
sizeof(value),
NULL)) {
nullptr)) {
nsAutoString driverKey(driverKeyPre);
driverKey += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.BeginReading(), 0, KEY_QUERY_VALUE, &key);
if (result == ERROR_SUCCESS) {
/* we've found the driver we're looking for */
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS) {
mDriverVersion = value;
} else {
@ -348,7 +351,8 @@ GfxInfo::Init()
mDriverVersion.AssignLiteral("0.0.0.0");
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS) {
mDriverDate = value;
} else {
@ -375,7 +379,8 @@ GfxInfo::Init()
HRESULT hresult = CLSIDFromString(L"{1CA05180-A699-450A-9A0C-DE4FBE3DDD89}",
&GUID_DISPLAY_DEVICE_ARRIVAL);
if (hresult == NOERROR) {
devinfo = SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL, NULL, NULL,
devinfo = SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL,
nullptr, nullptr,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
if (devinfo != INVALID_HANDLE_VALUE) {
@ -401,16 +406,17 @@ GfxInfo::Init()
if (SetupDiGetDeviceRegistryPropertyW(devinfo,
&devinfoData,
SPDRP_DRIVER,
NULL,
nullptr,
(PBYTE)value,
sizeof(value),
NULL)) {
nullptr)) {
nsAutoString driverKey2(driverKeyPre);
driverKey2 += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey2.BeginReading(), 0, KEY_QUERY_VALUE, &key);
if (result == ERROR_SUCCESS) {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"MatchingDeviceId", nullptr,
nullptr, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
continue;
}
@ -435,24 +441,28 @@ GfxInfo::Init()
continue;
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
driverVersion2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
driverDate2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"Device Description", nullptr,
nullptr, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDesc", NULL, NULL, (LPBYTE)value, &dwcbData);
result = RegQueryValueExW(key, L"DriverDesc", nullptr, nullptr,
(LPBYTE)value, &dwcbData);
}
RegCloseKey(key);
if (result == ERROR_SUCCESS) {

View File

@ -31,13 +31,13 @@ CEnumFormatEtc::~CEnumFormatEtc()
STDMETHODIMP
CEnumFormatEtc::QueryInterface(REFIID riid, LPVOID *ppv)
{
*ppv = NULL;
*ppv = nullptr;
if (IsEqualIID(riid, IID_IUnknown) ||
IsEqualIID(riid, IID_IEnumFORMATETC))
*ppv = (LPVOID)this;
if (*ppv == NULL)
if (*ppv == nullptr)
return E_NOINTERFACE;
// AddRef any interface we'll return.

View File

@ -46,9 +46,9 @@ JumpListBuilder::JumpListBuilder() :
mMaxItems(0),
mHasCommit(false)
{
::CoInitialize(NULL);
::CoInitialize(nullptr);
CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER,
CoCreateInstance(CLSID_DestinationList, nullptr, CLSCTX_INPROC_SERVER,
IID_ICustomDestinationList, getter_AddRefs(mJumpListMgr));
// Make a lazy thread for any IO
@ -257,8 +257,9 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray *items,
HRESULT hr;
nsRefPtr<IObjectCollection> collection;
hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER,
IID_IObjectCollection, getter_AddRefs(collection));
hr = CoCreateInstance(CLSID_EnumerableObjectCollection, nullptr,
CLSCTX_INPROC_SERVER, IID_IObjectCollection,
getter_AddRefs(collection));
if (FAILED(hr))
return NS_ERROR_UNEXPECTED;
@ -322,8 +323,9 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray *items,
HRESULT hr;
nsRefPtr<IObjectCollection> collection;
hr = CoCreateInstance(CLSID_EnumerableObjectCollection, NULL, CLSCTX_INPROC_SERVER,
IID_IObjectCollection, getter_AddRefs(collection));
hr = CoCreateInstance(CLSID_EnumerableObjectCollection, nullptr,
CLSCTX_INPROC_SERVER, IID_IObjectCollection,
getter_AddRefs(collection));
if (FAILED(hr))
return NS_ERROR_UNEXPECTED;

View File

@ -286,7 +286,7 @@ nsresult JumpListSeparator::GetSeparator(nsRefPtr<IShellLinkW>& aShellLink)
IShellLinkW* psl;
// Create a IShellLink.
hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLinkW, (LPVOID*)&psl);
if (FAILED(hr))
return NS_ERROR_UNEXPECTED;
@ -338,7 +338,7 @@ nsresult JumpListShortcut::GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
NS_ENSURE_SUCCESS(rv, rv);
// Create a IShellLink
hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLinkW, (LPVOID*)&psl);
if (FAILED(hr))
return NS_ERROR_UNEXPECTED;
@ -476,7 +476,7 @@ nsresult JumpListShortcut::GetJumpListShortcut(IShellLinkW *pLink, nsCOMPtr<nsIJ
PRUnichar buf[MAX_PATH];
// Path
hres = pLink->GetPath((LPWSTR)&buf, MAX_PATH, NULL, SLGP_UNCPRIORITY);
hres = pLink->GetPath((LPWSTR)&buf, MAX_PATH, nullptr, SLGP_UNCPRIORITY);
if (FAILED(hres))
return NS_ERROR_INVALID_ARG;
@ -563,7 +563,8 @@ nsresult JumpListLink::GetShellItem(nsCOMPtr<nsIJumpListItem>& item, nsRefPtr<IS
// Create the IShellItem
if (FAILED(WinUtils::SHCreateItemFromParsingName(
NS_ConvertASCIItoUTF16(spec).get(), NULL, IID_PPV_ARGS(&psi)))) {
NS_ConvertASCIItoUTF16(spec).get(),
nullptr, IID_PPV_ARGS(&psi)))) {
return NS_ERROR_INVALID_ARG;
}
@ -599,7 +600,7 @@ nsresult JumpListLink::GetJumpListLink(IShellItem *pItem, nsCOMPtr<nsIJumpListLi
// We assume for now these are URI links, but through properties we could
// query and create other types.
nsresult rv;
LPWSTR lpstrName = NULL;
LPWSTR lpstrName = nullptr;
if (SUCCEEDED(pItem->GetDisplayName(SIGDN_URL, &lpstrName))) {
nsCOMPtr<nsIURI> uri;

View File

@ -2234,7 +2234,7 @@ KeyboardLayout::SynthesizeNativeKeyEvent(nsWindowBase* aWidget,
const nsAString& aCharacters,
const nsAString& aUnmodifiedCharacters)
{
UINT keyboardLayoutListCount = ::GetKeyboardLayoutList(0, NULL);
UINT keyboardLayoutListCount = ::GetKeyboardLayoutList(0, nullptr);
NS_ASSERTION(keyboardLayoutListCount > 0,
"One keyboard layout must be installed at least");
HKL keyboardLayoutListBuff[50];
@ -2248,7 +2248,7 @@ KeyboardLayout::SynthesizeNativeKeyEvent(nsWindowBase* aWidget,
nsPrintfCString layoutName("%08x", aNativeKeyboardLayout);
HKL loadedLayout = LoadKeyboardLayoutA(layoutName.get(), KLF_NOTELLSHELL);
if (loadedLayout == NULL) {
if (loadedLayout == nullptr) {
if (keyboardLayoutListBuff != keyboardLayoutList) {
delete [] keyboardLayoutList;
}

View File

@ -56,7 +56,7 @@ LSPAnnotationGatherer::Run()
DWORD size = 0;
int err;
// Get the size of the buffer we need
if (SOCKET_ERROR != WSCEnumProtocols(NULL, NULL, &size, &err) ||
if (SOCKET_ERROR != WSCEnumProtocols(nullptr, nullptr, &size, &err) ||
err != WSAENOBUFS) {
// Er, what?
NS_NOTREACHED("WSCEnumProtocols suceeded when it should have failed ...");
@ -67,7 +67,7 @@ LSPAnnotationGatherer::Run()
WSAPROTOCOL_INFOW* providers =
reinterpret_cast<WSAPROTOCOL_INFOW*>(byteArray.get());
int n = WSCEnumProtocols(NULL, providers, &size, &err);
int n = WSCEnumProtocols(nullptr, providers, &size, &err);
if (n == SOCKET_ERROR) {
// Lame. We provided the right size buffer; we'll just give up now.
NS_WARNING("Could not get LSP list");

View File

@ -78,7 +78,7 @@ nsAppShell::Init()
NS_ASSERTION(sTaskbarButtonCreatedMsg, "Could not register taskbar button creation message");
WNDCLASSW wc;
HINSTANCE module = GetModuleHandle(NULL);
HINSTANCE module = GetModuleHandle(nullptr);
const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass";
if (!GetClassInfoW(module, kWindowClass, &wc)) {
@ -87,16 +87,16 @@ nsAppShell::Init()
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = module;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH) NULL;
wc.lpszMenuName = (LPCWSTR) NULL;
wc.hIcon = nullptr;
wc.hCursor = nullptr;
wc.hbrBackground = (HBRUSH) nullptr;
wc.lpszMenuName = (LPCWSTR) nullptr;
wc.lpszClassName = kWindowClass;
RegisterClassW(&wc);
}
mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow",
0, 0, 0, 10, 10, NULL, NULL, module, NULL);
0, 0, 0, 10, 10, nullptr, nullptr, module, nullptr);
NS_ENSURE_STATE(mEventWnd);
return nsBaseAppShell::Init();
@ -191,7 +191,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
// internal message because it may make different modifier key state or
// mouse cursor position between them.
if (mozilla::widget::MouseScrollHandler::IsWaitingInternalMessage()) {
gotMessage = WinUtils::PeekMessage(&msg, NULL, MOZ_WM_MOUSEWHEEL_FIRST,
gotMessage = WinUtils::PeekMessage(&msg, nullptr, MOZ_WM_MOUSEWHEEL_FIRST,
MOZ_WM_MOUSEWHEEL_LAST, PM_REMOVE);
NS_ASSERTION(gotMessage,
"waiting internal wheel message, but it has not come");
@ -199,7 +199,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
}
if (!gotMessage) {
gotMessage = WinUtils::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
gotMessage = WinUtils::PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE);
uiMessage =
(msg.message >= WM_KEYFIRST && msg.message <= WM_IME_KEYLAST) ||
(msg.message >= NS_WM_IMEFIRST && msg.message <= NS_WM_IMELAST) ||

View File

@ -22,7 +22,7 @@ class nsAppShell : public nsBaseAppShell
{
public:
nsAppShell() :
mEventWnd(NULL),
mEventWnd(nullptr),
mNativeCallbackPending(false),
mLastNativeEventScheduledMutex("nsAppShell::mLastNativeEventScheduledMutex")
{}

View File

@ -257,12 +257,12 @@ NS_IMETHODIMP nsClipboard::SetNativeClipboardData ( int32_t aWhichClipboard )
}
IDataObject * dataObj;
if ( NS_SUCCEEDED(CreateNativeDataObject(mTransferable, &dataObj, NULL)) ) { // this add refs dataObj
if ( NS_SUCCEEDED(CreateNativeDataObject(mTransferable, &dataObj, nullptr)) ) { // this add refs dataObj
::OleSetClipboard(dataObj);
dataObj->Release();
} else {
// Clear the native clipboard
::OleSetClipboard(NULL);
::OleSetClipboard(nullptr);
}
mIgnoreEmptyNotification = false;
@ -279,7 +279,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
// precaution, allocate an extra 2 bytes (but don't report them!) and
// null them out to ensure that all of our strlen calls will succeed.
nsresult result = NS_ERROR_FAILURE;
if (aHGBL != NULL) {
if (aHGBL != nullptr) {
LPSTR lpStr = (LPSTR) GlobalLock(aHGBL);
DWORD allocSize = GlobalSize(aHGBL);
char* data = static_cast<char*>(nsMemory::Alloc(allocSize + sizeof(PRUnichar)));
@ -305,16 +305,17 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
nullptr,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPWSTR) &lpMsgBuf,
0,
NULL
nullptr
);
// Display the string.
MessageBoxW( NULL, (LPCWSTR) lpMsgBuf, L"GetLastError", MB_OK|MB_ICONINFORMATION );
MessageBoxW( nullptr, (LPCWSTR) lpMsgBuf, L"GetLastError",
MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
@ -488,7 +489,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT
// if there really are multiple drag items.
HDROP dropFiles = (HDROP) GlobalLock(stm.hGlobal);
UINT numFiles = ::DragQueryFileW(dropFiles, 0xFFFFFFFF, NULL, 0);
UINT numFiles = ::DragQueryFileW(dropFiles, 0xFFFFFFFF, nullptr, 0);
NS_ASSERTION ( numFiles > 0, "File drop flavor, but no files...hmmmm" );
NS_ASSERTION ( aIndex < numFiles, "Asked for a file index out of range of list" );
if (numFiles > 0) {
@ -954,7 +955,7 @@ nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
// has the clipboard open. So to avoid this race condition for OpenClipboard
// we do not empty the clipboard when we're setting it.
if (aWhichClipboard == kGlobalClipboard && !mEmptyingForSetData) {
OleSetClipboard(NULL);
OleSetClipboard(nullptr);
}
return nsBaseClipboard::EmptyClipboard(aWhichClipboard);
}

View File

@ -103,7 +103,7 @@ AsyncColorChooser::Run()
static COLORREF customColors[16] = {0} ;
AutoDestroyTmpWindow adtw((HWND) (mParentWidget.get() ?
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : NULL));
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
options.lStructSize = sizeof(options);
options.hwndOwner = adtw.get();

View File

@ -75,7 +75,7 @@ nsresult nsDataObj::CStream::Init(nsIURI *pSourceURI)
// IUnknown and nsIStreamListener.
STDMETHODIMP nsDataObj::CStream::QueryInterface(REFIID refiid, void** ppvResult)
{
*ppvResult = NULL;
*ppvResult = nullptr;
if (IID_IUnknown == refiid ||
refiid == IID_IStream)
@ -83,7 +83,7 @@ STDMETHODIMP nsDataObj::CStream::QueryInterface(REFIID refiid, void** ppvResult)
*ppvResult = this;
}
if (NULL != *ppvResult)
if (nullptr != *ppvResult)
{
((LPUNKNOWN)*ppvResult)->AddRef();
return S_OK;
@ -102,7 +102,7 @@ nsDataObj::CStream::OnDataAvailable(nsIRequest *aRequest,
{
// Extend the write buffer for the incoming data.
uint8_t* buffer = mChannelData.AppendElements(aCount);
if (buffer == NULL)
if (buffer == nullptr)
return NS_ERROR_OUT_OF_MEMORY;
NS_ASSERTION((mChannelData.Length() == (aOffset + aCount)),
"stream length mismatch w/write buffer");
@ -215,7 +215,7 @@ STDMETHODIMP nsDataObj::CStream::Seek(LARGE_INTEGER nMove,
DWORD dwOrigin,
ULARGE_INTEGER* nNewPos)
{
if (nNewPos == NULL)
if (nNewPos == nullptr)
return STG_E_INVALIDPOINTER;
if (nMove.LowPart == 0 && nMove.HighPart == 0 &&
@ -237,7 +237,7 @@ STDMETHODIMP nsDataObj::CStream::SetSize(ULARGE_INTEGER nNewSize)
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Stat(STATSTG* statstg, DWORD dwFlags)
{
if (statstg == NULL)
if (statstg == nullptr)
return STG_E_INVALIDPOINTER;
if (!mChannel || NS_FAILED(WaitForCompletion()))
@ -394,7 +394,7 @@ nsDataObj::~nsDataObj()
//-----------------------------------------------------
STDMETHODIMP nsDataObj::QueryInterface(REFIID riid, void** ppv)
{
*ppv=NULL;
*ppv=nullptr;
if ( (IID_IUnknown == riid) || (IID_IDataObject == riid) ) {
*ppv = this;
@ -440,7 +440,7 @@ STDMETHODIMP_(ULONG) nsDataObj::Release()
return AddRef();
}
mCachedTempFile->Remove(false);
mCachedTempFile = NULL;
mCachedTempFile = nullptr;
}
delete this;
@ -494,7 +494,7 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC aFormat, LPSTGMEDIUM pSTM)
&& dfInx < mDataFlavors.Length()) {
nsCString& df = mDataFlavors.ElementAt(dfInx);
if (FormatsMatch(fe, *aFormat)) {
pSTM->pUnkForRelease = NULL; // caller is responsible for deleting this data
pSTM->pUnkForRelease = nullptr; // caller is responsible for deleting this data
CLIPFORMAT format = aFormat->cfFormat;
switch(format) {
@ -618,9 +618,9 @@ STDMETHODIMP nsDataObj::SetData(LPFORMATETC aFormat, LPSTGMEDIUM aMedium, BOOL s
bool
nsDataObj::LookupArbitraryFormat(FORMATETC *aFormat, LPDATAENTRY *aDataEntry, BOOL aAddorUpdate)
{
*aDataEntry = NULL;
*aDataEntry = nullptr;
if (aFormat->ptd != NULL)
if (aFormat->ptd != nullptr)
return false;
// See if it's already in our list. If so return the data entry.
@ -711,10 +711,10 @@ STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum)
case DATADIR_SET:
// fall through
default:
*ppEnum = NULL;
*ppEnum = nullptr;
} // switch
if (NULL == *ppEnum)
if (nullptr == *ppEnum)
return E_FAIL;
(*ppEnum)->Reset();
@ -949,7 +949,7 @@ CreateFilenameFromTextA(nsString & aText, const char * aExtension,
do {
currLen = WideCharToMultiByte(CP_ACP,
WC_COMPOSITECHECK|WC_DEFAULTCHAR,
aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, nullptr);
}
while (currLen == 0 && textLen > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
if (currLen > 0 && textLen > 0) {
@ -1206,8 +1206,8 @@ HRESULT nsDataObj::GetPreferredDropEffect ( FORMATETC& aFE, STGMEDIUM& aSTG )
{
HRESULT res = S_OK;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
HGLOBAL hGlobalMemory = NULL;
aSTG.pUnkForRelease = nullptr;
HGLOBAL hGlobalMemory = nullptr;
hGlobalMemory = ::GlobalAlloc(GMEM_MOVEABLE, sizeof(DWORD));
if (hGlobalMemory) {
DWORD* pdw = (DWORD*) GlobalLock(hGlobalMemory);
@ -1231,7 +1231,7 @@ HRESULT nsDataObj::GetPreferredDropEffect ( FORMATETC& aFE, STGMEDIUM& aSTG )
//-----------------------------------------------------
HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGMEDIUM& aSTG)
{
void* data = NULL;
void* data = nullptr;
uint32_t len;
// if someone asks for text/plain, look up text/unicode instead in the transferable.
@ -1251,10 +1251,10 @@ HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGME
if ( !data )
return E_FAIL;
HGLOBAL hGlobalMemory = NULL;
HGLOBAL hGlobalMemory = nullptr;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
aSTG.pUnkForRelease = nullptr;
// We play games under the hood and advertise flavors that we know we
// can support, only they require a bit of conversion or munging of the data.
@ -1367,7 +1367,7 @@ HRESULT nsDataObj::DropFile(FORMATETC& aFE, STGMEDIUM& aSTG)
return E_FAIL;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
aSTG.pUnkForRelease = nullptr;
nsAutoString path;
rv = file->GetPath(path);
@ -1375,7 +1375,7 @@ HRESULT nsDataObj::DropFile(FORMATETC& aFE, STGMEDIUM& aSTG)
return E_FAIL;
uint32_t allocLen = path.Length() + 2;
HGLOBAL hGlobalMemory = NULL;
HGLOBAL hGlobalMemory = nullptr;
PRUnichar *dest;
hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) +
@ -1512,12 +1512,12 @@ HRESULT nsDataObj::DropImage(FORMATETC& aFE, STGMEDIUM& aSTG)
return E_FAIL;
// Two null characters are needed to terminate the file name list.
HGLOBAL hGlobalMemory = NULL;
HGLOBAL hGlobalMemory = nullptr;
uint32_t allocLen = path.Length() + 2;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
aSTG.pUnkForRelease = nullptr;
hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar));
if (!hGlobalMemory)
@ -1585,7 +1585,7 @@ HRESULT nsDataObj::DropTempFile(FORMATETC& aFE, STGMEDIUM& aSTG)
if (NS_FAILED(rv))
return E_FAIL;
IStream *pStream = NULL;
IStream *pStream = nullptr;
nsDataObj::CreateStream(&pStream);
NS_ENSURE_TRUE(pStream, E_FAIL);
@ -1615,10 +1615,10 @@ HRESULT nsDataObj::DropTempFile(FORMATETC& aFE, STGMEDIUM& aSTG)
uint32_t allocLen = path.Length() + 2;
// Two null characters are needed to terminate the file name list.
HGLOBAL hGlobalMemory = NULL;
HGLOBAL hGlobalMemory = nullptr;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
aSTG.pUnkForRelease = nullptr;
hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar));
if (!hGlobalMemory)
@ -2108,14 +2108,14 @@ HRESULT nsDataObj::GetFileDescriptor_IStreamW(FORMATETC& aFE, STGMEDIUM& aSTG)
HRESULT nsDataObj::GetFileContents_IStream(FORMATETC& aFE, STGMEDIUM& aSTG)
{
IStream *pStream = NULL;
IStream *pStream = nullptr;
nsDataObj::CreateStream(&pStream);
NS_ENSURE_TRUE(pStream, E_FAIL);
aSTG.tymed = TYMED_ISTREAM;
aSTG.pstm = pStream;
aSTG.pUnkForRelease = NULL;
aSTG.pUnkForRelease = nullptr;
return S_OK;
}
@ -2125,7 +2125,7 @@ void nsDataObj::RemoveTempFile(nsITimer* aTimer, void* aClosure)
nsDataObj *timedDataObj = static_cast<nsDataObj *>(aClosure);
if (timedDataObj->mCachedTempFile) {
timedDataObj->mCachedTempFile->Remove(false);
timedDataObj->mCachedTempFile = NULL;
timedDataObj->mCachedTempFile = nullptr;
}
timedDataObj->Release();
}

View File

@ -38,7 +38,7 @@ nsDataObjCollection::~nsDataObjCollection()
// IUnknown interface methods - see iunknown.h for documentation
STDMETHODIMP nsDataObjCollection::QueryInterface(REFIID riid, void** ppv)
{
*ppv=NULL;
*ppv=nullptr;
if ( (IID_IUnknown == riid) || (IID_IDataObject == riid) ) {
*ppv = static_cast<IDataObject*>(this);
@ -252,7 +252,7 @@ HRESULT nsDataObjCollection::GetFile(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
}
// Now we need to pull out the filename
PRUnichar* buffer = (PRUnichar*)GlobalLock(workingmedium.hGlobal);
if (buffer == NULL)
if (buffer == nullptr)
return E_FAIL;
buffer += sizeof(DROPFILES)/sizeof(PRUnichar);
filename = buffer;
@ -261,7 +261,7 @@ HRESULT nsDataObjCollection::GetFile(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
// Now put the filename into our buffer
alloclen = (filename.Length() + 1) * sizeof(PRUnichar);
hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen, GHND);
if (hGlobalMemory == NULL)
if (hGlobalMemory == nullptr)
return E_FAIL;
realbuffer = (PRUnichar*)((char*)GlobalLock(hGlobalMemory) + buffersize);
if (!realbuffer)
@ -285,7 +285,7 @@ HRESULT nsDataObjCollection::GetFile(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
GlobalUnlock(hGlobalMemory);
// Finally fill out the STGMEDIUM struct
pSTM->tymed = TYMED_HGLOBAL;
pSTM->pUnkForRelease = NULL; // Caller gets to free the data
pSTM->pUnkForRelease = nullptr; // Caller gets to free the data
pSTM->hGlobal = hGlobalMemory;
return S_OK;
}
@ -316,7 +316,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
}
// Now we need to pull out the text
char* buffer = (char*)GlobalLock(workingmedium.hGlobal);
if (buffer == NULL)
if (buffer == nullptr)
return E_FAIL;
text = buffer;
GlobalUnlock(workingmedium.hGlobal);
@ -325,7 +325,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
alloclen = text.Length();
hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen,
GHND);
if (hGlobalMemory == NULL)
if (hGlobalMemory == nullptr)
return E_FAIL;
buffer = ((char*)GlobalLock(hGlobalMemory) + buffersize);
if (!buffer)
@ -336,7 +336,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
buffersize += alloclen;
}
pSTM->tymed = TYMED_HGLOBAL;
pSTM->pUnkForRelease = NULL; // Caller gets to free the data
pSTM->pUnkForRelease = nullptr; // Caller gets to free the data
pSTM->hGlobal = hGlobalMemory;
return S_OK;
}
@ -356,7 +356,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
}
// Now we need to pull out the text
PRUnichar* buffer = (PRUnichar*)GlobalLock(workingmedium.hGlobal);
if (buffer == NULL)
if (buffer == nullptr)
return E_FAIL;
text = buffer;
GlobalUnlock(workingmedium.hGlobal);
@ -365,7 +365,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
alloclen = text.Length() * sizeof(PRUnichar);
hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen,
GHND);
if (hGlobalMemory == NULL)
if (hGlobalMemory == nullptr)
return E_FAIL;
buffer = (PRUnichar*)((char*)GlobalLock(hGlobalMemory) + buffersize);
if (!buffer)
@ -376,7 +376,7 @@ HRESULT nsDataObjCollection::GetText(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
buffersize += alloclen;
}
pSTM->tymed = TYMED_HGLOBAL;
pSTM->pUnkForRelease = NULL; // Caller gets to free the data
pSTM->pUnkForRelease = nullptr; // Caller gets to free the data
pSTM->hGlobal = hGlobalMemory;
return S_OK;
}
@ -410,10 +410,10 @@ HRESULT nsDataObjCollection::GetFileDescriptors(LPFORMATETC pFE,
// Now we need to pull out the filedescriptor
FILEDESCRIPTOR* buffer =
(FILEDESCRIPTOR*)((char*)GlobalLock(workingmedium.hGlobal) + sizeof(UINT));
if (buffer == NULL)
if (buffer == nullptr)
return E_FAIL;
hGlobalMemory = ::GlobalReAlloc(hGlobalMemory, buffersize + alloclen, GHND);
if (hGlobalMemory == NULL)
if (hGlobalMemory == nullptr)
return E_FAIL;
FILEGROUPDESCRIPTOR* realbuffer =
(FILEGROUPDESCRIPTOR*)GlobalLock(hGlobalMemory);
@ -428,7 +428,7 @@ HRESULT nsDataObjCollection::GetFileDescriptors(LPFORMATETC pFE,
buffersize += alloclen;
}
pSTM->tymed = TYMED_HGLOBAL;
pSTM->pUnkForRelease = NULL; // Caller gets to free the data
pSTM->pUnkForRelease = nullptr; // Caller gets to free the data
pSTM->hGlobal = hGlobalMemory;
return S_OK;
}

View File

@ -145,7 +145,7 @@ nsDeviceContextSpecWin::nsDeviceContextSpecWin()
{
mDriverName = nullptr;
mDeviceName = nullptr;
mDevMode = NULL;
mDevMode = nullptr;
}
@ -158,13 +158,13 @@ nsDeviceContextSpecWin::~nsDeviceContextSpecWin()
{
SetDeviceName(nullptr);
SetDriverName(nullptr);
SetDevMode(NULL);
SetDevMode(nullptr);
nsCOMPtr<nsIPrintSettingsWin> psWin(do_QueryInterface(mPrintSettings));
if (psWin) {
psWin->SetDeviceName(nullptr);
psWin->SetDriverName(nullptr);
psWin->SetDevMode(NULL);
psWin->SetDevMode(nullptr);
}
// Free them, we won't need them for a while
@ -187,10 +187,10 @@ EnumerateNativePrinters(DWORD aWhichPrinters, LPWSTR aPrinterName, bool& aIsFoun
{
DWORD dwSizeNeeded = 0;
DWORD dwNumItems = 0;
LPPRINTER_INFO_2W lpInfo = NULL;
LPPRINTER_INFO_2W lpInfo = nullptr;
// Get buffer size
if (::EnumPrintersW(aWhichPrinters, NULL, 2, NULL, 0, &dwSizeNeeded,
if (::EnumPrintersW(aWhichPrinters, nullptr, 2, nullptr, 0, &dwSizeNeeded,
&dwNumItems)) {
return NS_ERROR_FAILURE;
}
@ -201,7 +201,7 @@ EnumerateNativePrinters(DWORD aWhichPrinters, LPWSTR aPrinterName, bool& aIsFoun
return NS_ERROR_OUT_OF_MEMORY;
}
if (::EnumPrintersW(PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)lpInfo,
if (::EnumPrintersW(PRINTER_ENUM_LOCAL, nullptr, 2, (LPBYTE)lpInfo,
dwSizeNeeded, &dwSizeNeeded, &dwNumItems) == 0) {
free(lpInfo);
return NS_OK;
@ -499,7 +499,7 @@ NS_IMETHODIMP nsDeviceContextSpecWin::GetSurfaceForPrinter(gfxASurface **surface
} else {
if (mDevMode) {
NS_WARN_IF_FALSE(mDriverName, "No driver!");
HDC dc = ::CreateDCW(mDriverName, mDeviceName, NULL, mDevMode);
HDC dc = ::CreateDCW(mDriverName, mDeviceName, nullptr, mDevMode);
// have this surface take over ownership of this DC
newSurface = new gfxWindowsSurface(dc, gfxWindowsSurface::FLAG_TAKE_DC | gfxWindowsSurface::FLAG_FOR_PRINTING);
@ -653,32 +653,32 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett
NS_ENSURE_SUCCESS(rv, rv);
}
HANDLE hPrinter = NULL;
HANDLE hPrinter = nullptr;
BOOL status = ::OpenPrinterW((LPWSTR)(aName),
&hPrinter, NULL);
&hPrinter, nullptr);
if (status) {
LPDEVMODEW pDevMode;
DWORD dwNeeded, dwRet;
// Allocate a buffer of the correct size.
dwNeeded = ::DocumentPropertiesW(NULL, hPrinter,
dwNeeded = ::DocumentPropertiesW(nullptr, hPrinter,
const_cast<wchar_t*>(aName),
NULL, NULL, 0);
nullptr, nullptr, 0);
pDevMode = (LPDEVMODEW)::HeapAlloc (::GetProcessHeap(), HEAP_ZERO_MEMORY, dwNeeded);
if (!pDevMode) return NS_ERROR_FAILURE;
// Get the default DevMode for the printer and modify it for our needs.
dwRet = DocumentPropertiesW(NULL, hPrinter,
dwRet = DocumentPropertiesW(nullptr, hPrinter,
const_cast<wchar_t*>(aName),
pDevMode, NULL, DM_OUT_BUFFER);
pDevMode, nullptr, DM_OUT_BUFFER);
if (dwRet == IDOK && aPS) {
SetupDevModeFromSettings(pDevMode, aPS);
// Sets back the changes we made to the DevMode into the Printer Driver
dwRet = ::DocumentPropertiesW(NULL, hPrinter,
dwRet = ::DocumentPropertiesW(nullptr, hPrinter,
const_cast<wchar_t*>(aName),
pDevMode, pDevMode,
DM_IN_BUFFER | DM_OUT_BUFFER);

View File

@ -117,12 +117,12 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode,
bmih.bV5BlueMask = 0x000000FF;
bmih.bV5AlphaMask = 0xFF000000;
HDC hdcSrc = CreateCompatibleDC(NULL);
void *lpBits = NULL;
HDC hdcSrc = CreateCompatibleDC(nullptr);
void *lpBits = nullptr;
if (hdcSrc) {
psdi->hbmpDragImage =
::CreateDIBSection(hdcSrc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS,
(void**)&lpBits, NULL, 0);
(void**)&lpBits, nullptr, 0);
if (psdi->hbmpDragImage && lpBits) {
memcpy(lpBits,imgSurface->Data(),(bmWidth*bmHeight*4));
}
@ -144,7 +144,7 @@ nsDragService::CreateDragImage(nsIDOMNode *aDOMNode,
DeleteDC(hdcSrc);
}
return psdi->hbmpDragImage != NULL;
return psdi->hbmpDragImage != nullptr;
}
//-------------------------------------------------------------------------
@ -217,7 +217,8 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
// Create a drag image if support is available
IDragSourceHelper *pdsh;
if (SUCCEEDED(CoCreateInstance(CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER,
if (SUCCEEDED(CoCreateInstance(CLSID_DragDropHelper, nullptr,
CLSCTX_INPROC_SERVER,
IID_IDragSourceHelper, (void**)&pdsh))) {
SHDRAGIMAGE sdi;
if (CreateDragImage(aDOMNode, aRegion, &sdi)) {
@ -367,7 +368,7 @@ nsDragService::GetNumDropItems(uint32_t * aNumItems)
STGMEDIUM stm;
if (mDataObject->GetData(&fe2, &stm) == S_OK) {
HDROP hdrop = (HDROP)GlobalLock(stm.hGlobal);
*aNumItems = ::DragQueryFileW(hdrop, 0xFFFFFFFF, NULL, 0);
*aNumItems = ::DragQueryFileW(hdrop, 0xFFFFFFFF, nullptr, 0);
::GlobalUnlock(stm.hGlobal);
::ReleaseStgMedium(&stm);
// Data may be provided later, so assume we have 1 item

View File

@ -69,10 +69,10 @@ class AutoRestoreWorkingPath
{
public:
AutoRestoreWorkingPath() {
DWORD bufferLength = GetCurrentDirectoryW(0, NULL);
DWORD bufferLength = GetCurrentDirectoryW(0, nullptr);
mWorkingPath = new PRUnichar[bufferLength];
if (GetCurrentDirectoryW(bufferLength, mWorkingPath) == 0) {
mWorkingPath = NULL;
mWorkingPath = nullptr;
}
}
@ -83,7 +83,7 @@ public:
}
inline bool HasWorkingPath() const {
return mWorkingPath != NULL;
return mWorkingPath != nullptr;
}
private:
nsAutoArrayPtr<PRUnichar> mWorkingPath;
@ -170,10 +170,10 @@ private:
nsFilePicker::nsFilePicker() :
mSelectedType(1)
, mDlgWnd(NULL)
, mDlgWnd(nullptr)
, mFDECookie(0)
{
CoInitialize(NULL);
CoInitialize(nullptr);
}
nsFilePicker::~nsFilePicker()
@ -190,7 +190,7 @@ NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
NS_IMETHODIMP nsFilePicker::Init(nsIDOMWindow *aParent, const nsAString& aTitle, int16_t aMode)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aParent);
nsIDocShell* docShell = window ? window->GetDocShell() : NULL;
nsIDocShell* docShell = window ? window->GetDocShell() : nullptr;
mLoadContext = do_QueryInterface(docShell);
return nsBaseFilePicker::Init(aParent, aTitle, aMode);
@ -198,13 +198,13 @@ NS_IMETHODIMP nsFilePicker::Init(nsIDOMWindow *aParent, const nsAString& aTitle,
STDMETHODIMP nsFilePicker::QueryInterface(REFIID refiid, void** ppvResult)
{
*ppvResult = NULL;
*ppvResult = nullptr;
if (IID_IUnknown == refiid ||
refiid == IID_IFileDialogEvents) {
*ppvResult = this;
}
if (NULL != *ppvResult) {
if (nullptr != *ppvResult) {
((LPUNKNOWN)*ppvResult)->AddRef();
return S_OK;
}
@ -235,14 +235,14 @@ static void
EnsureWindowVisible(HWND hwnd)
{
// Obtain the monitor which has the largest area of intersection
// with the window, or NULL if there is no intersection.
// with the window, or nullptr if there is no intersection.
HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
if (!monitor) {
// The window is not visible, we should reposition it to the same place as its parent
HWND parentHwnd = GetParent(hwnd);
RECT parentRect;
GetWindowRect(parentHwnd, &parentRect);
SetWindowPos(hwnd, NULL, parentRect.left, parentRect.top, 0, 0,
SetWindowPos(hwnd, nullptr, parentRect.left, parentRect.top, 0, 0,
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
}
}
@ -281,7 +281,7 @@ nsFilePicker::FilePickerHook(HWND hwnd,
nsFilePicker* picker = reinterpret_cast<nsFilePicker*>(pofn->lCustData);
if (picker) {
picker->SetDialogHandle(hwnd);
SetTimer(hwnd, kDialogTimerID, kDialogTimerTimeout, NULL);
SetTimer(hwnd, kDialogTimerID, kDialogTimerTimeout, nullptr);
}
}
break;
@ -316,8 +316,8 @@ nsFilePicker::MultiFilePickerHook(HWND hwnd,
// Finds the child drop down of a File Picker dialog and sets the
// maximum amount of text it can hold when typed in manually.
// A wParam of 0 mean 0x7FFFFFFE characters.
HWND comboBox = FindWindowEx(GetParent(hwnd), NULL,
L"ComboBoxEx32", NULL );
HWND comboBox = FindWindowEx(GetParent(hwnd), nullptr,
L"ComboBoxEx32", nullptr );
if(comboBox)
SendMessage(comboBox, CB_LIMITTEXT, 0, 0);
// Store our nsFilePicker ptr for future use
@ -327,7 +327,7 @@ nsFilePicker::MultiFilePickerHook(HWND hwnd,
reinterpret_cast<nsFilePicker*>(pofn->lCustData);
if (picker) {
picker->SetDialogHandle(hwnd);
SetTimer(hwnd, kDialogTimerID, kDialogTimerTimeout, NULL);
SetTimer(hwnd, kDialogTimerID, kDialogTimerTimeout, nullptr);
}
}
break;
@ -345,7 +345,7 @@ nsFilePicker::MultiFilePickerHook(HWND hwnd,
// Get the required size for the selected files buffer
UINT newBufLength = 0;
int requiredBufLength = CommDlg_OpenSave_GetSpecW(parentHWND,
NULL, 0);
nullptr, 0);
if(requiredBufLength >= 0)
newBufLength += requiredBufLength;
else
@ -356,7 +356,7 @@ nsFilePicker::MultiFilePickerHook(HWND hwnd,
// files. So make room for the directory path. If the user
// selects a single file, it is no harm to add extra space.
requiredBufLength = CommDlg_OpenSave_GetFolderPathW(parentHWND,
NULL, 0);
nullptr, 0);
if(requiredBufLength >= 0)
newBufLength += requiredBufLength;
else
@ -445,7 +445,7 @@ nsFilePicker::OnTypeChange(IFileDialog *pfd)
NS_ERROR("Could not retrieve the IOleWindow interface for IFileDialog.");
return S_OK;
}
HWND hwnd = NULL;
HWND hwnd = nullptr;
win->GetWindow(&hwnd);
if (!hwnd) {
NS_ERROR("Could not retrieve the HWND for IFileDialog.");
@ -488,7 +488,7 @@ nsFilePicker::ClosePickerIfNeeded(bool aIsXPDialog)
if (GetClassNameW(dlgWnd, className, mozilla::ArrayLength(className)) &&
!wcscmp(className, L"#32770") &&
DestroyWindow(dlgWnd)) {
mDlgWnd = NULL;
mDlgWnd = nullptr;
return true;
}
}
@ -528,7 +528,7 @@ nsFilePicker::ShowXPFolderPicker(const nsString& aInitialDir)
dirBuffer[FILE_BUFFER_SIZE-1] = '\0';
AutoDestroyTmpWindow adtw((HWND)(mParentWidget.get() ?
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : NULL));
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
BROWSEINFOW browserInfo = {0};
browserInfo.pidlRoot = nullptr;
@ -546,7 +546,7 @@ nsFilePicker::ShowXPFolderPicker(const nsString& aInitialDir)
browserInfo.lpfn = &BrowseCallbackProc;
} else {
browserInfo.lParam = 0;
browserInfo.lpfn = NULL;
browserInfo.lpfn = nullptr;
}
LPITEMIDLIST list = ::SHBrowseForFolderW(&browserInfo);
@ -574,7 +574,7 @@ bool
nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
{
nsRefPtr<IFileOpenDialog> dialog;
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC,
IID_IFileOpenDialog,
getter_AddRefs(dialog)))) {
aWasInitError = true;
@ -594,7 +594,7 @@ nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
if (!aInitialDir.IsEmpty()) {
nsRefPtr<IShellItem> folder;
if (SUCCEEDED(
WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), NULL,
WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), nullptr,
IID_IShellItem,
getter_AddRefs(folder)))) {
dialog->SetFolder(folder);
@ -602,7 +602,7 @@ nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
}
AutoDestroyTmpWindow adtw((HWND)(mParentWidget.get() ?
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : NULL));
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
// display
nsRefPtr<IShellItem> item;
@ -620,8 +620,8 @@ nsFilePicker::ShowFolderPicker(const nsString& aInitialDir, bool &aWasInitError)
// default save folder.
nsRefPtr<IShellItem> folderPath;
nsRefPtr<IShellLibrary> shellLib;
CoCreateInstance(CLSID_ShellLibrary, NULL, CLSCTX_INPROC, IID_IShellLibrary,
getter_AddRefs(shellLib));
CoCreateInstance(CLSID_ShellLibrary, nullptr, CLSCTX_INPROC,
IID_IShellLibrary, getter_AddRefs(shellLib));
if (shellLib &&
SUCCEEDED(shellLib->LoadLibraryFromItem(item, STGM_READ)) &&
SUCCEEDED(shellLib->GetDefaultSaveFolder(DSFT_DETECT, IID_IShellItem,
@ -672,7 +672,7 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
}
AutoDestroyTmpWindow adtw((HWND) (mParentWidget.get() ?
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : NULL));
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
ofn.lpstrTitle = (LPCWSTR)mTitle.get();
ofn.lpstrFilter = (LPCWSTR)filterBuffer.get();
@ -800,8 +800,8 @@ nsFilePicker::ShowXPFilePicker(const nsString& aInitialDir)
// Set user-selected location of file or directory. From msdn's "Open and
// Save As Dialog Boxes" section:
// If you specify OFN_EXPLORER, the directory and file name strings are NULL
// separated, with an extra NULL character after the last file name. This
// If you specify OFN_EXPLORER, the directory and file name strings are '\0'
// separated, with an extra '\0' character after the last file name. This
// format enables the Explorer-style dialog boxes to return long file names
// that include spaces.
PRUnichar *current = fileBuffer;
@ -863,14 +863,14 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
{
nsRefPtr<IFileDialog> dialog;
if (mMode != modeSave) {
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC,
if (FAILED(CoCreateInstance(CLSID_FileOpenDialog, nullptr, CLSCTX_INPROC,
IID_IFileOpenDialog,
getter_AddRefs(dialog)))) {
aWasInitError = true;
return false;
}
} else {
if (FAILED(CoCreateInstance(CLSID_FileSaveDialog, NULL, CLSCTX_INPROC,
if (FAILED(CoCreateInstance(CLSID_FileSaveDialog, nullptr, CLSCTX_INPROC,
IID_IFileSaveDialog,
getter_AddRefs(dialog)))) {
aWasInitError = true;
@ -941,7 +941,7 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
if (!aInitialDir.IsEmpty()) {
nsRefPtr<IShellItem> folder;
if (SUCCEEDED(
WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), NULL,
WinUtils::SHCreateItemFromParsingName(aInitialDir.get(), nullptr,
IID_IShellItem,
getter_AddRefs(folder)))) {
dialog->SetFolder(folder);
@ -958,7 +958,7 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir, bool &aWasInitError)
{
AutoDestroyTmpWindow adtw((HWND)(mParentWidget.get() ?
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : NULL));
mParentWidget->GetNativeData(NS_NATIVE_TMP_WINDOW) : nullptr));
AutoTimerCallbackCancel atcc(this, PickerCallbackTimerFunc);
AutoWidgetPickerState awps(mParentWidget);