mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784739 - Switch from NULL to nullptr in modules/; r=ehsan
--HG-- extra : rebase_source : d82c3e2e18986d3b9ffc454ff84caf3634a6bbe7
This commit is contained in:
parent
de354c9745
commit
5ffc426eea
@ -213,7 +213,7 @@ nsJARChannel::~nsJARChannel()
|
||||
{
|
||||
// release owning reference to the jar handler
|
||||
nsJARProtocolHandler *handler = gJarHandler;
|
||||
NS_RELEASE(handler); // NULL parameter
|
||||
NS_RELEASE(handler); // nullptr parameter
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED7(nsJARChannel,
|
||||
|
@ -28,18 +28,18 @@ NS_DEFINE_NAMED_CID(NS_JARPROTOCOLHANDLER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_JARURI_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kJARCIDs[] = {
|
||||
{ &kNS_ZIPREADER_CID, false, NULL, nsJARConstructor },
|
||||
{ &kNS_ZIPREADERCACHE_CID, false, NULL, nsZipReaderCacheConstructor },
|
||||
{ &kNS_JARPROTOCOLHANDLER_CID, false, NULL, nsJARProtocolHandlerConstructor },
|
||||
{ &kNS_JARURI_CID, false, NULL, nsJARURIConstructor },
|
||||
{ NULL }
|
||||
{ &kNS_ZIPREADER_CID, false, nullptr, nsJARConstructor },
|
||||
{ &kNS_ZIPREADERCACHE_CID, false, nullptr, nsZipReaderCacheConstructor },
|
||||
{ &kNS_JARPROTOCOLHANDLER_CID, false, nullptr, nsJARProtocolHandlerConstructor },
|
||||
{ &kNS_JARURI_CID, false, nullptr, nsJARURIConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kJARContracts[] = {
|
||||
{ "@mozilla.org/libjar/zip-reader;1", &kNS_ZIPREADER_CID },
|
||||
{ "@mozilla.org/libjar/zip-reader-cache;1", &kNS_ZIPREADERCACHE_CID },
|
||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar", &kNS_JARPROTOCOLHANDLER_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
// Jar module shutdown hook
|
||||
@ -52,9 +52,9 @@ static const mozilla::Module kJARModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kJARCIDs,
|
||||
kJARContracts,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nsJarShutdown
|
||||
};
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
if (path.IsEmpty())
|
||||
return;
|
||||
HANDLE handle = CreateFileW(path.get(), FILE_APPEND_DATA, FILE_SHARE_WRITE,
|
||||
NULL, OPEN_ALWAYS, 0, NULL);
|
||||
nullptr, OPEN_ALWAYS, 0, nullptr);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return;
|
||||
file = PR_ImportFile((PROsfd)handle);
|
||||
@ -129,7 +129,7 @@ public:
|
||||
MOZ_ASSERT(refCnt > 0);
|
||||
if ((0 == --refCnt) && fd) {
|
||||
PR_Close(fd);
|
||||
fd = NULL;
|
||||
fd = nullptr;
|
||||
}
|
||||
}
|
||||
private:
|
||||
@ -333,7 +333,7 @@ nsresult nsZipArchive::CloseArchive()
|
||||
{
|
||||
if (mFd) {
|
||||
PL_FinishArenaPool(&mArena);
|
||||
mFd = NULL;
|
||||
mFd = nullptr;
|
||||
}
|
||||
|
||||
// CAUTION:
|
||||
@ -445,7 +445,7 @@ nsZipArchive::FindInit(const char * aPattern, nsZipFind **aFind)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
// null out param in case an error happens
|
||||
*aFind = NULL;
|
||||
*aFind = nullptr;
|
||||
|
||||
bool regExp = false;
|
||||
char* pattern = 0;
|
||||
@ -715,7 +715,7 @@ MOZ_WIN_MEM_TRY_BEGIN
|
||||
// Is the directory already in the file table?
|
||||
uint32_t hash = HashName(item->Name(), dirlen);
|
||||
bool found = false;
|
||||
for (nsZipItem* zi = mFiles[hash]; zi != NULL; zi = zi->next)
|
||||
for (nsZipItem* zi = mFiles[hash]; zi != nullptr; zi = zi->next)
|
||||
{
|
||||
if ((dirlen == zi->nameLength) &&
|
||||
(0 == memcmp(item->Name(), zi->Name(), dirlen)))
|
||||
@ -753,7 +753,7 @@ MOZ_WIN_MEM_TRY_CATCH(return NS_ERROR_FAILURE)
|
||||
nsZipHandle* nsZipArchive::GetFD()
|
||||
{
|
||||
if (!mFd)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return mFd.get();
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ nsZipArchive::nsZipArchive()
|
||||
|
||||
MOZ_COUNT_CTOR(nsZipArchive);
|
||||
|
||||
// initialize the table to NULL
|
||||
// initialize the table to nullptr
|
||||
memset(mFiles, 0, sizeof(mFiles));
|
||||
}
|
||||
|
||||
|
@ -169,10 +169,10 @@ public:
|
||||
* the actual matches. The nsZipFind must be deleted when you're done
|
||||
*
|
||||
* @param aPattern a string or RegExp pattern to search for
|
||||
* (may be NULL to find all files in archive)
|
||||
* (may be nullptr to find all files in archive)
|
||||
* @param aFind a pointer to a pointer to a structure used
|
||||
* in FindNext. In the case of an error this
|
||||
* will be set to NULL.
|
||||
* will be set to nullptr.
|
||||
* @return status code
|
||||
*/
|
||||
nsresult FindInit(const char * aPattern, nsZipFind** aFind);
|
||||
@ -272,7 +272,7 @@ public:
|
||||
* @param aBufSize Buffer size
|
||||
* @param doCRC When set to true Read() will check crc
|
||||
*/
|
||||
nsZipCursor(nsZipItem *aItem, nsZipArchive *aZip, uint8_t* aBuf = NULL, uint32_t aBufSize = 0, bool doCRC = false);
|
||||
nsZipCursor(nsZipItem *aItem, nsZipArchive *aZip, uint8_t* aBuf = nullptr, uint32_t aBufSize = 0, bool doCRC = false);
|
||||
|
||||
~nsZipCursor();
|
||||
|
||||
@ -281,7 +281,7 @@ public:
|
||||
* it returns a zero-copy buffer.
|
||||
*
|
||||
* @param aBytesRead Outparam for number of bytes read.
|
||||
* @return data read or NULL if item is corrupted.
|
||||
* @return data read or nullptr if item is corrupted.
|
||||
*/
|
||||
uint8_t* Read(uint32_t *aBytesRead) {
|
||||
return ReadOrCopy(aBytesRead, false);
|
||||
@ -291,7 +291,7 @@ public:
|
||||
* Performs a copy. It always uses aBuf(passed in constructor).
|
||||
*
|
||||
* @param aBytesRead Outparam for number of bytes read.
|
||||
* @return data read or NULL if item is corrupted.
|
||||
* @return data read or nullptr if item is corrupted.
|
||||
*/
|
||||
uint8_t* Copy(uint32_t *aBytesRead) {
|
||||
return ReadOrCopy(aBytesRead, true);
|
||||
@ -342,7 +342,7 @@ class nsZipItemPtr : public nsZipItemPtr_base {
|
||||
public:
|
||||
nsZipItemPtr(nsZipArchive *aZip, const char *aEntryName, bool doCRC = false) : nsZipItemPtr_base(aZip, aEntryName, doCRC) { }
|
||||
/**
|
||||
* @return buffer containing the whole zip member or NULL on error.
|
||||
* @return buffer containing the whole zip member or nullptr on error.
|
||||
* The returned buffer is owned by nsZipItemReader.
|
||||
*/
|
||||
const T* Buffer() const {
|
||||
@ -360,15 +360,15 @@ public:
|
||||
*/
|
||||
T* Forget() {
|
||||
if (!mReturnBuf)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
// In uncompressed mmap case, give up buffer
|
||||
if (mAutoBuf.get() == mReturnBuf) {
|
||||
mReturnBuf = NULL;
|
||||
mReturnBuf = nullptr;
|
||||
return (T*) mAutoBuf.forget();
|
||||
}
|
||||
T *ret = (T*) malloc(Length());
|
||||
memcpy(ret, mReturnBuf, Length());
|
||||
mReturnBuf = NULL;
|
||||
mReturnBuf = nullptr;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
@ -14,9 +14,9 @@ NS_DEFINE_NAMED_CID(DEFLATECONVERTER_CID);
|
||||
NS_DEFINE_NAMED_CID(ZIPWRITER_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kZipWriterCIDs[] = {
|
||||
{ &kDEFLATECONVERTER_CID, false, NULL, nsDeflateConverterConstructor },
|
||||
{ &kZIPWRITER_CID, false, NULL, nsZipWriterConstructor },
|
||||
{ NULL }
|
||||
{ &kDEFLATECONVERTER_CID, false, nullptr, nsDeflateConverterConstructor },
|
||||
{ &kZIPWRITER_CID, false, nullptr, nsZipWriterConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kZipWriterContracts[] = {
|
||||
@ -25,7 +25,7 @@ static const mozilla::Module::ContractIDEntry kZipWriterContracts[] = {
|
||||
{ "@mozilla.org/streamconv;1?from=uncompressed&to=x-gzip", &kDEFLATECONVERTER_CID },
|
||||
{ "@mozilla.org/streamconv;1?from=uncompressed&to=rawdeflate", &kDEFLATECONVERTER_CID },
|
||||
{ ZIPWRITER_CONTRACTID, &kZIPWRITER_CID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kZipWriterModule = {
|
||||
|
@ -340,5 +340,5 @@ const uint8_t * nsZipHeader::GetExtraField(uint16_t aTag, bool aLocal, uint16_t
|
||||
pos += blocksize;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -47,15 +47,15 @@ public:
|
||||
mIAttr(0),
|
||||
mInited(false),
|
||||
mWriteOnClose(false),
|
||||
mExtraField(NULL),
|
||||
mLocalExtraField(NULL)
|
||||
mExtraField(nullptr),
|
||||
mLocalExtraField(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
~nsZipHeader()
|
||||
{
|
||||
mExtraField = NULL;
|
||||
mLocalExtraField = NULL;
|
||||
mExtraField = nullptr;
|
||||
mLocalExtraField = nullptr;
|
||||
}
|
||||
|
||||
uint32_t mCRC;
|
||||
|
@ -133,8 +133,8 @@ public:
|
||||
|
||||
/**
|
||||
* Gets char type pref value directly. If failed, the get() of result
|
||||
* returns NULL. Even if succeeded but the result was empty string, the
|
||||
* get() does NOT return NULL. So, you can check whether the method
|
||||
* returns nullptr. Even if succeeded but the result was empty string, the
|
||||
* get() does NOT return nullptr. So, you can check whether the method
|
||||
* succeeded or not by:
|
||||
*
|
||||
* nsAdoptingString value = Prefereces::GetString("foo.bar");
|
||||
@ -149,8 +149,8 @@ public:
|
||||
* // the condition is always FALSE!!
|
||||
* }
|
||||
*
|
||||
* The value.get() doesn't return NULL. You must use nsAdoptingString when
|
||||
* you need to check whether it was failure or not.
|
||||
* The value.get() doesn't return nullptr. You must use nsAdoptingString
|
||||
* when you need to check whether it was failure or not.
|
||||
*/
|
||||
static nsAdoptingCString GetCString(const char* aPref);
|
||||
static nsAdoptingString GetString(const char* aPref);
|
||||
@ -162,8 +162,8 @@ public:
|
||||
* nsIPrefBranch.
|
||||
*
|
||||
* @param aPref A pref name.
|
||||
* @param aResult Must not be NULL. The value is never modified when
|
||||
* these methods fail.
|
||||
* @param aResult Must not be nullptr. The value is never modified
|
||||
* when these methods fail.
|
||||
*/
|
||||
static nsresult GetBool(const char* aPref, bool* aResult);
|
||||
static nsresult GetInt(const char* aPref, int32_t* aResult);
|
||||
@ -182,8 +182,8 @@ public:
|
||||
* Gets string type pref value with raw return value of nsIPrefBranch.
|
||||
*
|
||||
* @param aPref A pref name.
|
||||
* @param aResult Must not be NULL. The value is never modified when
|
||||
* these methods fail.
|
||||
* @param aResult Must not be nullptr. The value is never modified
|
||||
* when these methods fail.
|
||||
*/
|
||||
static nsresult GetCString(const char* aPref, nsACString* aResult);
|
||||
static nsresult GetString(const char* aPref, nsAString* aResult);
|
||||
@ -237,7 +237,7 @@ public:
|
||||
|
||||
/**
|
||||
* Adds/Removes two or more observers for the root pref branch.
|
||||
* Pass to aPrefs an array of const char* whose last item is NULL.
|
||||
* Pass to aPrefs an array of const char* whose last item is nullptr.
|
||||
*/
|
||||
static nsresult AddStrongObservers(nsIObserver* aObserver,
|
||||
const char** aPrefs);
|
||||
@ -318,7 +318,7 @@ public:
|
||||
|
||||
/**
|
||||
* Gets the default value of the char type pref.
|
||||
* If the get() of the result returned NULL, that meant the value didn't
|
||||
* If the get() of the result returned nullptr, that meant the value didn't
|
||||
* have default value.
|
||||
*
|
||||
* See the comment at definition at GetString() and GetCString() for more
|
||||
|
@ -412,7 +412,7 @@ Preferences::Shutdown()
|
||||
if (!sShutdown) {
|
||||
sShutdown = true; // Don't create the singleton instance after here.
|
||||
|
||||
// Don't set NULL to sPreferences here. The instance may be grabbed by
|
||||
// Don't set sPreferences to nullptr here. The instance may be grabbed by
|
||||
// other modules. The utility methods of Preferences should be available
|
||||
// until the singleton instance actually released.
|
||||
if (sPreferences) {
|
||||
@ -659,7 +659,7 @@ ReadExtensionPrefs(nsIFile *aFile)
|
||||
uint32_t read;
|
||||
|
||||
PrefParseState ps;
|
||||
PREF_InitParseState(&ps, PREF_ReaderCallback, NULL);
|
||||
PREF_InitParseState(&ps, PREF_ReaderCallback, nullptr);
|
||||
while (NS_SUCCEEDED(rv = stream->Available(&avail)) && avail) {
|
||||
rv = stream->Read(buffer, 4096, &read);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -916,7 +916,7 @@ Preferences::WritePrefFile(nsIFile* aFile)
|
||||
PL_DHashTableEnumerate(&gHashTable, pref_savePref, &saveArgs);
|
||||
|
||||
/* Sort the preferences to make a readable file on disk */
|
||||
NS_QuickSort(valueArray, gHashTable.entryCount, sizeof(char *), pref_CompareStrings, NULL);
|
||||
NS_QuickSort(valueArray, gHashTable.entryCount, sizeof(char *), pref_CompareStrings, nullptr);
|
||||
|
||||
// write out the file header
|
||||
outStream->Write(outHeader, sizeof(outHeader) - 1, &writeAmount);
|
||||
@ -966,7 +966,7 @@ static nsresult openPrefFile(nsIFile* aFile)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PrefParseState ps;
|
||||
PREF_InitParseState(&ps, PREF_ReaderCallback, NULL);
|
||||
PREF_InitParseState(&ps, PREF_ReaderCallback, nullptr);
|
||||
|
||||
// Read is not guaranteed to return a buf the size of fileSize,
|
||||
// but usually will.
|
||||
@ -1141,7 +1141,7 @@ static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name)
|
||||
NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
PrefParseState ps;
|
||||
PREF_InitParseState(&ps, PREF_ReaderCallback, NULL);
|
||||
PREF_InitParseState(&ps, PREF_ReaderCallback, nullptr);
|
||||
PREF_ParseBuf(&ps, manifest, manifest.Length());
|
||||
PREF_FinalizeParseState(&ps);
|
||||
|
||||
|
@ -20,10 +20,10 @@ static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
|
||||
static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
|
||||
|
||||
static mozilla::Module::CIDEntry kPrefCIDs[] = {
|
||||
{ &kPrefServiceCID, true, NULL, PreferencesConstructor },
|
||||
{ &kPrefLocalizedStringCID, false, NULL, nsPrefLocalizedStringConstructor },
|
||||
{ &kRelativeFilePrefCID, false, NULL, nsRelativeFilePrefConstructor },
|
||||
{ NULL }
|
||||
{ &kPrefServiceCID, true, nullptr, PreferencesConstructor },
|
||||
{ &kPrefLocalizedStringCID, false, nullptr, nsPrefLocalizedStringConstructor },
|
||||
{ &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static mozilla::Module::ContractIDEntry kPrefContracts[] = {
|
||||
@ -32,7 +32,7 @@ static mozilla::Module::ContractIDEntry kPrefContracts[] = {
|
||||
{ NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID },
|
||||
// compatibility for extension that uses old service
|
||||
{ "@mozilla.org/preferences;1", &kPrefServiceCID },
|
||||
{ NULL }
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static void
|
||||
@ -45,9 +45,9 @@ static const mozilla::Module kPrefModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kPrefCIDs,
|
||||
kPrefContracts,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
UnloadPrefsModule
|
||||
};
|
||||
|
||||
|
@ -76,7 +76,7 @@ PLDHashTable gHashTable = { nullptr };
|
||||
static PLArenaPool gPrefNameArena;
|
||||
bool gDirty = false;
|
||||
|
||||
static struct CallbackNode* gCallbacks = NULL;
|
||||
static struct CallbackNode* gCallbacks = nullptr;
|
||||
static bool gIsAnyPrefLocked = false;
|
||||
// These are only used during the call to pref_DoCallback
|
||||
static bool gCallbacksInProgress = false;
|
||||
@ -184,7 +184,7 @@ void PREF_Cleanup()
|
||||
free(node);
|
||||
node = next_node;
|
||||
}
|
||||
gCallbacks = NULL;
|
||||
gCallbacks = nullptr;
|
||||
|
||||
PREF_CleanupPrefs();
|
||||
}
|
||||
@ -215,7 +215,7 @@ static void str_escape(const char * original, nsAFlatCString& aResult)
|
||||
*/
|
||||
const char *p;
|
||||
|
||||
if (original == NULL)
|
||||
if (original == nullptr)
|
||||
return;
|
||||
|
||||
/* Paranoid worst case all slashes will free quickly */
|
||||
@ -709,7 +709,7 @@ static void pref_SetValue(PrefValue* oldValue, PrefValue newValue, PrefType type
|
||||
PR_ASSERT(newValue.stringVal);
|
||||
if (oldValue->stringVal)
|
||||
PL_strfree(oldValue->stringVal);
|
||||
oldValue->stringVal = newValue.stringVal ? PL_strdup(newValue.stringVal) : NULL;
|
||||
oldValue->stringVal = newValue.stringVal ? PL_strdup(newValue.stringVal) : nullptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -902,9 +902,9 @@ PREF_UnregisterCallback(const char *pref_node,
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
struct CallbackNode* node = gCallbacks;
|
||||
struct CallbackNode* prev_node = NULL;
|
||||
struct CallbackNode* prev_node = nullptr;
|
||||
|
||||
while (node != NULL)
|
||||
while (node != nullptr)
|
||||
{
|
||||
if ( node->func == callback &&
|
||||
node->data == instance_data &&
|
||||
@ -946,7 +946,7 @@ static nsresult pref_DoCallback(const char* changed_pref)
|
||||
// out the |func| pointer. We release them at the end of this function
|
||||
// if we haven't reentered.
|
||||
|
||||
for (node = gCallbacks; node != NULL; node = node->next)
|
||||
for (node = gCallbacks; node != nullptr; node = node->next)
|
||||
{
|
||||
if ( node->func &&
|
||||
PL_strncmp(changed_pref,
|
||||
@ -963,10 +963,10 @@ static nsresult pref_DoCallback(const char* changed_pref)
|
||||
|
||||
if (gShouldCleanupDeadNodes && !gCallbacksInProgress)
|
||||
{
|
||||
struct CallbackNode* prev_node = NULL;
|
||||
struct CallbackNode* prev_node = nullptr;
|
||||
node = gCallbacks;
|
||||
|
||||
while (node != NULL)
|
||||
while (node != nullptr)
|
||||
{
|
||||
if (!node->func)
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ PREF_ParseBuf(PrefParseState *ps, const char *buf, int bufLen)
|
||||
case PREF_PARSE_INIT:
|
||||
if (ps->lbcur != ps->lb) { /* reset state */
|
||||
ps->lbcur = ps->lb;
|
||||
ps->vb = NULL;
|
||||
ps->vb = nullptr;
|
||||
ps->vtype = PREF_INVALID;
|
||||
ps->fdefault = false;
|
||||
}
|
||||
@ -593,7 +593,7 @@ main(int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
PREF_InitParseState(&ps, pref_reader, NULL);
|
||||
PREF_InitParseState(&ps, pref_reader, nullptr);
|
||||
|
||||
while ((n = fread(buf, 1, sizeof(buf), fp)) > 0)
|
||||
PREF_ParseBuf(&ps, buf, n);
|
||||
|
Loading…
Reference in New Issue
Block a user