Bug 784739 - Switch from NULL to nullptr in browser/metro. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Wed, 21 Aug 2013 12:13:50 -0400
changeset 143731 15ce5693e28a7913d25e508066dfb7bc68b2cd66
parent 143730 c0c72a444eec6685e28b6fd57452874935eb32ee
child 143732 be6770d2bd09f20a9bcd7403b0a10b5fb324faea
push id25136
push userryanvm@gmail.com
push dateWed, 21 Aug 2013 21:14:27 +0000
treeherdermozilla-central@306298eac982 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784739 - Switch from NULL to nullptr in browser/metro. r=ehsan
browser/metro/shell/commandexecutehandler/CEHHelper.cpp
browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp
browser/metro/shell/linktool/linktool.cpp
browser/metro/shell/testing/metrotestharness.cpp
--- a/browser/metro/shell/commandexecutehandler/CEHHelper.cpp
+++ b/browser/metro/shell/commandexecutehandler/CEHHelper.cpp
@@ -18,29 +18,29 @@ typedef HRESULT (WINAPI*D3D10CreateDevic
 typedef HRESULT(WINAPI*CreateDXGIFactory1Func)(REFIID , void **);
 
 void
 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;
   va_start(a,fmt);
   vswprintf(szDebugString, 1024, fmt, a);
   va_end(a);
   if(!lstrlenW(szDebugString))
     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);
     OutputDebugStringW(L"\n");
   }
 }
 
 #if defined(SHOW_CONSOLE)
@@ -48,17 +48,17 @@ void
 SetupConsole()
 {
   FILE *fp;
   AllocConsole();
   sCon = GetStdHandle(STD_OUTPUT_HANDLE); 
   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
 
 bool
 IsDX10Available()
 {
   DWORD isDX10Available;
   if (GetDWORDRegKey(metroDX10Available, isDX10Available)) {
@@ -99,29 +99,29 @@ IsDX10Available()
   CComPtr<IDXGIAdapter1> adapter1;
   if (FAILED(factory1->EnumAdapters1(0, &adapter1))) {
     SetDWORDRegKey(metroDX10Available, 0);
     return false;
   }
 
   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,
                                  D3D10_1_SDK_VERSION, &device))) {
 
         SetDWORDRegKey(metroDX10Available, 0);
         return false;
       }
--- a/browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp
+++ b/browser/metro/shell/commandexecutehandler/CommandExecuteHandler.cpp
@@ -44,17 +44,17 @@ static bool GetDefaultBrowserPath(CStrin
  *
  * @aPathBuffer Buffer to fill
  */
 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;
   }
 
   WCHAR* slash = wcsrchr(buffer, '\\');
   if (!slash)
     return false;
   *slash = '\0';
@@ -63,17 +63,17 @@ static bool GetModulePath(CStringW& aPat
   return true;
 }
 
 
 template <class T>void SafeRelease(T **ppT)
 {
   if (*ppT) {
     (*ppT)->Release();
-    *ppT = NULL;
+    *ppT = nullptr;
   }
 }
 
 template <class T> HRESULT SetInterface(T **ppT, IUnknown *punk)
 {
   SafeRelease(ppT);
   return punk ? punk->QueryInterface(ppT) : E_NOINTERFACE;
 }
@@ -84,18 +84,18 @@ class __declspec(uuid("5100FEC1-212B-4BF
                         public IInitializeCommand,
                         public IObjectWithSite,
                         public IExecuteCommandApplicationHostEnvironment
 {
 public:
 
   CExecuteCommandVerb() :
     mRef(1),
-    mShellItemArray(NULL),
-    mUnkSite(NULL),
+    mShellItemArray(nullptr),
+    mUnkSite(nullptr),
     mTargetIsFileSystemLink(false),
     mTargetIsDefaultBrowser(false),
     mTargetIsBrowser(false),
     mIsDesktopRequest(true),
     mRequestMet(false)
   {
   }
 
@@ -171,34 +171,34 @@ public:
     aArray->GetCount(&count);
     if (!count) {
       return E_FAIL;
     }
 
 #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.");
             item->Release();
             continue;
           }
         }
         item->Release();
         Log(L"SetSelection param: '%s'", str);
         CoTaskMemFree(str);
       }
     }
 #endif
 
