Bug 784739 - Switch from NULL to nullptr in toolkit/; r=ehsan

This commit is contained in:
Birunthan Mohanathas 2013-10-10 16:36:42 -04:00
parent 0b51035eb5
commit b2658eb131
37 changed files with 226 additions and 218 deletions

View File

@ -105,13 +105,13 @@ nsJSInspector::GetLastNestRequestor(JS::Value *out)
NS_DEFINE_NAMED_CID(JSINSPECTOR_CID);
static const mozilla::Module::CIDEntry kJSInspectorCIDs[] = {
{ &kJSINSPECTOR_CID, false, NULL, mozilla::jsinspector::nsJSInspectorConstructor },
{ NULL }
{ &kJSINSPECTOR_CID, false, nullptr, mozilla::jsinspector::nsJSInspectorConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kJSInspectorContracts[] = {
{ JSINSPECTOR_CONTRACTID, &kJSINSPECTOR_CID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kJSInspectorModule = {

View File

@ -117,9 +117,9 @@ private:
return;
SECKEY_DestroyPrivateKey(mPrivateKey);
mPrivateKey = NULL;
mPrivateKey = nullptr;
SECKEY_DestroyPublicKey(mPublicKey);
mPublicKey = NULL;
mPublicKey = nullptr;
}
SECKEYPrivateKey * mPrivateKey;
@ -156,7 +156,7 @@ private:
if (isAlreadyShutDown())
return;
mKeyPair = NULL;
mKeyPair = nullptr;
}
const KeyType mKeyType; // in
@ -195,7 +195,7 @@ private:
return;
SECKEY_DestroyPrivateKey(mPrivateKey);
mPrivateKey = NULL;
mPrivateKey = nullptr;
}
const nsCString mTextToSign; // in
@ -376,18 +376,18 @@ GenerateKeyPair(PK11SlotInfo * slot,
CK_MECHANISM_TYPE mechanism,
void * params)
{
*publicKey = NULL;
*publicKey = nullptr;
*privateKey = PK11_GenerateKeyPair(slot, mechanism, params, publicKey,
PR_FALSE /*isPerm*/,
PR_TRUE /*isSensitive*/,
NULL /*&pwdata*/);
nullptr /*&pwdata*/);
if (!*privateKey) {
MOZ_ASSERT(!*publicKey);
return PRErrorCode_to_nsresult(PR_GetError());
}
if (!*publicKey) {
SECKEY_DestroyPrivateKey(*privateKey);
*privateKey = NULL;
*privateKey = nullptr;
MOZ_CRASH("PK11_GnerateKeyPair returned private key without public key");
}
@ -460,7 +460,7 @@ GenerateDSAKeyPair(PK11SlotInfo * slot,
static_assert(MOZ_ARRAY_LENGTH(G) == 1024 / CHAR_BIT, "bad DSA G");
PQGParams pqgParams = {
NULL /*arena*/,
nullptr /*arena*/,
{ siBuffer, P, static_cast<unsigned int>(mozilla::ArrayLength(P)) },
{ siBuffer, Q, static_cast<unsigned int>(mozilla::ArrayLength(Q)) },
{ siBuffer, G, static_cast<unsigned int>(mozilla::ArrayLength(G)) }
@ -484,8 +484,8 @@ KeyGenRunnable::Run()
if (!slot) {
mRv = NS_ERROR_UNEXPECTED;
} else {
SECKEYPrivateKey *privk = NULL;
SECKEYPublicKey *pubk = NULL;
SECKEYPrivateKey *privk = nullptr;
SECKEYPublicKey *pubk = nullptr;
switch (mKeyType) {
case rsaKey:
@ -538,11 +538,11 @@ SignRunnable::Run()
// We need the output in PKCS#11 format, not DER encoding, so we must use
// PK11_HashBuf and PK11_Sign instead of SEC_SignData.
SECItem sig = { siBuffer, NULL, 0 };
SECItem sig = { siBuffer, nullptr, 0 };
int sigLength = PK11_SignatureLen(mPrivateKey);
if (sigLength <= 0) {
mRv = PRErrorCode_to_nsresult(PR_GetError());
} else if (!SECITEM_AllocItem(NULL, &sig, sigLength)) {
} else if (!SECITEM_AllocItem(nullptr, &sig, sigLength)) {
mRv = PRErrorCode_to_nsresult(PR_GetError());
} else {
uint8_t hash[32]; // big enough for SHA-1 or SHA-256
@ -586,13 +586,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(IdentityCryptoService, Init)
NS_DEFINE_NAMED_CID(NS_IDENTITYCRYPTOSERVICE_CID);
const mozilla::Module::CIDEntry kCIDs[] = {
{ &kNS_IDENTITYCRYPTOSERVICE_CID, false, NULL, IdentityCryptoServiceConstructor },
{ NULL }
{ &kNS_IDENTITYCRYPTOSERVICE_CID, false, nullptr, IdentityCryptoServiceConstructor },
{ nullptr }
};
const mozilla::Module::ContractIDEntry kContracts[] = {
{ "@mozilla.org/identity/crypto-service;1", &kNS_IDENTITYCRYPTOSERVICE_CID },
{ NULL }
{ nullptr }
};
const mozilla::Module kModule = {

View File

@ -123,7 +123,7 @@ FARPROC WINAPI DelayDllLoadHook(unsigned dliNotify, PDelayLoadInfo pdli)
!strnicmp(pdli->dlp.szProcName, kfailfast, strlen(kfailfast))) {
return (FARPROC)__abi_MozFailFast;
}
return NULL;
return nullptr;
}
ExternC PfnDliHook __pfnDliNotifyHook2 = DelayDllLoadHook;

View File

@ -261,7 +261,7 @@ extern const mozilla::Module *const *const kPStaticModules[] = {
#ifdef MOZ_WIDGET_GONK
MODULE(WifiProxyServiceModule)
#endif
NULL
nullptr
};
#undef MODULE

View File

@ -73,13 +73,13 @@ NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID);
void test() {};
static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
{ &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, NULL, nsAndroidSystemProxySettingsConstructor },
{ NULL }
{ &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr, nsAndroidSystemProxySettingsConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
{ NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kSysProxyModule = {

View File

@ -25,13 +25,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetworkManagerListener, Init)
NS_DEFINE_NAMED_CID(NS_DBUS_NETWORK_LINK_SERVICE_CID);
static const mozilla::Module::CIDEntry kDBUSCIDs[] = {
{ &kNS_DBUS_NETWORK_LINK_SERVICE_CID, false, NULL, nsNetworkManagerListenerConstructor },
{ NULL }
{ &kNS_DBUS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNetworkManagerListenerConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kDBUSContracts[] = {
{ NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_DBUS_NETWORK_LINK_SERVICE_CID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kDBUSModule = {

View File

@ -128,14 +128,14 @@ void nsDBusService::HandleDBusDisconnect() {
}
nsresult nsDBusService::CreateConnection() {
mConnection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
mConnection = dbus_bus_get(DBUS_BUS_SYSTEM, nullptr);
if (!mConnection)
return NS_ERROR_FAILURE;
dbus_connection_set_exit_on_disconnect(mConnection, false);
dbus_connection_setup_with_g_main(mConnection, NULL);
dbus_connection_setup_with_g_main(mConnection, nullptr);
if (!dbus_connection_add_filter(mConnection, dbus_filter, this, NULL))
if (!dbus_connection_add_filter(mConnection, dbus_filter, this, nullptr))
return NS_ERROR_FAILURE;
mSingleClient->RegisterWithConnection(mConnection);

View File

@ -125,7 +125,7 @@ nsNetworkManagerListener::RegisterWithConnection(DBusConnection* connection)
return;
}
dbus_pending_call_set_notify(reply, NetworkStatusNotify, this, NULL);
dbus_pending_call_set_notify(reply, NetworkStatusNotify, this, nullptr);
dbus_pending_call_unref(reply);
}
@ -172,7 +172,7 @@ void
nsNetworkManagerListener::UpdateNetworkStatus(DBusMessage* msg)
{
int32_t result;
if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_UINT32, &result,
if (!dbus_message_get_args(msg, nullptr, DBUS_TYPE_UINT32, &result,
DBUS_TYPE_INVALID)) {
return;
}

View File

@ -56,7 +56,7 @@ NS_IMPL_ISUPPORTS3(nsAlertsIconListener, imgINotificationObserver,
nsAlertsIconListener::nsAlertsIconListener()
: mLoadedFrame(false),
mNotification(NULL)
mNotification(nullptr)
{
if (!libNotifyHandle && !libNotifyNotAvail) {
libNotifyHandle = dlopen("libnotify.so.4", RTLD_LAZY);
@ -111,7 +111,7 @@ nsAlertsIconListener::OnStopRequest(imgIRequest* aRequest)
NS_ENSURE_SUCCESS(rv, rv);
if (imgStatus == imgIRequest::STATUS_ERROR && !mLoadedFrame) {
// We have an error getting the image. Display the notification with no icon.
ShowAlert(NULL);
ShowAlert(nullptr);
}
if (mIconRequest) {
@ -153,7 +153,8 @@ nsAlertsIconListener::OnStopFrame(imgIRequest* aRequest)
nsresult
nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf)
{
mNotification = notify_notification_new(mAlertTitle.get(), mAlertText.get(), NULL, NULL);
mNotification = notify_notification_new(mAlertTitle.get(), mAlertText.get(),
nullptr, nullptr);
if (!mNotification)
return NS_ERROR_OUT_OF_MEMORY;
@ -167,7 +168,7 @@ nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf)
// string is "default" then that makes the entire bubble clickable
// rather than creating a button.
notify_notification_add_action(mNotification, "default", "Activate",
notify_action_cb, this, NULL);
notify_action_cb, this, nullptr);
}
// Fedora 10 calls NotifyNotification "closed" signal handlers with a
@ -177,7 +178,7 @@ nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf)
GClosure* closure = g_closure_new_simple(sizeof(GClosure), this);
g_closure_set_marshal(closure, notify_closed_marshal);
mClosureHandler = g_signal_connect_closure(mNotification, "closed", closure, FALSE);
gboolean result = notify_notification_show(mNotification, NULL);
gboolean result = notify_notification_show(mNotification, nullptr);
return result ? NS_OK : NS_ERROR_FAILURE;
}
@ -194,22 +195,22 @@ nsAlertsIconListener::StartRequest(const nsAString & aImageUrl)
nsCOMPtr<nsIURI> imageUri;
NS_NewURI(getter_AddRefs(imageUri), aImageUrl);
if (!imageUri)
return ShowAlert(NULL);
return ShowAlert(nullptr);
nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1"));
if (!il)
return ShowAlert(NULL);
return ShowAlert(nullptr);
return il->LoadImageXPCOM(imageUri, nullptr, nullptr, nullptr, nullptr, this,
nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr,
getter_AddRefs(mIconRequest));
return il->LoadImageXPCOM(imageUri, nullptr, nullptr, nullptr, nullptr,
this, nullptr, nsIRequest::LOAD_NORMAL, nullptr,
nullptr, getter_AddRefs(mIconRequest));
}
void
nsAlertsIconListener::SendCallback()
{
if (mAlertListener)
mAlertListener->Observe(NULL, "alertclickcallback", mAlertCookie.get());
mAlertListener->Observe(nullptr, "alertclickcallback", mAlertCookie.get());
}
void
@ -217,10 +218,10 @@ nsAlertsIconListener::SendClosed()
{
if (mNotification) {
g_object_unref(mNotification);
mNotification = NULL;
mNotification = nullptr;
}
if (mAlertListener)
mAlertListener->Observe(NULL, "alertfinished", mAlertCookie.get());
mAlertListener->Observe(nullptr, "alertfinished", mAlertCookie.get());
}
NS_IMETHODIMP
@ -231,7 +232,7 @@ nsAlertsIconListener::Observe(nsISupports *aSubject, const char *aTopic,
if (!nsCRT::strcmp(aTopic, "quit-application") && mNotification) {
g_signal_handler_disconnect(mNotification, mClosureHandler);
g_object_unref(mNotification);
mNotification = NULL;
mNotification = nullptr;
Release(); // equivalent to NS_RELEASE(this)
}
return NS_OK;
@ -278,13 +279,13 @@ nsAlertsIconListener::InitAlertAsync(const nsAString & aImageUrl,
GList *server_caps = notify_get_server_caps();
if (server_caps) {
gHasCaps = true;
for (GList* cap = server_caps; cap != NULL; cap = cap->next) {
for (GList* cap = server_caps; cap != nullptr; cap = cap->next) {
if (!strcmp((char*) cap->data, "actions")) {
gHasActions = true;
break;
}
}
g_list_foreach(server_caps, (GFunc)g_free, NULL);
g_list_foreach(server_caps, (GFunc)g_free, nullptr);
g_list_free(server_caps);
}
}

View File

@ -19,7 +19,7 @@ get_content_type_from_mime_type(const char *mimeType)
{
GList* contentTypes = g_content_types_get_registered();
GList* ct_ptr = contentTypes;
char* foundContentType = NULL;
char* foundContentType = nullptr;
while (ct_ptr) {
char *mimeTypeFromContentType = g_content_type_get_mime_type((char*)ct_ptr->data);
@ -31,7 +31,7 @@ get_content_type_from_mime_type(const char *mimeType)
g_free(mimeTypeFromContentType);
ct_ptr = ct_ptr->next;
}
g_list_foreach(contentTypes, (GFunc) g_free, NULL);
g_list_foreach(contentTypes, (GFunc) g_free, nullptr);
g_list_free(contentTypes);
return foundContentType;
}
@ -89,8 +89,8 @@ nsGIOMimeApp::Launch(const nsACString& aUri)
PromiseFlatCString flatUri(aUri);
uris.data = const_cast<char*>(flatUri.get());
GError *error = NULL;
gboolean result = g_app_info_launch_uris(mApp, &uris, NULL, &error);
GError *error = nullptr;
gboolean result = g_app_info_launch_uris(mApp, &uris, nullptr, &error);
if (!result) {
g_warning("Cannot launch application: %s", error->message);
@ -151,7 +151,7 @@ nsGIOMimeApp::GetSupportedURISchemes(nsIUTF8StringEnumerator** aSchemes)
const gchar* const * uri_schemes = g_vfs_get_supported_uri_schemes(gvfs);
while (*uri_schemes != NULL) {
while (*uri_schemes != nullptr) {
if (!array->mStrings.AppendElement(*uri_schemes)) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -169,7 +169,7 @@ nsGIOMimeApp::SetAsDefaultForMimeType(nsACString const& aMimeType)
get_content_type_from_mime_type(PromiseFlatCString(aMimeType).get());
if (!content_type)
return NS_ERROR_FAILURE;
GError *error = NULL;
GError *error = nullptr;
g_app_info_set_as_default_for_type(mApp,
content_type,
&error);
@ -194,7 +194,7 @@ nsGIOMimeApp::SetAsDefaultForMimeType(nsACString const& aMimeType)
NS_IMETHODIMP
nsGIOMimeApp::SetAsDefaultForFileExtensions(nsACString const& fileExts)
{
GError *error = NULL;
GError *error = nullptr;
char *extensions = g_strdup(PromiseFlatCString(fileExts).get());
char *ext_pos = extensions;
char *space_pos;
@ -231,7 +231,7 @@ nsGIOMimeApp::SetAsDefaultForFileExtensions(nsACString const& fileExts)
NS_IMETHODIMP
nsGIOMimeApp::SetAsDefaultForURIScheme(nsACString const& aURIScheme)
{
GError *error = NULL;
GError *error = nullptr;
nsAutoCString contentType("x-scheme-handler/");
contentType.Append(aURIScheme);
@ -260,7 +260,7 @@ nsGIOService::GetMimeTypeFromExtension(const nsACString& aExtension,
gboolean result_uncertain;
char *content_type = g_content_type_guess(fileExtToUse.get(),
NULL,
nullptr,
0,
&result_uncertain);
if (!content_type)
@ -347,9 +347,9 @@ nsGIOService::ShowURI(nsIURI* aURI)
{
nsAutoCString spec;
aURI->GetSpec(spec);
GError *error = NULL;
if (!g_app_info_launch_default_for_uri(spec.get(), NULL, &error)) {
g_warning("Could not launch default application for URI: %s" ,error->message);
GError *error = nullptr;
if (!g_app_info_launch_default_for_uri(spec.get(), nullptr, &error)) {
g_warning("Could not launch default application for URI: %s", error->message);
g_error_free(error);
return NS_ERROR_FAILURE;
}
@ -362,9 +362,9 @@ nsGIOService::ShowURIForInput(const nsACString& aUri)
GFile *file = g_file_new_for_commandline_arg(PromiseFlatCString(aUri).get());
char* spec = g_file_get_uri(file);
nsresult rv = NS_ERROR_FAILURE;
GError *error = NULL;
GError *error = nullptr;
g_app_info_launch_default_for_uri(spec, NULL, &error);
g_app_info_launch_default_for_uri(spec, nullptr, &error);
if (error) {
g_warning("Cannot launch default application: %s", error->message);
g_error_free(error);
@ -390,10 +390,10 @@ nsGIOService::CreateAppFromCommand(nsACString const& cmd,
nsACString const& appName,
nsIGIOMimeApp** appInfo)
{
GError *error = NULL;
GError *error = nullptr;
*appInfo = nullptr;
GAppInfo *app_info = NULL, *app_info_from_list = NULL;
GAppInfo *app_info = nullptr, *app_info_from_list = nullptr;
GList *apps = g_app_info_get_all();
GList *apps_p = apps;

View File

@ -84,7 +84,7 @@ public:
NS_DECL_NSIGSETTINGSCOLLECTION
nsGSettingsCollection(GSettings* aSettings) : mSettings(aSettings),
mKeys(NULL) {}
mKeys(nullptr) {}
~nsGSettingsCollection();
private:
@ -108,7 +108,7 @@ nsGSettingsCollection::KeyExists(const nsACString& aKey)
if (!mKeys)
mKeys = g_settings_list_keys(mSettings);
for (uint32_t i = 0; mKeys[i] != NULL; i++) {
for (uint32_t i = 0; mKeys[i] != nullptr; i++) {
if (aKey.Equals(mKeys[i]))
return true;
}
@ -190,7 +190,7 @@ nsGSettingsCollection::GetString(const nsACString& aKey,
return NS_ERROR_FAILURE;
}
aResult.Assign(g_variant_get_string(value, NULL));
aResult.Assign(g_variant_get_string(value, nullptr));
g_variant_unref(value);
return NS_OK;
@ -269,7 +269,7 @@ nsGSettingsCollection::GetStringList(const nsACString& aKey, nsIArray** aResult)
return NS_ERROR_FAILURE;
}
const gchar ** gs_strings = g_variant_get_strv(value, NULL);
const gchar ** gs_strings = g_variant_get_strv(value, nullptr);
if (!gs_strings) {
// empty array
NS_ADDREF(*aResult = items);
@ -278,7 +278,7 @@ nsGSettingsCollection::GetStringList(const nsACString& aKey, nsIArray** aResult)
}
const gchar** p_gs_strings = gs_strings;
while (*p_gs_strings != NULL)
while (*p_gs_strings != nullptr)
{
nsCOMPtr<nsISupportsCString> obj(do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
if (obj) {
@ -337,7 +337,7 @@ nsGSettingsService::GetCollectionForSchema(const nsACString& schema,
const char * const *schemas = g_settings_list_schemas();
for (uint32_t i = 0; schemas[i] != NULL; i++) {
for (uint32_t i = 0; schemas[i] != nullptr; i++) {
if (schema.Equals(schemas[i])) {
GSettings *settings = g_settings_new(PromiseFlatCString(schema).get());
nsGSettingsCollection *mozGSettings = new nsGSettingsCollection(settings);

View File

@ -36,16 +36,16 @@ NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
#ifdef MOZ_ENABLE_GCONF
{ &kNS_GCONFSERVICE_CID, false, NULL, nsGConfServiceConstructor },
{ &kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor },
#endif
#ifdef MOZ_ENABLE_GNOMEVFS
{ &kNS_GNOMEVFSSERVICE_CID, false, NULL, nsGnomeVFSServiceConstructor },
{ &kNS_GNOMEVFSSERVICE_CID, false, nullptr, nsGnomeVFSServiceConstructor },
#endif
#ifdef MOZ_ENABLE_GIO
{ &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor },
{ &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor },
{ &kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor },
{ &kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor },
#endif
{ NULL }
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
@ -59,7 +59,7 @@ static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
{ NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
{ NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
#endif
{ NULL }
{ nullptr }
};
static nsresult
@ -73,8 +73,8 @@ static const mozilla::Module kGnomeModule = {
mozilla::Module::kVersion,
kGnomeCIDs,
kGnomeContracts,
NULL,
NULL,
nullptr,
nullptr,
InitGType
};

View File

@ -204,7 +204,7 @@ nsGnomeVFSService::ShowURI(nsIURI *aURI)
nsAutoCString spec;
aURI->GetSpec(spec);
if (gnome_vfs_url_show_with_env(spec.get(), NULL) == GNOME_VFS_OK)
if (gnome_vfs_url_show_with_env(spec.get(), nullptr) == GNOME_VFS_OK)
return NS_OK;
return NS_ERROR_FAILURE;
@ -216,7 +216,7 @@ nsGnomeVFSService::ShowURIForInput(const nsACString &aUri)
char* spec = gnome_vfs_make_uri_from_input(PromiseFlatCString(aUri).get());
nsresult rv = NS_ERROR_FAILURE;
if (gnome_vfs_url_show_with_env(spec, NULL) == GNOME_VFS_OK)
if (gnome_vfs_url_show_with_env(spec, nullptr) == GNOME_VFS_OK)
rv = NS_OK;
g_free(spec);

View File

@ -85,7 +85,7 @@ nsUnixSystemProxySettings::GetProxyForURI(const nsACString & aSpec,
// but nsISystemProxySettings allows "PROXY http://proxy.foo.com:8080" as well.
int c = 0;
while (proxyArray[c] != NULL) {
while (proxyArray[c] != nullptr) {
if (!aResult.IsEmpty()) {
aResult.AppendLiteral("; ");
}
@ -122,13 +122,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
{ &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, NULL, nsUnixSystemProxySettingsConstructor },
{ NULL }
{ &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr, nsUnixSystemProxySettingsConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
{ NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kUnixProxyModule = {

View File

@ -518,13 +518,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
{ &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, NULL, nsUnixSystemProxySettingsConstructor },
{ NULL }
{ &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr, nsUnixSystemProxySettingsConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
{ NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kUnixProxyModule = {

View File

@ -82,13 +82,13 @@ static nsresult ReadInternetOption(uint32_t aOption, uint32_t& aFlags,
INTERNET_PER_CONN_OPTION_LISTW list;
list.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
list.pszConnection = connFlags & INTERNET_CONNECTION_MODEM ?
connName : NULL;
connName : nullptr;
list.dwOptionCount = mozilla::ArrayLength(options);
list.dwOptionError = 0;
list.pOptions = options;
unsigned long size = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
if (!InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
if (!InternetQueryOptionW(nullptr, INTERNET_OPTION_PER_CONNECTION_OPTION,
&list, &size)) {
if (GetLastError() != ERROR_INVALID_PARAMETER) {
return NS_ERROR_FAILURE;
@ -96,7 +96,8 @@ static nsresult ReadInternetOption(uint32_t aOption, uint32_t& aFlags,
options[0].dwOption = INTERNET_PER_CONN_FLAGS;
size = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
MOZ_SEH_TRY {
if (!InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
if (!InternetQueryOptionW(nullptr,
INTERNET_OPTION_PER_CONNECTION_OPTION,
&list, &size)) {
return NS_ERROR_FAILURE;
}
@ -303,13 +304,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsSystemProxySettings, Init)
NS_DEFINE_NAMED_CID(NS_WINDOWSSYSTEMPROXYSERVICE_CID);
static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
{ &kNS_WINDOWSSYSTEMPROXYSERVICE_CID, false, NULL, nsWindowsSystemProxySettingsConstructor },
{ NULL }
{ &kNS_WINDOWSSYSTEMPROXYSERVICE_CID, false, nullptr, nsWindowsSystemProxySettingsConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
{ NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_WINDOWSSYSTEMPROXYSERVICE_CID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kSysProxyModule = {

View File

@ -69,7 +69,7 @@ using mozilla::FireAndWaitForTracerEvent;
namespace {
PRThread* sTracerThread = NULL;
PRThread* sTracerThread = nullptr;
bool sExit = false;
struct TracerStartClosure {
@ -100,12 +100,12 @@ void TracerThread(void *arg)
PRIntervalTime interval = PR_MillisecondsToInterval(10);
sExit = false;
FILE* log = NULL;
FILE* log = nullptr;
char* envfile = PR_GetEnv("MOZ_INSTRUMENT_EVENT_LOOP_OUTPUT");
if (envfile) {
log = fopen(envfile, "w");
}
if (log == NULL)
if (log == nullptr)
log = stdout;
char* thresholdenv = PR_GetEnv("MOZ_INSTRUMENT_EVENT_LOOP_THRESHOLD");
@ -197,7 +197,7 @@ bool InitEventTracing(bool aLog)
PR_GLOBAL_THREAD,
PR_JOINABLE_THREAD,
0);
return sTracerThread != NULL;
return sTracerThread != nullptr;
}
void ShutdownEventTracing()
@ -211,7 +211,7 @@ void ShutdownEventTracing()
if (sTracerThread)
PR_JoinThread(sTracerThread);
sTracerThread = NULL;
sTracerThread = nullptr;
// Allow the widget backend to clean up.
CleanUpWidgetTracing();

View File

@ -39,10 +39,10 @@ ParseVP(char *part, VersionPart &result)
char *dot;
result.numA = 0;
result.strB = NULL;
result.strB = nullptr;
result.strBlen = 0;
result.numC = 0;
result.extraD = NULL;
result.extraD = nullptr;
if (!part)
return part;
@ -60,7 +60,7 @@ ParseVP(char *part, VersionPart &result)
}
if (!*result.strB) {
result.strB = NULL;
result.strB = nullptr;
result.strBlen = 0;
}
else {
@ -81,7 +81,7 @@ ParseVP(char *part, VersionPart &result)
result.numC = strtol(numstart, &result.extraD, 10);
if (!*result.extraD)
result.extraD = NULL;
result.extraD = nullptr;
}
}
}
@ -90,7 +90,7 @@ ParseVP(char *part, VersionPart &result)
++dot;
if (!*dot)
dot = NULL;
dot = nullptr;
}
return dot;
@ -215,7 +215,7 @@ TriggerQuirks()
char release[sizeof("10.7.99")];
size_t len = sizeof(release);
// sysctl will return ENOMEM if the release string is longer than sizeof(release)
int ret = sysctl(mib, 2, release, &len, NULL, 0);
int ret = sysctl(mib, 2, release, &len, nullptr, 0);
// we only want to trigger this on OS X 10.6, on versions 10.6.8 or newer
// Darwin version 10 corresponds to OS X version 10.6, version 11 is 10.7
// http://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history

View File

@ -140,7 +140,7 @@ ProfileResetCleanup(nsIToolkitProfile* aOldProfile)
kResetProgressURL,
"_blank",
"centerscreen,chrome,titlebar",
NULL,
nullptr,
getter_AddRefs(progressWindow));
if (NS_FAILED(rv)) return rv;

View File

@ -139,12 +139,12 @@ static void glxtest()
fatal_error("glXGetProcAddress couldn't find required functions");
}
///// Open a connection to the X server /////
Display *dpy = XOpenDisplay(NULL);
Display *dpy = XOpenDisplay(nullptr);
if (!dpy)
fatal_error("Unable to open a connection to the X server");
///// Check that the GLX extension is present /////
if (!glXQueryExtension(dpy, NULL, NULL))
if (!glXQueryExtension(dpy, nullptr, nullptr))
fatal_error("GLX extension missing");
XSetErrorHandler(x_error_handler);
@ -174,7 +174,7 @@ static void glxtest()
CWBorderPixel | CWColormap, &swa);
///// Get a GL context and make it current //////
GLXContext context = glXCreateContext(dpy, vInfo, NULL, True);
GLXContext context = glXCreateContext(dpy, vInfo, nullptr, True);
glXMakeCurrent(dpy, window, context);
///// Look for this symbol to determine texture_from_pixmap support /////
@ -202,7 +202,7 @@ static void glxtest()
///// Clean up. Indeed, the parent process might fail to kill us (e.g. if it doesn't need to check GL info)
///// so we might be staying alive for longer than expected, so it's important to consume as little memory as
///// possible. Also we want to check that we're able to do that too without generating X errors.
glXMakeCurrent(dpy, None, NULL); // must release the GL context before destroying it
glXMakeCurrent(dpy, None, nullptr); // must release the GL context before destroying it
glXDestroyContext(dpy, context);
XDestroyWindow(dpy, window);
XFreeColormap(dpy, swa.colormap);

View File

@ -66,7 +66,7 @@ GeckoStart(void *data, const nsXREAppData *appData)
char *arg = strtok(static_cast<char *>(data), " ");
while (arg) {
targs.AppendElement(arg);
arg = strtok(NULL, " ");
arg = strtok(nullptr, " ");
}
targs.AppendElement(static_cast<char *>(nullptr));

View File

@ -391,7 +391,7 @@ static void Output(bool isError, const char *fmt, ... )
wide_msg,
sizeof(wide_msg) / sizeof(wchar_t));
MessageBoxW(NULL, wide_msg, L"XULRunner", flags);
MessageBoxW(nullptr, wide_msg, L"XULRunner", flags);
PR_smprintf_free(msg);
}
#else
@ -1155,10 +1155,10 @@ ProfileServiceFactoryConstructor(const mozilla::Module& module, const mozilla::M
NS_DEFINE_NAMED_CID(APPINFO_CID);
static const mozilla::Module::CIDEntry kXRECIDs[] = {
{ &kAPPINFO_CID, false, NULL, AppInfoConstructor },
{ &kProfileServiceCID, false, ProfileServiceFactoryConstructor, NULL },
{ &kNativeAppSupportCID, false, NULL, ScopedXPCOMStartup::CreateAppSupport },
{ NULL }
{ &kAPPINFO_CID, false, nullptr, AppInfoConstructor },
{ &kProfileServiceCID, false, ProfileServiceFactoryConstructor, nullptr },
{ &kNativeAppSupportCID, false, nullptr, ScopedXPCOMStartup::CreateAppSupport },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kXREContracts[] = {
@ -1169,7 +1169,7 @@ static const mozilla::Module::ContractIDEntry kXREContracts[] = {
#endif
{ NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID },
{ NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID },
{ NULL }
{ nullptr }
};
static const mozilla::Module kXREModule = {
@ -1541,7 +1541,7 @@ char *createEnv()
// copy the existing environment
char *env = (char *)calloc(0x6000, sizeof(char));
if (!env) {
return NULL;
return nullptr;
}
// walk along the environ string array of the C library and copy
@ -2621,7 +2621,7 @@ static void MOZ_gdk_display_close(GdkDisplay *display)
GtkSettings* settings =
gtk_settings_get_for_screen(gdk_display_get_default_screen(display));
gchar *theme_name;
g_object_get(settings, "gtk-theme-name", &theme_name, NULL);
g_object_get(settings, "gtk-theme-name", &theme_name, nullptr);
if (theme_name) {
theme_is_qt = strcmp(theme_name, "Qt") == 0;
if (theme_is_qt)
@ -2661,7 +2661,7 @@ static void MOZ_gdk_display_close(GdkDisplay *display)
// Now that we have finished with GTK and Pango, we could unref fontmap,
// which would allow us to call FcFini, but removing what is really
// Pango's ref feels a bit evil. Pango-1.22 will have support for
// pango_cairo_font_map_set_default(NULL), which would release the
// pango_cairo_font_map_set_default(nullptr), which would release the
// reference on the old fontmap.
// cairo_debug_reset_static_data() is prototyped through cairo.h included
@ -2869,7 +2869,8 @@ XREMain::XRE_mainInit(bool* aExitFlag)
OSVERSIONINFO vinfo;
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
if (GetVersionEx(&vinfo) && vinfo.dwMajorVersion >= 6) {
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&InitDwriteBG, NULL, 0, NULL);
CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)&InitDwriteBG,
nullptr, 0, nullptr);
}
}
#endif
@ -3924,7 +3925,7 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
// This must be done before g_thread_init() is called.
g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
#endif
g_thread_init(NULL);
g_thread_init(nullptr);
#endif
// init

View File

@ -98,7 +98,7 @@ WriteConsoleLog();
#ifdef XP_WIN
BOOL
WinLaunchChild(const PRUnichar *exePath, int argc,
char **argv, HANDLE userToken = NULL,
char **argv, HANDLE userToken = nullptr,
HANDLE *hProcess = nullptr);
BOOL
WriteStatusPending(LPCWSTR updateDirPath);

View File

@ -13,7 +13,7 @@ namespace CommandLineServiceMac {
static const int kArgsGrowSize = 20;
static char** sArgs = NULL;
static char** sArgs = nullptr;
static int sArgsAllocated = 0;
static int sArgsUsed = 0;
@ -35,7 +35,7 @@ void AddToCommandLine(const char* inArgText)
return;
sArgs[sArgsUsed++] = temp2;
sArgs[sArgsUsed] = NULL;
sArgs[sArgsUsed] = nullptr;
return;
}
@ -46,7 +46,7 @@ void SetupMacCommandLine(int& argc, char**& argv, bool forRestart)
if (!sArgs)
return;
sArgsAllocated = kArgsGrowSize;
sArgs[0] = NULL;
sArgs[0] = nullptr;
sArgsUsed = 0;
sBuildingCommandLine = true;

View File

@ -394,7 +394,7 @@ XRE_InitChildProcess(int aArgc,
// on POSIX, |crashReporterArg| is "true" if crash reporting is
// enabled, false otherwise
if (0 != strcmp("false", crashReporterArg) &&
!XRE_SetRemoteExceptionHandler(NULL)) {
!XRE_SetRemoteExceptionHandler(nullptr)) {
// Bug 684322 will add better visibility into this condition
NS_WARNING("Could not setup crash reporting\n");
}
@ -407,7 +407,7 @@ XRE_InitChildProcess(int aArgc,
gArgc = aArgc;
#if defined(MOZ_WIDGET_GTK)
g_thread_init(NULL);
g_thread_init(nullptr);
#endif
#if defined(MOZ_WIDGET_QT)

View File

@ -377,7 +377,7 @@ int DdeCmpStringHandles( HSZ hsz1, HSZ hsz2 )
/* I am assuming that the strings will never be more that CCHMAXPATH in
* length. Safe bet (for now). To find true length, call WinDdeQueryString
* and pass in (hsz, NULL, 0L, 0) and it will return iLength. Passing 0
* and pass in (hsz, nullptr, 0L, 0) and it will return iLength. Passing 0
* for codepage will use the codepage of the current thread.
*/
WinDdeQueryString( hsz1, chhsz1, sizeof( chhsz1 ), 0 );
@ -397,16 +397,16 @@ char *GetCommandLine()
* .exe and the second string is what followed on the command line. Dorky,
* but I guess it'll have to do.
*/
PTIB pTIB = NULL;
PPIB pPIB = NULL;
PTIB pTIB = nullptr;
PPIB pPIB = nullptr;
APIRET rc = NO_ERROR;
char *pchParam = NULL;
char *pchParam = nullptr;
rc = DosGetInfoBlocks( &pTIB, &pPIB );
if( rc == NO_ERROR )
{
INT iLen = 0;
char *pchTemp = NULL;
char *pchTemp = nullptr;
pchParam = pPIB->pib_pchcmd;
strcpy( szCommandLine, pchParam );
iLen = strlen( pchParam );
@ -469,7 +469,7 @@ DDEMLFN ddemlfnTable[] =
{ (PFN *)&WinDdeReconnect ,123 },
{ (PFN *)&WinDdeSetUserHandle ,124 },
{ (PFN *)&WinDdeUninitialize ,126 },
{ (PFN *)NULL , 0 }
{ (PFN *)nullptr , 0 }
};
/* SetupOS2ddeml makes sure that we can get pointers to all of the DDEML
@ -482,7 +482,7 @@ BOOL SetupOS2ddeml()
HMODULE hmodDDEML = NULLHANDLE;
APIRET rc = NO_ERROR;
rc = DosLoadModule( NULL, 0, "PMDDEML", &hmodDDEML );
rc = DosLoadModule( nullptr, 0, "PMDDEML", &hmodDDEML );
if( rc == NO_ERROR )
{
int i;
@ -490,7 +490,7 @@ BOOL SetupOS2ddeml()
bRC = TRUE;
for( i=0; ddemlfnTable[i].ord != 0; i++ )
{
rc = DosQueryProcAddr( hmodDDEML, ddemlfnTable[i].ord, NULL,
rc = DosQueryProcAddr( hmodDDEML, ddemlfnTable[i].ord, nullptr,
ddemlfnTable[i].fn );
if( rc != NO_ERROR )
{
@ -580,15 +580,15 @@ struct MessageWindow {
const char * pszClassName = className();
mHandle = WinCreateWindow( HWND_OBJECT,
pszClassName,
NULL, // name
WS_DISABLED, // style
0,0, // x, y
0,0, // cx,cy
HWND_DESKTOP,// owner
nullptr, // name
WS_DISABLED, // style
0,0, // x, y
0,0, // cx,cy
HWND_DESKTOP, // owner
HWND_BOTTOM, // hwndbehind
(USHORT)mMsgWindowAtom, // id
NULL, // pCtlData
NULL ); // pres params
nullptr, // pCtlData
nullptr ); // pres params
#if MOZ_DEBUG_DDE
printf( "Message window = 0x%08X\n", (int)mHandle );
@ -609,7 +609,7 @@ struct MessageWindow {
// the same thread.
BOOL desRes = WinDestroyWindow( mHandle );
if ( FALSE != desRes ) {
mHandle = NULL;
mHandle = nullptr;
}
else {
retval = NS_ERROR_FAILURE;
@ -632,27 +632,27 @@ struct MessageWindow {
*/
COPYDATASTRUCT *pcds;
PVOID pvData = NULL;
PVOID pvData = nullptr;
if (!cmd)
return NS_ERROR_FAILURE;
ULONG ulSize = sizeof(COPYDATASTRUCT)+strlen(cmd)+1+CCHMAXPATH;
#ifdef MOZ_OS2_HIGH_MEMORY
APIRET rc = DosAllocSharedMem( &pvData, NULL, ulSize,
APIRET rc = DosAllocSharedMem( &pvData, nullptr, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY);
if (rc != NO_ERROR) { // Did the kernel handle OBJ_ANY?
// Try again without OBJ_ANY and if the first failure was not caused
// by OBJ_ANY then we will get the same failure, else we have taken
// care of pre-FP13 systems where the kernel couldn't handle it.
rc = DosAllocSharedMem( &pvData, NULL, ulSize,
rc = DosAllocSharedMem( &pvData, nullptr, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE);
if (rc != NO_ERROR) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
#else
if (DosAllocSharedMem( &pvData, NULL, ulSize,
if (DosAllocSharedMem( &pvData, nullptr, ulSize,
PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY))
return NS_ERROR_OUT_OF_MEMORY;
#endif
@ -1017,7 +1017,7 @@ static nsCString uTypeDesc( UINT uType ) {
static nsCString hszValue( DWORD instance, HSZ hsz ) {
// Extract string from HSZ.
nsCString result("[");
DWORD len = WinDdeQueryString( hsz, NULL, NULL, CP_WINANSI );
DWORD len = WinDdeQueryString( hsz, nullptr, nullptr, CP_WINANSI );
if ( len ) {
char buffer[ 256 ];
WinDdeQueryString( hsz, buffer, sizeof buffer, CP_WINANSI );
@ -1357,7 +1357,7 @@ void nsNativeAppSupportOS2::ParseDDEArg( const char* args, int index, nsCString&
// Utility to parse out argument from a DDE item string.
void nsNativeAppSupportOS2::ParseDDEArg( HSZ args, int index, nsCString& aString) {
DWORD argLen = WinDdeQueryString( args, NULL, NULL, CP_WINANSI );
DWORD argLen = WinDdeQueryString( args, nullptr, nullptr, CP_WINANSI );
// there wasn't any string, so return empty string
if ( !argLen ) return;
nsAutoCString temp;

View File

@ -148,7 +148,7 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
#if (MOZ_WIDGET_GTK == 2)
if (gtk_major_version < MIN_GTK_MAJOR_VERSION ||
(gtk_major_version == MIN_GTK_MAJOR_VERSION && gtk_minor_version < MIN_GTK_MINOR_VERSION)) {
GtkWidget* versionErrDialog = gtk_message_dialog_new(NULL,
GtkWidget* versionErrDialog = gtk_message_dialog_new(nullptr,
GtkDialogFlags(GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_MESSAGE_ERROR,
@ -202,7 +202,8 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
if (!gnome_program_get()) {
gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(), gArgc, gArgv, NULL);
gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(),
gArgc, gArgv, nullptr);
}
#endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */
@ -227,8 +228,8 @@ nsNativeAppSupportUnix::Start(bool *aRetVal)
PR_FindFunctionSymbol(gnomeuiLib, "gnome_master_client");
GnomeClient *client = gnome_master_client();
g_signal_connect(client, "save-yourself", G_CALLBACK(save_yourself_cb), NULL);
g_signal_connect(client, "die", G_CALLBACK(die_cb), NULL);
g_signal_connect(client, "save-yourself", G_CALLBACK(save_yourself_cb), nullptr);
g_signal_connect(client, "die", G_CALLBACK(die_cb), nullptr);
// Set the correct/requested restart command in any case.

View File

@ -533,7 +533,7 @@ struct MessageWindow {
// the same thread.
BOOL desRes = DestroyWindow( mHandle );
if ( FALSE != desRes ) {
mHandle = NULL;
mHandle = nullptr;
}
else {
retval = NS_ERROR_FAILURE;
@ -858,7 +858,7 @@ static nsCString uTypeDesc( UINT uType ) {
static nsCString hszValue( DWORD instance, HSZ hsz ) {
// Extract string from HSZ.
nsCString result("[");
DWORD len = DdeQueryString( instance, hsz, NULL, NULL, CP_WINANSI );
DWORD len = DdeQueryString( instance, hsz, nullptr, nullptr, CP_WINANSI );
if ( len ) {
char buffer[ 256 ];
DdeQueryString( instance, hsz, buffer, sizeof buffer, CP_WINANSI );
@ -1211,7 +1211,7 @@ void nsNativeAppSupportWin::ParseDDEArg( const WCHAR* args, int index, nsString&
// Utility to parse out argument from a DDE item string.
void nsNativeAppSupportWin::ParseDDEArg( HSZ args, int index, nsString& aString) {
DWORD argLen = DdeQueryStringW( mInstance, args, NULL, 0, CP_WINUNICODE );
DWORD argLen = DdeQueryStringW( mInstance, args, nullptr, 0, CP_WINUNICODE );
// there wasn't any string, so return empty string
if ( !argLen ) return;
nsAutoString temp;

View File

@ -13,9 +13,9 @@
#include "prenv.h"
#include <stdlib.h>
QApplication *nsQAppInstance::sQAppInstance = NULL;
QApplication *nsQAppInstance::sQAppInstance = nullptr;
#ifdef MOZ_ENABLE_MEEGOTOUCH
MComponentData* nsQAppInstance::sMComponentData = NULL;
MComponentData* nsQAppInstance::sMComponentData = nullptr;
#endif
int nsQAppInstance::sQAppRefCount = 0;
@ -38,9 +38,9 @@ void nsQAppInstance::Release(void) {
if (sQAppInstance && !--sQAppRefCount) {
#ifdef MOZ_ENABLE_MEEGOTOUCH
delete sMComponentData;
sMComponentData = NULL;
sMComponentData = nullptr;
#endif
delete sQAppInstance;
sQAppInstance = NULL;
sQAppInstance = nullptr;
}
}

View File

@ -109,7 +109,7 @@ child_ah_crap_handler(int signum)
#if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
static GLogFunc orig_log_func = NULL;
static GLogFunc orig_log_func = nullptr;
extern "C" {
static void
@ -127,7 +127,7 @@ my_glib_log_func(const gchar *log_domain, GLogLevelFlags log_level,
NS_DebugBreak(NS_DEBUG_WARNING, message, "glib warning", __FILE__, __LINE__);
}
orig_log_func(log_domain, log_level, message, NULL);
orig_log_func(log_domain, log_level, message, nullptr);
}
#endif
@ -301,7 +301,7 @@ void InstallSignalHandlers(const char *ProgramName)
!strcmp(assertString, "trap") ||
!strcmp(assertString, "break"))) {
// Override the default glib logging function so we get stacks for it too.
orig_log_func = g_log_set_default_handler(my_glib_log_func, NULL);
orig_log_func = g_log_set_default_handler(my_glib_log_func, nullptr);
}
#endif
}

View File

@ -558,10 +558,10 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
argv[argc - 1] = "-ServerName:DefaultBrowserServer";
}
#endif
argv[argc] = NULL;
argv[argc] = nullptr;
} else {
argc = 4;
argv[4] = NULL;
argv[4] = nullptr;
}
if (gSafeMode) {
@ -592,7 +592,7 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
LaunchChildMac(argc, argv);
exit(0);
#else
PR_CreateProcessDetached(updaterPath.get(), argv, NULL, NULL);
PR_CreateProcessDetached(updaterPath.get(), argv, nullptr, nullptr);
exit(0);
#endif
}
@ -842,10 +842,10 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
argv[argc - 1] = "-ServerName:DefaultBrowserServer";
}
#endif
argv[argc] = NULL;
argv[argc] = nullptr;
} else {
argc = 4;
argv[4] = NULL;
argv[4] = nullptr;
}
if (gSafeMode) {
@ -880,11 +880,11 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
if (restart) {
execv(updaterPath.get(), argv);
} else {
*outpid = PR_CreateProcess(updaterPath.get(), argv, NULL, NULL);
*outpid = PR_CreateProcess(updaterPath.get(), argv, nullptr, nullptr);
}
#elif defined(XP_WIN)
// Launch the update using updater.exe
if (!WinLaunchChild(updaterPathW.get(), argc, argv, NULL, outpid)) {
if (!WinLaunchChild(updaterPathW.get(), argc, argv, nullptr, outpid)) {
return;
}
@ -902,7 +902,7 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
exit(0);
}
#else
*outpid = PR_CreateProcess(updaterPath.get(), argv, NULL, NULL);
*outpid = PR_CreateProcess(updaterPath.get(), argv, nullptr, nullptr);
if (restart) {
exit(0);
}

View File

@ -135,7 +135,7 @@ static DllBlockInfo sWindowsDllBlocklist[] = {
// shutdown, bug 831285 and 918399.
{ "beid35cardlayer.dll", MAKE_VERSION(3, 5, 6, 6968) },
{ NULL, 0 }
{ nullptr, 0 }
};
#ifndef STATUS_DLL_NOT_FOUND
@ -188,10 +188,11 @@ CheckASLR(const wchar_t* path)
bool retval = false;
HANDLE file = ::CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
nullptr);
if (file != INVALID_HANDLE_VALUE) {
HANDLE map = ::CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
HANDLE map = ::CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, 0,
nullptr);
if (map) {
RVAMap<IMAGE_DOS_HEADER> peHeader(map, 0);
if (peHeader) {
@ -278,11 +279,12 @@ wchar_t* getFullPath (PWCHAR filePath, wchar_t* fname)
// In Windows 8, the first parameter seems to be used for more than just the
// path name. For example, its numerical value can be 1. Passing a non-valid
// pointer to SearchPathW will cause a crash, so we need to check to see if we
// are handed a valid pointer, and otherwise just pass NULL to SearchPathW.
PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? NULL : filePath;
// are handed a valid pointer, and otherwise just pass nullptr to SearchPathW.
PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? nullptr : filePath;
// figure out the length of the string that we need
DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, NULL, NULL);
DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, nullptr,
nullptr);
if (pathlen == 0) {
return nullptr;
}
@ -294,7 +296,8 @@ wchar_t* getFullPath (PWCHAR filePath, wchar_t* fname)
}
// now actually grab it
SearchPathW(sanitizedFilePath, fname, L".dll", pathlen+1, full_fname, NULL);
SearchPathW(sanitizedFilePath, fname, L".dll", pathlen + 1, full_fname,
nullptr);
return full_fname;
}

View File

@ -104,14 +104,14 @@ public:
// I don't think this is actually necessary, but it can't hurt.
FlushInstructionCache(GetCurrentProcess(),
/* ignored */ NULL,
/* ignored */ nullptr,
/* ignored */ 0);
}
}
void Init(const char *modulename)
{
mModule = LoadLibraryExA(modulename, NULL, 0);
mModule = LoadLibraryExA(modulename, nullptr, 0);
if (!mModule) {
//printf("LoadLibraryEx for '%s' failed\n", modulename);
return;
@ -194,7 +194,7 @@ public:
// I think this routine is safe without this, but it can't hurt.
FlushInstructionCache(GetCurrentProcess(),
/* ignored */ NULL,
/* ignored */ nullptr,
/* ignored */ 0);
return true;
@ -256,7 +256,7 @@ public:
if (mModule)
return;
mModule = LoadLibraryExA(modulename, NULL, 0);
mModule = LoadLibraryExA(modulename, nullptr, 0);
if (!mModule) {
//printf("LoadLibraryEx for '%s' failed\n", modulename);
return;
@ -268,7 +268,8 @@ public:
mMaxHooks = nhooks + (hooksPerPage % nhooks);
mHookPage = (byteptr_t) VirtualAllocEx(GetCurrentProcess(), NULL, mMaxHooks * kHookSize,
mHookPage = (byteptr_t) VirtualAllocEx(GetCurrentProcess(), nullptr,
mMaxHooks * kHookSize,
MEM_COMMIT | MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
@ -327,7 +328,7 @@ protected:
intptr_t dest,
void **outTramp)
{
*outTramp = NULL;
*outTramp = nullptr;
byteptr_t tramp = FindTrampolineSpace();
if (!tramp)
@ -642,7 +643,7 @@ class WindowsDllInterceptor
public:
WindowsDllInterceptor()
: mModuleName(NULL)
: mModuleName(nullptr)
, mNHooks(0)
{}

View File

@ -28,9 +28,9 @@ static int ArgStrLen(const PRUnichar *s)
{
int backslashes = 0;
int i = wcslen(s);
BOOL hasDoubleQuote = wcschr(s, L'"') != NULL;
BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
// Only add doublequotes if the string contains a space or a tab
BOOL addDoubleQuotes = wcspbrk(s, L" \t") != NULL;
BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
if (addDoubleQuotes) {
i += 2; // initial and final duoblequote
@ -68,9 +68,9 @@ static int ArgStrLen(const PRUnichar *s)
static PRUnichar* ArgToString(PRUnichar *d, const PRUnichar *s)
{
int backslashes = 0;
BOOL hasDoubleQuote = wcschr(s, L'"') != NULL;
BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
// Only add doublequotes if the string contains a space or a tab
BOOL addDoubleQuotes = wcspbrk(s, L" \t") != NULL;
BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
if (addDoubleQuotes) {
*d = '"'; // initial doublequote
@ -132,7 +132,7 @@ MakeCommandLine(int argc, PRUnichar **argv)
PRUnichar *s = (PRUnichar*) malloc(len * sizeof(PRUnichar));
if (!s)
return NULL;
return nullptr;
PRUnichar *c = s;
for (i = 0; i < argc; ++i) {
@ -159,7 +159,7 @@ AllocConvertUTF8toUTF16(const char *arg)
int len = strlen(arg);
PRUnichar *s = new PRUnichar[(len + 1) * sizeof(PRUnichar)];
if (!s)
return NULL;
return nullptr;
ConvertUTF8toUTF16 convert(s);
convert.write(arg, len);
@ -189,8 +189,8 @@ FreeAllocStrings(int argc, PRUnichar **argv)
BOOL
WinLaunchChild(const PRUnichar *exePath,
int argc, PRUnichar **argv,
HANDLE userToken = NULL,
HANDLE *hProcess = NULL);
HANDLE userToken = nullptr,
HANDLE *hProcess = nullptr);
BOOL
WinLaunchChild(const PRUnichar *exePath,
@ -235,34 +235,34 @@ WinLaunchChild(const PRUnichar *exePath,
si.lpDesktop = L"winsta0\\Default";
PROCESS_INFORMATION pi = {0};
if (userToken == NULL) {
if (userToken == nullptr) {
ok = CreateProcessW(exePath,
cl,
NULL, // no special security attributes
NULL, // no special thread attributes
nullptr, // no special security attributes
nullptr, // no special thread attributes
FALSE, // don't inherit filehandles
0, // creation flags
NULL, // inherit my environment
NULL, // use my current directory
nullptr, // inherit my environment
nullptr, // use my current directory
&si,
&pi);
} else {
// Create an environment block for the process we're about to start using
// the user's token.
LPVOID environmentBlock = NULL;
LPVOID environmentBlock = nullptr;
if (!CreateEnvironmentBlock(&environmentBlock, userToken, TRUE)) {
environmentBlock = NULL;
environmentBlock = nullptr;
}
ok = CreateProcessAsUserW(userToken,
exePath,
cl,
NULL, // no special security attributes
NULL, // no special thread attributes
FALSE, // don't inherit filehandles
0, // creation flags
nullptr, // no special security attributes
nullptr, // no special thread attributes
FALSE, // don't inherit filehandles
0, // creation flags
environmentBlock,
NULL, // use my current directory
nullptr, // use my current directory
&si,
&pi);
@ -279,16 +279,16 @@ WinLaunchChild(const PRUnichar *exePath,
}
CloseHandle(pi.hThread);
} else {
LPVOID lpMsgBuf = NULL;
LPVOID lpMsgBuf = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
nullptr,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL);
nullptr);
wprintf(L"Error restarting: %s\n", lpMsgBuf ? lpMsgBuf : L"(null)");
if (lpMsgBuf)
LocalFree(lpMsgBuf);

View File

@ -55,7 +55,7 @@ AllocConvertUTF16toUTF8(const WCHAR *arg)
int len = wcslen(arg);
char *s = new char[len * 3 + 1];
if (!s)
return NULL;
return nullptr;
ConvertUTF16toUTF8 convert(s);
convert.write(arg, len);
@ -91,7 +91,7 @@ int wmain(int argc, WCHAR **argv)
return 127;
}
}
argvConverted[argc] = NULL;
argvConverted[argc] = nullptr;
// need to save argvConverted copy for later deletion.
char **deleteUs = new char*[argc+1];

View File

@ -36,7 +36,7 @@ X11Error(Display *display, XErrorEvent *event) {
// temporary Display to request extension information. This assumes on
// the DISPLAY environment variable has been set and matches what was used
// to open |display|.
Display *tmpDisplay = XOpenDisplay(NULL);
Display *tmpDisplay = XOpenDisplay(nullptr);
if (tmpDisplay) {
int nExts;
char** extNames = XListExtensions(tmpDisplay, &nExts);

View File

@ -882,9 +882,9 @@ GetShellFolderPath(int folder, nsAString& _retval)
nsresult rv = NS_OK;
LPITEMIDLIST pItemIDList = NULL;
LPITEMIDLIST pItemIDList = nullptr;
if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &pItemIDList)) &&
if (SUCCEEDED(SHGetSpecialFolderLocation(nullptr, folder, &pItemIDList)) &&
SHGetPathFromIDListW(pItemIDList, buf)) {
// We're going to use wcslen (wcsnlen not available in msvc7.1) so make
// sure to null terminate.
@ -919,8 +919,8 @@ GetRegWindowsAppDataFolder(bool aLocal, nsAString& _retval)
}
DWORD type, size;
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"), NULL,
&type, NULL, &size);
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
nullptr, &type, nullptr, &size);
// The call to RegQueryValueExW must succeed, the type must be REG_SZ, the
// buffer size must not equal 0, and the buffer size be a multiple of 2.
if (res != ERROR_SUCCESS || type != REG_SZ || size == 0 || size % 2 != 0) {
@ -941,8 +941,8 @@ GetRegWindowsAppDataFolder(bool aLocal, nsAString& _retval)
return NS_ERROR_NOT_AVAILABLE;
}
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"), NULL,
NULL, (LPBYTE) begin.get(), &size);
res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
nullptr, nullptr, (LPBYTE) begin.get(), &size);
::RegCloseKey(key);
if (res != ERROR_SUCCESS) {
_retval.SetLength(0);
@ -964,7 +964,7 @@ GetCachedHash(HKEY rootKey, const nsAString &regPath, const nsAString &path,
wchar_t cachedHashRaw[512];
DWORD bufferSize = sizeof(cachedHashRaw);
LONG result = RegQueryValueExW(baseKey, path.BeginReading(), 0, NULL,
LONG result = RegQueryValueExW(baseKey, path.BeginReading(), 0, nullptr,
(LPBYTE)cachedHashRaw, &bufferSize);
RegCloseKey(baseKey);
if (result == ERROR_SUCCESS) {