From 5adcbb8fb9aa9181595c317b3aba2c9682248f03 Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Fri, 24 Aug 2012 16:49:00 +0900 Subject: [PATCH] Bug 783206 - replace NULL with nullptr in intl except to OS API usages. r=smontagu --- intl/build/nsI18nModule.cpp | 58 +-- intl/chardet/src/nsChardetModule.cpp | 14 +- intl/locale/src/mac/nsCollationMacUC.cpp | 2 +- intl/locale/src/nsLocale.cpp | 5 +- intl/locale/src/nsLocaleService.cpp | 10 +- intl/locale/src/os2/nsCollationOS2.cpp | 15 +- intl/locale/src/os2/nsDateTimeFormatOS2.cpp | 2 +- intl/locale/src/unix/nsCollationUnix.cpp | 19 +- intl/locale/src/unix/nsDateTimeFormatUnix.cpp | 8 +- intl/locale/src/windows/nsCollationWin.cpp | 10 +- .../src/windows/nsDateTimeFormatWin.cpp | 4 +- intl/locale/src/windows/nsWin32Locale.cpp | 4 +- intl/lwbrk/tests/TestLineBreak.cpp | 16 +- intl/strres/src/nsStringBundle.cpp | 4 +- intl/uconv/public/nsEncoderDecoderUtils.h | 2 +- intl/uconv/src/nsCharsetConverterManager.cpp | 14 +- intl/uconv/src/nsScriptableUConv.cpp | 4 +- intl/uconv/src/nsUConvModule.cpp | 370 +++++++++--------- intl/uconv/tests/TestUConv.cpp | 12 +- intl/uconv/tests/convperf.cpp | 2 +- intl/uconv/tests/nsTestUConv.cpp | 16 +- intl/uconv/tests/nsconv.cpp | 4 +- intl/uconv/tools/umaptable.c | 2 +- intl/uconv/util/nsUCSupport.cpp | 2 +- intl/uconv/util/nsUnicodeDecodeHelper.cpp | 19 +- intl/unicharutil/src/nsEntityConverter.cpp | 52 ++- intl/unicharutil/src/nsEntityConverter.h | 2 +- intl/unicharutil/src/nsSaveAsCharset.cpp | 35 +- intl/unicharutil/src/nsUnicodeNormalizer.cpp | 12 +- intl/unicharutil/tests/NormalizationTest.cpp | 4 +- intl/unicharutil/tests/UnicharSelfTest.cpp | 26 +- intl/unicharutil/util/nsSpecialCasingData.h | 2 +- 32 files changed, 357 insertions(+), 394 deletions(-) diff --git a/intl/build/nsI18nModule.cpp b/intl/build/nsI18nModule.cpp index 26cffc50785f..864c6af7e1db 100644 --- a/intl/build/nsI18nModule.cpp +++ b/intl/build/nsI18nModule.cpp @@ -80,39 +80,39 @@ NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID); #endif static const mozilla::Module::CIDEntry kIntlCIDs[] = { - { &kNS_LBRK_CID, false, NULL, nsJISx4051LineBreakerConstructor }, - { &kNS_WBRK_CID, false, NULL, nsSampleWordBreakerConstructor }, - { &kNS_SEMANTICUNITSCANNER_CID, false, NULL, nsSemanticUnitScannerConstructor }, - { &kNS_UNICHARUTIL_CID, false, NULL, nsCaseConversionImp2Constructor }, - { &kNS_UNICHARCATEGORY_CID, false, NULL, nsCategoryImpConstructor }, - { &kNS_ENTITYCONVERTER_CID, false, NULL, nsEntityConverterConstructor }, - { &kNS_SAVEASCHARSET_CID, false, NULL, nsSaveAsCharsetConstructor }, - { &kNS_UNICODE_NORMALIZER_CID, false, NULL, nsUnicodeNormalizerConstructor }, - { &kNS_STRINGBUNDLESERVICE_CID, false, NULL, nsStringBundleServiceConstructor }, - { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, NULL, nsStringBundleTextOverrideConstructor }, - { &kNS_LOCALESERVICE_CID, false, NULL, CreateLocaleService }, - { &kNS_COLLATIONFACTORY_CID, false, NULL, nsCollationFactoryConstructor }, - { &kNS_SCRIPTABLEDATEFORMAT_CID, false, NULL, NS_NewScriptableDateFormat }, - { &kNS_LANGUAGEATOMSERVICE_CID, false, NULL, nsLanguageAtomServiceConstructor }, - { &kNS_PLATFORMCHARSET_CID, false, NULL, nsPlatformCharsetConstructor }, + { &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor }, + { &kNS_WBRK_CID, false, nullptr, nsSampleWordBreakerConstructor }, + { &kNS_SEMANTICUNITSCANNER_CID, false, nullptr, nsSemanticUnitScannerConstructor }, + { &kNS_UNICHARUTIL_CID, false, nullptr, nsCaseConversionImp2Constructor }, + { &kNS_UNICHARCATEGORY_CID, false, nullptr, nsCategoryImpConstructor }, + { &kNS_ENTITYCONVERTER_CID, false, nullptr, nsEntityConverterConstructor }, + { &kNS_SAVEASCHARSET_CID, false, nullptr, nsSaveAsCharsetConstructor }, + { &kNS_UNICODE_NORMALIZER_CID, false, nullptr, nsUnicodeNormalizerConstructor }, + { &kNS_STRINGBUNDLESERVICE_CID, false, nullptr, nsStringBundleServiceConstructor }, + { &kNS_STRINGBUNDLETEXTOVERRIDE_CID, false, nullptr, nsStringBundleTextOverrideConstructor }, + { &kNS_LOCALESERVICE_CID, false, nullptr, CreateLocaleService }, + { &kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor }, + { &kNS_SCRIPTABLEDATEFORMAT_CID, false, nullptr, NS_NewScriptableDateFormat }, + { &kNS_LANGUAGEATOMSERVICE_CID, false, nullptr, nsLanguageAtomServiceConstructor }, + { &kNS_PLATFORMCHARSET_CID, false, nullptr, nsPlatformCharsetConstructor }, #ifdef XP_WIN - { &kNS_COLLATION_CID, false, NULL, nsCollationWinConstructor }, - { &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatWinConstructor }, + { &kNS_COLLATION_CID, false, nullptr, nsCollationWinConstructor }, + { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatWinConstructor }, #endif #ifdef USE_UNIX_LOCALE - { &kNS_COLLATION_CID, false, NULL, nsCollationUnixConstructor }, - { &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatUnixConstructor }, + { &kNS_COLLATION_CID, false, nullptr, nsCollationUnixConstructor }, + { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatUnixConstructor }, #endif #ifdef USE_MAC_LOCALE - { &kNS_COLLATION_CID, false, NULL, nsCollationMacUCConstructor }, - { &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatMacConstructor }, + { &kNS_COLLATION_CID, false, nullptr, nsCollationMacUCConstructor }, + { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatMacConstructor }, #endif #ifdef XP_OS2 - { &kNS_OS2LOCALE_CID, false, NULL, nsOS2LocaleConstructor }, - { &kNS_COLLATION_CID, false, NULL, nsCollationOS2Constructor }, - { &kNS_DATETIMEFORMAT_CID, false, NULL, nsDateTimeFormatOS2Constructor }, + { &kNS_OS2LOCALE_CID, false, nullptr, nsOS2LocaleConstructor }, + { &kNS_COLLATION_CID, false, nullptr, nsCollationOS2Constructor }, + { &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatOS2Constructor }, #endif - { NULL } + { nullptr } }; static const mozilla::Module::ContractIDEntry kIntlContracts[] = { @@ -148,7 +148,7 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = { { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, #endif - { NULL } + { nullptr } }; static void @@ -161,9 +161,9 @@ static const mozilla::Module kIntlModule = { mozilla::Module::kVersion, kIntlCIDs, kIntlContracts, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, I18nModuleDtor }; diff --git a/intl/chardet/src/nsChardetModule.cpp b/intl/chardet/src/nsChardetModule.cpp index 3d9c742e2cc0..9f9662ac8207 100644 --- a/intl/chardet/src/nsChardetModule.cpp +++ b/intl/chardet/src/nsChardetModule.cpp @@ -16,11 +16,11 @@ NS_DEFINE_NAMED_CID(NS_RU_STRING_PROBDETECTOR_CID); NS_DEFINE_NAMED_CID(NS_UK_STRING_PROBDETECTOR_CID); static const mozilla::Module::CIDEntry kChardetCIDs[] = { - { &kNS_RU_PROBDETECTOR_CID, false, NULL, nsRUProbDetectorConstructor }, - { &kNS_UK_PROBDETECTOR_CID, false, NULL, nsUKProbDetectorConstructor }, - { &kNS_RU_STRING_PROBDETECTOR_CID, false, NULL, nsRUStringProbDetectorConstructor }, - { &kNS_UK_STRING_PROBDETECTOR_CID, false, NULL, nsUKStringProbDetectorConstructor }, - { NULL } + { &kNS_RU_PROBDETECTOR_CID, false, nullptr, nsRUProbDetectorConstructor }, + { &kNS_UK_PROBDETECTOR_CID, false, nullptr, nsUKProbDetectorConstructor }, + { &kNS_RU_STRING_PROBDETECTOR_CID, false, nullptr, nsRUStringProbDetectorConstructor }, + { &kNS_UK_STRING_PROBDETECTOR_CID, false, nullptr, nsUKStringProbDetectorConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kChardetContracts[] = { @@ -28,14 +28,14 @@ static const mozilla::Module::ContractIDEntry kChardetContracts[] = { { NS_CHARSET_DETECTOR_CONTRACTID_BASE "ukprob", &kNS_UK_PROBDETECTOR_CID }, { NS_STRCDETECTOR_CONTRACTID_BASE "ruprob", &kNS_RU_STRING_PROBDETECTOR_CID }, { NS_STRCDETECTOR_CONTRACTID_BASE "ukprob", &kNS_UK_STRING_PROBDETECTOR_CID }, - { NULL } + { nullptr } }; static const mozilla::Module::CategoryEntry kChardetCategories[] = { { NS_CHARSET_DETECTOR_CATEGORY, "off", "off" }, { NS_CHARSET_DETECTOR_CATEGORY, "ruprob", NS_CHARSET_DETECTOR_CONTRACTID_BASE "ruprob" }, { NS_CHARSET_DETECTOR_CATEGORY, "ukprob", NS_CHARSET_DETECTOR_CONTRACTID_BASE "ukprob" }, - { NULL } + { nullptr } }; static const mozilla::Module kChardetModule = { diff --git a/intl/locale/src/mac/nsCollationMacUC.cpp b/intl/locale/src/mac/nsCollationMacUC.cpp index 08822e170e0e..97c353fc1ba5 100644 --- a/intl/locale/src/mac/nsCollationMacUC.cpp +++ b/intl/locale/src/mac/nsCollationMacUC.cpp @@ -16,7 +16,7 @@ nsCollationMacUC::nsCollationMacUC() , mLocale(NULL) , mLastStrength(-1) , mCollator(NULL) - , mBuffer(NULL) + , mBuffer(nullptr) , mBufferLen(1) { } diff --git a/intl/locale/src/nsLocale.cpp b/intl/locale/src/nsLocale.cpp index 3669205c96b2..b37ecbb91a9a 100644 --- a/intl/locale/src/nsLocale.cpp +++ b/intl/locale/src/nsLocale.cpp @@ -27,7 +27,8 @@ nsLocale::nsLocale(void) { fHashtable = PL_NewHashTable(LOCALE_HASH_SIZE,&nsLocale::Hash_HashFunction, &nsLocale::Hash_CompareNSString, - &nsLocale::Hash_CompareNSString, NULL, NULL); + &nsLocale::Hash_CompareNSString, + nullptr, nullptr); NS_ASSERTION(fHashtable, "nsLocale: failed to allocate PR_Hashtable"); } @@ -36,7 +37,7 @@ nsLocale::~nsLocale(void) // enumerate all the entries with a delete function to // safely delete all the keys and values PL_HashTableEnumerateEntries(fHashtable, &nsLocale::Hash_EnumerateDelete, - NULL); + nullptr); PL_HashTableDestroy(fHashtable); } diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp index 5b96865cd869..071923ab521c 100644 --- a/intl/locale/src/nsLocaleService.cpp +++ b/intl/locale/src/nsLocaleService.cpp @@ -102,7 +102,6 @@ protected: // nsLocaleService methods // nsLocaleService::nsLocaleService(void) - : mSystemLocale(0), mApplicationLocale(0) { #ifdef XP_WIN nsAutoString xpLocale; @@ -176,9 +175,6 @@ nsLocaleService::nsLocaleService(void) int i; nsRefPtr resultLocale(new nsLocale()); - if ( resultLocale == NULL ) { - return; - } LocaleObject locale_object = NULL; int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, @@ -310,7 +306,6 @@ nsLocaleService::GetApplicationLocale(nsILocale **_retval) NS_IMETHODIMP nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILocale **_retval) { - char* input; char* cPtr; char* cPtr1; char* cPtr2; @@ -320,9 +315,7 @@ nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILoca char acceptLanguageList[NSILOCALE_MAX_ACCEPT_LANGUAGE][NSILOCALE_MAX_ACCEPT_LENGTH]; nsresult result; - input = new char[strlen(acceptLanguage)+1]; - NS_ASSERTION(input!=nullptr,"nsLocaleFactory::GetLocaleFromAcceptLanguage: memory allocation failed."); - if (input == (char*)NULL){ return NS_ERROR_OUT_OF_MEMORY; } + nsAutoArrayPtr input(new char[strlen(acceptLanguage)+1]); strcpy(input, acceptLanguage); cPtr1 = input-1; @@ -407,7 +400,6 @@ nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILoca // // clean up // - delete[] input; return result; } diff --git a/intl/locale/src/os2/nsCollationOS2.cpp b/intl/locale/src/os2/nsCollationOS2.cpp index 4821d2f0bcea..a1700b32583d 100644 --- a/intl/locale/src/os2/nsCollationOS2.cpp +++ b/intl/locale/src/os2/nsCollationOS2.cpp @@ -27,14 +27,13 @@ NS_IMPL_ISUPPORTS1(nsCollationOS2, nsICollation) -nsCollationOS2::nsCollationOS2() +nsCollationOS2::nsCollationOS2() : mCollation(nullptr) { - mCollation = NULL; } nsCollationOS2::~nsCollationOS2() { - if (mCollation != NULL) + if (mCollation) delete mCollation; } @@ -45,15 +44,9 @@ nsCollationOS2::~nsCollationOS2() nsresult nsCollationOS2::Initialize(nsILocale *locale) { - NS_ASSERTION(mCollation == NULL, "Should only be initialized once"); - - nsresult res; + NS_ASSERTION(!mCollation, "Should only be initialized once"); mCollation = new nsCollation; - if (mCollation == NULL) { - NS_ERROR("mCollation creation failed"); - return NS_ERROR_OUT_OF_MEMORY; - } return NS_OK; } @@ -118,7 +111,7 @@ nsresult nsCollationOS2::AllocateRawSortKey(int32_t strength, // you let it...) // Magic, persistent buffer. If it's not twice the size we need, // we grow/reallocate it 4X so it doesn't grow often. - static UniChar* pLocalBuffer = NULL; + static UniChar* pLocalBuffer = nullptr; static int iBufferLength = 100; if (iBufferLength < length*2) { if ( pLocalBuffer ) { diff --git a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp index 48c668fbd7ef..2c5865ea1044 100644 --- a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp +++ b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp @@ -33,7 +33,7 @@ nsresult nsDateTimeFormatOS2::FormatTMTime(nsILocale* locale, nsresult rc = NS_ERROR_FAILURE; UniChar uFmtD[NSDATETIME_FORMAT_BUFFER_LEN] = { 0 }; UniChar uFmtT[NSDATETIME_FORMAT_BUFFER_LEN] = { 0 }; - UniChar *pString = NULL; + UniChar *pString = nullptr; LocaleObject locObj = NULL; int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj); if (ret != ULS_SUCCESS) diff --git a/intl/locale/src/unix/nsCollationUnix.cpp b/intl/locale/src/unix/nsCollationUnix.cpp index b84bb3cf474e..53bc8f4e1928 100644 --- a/intl/locale/src/unix/nsCollationUnix.cpp +++ b/intl/locale/src/unix/nsCollationUnix.cpp @@ -18,7 +18,7 @@ inline void nsCollationUnix::DoSetLocale() { - char *locale = setlocale(LC_COLLATE, NULL); + char *locale = setlocale(LC_COLLATE, nullptr); mSavedLocale.Assign(locale ? locale : ""); if (!mSavedLocale.EqualsIgnoreCase(mLocale.get())) { (void) setlocale(LC_COLLATE, PromiseFlatCString(Substring(mLocale,0,MAX_LOCALE_LEN)).get()); @@ -32,14 +32,13 @@ inline void nsCollationUnix::DoRestoreLocale() } } -nsCollationUnix::nsCollationUnix() +nsCollationUnix::nsCollationUnix() : mCollation(nullptr) { - mCollation = NULL; } nsCollationUnix::~nsCollationUnix() { - if (mCollation != NULL) + if (mCollation) delete mCollation; } @@ -48,15 +47,11 @@ NS_IMPL_ISUPPORTS1(nsCollationUnix, nsICollation) nsresult nsCollationUnix::Initialize(nsILocale* locale) { #define kPlatformLocaleLength 64 - NS_ASSERTION(mCollation == NULL, "Should only be initialized once"); + NS_ASSERTION(!mCollation, "Should only be initialized once"); nsresult res; mCollation = new nsCollation; - if (mCollation == NULL) { - NS_ERROR("mCollation creation failed"); - return NS_ERROR_OUT_OF_MEMORY; - } // default platform locale mLocale.Assign('C'); @@ -131,9 +126,9 @@ nsresult nsCollationUnix::CompareString(int32_t strength, char *str1, *str2; res = mCollation->UnicodeToChar(stringNormalized1, &str1); - if (NS_SUCCEEDED(res) && str1 != NULL) { + if (NS_SUCCEEDED(res) && str1) { res = mCollation->UnicodeToChar(stringNormalized2, &str2); - if (NS_SUCCEEDED(res) && str2 != NULL) { + if (NS_SUCCEEDED(res) && str2) { DoSetLocale(); *result = strcoll(str1, str2); DoRestoreLocale(); @@ -164,7 +159,7 @@ nsresult nsCollationUnix::AllocateRawSortKey(int32_t strength, char *str; res = mCollation->UnicodeToChar(stringNormalized, &str); - if (NS_SUCCEEDED(res) && str != NULL) { + if (NS_SUCCEEDED(res) && str) { DoSetLocale(); // call strxfrm to generate a key size_t len = strxfrm(nullptr, str, 0) + 1; diff --git a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp index 00a53f8790c2..aca213c2c3a4 100644 --- a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp @@ -25,7 +25,7 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale) nsresult res = NS_OK; // use cached info if match with stored locale - if (NULL == locale) { + if (!locale) { if (!mLocale.IsEmpty() && mLocale.Equals(mAppLocale, nsCaseInsensitiveStringComparator())) { return NS_OK; @@ -46,7 +46,7 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale) mPlatformLocale.Assign("en_US"); // get locale name string, use app default if no locale specified - if (NULL == locale) { + if (!locale) { nsCOMPtr localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID, &res); if (NS_SUCCEEDED(res)) { @@ -100,7 +100,7 @@ void nsDateTimeFormatUnix::LocalePreferred24hour() struct tm *tmc; int i; - tt = time((time_t)NULL); + tt = time((time_t)0); tmc = localtime(&tt); tmc->tm_hour=22; // put the test sample hour to 22:00 which is 10PM @@ -206,7 +206,7 @@ nsresult nsDateTimeFormatUnix::FormatTMTime(nsILocale* locale, } // generate data/time string - char *old_locale = setlocale(LC_TIME, NULL); + char *old_locale = setlocale(LC_TIME, nullptr); (void) setlocale(LC_TIME, mPlatformLocale.get()); if (PL_strlen(fmtD) && PL_strlen(fmtT)) { PL_strncat(fmtD, " ", NSDATETIME_FORMAT_BUFFER_LEN); diff --git a/intl/locale/src/windows/nsCollationWin.cpp b/intl/locale/src/windows/nsCollationWin.cpp index 8c81bd8cac33..ff3f7b55a12e 100644 --- a/intl/locale/src/windows/nsCollationWin.cpp +++ b/intl/locale/src/windows/nsCollationWin.cpp @@ -21,27 +21,23 @@ NS_IMPL_ISUPPORTS1(nsCollationWin, nsICollation) -nsCollationWin::nsCollationWin() +nsCollationWin::nsCollationWin() : mCollation(nullptr) { - mCollation = NULL; } nsCollationWin::~nsCollationWin() { - if (mCollation != NULL) + if (mCollation) delete mCollation; } nsresult nsCollationWin::Initialize(nsILocale* locale) { - NS_ASSERTION(mCollation == NULL, "Should only be initialized once."); + NS_ASSERTION(!mCollation, "Should only be initialized once."); nsresult res; mCollation = new nsCollation; - if (!mCollation) { - return NS_ERROR_OUT_OF_MEMORY; - } // default LCID (en-US) mLCID = 1033; diff --git a/intl/locale/src/windows/nsDateTimeFormatWin.cpp b/intl/locale/src/windows/nsDateTimeFormatWin.cpp index 92317b6ea3b4..5dd1f995d518 100644 --- a/intl/locale/src/windows/nsDateTimeFormatWin.cpp +++ b/intl/locale/src/windows/nsDateTimeFormatWin.cpp @@ -27,7 +27,7 @@ nsresult nsDateTimeFormatWin::Initialize(nsILocale* locale) nsresult res = NS_OK; // use cached info if match with stored locale - if (NULL == locale) { + if (!locale) { if (!mLocale.IsEmpty() && mLocale.Equals(mAppLocale, nsCaseInsensitiveStringComparator())) { return NS_OK; @@ -47,7 +47,7 @@ nsresult nsDateTimeFormatWin::Initialize(nsILocale* locale) mLCID = 1033; // get locale string, use app default if no locale specified - if (NULL == locale) { + if (!locale) { nsCOMPtr localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID); if (localeService) { diff --git a/intl/locale/src/windows/nsWin32Locale.cpp b/intl/locale/src/windows/nsWin32Locale.cpp index 9f0eb3b563c9..55fd56bcbb86 100644 --- a/intl/locale/src/windows/nsWin32Locale.cpp +++ b/intl/locale/src/windows/nsWin32Locale.cpp @@ -30,8 +30,8 @@ struct iso_map iso_pair sublang_list[20]; }; -nsWin32Locale::LocaleNameToLCIDPtr nsWin32Locale::localeNameToLCID = NULL; -nsWin32Locale::LCIDToLocaleNamePtr nsWin32Locale::lcidToLocaleName = NULL; +nsWin32Locale::LocaleNameToLCIDPtr nsWin32Locale::localeNameToLCID = nullptr; +nsWin32Locale::LCIDToLocaleNamePtr nsWin32Locale::lcidToLocaleName = nullptr; // Older versions of VC++ and Win32 SDK and mingw don't have // macros for languages and sublanguages recently added to Win32. diff --git a/intl/lwbrk/tests/TestLineBreak.cpp b/intl/lwbrk/tests/TestLineBreak.cpp index 7136b864e24f..2272c0b8407b 100644 --- a/intl/lwbrk/tests/TestLineBreak.cpp +++ b/intl/lwbrk/tests/TestLineBreak.cpp @@ -176,13 +176,13 @@ bool TestLineBreaker() printf("===========================\n"); printf("Finish nsILineBreaker Test \n"); printf("===========================\n"); - nsILineBreaker *t = NULL; + nsILineBreaker *t = nullptr; nsresult res; bool ok = true; res = CallGetService(kLBrkCID, &t); printf("Test 1 - GetService():\n"); - if(NS_FAILED(res) || ( t == NULL ) ) { + if (NS_FAILED(res) || !t) { printf("\t1st GetService failed\n"); ok = false; } @@ -191,7 +191,7 @@ bool TestLineBreaker() res = CallGetService(kLBrkCID, &t); - if(NS_FAILED(res) || ( t == NULL ) ) { + if (NS_FAILED(res) || !t) { printf("\t2nd GetService failed\n"); ok = false; } else { @@ -242,13 +242,13 @@ bool TestWordBreaker() printf("===========================\n"); printf("Finish nsIWordBreaker Test \n"); printf("===========================\n"); - nsIWordBreaker *t = NULL; + nsIWordBreaker *t = nullptr; nsresult res; bool ok = true; res = CallGetService(kWBrkCID, &t); printf("Test 1 - GetService():\n"); - if(NS_FAILED(res) || ( t == NULL ) ) { + if (NS_FAILED(res) || !t) { printf("\t1st GetService failed\n"); ok = false; } else { @@ -257,7 +257,7 @@ bool TestWordBreaker() res = CallGetService(kWBrkCID, &t); - if(NS_FAILED(res) || ( t == NULL ) ) { + if (NS_FAILED(res) || !t) { printf("\t2nd GetService failed\n"); ok = false; } else { @@ -334,7 +334,7 @@ void SampleWordBreakUsage() void SamplePrintWordWithBreak() { uint32_t numOfFragment = sizeof(wb) / sizeof(char*); - nsIWordBreaker *wbk = NULL; + nsIWordBreaker *wbk = nullptr; CallGetService(kWBrkCID, &wbk); @@ -381,7 +381,7 @@ void SamplePrintWordWithBreak() void SampleFindWordBreakFromPosition(uint32_t fragN, uint32_t offset) { uint32_t numOfFragment = sizeof(wb) / sizeof(char*); - nsIWordBreaker *wbk = NULL; + nsIWordBreaker *wbk = nullptr; CallGetService(kWBrkCID, &wbk); diff --git a/intl/strres/src/nsStringBundle.cpp b/intl/strres/src/nsStringBundle.cpp index 3bf62a40b4ca..ce0e17fd19f5 100644 --- a/intl/strres/src/nsStringBundle.cpp +++ b/intl/strres/src/nsStringBundle.cpp @@ -493,7 +493,7 @@ nsExtensibleStringBundle::FormatStringFromName(const PRUnichar *aName, nsresult nsExtensibleStringBundle::GetSimpleEnumeration(nsISimpleEnumerator ** aResult) { // XXX write me - *aResult = NULL; + *aResult = nullptr; return NS_ERROR_NOT_IMPLEMENTED; } @@ -712,7 +712,7 @@ NS_IMETHODIMP nsStringBundleService::CreateExtensibleBundle(const char* aCategory, nsIStringBundle** aResult) { - if (aResult == NULL) return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(aResult); nsresult res; diff --git a/intl/uconv/public/nsEncoderDecoderUtils.h b/intl/uconv/public/nsEncoderDecoderUtils.h index a572a1054f80..f45c46c6314c 100644 --- a/intl/uconv/public/nsEncoderDecoderUtils.h +++ b/intl/uconv/public/nsEncoderDecoderUtils.h @@ -16,7 +16,7 @@ static const mozilla::Module::CategoryEntry kUConvCategories[] = { #define NS_CONVERTER_REGISTRY_END \ - { NULL } \ + { nullptr } \ }; #define NS_UCONV_REG_UNREG_DECODER(_Charset, _CID) \ diff --git a/intl/uconv/src/nsCharsetConverterManager.cpp b/intl/uconv/src/nsCharsetConverterManager.cpp index 1791b1387204..8e81ba6d73d1 100644 --- a/intl/uconv/src/nsCharsetConverterManager.cpp +++ b/intl/uconv/src/nsCharsetConverterManager.cpp @@ -99,11 +99,10 @@ static nsresult GetCharsetDataImpl(const char * aCharset, const PRUnichar * aProp, nsAString& aResult) { - if (aCharset == NULL) - return NS_ERROR_NULL_POINTER; - // aProp can be NULL + NS_ENSURE_ARG_POINTER(aCharset); + // aProp can be nullptr - if (sDataBundle == NULL) { + if (!sDataBundle) { nsresult rv = LoadExtensibleBundle(NS_DATA_BUNDLE_CATEGORY, &sDataBundle); if (NS_FAILED(rv)) return rv; @@ -224,9 +223,8 @@ nsresult GetList(const nsACString& aCategory, const nsACString& aPrefix, nsIUTF8StringEnumerator** aResult) { - if (aResult == NULL) - return NS_ERROR_NULL_POINTER; - *aResult = NULL; + NS_ENSURE_ARG_POINTER(aResult); + *aResult = nullptr; nsresult rv; @@ -313,7 +311,7 @@ nsCharsetConverterManager::GetCharsetTitle(const char * aCharset, { NS_ENSURE_ARG_POINTER(aCharset); - if (sTitleBundle == NULL) { + if (!sTitleBundle) { nsresult rv = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &sTitleBundle); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/intl/uconv/src/nsScriptableUConv.cpp b/intl/uconv/src/nsScriptableUConv.cpp index 3bf00e80bc19..0a03f67fa403 100644 --- a/intl/uconv/src/nsScriptableUConv.cpp +++ b/intl/uconv/src/nsScriptableUConv.cpp @@ -254,11 +254,11 @@ nsresult nsScriptableUnicodeConverter::InitConverter() { nsresult rv = NS_OK; - mEncoder = NULL ; + mEncoder = nullptr; nsCOMPtr ccm = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv); - if (NS_SUCCEEDED( rv) && (nullptr != ccm)) { + if (NS_SUCCEEDED(rv) && ccm) { // get charset atom due to getting unicode converter // get an unicode converter diff --git a/intl/uconv/src/nsUConvModule.cpp b/intl/uconv/src/nsUConvModule.cpp index 39cf64209903..9381857014a6 100644 --- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -714,194 +714,194 @@ NS_DEFINE_NAMED_CID(NS_UNICODETOGB18030_CID); NS_DEFINE_NAMED_CID(NS_ISO2022CNTOUNICODE_CID); static const mozilla::Module::CIDEntry kUConvCIDs[] = { - { &kNS_ICHARSETCONVERTERMANAGER_CID, false, NULL, nsCharsetConverterManagerConstructor }, - { &kNS_TEXTTOSUBURI_CID, false, NULL, nsTextToSubURIConstructor }, - { &kNS_CONVERTERINPUTSTREAM_CID, false, NULL, nsConverterInputStreamConstructor }, - { &kNS_CONVERTEROUTPUTSTREAM_CID, false, NULL, nsConverterOutputStreamConstructor }, - { &kNS_ISCRIPTABLEUNICODECONVERTER_CID, false, NULL, nsScriptableUnicodeConverterConstructor }, - { &kNS_UTF8CONVERTERSERVICE_CID, false, NULL, nsUTF8ConverterServiceConstructor }, - { &kNS_ISO88591TOUNICODE_CID, false, NULL, nsISO88591ToUnicodeConstructor }, - { &kNS_CP1252TOUNICODE_CID, false, NULL, nsCP1252ToUnicodeConstructor }, - { &kNS_MACROMANTOUNICODE_CID, false, NULL, nsMacRomanToUnicodeConstructor }, - { &kNS_UTF8TOUNICODE_CID, false, NULL, nsUTF8ToUnicodeConstructor }, - { &kNS_UNICODETOISO88591_CID, false, NULL, nsUnicodeToISO88591Constructor }, - { &kNS_UNICODETOCP1252_CID, false, NULL, nsUnicodeToCP1252Constructor }, - { &kNS_UNICODETOMACROMAN_CID, false, NULL, nsUnicodeToMacRomanConstructor }, - { &kNS_UNICODETOUTF8_CID, false, NULL, nsUnicodeToUTF8Constructor }, - { &kNS_ASCIITOUNICODE_CID, false, NULL, nsAsciiToUnicodeConstructor }, - { &kNS_ISO88592TOUNICODE_CID, false, NULL, nsISO88592ToUnicodeConstructor }, - { &kNS_ISO88593TOUNICODE_CID, false, NULL, nsISO88593ToUnicodeConstructor }, - { &kNS_ISO88594TOUNICODE_CID, false, NULL, nsISO88594ToUnicodeConstructor }, - { &kNS_ISO88595TOUNICODE_CID, false, NULL, nsISO88595ToUnicodeConstructor }, - { &kNS_ISO88596TOUNICODE_CID, false, NULL, nsISO88596ToUnicodeConstructor }, - { &kNS_ISO88596ITOUNICODE_CID, false, NULL, nsISO88596IToUnicodeConstructor }, - { &kNS_ISO88596ETOUNICODE_CID, false, NULL, nsISO88596EToUnicodeConstructor }, - { &kNS_ISO88597TOUNICODE_CID, false, NULL, nsISO88597ToUnicodeConstructor }, - { &kNS_ISO88598TOUNICODE_CID, false, NULL, nsISO88598ToUnicodeConstructor }, - { &kNS_ISO88598ITOUNICODE_CID, false, NULL, nsISO88598IToUnicodeConstructor }, - { &kNS_ISO88598ETOUNICODE_CID, false, NULL, nsISO88598EToUnicodeConstructor }, - { &kNS_ISO88599TOUNICODE_CID, false, NULL, nsISO88599ToUnicodeConstructor }, - { &kNS_ISO885910TOUNICODE_CID, false, NULL, nsISO885910ToUnicodeConstructor }, - { &kNS_ISO885913TOUNICODE_CID, false, NULL, nsISO885913ToUnicodeConstructor }, - { &kNS_ISO885914TOUNICODE_CID, false, NULL, nsISO885914ToUnicodeConstructor }, - { &kNS_ISO885915TOUNICODE_CID, false, NULL, nsISO885915ToUnicodeConstructor }, - { &kNS_ISO885916TOUNICODE_CID, false, NULL, nsISO885916ToUnicodeConstructor }, - { &kNS_ISOIR111TOUNICODE_CID, false, NULL, nsISOIR111ToUnicodeConstructor }, - { &kNS_CP1250TOUNICODE_CID, false, NULL, nsCP1250ToUnicodeConstructor }, - { &kNS_CP1251TOUNICODE_CID, false, NULL, nsCP1251ToUnicodeConstructor }, - { &kNS_CP1253TOUNICODE_CID, false, NULL, nsCP1253ToUnicodeConstructor }, - { &kNS_CP1254TOUNICODE_CID, false, NULL, nsCP1254ToUnicodeConstructor }, - { &kNS_CP1255TOUNICODE_CID, false, NULL, nsCP1255ToUnicodeConstructor }, - { &kNS_CP1256TOUNICODE_CID, false, NULL, nsCP1256ToUnicodeConstructor }, - { &kNS_CP1257TOUNICODE_CID, false, NULL, nsCP1257ToUnicodeConstructor }, - { &kNS_CP1258TOUNICODE_CID, false, NULL, nsCP1258ToUnicodeConstructor }, - { &kNS_TIS620TOUNICODE_CID, false, NULL, nsTIS620ToUnicodeConstructor }, - { &kNS_ISO885911TOUNICODE_CID, false, NULL, nsISO885911ToUnicodeConstructor }, - { &kNS_CP874TOUNICODE_CID, false, NULL, nsCP874ToUnicodeConstructor }, - { &kNS_CP866TOUNICODE_CID, false, NULL, nsCP866ToUnicodeConstructor }, - { &kNS_KOI8RTOUNICODE_CID, false, NULL, nsKOI8RToUnicodeConstructor }, - { &kNS_KOI8UTOUNICODE_CID, false, NULL, nsKOI8UToUnicodeConstructor }, - { &kNS_MACCETOUNICODE_CID, false, NULL, nsMacCEToUnicodeConstructor }, - { &kNS_MACGREEKTOUNICODE_CID, false, NULL, nsMacGreekToUnicodeConstructor }, - { &kNS_MACTURKISHTOUNICODE_CID, false, NULL, nsMacTurkishToUnicodeConstructor }, - { &kNS_MACCROATIANTOUNICODE_CID, false, NULL, nsMacCroatianToUnicodeConstructor }, - { &kNS_MACROMANIANTOUNICODE_CID, false, NULL, nsMacRomanianToUnicodeConstructor }, - { &kNS_MACCYRILLICTOUNICODE_CID, false, NULL, nsMacCyrillicToUnicodeConstructor }, - { &kNS_MACICELANDICTOUNICODE_CID, false, NULL, nsMacIcelandicToUnicodeConstructor }, - { &kNS_ARMSCII8TOUNICODE_CID, false, NULL, nsARMSCII8ToUnicodeConstructor }, - { &kNS_TCVN5712TOUNICODE_CID, false, NULL, nsTCVN5712ToUnicodeConstructor }, - { &kNS_VISCIITOUNICODE_CID, false, NULL, nsVISCIIToUnicodeConstructor }, - { &kNS_VPSTOUNICODE_CID, false, NULL, nsVPSToUnicodeConstructor }, - { &kNS_UTF7TOUNICODE_CID, false, NULL, nsUTF7ToUnicodeConstructor }, - { &kNS_MUTF7TOUNICODE_CID, false, NULL, nsMUTF7ToUnicodeConstructor }, - { &kNS_UTF16TOUNICODE_CID, false, NULL, nsUTF16ToUnicodeConstructor }, - { &kNS_UTF16BETOUNICODE_CID, false, NULL, nsUTF16BEToUnicodeConstructor }, - { &kNS_UTF16LETOUNICODE_CID, false, NULL, nsUTF16LEToUnicodeConstructor }, - { &kNS_T61TOUNICODE_CID, false, NULL, nsT61ToUnicodeConstructor }, - { &kNS_USERDEFINEDTOUNICODE_CID, false, NULL, nsUserDefinedToUnicodeConstructor }, - { &kNS_MACARABICTOUNICODE_CID, false, NULL, nsMacArabicToUnicodeConstructor }, - { &kNS_MACDEVANAGARITOUNICODE_CID, false, NULL, nsMacDevanagariToUnicodeConstructor }, - { &kNS_MACFARSITOUNICODE_CID, false, NULL, nsMacFarsiToUnicodeConstructor }, - { &kNS_MACGURMUKHITOUNICODE_CID, false, NULL, nsMacGurmukhiToUnicodeConstructor }, - { &kNS_MACGUJARATITOUNICODE_CID, false, NULL, nsMacGujaratiToUnicodeConstructor }, - { &kNS_MACHEBREWTOUNICODE_CID, false, NULL, nsMacHebrewToUnicodeConstructor }, - { &kNS_UNICODETOASCII_CID, false, NULL, nsUnicodeToAsciiConstructor }, - { &kNS_UNICODETOISO88592_CID, false, NULL, nsUnicodeToISO88592Constructor }, - { &kNS_UNICODETOISO88593_CID, false, NULL, nsUnicodeToISO88593Constructor }, - { &kNS_UNICODETOISO88594_CID, false, NULL, nsUnicodeToISO88594Constructor }, - { &kNS_UNICODETOISO88595_CID, false, NULL, nsUnicodeToISO88595Constructor }, - { &kNS_UNICODETOISO88596_CID, false, NULL, nsUnicodeToISO88596Constructor }, - { &kNS_UNICODETOISO88596I_CID, false, NULL, nsUnicodeToISO88596IConstructor }, - { &kNS_UNICODETOISO88596E_CID, false, NULL, nsUnicodeToISO88596EConstructor }, - { &kNS_UNICODETOISO88597_CID, false, NULL, nsUnicodeToISO88597Constructor }, - { &kNS_UNICODETOISO88598_CID, false, NULL, nsUnicodeToISO88598Constructor }, - { &kNS_UNICODETOISO88598I_CID, false, NULL, nsUnicodeToISO88598IConstructor }, - { &kNS_UNICODETOISO88598E_CID, false, NULL, nsUnicodeToISO88598EConstructor }, - { &kNS_UNICODETOISO88599_CID, false, NULL, nsUnicodeToISO88599Constructor }, - { &kNS_UNICODETOISO885910_CID, false, NULL, nsUnicodeToISO885910Constructor }, - { &kNS_UNICODETOISO885913_CID, false, NULL, nsUnicodeToISO885913Constructor }, - { &kNS_UNICODETOISO885914_CID, false, NULL, nsUnicodeToISO885914Constructor }, - { &kNS_UNICODETOISO885915_CID, false, NULL, nsUnicodeToISO885915Constructor }, - { &kNS_UNICODETOISO885916_CID, false, NULL, nsUnicodeToISO885916Constructor }, - { &kNS_UNICODETOISOIR111_CID, false, NULL, nsUnicodeToISOIR111Constructor }, - { &kNS_UNICODETOCP1250_CID, false, NULL, nsUnicodeToCP1250Constructor }, - { &kNS_UNICODETOCP1251_CID, false, NULL, nsUnicodeToCP1251Constructor }, - { &kNS_UNICODETOCP1253_CID, false, NULL, nsUnicodeToCP1253Constructor }, - { &kNS_UNICODETOCP1254_CID, false, NULL, nsUnicodeToCP1254Constructor }, - { &kNS_UNICODETOCP1255_CID, false, NULL, nsUnicodeToCP1255Constructor }, - { &kNS_UNICODETOCP1256_CID, false, NULL, nsUnicodeToCP1256Constructor }, - { &kNS_UNICODETOCP1257_CID, false, NULL, nsUnicodeToCP1257Constructor }, - { &kNS_UNICODETOCP1258_CID, false, NULL, nsUnicodeToCP1258Constructor }, - { &kNS_UNICODETOTIS620_CID, false, NULL, nsUnicodeToTIS620Constructor }, - { &kNS_UNICODETOISO885911_CID, false, NULL, nsUnicodeToISO885911Constructor }, - { &kNS_UNICODETOCP874_CID, false, NULL, nsUnicodeToCP874Constructor }, - { &kNS_UNICODETOCP866_CID, false, NULL, nsUnicodeToCP866Constructor }, - { &kNS_UNICODETOKOI8R_CID, false, NULL, nsUnicodeToKOI8RConstructor }, - { &kNS_UNICODETOKOI8U_CID, false, NULL, nsUnicodeToKOI8UConstructor }, - { &kNS_UNICODETOMACCE_CID, false, NULL, nsUnicodeToMacCEConstructor }, - { &kNS_UNICODETOMACGREEK_CID, false, NULL, nsUnicodeToMacGreekConstructor }, - { &kNS_UNICODETOMACTURKISH_CID, false, NULL, nsUnicodeToMacTurkishConstructor }, - { &kNS_UNICODETOMACCROATIAN_CID, false, NULL, nsUnicodeToMacCroatianConstructor }, - { &kNS_UNICODETOMACROMANIAN_CID, false, NULL, nsUnicodeToMacRomanianConstructor }, - { &kNS_UNICODETOMACCYRILLIC_CID, false, NULL, nsUnicodeToMacCyrillicConstructor }, - { &kNS_UNICODETOMACICELANDIC_CID, false, NULL, nsUnicodeToMacIcelandicConstructor }, - { &kNS_UNICODETOARMSCII8_CID, false, NULL, nsUnicodeToARMSCII8Constructor }, - { &kNS_UNICODETOTCVN5712_CID, false, NULL, nsUnicodeToTCVN5712Constructor }, - { &kNS_UNICODETOVISCII_CID, false, NULL, nsUnicodeToVISCIIConstructor }, - { &kNS_UNICODETOVPS_CID, false, NULL, nsUnicodeToVPSConstructor }, - { &kNS_UNICODETOUTF7_CID, false, NULL, nsUnicodeToUTF7Constructor }, - { &kNS_UNICODETOMUTF7_CID, false, NULL, nsUnicodeToMUTF7Constructor }, - { &kNS_UNICODETOUTF16BE_CID, false, NULL, nsUnicodeToUTF16BEConstructor }, - { &kNS_UNICODETOUTF16LE_CID, false, NULL, nsUnicodeToUTF16LEConstructor }, - { &kNS_UNICODETOUTF16_CID, false, NULL, nsUnicodeToUTF16Constructor }, - { &kNS_UNICODETOT61_CID, false, NULL, nsUnicodeToT61Constructor }, - { &kNS_UNICODETOUSERDEFINED_CID, false, NULL, nsUnicodeToUserDefinedConstructor }, - { &kNS_UNICODETOSYMBOL_CID, false, NULL, nsUnicodeToSymbolConstructor }, - { &kNS_UNICODETOZAPFDINGBATS_CID, false, NULL, nsUnicodeToZapfDingbatConstructor }, - { &kNS_UNICODETOADOBEEURO_CID, false, NULL, nsUnicodeToAdobeEuroConstructor }, - { &kNS_UNICODETOMACARABIC_CID, false, NULL, nsUnicodeToMacArabicConstructor }, - { &kNS_UNICODETOMACDEVANAGARI_CID, false, NULL, nsUnicodeToMacDevanagariConstructor }, - { &kNS_UNICODETOMACFARSI_CID, false, NULL, nsUnicodeToMacFarsiConstructor }, - { &kNS_UNICODETOMACGURMUKHI_CID, false, NULL, nsUnicodeToMacGurmukhiConstructor }, - { &kNS_UNICODETOMACGUJARATI_CID, false, NULL, nsUnicodeToMacGujaratiConstructor }, - { &kNS_UNICODETOMACHEBREW_CID, false, NULL, nsUnicodeToMacHebrewConstructor }, - { &kNS_UNICODETOTSCII_CID, false, NULL, nsUnicodeToTSCIIConstructor }, - { &kNS_UNICODETOTAMILTTF_CID, false, NULL, nsUnicodeToTamilTTFConstructor }, - { &kNS_CP850TOUNICODE_CID, false, NULL, nsCP850ToUnicodeConstructor }, - { &kNS_CP852TOUNICODE_CID, false, NULL, nsCP852ToUnicodeConstructor }, - { &kNS_CP855TOUNICODE_CID, false, NULL, nsCP855ToUnicodeConstructor }, - { &kNS_CP857TOUNICODE_CID, false, NULL, nsCP857ToUnicodeConstructor }, - { &kNS_CP862TOUNICODE_CID, false, NULL, nsCP862ToUnicodeConstructor }, - { &kNS_CP864TOUNICODE_CID, false, NULL, nsCP864ToUnicodeConstructor }, - { &kNS_CP864ITOUNICODE_CID, false, NULL, nsCP864iToUnicodeConstructor }, + { &kNS_ICHARSETCONVERTERMANAGER_CID, false, nullptr, nsCharsetConverterManagerConstructor }, + { &kNS_TEXTTOSUBURI_CID, false, nullptr, nsTextToSubURIConstructor }, + { &kNS_CONVERTERINPUTSTREAM_CID, false, nullptr, nsConverterInputStreamConstructor }, + { &kNS_CONVERTEROUTPUTSTREAM_CID, false, nullptr, nsConverterOutputStreamConstructor }, + { &kNS_ISCRIPTABLEUNICODECONVERTER_CID, false, nullptr, nsScriptableUnicodeConverterConstructor }, + { &kNS_UTF8CONVERTERSERVICE_CID, false, nullptr, nsUTF8ConverterServiceConstructor }, + { &kNS_ISO88591TOUNICODE_CID, false, nullptr, nsISO88591ToUnicodeConstructor }, + { &kNS_CP1252TOUNICODE_CID, false, nullptr, nsCP1252ToUnicodeConstructor }, + { &kNS_MACROMANTOUNICODE_CID, false, nullptr, nsMacRomanToUnicodeConstructor }, + { &kNS_UTF8TOUNICODE_CID, false, nullptr, nsUTF8ToUnicodeConstructor }, + { &kNS_UNICODETOISO88591_CID, false, nullptr, nsUnicodeToISO88591Constructor }, + { &kNS_UNICODETOCP1252_CID, false, nullptr, nsUnicodeToCP1252Constructor }, + { &kNS_UNICODETOMACROMAN_CID, false, nullptr, nsUnicodeToMacRomanConstructor }, + { &kNS_UNICODETOUTF8_CID, false, nullptr, nsUnicodeToUTF8Constructor }, + { &kNS_ASCIITOUNICODE_CID, false, nullptr, nsAsciiToUnicodeConstructor }, + { &kNS_ISO88592TOUNICODE_CID, false, nullptr, nsISO88592ToUnicodeConstructor }, + { &kNS_ISO88593TOUNICODE_CID, false, nullptr, nsISO88593ToUnicodeConstructor }, + { &kNS_ISO88594TOUNICODE_CID, false, nullptr, nsISO88594ToUnicodeConstructor }, + { &kNS_ISO88595TOUNICODE_CID, false, nullptr, nsISO88595ToUnicodeConstructor }, + { &kNS_ISO88596TOUNICODE_CID, false, nullptr, nsISO88596ToUnicodeConstructor }, + { &kNS_ISO88596ITOUNICODE_CID, false, nullptr, nsISO88596IToUnicodeConstructor }, + { &kNS_ISO88596ETOUNICODE_CID, false, nullptr, nsISO88596EToUnicodeConstructor }, + { &kNS_ISO88597TOUNICODE_CID, false, nullptr, nsISO88597ToUnicodeConstructor }, + { &kNS_ISO88598TOUNICODE_CID, false, nullptr, nsISO88598ToUnicodeConstructor }, + { &kNS_ISO88598ITOUNICODE_CID, false, nullptr, nsISO88598IToUnicodeConstructor }, + { &kNS_ISO88598ETOUNICODE_CID, false, nullptr, nsISO88598EToUnicodeConstructor }, + { &kNS_ISO88599TOUNICODE_CID, false, nullptr, nsISO88599ToUnicodeConstructor }, + { &kNS_ISO885910TOUNICODE_CID, false, nullptr, nsISO885910ToUnicodeConstructor }, + { &kNS_ISO885913TOUNICODE_CID, false, nullptr, nsISO885913ToUnicodeConstructor }, + { &kNS_ISO885914TOUNICODE_CID, false, nullptr, nsISO885914ToUnicodeConstructor }, + { &kNS_ISO885915TOUNICODE_CID, false, nullptr, nsISO885915ToUnicodeConstructor }, + { &kNS_ISO885916TOUNICODE_CID, false, nullptr, nsISO885916ToUnicodeConstructor }, + { &kNS_ISOIR111TOUNICODE_CID, false, nullptr, nsISOIR111ToUnicodeConstructor }, + { &kNS_CP1250TOUNICODE_CID, false, nullptr, nsCP1250ToUnicodeConstructor }, + { &kNS_CP1251TOUNICODE_CID, false, nullptr, nsCP1251ToUnicodeConstructor }, + { &kNS_CP1253TOUNICODE_CID, false, nullptr, nsCP1253ToUnicodeConstructor }, + { &kNS_CP1254TOUNICODE_CID, false, nullptr, nsCP1254ToUnicodeConstructor }, + { &kNS_CP1255TOUNICODE_CID, false, nullptr, nsCP1255ToUnicodeConstructor }, + { &kNS_CP1256TOUNICODE_CID, false, nullptr, nsCP1256ToUnicodeConstructor }, + { &kNS_CP1257TOUNICODE_CID, false, nullptr, nsCP1257ToUnicodeConstructor }, + { &kNS_CP1258TOUNICODE_CID, false, nullptr, nsCP1258ToUnicodeConstructor }, + { &kNS_TIS620TOUNICODE_CID, false, nullptr, nsTIS620ToUnicodeConstructor }, + { &kNS_ISO885911TOUNICODE_CID, false, nullptr, nsISO885911ToUnicodeConstructor }, + { &kNS_CP874TOUNICODE_CID, false, nullptr, nsCP874ToUnicodeConstructor }, + { &kNS_CP866TOUNICODE_CID, false, nullptr, nsCP866ToUnicodeConstructor }, + { &kNS_KOI8RTOUNICODE_CID, false, nullptr, nsKOI8RToUnicodeConstructor }, + { &kNS_KOI8UTOUNICODE_CID, false, nullptr, nsKOI8UToUnicodeConstructor }, + { &kNS_MACCETOUNICODE_CID, false, nullptr, nsMacCEToUnicodeConstructor }, + { &kNS_MACGREEKTOUNICODE_CID, false, nullptr, nsMacGreekToUnicodeConstructor }, + { &kNS_MACTURKISHTOUNICODE_CID, false, nullptr, nsMacTurkishToUnicodeConstructor }, + { &kNS_MACCROATIANTOUNICODE_CID, false, nullptr, nsMacCroatianToUnicodeConstructor }, + { &kNS_MACROMANIANTOUNICODE_CID, false, nullptr, nsMacRomanianToUnicodeConstructor }, + { &kNS_MACCYRILLICTOUNICODE_CID, false, nullptr, nsMacCyrillicToUnicodeConstructor }, + { &kNS_MACICELANDICTOUNICODE_CID, false, nullptr, nsMacIcelandicToUnicodeConstructor }, + { &kNS_ARMSCII8TOUNICODE_CID, false, nullptr, nsARMSCII8ToUnicodeConstructor }, + { &kNS_TCVN5712TOUNICODE_CID, false, nullptr, nsTCVN5712ToUnicodeConstructor }, + { &kNS_VISCIITOUNICODE_CID, false, nullptr, nsVISCIIToUnicodeConstructor }, + { &kNS_VPSTOUNICODE_CID, false, nullptr, nsVPSToUnicodeConstructor }, + { &kNS_UTF7TOUNICODE_CID, false, nullptr, nsUTF7ToUnicodeConstructor }, + { &kNS_MUTF7TOUNICODE_CID, false, nullptr, nsMUTF7ToUnicodeConstructor }, + { &kNS_UTF16TOUNICODE_CID, false, nullptr, nsUTF16ToUnicodeConstructor }, + { &kNS_UTF16BETOUNICODE_CID, false, nullptr, nsUTF16BEToUnicodeConstructor }, + { &kNS_UTF16LETOUNICODE_CID, false, nullptr, nsUTF16LEToUnicodeConstructor }, + { &kNS_T61TOUNICODE_CID, false, nullptr, nsT61ToUnicodeConstructor }, + { &kNS_USERDEFINEDTOUNICODE_CID, false, nullptr, nsUserDefinedToUnicodeConstructor }, + { &kNS_MACARABICTOUNICODE_CID, false, nullptr, nsMacArabicToUnicodeConstructor }, + { &kNS_MACDEVANAGARITOUNICODE_CID, false, nullptr, nsMacDevanagariToUnicodeConstructor }, + { &kNS_MACFARSITOUNICODE_CID, false, nullptr, nsMacFarsiToUnicodeConstructor }, + { &kNS_MACGURMUKHITOUNICODE_CID, false, nullptr, nsMacGurmukhiToUnicodeConstructor }, + { &kNS_MACGUJARATITOUNICODE_CID, false, nullptr, nsMacGujaratiToUnicodeConstructor }, + { &kNS_MACHEBREWTOUNICODE_CID, false, nullptr, nsMacHebrewToUnicodeConstructor }, + { &kNS_UNICODETOASCII_CID, false, nullptr, nsUnicodeToAsciiConstructor }, + { &kNS_UNICODETOISO88592_CID, false, nullptr, nsUnicodeToISO88592Constructor }, + { &kNS_UNICODETOISO88593_CID, false, nullptr, nsUnicodeToISO88593Constructor }, + { &kNS_UNICODETOISO88594_CID, false, nullptr, nsUnicodeToISO88594Constructor }, + { &kNS_UNICODETOISO88595_CID, false, nullptr, nsUnicodeToISO88595Constructor }, + { &kNS_UNICODETOISO88596_CID, false, nullptr, nsUnicodeToISO88596Constructor }, + { &kNS_UNICODETOISO88596I_CID, false, nullptr, nsUnicodeToISO88596IConstructor }, + { &kNS_UNICODETOISO88596E_CID, false, nullptr, nsUnicodeToISO88596EConstructor }, + { &kNS_UNICODETOISO88597_CID, false, nullptr, nsUnicodeToISO88597Constructor }, + { &kNS_UNICODETOISO88598_CID, false, nullptr, nsUnicodeToISO88598Constructor }, + { &kNS_UNICODETOISO88598I_CID, false, nullptr, nsUnicodeToISO88598IConstructor }, + { &kNS_UNICODETOISO88598E_CID, false, nullptr, nsUnicodeToISO88598EConstructor }, + { &kNS_UNICODETOISO88599_CID, false, nullptr, nsUnicodeToISO88599Constructor }, + { &kNS_UNICODETOISO885910_CID, false, nullptr, nsUnicodeToISO885910Constructor }, + { &kNS_UNICODETOISO885913_CID, false, nullptr, nsUnicodeToISO885913Constructor }, + { &kNS_UNICODETOISO885914_CID, false, nullptr, nsUnicodeToISO885914Constructor }, + { &kNS_UNICODETOISO885915_CID, false, nullptr, nsUnicodeToISO885915Constructor }, + { &kNS_UNICODETOISO885916_CID, false, nullptr, nsUnicodeToISO885916Constructor }, + { &kNS_UNICODETOISOIR111_CID, false, nullptr, nsUnicodeToISOIR111Constructor }, + { &kNS_UNICODETOCP1250_CID, false, nullptr, nsUnicodeToCP1250Constructor }, + { &kNS_UNICODETOCP1251_CID, false, nullptr, nsUnicodeToCP1251Constructor }, + { &kNS_UNICODETOCP1253_CID, false, nullptr, nsUnicodeToCP1253Constructor }, + { &kNS_UNICODETOCP1254_CID, false, nullptr, nsUnicodeToCP1254Constructor }, + { &kNS_UNICODETOCP1255_CID, false, nullptr, nsUnicodeToCP1255Constructor }, + { &kNS_UNICODETOCP1256_CID, false, nullptr, nsUnicodeToCP1256Constructor }, + { &kNS_UNICODETOCP1257_CID, false, nullptr, nsUnicodeToCP1257Constructor }, + { &kNS_UNICODETOCP1258_CID, false, nullptr, nsUnicodeToCP1258Constructor }, + { &kNS_UNICODETOTIS620_CID, false, nullptr, nsUnicodeToTIS620Constructor }, + { &kNS_UNICODETOISO885911_CID, false, nullptr, nsUnicodeToISO885911Constructor }, + { &kNS_UNICODETOCP874_CID, false, nullptr, nsUnicodeToCP874Constructor }, + { &kNS_UNICODETOCP866_CID, false, nullptr, nsUnicodeToCP866Constructor }, + { &kNS_UNICODETOKOI8R_CID, false, nullptr, nsUnicodeToKOI8RConstructor }, + { &kNS_UNICODETOKOI8U_CID, false, nullptr, nsUnicodeToKOI8UConstructor }, + { &kNS_UNICODETOMACCE_CID, false, nullptr, nsUnicodeToMacCEConstructor }, + { &kNS_UNICODETOMACGREEK_CID, false, nullptr, nsUnicodeToMacGreekConstructor }, + { &kNS_UNICODETOMACTURKISH_CID, false, nullptr, nsUnicodeToMacTurkishConstructor }, + { &kNS_UNICODETOMACCROATIAN_CID, false, nullptr, nsUnicodeToMacCroatianConstructor }, + { &kNS_UNICODETOMACROMANIAN_CID, false, nullptr, nsUnicodeToMacRomanianConstructor }, + { &kNS_UNICODETOMACCYRILLIC_CID, false, nullptr, nsUnicodeToMacCyrillicConstructor }, + { &kNS_UNICODETOMACICELANDIC_CID, false, nullptr, nsUnicodeToMacIcelandicConstructor }, + { &kNS_UNICODETOARMSCII8_CID, false, nullptr, nsUnicodeToARMSCII8Constructor }, + { &kNS_UNICODETOTCVN5712_CID, false, nullptr, nsUnicodeToTCVN5712Constructor }, + { &kNS_UNICODETOVISCII_CID, false, nullptr, nsUnicodeToVISCIIConstructor }, + { &kNS_UNICODETOVPS_CID, false, nullptr, nsUnicodeToVPSConstructor }, + { &kNS_UNICODETOUTF7_CID, false, nullptr, nsUnicodeToUTF7Constructor }, + { &kNS_UNICODETOMUTF7_CID, false, nullptr, nsUnicodeToMUTF7Constructor }, + { &kNS_UNICODETOUTF16BE_CID, false, nullptr, nsUnicodeToUTF16BEConstructor }, + { &kNS_UNICODETOUTF16LE_CID, false, nullptr, nsUnicodeToUTF16LEConstructor }, + { &kNS_UNICODETOUTF16_CID, false, nullptr, nsUnicodeToUTF16Constructor }, + { &kNS_UNICODETOT61_CID, false, nullptr, nsUnicodeToT61Constructor }, + { &kNS_UNICODETOUSERDEFINED_CID, false, nullptr, nsUnicodeToUserDefinedConstructor }, + { &kNS_UNICODETOSYMBOL_CID, false, nullptr, nsUnicodeToSymbolConstructor }, + { &kNS_UNICODETOZAPFDINGBATS_CID, false, nullptr, nsUnicodeToZapfDingbatConstructor }, + { &kNS_UNICODETOADOBEEURO_CID, false, nullptr, nsUnicodeToAdobeEuroConstructor }, + { &kNS_UNICODETOMACARABIC_CID, false, nullptr, nsUnicodeToMacArabicConstructor }, + { &kNS_UNICODETOMACDEVANAGARI_CID, false, nullptr, nsUnicodeToMacDevanagariConstructor }, + { &kNS_UNICODETOMACFARSI_CID, false, nullptr, nsUnicodeToMacFarsiConstructor }, + { &kNS_UNICODETOMACGURMUKHI_CID, false, nullptr, nsUnicodeToMacGurmukhiConstructor }, + { &kNS_UNICODETOMACGUJARATI_CID, false, nullptr, nsUnicodeToMacGujaratiConstructor }, + { &kNS_UNICODETOMACHEBREW_CID, false, nullptr, nsUnicodeToMacHebrewConstructor }, + { &kNS_UNICODETOTSCII_CID, false, nullptr, nsUnicodeToTSCIIConstructor }, + { &kNS_UNICODETOTAMILTTF_CID, false, nullptr, nsUnicodeToTamilTTFConstructor }, + { &kNS_CP850TOUNICODE_CID, false, nullptr, nsCP850ToUnicodeConstructor }, + { &kNS_CP852TOUNICODE_CID, false, nullptr, nsCP852ToUnicodeConstructor }, + { &kNS_CP855TOUNICODE_CID, false, nullptr, nsCP855ToUnicodeConstructor }, + { &kNS_CP857TOUNICODE_CID, false, nullptr, nsCP857ToUnicodeConstructor }, + { &kNS_CP862TOUNICODE_CID, false, nullptr, nsCP862ToUnicodeConstructor }, + { &kNS_CP864TOUNICODE_CID, false, nullptr, nsCP864ToUnicodeConstructor }, + { &kNS_CP864ITOUNICODE_CID, false, nullptr, nsCP864iToUnicodeConstructor }, #ifdef XP_OS2 - { &kNS_CP869TOUNICODE_CID, false, NULL, nsCP869ToUnicodeConstructor }, - { &kNS_CP1125TOUNICODE_CID, false, NULL, nsCP1125ToUnicodeConstructor }, - { &kNS_CP1131TOUNICODE_CID, false, NULL, nsCP1131ToUnicodeConstructor }, + { &kNS_CP869TOUNICODE_CID, false, nullptr, nsCP869ToUnicodeConstructor }, + { &kNS_CP1125TOUNICODE_CID, false, nullptr, nsCP1125ToUnicodeConstructor }, + { &kNS_CP1131TOUNICODE_CID, false, nullptr, nsCP1131ToUnicodeConstructor }, #endif - { &kNS_UNICODETOCP850_CID, false, NULL, nsUnicodeToCP850Constructor }, - { &kNS_UNICODETOCP852_CID, false, NULL, nsUnicodeToCP852Constructor }, - { &kNS_UNICODETOCP855_CID, false, NULL, nsUnicodeToCP855Constructor }, - { &kNS_UNICODETOCP857_CID, false, NULL, nsUnicodeToCP857Constructor }, - { &kNS_UNICODETOCP862_CID, false, NULL, nsUnicodeToCP862Constructor }, - { &kNS_UNICODETOCP864_CID, false, NULL, nsUnicodeToCP864Constructor }, - { &kNS_UNICODETOCP864I_CID, false, NULL, nsUnicodeToCP864iConstructor }, + { &kNS_UNICODETOCP850_CID, false, nullptr, nsUnicodeToCP850Constructor }, + { &kNS_UNICODETOCP852_CID, false, nullptr, nsUnicodeToCP852Constructor }, + { &kNS_UNICODETOCP855_CID, false, nullptr, nsUnicodeToCP855Constructor }, + { &kNS_UNICODETOCP857_CID, false, nullptr, nsUnicodeToCP857Constructor }, + { &kNS_UNICODETOCP862_CID, false, nullptr, nsUnicodeToCP862Constructor }, + { &kNS_UNICODETOCP864_CID, false, nullptr, nsUnicodeToCP864Constructor }, + { &kNS_UNICODETOCP864I_CID, false, nullptr, nsUnicodeToCP864iConstructor }, #ifdef XP_OS2 - { &kNS_UNICODETOCP869_CID, false, NULL, nsUnicodeToCP869Constructor }, - { &kNS_UNICODETOCP1125_CID, false, NULL, nsUnicodeToCP1125Constructor }, - { &kNS_UNICODETOCP1131_CID, false, NULL, nsUnicodeToCP1131Constructor }, + { &kNS_UNICODETOCP869_CID, false, nullptr, nsUnicodeToCP869Constructor }, + { &kNS_UNICODETOCP1125_CID, false, nullptr, nsUnicodeToCP1125Constructor }, + { &kNS_UNICODETOCP1131_CID, false, nullptr, nsUnicodeToCP1131Constructor }, #endif - { &kNS_SJISTOUNICODE_CID, false, NULL, nsShiftJISToUnicodeConstructor }, - { &kNS_EUCJPTOUNICODE_CID, false, NULL, nsEUCJPToUnicodeV2Constructor }, - { &kNS_ISO2022JPTOUNICODE_CID, false, NULL, nsISO2022JPToUnicodeV2Constructor }, - { &kNS_UNICODETOSJIS_CID, false, NULL, nsUnicodeToSJISConstructor }, - { &kNS_UNICODETOEUCJP_CID, false, NULL, nsUnicodeToEUCJPConstructor }, - { &kNS_UNICODETOISO2022JP_CID, false, NULL, nsUnicodeToISO2022JPConstructor }, - { &kNS_UNICODETOJISX0201_CID, false, NULL, nsUnicodeToJISx0201Constructor }, - { &kNS_EUCTWTOUNICODE_CID, false, NULL, nsEUCTWToUnicodeConstructor }, - { &kNS_UNICODETOEUCTW_CID, false, NULL, nsUnicodeToEUCTWConstructor }, - { &kNS_UNICODETOBIG5_CID, false, NULL, nsUnicodeToBIG5Constructor }, - { &kNS_BIG5TOUNICODE_CID, false, NULL, nsBIG5ToUnicodeConstructor }, - { &kNS_UNICODETOBIG5HKSCS_CID, false, NULL, nsUnicodeToBIG5HKSCSConstructor }, - { &kNS_UNICODETOHKSCS_CID, false, NULL, nsUnicodeToHKSCSConstructor }, - { &kNS_BIG5HKSCSTOUNICODE_CID, false, NULL, nsBIG5HKSCSToUnicodeConstructor }, - { &kNS_EUCKRTOUNICODE_CID, false, NULL, nsEUCKRToUnicodeConstructor }, - { &kNS_UNICODETOEUCKR_CID, false, NULL, nsUnicodeToEUCKRConstructor }, - { &kNS_JOHABTOUNICODE_CID, false, NULL, nsJohabToUnicodeConstructor }, - { &kNS_UNICODETOJOHAB_CID, false, NULL, nsUnicodeToJohabConstructor }, - { &kNS_CP949TOUNICODE_CID, false, NULL, nsCP949ToUnicodeConstructor }, - { &kNS_UNICODETOCP949_CID, false, NULL, nsUnicodeToCP949Constructor }, - { &kNS_ISO2022KRTOUNICODE_CID, false, NULL, nsISO2022KRToUnicodeConstructor }, - { &kNS_GB2312TOUNICODE_CID, false, NULL, nsGB2312ToUnicodeV2Constructor }, - { &kNS_UNICODETOGB2312_CID, false, NULL, nsUnicodeToGB2312V2Constructor }, - { &kNS_GBKTOUNICODE_CID, false, NULL, nsGBKToUnicodeConstructor }, - { &kNS_UNICODETOGBK_CID, false, NULL, nsUnicodeToGBKConstructor }, - { &kNS_HZTOUNICODE_CID, false, NULL, nsHZToUnicodeConstructor }, - { &kNS_UNICODETOHZ_CID, false, NULL, nsUnicodeToHZConstructor }, - { &kNS_GB18030TOUNICODE_CID, false, NULL, nsGB18030ToUnicodeConstructor }, - { &kNS_UNICODETOGB18030_CID, false, NULL, nsUnicodeToGB18030Constructor }, - { &kNS_ISO2022CNTOUNICODE_CID, false, NULL, nsISO2022CNToUnicodeConstructor }, - { NULL }, + { &kNS_SJISTOUNICODE_CID, false, nullptr, nsShiftJISToUnicodeConstructor }, + { &kNS_EUCJPTOUNICODE_CID, false, nullptr, nsEUCJPToUnicodeV2Constructor }, + { &kNS_ISO2022JPTOUNICODE_CID, false, nullptr, nsISO2022JPToUnicodeV2Constructor }, + { &kNS_UNICODETOSJIS_CID, false, nullptr, nsUnicodeToSJISConstructor }, + { &kNS_UNICODETOEUCJP_CID, false, nullptr, nsUnicodeToEUCJPConstructor }, + { &kNS_UNICODETOISO2022JP_CID, false, nullptr, nsUnicodeToISO2022JPConstructor }, + { &kNS_UNICODETOJISX0201_CID, false, nullptr, nsUnicodeToJISx0201Constructor }, + { &kNS_EUCTWTOUNICODE_CID, false, nullptr, nsEUCTWToUnicodeConstructor }, + { &kNS_UNICODETOEUCTW_CID, false, nullptr, nsUnicodeToEUCTWConstructor }, + { &kNS_UNICODETOBIG5_CID, false, nullptr, nsUnicodeToBIG5Constructor }, + { &kNS_BIG5TOUNICODE_CID, false, nullptr, nsBIG5ToUnicodeConstructor }, + { &kNS_UNICODETOBIG5HKSCS_CID, false, nullptr, nsUnicodeToBIG5HKSCSConstructor }, + { &kNS_UNICODETOHKSCS_CID, false, nullptr, nsUnicodeToHKSCSConstructor }, + { &kNS_BIG5HKSCSTOUNICODE_CID, false, nullptr, nsBIG5HKSCSToUnicodeConstructor }, + { &kNS_EUCKRTOUNICODE_CID, false, nullptr, nsEUCKRToUnicodeConstructor }, + { &kNS_UNICODETOEUCKR_CID, false, nullptr, nsUnicodeToEUCKRConstructor }, + { &kNS_JOHABTOUNICODE_CID, false, nullptr, nsJohabToUnicodeConstructor }, + { &kNS_UNICODETOJOHAB_CID, false, nullptr, nsUnicodeToJohabConstructor }, + { &kNS_CP949TOUNICODE_CID, false, nullptr, nsCP949ToUnicodeConstructor }, + { &kNS_UNICODETOCP949_CID, false, nullptr, nsUnicodeToCP949Constructor }, + { &kNS_ISO2022KRTOUNICODE_CID, false, nullptr, nsISO2022KRToUnicodeConstructor }, + { &kNS_GB2312TOUNICODE_CID, false, nullptr, nsGB2312ToUnicodeV2Constructor }, + { &kNS_UNICODETOGB2312_CID, false, nullptr, nsUnicodeToGB2312V2Constructor }, + { &kNS_GBKTOUNICODE_CID, false, nullptr, nsGBKToUnicodeConstructor }, + { &kNS_UNICODETOGBK_CID, false, nullptr, nsUnicodeToGBKConstructor }, + { &kNS_HZTOUNICODE_CID, false, nullptr, nsHZToUnicodeConstructor }, + { &kNS_UNICODETOHZ_CID, false, nullptr, nsUnicodeToHZConstructor }, + { &kNS_GB18030TOUNICODE_CID, false, nullptr, nsGB18030ToUnicodeConstructor }, + { &kNS_UNICODETOGB18030_CID, false, nullptr, nsUnicodeToGB18030Constructor }, + { &kNS_ISO2022CNTOUNICODE_CID, false, nullptr, nsISO2022CNToUnicodeConstructor }, + { nullptr }, }; static const mozilla::Module::ContractIDEntry kUConvContracts[] = { @@ -1092,7 +1092,7 @@ static const mozilla::Module::ContractIDEntry kUConvContracts[] = { { NS_UNICODEDECODER_CONTRACTID_BASE "gb18030", &kNS_GB18030TOUNICODE_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "gb18030", &kNS_UNICODETOGB18030_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "ISO-2022-CN", &kNS_ISO2022CNTOUNICODE_CID }, - { NULL } + { nullptr } }; static const mozilla::Module kUConvModule = { diff --git a/intl/uconv/tests/TestUConv.cpp b/intl/uconv/tests/TestUConv.cpp index 4ad7c944d0e1..8d454a3f63c1 100644 --- a/intl/uconv/tests/TestUConv.cpp +++ b/intl/uconv/tests/TestUConv.cpp @@ -336,7 +336,7 @@ nsresult nsTestUConv::DisplayCharsets() PrintSpaces(24 - charset.Length()); // align to hard coded column number - nsCOMPtr dec = NULL; + nsCOMPtr dec; res = ccMan->GetUnicodeDecoder(charset.get(), getter_AddRefs(dec)); if (NS_FAILED(res)) printf (" "); else { @@ -356,7 +356,7 @@ nsresult nsTestUConv::DisplayCharsets() else printf(" "); #endif - nsCOMPtr enc = NULL; + nsCOMPtr enc; res = ccMan->GetUnicodeEncoder(charset.get(), getter_AddRefs(enc)); if (NS_FAILED(res)) printf (" "); else { @@ -380,22 +380,22 @@ nsresult nsTestUConv::DisplayCharsets() prop.AssignLiteral(".notForBrowser"); res = ccMan->GetCharsetData(charset.get(), prop.get(), str); - if ((dec != NULL) && (NS_FAILED(res))) printf ("B"); + if (dec && (NS_FAILED(res))) printf ("B"); else printf("X"); prop.AssignLiteral(".notForComposer"); res = ccMan->GetCharsetData(charset.get(), prop.get(), str); - if ((enc != NULL) && (NS_FAILED(res))) printf ("C"); + if (enc && (NS_FAILED(res))) printf ("C"); else printf("X"); prop.AssignLiteral(".notForMailView"); res = ccMan->GetCharsetData(charset.get(), prop.get(), str); - if ((dec != NULL) && (NS_FAILED(res))) printf ("V"); + if (dec && (NS_FAILED(res))) printf ("V"); else printf("X"); prop.AssignLiteral(".notForMailEdit"); res = ccMan->GetCharsetData(charset.get(), prop.get(), str); - if ((enc != NULL) && (NS_FAILED(res))) printf ("E"); + if (enc && (NS_FAILED(res))) printf ("E"); else printf("X"); printf("(%3d, %3d) ", encCount, decCount); diff --git a/intl/uconv/tests/convperf.cpp b/intl/uconv/tests/convperf.cpp index 8d86464db445..18c03ad6ab83 100644 --- a/intl/uconv/tests/convperf.cpp +++ b/intl/uconv/tests/convperf.cpp @@ -115,7 +115,7 @@ int main(int argc, const char** argv) if(argc == 6) { infile = fopen(argv[5], "rb"); - if(NULL == infile) + if (!infile) { usage(); fprintf(stderr,"cannot open file %s\n", argv[5]); diff --git a/intl/uconv/tests/nsTestUConv.cpp b/intl/uconv/tests/nsTestUConv.cpp index a31da194987c..e1cb208b7b25 100644 --- a/intl/uconv/tests/nsTestUConv.cpp +++ b/intl/uconv/tests/nsTestUConv.cpp @@ -42,7 +42,7 @@ static NS_DEFINE_CID(kPlatformCharsetCID, NS_PLATFORMCHARSET_CID); #define ARRAY_SIZE(_array) \ (sizeof(_array) / sizeof(_array[0])) -nsICharsetConverterManager * ccMan = NULL; +nsICharsetConverterManager * ccMan = nullptr; /** * Test data for Latin1 charset. @@ -436,7 +436,7 @@ nsresult standardDecoderTest(char * aTestName, char * aCharset, char * aSrc, nsresult loadBinaryFile(char * aFile, char * aBuff, int32_t * aBuffLen) { FILE * f = fopen(aFile, "rb"); - if (f == NULL) { + if (!f) { printf("ERROR at opening file: \"%s\".\n", aFile); return NS_ERROR_UNEXPECTED; } @@ -793,7 +793,7 @@ nsresult testLatin1Encoder() // create converter CREATE_ENCODER("iso-8859-1"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = {0x0001,0x0002,0xffff,0x00e3}; @@ -830,7 +830,7 @@ nsresult testSJISEncoder() // create converter CREATE_ENCODER("Shift_JIS"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = { @@ -879,7 +879,7 @@ nsresult testEUCJPEncoder() // create converter CREATE_ENCODER("euc-jp"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = {0x0045, 0x0054}; @@ -916,7 +916,7 @@ nsresult testISO2022JPEncoder() // create converter CREATE_ENCODER("iso-2022-jp"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = {0x000d,0x007f, 0xff6a,0xFF9C, 0x3000, 0x5378}; @@ -953,7 +953,7 @@ nsresult testMUTF7Encoder() // create converter CREATE_ENCODER("x-imap4-modified-utf7"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = {0x0050,0x0051,0x0052,0x0053,0x0000,0x0000,0x0000,'&',0x0000}; @@ -990,7 +990,7 @@ nsresult testUTF7Encoder() // create converter CREATE_ENCODER("utf-7"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = {'e','t','i','r','a',0x0a}; diff --git a/intl/uconv/tests/nsconv.cpp b/intl/uconv/tests/nsconv.cpp index 087ad8139787..a90bdf0a1d69 100644 --- a/intl/uconv/tests/nsconv.cpp +++ b/intl/uconv/tests/nsconv.cpp @@ -115,7 +115,7 @@ int main(int argc, const char** argv) // The user has specified an input file // if we have more than four arguments fin = infile = fopen(argv[5], "rb"); - if(NULL == infile) + if(!infile) { usage(); fprintf(stderr,"cannot open input file %s\n", argv[5]); @@ -127,7 +127,7 @@ int main(int argc, const char** argv) // The user has specified an output file // if we have more than four arguments fout = outfile = fopen(argv[6], "ab"); - if(NULL == outfile) + if(!outfile) { usage(); fprintf(stderr,"cannot open output file %s\n", argv[6]); diff --git a/intl/uconv/tools/umaptable.c b/intl/uconv/tools/umaptable.c index 007aa1b28d1b..b27b96491054 100644 --- a/intl/uconv/tools/umaptable.c +++ b/intl/uconv/tools/umaptable.c @@ -428,7 +428,7 @@ void getinput() { char buf[256]; short c,u; - for(;gets(buf)!=NULL;) + for (; gets(buf);) { if(buf[0]=='0' && buf[1] == 'x') { diff --git a/intl/uconv/util/nsUCSupport.cpp b/intl/uconv/util/nsUCSupport.cpp index c49dc16fdfd5..f0d2a42dc383 100644 --- a/intl/uconv/util/nsUCSupport.cpp +++ b/intl/uconv/util/nsUCSupport.cpp @@ -539,7 +539,7 @@ NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior( nsIUnicharEncoder * aEncoder, PRUnichar aChar) { - if (aBehavior == kOnError_CallBack && aEncoder == nullptr) + if (aBehavior == kOnError_CallBack && !aEncoder) return NS_ERROR_NULL_POINTER; mErrEncoder = aEncoder; diff --git a/intl/uconv/util/nsUnicodeDecodeHelper.cpp b/intl/uconv/util/nsUnicodeDecodeHelper.cpp index eb4e2339f3fe..09b37a27ea59 100644 --- a/intl/uconv/util/nsUnicodeDecodeHelper.cpp +++ b/intl/uconv/util/nsUnicodeDecodeHelper.cpp @@ -7,6 +7,7 @@ #include "unicpriv.h" #include "nsIUnicodeDecoder.h" #include "nsUnicodeDecodeHelper.h" +#include "nsAutoPtr.h" //---------------------------------------------------------------------- // Class nsUnicodeDecodeHelper [implementation] @@ -33,11 +34,11 @@ nsresult nsUnicodeDecodeHelper::ConvertByTable( bool charFound; if (aScanClass == uMultibytesCharset) { NS_ASSERTION(aShiftInTable, "shift table missing"); - charFound = uScanShift(aShiftInTable, NULL, (uint8_t *)src, + charFound = uScanShift(aShiftInTable, nullptr, (uint8_t *)src, reinterpret_cast(&med), srcLen, (uint32_t *)&bcr); } else { - charFound = uScan(aScanClass, NULL, (uint8_t *)src, + charFound = uScan(aScanClass, nullptr, (uint8_t *)src, reinterpret_cast(&med), srcLen, (uint32_t *)&bcr); } @@ -103,7 +104,7 @@ nsresult nsUnicodeDecodeHelper::ConvertByMultiTable( if ((aRangeArray[i].min <= *src) && (*src <= aRangeArray[i].max)) { passRangeCheck = true; - if (uScan(aScanClassArray[i], NULL, src, + if (uScan(aScanClassArray[i], nullptr, src, reinterpret_cast(&med), srcLen, (uint32_t *)&bcr)) { @@ -136,7 +137,7 @@ nsresult nsUnicodeDecodeHelper::ConvertByMultiTable( { if ((aRangeArray[i].min <= *src) && (*src <= aRangeArray[i].max)) { - if (uScan(aScanClassArray[i], NULL, src, + if (uScan(aScanClassArray[i], nullptr, src, reinterpret_cast(&med), srcLen, (uint32_t*)&bcr)) { @@ -225,15 +226,11 @@ nsresult nsUnicodeDecodeHelper::CreateFastTable( { int32_t tableSize = aTableSize; int32_t buffSize = aTableSize; - char * buff = new char [buffSize]; - if (buff == NULL) return NS_ERROR_OUT_OF_MEMORY; + nsAutoArrayPtr buff(new char [buffSize]); char * p = buff; for (int32_t i=0; i nsEntityConverter::LoadEntityBundle(uint32_t version) { nsCAutoString url(NS_LITERAL_CSTRING("resource://gre/res/entityTables/")); - const PRUnichar *versionName = NULL; nsresult rv; nsCOMPtr bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); - if (NS_FAILED(rv)) return NULL; + NS_ENSURE_SUCCESS(rv, nullptr); - versionName = GetVersionName(version); - if (NULL == versionName) return NULL; + const PRUnichar *versionName = GetVersionName(version); + NS_ENSURE_TRUE(versionName, nullptr); // all property file names are ASCII, like "html40Latin1" so this is safe LossyAppendUTF16toASCII(versionName, url); @@ -94,7 +94,7 @@ nsEntityConverter::LoadEntityBundle(uint32_t version) nsIStringBundle* bundle; rv = bundleService->CreateBundle(url.get(), &bundle); - if (NS_FAILED(rv)) return NULL; + NS_ENSURE_SUCCESS(rv, nullptr); // does this addref right? return bundle; @@ -108,17 +108,17 @@ nsEntityConverter:: GetVersionName(uint32_t versionNumber) return mVersionList[i].mEntityListName; } - return NULL; + return nullptr; } nsIStringBundle* nsEntityConverter:: GetVersionBundleInstance(uint32_t versionNumber) { - if (NULL == mVersionList) { + if (!mVersionList) { // load the property file which contains available version names // and generate a list of version/name pair - nsresult rv = LoadVersionPropertyFile(); - if (NS_FAILED(rv)) return NULL; + if (NS_FAILED(LoadVersionPropertyFile())) + return nullptr; } uint32_t i; @@ -134,7 +134,7 @@ nsEntityConverter:: GetVersionBundleInstance(uint32_t versionNumber) } } - return NULL; + return nullptr; } @@ -159,7 +159,7 @@ nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersi NS_ASSERTION(_retval, "null ptr- _retval"); if(nullptr == _retval) return NS_ERROR_NULL_POINTER; - *_retval = NULL; + *_retval = nullptr; for (uint32_t mask = 1, mask2 = 0xFFFFFFFFL; (0!=(entityVersion & mask2)); mask<<=1, mask2<<=1) { if (0 == (entityVersion & mask)) @@ -167,7 +167,7 @@ nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersi nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask); NS_ASSERTION(entities, "Cannot get the property file"); - if (NULL == entities) + if (!entities) continue; nsAutoString key(NS_LITERAL_STRING("entity.")); @@ -189,13 +189,11 @@ nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersi NS_IMETHODIMP nsEntityConverter::ConvertToEntities(const PRUnichar *inString, uint32_t entityVersion, PRUnichar **_retval) { - NS_ASSERTION(inString, "null ptr- inString"); - NS_ASSERTION(_retval, "null ptr- _retval"); - if((nullptr == inString) || (nullptr == _retval)) - return NS_ERROR_NULL_POINTER; - *_retval = NULL; + NS_ENSURE_ARG_POINTER(inString); + NS_ENSURE_ARG_POINTER(_retval); + + *_retval = nullptr; - const PRUnichar *entity = NULL; nsString outString; // per character look for the entity @@ -213,15 +211,15 @@ nsEntityConverter::ConvertToEntities(const PRUnichar *inString, uint32_t entityV } nsXPIDLString value; - - entity = NULL; + const PRUnichar *entity = nullptr; + for (uint32_t mask = 1, mask2 = 0xFFFFFFFFL; (0!=(entityVersion & mask2)); mask<<=1, mask2<<=1) { if (0 == (entityVersion & mask)) continue; nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask); NS_ASSERTION(entities, "Cannot get the property file"); - if (NULL == entities) + if (!entities) continue; nsresult rv = entities->GetStringFromName(key.get(), @@ -231,7 +229,7 @@ nsEntityConverter::ConvertToEntities(const PRUnichar *inString, uint32_t entityV break; } } - if (NULL != entity) { + if (entity) { outString.Append(entity); } else { @@ -240,7 +238,7 @@ nsEntityConverter::ConvertToEntities(const PRUnichar *inString, uint32_t entityV } *_retval = ToNewUnicode(outString); - if (NULL == *_retval) + if (!*_retval) return NS_ERROR_OUT_OF_MEMORY; return NS_OK; diff --git a/intl/unicharutil/src/nsEntityConverter.h b/intl/unicharutil/src/nsEntityConverter.h index d5dce083a5f0..a8079a451519 100644 --- a/intl/unicharutil/src/nsEntityConverter.h +++ b/intl/unicharutil/src/nsEntityConverter.h @@ -16,7 +16,7 @@ class nsEntityVersionList { public: - nsEntityVersionList() : mEntities(NULL) {} + nsEntityVersionList() {} uint32_t mVersion; PRUnichar mEntityListName[kVERSION_STRING_LEN+1]; diff --git a/intl/unicharutil/src/nsSaveAsCharset.cpp b/intl/unicharutil/src/nsSaveAsCharset.cpp index a24f8488a0d1..bf7d7ecd1b4c 100644 --- a/intl/unicharutil/src/nsSaveAsCharset.cpp +++ b/intl/unicharutil/src/nsSaveAsCharset.cpp @@ -59,10 +59,8 @@ nsSaveAsCharset::Init(const char *charset, uint32_t attr, uint32_t entityVersion NS_IMETHODIMP nsSaveAsCharset::Convert(const PRUnichar *inString, char **_retval) { - if (nullptr == _retval) - return NS_ERROR_NULL_POINTER; - if (nullptr == inString) - return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(_retval); + NS_ENSURE_ARG_POINTER(inString); if (0 == *inString) return NS_ERROR_ILLEGAL_VALUE; nsresult rv = NS_OK; @@ -135,8 +133,10 @@ NS_IMETHODIMP nsSaveAsCharset::HandleFallBack(uint32_t character, char **outString, int32_t *bufferLength, int32_t *currentPos, int32_t estimatedLength) { - if((nullptr == outString ) || (nullptr == bufferLength) ||(nullptr ==currentPos)) - return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(outString); + NS_ENSURE_ARG_POINTER(bufferLength); + NS_ENSURE_ARG_POINTER(currentPos); + char fallbackStr[256]; nsresult rv = DoConversionFallBack(character, fallbackStr, 256); if (NS_SUCCEEDED(rv)) { @@ -145,12 +145,12 @@ nsSaveAsCharset::HandleFallBack(uint32_t character, char **outString, int32_t *b // reallocate if the buffer is not large enough if ((tempLen + estimatedLength) >= (*bufferLength - *currentPos)) { char *temp = (char *) PR_Realloc(*outString, *bufferLength + tempLen); - if (NULL != temp) { + if (temp) { // adjust length/pointer after realloc *bufferLength += tempLen; *outString = temp; } else { - *outString = NULL; + *outString = nullptr; *bufferLength =0; return NS_ERROR_OUT_OF_MEMORY; } @@ -164,18 +164,15 @@ nsSaveAsCharset::HandleFallBack(uint32_t character, char **outString, int32_t *b NS_IMETHODIMP nsSaveAsCharset::DoCharsetConversion(const PRUnichar *inString, char **outString) { - if(nullptr == outString ) - return NS_ERROR_NULL_POINTER; - NS_ASSERTION(outString, "invalid input"); + NS_ENSURE_ARG_POINTER(outString); - *outString = NULL; + *outString = nullptr; nsresult rv; int32_t inStringLength = NS_strlen(inString); // original input string length int32_t bufferLength; // allocated buffer length int32_t srcLength = inStringLength; int32_t dstLength; - char *dstPtr = NULL; int32_t pos1, pos2; nsresult saveResult = NS_OK; // to remember NS_ERROR_UENC_NOMAPPING @@ -184,9 +181,7 @@ nsSaveAsCharset::DoCharsetConversion(const PRUnichar *inString, char **outString if (NS_FAILED(rv)) return rv; bufferLength = dstLength + 512; // reserve 512 byte for fallback. - dstPtr = (char *) PR_Malloc(bufferLength); - if (NULL == dstPtr) return NS_ERROR_OUT_OF_MEMORY; - + char *dstPtr = (char *) PR_Malloc(bufferLength); for (pos1 = 0, pos2 = 0; pos1 < inStringLength;) { // convert from unicode @@ -264,9 +259,7 @@ nsSaveAsCharset::DoCharsetConversion(const PRUnichar *inString, char **outString NS_IMETHODIMP nsSaveAsCharset::DoConversionFallBack(uint32_t inUCS4, char *outString, int32_t bufferLength) { - NS_ASSERTION(outString, "invalid input"); - if(nullptr == outString ) - return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(outString); *outString = '\0'; @@ -276,10 +269,10 @@ nsSaveAsCharset::DoConversionFallBack(uint32_t inUCS4, char *outString, int32_t return NS_OK; } if (attr_EntityAfterCharsetConv == MASK_ENTITY(mAttribute)) { - char *entity = NULL; + char *entity = nullptr; rv = mEntityConverter->ConvertUTF32ToEntity(inUCS4, mEntityVersion, &entity); if (NS_SUCCEEDED(rv)) { - if (NULL == entity || (int32_t)strlen(entity) > bufferLength) { + if (!entity || (int32_t)strlen(entity) > bufferLength) { return NS_ERROR_OUT_OF_MEMORY; } PL_strcpy(outString, entity); diff --git a/intl/unicharutil/src/nsUnicodeNormalizer.cpp b/intl/unicharutil/src/nsUnicodeNormalizer.cpp index 0a87cca8a492..e82cb87790c7 100644 --- a/intl/unicharutil/src/nsUnicodeNormalizer.cpp +++ b/intl/unicharutil/src/nsUnicodeNormalizer.cpp @@ -156,7 +156,7 @@ mdn__unicode_decompose(int32_t compat, uint32_t *v, size_t vlen, int32_t seqidx; const uint32_t *seq; - //assert(v != NULL && vlen >= 0 && decomp_lenp != NULL); + //assert(v != nullptr && vlen >= 0 && decomp_lenp != nullptr); /* * First, check for Hangul. @@ -247,7 +247,7 @@ mdn__unicode_compose(uint32_t c1, uint32_t c2, uint32_t *compp) int32_t lo, hi; const struct composition *cseq; - //assert(compp != NULL); + //assert(compp != nullptr); /* * Check for Hangul. @@ -480,7 +480,7 @@ reorder(workbuf_t *wb) { int32_t i; int32_t cclass; - //assert(wb != NULL); + //assert(wb != nullptr); i = wb->cur; c = wb->ucs[i]; @@ -504,7 +504,7 @@ compose(workbuf_t *wb) { int32_t nvoids; int32_t i; - //assert(wb != NULL && wb->cclass[0] == 0); + //assert(wb != nullptr && wb->cclass[0] == 0); cur = wb->cur; ucs = wb->ucs; @@ -591,7 +591,7 @@ workbuf_extend(workbuf_t *wb) { wb->cclass = (int32_t*)nsMemory::Alloc(sizeof(wb->cclass[0]) * newsize); if (!wb->cclass) { nsMemory::Free(wb->ucs); - wb->ucs = NULL; + wb->ucs = nullptr; return NS_ERROR_OUT_OF_MEMORY; } } else { @@ -621,7 +621,7 @@ static void workbuf_shift(workbuf_t *wb, int32_t shift) { int32_t nmove; - //assert(wb != NULL && wb->cur >= shift); + //assert(wb != nullptr && wb->cur >= shift); nmove = wb->last - shift; memmove(&wb->ucs[0], &wb->ucs[shift], diff --git a/intl/unicharutil/tests/NormalizationTest.cpp b/intl/unicharutil/tests/NormalizationTest.cpp index 400deb9d04c0..af0398154ff9 100644 --- a/intl/unicharutil/tests/NormalizationTest.cpp +++ b/intl/unicharutil/tests/NormalizationTest.cpp @@ -279,11 +279,11 @@ int main(int argc, char** argv) { return 1; } - normalizer = NULL; + normalizer = nullptr; nsresult res; res = CallGetService(kUnicodeNormalizerCID, &normalizer); - if(NS_FAILED(res) || ( normalizer == NULL ) ) { + if(NS_FAILED(res) || !normalizer) { printf("GetService failed\n"); return 1; } diff --git a/intl/unicharutil/tests/UnicharSelfTest.cpp b/intl/unicharutil/tests/UnicharSelfTest.cpp index 764486b1a978..af3fb8fc6355 100644 --- a/intl/unicharutil/tests/UnicharSelfTest.cpp +++ b/intl/unicharutil/tests/UnicharSelfTest.cpp @@ -509,9 +509,9 @@ static void TestEntityConversion(uint32_t version) // convert char by char for (i = 0; i < length; i++) { - char *entity = NULL; + char *entity = nullptr; res = entityConv->ConvertToEntity(data[i], version, &entity); - if (NS_SUCCEEDED(res) && NULL != entity) { + if (NS_SUCCEEDED(res) && entity) { printf("%c %s\n", data[i], entity); nsMemory::Free(entity); } @@ -520,7 +520,7 @@ static void TestEntityConversion(uint32_t version) // convert at once as a string PRUnichar *entities; res = entityConv->ConvertToEntities(inString.get(), version, &entities); - if (NS_SUCCEEDED(res) && NULL != entities) { + if (NS_SUCCEEDED(res) && entities) { for (PRUnichar *centity = entities; *centity; ++centity) { printf("%c", (char) *centity); if (';' == (char) *centity) @@ -565,7 +565,7 @@ static void TestSaveAsCharset() if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} res = saveAsCharset->Convert(inString.get(), &outString); if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("%s\n", outString); nsMemory::Free(outString);} printf("ISO-2022-JP attr_plainTextDefault entityNone\n"); @@ -575,11 +575,11 @@ static void TestSaveAsCharset() if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} res = saveAsCharset->Convert(inString.get(), &outString); if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("%s\n", outString); nsMemory::Free(outString);} if (NS_ERROR_UENC_NOMAPPING == res) { outString = ToNewUTF8String(inString); - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("Fall back to UTF-8: %s\n", outString); nsMemory::Free(outString);} } @@ -590,7 +590,7 @@ static void TestSaveAsCharset() if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} res = saveAsCharset->Convert(inString.get(), &outString); if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("%s\n", outString); nsMemory::Free(outString);} printf("ISO-2022-JP attr_FallbackEscapeU entityNone\n"); @@ -600,7 +600,7 @@ static void TestSaveAsCharset() if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} res = saveAsCharset->Convert(inString.get(), &outString); if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("%s\n", outString); nsMemory::Free(outString);} printf("ISO-8859-1 attr_htmlTextDefault html40Latin1\n"); @@ -610,7 +610,7 @@ static void TestSaveAsCharset() if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} res = saveAsCharset->Convert(inString.get(), &outString); if (NS_ERROR_UENC_NOMAPPING != res && NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("%s\n", outString); nsMemory::Free(outString);} printf("ISO-8859-1 attr_FallbackHexNCR+attr_EntityAfterCharsetConv html40Latin1 \n"); @@ -621,7 +621,7 @@ static void TestSaveAsCharset() if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} res = saveAsCharset->Convert(inString.get(), &outString); if (NS_ERROR_UENC_NOMAPPING != res && NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n");} - if (NULL == outString) {printf("\tFailed!! output null\n");} + if (!outString) {printf("\tFailed!! output null\n");} else {printf("%s\n", outString); nsMemory::Free(outString);} @@ -659,12 +659,12 @@ void TestNormalization() printf("==============================\n"); printf("Start nsIUnicodeNormalizer Test \n"); printf("==============================\n"); - nsIUnicodeNormalizer *t = NULL; + nsIUnicodeNormalizer *t = nullptr; nsresult res; res = CallGetService(kUnicodeNormalizerCID, &t); printf("Test 1 - GetService():\n"); - if(NS_FAILED(res) || ( t == NULL ) ) { + if(NS_FAILED(res) || !t) { printf("\t1st Norm GetService failed\n"); } else { NS_RELEASE(t); @@ -672,7 +672,7 @@ void TestNormalization() res = CallGetService(kUnicodeNormalizerCID, &t); - if(NS_FAILED(res) || ( t == NULL ) ) { + if(NS_FAILED(res) || !t) { printf("\t2nd GetService failed\n"); } else { printf("Test 2 - NormalizeUnicode(uint32_t, const nsAString&, nsAString&):\n"); diff --git a/intl/unicharutil/util/nsSpecialCasingData.h b/intl/unicharutil/util/nsSpecialCasingData.h index 6fc87000a50a..3c1dae694425 100644 --- a/intl/unicharutil/util/nsSpecialCasingData.h +++ b/intl/unicharutil/util/nsSpecialCasingData.h @@ -18,7 +18,7 @@ struct MultiCharMapping { }; // Return a pointer to the special case mapping for the given character; -// returns NULL if no such mapping is defined. +// returns nullptr if no such mapping is defined. const MultiCharMapping* SpecialUpper(uint32_t aCh); const MultiCharMapping* SpecialLower(uint32_t aCh); const MultiCharMapping* SpecialTitle(uint32_t aCh);