Bug 784739 - Switch from NULL to nullptr in storage/; r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Wed, 31 Jul 2013 11:44:58 -0400
changeset 140792 dfd50d4b9ac6e38ce413fe1713003a04510605c4
parent 140791 417f4d51eba24f710542bdb1f540dc656e57710b
child 140793 553bc5d3430b39be67ff138ed7600222b1681839
push id25041
push userkwierso@gmail.com
push dateThu, 01 Aug 2013 00:32:15 +0000
treeherderautoland@05d3797276d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone25.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 storage/; r=ehsan
rdf/base/src/nsInMemoryDataSource.cpp
storage/build/mozStorageModule.cpp
storage/public/StatementCache.h
storage/src/SQLiteMutex.h
storage/src/StorageBaseStatementInternal.cpp
storage/src/TelemetryVFS.cpp
storage/src/Variant.h
storage/src/mozStorageConnection.cpp
storage/src/mozStorageConnection.h
storage/src/mozStorageSQLFunctions.cpp
storage/src/mozStorageService.cpp
storage/src/mozStorageStatement.cpp
storage/src/mozStorageStatementData.h
storage/src/mozStorageStatementRow.cpp
storage/src/variantToSQLiteT_impl.h
storage/test/test_asyncStatementExecution_transaction.cpp
storage/test/test_true_async.cpp
--- a/rdf/base/src/nsInMemoryDataSource.cpp
+++ b/rdf/base/src/nsInMemoryDataSource.cpp
@@ -192,17 +192,17 @@ Assertion::Assertion(nsIRDFResource* aSo
     u.as.mTruthValue = aTruthValue;
     u.as.mMarked = false;
 }
 
 Assertion::~Assertion()
 {
     if (mHashEntry && u.hash.mPropertyHash) {
         PL_DHashTableEnumerate(u.hash.mPropertyHash, DeletePropertyHashEntry,
-                               NULL);
+                               nullptr);
         PL_DHashTableDestroy(u.hash.mPropertyHash);
         u.hash.mPropertyHash = nullptr;
     }
 
     MOZ_COUNT_DTOR(RDF_Assertion);
 #ifdef DEBUG_REFS
     --gInstanceCount;
     fprintf(stdout, "%d - RDF: Assertion\n", gInstanceCount);
