From 9d92ba2ff6e82614621b44219aec5696a852282d Mon Sep 17 00:00:00 2001 From: matekm Date: Tue, 2 Apr 2013 21:06:20 -0400 Subject: [PATCH] Bug 784739 - Switch from NULL to nullptr in extensions/; r=ehsan --- extensions/auth/gssapi.h | 2 +- extensions/auth/nsAuthFactory.cpp | 24 +++++----- extensions/auth/nsAuthGSSAPI.cpp | 44 +++++++++---------- extensions/auth/nsAuthSASL.cpp | 4 +- extensions/auth/nsAuthSSPI.cpp | 18 ++++---- extensions/auth/nsHttpNegotiateAuth.cpp | 2 +- extensions/cookie/nsCookieModule.cpp | 12 ++--- extensions/cookie/nsCookiePermission.h | 2 +- extensions/cookie/nsPermissionManager.cpp | 2 +- extensions/gio/nsGIOProtocolHandler.cpp | 36 +++++++-------- .../gnomevfs/nsGnomeVFSProtocolHandler.cpp | 10 ++--- extensions/permissions/nsModuleFactory.cpp | 8 ++-- .../pref/autoconfig/src/nsConfigFactory.cpp | 10 ++--- .../pref/autoconfig/src/nsReadConfig.cpp | 4 +- .../spellcheck/src/mozInlineSpellChecker.cpp | 26 +++++------ .../spellcheck/src/mozInlineSpellChecker.h | 8 ++-- .../spellcheck/src/mozInlineSpellWordUtil.h | 2 +- extensions/spellcheck/src/mozSpellChecker.cpp | 8 ++-- .../spellcheck/src/mozSpellCheckerFactory.cpp | 18 ++++---- .../spellcheck/src/mozSpellI18NManager.cpp | 4 +- .../src/xpcom/nsUniversalCharDetModule.cpp | 34 +++++++------- 21 files changed, 139 insertions(+), 139 deletions(-) diff --git a/extensions/auth/gssapi.h b/extensions/auth/gssapi.h index 07804ecbc6cb..a3ce3d8c589c 100644 --- a/extensions/auth/gssapi.h +++ b/extensions/auth/gssapi.h @@ -245,7 +245,7 @@ typedef struct gss_channel_bindings_struct { #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0) #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0) #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0) -#define GSS_C_EMPTY_BUFFER {0, NULL} +#define GSS_C_EMPTY_BUFFER {0, nullptr} /* * Some alternate names for a couple of the above diff --git a/extensions/auth/nsAuthFactory.cpp b/extensions/auth/nsAuthFactory.cpp index 106a79dabe30..68fa90836b47 100644 --- a/extensions/auth/nsAuthFactory.cpp +++ b/extensions/auth/nsAuthFactory.cpp @@ -189,18 +189,18 @@ NS_DEFINE_NAMED_CID(NS_AUTHSASL_CID); static const mozilla::Module::CIDEntry kAuthCIDs[] = { - { &kNS_GSSAUTH_CID, false, NULL, nsKerbGSSAPIAuthConstructor }, - { &kNS_NEGOTIATEAUTH_CID, false, NULL, nsGSSAPIAuthConstructor }, + { &kNS_GSSAUTH_CID, false, nullptr, nsKerbGSSAPIAuthConstructor }, + { &kNS_NEGOTIATEAUTH_CID, false, nullptr, nsGSSAPIAuthConstructor }, #if defined( USE_SSPI ) - { &kNS_NEGOTIATEAUTHSSPI_CID, false, NULL, nsAuthSSPIConstructor }, - { &kNS_KERBAUTHSSPI_CID, false, NULL, nsKerbSSPIAuthConstructor }, - { &kNS_SYSNTLMAUTH_CID, false, NULL, nsSysNTLMAuthConstructor }, + { &kNS_NEGOTIATEAUTHSSPI_CID, false, nullptr, nsAuthSSPIConstructor }, + { &kNS_KERBAUTHSSPI_CID, false, nullptr, nsKerbSSPIAuthConstructor }, + { &kNS_SYSNTLMAUTH_CID, false, nullptr, nsSysNTLMAuthConstructor }, #else - { &kNS_SAMBANTLMAUTH_CID, false, NULL, nsSambaNTLMAuthConstructor }, + { &kNS_SAMBANTLMAUTH_CID, false, nullptr, nsSambaNTLMAuthConstructor }, #endif - { &kNS_HTTPNEGOTIATEAUTH_CID, false, NULL, nsHttpNegotiateAuthConstructor }, - { &kNS_AUTHSASL_CID, false, NULL, nsAuthSASLConstructor }, - { NULL } + { &kNS_HTTPNEGOTIATEAUTH_CID, false, nullptr, nsHttpNegotiateAuthConstructor }, + { &kNS_AUTHSASL_CID, false, nullptr, nsAuthSASLConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kAuthContracts[] = { @@ -215,7 +215,7 @@ static const mozilla::Module::ContractIDEntry kAuthContracts[] = { #endif { NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "negotiate", &kNS_HTTPNEGOTIATEAUTH_CID }, { NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi", &kNS_AUTHSASL_CID }, - { NULL } + { nullptr } }; //----------------------------------------------------------------------------- @@ -243,8 +243,8 @@ static const mozilla::Module kAuthModule = { mozilla::Module::kVersion, kAuthCIDs, kAuthContracts, - NULL, - NULL, + nullptr, + nullptr, InitNegotiateAuth, DestroyNegotiateAuth }; diff --git a/extensions/auth/nsAuthGSSAPI.cpp b/extensions/auth/nsAuthGSSAPI.cpp index 587382955798..4e8d283aa83c 100644 --- a/extensions/auth/nsAuthGSSAPI.cpp +++ b/extensions/auth/nsAuthGSSAPI.cpp @@ -62,16 +62,16 @@ static struct GSSFunction { const char *str; PRFuncPtr func; } gssFuncs[] = { - { "gss_display_status", NULL }, - { "gss_init_sec_context", NULL }, - { "gss_indicate_mechs", NULL }, - { "gss_release_oid_set", NULL }, - { "gss_delete_sec_context", NULL }, - { "gss_import_name", NULL }, - { "gss_release_buffer", NULL }, - { "gss_release_name", NULL }, - { "gss_wrap", NULL }, - { "gss_unwrap", NULL } + { "gss_display_status", nullptr }, + { "gss_init_sec_context", nullptr }, + { "gss_indicate_mechs", nullptr }, + { "gss_release_oid_set", nullptr }, + { "gss_delete_sec_context", nullptr }, + { "gss_import_name", nullptr }, + { "gss_release_buffer", nullptr }, + { "gss_release_name", nullptr }, + { "gss_wrap", nullptr }, + { "gss_unwrap", nullptr } }; static bool gssNativeImp = true; @@ -104,7 +104,7 @@ gssInit() prefs->GetBoolPref(kNegotiateAuthNativeImp, &gssNativeImp); } - PRLibrary *lib = NULL; + PRLibrary *lib = nullptr; if (!libPath.IsEmpty()) { LOG(("Attempting to load user specified library [%s]\n", libPath.get())); @@ -113,7 +113,7 @@ gssInit() } else { #ifdef XP_WIN - char *libName = PR_GetLibraryName(NULL, "gssapi32"); + char *libName = PR_GetLibraryName(nullptr, "gssapi32"); if (libName) { lib = PR_LoadLibrary("gssapi32"); PR_FreeLibraryName(libName); @@ -148,12 +148,12 @@ gssInit() PR_FindFunctionSymbol(lib, "gssd_pname_to_uid")) { LOG(("CITI libgssapi found, which calls exit(). Skipping\n")); PR_UnloadLibrary(lib); - lib = NULL; + lib = nullptr; } } for (size_t i = 0; i < ArrayLength(libNames) && !lib; ++i) { - char *libName = PR_GetLibraryName(NULL, libNames[i]); + char *libName = PR_GetLibraryName(nullptr, libNames[i]); if (libName) { lib = PR_LoadLibrary(libName); PR_FreeLibraryName(libName); @@ -164,7 +164,7 @@ gssInit() PR_FindFunctionSymbol(lib, "gssd_pname_to_uid")) { LOG(("CITI libgssapi found, which calls exit(). Skipping\n")); PR_UnloadLibrary(lib); - lib = NULL; + lib = nullptr; } } } @@ -396,7 +396,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken, &input_token, &gss_c_nt_hostbased_service, &server); - input_token.value = NULL; + input_token.value = nullptr; input_token.length = 0; if (GSS_ERROR(major_status)) { LogGssError(major_status, minor_status, "gss_import_name() failed"); @@ -429,7 +429,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken, mServiceName.Find("ldap@"); if (!doingMailTask && (gssNativeImp && - (KLCacheHasValidTickets_ptr(NULL, kerberosVersion_V5, &found, NULL, NULL) != klNoErr || !found))) + (KLCacheHasValidTickets_ptr(nullptr, kerberosVersion_V5, &found, nullptr, nullptr) != klNoErr || !found))) { major_status = GSS_S_FAILURE; minor_status = 0; @@ -473,7 +473,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken, if (output_token.length != 0) *outToken = nsMemory::Clone(output_token.value, output_token.length); else - *outToken = NULL; + *outToken = nullptr; gss_release_buffer_ptr(&minor_status, &output_token); @@ -507,8 +507,8 @@ nsAuthGSSAPI::Unwrap(const void *inToken, mCtx, &input_token, &output_token, - NULL, - NULL); + nullptr, + nullptr); if (GSS_ERROR(major_status)) { LogGssError(major_status, minor_status, "gss_unwrap() failed"); Reset(); @@ -521,7 +521,7 @@ nsAuthGSSAPI::Unwrap(const void *inToken, if (output_token.length) *outToken = nsMemory::Clone(output_token.value, output_token.length); else - *outToken = NULL; + *outToken = nullptr; gss_release_buffer_ptr(&minor_status, &output_token); @@ -548,7 +548,7 @@ nsAuthGSSAPI::Wrap(const void *inToken, confidential, GSS_C_QOP_DEFAULT, &input_token, - NULL, + nullptr, &output_token); if (GSS_ERROR(major_status)) { diff --git a/extensions/auth/nsAuthSASL.cpp b/extensions/auth/nsAuthSASL.cpp index 892c5f1a2bb7..05e6089a4a90 100644 --- a/extensions/auth/nsAuthSASL.cpp +++ b/extensions/auth/nsAuthSASL.cpp @@ -82,7 +82,7 @@ nsAuthSASL::GetNextToken(const void *inToken, // I don't think this is correct, but we need to handle that behaviour. // Cyrus ignores the contents of our reply token. if (inTokenLen == 0) { - *outToken = NULL; + *outToken = nullptr; *outTokenLen = 0; return NS_OK; } @@ -114,7 +114,7 @@ nsAuthSASL::GetNextToken(const void *inToken, message[2] = 0x00; message[3] = 0x00; // Maxbuf must be zero if we've got no sec layer strcpy(message+4, userbuf.get()); - // Userbuf should not be NULL terminated, so trim the trailing NULL + // Userbuf should not be nullptr terminated, so trim the trailing nullptr // when wrapping the message rv = mInnerModule->Wrap((void *) message, messageLen-1, false, outToken, outTokenLen); diff --git a/extensions/auth/nsAuthSSPI.cpp b/extensions/auth/nsAuthSSPI.cpp index bd6779c6ffac..85cd786446d9 100644 --- a/extensions/auth/nsAuthSSPI.cpp +++ b/extensions/auth/nsAuthSSPI.cpp @@ -262,13 +262,13 @@ nsAuthSSPI::Init(const char *serviceName, pai = &ai; } - rc = (sspi->AcquireCredentialsHandleW)(NULL, + rc = (sspi->AcquireCredentialsHandleW)(nullptr, package, SECPKG_CRED_OUTBOUND, - NULL, + nullptr, pai, - NULL, - NULL, + nullptr, + nullptr, &mCred, &useBefore); if (rc != SEC_E_OK) @@ -432,7 +432,7 @@ nsAuthSSPI::GetNextToken(const void *inToken, LOG(("Cannot restart authentication sequence!")); return NS_ERROR_UNEXPECTED; } - ctxIn = NULL; + ctxIn = nullptr; mIsFirst = false; } @@ -458,7 +458,7 @@ nsAuthSSPI::GetNextToken(const void *inToken, ctxReq, 0, SECURITY_NATIVE_DREP, - inToken ? &ibd : NULL, + inToken ? &ibd : nullptr, 0, &mCtxt, &obd, @@ -477,7 +477,7 @@ nsAuthSSPI::GetNextToken(const void *inToken, if (!ob.cbBuffer) { nsMemory::Free(ob.pvBuffer); - ob.pvBuffer = NULL; + ob.pvBuffer = nullptr; } *outToken = ob.pvBuffer; *outTokenLen = ob.cbBuffer; @@ -520,13 +520,13 @@ nsAuthSSPI::Unwrap(const void *inToken, // app data ib[1].BufferType = SECBUFFER_DATA; ib[1].cbBuffer = 0; - ib[1].pvBuffer = NULL; + ib[1].pvBuffer = nullptr; rc = (sspi->DecryptMessage)( &mCtxt, &ibd, 0, // no sequence numbers - NULL + nullptr ); if (SEC_SUCCESS(rc)) { diff --git a/extensions/auth/nsHttpNegotiateAuth.cpp b/extensions/auth/nsHttpNegotiateAuth.cpp index dfbdc9a02da5..978f30a197bb 100644 --- a/extensions/auth/nsHttpNegotiateAuth.cpp +++ b/extensions/auth/nsHttpNegotiateAuth.cpp @@ -237,7 +237,7 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne // // Decode the response that followed the "Negotiate" token // - if (PL_Base64Decode(challenge, len, (char *) inToken) == NULL) { + if (PL_Base64Decode(challenge, len, (char *) inToken) == nullptr) { free(inToken); return(NS_ERROR_UNEXPECTED); } diff --git a/extensions/cookie/nsCookieModule.cpp b/extensions/cookie/nsCookieModule.cpp index eb3d298c092f..1157e0c5d324 100644 --- a/extensions/cookie/nsCookieModule.cpp +++ b/extensions/cookie/nsCookieModule.cpp @@ -27,11 +27,11 @@ NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID); static const mozilla::Module::CIDEntry kCookieCIDs[] = { - { &kNS_PERMISSIONMANAGER_CID, false, NULL, nsIPermissionManagerConstructor }, - { &kNS_POPUPWINDOWMANAGER_CID, false, NULL, nsPopupWindowManagerConstructor }, - { &kNS_COOKIEPROMPTSERVICE_CID, false, NULL, nsCookiePromptServiceConstructor }, - { &kNS_COOKIEPERMISSION_CID, false, NULL, nsCookiePermissionConstructor }, - { NULL } + { &kNS_PERMISSIONMANAGER_CID, false, nullptr, nsIPermissionManagerConstructor }, + { &kNS_POPUPWINDOWMANAGER_CID, false, nullptr, nsPopupWindowManagerConstructor }, + { &kNS_COOKIEPROMPTSERVICE_CID, false, nullptr, nsCookiePromptServiceConstructor }, + { &kNS_COOKIEPERMISSION_CID, false, nullptr, nsCookiePermissionConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kCookieContracts[] = { @@ -39,7 +39,7 @@ static const mozilla::Module::ContractIDEntry kCookieContracts[] = { { NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID }, { NS_COOKIEPROMPTSERVICE_CONTRACTID, &kNS_COOKIEPROMPTSERVICE_CID }, { NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID }, - { NULL } + { nullptr } }; static const mozilla::Module kCookieModule = { diff --git a/extensions/cookie/nsCookiePermission.h b/extensions/cookie/nsCookiePermission.h index d9e4f3d50dcc..c74fc95a93f4 100644 --- a/extensions/cookie/nsCookiePermission.h +++ b/extensions/cookie/nsCookiePermission.h @@ -33,7 +33,7 @@ public: void PrefChanged(nsIPrefBranch *, const char *); private: - bool EnsureInitialized() { return (mPermMgr != NULL && mThirdPartyUtil != NULL) || Init(); }; + bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); }; nsCOMPtr mPermMgr; nsCOMPtr mThirdPartyUtil; diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 577e9f66597d..3cb526431963 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -53,7 +53,7 @@ ChildProcess() if (IsChildProcess()) { ContentChild* cpc = ContentChild::GetSingleton(); if (!cpc) - NS_RUNTIMEABORT("Content Process is NULL!"); + NS_RUNTIMEABORT("Content Process is nullptr!"); return cpc; } diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 70221d67e77e..327a326bb5bf 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -227,7 +227,7 @@ nsGIOInputStream::MountVolume() { g_file_mount_enclosing_volume(mHandle, G_MOUNT_MOUNT_NONE, mount_op, - NULL, + nullptr, mount_enclosing_volume_finished, this); mozilla::MonitorAutoLock mon(mMonitorMountInProgress); @@ -252,12 +252,12 @@ nsGIOInputStream::MountVolume() { nsresult nsGIOInputStream::DoOpenDirectory() { - GError *error = NULL; + GError *error = nullptr; GFileEnumerator *f_enum = g_file_enumerate_children(mHandle, "standard::*,time::*", G_FILE_QUERY_INFO_NONE, - NULL, + nullptr, &error); if (!f_enum) { nsresult rv = MapGIOResult(error); @@ -266,10 +266,10 @@ nsGIOInputStream::DoOpenDirectory() return rv; } // fill list of file infos - GFileInfo *info = g_file_enumerator_next_file(f_enum, NULL, &error); + GFileInfo *info = g_file_enumerator_next_file(f_enum, nullptr, &error); while (info) { mDirList = g_list_append(mDirList, info); - info = g_file_enumerator_next_file(f_enum, NULL, &error); + info = g_file_enumerator_next_file(f_enum, nullptr, &error); } g_object_unref(f_enum); if (error) { @@ -309,9 +309,9 @@ nsGIOInputStream::DoOpenDirectory() nsresult nsGIOInputStream::DoOpenFile(GFileInfo *info) { - GError *error = NULL; + GError *error = nullptr; - mStream = g_file_read(mHandle, NULL, &error); + mStream = g_file_read(mHandle, nullptr, &error); if (!mStream) { nsresult rv = MapGIOResult(error); g_warning("Cannot read from file: %s", error->message); @@ -349,7 +349,7 @@ nsresult nsGIOInputStream::DoOpen() { nsresult rv; - GError *error = NULL; + GError *error = nullptr; NS_ASSERTION(mHandle == nullptr, "already open"); @@ -358,7 +358,7 @@ nsGIOInputStream::DoOpen() GFileInfo *info = g_file_query_info(mHandle, "standard::*", G_FILE_QUERY_INFO_NONE, - NULL, + nullptr, &error); if (error) { @@ -367,7 +367,7 @@ nsGIOInputStream::DoOpen() g_error_free(error); if (NS_IsMainThread()) return NS_ERROR_NOT_CONNECTED; - error = NULL; + error = nullptr; rv = MountVolume(); if (rv != NS_OK) { return rv; @@ -376,7 +376,7 @@ nsGIOInputStream::DoOpen() info = g_file_query_info(mHandle, "standard::*", G_FILE_QUERY_INFO_NONE, - NULL, + nullptr, &error); // second try to get file info from remote files after media mount if (!info) { @@ -423,11 +423,11 @@ nsGIOInputStream::DoRead(char *aBuf, uint32_t aCount, uint32_t *aCountRead) nsresult rv = NS_ERROR_NOT_AVAILABLE; if (mStream) { // file read - GError *error = NULL; + GError *error = nullptr; uint32_t bytes_read = g_input_stream_read(G_INPUT_STREAM(mStream), aBuf, aCount, - NULL, + nullptr, &error); if (error) { rv = MapGIOResult(error); @@ -710,7 +710,7 @@ mount_enclosing_volume_finished (GObject *source_object, GAsyncResult *res, gpointer user_data) { - GError *error = NULL; + GError *error = nullptr; nsGIOInputStream* istream = static_cast(user_data); @@ -1013,7 +1013,7 @@ nsGIOProtocolHandler::NewURI(const nsACString &aSpec, const gchar* const * uri_schemes = g_vfs_get_supported_uri_schemes(gvfs); - while (*uri_schemes != NULL) { + while (*uri_schemes != nullptr) { // While flatSpec ends with ':' the uri_scheme does not. Therefore do not // compare last character. if (StringHead(flatSpec, colon_location).Equals(*uri_schemes)) { @@ -1108,13 +1108,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGIOProtocolHandler, Init) NS_DEFINE_NAMED_CID(NS_GIOPROTOCOLHANDLER_CID); static const mozilla::Module::CIDEntry kVFSCIDs[] = { - { &kNS_GIOPROTOCOLHANDLER_CID, false, NULL, nsGIOProtocolHandlerConstructor }, - { NULL } + { &kNS_GIOPROTOCOLHANDLER_CID, false, nullptr, nsGIOProtocolHandlerConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kVFSContracts[] = { { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MOZ_GIO_SCHEME, &kNS_GIOPROTOCOLHANDLER_CID }, - { NULL } + { nullptr } }; static const mozilla::Module kVFSModule = { diff --git a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp index 903e6164844c..1a36efe13308 100644 --- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp +++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp @@ -378,9 +378,9 @@ nsGnomeVFSInputStream::DoOpen() // nsIAuthPrompt instance. gnome_vfs_module_callback_push(GNOME_VFS_MODULE_CALLBACK_AUTHENTICATION, - AuthCallback, mChannel, NULL); + AuthCallback, mChannel, nullptr); - // Query the mime type first (this could return NULL). + // Query the mime type first (this could return nullptr). // // XXX We need to do this up-front in order to determine how to open the URI. // Unfortunately, the error code GNOME_VFS_ERROR_IS_DIRECTORY is not @@ -962,13 +962,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGnomeVFSProtocolHandler, Init) NS_DEFINE_NAMED_CID(NS_GNOMEVFSPROTOCOLHANDLER_CID); static const mozilla::Module::CIDEntry kVFSCIDs[] = { - { &kNS_GNOMEVFSPROTOCOLHANDLER_CID, false, NULL, nsGnomeVFSProtocolHandlerConstructor }, - { NULL } + { &kNS_GNOMEVFSPROTOCOLHANDLER_CID, false, nullptr, nsGnomeVFSProtocolHandlerConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kVFSContracts[] = { { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MOZ_GNOMEVFS_SCHEME, &kNS_GNOMEVFSPROTOCOLHANDLER_CID }, - { NULL } + { nullptr } }; static const mozilla::Module kVFSModule = { diff --git a/extensions/permissions/nsModuleFactory.cpp b/extensions/permissions/nsModuleFactory.cpp index e0d5742b337c..a8917c463492 100644 --- a/extensions/permissions/nsModuleFactory.cpp +++ b/extensions/permissions/nsModuleFactory.cpp @@ -13,18 +13,18 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsContentBlocker, Init) NS_DEFINE_NAMED_CID(NS_CONTENTBLOCKER_CID); static const mozilla::Module::CIDEntry kPermissionsCIDs[] = { - { &kNS_CONTENTBLOCKER_CID, false, NULL, nsContentBlockerConstructor }, - { NULL } + { &kNS_CONTENTBLOCKER_CID, false, nullptr, nsContentBlockerConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kPermissionsContracts[] = { { NS_CONTENTBLOCKER_CONTRACTID, &kNS_CONTENTBLOCKER_CID }, - { NULL } + { nullptr } }; static const mozilla::Module::CategoryEntry kPermissionsCategories[] = { { "content-policy", NS_CONTENTBLOCKER_CONTRACTID, NS_CONTENTBLOCKER_CONTRACTID }, - { NULL } + { nullptr } }; static const mozilla::Module kPermissionsModule = { diff --git a/extensions/pref/autoconfig/src/nsConfigFactory.cpp b/extensions/pref/autoconfig/src/nsConfigFactory.cpp index 181b5babb5b8..89f886b2aaad 100644 --- a/extensions/pref/autoconfig/src/nsConfigFactory.cpp +++ b/extensions/pref/autoconfig/src/nsConfigFactory.cpp @@ -15,20 +15,20 @@ NS_DEFINE_NAMED_CID(NS_AUTOCONFIG_CID); NS_DEFINE_NAMED_CID(NS_READCONFIG_CID); static const mozilla::Module::CIDEntry kAutoConfigCIDs[] = { - { &kNS_AUTOCONFIG_CID, false, NULL, nsAutoConfigConstructor }, - { &kNS_READCONFIG_CID, false, NULL, nsReadConfigConstructor }, - { NULL } + { &kNS_AUTOCONFIG_CID, false, nullptr, nsAutoConfigConstructor }, + { &kNS_READCONFIG_CID, false, nullptr, nsReadConfigConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kAutoConfigContracts[] = { { NS_AUTOCONFIG_CONTRACTID, &kNS_AUTOCONFIG_CID }, { NS_READCONFIG_CONTRACTID, &kNS_READCONFIG_CID }, - { NULL } + { nullptr } }; static const mozilla::Module::CategoryEntry kAutoConfigCategories[] = { { "pref-config-startup", "ReadConfig Module", NS_READCONFIG_CONTRACTID }, - { NULL } + { nullptr } }; static const mozilla::Module kAutoConfigModule = { diff --git a/extensions/pref/autoconfig/src/nsReadConfig.cpp b/extensions/pref/autoconfig/src/nsReadConfig.cpp index 52fce6404761..bcb68c216834 100644 --- a/extensions/pref/autoconfig/src/nsReadConfig.cpp +++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp @@ -168,7 +168,7 @@ nsresult nsReadConfig::readConfigFile() mRead = true; } - // If the lockFileName is NULL return ok, because no lockFile will be used + // If the lockFileName is nullptr return ok, because no lockFile will be used // Once the config file is read, we should check that the vendor name @@ -200,7 +200,7 @@ nsresult nsReadConfig::readConfigFile() rv = prefBranch->GetCharPref("general.config.vendor", getter_Copies(lockVendor)); - // If vendor is not NULL, do this check + // If vendor is not nullptr, do this check if (NS_SUCCEEDED(rv)) { fileNameLen = PL_strlen(lockFileName); diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.cpp b/extensions/spellcheck/src/mozInlineSpellChecker.cpp index c7c88344202a..0c995b68c26b 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp +++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp @@ -99,7 +99,7 @@ mozInlineSpellStatus::mozInlineSpellStatus(mozInlineSpellChecker* aSpellChecker) // This is the most complicated case. For changes, we need to compute the // range of stuff that changed based on the old and new caret positions, // as well as use a range possibly provided by the editor (start and end, -// which are usually NULL) to get a range with the union of these. +// which are usually nullptr) to get a range with the union of these. nsresult mozInlineSpellStatus::InitForEditorChange( @@ -155,7 +155,7 @@ mozInlineSpellStatus::InitForEditorChange( NS_ENSURE_SUCCESS(rv, rv); // On insert save this range: DoSpellCheck optimizes things in this range. - // Otherwise, just leave this NULL. + // Otherwise, just leave this nullptr. if (aAction == EditAction::insertText) mCreatedRange = mRange; @@ -261,9 +261,9 @@ mozInlineSpellStatus::InitForRange(nsRange* aRange) // Called when the event is triggered to complete initialization that // might require the WordUtil. This calls to the operation-specific // initializer, and also sets the range to be the entire element if it -// is NULL. +// is nullptr. // -// Watch out: the range might still be NULL if there is nothing to do, +// Watch out: the range might still be nullptr if there is nothing to do, // the caller will have to check for this. nsresult @@ -287,7 +287,7 @@ mozInlineSpellStatus::FinishInitOnEvent(mozInlineSpellWordUtil& aWordUtil) NS_ENSURE_SUCCESS(rv, rv); } // Delete events will have no range for the changed text (because it was - // deleted), and InitForEditorChange will set it to NULL. Here, we select + // deleted), and InitForEditorChange will set it to nullptr. Here, we select // the entire word to cause any underlining to be removed. mRange = mNoCheckRange; break; @@ -311,7 +311,7 @@ mozInlineSpellStatus::FinishInitOnEvent(mozInlineSpellWordUtil& aWordUtil) // This verifies that we need to check the word at the previous caret // position. Now that we have the word util, we can find the word belonging // to the previous caret position. If the new position is inside that word, -// we don't want to do anything. In this case, we'll NULL out mRange so +// we don't want to do anything. In this case, we'll nullptr out mRange so // that the caller will know not to continue. // // Notice that we don't set mNoCheckRange. We check here whether the cursor @@ -704,7 +704,7 @@ mozInlineSpellChecker::SetEnableRealTimeSpell(bool aEnabled) // Called by the editor when nearly anything happens to change the content. // // The start and end positions specify a range for the thing that happened, -// but these are usually NULL, even when you'd think they would be useful +// but these are usually nullptr, even when you'd think they would be useful // because you want the range (for example, pasting). We ignore them in // this case. @@ -750,7 +750,7 @@ mozInlineSpellChecker::SpellCheckAfterEditorChange( // mozInlineSpellChecker::SpellCheckRange // // Spellchecks all the words in the given range. -// Supply a NULL range and this will check the entire editor. +// Supply a nullptr range and this will check the entire editor. nsresult mozInlineSpellChecker::SpellCheckRange(nsIDOMRange* aRange) @@ -971,11 +971,11 @@ NS_IMETHODIMP mozInlineSpellChecker::DidDeleteSelection(nsISelection *aSelection // mozInlineSpellChecker::MakeSpellCheckRange // // Given begin and end positions, this function constructs a range as -// required for ScheduleSpellCheck. If the start and end nodes are NULL, +// required for ScheduleSpellCheck. If the start and end nodes are nullptr, // then the entire range will be selected, and you can supply -1 as the // offset to the end range to select all of that node. // -// If the resulting range would be empty, NULL is put into *aRange and the +// If the resulting range would be empty, nullptr is put into *aRange and the // function succeeds. nsresult @@ -1228,12 +1228,12 @@ mozInlineSpellChecker::DoSpellCheckSelection(mozInlineSpellWordUtil& aWordUtil, // mozInlineSpellChecker::DoSpellCheck // // This function checks words intersecting the given range, excluding those -// inside mStatus->mNoCheckRange (can be NULL). Words inside aNoCheckRange +// inside mStatus->mNoCheckRange (can be nullptr). Words inside aNoCheckRange // will have any spell selection removed (this is used to hide the // underlining for the word that the caret is in). aNoCheckRange should be // on word boundaries. // -// mResume->mCreatedRange is a possibly NULL range of new text that was +// mResume->mCreatedRange is a possibly nullptr range of new text that was // inserted. Inside this range, we don't bother to check whether things are // inside the spellcheck selection, which speeds up large paste operations // considerably. @@ -1503,7 +1503,7 @@ mozInlineSpellChecker::ResumeCheck(mozInlineSpellStatus* aStatus) // intersects is places in *aRange. (There may be multiple disjoint // ranges in a selection.) // -// If there is no intersection, *aRange will be NULL. +// If there is no intersection, *aRange will be nullptr. nsresult mozInlineSpellChecker::IsPointInSelection(nsISelection *aSelection, diff --git a/extensions/spellcheck/src/mozInlineSpellChecker.h b/extensions/spellcheck/src/mozInlineSpellChecker.h index ad4bb1b43731..374efe644443 100644 --- a/extensions/spellcheck/src/mozInlineSpellChecker.h +++ b/extensions/spellcheck/src/mozInlineSpellChecker.h @@ -70,18 +70,18 @@ public: Operation mOp; // Used for events where we have already computed the range to use. It can - // also be NULL in these cases where we need to check the entire range. + // also be nullptr in these cases where we need to check the entire range. nsRefPtr mRange; // If we happen to know something was inserted, this is that range. - // Can be NULL (this only allows an optimization, so not setting doesn't hurt) + // Can be nullptr (this only allows an optimization, so not setting doesn't hurt) nsCOMPtr mCreatedRange; - // Contains the range computed for the current word. Can be NULL. + // Contains the range computed for the current word. Can be nullptr. nsRefPtr mNoCheckRange; // Indicates the position of the cursor for the event (so we can compute - // mNoCheckRange). It can be NULL if we don't care about the cursor position + // mNoCheckRange). It can be nullptr if we don't care about the cursor position // (such as for the intial check of everything). // // For mOp == eOpNavigation, this is the NEW position of the cursor diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.h b/extensions/spellcheck/src/mozInlineSpellWordUtil.h index cd04aa99b7a8..87d7c4651e5d 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.h +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.h @@ -71,7 +71,7 @@ public: nsRange** aRange); // Moves to the the next word in the range, and retrieves it's text and range. - // An empty word and a NULL range are returned when we are done checking. + // An empty word and a nullptr range are returned when we are done checking. // aSkipChecking will be set if the word is "special" and shouldn't be // checked (e.g., an email address). nsresult GetNextWord(nsAString& aText, nsRange** aRange, diff --git a/extensions/spellcheck/src/mozSpellChecker.cpp b/extensions/spellcheck/src/mozSpellChecker.cpp index 2fd779a57add..28dc6a1b2105 100644 --- a/extensions/spellcheck/src/mozSpellChecker.cpp +++ b/extensions/spellcheck/src/mozSpellChecker.cpp @@ -289,7 +289,7 @@ mozSpellChecker::GetDictionaryList(nsTArray *aDictionaryList) nsCOMPtr engine = spellCheckingEngines[i]; uint32_t count = 0; - PRUnichar **words = NULL; + PRUnichar **words = nullptr; engine->GetDictionaryList(&words, &count); for (uint32_t k = 0; k < count; k++) { nsAutoString dictName; @@ -298,10 +298,10 @@ mozSpellChecker::GetDictionaryList(nsTArray *aDictionaryList) // Skip duplicate dictionaries. Only take the first one // for each name. - if (dictionaries.Get(dictName, NULL)) + if (dictionaries.Get(dictName, nullptr)) continue; - dictionaries.Put(dictName, NULL); + dictionaries.Put(dictName, nullptr); if (!aDictionaryList->AppendElement(dictName)) { NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, words); @@ -365,7 +365,7 @@ mozSpellChecker::SetCurrentDictionary(const nsAString &aDictionary) } } - mSpellCheckingEngine = NULL; + mSpellCheckingEngine = nullptr; // We could not find any engine with the requested dictionary return NS_ERROR_NOT_AVAILABLE; diff --git a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp index 3ca32963a70b..2cb7768b3c45 100644 --- a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp +++ b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp @@ -38,13 +38,13 @@ NS_DEFINE_NAMED_CID(MOZ_SPELLI18NMANAGER_CID); NS_DEFINE_NAMED_CID(MOZ_INLINESPELLCHECKER_CID); static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = { - { &kMOZ_HUNSPELL_CID, false, NULL, mozHunspellConstructor }, - { &kHUNSPELLDIRPROVIDER_CID, false, NULL, mozHunspellDirProviderConstructor }, - { &kNS_SPELLCHECKER_CID, false, NULL, mozSpellCheckerConstructor }, - { &kMOZ_PERSONALDICTIONARY_CID, false, NULL, mozPersonalDictionaryConstructor }, - { &kMOZ_SPELLI18NMANAGER_CID, false, NULL, mozSpellI18NManagerConstructor }, - { &kMOZ_INLINESPELLCHECKER_CID, false, NULL, mozInlineSpellCheckerConstructor }, - { NULL } + { &kMOZ_HUNSPELL_CID, false, nullptr, mozHunspellConstructor }, + { &kHUNSPELLDIRPROVIDER_CID, false, nullptr, mozHunspellDirProviderConstructor }, + { &kNS_SPELLCHECKER_CID, false, nullptr, mozSpellCheckerConstructor }, + { &kMOZ_PERSONALDICTIONARY_CID, false, nullptr, mozPersonalDictionaryConstructor }, + { &kMOZ_SPELLI18NMANAGER_CID, false, nullptr, mozSpellI18NManagerConstructor }, + { &kMOZ_INLINESPELLCHECKER_CID, false, nullptr, mozInlineSpellCheckerConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = { @@ -54,12 +54,12 @@ static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = { { MOZ_PERSONALDICTIONARY_CONTRACTID, &kMOZ_PERSONALDICTIONARY_CID }, { MOZ_SPELLI18NMANAGER_CONTRACTID, &kMOZ_SPELLI18NMANAGER_CID }, { MOZ_INLINESPELLCHECKER_CONTRACTID, &kMOZ_INLINESPELLCHECKER_CID }, - { NULL } + { nullptr } }; static const mozilla::Module::CategoryEntry kSpellcheckCategories[] = { { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "spellcheck-directory-provider", mozHunspellDirProvider::kContractID }, - { NULL } + { nullptr } }; const mozilla::Module kSpellcheckModule = { diff --git a/extensions/spellcheck/src/mozSpellI18NManager.cpp b/extensions/spellcheck/src/mozSpellI18NManager.cpp index 0d4dcd8abe93..a2d8d4dffdea 100644 --- a/extensions/spellcheck/src/mozSpellI18NManager.cpp +++ b/extensions/spellcheck/src/mozSpellI18NManager.cpp @@ -23,10 +23,10 @@ mozSpellI18NManager::~mozSpellI18NManager() /* mozISpellI18NUtil GetUtil (in wstring language); */ NS_IMETHODIMP mozSpellI18NManager::GetUtil(const PRUnichar *aLanguage, mozISpellI18NUtil **_retval) { - if( NULL == _retval) { + if( nullptr == _retval) { return NS_ERROR_NULL_POINTER; } - *_retval = NULL; + *_retval = nullptr; nsAutoString lang; lang.Assign(aLanguage); if(lang.EqualsLiteral("en")){ diff --git a/extensions/universalchardet/src/xpcom/nsUniversalCharDetModule.cpp b/extensions/universalchardet/src/xpcom/nsUniversalCharDetModule.cpp index 1944242ad251..e5f7fc243f81 100644 --- a/extensions/universalchardet/src/xpcom/nsUniversalCharDetModule.cpp +++ b/extensions/universalchardet/src/xpcom/nsUniversalCharDetModule.cpp @@ -52,21 +52,21 @@ NS_DEFINE_NAMED_CID(NS_CJK_PSMDETECTOR_CID); NS_DEFINE_NAMED_CID(NS_CJK_STRING_PSMDETECTOR_CID); static const mozilla::Module::CIDEntry kChardetCIDs[] = { - { &kNS_UNIVERSAL_DETECTOR_CID, false, NULL, nsUniversalXPCOMDetectorConstructor }, - { &kNS_UNIVERSAL_STRING_DETECTOR_CID, false, NULL, nsUniversalXPCOMStringDetectorConstructor }, - { &kNS_JA_PSMDETECTOR_CID, false, NULL, nsJAPSMDetectorConstructor }, - { &kNS_JA_STRING_PSMDETECTOR_CID, false, NULL, nsJAStringPSMDetectorConstructor }, - { &kNS_KO_PSMDETECTOR_CID, false, NULL, nsKOPSMDetectorConstructor }, - { &kNS_KO_STRING_PSMDETECTOR_CID, false, NULL, nsKOStringPSMDetectorConstructor }, - { &kNS_ZHTW_PSMDETECTOR_CID, false, NULL, nsZHTWPSMDetectorConstructor }, - { &kNS_ZHTW_STRING_PSMDETECTOR_CID, false, NULL, nsZHTWStringPSMDetectorConstructor }, - { &kNS_ZHCN_PSMDETECTOR_CID, false, NULL, nsZHCNPSMDetectorConstructor }, - { &kNS_ZHCN_STRING_PSMDETECTOR_CID, false, NULL, nsZHCNStringPSMDetectorConstructor }, - { &kNS_ZH_PSMDETECTOR_CID, false, NULL, nsZHPSMDetectorConstructor }, - { &kNS_ZH_STRING_PSMDETECTOR_CID, false, NULL, nsZHStringPSMDetectorConstructor }, - { &kNS_CJK_PSMDETECTOR_CID, false, NULL, nsCJKPSMDetectorConstructor }, - { &kNS_CJK_STRING_PSMDETECTOR_CID, false, NULL, nsCJKStringPSMDetectorConstructor }, - { NULL } + { &kNS_UNIVERSAL_DETECTOR_CID, false, nullptr, nsUniversalXPCOMDetectorConstructor }, + { &kNS_UNIVERSAL_STRING_DETECTOR_CID, false, nullptr, nsUniversalXPCOMStringDetectorConstructor }, + { &kNS_JA_PSMDETECTOR_CID, false, nullptr, nsJAPSMDetectorConstructor }, + { &kNS_JA_STRING_PSMDETECTOR_CID, false, nullptr, nsJAStringPSMDetectorConstructor }, + { &kNS_KO_PSMDETECTOR_CID, false, nullptr, nsKOPSMDetectorConstructor }, + { &kNS_KO_STRING_PSMDETECTOR_CID, false, nullptr, nsKOStringPSMDetectorConstructor }, + { &kNS_ZHTW_PSMDETECTOR_CID, false, nullptr, nsZHTWPSMDetectorConstructor }, + { &kNS_ZHTW_STRING_PSMDETECTOR_CID, false, nullptr, nsZHTWStringPSMDetectorConstructor }, + { &kNS_ZHCN_PSMDETECTOR_CID, false, nullptr, nsZHCNPSMDetectorConstructor }, + { &kNS_ZHCN_STRING_PSMDETECTOR_CID, false, nullptr, nsZHCNStringPSMDetectorConstructor }, + { &kNS_ZH_PSMDETECTOR_CID, false, nullptr, nsZHPSMDetectorConstructor }, + { &kNS_ZH_STRING_PSMDETECTOR_CID, false, nullptr, nsZHStringPSMDetectorConstructor }, + { &kNS_CJK_PSMDETECTOR_CID, false, nullptr, nsCJKPSMDetectorConstructor }, + { &kNS_CJK_STRING_PSMDETECTOR_CID, false, nullptr, nsCJKStringPSMDetectorConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kChardetContracts[] = { @@ -84,7 +84,7 @@ static const mozilla::Module::ContractIDEntry kChardetContracts[] = { { NS_STRCDETECTOR_CONTRACTID_BASE "zh_parallel_state_machine", &kNS_ZH_STRING_PSMDETECTOR_CID }, { NS_CHARSET_DETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine", &kNS_CJK_PSMDETECTOR_CID }, { NS_STRCDETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine", &kNS_CJK_STRING_PSMDETECTOR_CID }, - { NULL } + { nullptr } }; static const mozilla::Module::CategoryEntry kChardetCategories[] = { @@ -95,7 +95,7 @@ static const mozilla::Module::CategoryEntry kChardetCategories[] = { { NS_CHARSET_DETECTOR_CATEGORY, "zhcn_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "zhcn_parallel_state_machine" }, { NS_CHARSET_DETECTOR_CATEGORY, "zh_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "zh_parallel_state_machine" }, { NS_CHARSET_DETECTOR_CATEGORY, "cjk_parallel_state_machine", NS_CHARSET_DETECTOR_CONTRACTID_BASE "cjk_parallel_state_machine" }, - { NULL } + { nullptr } }; static const mozilla::Module kChardetModule = {