Bug 784739 - Switch from NULL to nullptr in miscellaneous directories; r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 25 Nov 2013 14:02:47 -0500
changeset 172031 df7dd1ef49dbef161a992edb3ea0fce343502beb
parent 172030 525c491135407a5b8526d28e565565ec37c1352a
child 172032 8b28c258bc84eef6b704d181ecbdcc04f8fbc065
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
gfx/2d/DrawTargetD2D1.h
gfx/tests/gtest/gfxFontSelectionTest.cpp
gfx/ycbcr/ycbcr_to_rgb565.cpp
intl/lwbrk/src/nsCarbonBreaker.cpp
js/src/builtin/TestingFunctions.cpp
js/src/vm/GlobalObject.cpp
media/omx-plugin/OmxPlugin.cpp
netwerk/sctp/datachannel/DataChannel.cpp
testing/gtest/mozilla/GTestRunner.cpp
testing/mochitest/ssltunnel/ssltunnel.cpp
testing/tools/screenshot/gdk-screenshot.cpp
testing/tools/screenshot/win32-screenshot.cpp
toolkit/system/gnome/nsGIOService.cpp
widget/nsIRollupListener.h
xpcom/build/PoisonIOInterposerMac.cpp
xpcom/io/nsStorageStream.cpp
--- a/gfx/2d/DrawTargetD2D1.h
+++ b/gfx/2d/DrawTargetD2D1.h
@@ -180,17 +180,17 @@ private:
   // We store this to prevent excessive SetTextRenderingParams calls.
   RefPtr<IDWriteRenderingParams> mTextRenderingParams;
 
   // List of pushed clips.
   struct PushedClip
   {
     D2D1_RECT_F mBounds;
     union {
-      // If mPath is non-NULL, the mTransform member will be used, otherwise
+      // If mPath is non-null, the mTransform member will be used, otherwise
       // the mIsPixelAligned member is valid.
       D2D1_MATRIX_3X2_F mTransform;
       bool mIsPixelAligned;
     };
     RefPtr<PathD2D> mPath;
   };
   std::vector<PushedClip> mPushedClips;
 
--- a/gfx/tests/gtest/gfxFontSelectionTest.cpp
+++ b/gfx/tests/gtest/gfxFontSelectionTest.cpp
@@ -117,17 +117,17 @@ struct TestEntry {
         LiteralArray glyphs;
     };
 
     void SetRTL()
     {
         isRTL = true;
     }
 