@@ -809,17 +809,17 @@ InMemoryDataSource::~InMemoryDataSource(
     fprintf(stdout, "%d - RDF: InMemoryDataSource\n", gInstanceCount);
 #endif
 
     if (mForwardArcs.ops) {
         // This'll release all of the Assertion objects that are
         // associated with this data source. We only need to do this
         // for the forward arcs, because the reverse arcs table
         // indexes the exact same set of resources.
-        PL_DHashTableEnumerate(&mForwardArcs, DeleteForwardArcsEntry, NULL);
+        PL_DHashTableEnumerate(&mForwardArcs, DeleteForwardArcsEntry, nullptr);
         PL_DHashTableFinish(&mForwardArcs);
     }
     if (mReverseArcs.ops)
         PL_DHashTableFinish(&mReverseArcs);
 
     PR_LOG(gLog, PR_LOG_NOTICE,
            ("InMemoryDataSource(%p): destroyed.", this));
 
--- a/storage/build/mozStorageModule.cpp
+++ b/storage/build/mozStorageModule.cpp
@@ -22,30 +22,30 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR
 
 } // namespace storage
 } // namespace mozilla
 
 NS_DEFINE_NAMED_CID(MOZ_STORAGE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(VACUUMMANAGER_CID);
 
 static const mozilla::Module::CIDEntry kStorageCIDs[] = {
-    { &kMOZ_STORAGE_SERVICE_CID, false, NULL, mozilla::storage::ServiceConstructor },
-    { &kVACUUMMANAGER_CID, false, NULL, mozilla::storage::VacuumManagerConstructor },
-    { NULL }
+    { &kMOZ_STORAGE_SERVICE_CID, false, nullptr, mozilla::storage::ServiceConstructor },
+    { &kVACUUMMANAGER_CID, false, nullptr, mozilla::storage::VacuumManagerConstructor },
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kStorageContracts[] = {
     { MOZ_STORAGE_SERVICE_CONTRACTID, &kMOZ_STORAGE_SERVICE_CID },
     { VACUUMMANAGER_CONTRACTID, &kVACUUMMANAGER_CID },
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module::CategoryEntry kStorageCategories[] = {
     { "idle-daily", "MozStorage Vacuum Manager", VACUUMMANAGER_CONTRACTID },
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module kStorageModule = {
     mozilla::Module::kVersion,
     kStorageCIDs,
     kStorageContracts,
     kStorageCategories
 };
--- a/storage/public/StatementCache.h
+++ b/storage/public/StatementCache.h
@@ -75,17 +75,17 @@ public:
   /**
    * Finalizes all cached statements so the database can be safely closed.  The
    * behavior of this cache is unspecified after this method is called.
    */
   inline
   void
   FinalizeStatements()
   {
-    (void)mCachedStatements.Enumerate(FinalizeCachedStatements, NULL);
+    (void)mCachedStatements.Enumerate(FinalizeCachedStatements, nullptr);
 
     // Clear the cache at this time too!
     (void)mCachedStatements.Clear();
   }
 
 private:
   inline
   already_AddRefed<StatementType>
--- a/storage/src/SQLiteMutex.h
+++ b/storage/src/SQLiteMutex.h
@@ -26,17 +26,17 @@ public:
   /**
    * Constructs a wrapper for a sqlite3_mutex that has deadlock detecting.
    *
    * @param aName
    *        A name which can be used to reference this mutex.
    */
   SQLiteMutex(const char *aName)
   : BlockingResourceBase(aName, eMutex)
-  , mMutex(NULL)
+  , mMutex(nullptr)
   {
   }
 
   /**
    * Sets the mutex that we are wrapping.  We generally do not have access to
    * our mutex at class construction, so we have to set it once we get access to
    * it.
    *
--- a/storage/src/StorageBaseStatementInternal.cpp
+++ b/storage/src/StorageBaseStatementInternal.cpp
@@ -104,17 +104,17 @@ private:
   nsRefPtr<Connection> mConnection;
   sqlite3_stmt *mAsyncStatement;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 //// StorageBaseStatementInternal
 
 StorageBaseStatementInternal::StorageBaseStatementInternal()
-: mAsyncStatement(NULL)
+: mAsyncStatement(nullptr)
 {
 }
 
 void
 StorageBaseStatementInternal::asyncFinalize()
 {
   nsIEventTarget *target = mDBConnection->getAsyncExecutionTarget();
   if (!target) {
--- a/storage/src/TelemetryVFS.cpp
+++ b/storage/src/TelemetryVFS.cpp
@@ -46,17 +46,17 @@ struct Histograms {
     Telemetry::MOZ_SQLITE_ ## HGRAM ## _WRITE_MS, \
     Telemetry::MOZ_SQLITE_ ## HGRAM ## _SYNC_MS \
   }
 
 Histograms gHistograms[] = {
   SQLITE_TELEMETRY("places.sqlite", PLACES),
   SQLITE_TELEMETRY("cookies.sqlite", COOKIES),
   SQLITE_TELEMETRY("webappsstore.sqlite", WEBAPPS),
-  SQLITE_TELEMETRY(NULL, OTHER)
+  SQLITE_TELEMETRY(nullptr, OTHER)
 };
 #undef SQLITE_TELEMETRY
 
 /** RAII class for measuring how long io takes on/off main thread
  */
 class IOThreadAutoTimer {
 public:
   /** 
@@ -118,17 +118,17 @@ struct telemetry_file {
 int
 xClose(sqlite3_file *pFile)
 {
   telemetry_file *p = (telemetry_file *)pFile;
   int rc;
   rc = p->pReal->pMethods->xClose(p->pReal);
   if( rc==SQLITE_OK ){
     delete p->base.pMethods;
-    p->base.pMethods = NULL;
+    p->base.pMethods = nullptr;
     p->quotaObject = nullptr;
   }
   return rc;
 }
 
 /*
 ** Read data from a telemetry_file.
 */
@@ -325,17 +325,17 @@ int
 xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
           int flags, int *pOutFlags)
 {
   IOThreadAutoTimer ioTimer(Telemetry::MOZ_SQLITE_OPEN_MS);
   Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_OPEN_MS> timer;
   sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
   int rc;
   telemetry_file *p = (telemetry_file *)pFile;
-  Histograms *h = NULL;
+  Histograms *h = nullptr;
   // check if the filename is one we are probing for
   for(size_t i = 0;i < sizeof(gHistograms)/sizeof(gHistograms[0]);i++) {
     h = &gHistograms[i];
     // last probe is the fallback probe
     if (!h->name)
       break;
     if (!zName)
       continue;
@@ -384,19 +384,19 @@ xOpen(sqlite3_vfs* vfs, const char *zNam
     pNew->xSectorSize = xSectorSize;
     pNew->xDeviceCharacteristics = xDeviceCharacteristics;
     // Methods added in version 2.
     pNew->xShmMap = pSub->xShmMap ? xShmMap : 0;
     pNew->xShmLock = pSub->xShmLock ? xShmLock : 0;
     pNew->xShmBarrier = pSub->xShmBarrier ? xShmBarrier : 0;
     pNew->xShmUnmap = pSub->xShmUnmap ? xShmUnmap : 0;
     // Methods added in version 3.
-    // SQLite 3.7.17 calls these methods without checking for NULL first,
+    // SQLite 3.7.17 calls these methods without checking for nullptr first,
     // so we always define them.  Verify that we're not going to call
-    // NULL pointers, though.
+    // nullptrs, though.
     MOZ_ASSERT(pSub->xFetch);
     pNew->xFetch = xFetch;
     MOZ_ASSERT(pSub->xUnfetch);
     pNew->xUnfetch = xUnfetch;
     pFile->pMethods = pNew;
   }
   return rc;
 }
@@ -525,21 +525,21 @@ sqlite3_vfs* ConstructTelemetryVFS()
   
   bool expected_vfs;
   sqlite3_vfs *vfs;
   if (Preferences::GetBool(PREF_NFS_FILESYSTEM)) {
     vfs = sqlite3_vfs_find(EXPECTED_VFS_NFS);
     expected_vfs = (vfs != nullptr);
   }
   else {
-    vfs = sqlite3_vfs_find(NULL);
+    vfs = sqlite3_vfs_find(nullptr);
     expected_vfs = vfs->zName && !strcmp(vfs->zName, EXPECTED_VFS);
   }
   if (!expected_vfs) {
-    return NULL;
+    return nullptr;
   }
 
   sqlite3_vfs *tvfs = new ::sqlite3_vfs;
   memset(tvfs, 0, sizeof(::sqlite3_vfs));
   // If you update this version number, you must add appropriate VFS methods
   // for any methods added in the version change.
   tvfs->iVersion = 3;
   MOZ_ASSERT(vfs->iVersion == tvfs->iVersion);
--- a/storage/src/Variant.h
+++ b/storage/src/Variant.h
@@ -17,17 +17,17 @@
  * This class is used by the storage module whenever an nsIVariant needs to be
  * returned.  We provide traits for the basic sqlite types to make use easier.
  * The following types map to the indicated sqlite type:
  * int64_t   -> INTEGER (use IntegerVariant)
  * double    -> FLOAT (use FloatVariant)
  * nsString  -> TEXT (use TextVariant)
  * nsCString -> TEXT (use UTF8TextVariant)
  * uint8_t[] -> BLOB (use BlobVariant)
- * nullptr    -> NULL (use NullVariant)
+ * nullptr   -> NULL (use NullVariant)
  */
 
 namespace mozilla {
 namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Base Class
 
@@ -273,17 +273,17 @@ struct variant_blob_traits<uint8_t[]>
     // Set type and size
     *_type = nsIDataType::VTYPE_UINT8;
     *_size = aData.Length();
     return NS_OK;
   }
 };
 
 /**
- * NULL type
+ * nullptr type
  */
 
 class NullVariant : public Variant_base
 {
 public:
   NS_IMETHOD GetDataType(uint16_t *_type)
   {
     NS_ENSURE_ARG_POINTER(_type);
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -555,17 +555,17 @@ Connection::getAsyncExecutionTarget()
 
 nsresult
 Connection::initialize()
 {
   NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
   PROFILER_LABEL("storage", "Connection::initialize");
 
   // in memory database requested, sqlite uses a magic file name
-  int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, NULL);
+  int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, nullptr);
   if (srv != SQLITE_OK) {
     mDBConn = nullptr;
     return convertResultCode(srv);
   }
 
   return initializeInternal(nullptr);
 }
 
@@ -578,17 +578,17 @@ Connection::initialize(nsIFile *aDatabas
 
   mDatabaseFile = aDatabaseFile;
 
   nsAutoString path;
   nsresult rv = aDatabaseFile->GetPath(path);
   NS_ENSURE_SUCCESS(rv, rv);
 
   int srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn,
-                              mFlags, NULL);
+                              mFlags, nullptr);
   if (srv != SQLITE_OK) {
     mDBConn = nullptr;
     return convertResultCode(srv);
   }
 
   rv = initializeInternal(aDatabaseFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -607,17 +607,17 @@ Connection::initialize(nsIFileURL *aFile
   nsCOMPtr<nsIFile> databaseFile;
   nsresult rv = aFileURL->GetFile(getter_AddRefs(databaseFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString spec;
   rv = aFileURL->GetSpec(spec);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, NULL);
+  int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, nullptr);
   if (srv != SQLITE_OK) {
     mDBConn = nullptr;
     return convertResultCode(srv);
   }
 
   rv = initializeInternal(databaseFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -832,30 +832,30 @@ Connection::internalClose()
   if (mDatabaseFile)
       (void)mDatabaseFile->GetNativeLeafName(leafName);
   PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Closing connection to '%s'",
                                       leafName.get()));
 #endif
 
 #ifdef DEBUG
   // Notify about any non-finalized statements.
-  sqlite3_stmt *stmt = NULL;
+  sqlite3_stmt *stmt = nullptr;
   while ((stmt = ::sqlite3_next_stmt(mDBConn, stmt))) {
     char *msg = ::PR_smprintf("SQL statement '%s' was not finalized",
                               ::sqlite3_sql(stmt));
     NS_WARNING(msg);
     ::PR_smprintf_free(msg);
   }
 #endif
 
   int srv = ::sqlite3_close(mDBConn);
   NS_ASSERTION(srv == SQLITE_OK,
                "sqlite3_close failed. There are probably outstanding statements that are listed above!");
 
-  mDBConn = NULL;
+  mDBConn = nullptr;
   return convertResultCode(srv);
 }
 
 nsCString
 Connection::getFilename()
 {
   nsCString leafname(":memory:");
   if (mDatabaseFile) {
@@ -921,18 +921,21 @@ int
 Connection::prepareStatement(const nsCString &aSQL,
                              sqlite3_stmt **_stmt)
 {
   bool checkedMainThread = false;
 
   (void)::sqlite3_extended_result_codes(mDBConn, 1);
 
   int srv;
-  while((srv = ::sqlite3_prepare_v2(mDBConn, aSQL.get(), -1, _stmt, NULL)) ==
-        SQLITE_LOCKED_SHAREDCACHE) {
+  while((srv = ::sqlite3_prepare_v2(mDBConn,
+                                    aSQL.get(),
+                                    -1,
+                                    _stmt,
+                                    nullptr)) == SQLITE_LOCKED_SHAREDCACHE) {
     if (!checkedMainThread) {
       checkedMainThread = true;
       if (::NS_IsMainThread()) {
         NS_WARNING("We won't allow blocking on the main thread!");
         break;
       }
     }
 
@@ -955,35 +958,35 @@ Connection::prepareStatement(const nsCSt
 #ifdef PR_LOGGING
     PR_LOG(gStorageLog, PR_LOG_ERROR, ("%s", warnMsg.get()));
 #endif
   }
 
   (void)::sqlite3_extended_result_codes(mDBConn, 0);
   // Drop off the extended result bits of the result code.
   int rc = srv & 0xFF;
-  // sqlite will return OK on a comment only string and set _stmt to NULL.
+  // sqlite will return OK on a comment only string and set _stmt to nullptr.
   // The callers of this function are used to only checking the return value,
   // so it is safer to return an error code.
-  if (rc == SQLITE_OK && *_stmt == NULL) {
+  if (rc == SQLITE_OK && *_stmt == nullptr) {
     return SQLITE_MISUSE;
   }
 
   return rc;
 }
 
 
 int
 Connection::executeSql(const char *aSqlString)
 {
   if (!mDBConn)
     return SQLITE_MISUSE;
 
   TimeStamp startTime = TimeStamp::Now();
-  int srv = ::sqlite3_exec(mDBConn, aSqlString, NULL, NULL, NULL);
+  int srv = ::sqlite3_exec(mDBConn, aSqlString, nullptr, nullptr, nullptr);
 
   // Report very slow SQL statements to Telemetry
   TimeDuration duration = TimeStamp::Now() - startTime;
   const uint32_t threshold =
     NS_IsMainThread() ? Telemetry::kSlowSQLThresholdForMainThread
                       : Telemetry::kSlowSQLThresholdForHelperThreads;
   if (duration.ToMilliseconds() >= threshold) {
     nsDependentCString statementString(aSqlString);
@@ -1461,26 +1464,26 @@ Connection::CreateFunction(const nsACStr
                            int32_t aNumArguments,
                            mozIStorageFunction *aFunction)
 {
   if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
 
   // Check to see if this function is already defined.  We only check the name
   // because a function can be defined with the same body but different names.
   SQLiteMutexAutoLock lockedScope(sharedDBMutex);
-  NS_ENSURE_FALSE(mFunctions.Get(aFunctionName, NULL), NS_ERROR_FAILURE);
+  NS_ENSURE_FALSE(mFunctions.Get(aFunctionName, nullptr), NS_ERROR_FAILURE);
 
   int srv = ::sqlite3_create_function(mDBConn,
                                       nsPromiseFlatCString(aFunctionName).get(),
                                       aNumArguments,
                                       SQLITE_ANY,
                                       aFunction,
                                       basicFunctionHelper,
-                                      NULL,
-                                      NULL);
+                                      nullptr,
+                                      nullptr);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
   FunctionInfo info = { aFunction,
                         Connection::FunctionInfo::SIMPLE,
                         aNumArguments };
   mFunctions.Put(aFunctionName, info);
 
@@ -1491,29 +1494,29 @@ NS_IMETHODIMP
 Connection::CreateAggregateFunction(const nsACString &aFunctionName,
                                     int32_t aNumArguments,
                                     mozIStorageAggregateFunction *aFunction)
 {
   if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
 
   // Check to see if this function name is already defined.
   SQLiteMutexAutoLock lockedScope(sharedDBMutex);
-  NS_ENSURE_FALSE(mFunctions.Get(aFunctionName, NULL), NS_ERROR_FAILURE);
+  NS_ENSURE_FALSE(mFunctions.Get(aFunctionName, nullptr), NS_ERROR_FAILURE);
 
   // Because aggregate functions depend on state across calls, you cannot have
   // the same instance use the same name.  We want to enumerate all functions
   // and make sure this instance is not already registered.
   NS_ENSURE_FALSE(findFunctionByInstance(aFunction), NS_ERROR_FAILURE);
 
   int srv = ::sqlite3_create_function(mDBConn,
                                       nsPromiseFlatCString(aFunctionName).get(),
                                       aNumArguments,
                                       SQLITE_ANY,
                                       aFunction,
-                                      NULL,
+                                      nullptr,
                                       aggregateFunctionStepHelper,
                                       aggregateFunctionFinalHelper);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
   FunctionInfo info = { aFunction,
                         Connection::FunctionInfo::AGGREGATE,
                         aNumArguments };
@@ -1523,26 +1526,26 @@ Connection::CreateAggregateFunction(cons
 }
 
 NS_IMETHODIMP
 Connection::RemoveFunction(const nsACString &aFunctionName)
 {
   if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
 
   SQLiteMutexAutoLock lockedScope(sharedDBMutex);
-  NS_ENSURE_TRUE(mFunctions.Get(aFunctionName, NULL), NS_ERROR_FAILURE);
+  NS_ENSURE_TRUE(mFunctions.Get(aFunctionName, nullptr), NS_ERROR_FAILURE);
 
   int srv = ::sqlite3_create_function(mDBConn,
                                       nsPromiseFlatCString(aFunctionName).get(),
                                       0,
                                       SQLITE_ANY,
-                                      NULL,
-                                      NULL,
-                                      NULL,
-                                      NULL);
+                                      nullptr,
+                                      nullptr,
+                                      nullptr,
+                                      nullptr);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
   mFunctions.Remove(aFunctionName);
 
   return NS_OK;
 }
 
@@ -1572,17 +1575,17 @@ Connection::RemoveProgressHandler(mozISt
 {
   if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
 
   // Return previous one
   SQLiteMutexAutoLock lockedScope(sharedDBMutex);
   NS_IF_ADDREF(*_oldHandler = mProgressHandler);
 
   mProgressHandler = nullptr;
-  ::sqlite3_progress_handler(mDBConn, 0, NULL, NULL);
+  ::sqlite3_progress_handler(mDBConn, 0, nullptr, nullptr);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Connection::SetGrowthIncrement(int32_t aChunkSize, const nsACString &aDatabaseName)
 {
   // Bug 597215: Disk space is extremely limited on Android
@@ -1593,17 +1596,18 @@ Connection::SetGrowthIncrement(int32_t a
   int64_t bytesAvailable;
   nsresult rv = mDatabaseFile->GetDiskSpaceAvailable(&bytesAvailable);
   NS_ENSURE_SUCCESS(rv, rv);
   if (bytesAvailable < MIN_AVAILABLE_BYTES_PER_CHUNKED_GROWTH) {
     return NS_ERROR_FILE_TOO_BIG;
   }
 
   (void)::sqlite3_file_control(mDBConn,
-                               aDatabaseName.Length() ? nsPromiseFlatCString(aDatabaseName).get() : NULL,
+                               aDatabaseName.Length() ? nsPromiseFlatCString(aDatabaseName).get()
+                                                      : nullptr,
                                SQLITE_FCNTL_CHUNK_SIZE,
                                &aChunkSize);
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Connection::EnableModule(const nsACString& aModuleName)
--- a/storage/src/mozStorageConnection.h
+++ b/storage/src/mozStorageConnection.h
@@ -178,17 +178,17 @@ public:
 private:
   ~Connection();
   nsresult initializeInternal(nsIFile *aDatabaseFile);
 
   /**
    * Sets the database into a closed state so no further actions can be
    * performed.
    *
-   * @note mDBConn is set to NULL in this method.
+   * @note mDBConn is set to nullptr in this method.
    */
   nsresult setClosedState();
 
   /**
    * Helper for calls to sqlite3_exec. Reports long delays to Telemetry.
    *
    * @param aSqlString
    *        SQL string to execute
--- a/storage/src/mozStorageSQLFunctions.cpp
+++ b/storage/src/mozStorageSQLFunctions.cpp
@@ -139,17 +139,17 @@ public:
   ~AutoArray()
   { 
     if (mBuffer != mAutoBuffer)
       delete[] mBuffer; 
   }
 
   /**
    * Return the pointer to the allocated array.
-   * @note If the array allocation failed, get() will return NULL!
+   * @note If the array allocation failed, get() will return nullptr!
    *
    * @return the pointer to the allocated array
    */
   T *get() 
   {
     return mBuffer; 
   }
 
@@ -341,17 +341,17 @@ registerFunctions(sqlite3 *aDB)
       0,        
       levenshteinDistanceFunction},
   };
 
   int rv = SQLITE_OK;
   for (size_t i = 0; SQLITE_OK == rv && i < ArrayLength(functions); ++i) {
     struct Functions *p = &functions[i];
     rv = ::sqlite3_create_function(aDB, p->zName, p->nArg, p->enc, p->pContext,
-                                   p->xFunc, NULL, NULL);
+                                   p->xFunc, nullptr, nullptr);
   }
 
   return rv;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// SQL Functions
 
--- a/storage/src/mozStorageService.cpp
+++ b/storage/src/mozStorageService.cpp
@@ -477,17 +477,17 @@ static void sqliteMemShutdown(void *p)
 const sqlite3_mem_methods memMethods = {
   &sqliteMemMalloc,
   &sqliteMemFree,
   &sqliteMemRealloc,
   &sqliteMemSize,
   &sqliteMemRoundup,
   &sqliteMemInit,
   &sqliteMemShutdown,
-  NULL
+  nullptr
 };
 
 } // anonymous namespace
 
 #endif  // MOZ_STORAGE_MEMORY
 
 nsresult
 Service::initialize()
@@ -623,17 +623,17 @@ Service::getLocaleCollation()
 NS_IMETHODIMP
 Service::OpenSpecialDatabase(const char *aStorageKey,
                              mozIStorageConnection **_connection)
 {
   nsresult rv;
 
   nsCOMPtr<nsIFile> storageFile;
   if (::strcmp(aStorageKey, "memory") == 0) {
-    // just fall through with NULL storageFile, this will cause the storage
+    // just fall through with nullptr storageFile, this will cause the storage
     // connection to use a memory DB.
   }
   else {
     return NS_ERROR_INVALID_ARG;
   }
 
   nsRefPtr<Connection> msc = new Connection(this, SQLITE_OPEN_READWRITE, false);
 
@@ -759,17 +759,17 @@ Service::OpenAsyncDatabase(nsIVariant *a
   } else {
     // Sometimes, however, it's a special database name.
     nsAutoCString keyString;
     rv = aDatabaseStore->GetAsACString(keyString);
     if (NS_FAILED(rv) || !keyString.EqualsLiteral("memory")) {
       return NS_ERROR_INVALID_ARG;
     }
 
-    // Just fall through with NULL storageFile, this will cause the storage
+    // Just fall through with nullptr storageFile, this will cause the storage
     // connection to use a memory DB.
   }
 
   int32_t growthIncrement = -1;
   if (aOptions && storageFile) {
     rv = aOptions->GetPropertyAsInt32(NS_LITERAL_STRING("growthIncrement"),
                                       &growthIncrement);
     if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE) {
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -119,17 +119,17 @@ NS_IMPL_QUERY_INTERFACE1(StatementClassI
 
 static StatementClassInfo sStatementClassInfo;
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Statement
 
 Statement::Statement()
 : StorageBaseStatementInternal()
-, mDBStatement(NULL)
+, mDBStatement(nullptr)
 , mColumnNames()
 , mExecuting(false)
 {
 }
 
 nsresult
 Statement::initialize(Connection *aDBConnection,
                       const nsACString &aSQLStatement)
@@ -275,17 +275,17 @@ Statement::getOwner()
 {
   return mDBConnection;
 }
 
 int
 Statement::getAsyncStatement(sqlite3_stmt **_stmt)
 {
   // If we have no statement, we shouldn't be calling this method!
-  NS_ASSERTION(mDBStatement != NULL, "We have no statement to clone!");
+  NS_ASSERTION(mDBStatement != nullptr, "We have no statement to clone!");
 
   // If we do not yet have a cached async statement, clone our statement now.
   if (!mAsyncStatement) {
     nsDependentCString sql(::sqlite3_sql(mDBStatement));
     int rc = mDBConnection->prepareStatement(sql, &mAsyncStatement);
     if (rc != SQLITE_OK) {
       *_stmt = nullptr;
       return rc;
@@ -358,17 +358,17 @@ Statement::internalFinalize(bool aDestru
     return NS_OK;
 
 #ifdef PR_LOGGING
   PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Finalizing statement '%s'",
                                       ::sqlite3_sql(mDBStatement)));
 #endif
 
   int srv = ::sqlite3_finalize(mDBStatement);
-  mDBStatement = NULL;
+  mDBStatement = nullptr;
 
   if (mAsyncStatement) {
     // If the destructor called us, there are no pending async statements (they
     // hold a reference to us) and we can/must just kill the statement directly.
     if (aDestructing)
       destructorAsyncFinalize();
     else
       asyncFinalize();
@@ -414,17 +414,17 @@ Statement::GetParameterName(uint32_t aPa
                             nsACString &_name)
 {
   if (!mDBStatement)
     return NS_ERROR_NOT_INITIALIZED;
   ENSURE_INDEX_VALUE(aParamIndex, mParamCount);
 
   const char *name = ::sqlite3_bind_parameter_name(mDBStatement,
                                                    aParamIndex + 1);
-  if (name == NULL) {
+  if (name == nullptr) {
     // this thing had no name, so fake one
     nsAutoCString name(":");
     name.AppendInt(aParamIndex);
     _name.Assign(name);
   }
   else {
     _name.Assign(nsDependentCString(name));
   }
--- a/storage/src/mozStorageStatementData.h
+++ b/storage/src/mozStorageStatementData.h
@@ -80,31 +80,31 @@ public:
   inline void finalize()
   {
     NS_PRECONDITION(mStatementOwner, "Must have a statement owner!");
 #ifdef DEBUG
     {
       nsCOMPtr<nsIEventTarget> asyncThread =
         mStatementOwner->getOwner()->getAsyncExecutionTarget();
       // It's possible that we are shutting down the async thread, and this
-      // method would return NULL as a result.
+      // method would return nullptr as a result.
       if (asyncThread) {
         bool onAsyncThread;
         NS_ASSERTION(NS_SUCCEEDED(asyncThread->IsOnCurrentThread(&onAsyncThread)) && onAsyncThread,
                      "This should only be running on the async thread!");
       }
     }
 #endif
     // In the AsyncStatement case we may never have populated mStatement if the
     // AsyncExecuteStatements got canceled or a failure occurred in constructing
     // the statement.
     if (mStatement) {
       (void)::sqlite3_reset(mStatement);
       (void)::sqlite3_clear_bindings(mStatement);
-      mStatement = NULL;
+      mStatement = nullptr;
     }
   }
 
   /**
    * Indicates if this statement has parameters to be bound before it is
    * executed.
    *
    * @return true if the statement has parameters to bind against, false
--- a/storage/src/mozStorageStatementRow.cpp
+++ b/storage/src/mozStorageStatementRow.cpp
@@ -132,17 +132,17 @@ StatementRow::NewResolve(nsIXPConnectWra
     nsDependentCString name(idBytes.ptr());
 
     uint32_t idx;
     nsresult rv = mStatement->GetColumnIndex(name, &idx);
     if (NS_FAILED(rv)) {
       // It's highly likely that the name doesn't exist, so let the JS engine
       // check the prototype chain and throw if that doesn't have the property
       // either.
-      *_objp = NULL;
+      *_objp = nullptr;
       return NS_OK;
     }
 
     *_retval = ::JS_DefinePropertyById(aCtx, aScopeObj, aId, JSVAL_VOID,
                                      nullptr, nullptr, 0);
     *_objp = aScopeObj;
     return NS_OK;
   }
--- a/storage/src/variantToSQLiteT_impl.h
+++ b/storage/src/variantToSQLiteT_impl.h
@@ -12,17 +12,17 @@
 ////////////////////////////////////////////////////////////////////////////////
 //// variantToSQLiteT Implementation
 
 template <typename T>
 int
 variantToSQLiteT(T aObj,
                  nsIVariant *aValue)
 {
-  // Allow to return NULL not wrapped to nsIVariant for speed.
+  // Allow to return nullptr not wrapped to nsIVariant for speed.
   if (!aValue)
     return sqlite3_T_null(aObj);
 
   uint16_t type;
   (void)aValue->GetDataType(&type);
   switch (type) {
     case nsIDataType::VTYPE_INT8:
     case nsIDataType::VTYPE_INT16:
--- a/storage/test/test_asyncStatementExecution_transaction.cpp
+++ b/storage/test/test_asyncStatementExecution_transaction.cpp
@@ -55,17 +55,17 @@ check_transaction(mozIStorageConnection 
   do_check_success(aDB->ExecuteAsync(aStmts, aStmtsLen, asyncSpin,
                                      getter_AddRefs(asyncPend)));
   do_check_true(asyncPend);
 
   // -- complete the execution
   asyncSpin->SpinUntilCompleted();
 
   // -- uninstall the transaction commit hook.
-  ::sqlite3_commit_hook(*static_cast<Connection *>(aDB), NULL, NULL);
+  ::sqlite3_commit_hook(*static_cast<Connection *>(aDB), nullptr, nullptr);
 
   // -- check transaction
   do_check_eq(aTransactionExpected, !!commit);
 
   // -- check that only one transaction was created.
   if (aTransactionExpected) {
     do_check_eq(1, commit);
   }
--- a/storage/test/test_true_async.cpp
+++ b/storage/test/test_true_async.cpp
@@ -26,27 +26,27 @@ using mozilla::ReentrantMonitorAutoEnter
  */
 
 /* ===== Mutex Watching ===== */
 
 sqlite3_mutex_methods orig_mutex_methods;
 sqlite3_mutex_methods wrapped_mutex_methods;
 
 bool mutex_used_on_watched_thread = false;
-PRThread *watched_thread = NULL;
+PRThread *watched_thread = nullptr;
 /**
  * Ugly hack to let us figure out what a connection's async thread is.  If we
  * were MOZILLA_INTERNAL_API and linked as such we could just include
  * mozStorageConnection.h and just ask Connection directly.  But that turns out
  * poorly.
  *
  * When the thread a mutex is invoked on isn't watched_thread we save it to this
  * variable.
  */
-PRThread *last_non_watched_thread = NULL;
+PRThread *last_non_watched_thread = nullptr;
 
 /**
  * Set a flag if the mutex is used on the thread we are watching, but always
  * call the real mutex function.
  */
 extern "C" void wrapped_MutexEnter(sqlite3_mutex *mutex)
 {
   PRThread *curThread = ::PR_GetCurrentThread();