author | Makoto Kato <m_kato@ga2.so-net.ne.jp> |
Fri, 24 Aug 2012 16:49:00 +0900 | |
changeset 103285 | ede84a1a43cf1bae39b293f8447ad194cca1f42c |
parent 103284 | 3559149341e06348c44fd450c1f4cebf40b1b921 |
child 103286 | 5f8728a398a91ca95c9746e03ad293a5e0c48961 |
push id | 23343 |
push user | ryanvm@gmail.com |
push date | Sat, 25 Aug 2012 02:53:35 +0000 |
treeherder | mozilla-central@f077de66e52d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smontagu |
bugs | 783206 |
milestone | 17.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/intl/build/nsI18nModule.cpp +++ b/intl/build/nsI18nModule.cpp @@ -75,49 +75,49 @@ NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CI #endif #ifdef XP_OS2 NS_DEFINE_NAMED_CID(NS_OS2LOCALE_CID); NS_DEFINE_NAMED_CID(NS_COLLATION_CID); 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[] = { { NS_LBRK_CONTRACTID, &kNS_LBRK_CID }, { NS_WBRK_CONTRACTID, &kNS_WBRK_CID }, { NS_SEMANTICUNITSCANNER_CONTRACTID, &kNS_SEMANTICUNITSCANNER_CID }, { NS_UNICHARUTIL_CONTRACTID, &kNS_UNICHARUTIL_CID }, { NS_UNICHARCATEGORY_CONTRACTID, &kNS_UNICHARCATEGORY_CID }, @@ -143,28 +143,28 @@ static const mozilla::Module::ContractID { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, #endif #ifdef XP_OS2 { NS_OS2LOCALE_CONTRACTID, &kNS_OS2LOCALE_CID }, { NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID }, { NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID }, #endif - { NULL } + { nullptr } }; static void I18nModuleDtor() { nsCharsetConverterManager::Shutdown(); } static const mozilla::Module kIntlModule = { mozilla::Module::kVersion, kIntlCIDs, kIntlContracts, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, I18nModuleDtor }; NSMODULE_DEFN(nsI18nModule) = &kIntlModule;
--- a/intl/chardet/src/nsChardetModule.cpp +++ b/intl/chardet/src/nsChardetModule.cpp @@ -11,36 +11,36 @@ #include "nsCharDetConstructors.h" NS_DEFINE_NAMED_CID(NS_RU_PROBDETECTOR_CID); NS_DEFINE_NAMED_CID(NS_UK_PROBDETECTOR_CID); 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[] = { { NS_CHARSET_DETECTOR_CONTRACTID_BASE "ruprob", &kNS_RU_PROBDETECTOR_CID }, { 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 = { mozilla::Module::kVersion, kChardetCIDs, kChardetContracts, kChardetCategories };
--- a/intl/locale/src/mac/nsCollationMacUC.cpp +++ b/intl/locale/src/mac/nsCollationMacUC.cpp @@ -11,17 +11,17 @@ NS_IMPL_ISUPPORTS1(nsCollationMacUC, nsICollation) nsCollationMacUC::nsCollationMacUC() : mInit(false) , mHasCollator(false) , mLocale(NULL) , mLastStrength(-1) , mCollator(NULL) - , mBuffer(NULL) + , mBuffer(nullptr) , mBufferLen(1) { } nsCollationMacUC::~nsCollationMacUC() { if (mHasCollator) { #ifdef DEBUG
--- a/intl/locale/src/nsLocale.cpp +++ b/intl/locale/src/nsLocale.cpp @@ -22,26 +22,27 @@ /* nsILocale */ NS_IMPL_THREADSAFE_ISUPPORTS1(nsLocale, nsILocale) nsLocale::nsLocale(void) : fHashtable(nullptr), fCategoryCount(0) { 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"); } 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); } NS_IMETHODIMP nsLocale::GetCategory(const nsAString& category, nsAString& result) { const PRUnichar *value = (const PRUnichar*)
--- a/intl/locale/src/nsLocaleService.cpp +++ b/intl/locale/src/nsLocaleService.cpp @@ -97,17 +97,16 @@ protected: nsCOMPtr<nsILocale> mApplicationLocale; }; // // nsLocaleService methods // nsLocaleService::nsLocaleService(void) - : mSystemLocale(0), mApplicationLocale(0) { #ifdef XP_WIN nsAutoString xpLocale; // // get the system LCID // LCID win_lcid = GetSystemDefaultLCID(); NS_ENSURE_TRUE(win_lcid, ); @@ -171,19 +170,16 @@ nsLocaleService::nsLocaleService(void) #ifdef XP_OS2 nsCOMPtr<nsIOS2Locale> os2Converter = do_GetService(NS_OS2LOCALE_CONTRACTID); nsAutoString xpLocale; if (os2Converter) { nsAutoString category; int i; nsRefPtr<nsLocale> resultLocale(new nsLocale()); - if ( resultLocale == NULL ) { - return; - } LocaleObject locale_object = NULL; int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); if (result != ULS_SUCCESS) { int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"en_US", &locale_object); } @@ -305,29 +301,26 @@ nsLocaleService::GetApplicationLocale(ns *_retval=(nsILocale*)nullptr; return NS_ERROR_FAILURE; } NS_IMETHODIMP nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILocale **_retval) { - char* input; char* cPtr; char* cPtr1; char* cPtr2; int i; int j; int countLang = 0; 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<char> input(new char[strlen(acceptLanguage)+1]); strcpy(input, acceptLanguage); cPtr1 = input-1; cPtr2 = input; /* put in standard form */ while (*(++cPtr1)) { if (isalpha(*cPtr1)) *cPtr2++ = tolower(*cPtr1); /* force lower case */ @@ -402,17 +395,16 @@ nsLocaleService::GetLocaleFromAcceptLang result = NS_ERROR_FAILURE; if (countLang>0) { result = NewLocale(NS_ConvertASCIItoUTF16(acceptLanguageList[0]), _retval); } // // clean up // - delete[] input; return result; } nsresult nsLocaleService::GetLocaleComponentForUserAgent(nsAString& retval) { nsCOMPtr<nsILocale> system_locale;
--- a/intl/locale/src/os2/nsCollationOS2.cpp +++ b/intl/locale/src/os2/nsCollationOS2.cpp @@ -22,43 +22,36 @@ #include "nsIPlatformCharset.h" #include "nsIOS2Locale.h" #include "nsCOMPtr.h" #include "nsString.h" #include "nsCRT.h" NS_IMPL_ISUPPORTS1(nsCollationOS2, nsICollation) -nsCollationOS2::nsCollationOS2() +nsCollationOS2::nsCollationOS2() : mCollation(nullptr) { - mCollation = NULL; } nsCollationOS2::~nsCollationOS2() { - if (mCollation != NULL) + if (mCollation) delete mCollation; } /* Workaround for GCC problem */ #ifndef LOCI_iCodepage #define LOCI_iCodepage ((LocaleItem)111) #endif 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; } nsresult nsCollationOS2::CompareString(int32_t strength, const nsAString& string1, const nsAString& string2, int32_t* result) { @@ -113,17 +106,17 @@ nsresult nsCollationOS2::AllocateRawSort res = NS_ERROR_FAILURE; // From here on out assume failure... int length = UniStrxfrm(locObj, NULL, reinterpret_cast<const UniChar *>(stringNormalized.get()),0); if (length >= 0) { length += 5; // Allow for the "extra" chars UniStrxfrm() // will out put (overrunning the buffer if // 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 ) { free(pLocalBuffer); pLocalBuffer = nullptr; } iBufferLength = length*4; }
--- a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp +++ b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp @@ -28,17 +28,17 @@ nsresult nsDateTimeFormatOS2::FormatTMTi const nsTimeFormatSelector timeFormatSelector, const struct tm* tmTime, nsAString &stringOut) { 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) UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj); bool f24Hour = false; UniQueryLocaleItem(locObj, LOCI_iTime, &pString);
--- a/intl/locale/src/unix/nsCollationUnix.cpp +++ b/intl/locale/src/unix/nsCollationUnix.cpp @@ -13,55 +13,50 @@ #include "nsPosixLocale.h" #include "nsCOMPtr.h" #include "nsUnicharUtils.h" #include "nsCRT.h" //#define DEBUG_UNIX_COLLATION 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()); } } inline void nsCollationUnix::DoRestoreLocale() { if (!mSavedLocale.EqualsIgnoreCase(mLocale.get())) { (void) setlocale(LC_COLLATE, PromiseFlatCString(Substring(mSavedLocale,0,MAX_LOCALE_LEN)).get()); } } -nsCollationUnix::nsCollationUnix() +nsCollationUnix::nsCollationUnix() : mCollation(nullptr) { - mCollation = NULL; } nsCollationUnix::~nsCollationUnix() { - if (mCollation != NULL) + if (mCollation) delete mCollation; } 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'); nsAutoString localeStr; NS_NAMED_LITERAL_STRING(aCategory, "NSILOCALE_COLLATE##PLATFORM"); // get locale string, use app default if no locale specified @@ -126,19 +121,19 @@ nsresult nsCollationUnix::CompareString( stringNormalized1 = string1; stringNormalized2 = string2; } // convert unicode to charset 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(); PR_Free(str2); } PR_Free(str1); } @@ -159,17 +154,17 @@ nsresult nsCollationUnix::AllocateRawSor return res; } else { stringNormalized = stringIn; } // convert unicode to charset 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; void *buffer = PR_Malloc(len); if (!buffer) { res = NS_ERROR_OUT_OF_MEMORY; } else if (strxfrm((char *)buffer, str, len) >= len) { PR_Free(buffer);
--- a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp @@ -20,17 +20,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTime // init this interface to a specified locale nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale) { nsAutoString localeStr; NS_NAMED_LITERAL_STRING(aCategory, "NSILOCALE_TIME##PLATFORM"); 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; } } else { res = locale->GetCategory(aCategory, localeStr); if (NS_SUCCEEDED(res) && !localeStr.IsEmpty()) { @@ -41,17 +41,17 @@ nsresult nsDateTimeFormatUnix::Initializ } } } mCharset.AssignLiteral("ISO-8859-1"); mPlatformLocale.Assign("en_US"); // get locale name string, use app default if no locale specified - if (NULL == locale) { + if (!locale) { nsCOMPtr<nsILocaleService> localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID, &res); if (NS_SUCCEEDED(res)) { nsCOMPtr<nsILocale> appLocale; res = localeService->GetApplicationLocale(getter_AddRefs(appLocale)); if (NS_SUCCEEDED(res)) { res = appLocale->GetCategory(aCategory, localeStr); if (NS_SUCCEEDED(res) && !localeStr.IsEmpty()) { @@ -95,17 +95,17 @@ nsresult nsDateTimeFormatUnix::Initializ void nsDateTimeFormatUnix::LocalePreferred24hour() { char str[100]; time_t tt; 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 tmc->tm_min=0; // set the min & sec other number than '2' tmc->tm_sec=0; char *temp = setlocale(LC_TIME, mPlatformLocale.get()); strftime(str, (size_t)99, "%X", (struct tm *)tmc); @@ -201,17 +201,17 @@ nsresult nsDateTimeFormatUnix::FormatTMT PL_strncpy(fmtT, "%H:%M", NSDATETIME_FORMAT_BUFFER_LEN); break; default: PL_strncpy(fmtT, "", NSDATETIME_FORMAT_BUFFER_LEN); } } // 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); PL_strncat(fmtD, fmtT, NSDATETIME_FORMAT_BUFFER_LEN); strftime(strOut, NSDATETIME_FORMAT_BUFFER_LEN, fmtD, tmTime); } else if (PL_strlen(fmtD) && !PL_strlen(fmtT)) { strftime(strOut, NSDATETIME_FORMAT_BUFFER_LEN, fmtD, tmTime);
--- a/intl/locale/src/windows/nsCollationWin.cpp +++ b/intl/locale/src/windows/nsCollationWin.cpp @@ -16,37 +16,33 @@ #include "plstr.h" #include <windows.h> #undef CompareString 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; nsAutoString localeStr; // get locale string, use app default if no locale specified if (!locale) {
--- a/intl/locale/src/windows/nsDateTimeFormatWin.cpp +++ b/intl/locale/src/windows/nsDateTimeFormatWin.cpp @@ -22,17 +22,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTime // init this interface to a specified locale nsresult nsDateTimeFormatWin::Initialize(nsILocale* locale) { nsAutoString localeStr; 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; } } else { res = locale->GetCategory(NS_LITERAL_STRING("NSILOCALE_TIME"), localeStr); if (NS_SUCCEEDED(res) && !localeStr.IsEmpty()) { @@ -42,17 +42,17 @@ nsresult nsDateTimeFormatWin::Initialize } } } // default LCID (en-US) mLCID = 1033; // get locale string, use app default if no locale specified - if (NULL == locale) { + if (!locale) { nsCOMPtr<nsILocaleService> localeService = do_GetService(NS_LOCALESERVICE_CONTRACTID); if (localeService) { nsCOMPtr<nsILocale> appLocale; res = localeService->GetApplicationLocale(getter_AddRefs(appLocale)); if (NS_SUCCEEDED(res)) { res = appLocale->GetCategory(NS_LITERAL_STRING("NSILOCALE_TIME"), localeStr);
--- a/intl/locale/src/windows/nsWin32Locale.cpp +++ b/intl/locale/src/windows/nsWin32Locale.cpp @@ -25,18 +25,18 @@ struct iso_pair struct iso_map { const char* iso_code; DWORD win_code; 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. // see http://www.tug.org/ftp/tex/texinfo/intl/localename.c #ifndef LANG_URDU #define LANG_URDU 0x20 #endif
--- a/intl/lwbrk/tests/TestLineBreak.cpp +++ b/intl/lwbrk/tests/TestLineBreak.cpp @@ -171,32 +171,32 @@ bool TestASCIIWB(nsIWordBreaker *lb, } 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; } NS_IF_RELEASE(t); res = CallGetService(kLBrkCID, &t); - if(NS_FAILED(res) || ( t == NULL ) ) { + if (NS_FAILED(res) || !t) { printf("\t2nd GetService failed\n"); ok = false; } else { printf("Test 4 - {First,Next}ForwardBreak():\n"); if( TestASCIILB(t, teng1, sizeof(teng1)/sizeof(char), exp1, sizeof(exp1)/sizeof(uint32_t)) ) { printf("Test 4 Passed\n\n"); @@ -237,32 +237,32 @@ bool TestLineBreaker() return ok; } 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 { NS_RELEASE(t); } res = CallGetService(kWBrkCID, &t); - if(NS_FAILED(res) || ( t == NULL ) ) { + if (NS_FAILED(res) || !t) { printf("\t2nd GetService failed\n"); ok = false; } else { printf("Test 4 - {First,Next}ForwardBreak():\n"); if( TestASCIIWB(t, teng1, sizeof(teng1)/sizeof(char), wexp1, sizeof(wexp1)/sizeof(uint32_t)) ) { @@ -329,17 +329,17 @@ void SampleWordBreakUsage() SampleFindWordBreakFromPosition(4,6); // [space] SampleFindWordBreakFromPosition(4,7); // work } void SamplePrintWordWithBreak() { uint32_t numOfFragment = sizeof(wb) / sizeof(char*); - nsIWordBreaker *wbk = NULL; + nsIWordBreaker *wbk = nullptr; CallGetService(kWBrkCID, &wbk); nsAutoString result; for(uint32_t i = 0; i < numOfFragment; i++) { NS_ConvertASCIItoUTF16 fragText(wb[i]); @@ -376,17 +376,17 @@ void SamplePrintWordWithBreak() printf("[%s]\n", NS_ConvertUTF16toUTF8(result).get()); NS_IF_RELEASE(wbk); } void SampleFindWordBreakFromPosition(uint32_t fragN, uint32_t offset) { uint32_t numOfFragment = sizeof(wb) / sizeof(char*); - nsIWordBreaker *wbk = NULL; + nsIWordBreaker *wbk = nullptr; CallGetService(kWBrkCID, &wbk); NS_ConvertASCIItoUTF16 fragText(wb[fragN]); nsWordRange res = wbk->FindWord(fragText.get(), fragText.Length(), offset); bool canBreak;
--- a/intl/strres/src/nsStringBundle.cpp +++ b/intl/strres/src/nsStringBundle.cpp @@ -488,17 +488,17 @@ nsExtensibleStringBundle::FormatStringFr return rv; return nsStringBundle::FormatString(formatStr, aParams, aLength, aResult); } nsresult nsExtensibleStringBundle::GetSimpleEnumeration(nsISimpleEnumerator ** aResult) { // XXX write me - *aResult = NULL; + *aResult = nullptr; return NS_ERROR_NOT_IMPLEMENTED; } ///////////////////////////////////////////////////////////////////////////////////////// #define MAX_CACHED_BUNDLES 16 struct bundleCacheEntry_t { @@ -707,17 +707,17 @@ nsStringBundleService::CreateBundle(cons return getStringBundle(aURLSpec,aResult); } NS_IMETHODIMP nsStringBundleService::CreateExtensibleBundle(const char* aCategory, nsIStringBundle** aResult) { - if (aResult == NULL) return NS_ERROR_NULL_POINTER; + NS_ENSURE_ARG_POINTER(aResult); nsresult res; nsExtensibleStringBundle * bundle = new nsExtensibleStringBundle(); if (!bundle) return NS_ERROR_OUT_OF_MEMORY; res = bundle->Init(aCategory, this); if (NS_FAILED(res)) {
--- a/intl/uconv/public/nsEncoderDecoderUtils.h +++ b/intl/uconv/public/nsEncoderDecoderUtils.h @@ -11,17 +11,17 @@ #define NS_DATA_BUNDLE_CATEGORY "uconv-charset-data" #define NS_TITLE_BUNDLE_CATEGORY "uconv-charset-titles" #define NS_CONVERTER_REGISTRY_START \ static const mozilla::Module::CategoryEntry kUConvCategories[] = { #define NS_CONVERTER_REGISTRY_END \ - { NULL } \ + { nullptr } \ }; #define NS_UCONV_REG_UNREG_DECODER(_Charset, _CID) \ { NS_UNICODEDECODER_NAME, _Charset, "" }, #define NS_UCONV_REG_UNREG_ENCODER(_Charset, _CID) \ { NS_UNICODEENCODER_NAME, _Charset, "" },
--- a/intl/uconv/src/nsCharsetConverterManager.cpp +++ b/intl/uconv/src/nsCharsetConverterManager.cpp @@ -94,21 +94,20 @@ nsresult GetBundleValue(nsIStringBundle return NS_OK; } 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; } return GetBundleValue(sDataBundle, aCharset, nsDependentString(aProp), aResult); } @@ -219,19 +218,18 @@ nsCharsetConverterManager::GetUnicodeDec return rv; } static 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; nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; nsTArray<nsCString>* array = new nsTArray<nsCString>; @@ -308,17 +306,17 @@ nsCharsetConverterManager::GetCharsetAli NS_IMETHODIMP nsCharsetConverterManager::GetCharsetTitle(const char * aCharset, nsAString& aResult) { NS_ENSURE_ARG_POINTER(aCharset); - if (sTitleBundle == NULL) { + if (!sTitleBundle) { nsresult rv = LoadExtensibleBundle(NS_TITLE_BUNDLE_CATEGORY, &sTitleBundle); NS_ENSURE_SUCCESS(rv, rv); } return GetBundleValue(sTitleBundle, aCharset, NS_LITERAL_STRING(".title"), aResult); } NS_IMETHODIMP
--- a/intl/uconv/src/nsScriptableUConv.cpp +++ b/intl/uconv/src/nsScriptableUConv.cpp @@ -249,21 +249,21 @@ nsScriptableUnicodeConverter::SetIsInter mIsInternal = aIsInternal; return NS_OK; } nsresult nsScriptableUnicodeConverter::InitConverter() { nsresult rv = NS_OK; - mEncoder = NULL ; + mEncoder = nullptr; nsCOMPtr<nsICharsetConverterManager> 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 rv = ccm->GetUnicodeEncoder(mCharset.get(), getter_AddRefs(mEncoder)); if(NS_SUCCEEDED(rv)) { rv = mEncoder->SetOutputErrorBehavior(nsIUnicodeEncoder::kOnError_Replace, nullptr, (PRUnichar)'?'); if(NS_SUCCEEDED(rv)) { rv = mIsInternal ?
--- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -709,204 +709,204 @@ NS_DEFINE_NAMED_CID(NS_GBKTOUNICODE_CID) NS_DEFINE_NAMED_CID(NS_UNICODETOGBK_CID); NS_DEFINE_NAMED_CID(NS_HZTOUNICODE_CID); NS_DEFINE_NAMED_CID(NS_UNICODETOHZ_CID); NS_DEFINE_NAMED_CID(NS_GB18030TOUNICODE_CID); 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[] = { { NS_CHARSETCONVERTERMANAGER_CONTRACTID, &kNS_ICHARSETCONVERTERMANAGER_CID }, { NS_ITEXTTOSUBURI_CONTRACTID, &kNS_TEXTTOSUBURI_CID }, { NS_CONVERTERINPUTSTREAM_CONTRACTID, &kNS_CONVERTERINPUTSTREAM_CID }, { "@mozilla.org/intl/converter-output-stream;1", &kNS_CONVERTEROUTPUTSTREAM_CID }, { NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID, &kNS_ISCRIPTABLEUNICODECONVERTER_CID }, @@ -1087,17 +1087,17 @@ static const mozilla::Module::ContractID { NS_UNICODEENCODER_CONTRACTID_BASE "GB2312", &kNS_UNICODETOGB2312_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "gbk", &kNS_GBKTOUNICODE_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "gbk", &kNS_UNICODETOGBK_CID }, { NS_UNICODEDECODER_CONTRACTID_BASE "HZ-GB-2312", &kNS_HZTOUNICODE_CID }, { NS_UNICODEENCODER_CONTRACTID_BASE "HZ-GB-2312", &kNS_UNICODETOHZ_CID }, { 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 = { mozilla::Module::kVersion, kUConvCIDs, kUConvContracts, kUConvCategories };
--- a/intl/uconv/tests/TestUConv.cpp +++ b/intl/uconv/tests/TestUConv.cpp @@ -331,17 +331,17 @@ nsresult nsTestUConv::DisplayCharsets() uint32_t count = allCharsets.Length(); for (uint32_t i = 0; i < count; i++) { const nsCString& charset = allCharsets[i]; printf("%s", charset.get()); PrintSpaces(24 - charset.Length()); // align to hard coded column number - nsCOMPtr<nsIUnicodeDecoder> dec = NULL; + nsCOMPtr<nsIUnicodeDecoder> dec; res = ccMan->GetUnicodeDecoder(charset.get(), getter_AddRefs(dec)); if (NS_FAILED(res)) printf (" "); else { printf("D"); decCount++; } #ifdef DEBUG // show the "basic" decoder classes @@ -351,17 +351,17 @@ nsresult nsTestUConv::DisplayCharsets() basicDecCount++; printf("b"); } else printf(" "); } else printf(" "); #endif - nsCOMPtr<nsIUnicodeEncoder> enc = NULL; + nsCOMPtr<nsIUnicodeEncoder> enc; res = ccMan->GetUnicodeEncoder(charset.get(), getter_AddRefs(enc)); if (NS_FAILED(res)) printf (" "); else { printf("E"); encCount++; } #ifdef DEBUG @@ -375,32 +375,32 @@ nsresult nsTestUConv::DisplayCharsets() } else printf(" "); #endif printf(" "); 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); res = ccMan->GetCharsetTitle(charset.get(), str); if (NS_FAILED(res)) str.SetLength(0); NS_LossyConvertUTF16toASCII buff2(str); printf(" \"%s\"\n", buff2.get()); }
--- a/intl/uconv/tests/convperf.cpp +++ b/intl/uconv/tests/convperf.cpp @@ -110,17 +110,17 @@ int main(int argc, const char** argv) argv[fromcodeind],res); return -1; } } } if(argc == 6) { infile = fopen(argv[5], "rb"); - if(NULL == infile) + if (!infile) { usage(); fprintf(stderr,"cannot open file %s\n", argv[5]); return -1; } } else {
--- a/intl/uconv/tests/nsTestUConv.cpp +++ b/intl/uconv/tests/nsTestUConv.cpp @@ -37,17 +37,17 @@ static NS_DEFINE_CID(kPlatformCharsetCID //---------------------------------------------------------------------- // Global variables and macros #define GENERAL_BUFFER 20000 // general purpose buffer; for Unicode divide by 2 #define ARRAY_SIZE(_array) \ (sizeof(_array) / sizeof(_array[0])) -nsICharsetConverterManager * ccMan = NULL; +nsICharsetConverterManager * ccMan = nullptr; /** * Test data for Latin1 charset. */ char bLatin1_d0[] = { "\x00\x0d\x7f\x80\xff" }; @@ -431,17 +431,17 @@ nsresult standardDecoderTest(char * aTes printf("Test Passed.\n"); return NS_OK; } } 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; } int32_t n = fread(aBuff, 1, *aBuffLen, f); if (n >= *aBuffLen) { printf("ERROR at reading from file \"%s\": too much input data.\n", aFile); return NS_ERROR_UNEXPECTED; @@ -788,17 +788,17 @@ nsresult testUTF7Decoder() */ nsresult testLatin1Encoder() { char * testName = "T201"; printf("\n[%s] Unicode -> Latin1\n", testName); // 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}; char exp[] = {"\x01\x02\xcc\xe3"}; // test converter - easy test res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName); @@ -825,17 +825,17 @@ nsresult testLatin1Encoder() */ nsresult testSJISEncoder() { char * testName = "T202"; printf("\n[%s] Unicode -> SJIS\n", testName); // create converter CREATE_ENCODER("Shift_JIS"); - enc->SetOutputErrorBehavior(enc->kOnError_Replace, NULL, 0x00cc); + enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc); // test data PRUnichar src[] = { 0x004A, 0x0061, 0x0070, 0x0061, 0x006E, 0x0065, 0x0073, 0x0065, 0x6f22, 0x5b57, 0x30ab, 0x30bf, 0x30ab, 0x30ca, 0x3072, 0x3089, 0x304c, 0x306a, 0xff11, 0xff12, 0xff13, 0xff21, 0xff22, 0xff23 @@ -874,17 +874,17 @@ nsresult testSJISEncoder() */ nsresult testEUCJPEncoder() { char * testName = "T203"; printf("\n[%s] Unicode -> EUCJP\n", testName); // 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}; char exp[] = {"\x45\x54"}; // test converter - easy test res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName); @@ -911,17 +911,17 @@ nsresult testEUCJPEncoder() */ nsresult testISO2022JPEncoder() { char * testName = "T204"; printf("\n[%s] Unicode -> ISO2022JP\n", testName); // 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}; char exp[] = {"\x0d\x7f" "\x1b(J\xaa\xdc" "\x1b$@\x21\x21\x32\x37\x1b(B"}; // test converter - easy test res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName); @@ -948,17 +948,17 @@ nsresult testISO2022JPEncoder() */ nsresult testMUTF7Encoder() { char * testName = "T205"; printf("\n[%s] Unicode -> MUTF-7\n", testName); // 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}; char exp[] = {"\x50\x51\x52\x53&AAAAAAAA-&-&AAA-"}; // test converter - easy test res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName); @@ -985,17 +985,17 @@ nsresult testMUTF7Encoder() */ nsresult testUTF7Encoder() { char * testName = "T206"; printf("\n[%s] Unicode -> UTF-7\n", testName); // 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}; char exp[] = {"etira\x0a"}; // test converter - easy test res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
--- a/intl/uconv/tests/nsconv.cpp +++ b/intl/uconv/tests/nsconv.cpp @@ -110,29 +110,29 @@ int main(int argc, const char** argv) } } if (argc > 5) { // 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]); goto error_exit; } if (argc > 6) { // 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]); goto error_exit; } } else fout = stdout;
--- a/intl/uconv/tools/umaptable.c +++ b/intl/uconv/tools/umaptable.c @@ -423,17 +423,17 @@ parsearg(int argc, char* argv[]) fprintf(stderr, "format 1 cnst = %d\n", FORMAT1CNST); fprintf(stderr, "generate u%c table\n", bGenerateFromUnicodeTable ? 'f' : 't'); } void getinput() { char buf[256]; short c,u; - for(;gets(buf)!=NULL;) + for (; gets(buf);) { if(buf[0]=='0' && buf[1] == 'x') { sscanf(buf,"%hx %hx",&c,&u); if(bGenerateFromUnicodeTable) SetMapValue(u, c); else SetMapValue(c, u);
--- a/intl/uconv/util/nsUCSupport.cpp +++ b/intl/uconv/util/nsUCSupport.cpp @@ -534,17 +534,17 @@ NS_IMETHODIMP nsEncoderSupport::Reset() return NS_OK; } NS_IMETHODIMP nsEncoderSupport::SetOutputErrorBehavior( int32_t aBehavior, nsIUnicharEncoder * aEncoder, PRUnichar aChar) { - if (aBehavior == kOnError_CallBack && aEncoder == nullptr) + if (aBehavior == kOnError_CallBack && !aEncoder) return NS_ERROR_NULL_POINTER; mErrEncoder = aEncoder; mErrBehavior = aBehavior; mErrChar = aChar; return NS_OK; }
--- a/intl/uconv/util/nsUnicodeDecodeHelper.cpp +++ b/intl/uconv/util/nsUnicodeDecodeHelper.cpp @@ -2,16 +2,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "pratom.h" #include "unicpriv.h" #include "nsIUnicodeDecoder.h" #include "nsUnicodeDecodeHelper.h" +#include "nsAutoPtr.h" //---------------------------------------------------------------------- // Class nsUnicodeDecodeHelper [implementation] nsresult nsUnicodeDecodeHelper::ConvertByTable( const char * aSrc, int32_t * aSrcLength, PRUnichar * aDest, int32_t * aDestLength, @@ -28,21 +29,21 @@ nsresult nsUnicodeDecodeHelper::ConvertB PRUnichar med; int32_t bcr; // byte count for read nsresult res = NS_OK; while ((srcLen > 0) && (dest < destEnd)) { 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<uint16_t*>(&med), srcLen, (uint32_t *)&bcr); } else { - charFound = uScan(aScanClass, NULL, (uint8_t *)src, + charFound = uScan(aScanClass, nullptr, (uint8_t *)src, reinterpret_cast<uint16_t*>(&med), srcLen, (uint32_t *)&bcr); } if (!charFound) { res = NS_OK_UDEC_MOREINPUT; break; } @@ -98,17 +99,17 @@ nsresult nsUnicodeDecodeHelper::ConvertB bool done= false; bool passRangeCheck = false; bool passScan = false; for (i=0; (!done) && (i<aTableCount); i++) { 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<uint16_t*>(&med), srcLen, (uint32_t *)&bcr)) { passScan = true; done = uMapCode((uTable*) aMappingTable[i], static_cast<uint16_t>(med), reinterpret_cast<uint16_t*>(dest)); } // if (uScan ... ) @@ -131,17 +132,17 @@ nsresult nsUnicodeDecodeHelper::ConvertB // handle nbsp *dest = 0x00a0; } else { // we need to decide how many byte we skip. We can use uScan to do this for (i=0; i<aTableCount; i++) { if ((aRangeArray[i].min <= *src) && (*src <= aRangeArray[i].max)) { - if (uScan(aScanClassArray[i], NULL, src, + if (uScan(aScanClassArray[i], nullptr, src, reinterpret_cast<uint16_t*>(&med), srcLen, (uint32_t*)&bcr)) { // match the patten int32_t k; for(k = 1; k < bcr; k++) { @@ -220,20 +221,16 @@ nsresult nsUnicodeDecodeHelper::ConvertB nsresult nsUnicodeDecodeHelper::CreateFastTable( uMappingTable * aMappingTable, PRUnichar * aFastTable, int32_t aTableSize) { int32_t tableSize = aTableSize; int32_t buffSize = aTableSize; - char * buff = new char [buffSize]; - if (buff == NULL) return NS_ERROR_OUT_OF_MEMORY; + nsAutoArrayPtr<char> buff(new char [buffSize]); char * p = buff; for (int32_t i=0; i<aTableSize; i++) *(p++) = i; - nsresult res = ConvertByTable(buff, &buffSize, aFastTable, &tableSize, - u1ByteCharset, nullptr, aMappingTable); - - delete [] buff; - return res; + return ConvertByTable(buff, &buffSize, aFastTable, &tableSize, + u1ByteCharset, nullptr, aMappingTable); }
--- a/intl/unicharutil/src/nsEntityConverter.cpp +++ b/intl/unicharutil/src/nsEntityConverter.cpp @@ -13,25 +13,26 @@ #include "nsXPIDLString.h" #include "nsString.h" #include "nsUnicharUtils.h" #include "mozilla/Services.h" // // implementation methods // -nsEntityConverter::nsEntityConverter() -: mVersionList(NULL), - mVersionListLength(0) +nsEntityConverter::nsEntityConverter() : + mVersionList(nullptr), + mVersionListLength(0) { } nsEntityConverter::~nsEntityConverter() { - if (NULL != mVersionList) delete [] mVersionList; + if (mVersionList) + delete [] mVersionList; } NS_IMETHODIMP nsEntityConverter::LoadVersionPropertyFile() { NS_NAMED_LITERAL_CSTRING(url, "resource://gre/res/entityTables/htmlEntityVersions.properties"); nsCOMPtr<nsIStringBundleService> bundleService = @@ -73,73 +74,72 @@ nsEntityConverter::LoadVersionPropertyFi return NS_OK; } already_AddRefed<nsIStringBundle> nsEntityConverter::LoadEntityBundle(uint32_t version) { nsCAutoString url(NS_LITERAL_CSTRING("resource://gre/res/entityTables/")); - const PRUnichar *versionName = NULL; nsresult rv; nsCOMPtr<nsIStringBundleService> 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); url.Append(".properties"); 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; } const PRUnichar* nsEntityConverter:: GetVersionName(uint32_t versionNumber) { for (uint32_t i = 0; i < mVersionListLength; i++) { if (versionNumber == mVersionList[i].mVersion) 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; for (i = 0; i < mVersionListLength; i++) { if (versionNumber == mVersionList[i].mVersion) { if (!mVersionList[i].mEntities) { // not loaded // load the property file mVersionList[i].mEntities = LoadEntityBundle(versionNumber); NS_ASSERTION(mVersionList[i].mEntities, "LoadEntityBundle failed"); } return mVersionList[i].mEntities.get(); } } - return NULL; + return nullptr; } // // nsISupports methods // NS_IMPL_ISUPPORTS1(nsEntityConverter,nsIEntityConverter) @@ -154,25 +154,25 @@ nsEntityConverter::ConvertToEntity(PRUni } NS_IMETHODIMP nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval) { 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)) continue; 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.")); key.AppendInt(character,10); nsXPIDLString value; nsresult rv = entities->GetStringFromName(key.get(), getter_Copies(value)); if (NS_SUCCEEDED(rv)) { @@ -184,23 +184,21 @@ nsEntityConverter::ConvertUTF32ToEntity( } } return NS_ERROR_ILLEGAL_VALUE; } 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); - const PRUnichar *entity = NULL; + *_retval = nullptr; + nsString outString; // per character look for the entity uint32_t len = NS_strlen(inString); for (uint32_t i = 0; i < len; i++) { nsAutoString key(NS_LITERAL_STRING("entity.")); if (NS_IS_HIGH_SURROGATE(inString[i]) && i + 2 < len && @@ -208,40 +206,40 @@ nsEntityConverter::ConvertToEntities(con key.AppendInt(SURROGATE_TO_UCS4(inString[i], inString[i+1]), 10); ++i; } else { key.AppendInt(inString[i],10); } 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(), getter_Copies(value)); if (NS_SUCCEEDED(rv)) { entity = value.get(); break; } } - if (NULL != entity) { + if (entity) { outString.Append(entity); } else { outString.Append(&inString[i], 1); } } *_retval = ToNewUnicode(outString); - if (NULL == *_retval) + if (!*_retval) return NS_ERROR_OUT_OF_MEMORY; return NS_OK; }
--- a/intl/unicharutil/src/nsEntityConverter.h +++ b/intl/unicharutil/src/nsEntityConverter.h @@ -11,17 +11,17 @@ #include "nsIStringBundle.h" #include "nsCOMPtr.h" #define kVERSION_STRING_LEN 128 class nsEntityVersionList { public: - nsEntityVersionList() : mEntities(NULL) {} + nsEntityVersionList() {} uint32_t mVersion; PRUnichar mEntityListName[kVERSION_STRING_LEN+1]; nsCOMPtr<nsIStringBundle> mEntities; }; class nsEntityConverter: public nsIEntityConverter {
--- a/intl/unicharutil/src/nsSaveAsCharset.cpp +++ b/intl/unicharutil/src/nsSaveAsCharset.cpp @@ -54,20 +54,18 @@ nsSaveAsCharset::Init(const char *charse mEntityConverter = do_CreateInstance(NS_ENTITYCONVERTER_CONTRACTID, &rv); return rv; } 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; NS_ASSERTION(mEncoder, "need to call Init() before Convert()"); NS_ENSURE_TRUE(mEncoder, NS_ERROR_FAILURE); *_retval = nullptr; @@ -130,68 +128,65 @@ nsSaveAsCharset::GetCharset(char * *aCha ///////////////////////////////////////////////////////////////////////////////////////// // do the fallback, reallocate the buffer if necessary // need to pass destination buffer info (size, current position and estimation of rest of the conversion) 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)) { int32_t tempLen = (int32_t) PL_strlen(fallbackStr); // 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; } } memcpy((*outString + *currentPos), fallbackStr, tempLen); *currentPos += tempLen; } return rv; } 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 // estimate and allocate the target buffer (reserve extra memory for fallback) rv = mEncoder->GetMaxLength(inString, inStringLength, &dstLength); 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 dstLength = bufferLength - pos2; rv = mEncoder->Convert(&inString[pos1], &srcLength, &dstPtr[pos2], &dstLength); pos1 += srcLength ? srcLength : 1; pos2 += dstLength; @@ -259,32 +254,30 @@ nsSaveAsCharset::DoCharsetConversion(con } return rv; } 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'; nsresult rv = NS_OK; if (ATTR_NO_FALLBACK(mAttribute)) { 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); nsMemory::Free(entity); return rv; } }
--- a/intl/unicharutil/src/nsUnicodeNormalizer.cpp +++ b/intl/unicharutil/src/nsUnicodeNormalizer.cpp @@ -151,17 +151,17 @@ compose_char(uint32_t c, static nsresult mdn__unicode_decompose(int32_t compat, uint32_t *v, size_t vlen, uint32_t c, int32_t *decomp_lenp) { uint32_t *vorg = v; 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. */ if (SBase <= c && c < SLast) { int32_t idx, t_offset, v_offset, l_offset; idx = c - SBase; @@ -242,17 +242,17 @@ mdn__unicode_iscompositecandidate(uint32 static nsresult mdn__unicode_compose(uint32_t c1, uint32_t c2, uint32_t *compp) { int32_t n; int32_t lo, hi; const struct composition *cseq; - //assert(compp != NULL); + //assert(compp != nullptr); /* * Check for Hangul. */ if (LBase <= c1 && c1 < LBase + LCount && VBase <= c2 && c2 < VBase + VCount) { /* * Hangul L and V. @@ -475,17 +475,17 @@ get_class(workbuf_t *wb) { } static void reorder(workbuf_t *wb) { uint32_t c; int32_t i; int32_t cclass; - //assert(wb != NULL); + //assert(wb != nullptr); i = wb->cur; c = wb->ucs[i]; cclass = wb->cclass[i]; while (i > 0 && wb->cclass[i - 1] > cclass) { wb->ucs[i] = wb->ucs[i - 1]; wb->cclass[i] =wb->cclass[i - 1]; @@ -499,17 +499,17 @@ static void compose(workbuf_t *wb) { int32_t cur; uint32_t *ucs; int32_t *cclass; int32_t last_class; 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; cclass = wb->cclass; /* * If there are no decomposition sequence that begins with * the top character, composition is impossible. @@ -586,17 +586,17 @@ workbuf_extend(workbuf_t *wb) { if (wb->ucs == wb->ucs_buf) { wb->ucs = (uint32_t*)nsMemory::Alloc(sizeof(wb->ucs[0]) * newsize); if (!wb->ucs) return NS_ERROR_OUT_OF_MEMORY; 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 { void* buf = nsMemory::Realloc(wb->ucs, sizeof(wb->ucs[0]) * newsize); if (!buf) return NS_ERROR_OUT_OF_MEMORY; wb->ucs = (uint32_t*)buf; buf = nsMemory::Realloc(wb->cclass, sizeof(wb->cclass[0]) * newsize); @@ -616,17 +616,17 @@ workbuf_append(workbuf_t *wb, uint32_t c wb->ucs[wb->last++] = c; return (NS_OK); } 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], nmove * sizeof(wb->ucs[0])); memmove(&wb->cclass[0], &wb->cclass[shift], nmove * sizeof(wb->cclass[0])); wb->cur -= shift; wb->last -= shift;
--- a/intl/unicharutil/tests/NormalizationTest.cpp +++ b/intl/unicharutil/tests/NormalizationTest.cpp @@ -274,21 +274,21 @@ int main(int argc, char** argv) { } nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr); if (NS_FAILED(rv)) { printf("NS_InitXPCOM2 failed\n"); 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; } TestPart0(); TestPart1(); TestPart2(); TestPart3();
--- a/intl/unicharutil/tests/UnicharSelfTest.cpp +++ b/intl/unicharutil/tests/UnicharSelfTest.cpp @@ -504,28 +504,28 @@ static void TestEntityConversion(uint32_ nsCOMPtr <nsIEntityConverter> entityConv = do_CreateInstance(kEntityConverterCID, &res);; if (NS_FAILED(res)) {printf("\tFailed!! return value != NS_OK\n"); return;} const PRUnichar *data; uint32_t length = NS_StringGetData(inString, &data); // 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); } } // 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) printf("\n"); } nsMemory::Free(entities); } @@ -560,73 +560,73 @@ static void TestSaveAsCharset() printf("ISO-8859-1 attr_plainTextDefault entityNone\n"); res = saveAsCharset->Init("ISO-8859-1", nsISaveAsCharset::attr_plainTextDefault, nsIEntityConverter::entityNone); 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"); res = saveAsCharset->Init("ISO-2022-JP", nsISaveAsCharset::attr_plainTextDefault, nsIEntityConverter::entityNone); 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);} } printf("ISO-2022-JP attr_FallbackQuestionMark entityNone\n"); res = saveAsCharset->Init("ISO-2022-JP", nsISaveAsCharset::attr_FallbackQuestionMark, nsIEntityConverter::entityNone); 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"); res = saveAsCharset->Init("ISO-2022-JP", nsISaveAsCharset::attr_FallbackEscapeU, nsIEntityConverter::entityNone); 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"); res = saveAsCharset->Init("ISO-8859-1", nsISaveAsCharset::attr_htmlTextDefault, nsIEntityConverter::html40Latin1); 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"); res = saveAsCharset->Init("ISO-8859-1", nsISaveAsCharset::attr_FallbackHexNCR + nsISaveAsCharset::attr_EntityAfterCharsetConv, nsIEntityConverter::html40Latin1); 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("==============================\n"); printf("Finish nsISaveAsCharset Test \n"); printf("==============================\n\n"); } @@ -654,30 +654,30 @@ static PRUnichar nfdForm[] = 0x0000 }; 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); } 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"); nsAutoString resultStr; res = t->NormalizeUnicodeNFD(nsDependentString(normStr), resultStr); if (resultStr.Equals(nsDependentString(nfdForm))) { printf(" Succeeded in NFD UnicodeNormalizer test. \n"); } else {
--- a/intl/unicharutil/util/nsSpecialCasingData.h +++ b/intl/unicharutil/util/nsSpecialCasingData.h @@ -13,15 +13,15 @@ namespace unicode { // defined outside the BMP, so we can use PRUnichar here. Unused trailing // positions in mMappedChars are set to 0. struct MultiCharMapping { PRUnichar mOriginalChar; PRUnichar mMappedChars[3]; }; // 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); } // namespace unicode } // namespace mozilla