-    IShellItem* item = NULL;
+    IShellItem* item = nullptr;
     if (FAILED(aArray->GetItemAt(0, &item))) {
       return E_FAIL;
     }
 
     bool isFileSystem = false;
     if (!SetTargetPath(item) || !mTarget.GetLength()) {
       Log(L"SetTargetPath failed.");
       return E_FAIL;
@@ -206,17 +206,17 @@ public:
     item->Release();
 
     Log(L"SetSelection target: %s", mTarget);
     return S_OK;
   }
 
   IFACEMETHODIMP GetSelection(REFIID aRefID, void **aInt)
   {
-    *aInt = NULL;
+    *aInt = nullptr;
     return mShellItemArray ? mShellItemArray->QueryInterface(aRefID, aInt) : E_FAIL;
   }
 
   // IInitializeCommand
   IFACEMETHODIMP Initialize(PCWSTR aVerb, IPropertyBag* aPropBag)
   {
     if (!aVerb)
       return E_FAIL;
@@ -230,41 +230,41 @@ public:
   IFACEMETHODIMP SetSite(IUnknown *aUnkSite)
   {
     SetInterface(&mUnkSite, aUnkSite);
     return S_OK;
   }
 
   IFACEMETHODIMP GetSite(REFIID aRefID, void **aInt)
   {
-    *aInt = NULL;
+    *aInt = nullptr;
     return mUnkSite ? mUnkSite->QueryInterface(aRefID, aInt) : E_FAIL;
   }
 
   // IExecuteCommandApplicationHostEnvironment
   IFACEMETHODIMP GetValue(AHE_TYPE *aLaunchType)
   {
     Log(L"IExecuteCommandApplicationHostEnvironment::GetValue()");
     *aLaunchType = AHE_DESKTOP;
     mIsDesktopRequest = true;
 
     if (!mUnkSite) {
       Log(L"No mUnkSite.");
       return S_OK;
     }
 
     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);
     if (!pHost) {
       Log(L"Couldn't get IExecuteCommandHost service from explorer. (%X)", hr);
       SafeRelease(&pSvcProvider);
       return S_OK;
     }
@@ -335,17 +335,17 @@ public:
     aPathBuffer.Append(kFirefoxExe);
     return true;
   }
 
   bool IsDefaultBrowser()
   {
     IApplicationAssociationRegistration* pAAR;
     HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
-                                  NULL,
+                                  nullptr,
                                   CLSCTX_INPROC,
                                   IID_IApplicationAssociationRegistration,
                                   (void**)&pAAR);
     if (FAILED(hr))
       return false;
 
     BOOL res = FALSE;
     hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
@@ -411,17 +411,17 @@ private:
  */
 static bool GetDefaultBrowserPath(CStringW& aPathBuffer)
 {
   WCHAR buffer[MAX_PATH];
   DWORD length = MAX_PATH;
 
   if (FAILED(AssocQueryStringW(ASSOCF_NOTRUNCATE | ASSOCF_INIT_IGNOREUNKNOWN,
                                ASSOCSTR_EXECUTABLE,
-                               kDefaultMetroBrowserIDPathKey, NULL,
+                               kDefaultMetroBrowserIDPathKey, nullptr,
                                buffer, &length))) {
     Log(L"AssocQueryString failed.");
     return false;
   }
 
   // sanity check
   if (lstrcmpiW(PathFindFileNameW(buffer), kFirefoxExe))
     return false;
@@ -446,17 +446,17 @@ static bool GetDefaultBrowserAppModelID(
 
   HKEY key;
   if (RegOpenKeyExW(HKEY_CLASSES_ROOT, kDefaultMetroBrowserIDPathKey,
                     0, KEY_READ, &key) != ERROR_SUCCESS) {
     return false;
   }
   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;
   }
   RegCloseKey(key);
   return true;
 }
 
@@ -508,17 +508,17 @@ bool CExecuteCommandVerb::SetTargetPath(
 {
   if (!aItem)
     return false;
 
   CString cstrText;
   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)) {
     wchar_t scheme[16];
     URL_COMPONENTS components = {0};
     components.lpszScheme = scheme;
     components.dwSchemeLength = sizeof(scheme)/sizeof(scheme[0]);
     components.dwStructSize = sizeof(components);
@@ -532,17 +532,17 @@ bool CExecuteCommandVerb::SetTargetPath(
     mTarget = cstrText;
 
     return true;
   }
 
   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;
     if (FAILED(aItem->GetDisplayName(SIGDN_URL, &str))) {
       Log(L"Failed to get parameter string.");
       return false;
     }
   }
