Bug 784739 - Switch from NULL to nullptr in miscellaneous directories; r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 11 Nov 2013 14:17:14 -0500
changeset 169005 ca67a11bfdcf87c0354087b9c271612fec30c24a
parent 169004 0fc828acb6535ab046b3c2cbae148a178343029f
child 169006 bbbeb0e593ecff3c790e079eb790144bf224d072
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone28.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 miscellaneous directories; r=ehsan
content/media/webrtc/LoadMonitor.cpp
dom/mobilemessage/src/MmsMessage.cpp
js/src/jit/Ion.cpp
js/src/jit/IonBuilder.cpp
js/src/vm/OldDebugAPI.cpp
js/xpconnect/src/XPCShellImpl.cpp
memory/replace/dmd/DMD.cpp
netwerk/build/nsNetModule.cpp
toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
widget/cocoa/nsCocoaWindow.h
widget/gonk/Framebuffer.cpp
widget/windows/WinUtils.cpp
xpcom/base/nsSystemInfo.cpp
xpcom/build/LateWriteChecks.cpp
--- a/content/media/webrtc/LoadMonitor.cpp
+++ b/content/media/webrtc/LoadMonitor.cpp
@@ -233,17 +233,17 @@ nsresult LoadInfo::UpdateSystemLoad()
   // Not implemented
   return NS_OK;
 #endif
 }
 
 nsresult LoadInfo::UpdateProcessLoad() {
 #if defined(LINUX) || defined(ANDROID)
   struct timeval tv;
-  gettimeofday(&tv, NULL);
+  gettimeofday(&tv, nullptr);
   const uint64_t total_times = tv.tv_sec * PR_USEC_PER_SEC + tv.tv_usec;
 
   rusage usage;
   if (getrusage(RUSAGE_SELF, &usage) < 0) {
     LOG(("getrusage failed"));
     return NS_ERROR_FAILURE;
   }
 
--- a/dom/mobilemessage/src/MmsMessage.cpp
+++ b/dom/mobilemessage/src/MmsMessage.cpp
@@ -493,36 +493,36 @@ MmsMessage::GetDeliveryInfo(JSContext* a
     // Get |info.receiver|.
     tmpJsStr = JS_NewUCStringCopyN(aCx,
                                    info.receiver.get(),
                                    info.receiver.Length());
     NS_ENSURE_TRUE(tmpJsStr, NS_ERROR_OUT_OF_MEMORY);
 
     tmpJsVal.setString(tmpJsStr);
     if (!JS_DefineProperty(aCx, infoJsObj, "receiver", tmpJsVal,
-                           NULL, NULL, JSPROP_ENUMERATE)) {
+                           nullptr, nullptr, JSPROP_ENUMERATE)) {
       return NS_ERROR_FAILURE;
     }
 
     // Get |info.deliveryStatus|.
     tmpJsStr = JS_NewUCStringCopyN(aCx,
                                    info.deliveryStatus.get(),
                                    info.deliveryStatus.Length());
     NS_ENSURE_TRUE(tmpJsStr, NS_ERROR_OUT_OF_MEMORY);
 
     tmpJsVal.setString(tmpJsStr);
     if (!JS_DefineProperty(aCx, infoJsObj, "deliveryStatus", tmpJsVal,
-                           NULL, NULL, JSPROP_ENUMERATE)) {
+                           nullptr, nullptr, JSPROP_ENUMERATE)) {
       return NS_ERROR_FAILURE;
     }
 
     // Get |info.deliveryTimestamp|.
     if (!JS_DefineProperty(aCx, infoJsObj,
                            "deliveryTimestamp", info.deliveryTimestamp,
-                           NULL, NULL, JSPROP_ENUMERATE)) {
+                           nullptr, nullptr, JSPROP_ENUMERATE)) {
       return NS_ERROR_FAILURE;
     }
 
     tmpJsVal = OBJECT_TO_JSVAL(infoJsObj);
     if (!JS_SetElement(aCx, deliveryInfo, i, &tmpJsVal)) {
       return NS_ERROR_FAILURE;
     }
   }
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -1572,17 +1572,17 @@ TrackAllProperties(JSContext *cx, JSObje
 
 static void
 TrackPropertiesForSingletonScopes(JSContext *cx, JSScript *script, BaselineFrame *baselineFrame)
 {
     // Ensure that all properties of singleton call objects which the script
     // could access are tracked. These are generally accessed through
     // ALIASEDVAR operations in baseline and will not be tracked even if they
     // have been accessed in baseline code.
-    JSObject *environment = script->function() ? script->function()->environment() : NULL;
+    JSObject *environment = script->function() ? script->function()->environment() : nullptr;
 
     while (environment && !environment->is<GlobalObject>()) {
         if (environment->is<CallObject>() && environment->hasSingletonType())
             TrackAllProperties(cx, environment);
         environment = environment->enclosingScope();
     }
 
     if (baselineFrame) {
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -8335,18 +8335,18 @@ IonBuilder::getPropTryDefiniteSlot(bool 
 }
 
 bool
 IonBuilder::getPropTryCommonGetter(bool *emitted, PropertyName *name,
                                    types::TemporaryTypeSet *types)
 {
     JS_ASSERT(*emitted == false);
 
-    Shape *lastProperty = NULL;
-    JSFunction *commonGetter = NULL;
+    Shape *lastProperty = nullptr;
+    JSFunction *commonGetter = nullptr;
     JSObject *foundProto = inspector->commonGetPropFunction(pc, &lastProperty, &commonGetter);
     if (!foundProto)
         return true;
 
     types::TemporaryTypeSet *objTypes = current->peek(-1)->resultTypeSet();
     MDefinition *guard = testCommonGetterSetter(objTypes, name, /* isGetter = */ true,
                                                 foundProto, lastProperty);
     if (!guard)
@@ -8614,18 +8614,18 @@ IonBuilder::jsop_setprop(PropertyName *n
 }
 
 bool
 IonBuilder::setPropTryCommonSetter(bool *emitted, MDefinition *obj,
                                    PropertyName *name, MDefinition *value)
 {
     JS_ASSERT(*emitted == false);
 
-    Shape *lastProperty = NULL;
-    JSFunction *commonSetter = NULL;
+    Shape *lastProperty = nullptr;
+    JSFunction *commonSetter = nullptr;
     JSObject *foundProto = inspector->commonSetPropFunction(pc, &lastProperty, &commonSetter);
     if (!foundProto)
         return true;
 
     types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
     MDefinition *guard = testCommonGetterSetter(objTypes, name, /* isGetter = */ false,
                                                 foundProto, lastProperty);
     if (!guard)
--- a/js/src/vm/OldDebugAPI.cpp
+++ b/js/src/vm/OldDebugAPI.cpp
@@ -1119,17 +1119,17 @@ FormatFrame(JSContext *cx, const NonBuil
             const char *value = FormatValue(cx, arg, valueBytes);
 
             JSAutoByteString nameBytes;
             const char *name = nullptr;
 
             if (i < bindings.length()) {
                 name = nameBytes.encodeLatin1(cx, bindings[i].name());
                 if (!buf)
-                    return NULL;
+                    return nullptr;
             }
 
             if (value) {
                 buf = JS_sprintf_append(buf, "%s%s%s%s%s%s",
                                         !first ? ", " : "",
                                         name ? name :"",
                                         name ? " = " : "",
                                         arg.isString() ? "\"" : "",
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -483,17 +483,17 @@ Options(JSContext *cx, unsigned argc, js
             ContextOptionsRef(cx).toggleStrictMode();
         else {
             JS_ReportError(cx, "unknown option name '%s'. The valid names are "
                            "strict, werror, and strict_mode.", opt.ptr());
             return false;
         }
     }
 
-    char *names = NULL;
+    char *names = nullptr;
     if (oldOptions.extraWarnings()) {
         names = JS_sprintf_append(names, "%s", "strict");
         if (!names) {
             JS_ReportOutOfMemory(cx);
             return false;
         }
     }
     if (oldOptions.werror()) {
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -365,17 +365,17 @@ class MutexBase
 {
   pthread_mutex_t mMutex;
 
   DISALLOW_COPY_AND_ASSIGN(MutexBase);
 
 public:
   MutexBase()
   {
-    pthread_mutex_init(&mMutex, NULL);
+    pthread_mutex_init(&mMutex, nullptr);
   }
 
   void Lock()
   {
     pthread_mutex_lock(&mMutex);
   }
 
   void Unlock()
@@ -1254,17 +1254,17 @@ replace_realloc(void* aOldPtr, size_t aS
     return gMallocTable->realloc(aOldPtr, aSize);
   }
 
   Thread* t = Thread::Fetch();
   if (t->InterceptsAreBlocked()) {
     return InfallibleAllocPolicy::realloc_(aOldPtr, aSize);
   }
 
-  // If |aOldPtr| is NULL, the call is equivalent to |malloc(aSize)|.
+  // If |aOldPtr| is nullptr, the call is equivalent to |malloc(aSize)|.
   if (!aOldPtr) {
     return replace_malloc(aSize);
   }
 
   // Be very careful here!  Must remove the block from the table before doing
   // the realloc to avoid races, just like in replace_free().
   // Nb: This does an unnecessary hashtable remove+add if the block doesn't
   // move, but doing better isn't worth the effort.
--- a/netwerk/build/nsNetModule.cpp
+++ b/netwerk/build/nsNetModule.cpp
@@ -950,17 +950,17 @@ static const mozilla::Module::CIDEntry k
 #elif defined(MOZ_ENABLE_QTNETWORK)
     { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsQtNetworkLinkServiceConstructor },
 #elif defined(MOZ_WIDGET_ANDROID)
     { &kNS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsAndroidNetworkLinkServiceConstructor },
 #endif
     { &kNS_SERIALIZATION_HELPER_CID, false, nullptr, nsSerializationHelperConstructor },
     { &kNS_REDIRECTCHANNELREGISTRAR_CID, false, nullptr, RedirectChannelRegistrarConstructor },
     { &kNS_CACHE_STORAGE_SERVICE_CID, false, nullptr, CacheStorageServiceConstructor },
-    { &kNS_NETWORKSEER_CID, false, NULL, mozilla::net::Seer::Create },
+    { &kNS_NETWORKSEER_CID, false, nullptr, mozilla::net::Seer::Create },
     { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
     { NS_IOSERVICE_CONTRACTID, &kNS_IOSERVICE_CID },
     { NS_NETUTIL_CONTRACTID, &kNS_IOSERVICE_CID },
     { NS_STREAMTRANSPORTSERVICE_CONTRACTID, &kNS_STREAMTRANSPORTSERVICE_CID },
     { NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &kNS_SOCKETTRANSPORTSERVICE_CID },
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
@@ -370,17 +370,17 @@ static bool HostIgnoredByProxy(const nsA
     --slash;
   } else {
     slash = end;
   }
 
   nsDependentCSubstring ignoreStripped(start, slash);
   PRIPv6Addr ignoreAddr, hostAddr;
   if (!ConvertToIPV6Addr(ignoreStripped, &ignoreAddr, &mask) ||
-      !ConvertToIPV6Addr(aHost, &hostAddr, NULL))
+      !ConvertToIPV6Addr(aHost, &hostAddr, nullptr))
     return false;
 
   proxy_MaskIPv6Addr(ignoreAddr, mask);
   proxy_MaskIPv6Addr(hostAddr, mask);
   
   return memcmp(&ignoreAddr, &hostAddr, sizeof(PRIPv6Addr)) == 0;
 }
 
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -42,17 +42,17 @@ typedef NSInteger NSWindowAnimationBehav
 @interface NSWindow (LionWindowFeatures)
 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
 - (void)toggleFullScreen:(id)sender;
 @end
 
 #endif
 
 typedef struct _nsCocoaWindowList {
-  _nsCocoaWindowList() : prev(NULL), window(NULL) {}
+  _nsCocoaWindowList() : prev(nullptr), window(nullptr) {}
   struct _nsCocoaWindowList *prev;
   nsCocoaWindow *window; // Weak
 } nsCocoaWindowList;
 
 // NSWindow subclass that is the base class for all of our own window classes.
 // Among other things, this class handles the storage of those settings that
 // need to be persisted across window destruction and reconstruction, i.e. when
 // switching to and from fullscreen mode.
--- a/widget/gonk/Framebuffer.cpp
+++ b/widget/gonk/Framebuffer.cpp
@@ -157,19 +157,19 @@ GetSize(nsIntSize *aScreenSize) {
 void
 Close()
 {
     if (0 > sFd)
         return;
 
     munmap(Buffers()[0]->Data(), sMappedSize);
     delete sBuffers;
-    sBuffers = NULL;
+    sBuffers = nullptr;
     delete sScreenSize;
-    sScreenSize = NULL;
+    sScreenSize = nullptr;
 
     close(sFd);
     sFd = -1;
 }
 
 gfxASurface*
 BackBuffer()
 {
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -141,17 +141,17 @@ WinUtils::GetWindowsServicePackVersion(U
 
   return true;
 }
 
 // static
 void
 WinUtils::LogW(const wchar_t *fmt, ...)
 {
-  va_list args = NULL;
+  va_list args = nullptr;
   if(!lstrlenW(fmt)) {
     return;
   }
   va_start(args, fmt);
   int buflen = _vscwprintf(fmt, args);
   wchar_t* buffer = new wchar_t[buflen+1];
   if (!buffer) {
     va_end(args);
@@ -164,18 +164,18 @@ WinUtils::LogW(const wchar_t *fmt, ...)
   OutputDebugStringW(buffer);
   OutputDebugStringW(L"\n");
 
   int len = wcslen(buffer);
   if (len) {
     char* utf8 = new char[len+1];
     memset(utf8, 0, sizeof(utf8));
     if (WideCharToMultiByte(CP_ACP, 0, buffer,
-                            -1, utf8, len+1, NULL,
-                            NULL) > 0) {
+                            -1, utf8, len+1, nullptr,
+                            nullptr) > 0) {
       // desktop console
       printf("%s\n", utf8);
 #ifdef PR_LOGGING
       NS_ASSERTION(gWindowsLog, "Called WinUtils Log() but Widget "
                                    "log module doesn't exist!");
       PR_LOG(gWindowsLog, PR_LOG_ALWAYS, (utf8));
 #endif
     }
@@ -183,17 +183,17 @@ WinUtils::LogW(const wchar_t *fmt, ...)
   }
   delete[] buffer;
 }
 
 // static
 void
 WinUtils::Log(const char *fmt, ...)
 {
-  va_list args = NULL;
+  va_list args = nullptr;
   if(!strlen(fmt)) {
     return;
   }
   va_start(args, fmt);
   int buflen = _vscprintf(fmt, args);
   char* buffer = new char[buflen+1];
   if (!buffer) {
     va_end(args);
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -62,18 +62,18 @@ nsresult GetProfileHDDInfo(nsAutoCString
     size_t volumeMountPointLen = wcslen(volumeMountPoint);
     // Since we would like to open a drive and not a directory, we need to
     // remove any trailing backslash. A drive handle is valid for
     // DeviceIoControl calls, a directory handle is not.
     if (volumeMountPoint[volumeMountPointLen - 1] == L'\\') {
       volumeMountPoint[volumeMountPointLen - 1] = L'\0';
     }
     ScopedHandle handle(::CreateFileW(volumeMountPoint, 0,
-                                      FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
-                                      OPEN_EXISTING, 0, NULL));
+                                      FILE_SHARE_READ | FILE_SHARE_WRITE,
+                                      nullptr, OPEN_EXISTING, 0, nullptr));
     if (!handle.IsValid()) {
         return NS_ERROR_UNEXPECTED;
     }
     STORAGE_PROPERTY_QUERY queryParameters = {StorageDeviceProperty,
                                               PropertyStandardQuery};
     STORAGE_DEVICE_DESCRIPTOR outputHeader = {sizeof(STORAGE_DEVICE_DESCRIPTOR)};
     DWORD bytesRead = 0;
     if (!::DeviceIoControl(handle, IOCTL_STORAGE_QUERY_PROPERTY,
--- a/xpcom/build/LateWriteChecks.cpp
+++ b/xpcom/build/LateWriteChecks.cpp
@@ -62,17 +62,17 @@ public:
     }
     void Finish(SHA1Sum::Hash &aHash)
     {
         int fd = fileno(mFile);
         fflush(mFile);
         MozillaUnRegisterDebugFD(fd);
         fclose(mFile);
         mSHA1.finish(aHash);
-        mFile = NULL;
+        mFile = nullptr;
     }
 private:
     FILE *mFile;
     SHA1Sum mSHA1;
 };
 
 static void RecordStackWalker(void *aPC, void *aSP, void *aClosure)
 {
@@ -132,18 +132,18 @@ void LateWriteObserver::Observe(IOInterp
   // We want the sha1 of the entire file, so please don't write to fd
   // directly; use sha1Stream.
   FILE *stream;
 #ifdef XP_WIN
   HANDLE hFile;
   do {
     // mkstemp isn't supported so keep trying until we get a file
     int result = _mktemp_s(name, strlen(name) + 1);
-    hFile = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_NEW,
-                        FILE_ATTRIBUTE_NORMAL, NULL);
+    hFile = CreateFileA(name, GENERIC_WRITE, 0, nullptr, CREATE_NEW,
+                        FILE_ATTRIBUTE_NORMAL, nullptr);
   } while (GetLastError() == ERROR_FILE_EXISTS);
 
   if (hFile == INVALID_HANDLE_VALUE) {
     NS_RUNTIMEABORT("Um, how did we get here?");
   }
 
   // http://support.microsoft.com/kb/139640
   int fd = _open_osfhandle((intptr_t)hFile, _O_APPEND);