Bug 784739 - Switch from NULL to nullptr in intl/. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2013-08-23 15:51:30 -04:00
parent c3a52a8631
commit fe7d4dc7d3
10 changed files with 34 additions and 23 deletions

View File

@ -13,9 +13,9 @@ NS_IMPL_ISUPPORTS1(nsCollationMacUC, nsICollation)
nsCollationMacUC::nsCollationMacUC()
: mInit(false)
, mHasCollator(false)
, mLocale(NULL)
, mLocale(nullptr)
, mLastStrength(-1)
, mCollator(NULL)
, mCollator(nullptr)
, mBuffer(nullptr)
, mBufferLen(1)
{
@ -174,7 +174,7 @@ NS_IMETHODIMP nsCollationMacUC::CompareString(int32_t strength, const nsAString&
err = ::UCCompareText(mCollator,
(const UniChar *) PromiseFlatString(string1).get(), (UniCharCount) string1.Length(),
(const UniChar *) PromiseFlatString(string2).get(), (UniCharCount) string2.Length(),
NULL, (SInt32*) result);
nullptr, (SInt32*) result);
NS_ENSURE_TRUE((err == noErr), NS_ERROR_FAILURE);
return NS_OK;
@ -193,7 +193,7 @@ NS_IMETHODIMP nsCollationMacUC::CompareRawSortKey(const uint8_t* key1, uint32_t
OSStatus err;
err = ::UCCompareCollationKeys((const UCCollationValue*) key1, (ItemCount) len1,
(const UCCollationValue*) key2, (ItemCount) len2,
NULL, (SInt32*) result);
nullptr, (SInt32*) result);
NS_ENSURE_TRUE((err == noErr), NS_ERROR_FAILURE);

View File

@ -113,8 +113,10 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
if (!locale) {
formatterLocale = CFLocaleCopyCurrent();
} else {
CFStringRef localeStr = CFStringCreateWithCharacters(NULL, mLocale.get(), mLocale.Length());
formatterLocale = CFLocaleCreate(NULL, localeStr);
CFStringRef localeStr = CFStringCreateWithCharacters(nullptr,
mLocale.get(),
mLocale.Length());
formatterLocale = CFLocaleCreate(nullptr, localeStr);
CFRelease(localeStr);
}
@ -162,7 +164,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
// Create the formatter and fix up its formatting as necessary:
CFDateFormatterRef formatter =
CFDateFormatterCreate(NULL, formatterLocale, dateStyle, timeStyle);
CFDateFormatterCreate(nullptr, formatterLocale, dateStyle, timeStyle);
CFRelease(formatterLocale);
@ -172,7 +174,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
dateFormatSelector == kDateFormatYearMonth ? CFSTR("yyyy/MM ") : CFSTR("EEE ");
CFStringRef oldFormat = CFDateFormatterGetFormat(formatter);
CFMutableStringRef newFormat = CFStringCreateMutableCopy(NULL, 0, oldFormat);
CFMutableStringRef newFormat = CFStringCreateMutableCopy(nullptr, 0, oldFormat);
CFStringInsert(newFormat, 0, dateFormat);
CFDateFormatterSetFormat(formatter, newFormat);
CFRelease(newFormat); // note we don't own oldFormat
@ -182,7 +184,7 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
timeFormatSelector == kTimeFormatNoSecondsForce24Hour) {
// Replace "h" with "H", and remove "a":
CFStringRef oldFormat = CFDateFormatterGetFormat(formatter);
CFMutableStringRef newFormat = CFStringCreateMutableCopy(NULL, 0, oldFormat);
CFMutableStringRef newFormat = CFStringCreateMutableCopy(nullptr, 0, oldFormat);
CFIndex replaceCount = CFStringFindAndReplace(newFormat,
CFSTR("h"), CFSTR("H"),
CFRangeMake(0, CFStringGetLength(newFormat)),
@ -210,7 +212,9 @@ nsresult nsDateTimeFormatMac::FormatTMTime(nsILocale* locale,
CFAbsoluteTime absTime = CFGregorianDateGetAbsoluteTime(date, timeZone);
CFRelease(timeZone);
CFStringRef formattedDate = CFDateFormatterCreateStringWithAbsoluteTime(NULL, formatter, absTime);
CFStringRef formattedDate = CFDateFormatterCreateStringWithAbsoluteTime(nullptr,
formatter,
absTime);
CFIndex stringLen = CFStringGetLength(formattedDate);

View File

@ -176,7 +176,7 @@ nsLocaleService::nsLocaleService(void)
nsRefPtr<nsLocale> resultLocale(new nsLocale());
LocaleObject locale_object = NULL;
LocaleObject locale_object = nullptr;
int result = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
(UniChar *)L"", &locale_object);
if (result != ULS_SUCCESS) {

View File

@ -71,7 +71,7 @@ nsresult nsCollationOS2::CompareString(int32_t strength,
stringNormalized2 = string2;
}
LocaleObject locObj = NULL;
LocaleObject locObj = nullptr;
int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj);
if (ret != ULS_SUCCESS)
UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj);
@ -98,13 +98,16 @@ nsresult nsCollationOS2::AllocateRawSortKey(int32_t strength,
stringNormalized = stringIn;
}
LocaleObject locObj = NULL;
LocaleObject locObj = nullptr;
int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj);
if (ret != ULS_SUCCESS)
UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj);
res = NS_ERROR_FAILURE; // From here on out assume failure...
int length = UniStrxfrm(locObj, NULL, reinterpret_cast<const UniChar *>(stringNormalized.get()),0);
int length = UniStrxfrm(locObj,
nullptr,
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

View File

@ -34,7 +34,7 @@ nsresult nsDateTimeFormatOS2::FormatTMTime(nsILocale* locale,
UniChar uFmtD[NSDATETIME_FORMAT_BUFFER_LEN] = { 0 };
UniChar uFmtT[NSDATETIME_FORMAT_BUFFER_LEN] = { 0 };
UniChar *pString = nullptr;
LocaleObject locObj = NULL;
LocaleObject locObj = nullptr;
int ret = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locObj);
if (ret != ULS_SUCCESS)
UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"C", &locObj);