@@ -591,22 +591,22 @@ void CExecuteCommandVerb::LaunchDesktopB
     params += mParameters;
   }
 
   Log(L"Desktop Launch: verb:%s exe:%s params:%s", mVerb, browserPath, params); 
 
   SHELLEXECUTEINFOW seinfo;
   memset(&seinfo, 0, sizeof(seinfo));
   seinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
-  seinfo.fMask  = NULL;
-  seinfo.hwnd   = NULL;
-  seinfo.lpVerb = NULL;
+  seinfo.fMask  = 0;
+  seinfo.hwnd   = nullptr;
+  seinfo.lpVerb = nullptr;
   seinfo.lpFile = browserPath;
   seinfo.lpParameters =  params;
-  seinfo.lpDirectory  = NULL;
+  seinfo.lpDirectory  = nullptr;
   seinfo.nShow  = SW_SHOWNORMAL;
         
   ShellExecuteExW(&seinfo);
 }
 
 class AutoSetRequestMet
 {
 public:
@@ -630,19 +630,19 @@ IFACEMETHODIMP CExecuteCommandVerb::Exec
 
   // Launch on the desktop
   if (mIsDesktopRequest) {
     LaunchDesktopBrowser();
     return S_OK;
   }
 
   // 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))) {
     Log(L"CoCreateInstance failed, launching on desktop.");
     LaunchDesktopBrowser();
     return S_OK;
   }
   
@@ -652,17 +652,17 @@ IFACEMETHODIMP CExecuteCommandVerb::Exec
     Log(L"GetDefaultBrowserAppModelID failed, launching on desktop.");
     activateMgr->Release();
     LaunchDesktopBrowser();
     return S_OK;
   }
 
   // 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();
     return false;
   }
 
   Log(L"Metro Launch: verb:%s appid:%s params:%s", mVerb, appModelID, mTarget); 
 
@@ -722,33 +722,33 @@ ClassFactory::Register(CLSCTX aClass, RE
   return CoRegisterClassObject(__uuidof(CExecuteCommandVerb),
                                static_cast<IClassFactory *>(this),
                                aClass, aUse, &mRegID);
 }
 
 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);
   }
   *ppv = punk;
   if (punk) {
     punk->AddRef();
     return S_OK;
   } else {
     return E_NOINTERFACE;
   }
 }
 
 STDMETHODIMP
 ClassFactory::CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv)
 {
-  *ppv = NULL;
+  *ppv = nullptr;
   if (punkOuter)
     return CLASS_E_NOAGGREGATION;
   return mUnkObject->QueryInterface(riid, ppv);
 }
 
 LONG gObjRefCnt;
 
 STDMETHODIMP
@@ -766,36 +766,36 @@ int APIENTRY wWinMain(HINSTANCE, HINSTAN
 {
 #if defined(SHOW_CONSOLE)
   SetupConsole();
 #endif
   //Log(pszCmdLine);
 
   if (!wcslen(pszCmdLine) || StrStrI(pszCmdLine, L"-Embedding"))
   {
-      CoInitialize(NULL);
+      CoInitialize(nullptr);
 
       CExecuteCommandVerb *pHandler = new CExecuteCommandVerb();
       if (!pHandler)
         return E_OUTOFMEMORY;
 
       IUnknown* ppi;
       pHandler->QueryInterface(IID_IUnknown, (void**)&ppi);
       if (!ppi)
         return E_FAIL;
 
       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;
       }
 
       MSG msg;
       long beatCount = 0;
       while (GetMessage(&msg, 0, 0, 0) > 0) {
         if (msg.message == WM_TIMER) {
--- a/browser/metro/shell/linktool/linktool.cpp
+++ b/browser/metro/shell/linktool/linktool.cpp
@@ -32,20 +32,23 @@ void DumpParameters(LPCWSTR aTargetPath,
   if (aDescription)
     wprintf(L"description: '%s'\n", aDescription);
 }
 
 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;
   }
 
   if (aSetMode) {
     PROPVARIANT propvar;
     if (FAILED(hres = InitPropVariantFromBoolean(true, &propvar)) ||
         FAILED(hres = m_pps->SetValue(PKEY_AppUserModel_IsDualMode, propvar))) {
@@ -74,20 +77,23 @@ SetShortcutProps(LPCWSTR aShortcutPath, 
   CoUninitialize();
   return hres;
 }
 
 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;
   }
 
   bool found = false;
 
   PROPVARIANT propvar;
   if (SUCCEEDED(hres = m_pps->GetValue(PKEY_AppUserModel_IsDualMode, &propvar)) && propvar.vt == VT_BOOL && propvar.boolVal == -1) {
@@ -120,32 +126,32 @@ PrintShortcutProps(LPCWSTR aTargetPath)
 HRESULT
 CreateLink(LPCWSTR aTargetPath, LPCWSTR aShortcutPath, LPCWSTR aDescription) 
 { 
     HRESULT hres;
     IShellLink* psl;
  
     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();
       return hres;
     }
     psl->SetPath(aTargetPath);
     if (aDescription) {
       psl->SetDescription(aDescription);
     } else {
       psl->SetDescription(L"");
     }
  
-    IPersistFile* ppf = NULL;
+    IPersistFile* ppf = nullptr;
     hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
  
     if (SUCCEEDED(hres)) {
         hres = ppf->Save(aShortcutPath, TRUE);
         ppf->Release();
     }
     psl->Release();
     CoUninitialize();
@@ -256,31 +262,35 @@ int wmain(int argc, WCHAR* argv[])
   }
 
   if (updateFound && !appModelIDFound && !modeFound) {
     printf("no properties selected.\n");
     return -1;
   }
 
   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;
     }
   }
 
   LPCWSTR target;
   if (createShortcutFound) {
     target = shortcutPathStr;
   } else {
     target = targetPathStr;
   }
 
   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;
     }
   }
 
 	return 0;
 }
 
