Bug 784739 - Switch from NULL to nullptr in browser/; r=ehsan

This commit is contained in:
matekm 2013-04-02 20:40:29 -04:00
parent 2cf187a437
commit ae280e880b
10 changed files with 117 additions and 117 deletions

View File

@ -77,7 +77,7 @@ static void Output(const char *fmt, ... )
#if MOZ_WINCONSOLE
fwprintf_s(stderr, wide_msg);
#else
MessageBoxW(NULL, wide_msg, L"Firefox", MB_OK
MessageBoxW(nullptr, wide_msg, L"Firefox", MB_OK
| MB_ICONERROR
| MB_SETFOREGROUND);
#endif
@ -325,16 +325,16 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
// Check for a metro test harness command line args file
HANDLE hTestFile = CreateFileA(path.get(),
GENERIC_READ,
0, NULL, OPEN_EXISTING,
0, nullptr, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
nullptr);
if (hTestFile != INVALID_HANDLE_VALUE) {
// Typical test harness command line args string is around 100 bytes.
char buffer[1024];
memset(buffer, 0, sizeof(buffer));
DWORD bytesRead = 0;
if (!ReadFile(hTestFile, (VOID*)buffer, sizeof(buffer)-1,
&bytesRead, NULL) || !bytesRead) {
&bytesRead, nullptr) || !bytesRead) {
CloseHandle(hTestFile);
printf("failed to read test file '%s'", testFile);
return -1;
@ -349,7 +349,7 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
char* ptr = buffer;
newArgv[0] = ptr;
while (*ptr != NULL &&
while (*ptr != nullptr &&
(ptr - buffer) < sizeof(buffer) &&
newArgc < ARRAYSIZE(newArgv)) {
if (isspace(*ptr)) {
@ -461,13 +461,13 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
}
if (absfwurl) {
CFURLRef xulurl =
CFURLCreateCopyAppendingPathComponent(NULL, absfwurl,
CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl,
CFSTR("XUL.framework"),
true);
if (xulurl) {
CFURLRef xpcomurl =
CFURLCreateCopyAppendingPathComponent(NULL, xulurl,
CFURLCreateCopyAppendingPathComponent(nullptr, xulurl,
CFSTR("libxpcom.dylib"),
false);

View File

@ -61,20 +61,20 @@ NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#endif
static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, nullptr, DirectoryProviderConstructor },
#if defined(XP_WIN)
{ &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor },
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsWindowsShellServiceConstructor },
#elif defined(MOZ_WIDGET_GTK2)
{ &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor },
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsGNOMEShellServiceConstructor },
#endif
{ &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor },
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
{ &kNS_FEEDSNIFFER_CID, false, nullptr, nsFeedSnifferConstructor },
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create },
#if defined(XP_WIN)
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, NULL, nsIEHistoryEnumeratorConstructor },
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor },
#elif defined(XP_MACOSX)
{ &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor },
#endif
{ NULL }
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
@ -112,13 +112,13 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
#elif defined(XP_MACOSX)
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#endif
{ NULL }
{ nullptr }
};
static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
{ NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kBrowserModule = {

View File

@ -45,7 +45,7 @@ NS_IMPL_ISUPPORTS1(nsIEHistoryEnumerator, nsISimpleEnumerator)
nsIEHistoryEnumerator::nsIEHistoryEnumerator()
{
::CoInitialize(NULL);
::CoInitialize(nullptr);
}
nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
@ -60,7 +60,7 @@ nsIEHistoryEnumerator::EnsureInitialized()
return;
HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
NULL,
nullptr,
CLSCTX_INPROC_SERVER,
IID_IUrlHistoryStg2,
getter_AddRefs(mIEHistory));

View File

@ -152,7 +152,7 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
gchar *commandPath;
if (mUseLocaleFilenames) {
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, nullptr, nullptr, nullptr);
if (!nativePath) {
NS_ERROR("Error converting path to filesystem encoding");
return false;
@ -182,7 +182,7 @@ nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const
// The string will be something of the form: [/path/to/]browser "%s"
// We want to remove all of the parameters and get just the binary name.
if (g_shell_parse_argv(command.get(), &argc, &argv, NULL) && argc > 0) {
if (g_shell_parse_argv(command.get(), &argc, &argv, nullptr) && argc > 0) {
command.Assign(argv[0]);
g_strfreev(argv);
}
@ -380,7 +380,7 @@ WriteImage(const nsCString& aPath, imgIContainer* aImage)
if (!pixbuf)
return NS_ERROR_NOT_AVAILABLE;
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", NULL, NULL);
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);
g_object_unref(pixbuf);
return res ? NS_OK : NS_ERROR_FAILURE;
@ -454,7 +454,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
gsettings->GetCollectionForSchema(
NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
if (background_settings) {
gchar *file_uri = g_filename_to_uri(filePath.get(), NULL, NULL);
gchar *file_uri = g_filename_to_uri(filePath.get(), nullptr, nullptr);
if (!file_uri)
return NS_ERROR_FAILURE;
@ -615,7 +615,7 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
// Perform shell argument expansion
int argc;
char **argv;
if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, NULL))
if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, nullptr))
return NS_ERROR_FAILURE;
char **newArgv = new char*[argc + 1];
@ -630,8 +630,8 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
newArgv[newArgc] = nullptr;
gboolean err = g_spawn_async(NULL, newArgv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL);
gboolean err = g_spawn_async(nullptr, newArgv, nullptr, G_SPAWN_SEARCH_PATH,
nullptr, nullptr, nullptr, nullptr);
g_strfreev(argv);
delete[] newArgv;

