Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 9d92ba2

Browse files
author
matekm
committed
Bug 784739 - Switch from NULL to nullptr in extensions/; r=ehsan
1 parent 3e42890 commit 9d92ba2

21 files changed

Lines changed: 139 additions & 139 deletions

extensions/auth/gssapi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ typedef struct gss_channel_bindings_struct {
245245
#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
246246
#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
247247
#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
248-
#define GSS_C_EMPTY_BUFFER {0, NULL}
248+
#define GSS_C_EMPTY_BUFFER {0, nullptr}
249249

250250
/*
251251
* Some alternate names for a couple of the above

extensions/auth/nsAuthFactory.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,18 @@ NS_DEFINE_NAMED_CID(NS_AUTHSASL_CID);
189189

190190

191191
static const mozilla::Module::CIDEntry kAuthCIDs[] = {
192-
{ &kNS_GSSAUTH_CID, false, NULL, nsKerbGSSAPIAuthConstructor },
193-
{ &kNS_NEGOTIATEAUTH_CID, false, NULL, nsGSSAPIAuthConstructor },
192+
{ &kNS_GSSAUTH_CID, false, nullptr, nsKerbGSSAPIAuthConstructor },
193+
{ &kNS_NEGOTIATEAUTH_CID, false, nullptr, nsGSSAPIAuthConstructor },
194194
#if defined( USE_SSPI )
195-
{ &kNS_NEGOTIATEAUTHSSPI_CID, false, NULL, nsAuthSSPIConstructor },
196-
{ &kNS_KERBAUTHSSPI_CID, false, NULL, nsKerbSSPIAuthConstructor },
197-
{ &kNS_SYSNTLMAUTH_CID, false, NULL, nsSysNTLMAuthConstructor },
195+
{ &kNS_NEGOTIATEAUTHSSPI_CID, false, nullptr, nsAuthSSPIConstructor },
196+
{ &kNS_KERBAUTHSSPI_CID, false, nullptr, nsKerbSSPIAuthConstructor },
197+
{ &kNS_SYSNTLMAUTH_CID, false, nullptr, nsSysNTLMAuthConstructor },
198198
#else
199-
{ &kNS_SAMBANTLMAUTH_CID, false, NULL, nsSambaNTLMAuthConstructor },
199+
{ &kNS_SAMBANTLMAUTH_CID, false, nullptr, nsSambaNTLMAuthConstructor },
200200
#endif
201-
{ &kNS_HTTPNEGOTIATEAUTH_CID, false, NULL, nsHttpNegotiateAuthConstructor },
202-
{ &kNS_AUTHSASL_CID, false, NULL, nsAuthSASLConstructor },
203-
{ NULL }
201+
{ &kNS_HTTPNEGOTIATEAUTH_CID, false, nullptr, nsHttpNegotiateAuthConstructor },
202+
{ &kNS_AUTHSASL_CID, false, nullptr, nsAuthSASLConstructor },
203+
{ nullptr }
204204
};
205205

206206
static const mozilla::Module::ContractIDEntry kAuthContracts[] = {
@@ -215,7 +215,7 @@ static const mozilla::Module::ContractIDEntry kAuthContracts[] = {
215215
#endif
216216
{ NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "negotiate", &kNS_HTTPNEGOTIATEAUTH_CID },
217217
{ NS_AUTH_MODULE_CONTRACTID_PREFIX "sasl-gssapi", &kNS_AUTHSASL_CID },
218-
{ NULL }
218+
{ nullptr }
219219
};
220220

221221
//-----------------------------------------------------------------------------
@@ -243,8 +243,8 @@ static const mozilla::Module kAuthModule = {
243243
mozilla::Module::kVersion,
244244
kAuthCIDs,
245245
kAuthContracts,
246-
NULL,
247-
NULL,
246+
nullptr,
247+
nullptr,
248248
InitNegotiateAuth,
249249
DestroyNegotiateAuth
250250
};

extensions/auth/nsAuthGSSAPI.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@ static struct GSSFunction {
6262
const char *str;
6363
PRFuncPtr func;
6464
} gssFuncs[] = {
65-
{ "gss_display_status", NULL },
66-
{ "gss_init_sec_context", NULL },
67-
{ "gss_indicate_mechs", NULL },
68-
{ "gss_release_oid_set", NULL },
69-
{ "gss_delete_sec_context", NULL },
70-
{ "gss_import_name", NULL },
71-
{ "gss_release_buffer", NULL },
72-
{ "gss_release_name", NULL },
73-
{ "gss_wrap", NULL },
74-
{ "gss_unwrap", NULL }
65+
{ "gss_display_status", nullptr },
66+
{ "gss_init_sec_context", nullptr },
67+
{ "gss_indicate_mechs", nullptr },
68+
{ "gss_release_oid_set", nullptr },
69+
{ "gss_delete_sec_context", nullptr },
70+
{ "gss_import_name", nullptr },
71+
{ "gss_release_buffer", nullptr },
72+
{ "gss_release_name", nullptr },
73+
{ "gss_wrap", nullptr },
74+
{ "gss_unwrap", nullptr }
7575
};
7676

7777
static bool gssNativeImp = true;
@@ -104,7 +104,7 @@ gssInit()
104104
prefs->GetBoolPref(kNegotiateAuthNativeImp, &gssNativeImp);
105105
}
106106

107-
PRLibrary *lib = NULL;
107+
PRLibrary *lib = nullptr;
108108

109109
if (!libPath.IsEmpty()) {
110110
LOG(("Attempting to load user specified library [%s]\n", libPath.get()));
@@ -113,7 +113,7 @@ gssInit()
113113
}
114114
else {
115115
#ifdef XP_WIN
116-
char *libName = PR_GetLibraryName(NULL, "gssapi32");
116+
char *libName = PR_GetLibraryName(nullptr, "gssapi32");
117117
if (libName) {
118118
lib = PR_LoadLibrary("gssapi32");
119119
PR_FreeLibraryName(libName);
@@ -148,12 +148,12 @@ gssInit()
148148
PR_FindFunctionSymbol(lib, "gssd_pname_to_uid")) {
149149
LOG(("CITI libgssapi found, which calls exit(). Skipping\n"));
150150
PR_UnloadLibrary(lib);
151-
lib = NULL;
151+
lib = nullptr;
152152
}
153153
}
154154

155155
for (size_t i = 0; i < ArrayLength(libNames) && !lib; ++i) {
156-
char *libName = PR_GetLibraryName(NULL, libNames[i]);
156+
char *libName = PR_GetLibraryName(nullptr, libNames[i]);
157157
if (libName) {
158158
lib = PR_LoadLibrary(libName);
159159
PR_FreeLibraryName(libName);
@@ -164,7 +164,7 @@ gssInit()
164164
PR_FindFunctionSymbol(lib, "gssd_pname_to_uid")) {
165165
LOG(("CITI libgssapi found, which calls exit(). Skipping\n"));
166166
PR_UnloadLibrary(lib);
167-
lib = NULL;
167+
lib = nullptr;
168168
}
169169
}
170170
}
@@ -396,7 +396,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken,
396396
&input_token,
397397
&gss_c_nt_hostbased_service,
398398
&server);
399-
input_token.value = NULL;
399+
input_token.value = nullptr;
400400
input_token.length = 0;
401401
if (GSS_ERROR(major_status)) {
402402
LogGssError(major_status, minor_status, "gss_import_name() failed");
@@ -429,7 +429,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken,
429429
mServiceName.Find("ldap@");
430430

431431
if (!doingMailTask && (gssNativeImp &&
432-
(KLCacheHasValidTickets_ptr(NULL, kerberosVersion_V5, &found, NULL, NULL) != klNoErr || !found)))
432+
(KLCacheHasValidTickets_ptr(nullptr, kerberosVersion_V5, &found, nullptr, nullptr) != klNoErr || !found)))
433433
{
434434
major_status = GSS_S_FAILURE;
435435
minor_status = 0;
@@ -473,7 +473,7 @@ nsAuthGSSAPI::GetNextToken(const void *inToken,
473473
if (output_token.length != 0)
474474
*outToken = nsMemory::Clone(output_token.value, output_token.length);
475475
else
476-
*outToken = NULL;
476+
*outToken = nullptr;
477477

478478
gss_release_buffer_ptr(&minor_status, &output_token);
479479

@@ -507,8 +507,8 @@ nsAuthGSSAPI::Unwrap(const void *inToken,
507507
mCtx,
508508
&input_token,
509509
&output_token,
510-
NULL,
511-
NULL);
510+
nullptr,
511+
nullptr);
512512
if (GSS_ERROR(major_status)) {
513513
LogGssError(major_status, minor_status, "gss_unwrap() failed");
514514
Reset();
@@ -521,7 +521,7 @@ nsAuthGSSAPI::Unwrap(const void *inToken,
521521
if (output_token.length)
522522
*outToken = nsMemory::Clone(output_token.value, output_token.length);
523523
else
524-
*outToken = NULL;
524+
*outToken = nullptr;
525525

526526
gss_release_buffer_ptr(&minor_status, &output_token);
527527

@@ -548,7 +548,7 @@ nsAuthGSSAPI::Wrap(const void *inToken,
548548
confidential,
549549
GSS_C_QOP_DEFAULT,
550550
&input_token,
551-
NULL,
551+
nullptr,
552552
&output_token);
553553

554554
if (GSS_ERROR(major_status)) {

extensions/auth/nsAuthSASL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ nsAuthSASL::GetNextToken(const void *inToken,
8282
// I don't think this is correct, but we need to handle that behaviour.
8383
// Cyrus ignores the contents of our reply token.
8484
if (inTokenLen == 0) {
85-
*outToken = NULL;
85+
*outToken = nullptr;
8686
*outTokenLen = 0;
8787
return NS_OK;
8888
}
@@ -114,7 +114,7 @@ nsAuthSASL::GetNextToken(const void *inToken,
114114
message[2] = 0x00;
115115
message[3] = 0x00; // Maxbuf must be zero if we've got no sec layer
116116
strcpy(message+4, userbuf.get());
117-
// Userbuf should not be NULL terminated, so trim the trailing NULL
117+
// Userbuf should not be nullptr terminated, so trim the trailing nullptr
118118
// when wrapping the message
119119
rv = mInnerModule->Wrap((void *) message, messageLen-1, false,
120120
outToken, outTokenLen);

extensions/auth/nsAuthSSPI.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,13 @@ nsAuthSSPI::Init(const char *serviceName,
262262
pai = &ai;
263263
}
264264

265-
rc = (sspi->AcquireCredentialsHandleW)(NULL,
265+
rc = (sspi->AcquireCredentialsHandleW)(nullptr,
266266
package,
267267
SECPKG_CRED_OUTBOUND,
268-
NULL,
268+
nullptr,
269269
pai,
270-
NULL,
271-
NULL,
270+
nullptr,
271+
nullptr,
272272
&mCred,
273273
&useBefore);
274274
if (rc != SEC_E_OK)
@@ -432,7 +432,7 @@ nsAuthSSPI::GetNextToken(const void *inToken,
432432
LOG(("Cannot restart authentication sequence!"));
433433
return NS_ERROR_UNEXPECTED;
434434
}
435-
ctxIn = NULL;
435+
ctxIn = nullptr;
436436
mIsFirst = false;
437437
}
438438

@@ -458,7 +458,7 @@ nsAuthSSPI::GetNextToken(const void *inToken,
458458
ctxReq,
459459
0,
460460
SECURITY_NATIVE_DREP,
461-
inToken ? &ibd : NULL,
461+
inToken ? &ibd : nullptr,
462462
0,
463463
&mCtxt,
464464
&obd,
@@ -477,7 +477,7 @@ nsAuthSSPI::GetNextToken(const void *inToken,
477477

478478
if (!ob.cbBuffer) {
479479
nsMemory::Free(ob.pvBuffer);
480-
ob.pvBuffer = NULL;
480+
ob.pvBuffer = nullptr;
481481
}
482482
*outToken = ob.pvBuffer;
483483
*outTokenLen = ob.cbBuffer;
@@ -520,13 +520,13 @@ nsAuthSSPI::Unwrap(const void *inToken,
520520
// app data
521521
ib[1].BufferType = SECBUFFER_DATA;
522522
ib[1].cbBuffer = 0;
523-
ib[1].pvBuffer = NULL;
523+
ib[1].pvBuffer = nullptr;
524524

525525
rc = (sspi->DecryptMessage)(
526526
&mCtxt,
527527
&ibd,
528528
0, // no sequence numbers
529-
NULL
529+
nullptr
530530
);
531531

532532
if (SEC_SUCCESS(rc)) {

extensions/auth/nsHttpNegotiateAuth.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne
237237
//
238238
// Decode the response that followed the "Negotiate" token
239239
//
240-
if (PL_Base64Decode(challenge, len, (char *) inToken) == NULL) {
240+
if (PL_Base64Decode(challenge, len, (char *) inToken) == nullptr) {
241241
free(inToken);
242242
return(NS_ERROR_UNEXPECTED);
243243
}

extensions/cookie/nsCookieModule.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ NS_DEFINE_NAMED_CID(NS_COOKIEPERMISSION_CID);
2727

2828

2929
static const mozilla::Module::CIDEntry kCookieCIDs[] = {
30-
{ &kNS_PERMISSIONMANAGER_CID, false, NULL, nsIPermissionManagerConstructor },
31-
{ &kNS_POPUPWINDOWMANAGER_CID, false, NULL, nsPopupWindowManagerConstructor },
32-
{ &kNS_COOKIEPROMPTSERVICE_CID, false, NULL, nsCookiePromptServiceConstructor },
33-
{ &kNS_COOKIEPERMISSION_CID, false, NULL, nsCookiePermissionConstructor },
34-
{ NULL }
30+
{ &kNS_PERMISSIONMANAGER_CID, false, nullptr, nsIPermissionManagerConstructor },
31+
{ &kNS_POPUPWINDOWMANAGER_CID, false, nullptr, nsPopupWindowManagerConstructor },
32+
{ &kNS_COOKIEPROMPTSERVICE_CID, false, nullptr, nsCookiePromptServiceConstructor },
33+
{ &kNS_COOKIEPERMISSION_CID, false, nullptr, nsCookiePermissionConstructor },
34+
{ nullptr }
3535
};
3636

3737
static const mozilla::Module::ContractIDEntry kCookieContracts[] = {
3838
{ NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID },
3939
{ NS_POPUPWINDOWMANAGER_CONTRACTID, &kNS_POPUPWINDOWMANAGER_CID },
4040
{ NS_COOKIEPROMPTSERVICE_CONTRACTID, &kNS_COOKIEPROMPTSERVICE_CID },
4141
{ NS_COOKIEPERMISSION_CONTRACTID, &kNS_COOKIEPERMISSION_CID },
42-
{ NULL }
42+
{ nullptr }
4343
};
4444

4545
static const mozilla::Module kCookieModule = {

extensions/cookie/nsCookiePermission.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class nsCookiePermission : public nsICookiePermission
3333
void PrefChanged(nsIPrefBranch *, const char *);
3434

3535
private:
36-
bool EnsureInitialized() { return (mPermMgr != NULL && mThirdPartyUtil != NULL) || Init(); };
36+
bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); };
3737

3838
nsCOMPtr<nsIPermissionManager> mPermMgr;
3939
nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;

extensions/cookie/nsPermissionManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ ChildProcess()
5353
if (IsChildProcess()) {
5454
ContentChild* cpc = ContentChild::GetSingleton();
5555
if (!cpc)
56-
NS_RUNTIMEABORT("Content Process is NULL!");
56+
NS_RUNTIMEABORT("Content Process is nullptr!");
5757
return cpc;
5858
}
5959

0 commit comments

Comments
 (0)