-    // empty/NULL fontName means ignore font name
+    // Empty/nullptr fontName means ignore font name
     void Expect (const char *platform,
                  const char *fontName,
                  const LiteralArray& glyphs)
     {
         if (fontName)
             Expect (platform, nsDependentCString(fontName), glyphs);
         else
             Expect (platform, nsCString(), glyphs);
--- a/gfx/ycbcr/ycbcr_to_rgb565.cpp
+++ b/gfx/ycbcr/ycbcr_to_rgb565.cpp
@@ -338,18 +338,19 @@ NS_GFX_(void) ScaleYCbCrToRGB565(const u
     "ScaleYCbCrToRGB565 source image unpadded?");
   /*The NEON code requires the pointers to be aligned to a 16-byte boundary at
      the start of each row.
     This should be true for all of our sources.
     We could try to fix this up if it's not true by adjusting source_x0, but
      that would require the mis-alignment to be the same for the U and V
      planes.*/
   NS_ASSERTION((y_pitch&15) == 0 && (uv_pitch&15) == 0 &&
-   ((y_buf-(uint8_t *)NULL)&15) == 0 &&
-   ((u_buf-(uint8_t *)NULL)&15) == 0 && ((v_buf-(uint8_t *)NULL)&15) == 0,
+   ((y_buf-(uint8_t *)nullptr)&15) == 0 &&
+   ((u_buf-(uint8_t *)nullptr)&15) == 0 &&
+   ((v_buf-(uint8_t *)nullptr)&15) == 0,
    "ScaleYCbCrToRGB565 source image unaligned");
   /*We take an area-based approach to pixel coverage to avoid shifting by small
      amounts (or not so small, when up-scaling or down-scaling by a large
      factor).
 
     An illustrative example: scaling 4:2:0 up by 2, using JPEG chroma cositing^.
 
     + = RGB destination locations
--- a/intl/lwbrk/src/nsCarbonBreaker.cpp
+++ b/intl/lwbrk/src/nsCarbonBreaker.cpp
@@ -16,17 +16,20 @@ NS_GetComplexLineBreaks(const PRUnichar*
 
   memset(aBreakBefore, 0, aLength * sizeof(uint8_t));
 
   CFStringRef str = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(aText), aLength, kCFAllocatorNull);
   if (!str) {
     return;
   }
 
-  CFStringTokenizerRef st = ::CFStringTokenizerCreate(kCFAllocatorDefault, str, ::CFRangeMake(0, aLength), kCFStringTokenizerUnitLineBreak, NULL);
+  CFStringTokenizerRef st = ::CFStringTokenizerCreate(kCFAllocatorDefault, str,
+                                                      ::CFRangeMake(0, aLength),
+                                                      kCFStringTokenizerUnitLineBreak,
+                                                      nullptr);
   if (!st) {
     ::CFRelease(str);
     return;
   }
 
   CFStringTokenizerTokenType tt = ::CFStringTokenizerAdvanceToNextToken(st);
   while (tt != kCFStringTokenizerTokenNone) {
     CFRange r = ::CFStringTokenizerGetCurrentTokenRange(st);
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -698,17 +698,17 @@ CountHeap(JSContext *cx, unsigned argc, 
                            "the first argument is not null or a heap-allocated "
                            "thing");
             return false;
         }
     }
 
     RootedValue traceValue(cx);
     int32_t traceKind = -1;
-    void *traceThing = NULL;
+    void *traceThing = nullptr;
     if (args.length() > 1) {
         JSString *str = ToString(cx, args[1]);
         if (!str)
             return false;
         JSFlatString *flatStr = JS_FlattenString(cx, str);
         if (!flatStr)
             return false;
         if (JS_FlatStringEqualsAscii(flatStr, "specific")) {
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -512,17 +512,17 @@ GlobalObject::isRuntimeCodeGenEnabled(JS
 
 /* static */ bool
 GlobalObject::warnOnceAboutWatch(JSContext *cx, HandleObject obj)
 {
     Rooted<GlobalObject*> global(cx, &obj->global());
     HeapSlot &v = global->getSlotRef(WARNED_WATCH_DEPRECATED);
     if (v.isUndefined()) {
         // Warn only once per global object.
-        if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage, NULL,
+        if (!JS_ReportErrorFlagsAndNumber(cx, JSREPORT_WARNING, js_GetErrorMessage, nullptr,
                                           JSMSG_OBJECT_WATCH_DEPRECATED))
         {
             return false;
         }
         v.init(global, HeapSlot::Slot, WARNED_WATCH_DEPRECATED, BooleanValue(true));
     }
     return true;
 }
--- a/media/omx-plugin/OmxPlugin.cpp
+++ b/media/omx-plugin/OmxPlugin.cpp
@@ -1,13 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
 #include <stagefright/ColorConverter.h>
 #include <stagefright/DataSource.h>
 #include <stagefright/MediaExtractor.h>
 #include <stagefright/MetaData.h>
 #include <stagefright/OMXCodec.h>
 #include <media/stagefright/MediaErrors.h>
 #ifdef MOZ_WIDGET_GONK
 #include <OMX.h>
@@ -112,21 +113,21 @@ public:
   }
 
   void GetAudioParameters(int32_t *numChannels, int32_t *sampleRate) {
     *numChannels = mAudioChannels;
     *sampleRate = mAudioSampleRate;
   }
 
   bool HasVideo() {
-    return mVideoSource != NULL;
+    return mVideoSource != nullptr;
   }
 
   bool HasAudio() {
-    return mAudioSource != NULL;
+    return mAudioSource != nullptr;
   }
 
   bool ReadVideo(VideoFrame *aFrame, int64_t aSeekTimeUs, BufferCallback *aBufferCallback);
   bool ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs);
 };
 
 OmxDecoder::OmxDecoder(PluginHost *aPluginHost, Decoder *aDecoder) :
   mPluginHost(aPluginHost),
@@ -137,19 +138,19 @@ OmxDecoder::OmxDecoder(PluginHost *aPlug
   mVideoStride(0),
   mVideoSliceHeight(0),
   mVideoCropLeft(0),
   mVideoCropTop(0),
   mVideoRotation(0),
   mAudioChannels(-1),
   mAudioSampleRate(-1),
   mDurationUs(-1),
-  mVideoBuffer(NULL),
-  mAudioBuffer(NULL),
-  mColorConverter(NULL),
+  mVideoBuffer(nullptr),
+  mAudioBuffer(nullptr),
+  mColorConverter(nullptr),
   mAudioMetadataRead(false)
 {
 }
 
 OmxDecoder::~OmxDecoder()
 {
   ReleaseVideoBuffer();
   ReleaseAudioBuffer();
@@ -179,19 +180,19 @@ public:
   }
 
   ~AutoStopMediaSource() {
     mMediaSource->stop();
   }
 };
 
 #ifdef MOZ_WIDGET_GONK