--- a/browser/metro/shell/testing/metrotestharness.cpp
+++ b/browser/metro/shell/testing/metrotestharness.cpp
@@ -45,33 +45,33 @@ CString sFirefoxPath;
 #define SUCCESS   0
 #define WARNINGS  1
 #define FAILURE   2
 #define EXCEPTION 3
 #define RETRY     4
 
 static void Log(const wchar_t *fmt, ...)
 {
-  va_list a = NULL;
+  va_list a = nullptr;
   wchar_t szDebugString[1024];
   if(!lstrlenW(fmt))
     return;
   va_start(a,fmt);
   vswprintf(szDebugString, 1024, fmt, a);
   va_end(a);
   if(!lstrlenW(szDebugString))
     return;
 
   wprintf(L"INFO | metrotestharness.exe | %s\n", szDebugString);
   fflush(stdout);
 }
 
 static void Fail(bool aRequestRetry, const wchar_t *fmt, ...)
 {
-  va_list a = NULL;
+  va_list a = nullptr;
   wchar_t szDebugString[1024];
   if(!lstrlenW(fmt))
     return;
   va_start(a,fmt);
   vswprintf(szDebugString, 1024, fmt, a);
   va_end(a);
   if(!lstrlenW(szDebugString))
     return;
@@ -88,17 +88,17 @@ static void Fail(bool aRequestRetry, con
  *
  * @aPathBuffer Buffer to fill
  */
 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(false, L"GetModuleFileName failed.");
     return false;
   }
 
   WCHAR* slash = wcsrchr(buffer, '\\');
   if (!slash)
     return false;
   *slash = '\0';
@@ -140,17 +140,17 @@ static bool GetDefaultBrowserAppModelID(
 
   HKEY key;
   if (RegOpenKeyExW(HKEY_CLASSES_ROOT, kDefaultMetroBrowserIDPathKey,
                     0, KEY_READ, &key) != ERROR_SUCCESS) {
     return false;
   }
   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;
   }
   RegCloseKey(key);
   return true;
 }
 
@@ -169,52 +169,53 @@ public:
   }
 };
 
 static bool SetupTestOutputPipe()
 {
   SECURITY_ATTRIBUTES saAttr;
   saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
   saAttr.bInheritHandle = TRUE;
-  saAttr.lpSecurityDescriptor = NULL;
+  saAttr.lpSecurityDescriptor = nullptr;
 
   gTestOutputPipe =
     CreateNamedPipeW(L"\\\\.\\pipe\\metrotestharness",
                      PIPE_ACCESS_INBOUND,
                      PIPE_TYPE_BYTE|PIPE_WAIT,
                      1,
                      PIPE_BUFFER_SIZE,
-                     PIPE_BUFFER_SIZE, 0, NULL);
+                     PIPE_BUFFER_SIZE, 0, nullptr);
 
   if (gTestOutputPipe == INVALID_HANDLE_VALUE) {
     Log(L"Failed to create named logging pipe.");
     return false;
   }
   return true;
 }
 
 static void ReadPipe()
 {
   DWORD numBytesRead;
-  while (ReadFile(gTestOutputPipe, buffer, PIPE_BUFFER_SIZE, &numBytesRead, NULL) &&
+  while (ReadFile(gTestOutputPipe, buffer, PIPE_BUFFER_SIZE,
+                  &numBytesRead, nullptr) &&
          numBytesRead) {
     buffer[numBytesRead] = '\0';
     printf("%s", buffer);
   }
 }
 
 static int Launch()
 {
   Log(L"Launching browser...");
 
   DWORD processID;
 
   // 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))) {
     Fail(false, L"CoCreateInstance CLSID_ApplicationActivationManager failed.");
     return FAILURE;
   }
   
   HRESULT hr;
@@ -224,17 +225,17 @@ static int Launch()
     Fail(false, L"GetDefaultBrowserAppModelID failed.");
     return FAILURE;
   }
   Log(L"App model id='%s'", appModelID);
 
   // Hand off focus rights if the terminal has focus to the out-of-process
   // activation server (explorer.exe). Without this the metro interface
   // won't launch.