View File

@ -52,7 +52,7 @@ nsOS2Locale::~nsOS2Locale(void)
NS_IMETHODIMP
nsOS2Locale::GetPlatformLocale(const nsAString& locale, PULONG os2Codepage)
{
LocaleObject locObj = NULL;
LocaleObject locObj = nullptr;
int codePage;
nsAutoString tempLocale(locale);
tempLocale.ReplaceChar('-', '_');

View File

@ -125,7 +125,7 @@ nsresult nsCollationWin::AllocateRawSortKey(int32_t strength,
byteLen = LCMapStringW(mLCID, dwMapFlags,
(LPCWSTR) PromiseFlatString(stringIn).get(),
-1, NULL, 0);
-1, nullptr, 0);
buffer = PR_Malloc(byteLen);
if (!buffer) {
res = NS_ERROR_OUT_OF_MEMORY;

View File

@ -155,7 +155,7 @@ nsresult nsDateTimeFormatWin::FormatTMTime(nsILocale* locale,
dateBuffer, NSDATETIMEFORMAT_BUFFER_LEN);
}
else {
dateLen = nsGetDateFormatW(dwFlags_Date, &system_time, NULL,
dateLen = nsGetDateFormatW(dwFlags_Date, &system_time, nullptr,
dateBuffer, NSDATETIMEFORMAT_BUFFER_LEN);
}
if (dateLen != 0) {
@ -168,7 +168,7 @@ nsresult nsDateTimeFormatWin::FormatTMTime(nsILocale* locale,
timeLen = 0;
}
else {
timeLen = nsGetTimeFormatW(dwFlags_Time, &system_time, NULL,
timeLen = nsGetTimeFormatW(dwFlags_Time, &system_time, nullptr,
timeBuffer, NSDATETIMEFORMAT_BUFFER_LEN);
if (timeLen != 0) {
timeLen--; // Since the count includes the terminating null.
@ -239,7 +239,7 @@ int nsDateTimeFormatWin::nsGetTimeFormatW(DWORD dwFlags, const SYSTEMTIME *lpTim
format ?
const_cast<LPCWSTR>
(NS_ConvertASCIItoUTF16(format).get()) :
NULL,
nullptr,
(LPWSTR) timeStr, cchTime);
return len;
}
@ -252,7 +252,7 @@ int nsDateTimeFormatWin::nsGetDateFormatW(DWORD dwFlags, const SYSTEMTIME *lpDat
format ?
const_cast<LPCWSTR>
(NS_ConvertASCIItoUTF16(format).get()) :
NULL,
nullptr,
(LPWSTR) dateStr, cchDate);
return len;
}

View File

@ -15,7 +15,10 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
memset(aBreakBefore, false, aLength * sizeof(uint8_t));
OSStatus status = UCCreateTextBreakLocator(NULL, 0, kUCTextBreakLineMask, &breakLocator);
OSStatus status = UCCreateTextBreakLocator(nullptr,
0,
kUCTextBreakLineMask,
&breakLocator);
if (status != noErr)
return;

View File

@ -29,7 +29,8 @@ NS_GetComplexLineBreaks(const PRUnichar* aText, uint32_t aLength,
return;
do {
result = ScriptItemize(aText, aLength, items.Length(), NULL, NULL, items.Elements(), &outItems);
result = ScriptItemize(aText, aLength, items.Length(), nullptr, nullptr,
items.Elements(), &outItems);
if (result == E_OUTOFMEMORY) {
if (!items.AppendElements(items.Length()))