-static sp<IOMX> sOMX = NULL;
+static sp<IOMX> sOMX = nullptr;
 static sp<IOMX> GetOMX() {
-  if(sOMX.get() == NULL) {
+  if(sOMX.get() == nullptr) {
     sOMX = reinterpret_cast<IOMX*>(new OMX);
   }
   return sOMX;
 }
 #endif
 
 static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
 {
@@ -228,19 +229,19 @@ static uint32_t GetVideoCreationFlags(Pl
 static sp<MediaSource> CreateVideoSource(PluginHost* aPluginHost,
                                          const sp<IOMX>& aOmx,
                                          const sp<MediaSource>& aVideoTrack)
 {
   uint32_t flags = GetVideoCreationFlags(aPluginHost);
   if (flags == DEFAULT_STAGEFRIGHT_FLAGS) {
     // Let Stagefright choose hardware or software decoder.
     sp<MediaSource> videoSource = OMXCodec::Create(aOmx, aVideoTrack->getFormat(),
-                                                   false, aVideoTrack, NULL, flags);
-    if (videoSource == NULL)
-      return NULL;
+                                                   false, aVideoTrack, nullptr, flags);
+    if (videoSource == nullptr)
+      return nullptr;
 
     // Now that OMXCodec has parsed the video's AVCDecoderConfigurationRecord,
     // check whether we know how to decode this video.
     int32_t videoColorFormat;
     if (videoSource->getFormat()->findInt32(kKeyColorFormat, &videoColorFormat)) {
       switch (videoColorFormat) {
         // We know how to convert these color formats.
         case OMX_COLOR_FormatCbYCrY:
@@ -276,38 +277,38 @@ static sp<MediaSource> CreateVideoSource
     flags = DEFAULT_STAGEFRIGHT_FLAGS | OMXCodec::kPreferSoftwareCodecs;
 #else
     flags = DEFAULT_STAGEFRIGHT_FLAGS | OMXCodec::kSoftwareCodecsOnly;
 #endif
   }
 
   MOZ_ASSERT(flags != DEFAULT_STAGEFRIGHT_FLAGS);
   return OMXCodec::Create(aOmx, aVideoTrack->getFormat(), false, aVideoTrack,
-                          NULL, flags);
+                          nullptr, flags);
 }
 
 bool OmxDecoder::Init() {
   //register sniffers, if they are not registered in this process.
   DataSource::RegisterDefaultSniffers();
 
   sp<DataSource> dataSource =
     DataSource::CreateFromURI(static_cast<char*>(mDecoder->mResource));
   if (!dataSource.get() || dataSource->initCheck()) {
     return false;
   }
 
   sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource);
-  if (extractor == NULL) {
+  if (extractor == nullptr) {
     return false;
   }
 
   ssize_t audioTrackIndex = -1;
   ssize_t videoTrackIndex = -1;
-  const char *audioMime = NULL;
-  const char *videoMime = NULL;
+  const char *audioMime = nullptr;
+  const char *videoMime = nullptr;
 
   for (size_t i = 0; i < extractor->countTracks(); ++i) {
     sp<MetaData> meta = extractor->getTrackMetaData(i);
 
     const char *mime;
     if (!meta->findCString(kKeyMIMEType, &mime)) {
       continue;
     }
@@ -336,24 +337,24 @@ bool OmxDecoder::Init() {
   if (mClient.connect() != OK) {
     LOG("OMXClient failed to connect");
   }
   sp<IOMX> omx = mClient.interface();
 #endif
 
   sp<MediaSource> videoTrack;
   sp<MediaSource> videoSource;
-  if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != NULL) {
+  if (videoTrackIndex != -1 && (videoTrack = extractor->getTrack(videoTrackIndex)) != nullptr) {
 #if defined(MOZ_ANDROID_FROYO)
     // Allow up to 720P video.
     sp<MetaData> meta = extractor->getTrackMetaData(videoTrackIndex);
     meta->setInt32(kKeyMaxInputSize, (1280 * 720 * 3) / 2);
 #endif
     videoSource = CreateVideoSource(mPluginHost, omx, videoTrack);
-    if (videoSource == NULL) {
+    if (videoSource == nullptr) {
       LOG("OMXCodec failed to initialize video decoder for \"%s\"", videoMime);
       return false;
     }
     status_t status = videoSource->start();
     if (status != OK) {
       LOG("videoSource->start() failed with status %#x", status);
       return false;
     }
@@ -363,28 +364,28 @@ bool OmxDecoder::Init() {
         LOG("video duration %lld should be nonnegative", durationUs);
       if (durationUs > totalDurationUs)
         totalDurationUs = durationUs;
     }
   }
 
   sp<MediaSource> audioTrack;
   sp<MediaSource> audioSource;
-  if (audioTrackIndex != -1 && (audioTrack = extractor->getTrack(audioTrackIndex)) != NULL)
+  if (audioTrackIndex != -1 && (audioTrack = extractor->getTrack(audioTrackIndex)) != nullptr)
   {
     if (!strcasecmp(audioMime, "audio/raw")) {
       audioSource = audioTrack;
     } else {
       audioSource = OMXCodec::Create(omx,
                                      audioTrack->getFormat(),
                                      false, // decoder
                                      audioTrack);
     }
 
-    if (audioSource == NULL) {
+    if (audioSource == nullptr) {
       LOG("OMXCodec failed to initialize audio decoder for \"%s\"", audioMime);
       return false;
     }
 
     status_t status = audioSource->start();
     if (status != OK) {
       LOG("audioSource->start() failed with status %#x", status);
       return false;
@@ -539,24 +540,24 @@ bool OmxDecoder::SetAudioFormat() {
   }
 
   return true;
 }
 
 void OmxDecoder::ReleaseVideoBuffer() {
   if (mVideoBuffer) {
     mVideoBuffer->release();
-    mVideoBuffer = NULL;
+    mVideoBuffer = nullptr;
   }
 }
 
 void OmxDecoder::ReleaseAudioBuffer() {
   if (mAudioBuffer) {
     mAudioBuffer->release();
-    mAudioBuffer = NULL;
+    mAudioBuffer = nullptr;
   }
 }
 
 void OmxDecoder::ToVideoFrame_YUV420Planar(VideoFrame *aFrame, int64_t aTimeUs, void *aData, size_t aSize, bool aKeyFrame) {
   void *y = aData;
   void *u = static_cast<uint8_t *>(y) + mVideoStride * mVideoSliceHeight;
   void *v = static_cast<uint8_t *>(u) + mVideoStride/2 * mVideoSliceHeight/2;
   aFrame->Set(aTimeUs, aKeyFrame,
@@ -894,17 +895,17 @@ static bool Match(const char *aMimeChars
 
 static const char* const gCodecs[] = {
   "avc1.42E01E",  // H.264 Constrained Baseline Profile Level 3.0
   "avc1.42001E",  // H.264 Baseline Profile Level 3.0
   "avc1.42001F",  // H.264 Baseline Profile Level 3.1
   "avc1.4D401E",  // H.264 Main Profile Level 3.0
   "avc1.4D401F",  // H.264 Main Profile Level 3.1
   "mp4a.40.2",    // AAC-LC
-  NULL
+  nullptr
 };
 
 static bool CanDecode(const char *aMimeChars, size_t aMimeLen, const char* const**aCodecs)
 {
   if (!Match(aMimeChars, aMimeLen, "video/mp4") &&
       !Match(aMimeChars, aMimeLen, "audio/mp4") &&
       !Match(aMimeChars, aMimeLen, "audio/mpeg") &&
       !Match(aMimeChars, aMimeLen, "application/octet-stream")) { // file urls
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -640,17 +640,17 @@ DataChannelConnection::ProcessQueuedOpen
 void
 DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
                                      const unsigned char *data, size_t len)
 {
 #ifdef PR_LOGGING
   if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) {
     char *buf;
 
-    if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != NULL) {
+    if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != nullptr) {
       PR_LogPrint("%s", buf);
       usrsctp_freedumpbuffer(buf);
     }
   }
 #endif
   // Pass the data to SCTP
   usrsctp_conninput(static_cast<void *>(this), data, len, 0);
 }
@@ -672,17 +672,17 @@ DataChannelConnection::SctpDtlsOutput(vo
 {
   DataChannelConnection *peer = static_cast<DataChannelConnection *>(addr);
   int res;
 
 #ifdef PR_LOGGING
   if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) {
     char *buf;
 
-    if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != NULL) {
+    if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != nullptr) {
       PR_LogPrint("%s", buf);
       usrsctp_freedumpbuffer(buf);
     }
   }
 #endif
   // We're async proxying even if on the STSThread because this is called
   // with internal SCTP locks held in some cases (such as in usrsctp_connect()).
   // SCTP has an option for Apple, on IP connections only, to release at least
--- a/testing/gtest/mozilla/GTestRunner.cpp
+++ b/testing/gtest/mozilla/GTestRunner.cpp
@@ -106,17 +106,17 @@ int RunGTestFunc()
     }
   }
 #endif
 
   return RUN_ALL_TESTS();
 }
 
 // We use a static var 'RunGTest' defined in nsAppRunner.cpp.
-// RunGTest is initialized to NULL but if GTest (this file)
+// RunGTest is initialized to nullptr but if GTest (this file)
 // is linked in then RunGTest will be set here indicating
 // GTest is supported.
 class _InitRunGTest {
 public:
   _InitRunGTest() {
     RunGTest = RunGTestFunc;
   }
 } InitRunGTest;
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -129,17 +129,17 @@ char* strtok2(char* string, const char* 
     if (IS_DELIM(delimTable, static_cast<uint8_t>(*str))) {
       *str++ = '\0';
       break;
     }
     str++;
   }
   *newStr = str;
   
-  return str == result ? NULL : result;
+  return str == result ? nullptr : result;
 }
 
 
 
 enum client_auth_option {
   caNone = 0,
   caRequire = 1,
   caRequest = 2
@@ -213,19 +213,19 @@ const uint32_t INITIAL_THREADS = 2;
 const uint32_t MAX_THREADS = 100;
 const uint32_t DEFAULT_STACKSIZE = (512 * 1024);
 
 // global data
 string nssconfigdir;
 vector<server_info_t> servers;
 PRNetAddr remote_addr;
 PRNetAddr websocket_server;
-PRThreadPool* threads = NULL;
-PRLock* shutdown_lock = NULL;
-PRCondVar* shutdown_condvar = NULL;
+PRThreadPool* threads = nullptr;
+PRLock* shutdown_lock = nullptr;
+PRCondVar* shutdown_condvar = nullptr;
 // Not really used, unless something fails to start
 bool shutdown_server = false;
 bool do_http_proxy = false;
 bool any_host_spec_config = false;
 
 int ClientAuthValueComparator(const void *v1, const void *v2)
 {
   int a = *static_cast<const client_auth_option*>(v1) -
@@ -317,29 +317,29 @@ bool ReadConnectRequest(server_info_t* s
   return true;
 }
 
 bool ConfigureSSLServerSocket(PRFileDesc* socket, server_info_t* si, string &certificate, client_auth_option clientAuth)
 {
   const char* certnick = certificate.empty() ?
       si->cert_nickname.c_str() : certificate.c_str();
 
-  ScopedCERTCertificate cert(PK11_FindCertFromNickname(certnick, NULL));
+  ScopedCERTCertificate cert(PK11_FindCertFromNickname(certnick, nullptr));
   if (!cert) {
     LOG_ERROR(("Failed to find cert %s\n", certnick));
     return false;
   }
 
-  ScopedSECKEYPrivateKey privKey(PK11_FindKeyByAnyCert(cert, NULL));
+  ScopedSECKEYPrivateKey privKey(PK11_FindKeyByAnyCert(cert, nullptr));
   if (!privKey) {
     LOG_ERROR(("Failed to find private key\n"));
     return false;
   }
 
-  PRFileDesc* ssl_socket = SSL_ImportFD(NULL, socket);
+  PRFileDesc* ssl_socket = SSL_ImportFD(nullptr, socket);
   if (!ssl_socket) {
     LOG_ERROR(("Error importing SSL socket\n"));
     return false;
   }
 
   SSLKEAType certKEA = NSS_FindCertKEAType(cert);
   if (SSL_ConfigSecureServer(ssl_socket, cert, privKey, certKEA)
       != SECSuccess) {
@@ -929,31 +929,31 @@ void StartServer(void* data)
       delete ci;
   }
 }
 
 // bogus password func, just don't use passwords. :-P
 char* password_func(PK11SlotInfo* slot, PRBool retry, void* arg)
 {
   if (retry)
-    return NULL;
+    return nullptr;
 
   return PL_strdup("");
 }
 
 server_info_t* findServerInfo(int portnumber)
 {
   for (vector<server_info_t>::iterator it = servers.begin();
        it != servers.end(); it++) 
   {
     if (it->listen_port == portnumber)
       return &(*it);
   }
 
-  return NULL;
+  return nullptr;
 }
 
 int processConfigLine(char* configLine)
 {
   if (*configLine == 0 || *configLine == '#')
     return 0;
 
   char* _caret;
@@ -1004,17 +1004,17 @@ int processConfigLine(char* configLine)
 
     return 0;
   }
 
   // Configure all listen sockets and port+certificate bindings
   if (!strcmp(keyword, "listen"))
   {
     char* hostname = strtok2(_caret, ":", &_caret);
-    char* hostportstring = NULL;
+    char* hostportstring = nullptr;
     if (strcmp(hostname, "*"))
     {
       any_host_spec_config = true;
       hostportstring = strtok2(_caret, ":", &_caret);
     }
 
     char* serverportstring = strtok2(_caret, ":", &_caret);
     char* certnick = strtok2(_caret, ":", &_caret);
@@ -1041,29 +1041,32 @@ int processConfigLine(char* configLine)
         return 1;
       }
     }
     else
     {
       server_info_t server;
       server.cert_nickname = certnick;
       server.listen_port = port;
-      server.host_cert_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings, PL_CompareStrings, NULL, NULL);
+      server.host_cert_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings,
+                                               PL_CompareStrings, nullptr, nullptr);
       if (!server.host_cert_table)
       {
         LOG_ERROR(("Internal, could not create hash table\n"));
         return 1;
       }
-      server.host_clientauth_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings, ClientAuthValueComparator, NULL, NULL);
+      server.host_clientauth_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings,
+                                                     ClientAuthValueComparator, nullptr, nullptr);
       if (!server.host_clientauth_table)
       {
         LOG_ERROR(("Internal, could not create hash table\n"));
         return 1;
       }
-      server.host_redir_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings, PL_CompareStrings, NULL, NULL);
+      server.host_redir_table = PL_NewHashTable(0, PL_HashString, PL_CompareStrings,
+                                                PL_CompareStrings, nullptr, nullptr);
       if (!server.host_redir_table)
       {
         LOG_ERROR(("Internal, could not create hash table\n"));
         return 1;
       }
       servers.push_back(server);
     }
 
@@ -1340,17 +1343,17 @@ int main(int argc, char** argv)
     PR_ShutdownThreadPool(threads);
     PR_DestroyCondVar(shutdown_condvar);
     PR_DestroyLock(shutdown_lock);
     NSS_Shutdown();
     return 1;
   }
 
   // these values should make NSS use the defaults
-  if (SSL_ConfigServerSessionIDCache(0, 0, 0, NULL) != SECSuccess) {
+  if (SSL_ConfigServerSessionIDCache(0, 0, 0, nullptr) != SECSuccess) {
     LOG_ERROR(("SSL_ConfigServerSessionIDCache failed\n"));
     PR_ShutdownThreadPool(threads);
     PR_DestroyCondVar(shutdown_condvar);
     PR_DestroyLock(shutdown_lock);
     NSS_Shutdown();
     return 1;
   }
 
@@ -1373,19 +1376,19 @@ int main(int argc, char** argv)
   PR_DestroyLock(shutdown_lock);
   if (NSS_Shutdown() == SECFailure) {
     LOG_DEBUG(("Leaked NSS objects!\n"));
   }
   
   for (vector<server_info_t>::iterator it = servers.begin();
        it != servers.end(); it++) 
   {
-    PL_HashTableEnumerateEntries(it->host_cert_table, freeHostCertHashItems, NULL);
-    PL_HashTableEnumerateEntries(it->host_clientauth_table, freeClientAuthHashItems, NULL);
-    PL_HashTableEnumerateEntries(it->host_redir_table, freeHostRedirHashItems, NULL);
+    PL_HashTableEnumerateEntries(it->host_cert_table, freeHostCertHashItems, nullptr);
+    PL_HashTableEnumerateEntries(it->host_clientauth_table, freeClientAuthHashItems, nullptr);
+    PL_HashTableEnumerateEntries(it->host_redir_table, freeHostRedirHashItems, nullptr);
     PL_HashTableDestroy(it->host_cert_table);
     PL_HashTableDestroy(it->host_clientauth_table);
     PL_HashTableDestroy(it->host_redir_table);
   }
 
   PR_Cleanup();
   return 0;
 }
--- a/testing/tools/screenshot/gdk-screenshot.cpp
+++ b/testing/tools/screenshot/gdk-screenshot.cpp
@@ -72,17 +72,17 @@ int main(int argc, char** argv)
     XScreenSaverInfo* info = XScreenSaverAllocInfo();
     if (!info) {
       fprintf(stderr, "%s: Out of memory\n", argv[0]);
       return 1;
     }
     XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), info);
 
     const char* state;