-  hr = CoAllowSetForegroundWindow(activateMgr, NULL);
+  hr = CoAllowSetForegroundWindow(activateMgr, nullptr);
   if (FAILED(hr)) {
     // Log but don't fail. This has happened on vms with certain terminals run by
     // QA during mozmill testing.
     Log(L"Windows focus rights hand off failed (HRESULT=0x%X). Ignoring.", hr);
   }
 
   Log(L"Harness process id: %d", GetCurrentProcessId());
 
@@ -259,17 +260,17 @@ static int Launch()
       return FAILURE;
     }
     testFilePath = sFirefoxPath.Mid(0, index);
     testFilePath += "\\";
     testFilePath += kMetroTestFile;
   } else {
     // Use the module path
     char path[MAX_PATH];
-    if (!GetModuleFileNameA(NULL, path, MAX_PATH)) {
+    if (!GetModuleFileNameA(nullptr, path, MAX_PATH)) {
       Fail(false, L"GetModuleFileNameA errorno=%d", GetLastError());
       return FAILURE;
     }
     char* slash = strrchr(path, '\\');
     if (!slash)
       return FAILURE;
     *slash = '\0'; // no trailing slash
     testFilePath = path;
@@ -284,34 +285,35 @@ static int Launch()
     Fail(false, L"Invalid bin path: '%s'", sFirefoxPath);
     return FAILURE;
   }
 
   Log(L"Using bin path: '%s'", sFirefoxPath);
 
   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(false, L"CreateFileA errorno=%d", GetLastError());
     return FAILURE;
   }
 
   DeleteTestFileHelper dtf(testFilePath);
 
   // nsAppRunner expects the first param to be the bin path, just like a
   // normal startup. So prepend our bin path to our param string we write.
   CStringA asciiParams = sFirefoxPath;
   asciiParams += " ";
   asciiParams += sAppParams;
   asciiParams.Trim();
   Log(L"Browser command line args: '%s'", CString(asciiParams));
-  if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(), NULL, 0)) {
+  if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(),
+                 nullptr, 0)) {
     CloseHandle(hTestFile);
     Fail(false, L"WriteFile errorno=%d", GetLastError());
     return FAILURE;
   }
   FlushFileBuffers(hTestFile);
   CloseHandle(hTestFile);
 
   // Create a named stdout pipe for the browser
@@ -342,33 +344,33 @@ static int Launch()
   HANDLE handles[2] = { child, gTestOutputPipe };
   while ((waitResult = MsgWaitForMultipleObjects(2, handles, FALSE, INFINITE, QS_ALLINPUT)) != WAIT_OBJECT_0) {
     if (waitResult == WAIT_FAILED) {
       Log(L"Wait failed (errno=%d)", GetLastError());
       break;
     } else if (waitResult == WAIT_OBJECT_0 + 1) {
       ReadPipe();
     } else if (waitResult == WAIT_OBJECT_0 + 2 &&
-               PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+               PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
       TranslateMessage(&msg);
       DispatchMessage(&msg);
     }
   }
 
   ReadPipe();
   CloseHandle(gTestOutputPipe);
   CloseHandle(child);
 
   Log(L"Exiting.");
   return SUCCESS;
 }
 
 int wmain(int argc, WCHAR* argv[])
 {
-  CoInitialize(NULL);
+  CoInitialize(nullptr);
 
   int idx;
   bool firefoxParam = false;
   for (idx = 1; idx < argc; idx++) {
     CString param = argv[idx];
     param.Trim();
 
     // Pickup the firefox path param and store it, we'll need this