View File

@ -40,13 +40,13 @@ nsMacShellService::IsDefaultBrowser(bool aStartupCheck,
CFStringRef firefoxID = ::CFBundleGetIdentifier(::CFBundleGetMainBundle());
if (!firefoxID) {
// CFBundleGetIdentifier is expected to return NULL only if the specified
// CFBundleGetIdentifier is expected to return nullptr only if the specified
// bundle doesn't have a bundle identifier in its plist. In this case, that
// means a failure, since our bundle does have an identifier.
return NS_ERROR_FAILURE;
}
// Get the default http handler's bundle ID (or NULL if it has not been explicitly set)
// Get the default http handler's bundle ID (or nullptr if it has not been explicitly set)
CFStringRef defaultBrowserID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("http"));
if (defaultBrowserID) {
*aIsDefaultBrowser = ::CFStringCompare(firefoxID, defaultBrowserID, 0) == kCFCompareEqualTo;
@ -259,7 +259,7 @@ nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress,
OSStatus status;
// Convert the path into a FSRef
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, NULL);
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, nullptr);
if (status == noErr) {
err = ::FSNewAlias(nil, &pictureRef, &aliasHandle);
if (err == noErr && aliasHandle == nil)
@ -312,21 +312,21 @@ nsMacShellService::OpenApplication(int32_t aApplication)
case nsIShellService::APPLICATION_MAIL:
{
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
CFSTR("mailto:"), NULL);
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, NULL, &appURL);
CFSTR("mailto:"), nullptr);
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, nullptr, &appURL);
::CFRelease(tempURL);
}
break;
case nsIShellService::APPLICATION_NEWS:
{
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
CFSTR("news:"), NULL);
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, NULL, &appURL);
CFSTR("news:"), nullptr);
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, nullptr, &appURL);
::CFRelease(tempURL);
}
break;
case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS:
err = ::LSGetApplicationForInfo('APPL', 'kcmr', NULL, kLSRolesAll, NULL,
err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll, nullptr,
&appURL);
break;
case nsIMacShellService::APPLICATION_NETWORK:
@ -356,7 +356,7 @@ nsMacShellService::OpenApplication(int32_t aApplication)
}
if (appURL && err == noErr) {
err = ::LSOpenCFURLRef(appURL, NULL);
err = ::LSOpenCFURLRef(appURL, nullptr);
rv = err != noErr ? NS_ERROR_FAILURE : NS_OK;
::CFRelease(appURL);
@ -394,12 +394,12 @@ nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACStrin
const nsCString spec(aURI);
const UInt8* uriString = (const UInt8*)spec.get();
CFURLRef uri = ::CFURLCreateWithBytes(NULL, uriString, aURI.Length(),
kCFStringEncodingUTF8, NULL);
CFURLRef uri = ::CFURLCreateWithBytes(nullptr, uriString, aURI.Length(),
kCFStringEncodingUTF8, nullptr);
if (!uri)
return NS_ERROR_OUT_OF_MEMORY;
CFArrayRef uris = ::CFArrayCreate(NULL, (const void**)&uri, 1, NULL);
CFArrayRef uris = ::CFArrayCreate(nullptr, (const void**)&uri, 1, nullptr);
if (!uris) {
::CFRelease(uri);
return NS_ERROR_OUT_OF_MEMORY;
@ -408,11 +408,11 @@ nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACStrin
LSLaunchURLSpec launchSpec;
launchSpec.appURL = appURL;
launchSpec.itemURLs = uris;
launchSpec.passThruParams = NULL;
launchSpec.passThruParams = nullptr;
launchSpec.launchFlags = kLSLaunchDefaults;
launchSpec.asyncRefCon = NULL;
launchSpec.asyncRefCon = nullptr;
OSErr err = ::LSOpenFromURLSpec(&launchSpec, NULL);
OSErr err = ::LSOpenFromURLSpec(&launchSpec, nullptr);
::CFRelease(uris);
::CFRelease(uri);
@ -433,11 +433,11 @@ nsMacShellService::GetDefaultFeedReader(nsIFile** _retval)
kCFStringEncodingASCII);
}
CFURLRef defaultHandlerURL = NULL;
CFURLRef defaultHandlerURL = nullptr;
OSStatus status = ::LSFindApplicationForInfo(kLSUnknownCreator,
defaultHandlerID,
NULL, // inName
NULL, // outAppRef
nullptr, // inName
nullptr, // outAppRef
&defaultHandlerURL);
if (status == noErr && defaultHandlerURL) {

View File

@ -223,8 +223,8 @@ LaunchHelper(nsAutoString& aPath)
STARTUPINFOW si = {sizeof(si), 0};
PROCESS_INFORMATION pi = {0};
if (!CreateProcessW(NULL, (LPWSTR)aPath.get(), NULL, NULL, FALSE, 0, NULL,
NULL, &si, &pi)) {
if (!CreateProcessW(nullptr, (LPWSTR)aPath.get(), nullptr, nullptr, FALSE, 0, nullptr,
nullptr, &si, &pi)) {
return NS_ERROR_FAILURE;
}
@ -361,7 +361,7 @@ nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
{
IApplicationAssociationRegistration* pAAR;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
NULL,
nullptr,
CLSCTX_INPROC,
IID_IApplicationAssociationRegistration,
(void**)&pAAR);
@ -447,7 +447,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
::ZeroMemory(currValue, sizeof(currValue));
DWORD len = sizeof currValue;
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue, &len);
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue, &len);
// Close the key that was opened.
::RegCloseKey(theKey);
if (REG_FAILED(res) ||
@ -516,7 +516,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
::ZeroMemory(currValue, sizeof(currValue));
DWORD len = sizeof currValue;
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue,
&len);
// Close the key that was opened.
::RegCloseKey(theKey);
@ -525,9 +525,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// Delete the key along with all of its childrean and then recreate it.
const nsString &flatName = PromiseFlatString(keyName);
::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
&theKey, NULL);
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr,
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nullptr,
&theKey, nullptr);
if (REG_FAILED(res)) {
// If disabling DDE fails try to disable it using the helper
// application when setting Firefox as the default browser.
@ -564,7 +564,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
::ZeroMemory(currValue, sizeof(currValue));
DWORD len = sizeof currValue;
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue,
&len);
// Don't update the FTP protocol handler's shell open command when the
@ -606,7 +606,7 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
{
typedef HRESULT (WINAPI * SHOpenWithDialogPtr)(HWND hwndParent,
const OPENASINFO *poainfo);
static SHOpenWithDialogPtr SHOpenWithDialogFn = NULL;
static SHOpenWithDialogPtr SHOpenWithDialogFn = nullptr;
if (!SHOpenWithDialogFn) {
// shell32.dll is in the knownDLLs list so will always be loaded from the
// system32 directory.
@ -650,8 +650,8 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWDEFAULT;
PROCESS_INFORMATION pi = {0};
if (!CreateProcessW(controlEXEPath, params, NULL, NULL, FALSE, 0, NULL,
NULL, &si, &pi)) {
if (!CreateProcessW(controlEXEPath, params, nullptr, nullptr, FALSE, 0, nullptr,
nullptr, &si, &pi)) {
return NS_ERROR_FAILURE;
}
CloseHandle(pi.hProcess);
@ -665,11 +665,11 @@ nsWindowsShellService::LaunchHTTPHandlerPane()
{
OPENASINFO info;
info.pcszFile = L"http";
info.pcszClass = NULL;
info.pcszClass = nullptr;
info.oaifInFlags = OAIF_FORCE_REGISTRATION |
OAIF_URL_PROTOCOL |
OAIF_REGISTER_EXT;
return DynSHOpenWithDialog(NULL, &info);
return DynSHOpenWithDialog(nullptr, &info);
}
NS_IMETHODIMP
@ -1028,8 +1028,8 @@ nsWindowsShellService::OpenApplication(int32_t aApplication)
::ZeroMemory(&si, sizeof(STARTUPINFOW));
::ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
BOOL success = ::CreateProcessW(NULL, (LPWSTR)path.get(), NULL,
NULL, FALSE, 0, NULL, NULL,
BOOL success = ::CreateProcessW(nullptr, (LPWSTR)path.get(), nullptr,
nullptr, FALSE, 0, nullptr, nullptr,
&si, &pi);
if (!success)
return NS_ERROR_FAILURE;

View File

@ -23,7 +23,7 @@ Log(const wchar_t *fmt, ...)
#if !defined(SHOW_CONSOLE)
return;
#endif
va_list a = NULL;
va_list a = nullptr;
wchar_t szDebugString[1024];
if(!lstrlenW(fmt))
return;
@ -34,8 +34,8 @@ Log(const wchar_t *fmt, ...)
return;
DWORD len;
WriteConsoleW(sCon, szDebugString, lstrlenW(szDebugString), &len, NULL);
WriteConsoleW(sCon, L"\n", 1, &len, NULL);
WriteConsoleW(sCon, szDebugString, lstrlenW(szDebugString), &len, nullptr);
WriteConsoleW(sCon, L"\n", 1, &len, nullptr);
if (IsDebuggerPresent()) {
OutputDebugStringW(szDebugString);
@ -53,7 +53,7 @@ SetupConsole()
int fd = _open_osfhandle(reinterpret_cast<intptr_t>(sCon), 0);
fp = _fdopen(fd, "w");
*stdout = *fp;
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stdout, nullptr, _IONBF, 0);
}
#endif
@ -104,19 +104,19 @@ IsDX10Available()
CComPtr<ID3D10Device1> device;
// Try for DX10.1
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
D3D10_FEATURE_LEVEL_10_1,
D3D10_1_SDK_VERSION, &device))) {
// Try for DX10
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
D3D10_FEATURE_LEVEL_10_0,
D3D10_1_SDK_VERSION, &device))) {
// Try for DX9.3 (we fall back to cairo and cairo has support for D3D 9.3)
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
D3D10_FEATURE_LEVEL_9_3,

View File

@ -42,7 +42,7 @@ template <class T>void SafeRelease(T **ppT)
{
if (*ppT) {
(*ppT)->Release();
*ppT = NULL;
*ppT = nullptr;
}
}
@ -63,8 +63,8 @@ public:
CExecuteCommandVerb() :
mRef(1),
mShellItemArray(NULL),
mUnkSite(NULL),
mShellItemArray(nullptr),
mUnkSite(nullptr),
mTargetIsFileSystemLink(false),
mIsDesktopRequest(true),
mRequestMet(false)
@ -148,9 +148,9 @@ public:
#ifdef SHOW_CONSOLE
Log(L"SetSelection param count: %d", count);
for (DWORD idx = 0; idx < count; idx++) {
IShellItem* item = NULL;
IShellItem* item = nullptr;
if (SUCCEEDED(aArray->GetItemAt(idx, &item))) {
LPWSTR str = NULL;
LPWSTR str = nullptr;
if (FAILED(item->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
if (FAILED(item->GetDisplayName(SIGDN_URL, &str))) {
Log(L"Failed to get a shell item array item.");
@ -165,7 +165,7 @@ public:
}
#endif
IShellItem* item = NULL;
IShellItem* item = nullptr;
if (FAILED(aArray->GetItemAt(0, &item))) {
return E_FAIL;
}
@ -183,7 +183,7 @@ public:
IFACEMETHODIMP GetSelection(REFIID aRefID, void **aInt)
{
*aInt = NULL;
*aInt = nullptr;
return mShellItemArray ? mShellItemArray->QueryInterface(aRefID, aInt) : E_FAIL;
}
@ -207,7 +207,7 @@ public:
IFACEMETHODIMP GetSite(REFIID aRefID, void **aInt)
{
*aInt = NULL;
*aInt = nullptr;
return mUnkSite ? mUnkSite->QueryInterface(aRefID, aInt) : E_FAIL;
}
@ -224,14 +224,14 @@ public:
}
HRESULT hr;
IServiceProvider* pSvcProvider = NULL;
IServiceProvider* pSvcProvider = nullptr;
hr = mUnkSite->QueryInterface(IID_IServiceProvider, (void**)&pSvcProvider);
if (!pSvcProvider) {
Log(L"Couldn't get IServiceProvider service from explorer. (%X)", hr);
return S_OK;
}
IExecuteCommandHost* pHost = NULL;
IExecuteCommandHost* pHost = nullptr;
// If we can't get this it's a conventional desktop launch
hr = pSvcProvider->QueryService(SID_ExecuteCommandHost,
IID_IExecuteCommandHost, (void**)&pHost);
@ -282,7 +282,7 @@ public:
bool result = false;
IApplicationAssociationRegistration* pAAR;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
NULL,
nullptr,
CLSCTX_INPROC,
IID_IApplicationAssociationRegistration,
(void**)&pAAR);
@ -348,7 +348,7 @@ static bool GetModulePath(CStringW& aPathBuffer)
WCHAR buffer[MAX_PATH];
memset(buffer, 0, sizeof(buffer));
if (!GetModuleFileName(NULL, buffer, MAX_PATH)) {
if (!GetModuleFileName(nullptr, buffer, MAX_PATH)) {
Log(L"GetModuleFileName failed.");
return false;
}
@ -400,7 +400,7 @@ static bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer,
}
DWORD len = aCharLength * sizeof(WCHAR);
memset(aIDBuffer, 0, len);
if (RegQueryValueExW(key, L"AppUserModelID", NULL, NULL,
if (RegQueryValueExW(key, L"AppUserModelID", nullptr, nullptr,
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
RegCloseKey(key);
return false;
@ -492,7 +492,7 @@ bool CExecuteCommandVerb::SetTargetPath(IShellItem* aItem)
CComPtr<IDataObject> object;
// Check the underlying data object first to insure we get
// absolute uri. See chromium bug 157184.
if (SUCCEEDED(aItem->BindToHandler(NULL, BHID_DataObject,
if (SUCCEEDED(aItem->BindToHandler(nullptr, BHID_DataObject,
IID_IDataObject,
reinterpret_cast<void**>(&object))) &&
GetPlainText(object, cstrText)) {
@ -515,7 +515,7 @@ bool CExecuteCommandVerb::SetTargetPath(IShellItem* aItem)
Log(L"No data object or data object has no text.");
// Use the shell item display name
LPWSTR str = NULL;
LPWSTR str = nullptr;
mTargetIsFileSystemLink = true;
if (FAILED(aItem->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
mTargetIsFileSystemLink = false;
@ -555,12 +555,12 @@ void CExecuteCommandVerb::LaunchDesktopBrowser()
SHELLEXECUTEINFOW seinfo;
memset(&seinfo, 0, sizeof(seinfo));
seinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
seinfo.fMask = NULL;
seinfo.hwnd = NULL;
seinfo.lpVerb = NULL;
seinfo.fMask = nullptr;
seinfo.hwnd = nullptr;
seinfo.lpVerb = nullptr;
seinfo.lpFile = browserPath;
seinfo.lpParameters = params;
seinfo.lpDirectory = NULL;
seinfo.lpDirectory = nullptr;
seinfo.nShow = SW_SHOWNORMAL;
ShellExecuteExW(&seinfo);
@ -594,9 +594,9 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
}
// Launch into Metro
IApplicationActivationManager* activateMgr = NULL;
IApplicationActivationManager* activateMgr = nullptr;
DWORD processID;
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, NULL,
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, nullptr,
CLSCTX_LOCAL_SERVER,
IID_IApplicationActivationManager,
(void**)&activateMgr))) {
@ -616,7 +616,7 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
// Hand off focus rights to the out-of-process activation server. Without
// this the metro interface won't launch.
hr = CoAllowSetForegroundWindow(activateMgr, NULL);
hr = CoAllowSetForegroundWindow(activateMgr, nullptr);
if (FAILED(hr)) {
Log(L"CoAllowSetForegroundWindow result %X", hr);
activateMgr->Release();
@ -686,7 +686,7 @@ ClassFactory::Register(CLSCTX aClass, REGCLS aUse)
STDMETHODIMP
ClassFactory::QueryInterface(REFIID riid, void **ppv)
{
IUnknown *punk = NULL;
IUnknown *punk = nullptr;
if (riid == IID_IUnknown || riid == IID_IClassFactory) {
punk = static_cast<IClassFactory*>(this);
}
@ -702,7 +702,7 @@ ClassFactory::QueryInterface(REFIID riid, void **ppv)
STDMETHODIMP
ClassFactory::CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv)
{
*ppv = NULL;
*ppv = nullptr;
if (punkOuter)
return CLASS_E_NOAGGREGATION;
return mUnkObject->QueryInterface(riid, ppv);
@ -730,7 +730,7 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
if (!wcslen(pszCmdLine) || StrStrI(pszCmdLine, L"-Embedding"))
{
CoInitialize(NULL);
CoInitialize(nullptr);
CExecuteCommandVerb *pHandler = new CExecuteCommandVerb();
if (!pHandler)
@ -743,13 +743,13 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
ClassFactory classFactory(ppi);
ppi->Release();
ppi = NULL;
ppi = nullptr;
// REGCLS_SINGLEUSE insures we only get used once and then discarded.
if (FAILED(classFactory.Register(CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE)))
return -1;
if (!SetTimer(NULL, 1, HEARTBEAT_MSEC, NULL)) {
if (!SetTimer(nullptr, 1, HEARTBEAT_MSEC, nullptr)) {
Log(L"Failed to set timer, can't process request.");
return -1;
}

View File

@ -37,10 +37,10 @@ HRESULT
SetShortcutProps(LPCWSTR aShortcutPath, LPCWSTR aAppModelID, bool aSetID, bool aSetMode)
{
HRESULT hres;
::CoInitialize(NULL);
::CoInitialize(nullptr);
IPropertyStore *m_pps = NULL;
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aShortcutPath, NULL, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
IPropertyStore *m_pps = nullptr;
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aShortcutPath, nullptr, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
printf("SHGetPropertyStoreFromParsingName failed\n");
goto Exit;
}
@ -79,10 +79,10 @@ HRESULT
PrintShortcutProps(LPCWSTR aTargetPath)
{
HRESULT hres;
::CoInitialize(NULL);
::CoInitialize(nullptr);
IPropertyStore *m_pps = NULL;
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aTargetPath, NULL, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
IPropertyStore *m_pps = nullptr;
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aTargetPath, nullptr, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
printf("SHGetPropertyStoreFromParsingName failed\n");
goto Exit;
}
@ -125,9 +125,9 @@ CreateLink(LPCWSTR aTargetPath, LPCWSTR aShortcutPath, LPCWSTR aDescription)
wprintf(L"creating shortcut: '%s'\n", aShortcutPath);
CoInitialize(NULL);
CoInitialize(nullptr);
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*)&psl);
if (FAILED(hres)) {
CoUninitialize();
@ -140,7 +140,7 @@ CreateLink(LPCWSTR aTargetPath, LPCWSTR aShortcutPath, LPCWSTR aDescription)
psl->SetDescription(L"");
}
IPersistFile* ppf = NULL;
IPersistFile* ppf = nullptr;
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
if (SUCCEEDED(hres)) {
@ -261,7 +261,7 @@ int wmain(int argc, WCHAR* argv[])
}
if (createShortcutFound) {
if (FAILED(hres = CreateLink(targetPathStr, shortcutPathStr, (descriptionFound ? descriptionStr : NULL)))) {
if (FAILED(hres = CreateLink(targetPathStr, shortcutPathStr, (descriptionFound ? descriptionStr : nullptr)))) {
printf("failed creating shortcut HRESULT=%X\n", hres);
return -1;
}
@ -275,7 +275,7 @@ int wmain(int argc, WCHAR* argv[])
}
if (appModelIDFound || modeFound) {
if (FAILED(hres = SetShortcutProps(target, (appModelIDFound ? appModelIDStr : NULL), appModelIDFound, modeFound))) {
if (FAILED(hres = SetShortcutProps(target, (appModelIDFound ? appModelIDStr : nullptr), appModelIDFound, modeFound))) {
printf("failed adding property HRESULT=%X\n", hres);
return -1;
}

View File

@ -37,7 +37,7 @@ CString sFirefoxPath;
static void Log(const wchar_t *fmt, ...)
{
va_list a = NULL;
va_list a = nullptr;
wchar_t szDebugString[1024];
if(!lstrlenW(fmt))
return;
@ -53,7 +53,7 @@ static void Log(const wchar_t *fmt, ...)
static void Fail(const wchar_t *fmt, ...)
{
va_list a = NULL;
va_list a = nullptr;
wchar_t szDebugString[1024];
if(!lstrlenW(fmt))
return;
@ -77,7 +77,7 @@ static bool GetModulePath(CStringW& aPathBuffer)
WCHAR buffer[MAX_PATH];
memset(buffer, 0, sizeof(buffer));
if (!GetModuleFileName(NULL, buffer, MAX_PATH)) {
if (!GetModuleFileName(nullptr, buffer, MAX_PATH)) {
Fail(L"GetModuleFileName failed.");
return false;
}
@ -132,7 +132,7 @@ static bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer,
}
DWORD len = aCharLength * sizeof(WCHAR);
memset(aIDBuffer, 0, len);
if (RegQueryValueExW(key, L"AppUserModelID", NULL, NULL,
if (RegQueryValueExW(key, L"AppUserModelID", nullptr, nullptr,
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
RegCloseKey(key);
return false;
@ -172,7 +172,7 @@ static bool Launch()
// The interface that allows us to activate the browser
CComPtr<IApplicationActivationManager> activateMgr;
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, NULL,
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, nullptr,
CLSCTX_LOCAL_SERVER,
IID_IApplicationActivationManager,
(void**)&activateMgr))) {
@ -191,7 +191,7 @@ static bool Launch()
// Hand off focus rights to the out-of-process activation server. Without
// this the metro interface won't launch.
hr = CoAllowSetForegroundWindow(activateMgr, NULL);
hr = CoAllowSetForegroundWindow(activateMgr, nullptr);
if (FAILED(hr)) {
Fail(L"CoAllowSetForegroundWindow result %X", hr);
return false;
@ -215,7 +215,7 @@ static bool Launch()
} else {
// Use the module path
char path[MAX_PATH];
if (!GetModuleFileNameA(NULL, path, MAX_PATH)) {
if (!GetModuleFileNameA(nullptr, path, MAX_PATH)) {
Fail(L"GetModuleFileNameA errorno=%d", GetLastError());
return false;
}
@ -230,9 +230,9 @@ static bool Launch()
Log(L"Writing out tests.ini to: '%s'", CStringW(testFilePath));
HANDLE hTestFile = CreateFileA(testFilePath, GENERIC_WRITE,
0, NULL, CREATE_ALWAYS,
0, nullptr, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
nullptr);
if (hTestFile == INVALID_HANDLE_VALUE) {
Fail(L"CreateFileA errorno=%d", GetLastError());
return false;
@ -241,7 +241,7 @@ static bool Launch()
DeleteTestFileHelper dtf(testFilePath);
CStringA asciiParams = sAppParams;
if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(), NULL, 0)) {
if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(), nullptr, 0)) {
CloseHandle(hTestFile);
Fail(L"WriteFile errorno=%d", GetLastError());
return false;
@ -269,7 +269,7 @@ static bool Launch()
MSG msg;
DWORD waitResult = WAIT_TIMEOUT;
while ((waitResult = WaitForSingleObject(child, 10)) != WAIT_OBJECT_0) {
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@ -281,7 +281,7 @@ static bool Launch()
int wmain(int argc, WCHAR* argv[])
{
CoInitialize(NULL);
CoInitialize(nullptr);
int idx;
bool firefoxParam = false;