-    const char* til_or_since = NULL;
+    const char* til_or_since = nullptr;
     switch (info->state) {
     case ScreenSaverOff:
       state = "Off";
       til_or_since = "XScreenSaver will activate after another %lu seconds idle time\n";
       break;
     case ScreenSaverOn:
       state = "On";
       if (info->til_or_since) {
@@ -122,35 +122,35 @@ int main(int argc, char** argv)
 
     fprintf(stderr, "User input has been idle for %lu seconds\n", info->idle / 1000);
 
     XFree(info);
   }
 #endif
 
   GdkWindow* window = gdk_get_default_root_window();
-  GdkPixbuf* screenshot = NULL;
+  GdkPixbuf* screenshot = nullptr;
 // TODO GTK3
 #if (MOZ_WIDGET_GTK == 2)
-  screenshot = gdk_pixbuf_get_from_drawable(NULL, window, NULL,
+  screenshot = gdk_pixbuf_get_from_drawable(nullptr, window, nullptr,
                                             0, 0, 0, 0,
                                             gdk_screen_width(),
                                             gdk_screen_height());
 #endif
   if (!screenshot) {
     fprintf(stderr, "%s: failed to create screenshot GdkPixbuf\n", argv[0]);
     return 1;
   }
 
-  GError* error = NULL;
+  GError* error = nullptr;
   if (argc > 1) {
-    gdk_pixbuf_save(screenshot, argv[1], "png", &error, NULL);
+    gdk_pixbuf_save(screenshot, argv[1], "png", &error, nullptr);
   } else {
-    gdk_pixbuf_save_to_callback(screenshot, save_to_stdout, NULL,
-                                "png", &error, NULL);
+    gdk_pixbuf_save_to_callback(screenshot, save_to_stdout, nullptr,
+                                "png", &error, nullptr);
   }
   if (error) {
     fprintf(stderr, "%s: failed to write screenshot as png: %s\n",
             argv[0], error->message);
     return error->code;
   }
 
   return 0;
--- a/testing/tools/screenshot/win32-screenshot.cpp
+++ b/testing/tools/screenshot/win32-screenshot.cpp
@@ -41,24 +41,24 @@
 using namespace Gdiplus;
 
 // From http://msdn.microsoft.com/en-us/library/ms533843%28VS.85%29.aspx
 static int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
 {
   UINT  num = 0;          // number of image encoders
   UINT  size = 0;         // size of the image encoder array in bytes
 
-  ImageCodecInfo* pImageCodecInfo = NULL;
+  ImageCodecInfo* pImageCodecInfo = nullptr;
 
   GetImageEncodersSize(&num, &size);
   if(size == 0)
     return -1;  // Failure
 
   pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
-  if(pImageCodecInfo == NULL)
+  if(pImageCodecInfo == nullptr)
     return -1;  // Failure
 
   GetImageEncoders(num, size, pImageCodecInfo);
 
   for(UINT j = 0; j < num; ++j)
     {
       if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
         {
@@ -74,34 +74,34 @@ static int GetEncoderClsid(const WCHAR* 
 
 #ifdef __MINGW32__
 extern "C"
 #endif
 int wmain(int argc, wchar_t** argv)
 {
   GdiplusStartupInput gdiplusStartupInput;
   ULONG_PTR gdiplusToken;
-  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+  GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);
 
   HWND desktop = GetDesktopWindow();
   HDC desktopdc = GetDC(desktop);
   HDC mydc = CreateCompatibleDC(desktopdc);
   int width = GetSystemMetrics(SM_CXSCREEN);
   int height = GetSystemMetrics(SM_CYSCREEN);
   HBITMAP mybmp = CreateCompatibleBitmap(desktopdc, width, height);
   HBITMAP oldbmp = (HBITMAP)SelectObject(mydc, mybmp);
   BitBlt(mydc,0,0,width,height,desktopdc,0,0, SRCCOPY|CAPTUREBLT);
   SelectObject(mydc, oldbmp);
 
   const wchar_t* filename = (argc > 1) ? argv[1] : L"screenshot.png";
-  Bitmap* b = Bitmap::FromHBITMAP(mybmp, NULL);
+  Bitmap* b = Bitmap::FromHBITMAP(mybmp, nullptr);
   CLSID  encoderClsid;
   Status stat = GenericError;
   if (b && GetEncoderClsid(L"image/png", &encoderClsid) != -1) {
-    stat = b->Save(filename, &encoderClsid, NULL);
+    stat = b->Save(filename, &encoderClsid, nullptr);
   }
   if (b)
     delete b;
   
   // cleanup
   GdiplusShutdown(gdiplusToken);
   ReleaseDC(desktop, desktopdc);
   DeleteObject(mybmp);
--- a/toolkit/system/gnome/nsGIOService.cpp
+++ b/toolkit/system/gnome/nsGIOService.cpp
@@ -400,17 +400,17 @@ nsGIOService::OrgFreedesktopFileManager1
     if (error) {
       g_printerr("Failed to open connection to session bus: %s\n", error->message);
       g_error_free(error);
     }
     return NS_ERROR_FAILURE;
   }
 
   char *uri = g_filename_to_uri(PromiseFlatCString(aPath).get(), nullptr, nullptr);
-  if (uri == NULL) {
+  if (uri == nullptr) {
     return NS_ERROR_FAILURE;
   }
 
   DBusConnection* dbusConnection = dbus_g_connection_get_connection(dbusGConnection);
   // Make sure we do not exit the entire program if DBus connection get lost.
   dbus_connection_set_exit_on_disconnect(dbusConnection, false);
 
   DBusGProxy* dbusGProxy = dbus_g_proxy_new_for_name(dbusGConnection,
--- a/widget/nsIRollupListener.h
+++ b/widget/nsIRollupListener.h
@@ -16,17 +16,17 @@ class nsIntPoint;
 class nsIRollupListener {
  public: 
 
   /**
    * Notifies the object to rollup, optionally returning the node that
    * was just rolled up.
    *
    * aPoint is the mouse pointer position where the event that triggered the
-   * rollup occurred, which may be NULL.
+   * rollup occurred, which may be nullptr.
    *
    * aCount is the number of popups in a chain to close. If this is
    * UINT32_MAX, then all popups are closed.
    * If aLastRolledUp is non-null, it will be set to the last rolled up popup,
    * if this is supported. aLastRolledUp is not addrefed.
    *
    * Returns true if the event that the caller is processing should be consumed.
    */
--- a/xpcom/build/PoisonIOInterposerMac.cpp
+++ b/xpcom/build/PoisonIOInterposerMac.cpp
@@ -133,17 +133,17 @@ bool IsValidWrite(int fd, const void *wb
       return true;
     }
 
     if (IsIPCWrite(fd, buf)) {
       return false;
     }
   }
 
-  // For writev we pass NULL in wbuf. We should only get here from
+  // For writev we pass a nullptr wbuf. We should only get here from
   // dbm, and it uses write, so assert that we have wbuf.
   if (!wbuf) {
     return true;
   }
 
   // Break, here if we're allowed to report non-dirty writes
   if(!sOnlyReportDirtyWrites) {
     return true;
--- a/xpcom/io/nsStorageStream.cpp
+++ b/xpcom/io/nsStorageStream.cpp
@@ -337,17 +337,17 @@ private:
 
 protected:
     NS_METHOD Seek(uint32_t aPosition);
 
     friend class nsStorageStream;
 
 private:
     nsStorageStream* mStorageStream;
-    uint32_t         mReadCursor;    // Next memory location to read byte, or NULL
+    uint32_t         mReadCursor;    // Next memory location to read byte, or 0
     uint32_t         mSegmentEnd;    // One byte past end of current buffer segment
     uint32_t         mSegmentNum;    // Segment number containing read cursor
     uint32_t         mSegmentSize;   // All segments, except the last, are of this size
     uint32_t         mLogicalCursor; // Logical offset into stream
     nsresult         mStatus;
 
     uint32_t SegNum(uint32_t aPosition)    {return aPosition >> mStorageStream->mSegmentSizeLog2;}
     uint32_t SegOffset(uint32_t aPosition) {return aPosition & (mSegmentSize - 1);}