Fredrik Roubert 2024-03-13 22:25:40 +01:00 committed by Fredrik Roubert
parent de9910659d
commit 5401c12018
209 changed files with 1189 additions and 1179 deletions

View file

@ -114,11 +114,11 @@ UnhandledEngine::handleCharacter(UChar32 c) {
*/
ICULanguageBreakFactory::ICULanguageBreakFactory(UErrorCode &/*status*/) {
fEngines = 0;
fEngines = nullptr;
}
ICULanguageBreakFactory::~ICULanguageBreakFactory() {
if (fEngines != 0) {
if (fEngines != nullptr) {
delete fEngines;
}
}

View file

@ -195,7 +195,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
current[0] = 0;
pieces[0] = new UnicodeString[1];
pieces_lengths[0] = 1;
if (pieces[0] == 0) {
if (pieces[0] == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto CleanPartialInitialization;
}
@ -204,7 +204,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
list = new UnicodeString[source.length()];
if (list == 0) {
if (list == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto CleanPartialInitialization;
}
@ -287,7 +287,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
if (source.length() <= 2 && source.countChar32() <= 1) {
UnicodeString *toPut = new UnicodeString(source);
/* test for nullptr */
if (toPut == 0) {
if (toPut == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -356,7 +356,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
Hashtable permutations(status);
Hashtable basic(status);
if (U_FAILURE(status)) {
return 0;
return nullptr;
}
result.setValueDeleter(uprv_deleteUObject);
permutations.setValueDeleter(uprv_deleteUObject);
@ -409,7 +409,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
/* Test for buffer overflows */
if(U_FAILURE(status)) {
return 0;
return nullptr;
}
// convert into a String[] to clean up storage
//String[] finalResult = new String[result.size()];
@ -417,7 +417,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
int32_t resultCount;
if((resultCount = result.count()) != 0) {
finalResult = new UnicodeString[resultCount];
if (finalResult == 0) {
if (finalResult == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return nullptr;
}
@ -481,7 +481,7 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const cha
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
UnicodeString *toAdd = new UnicodeString(prefix);
/* test for nullptr */
if (toAdd == 0) {
if (toAdd == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return nullptr;
}

View file

@ -147,7 +147,7 @@ public:
if(umtx_atomic_dec(&refcount) <= 0) {
delete this;
}
return 0;
return nullptr;
}
virtual ~SimpleFilteredSentenceBreakData();

View file

@ -148,12 +148,12 @@ inline void Hashtable::initSize(UHashFunction *keyHash, UKeyComparator *keyComp,
}
inline Hashtable::Hashtable(UKeyComparator *keyComp, UValueComparator *valueComp,
UErrorCode& status) : hash(0) {
UErrorCode& status) : hash(nullptr) {
init( uhash_hashUnicodeString, keyComp, valueComp, status);
}
inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status)
: hash(0)
: hash(nullptr)
{
init(ignoreKeyCase ? uhash_hashCaselessUnicodeString
: uhash_hashUnicodeString,
@ -164,7 +164,7 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status)
}
inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& status)
: hash(0)
: hash(nullptr)
{
initSize(ignoreKeyCase ? uhash_hashCaselessUnicodeString
: uhash_hashUnicodeString,
@ -175,13 +175,13 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& statu
}
inline Hashtable::Hashtable(UErrorCode& status)
: hash(0)
: hash(nullptr)
{
init(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, status);
}
inline Hashtable::Hashtable()
: hash(0)
: hash(nullptr)
{
UErrorCode status = U_ZERO_ERROR;
init(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, status);

View file

@ -17,7 +17,7 @@ U_NAMESPACE_BEGIN
Locale LocaleBased::getLocale(ULocDataLocaleType type, UErrorCode& status) const {
const char* id = getLocaleID(type, status);
return Locale((id != 0) ? id : "");
return Locale(id != nullptr ? id : "");
}
const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
@ -37,11 +37,11 @@ const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status
}
void LocaleBased::setLocaleIDs(const char* validID, const char* actualID) {
if (validID != 0) {
if (validID != nullptr) {
uprv_strncpy(valid, validID, ULOC_FULLNAME_CAPACITY);
valid[ULOC_FULLNAME_CAPACITY-1] = 0; // always terminate
}
if (actualID != 0) {
if (actualID != nullptr) {
uprv_strncpy(actual, actualID, ULOC_FULLNAME_CAPACITY);
actual[ULOC_FULLNAME_CAPACITY-1] = 0; // always terminate
}

View file

@ -59,7 +59,7 @@ Locale::getDisplayLanguage(const Locale &displayLocale,
int32_t length;
buffer=result.getBuffer(ULOC_FULLNAME_CAPACITY);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -71,7 +71,7 @@ Locale::getDisplayLanguage(const Locale &displayLocale,
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
buffer=result.getBuffer(length);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -99,7 +99,7 @@ Locale::getDisplayScript(const Locale &displayLocale,
int32_t length;
buffer=result.getBuffer(ULOC_FULLNAME_CAPACITY);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -111,7 +111,7 @@ Locale::getDisplayScript(const Locale &displayLocale,
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
buffer=result.getBuffer(length);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -139,7 +139,7 @@ Locale::getDisplayCountry(const Locale &displayLocale,
int32_t length;
buffer=result.getBuffer(ULOC_FULLNAME_CAPACITY);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -151,7 +151,7 @@ Locale::getDisplayCountry(const Locale &displayLocale,
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
buffer=result.getBuffer(length);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -179,7 +179,7 @@ Locale::getDisplayVariant(const Locale &displayLocale,
int32_t length;
buffer=result.getBuffer(ULOC_FULLNAME_CAPACITY);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -191,7 +191,7 @@ Locale::getDisplayVariant(const Locale &displayLocale,
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
buffer=result.getBuffer(length);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -219,7 +219,7 @@ Locale::getDisplayName(const Locale &displayLocale,
int32_t length;
buffer=result.getBuffer(ULOC_FULLNAME_CAPACITY);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}
@ -231,7 +231,7 @@ Locale::getDisplayName(const Locale &displayLocale,
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
buffer=result.getBuffer(length);
if(buffer==0) {
if (buffer == nullptr) {
result.truncate(0);
return result;
}

View file

@ -633,7 +633,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
if (e.isValid() && U_SUCCESS(status)) {
UnicodeString temp2;
const char* key;
while ((key = e->next((int32_t *)0, status)) != nullptr) {
while ((key = e->next((int32_t*)nullptr, status)) != nullptr) {
auto value = loc.getKeywordValue<CharString>(key, status);
if (U_FAILURE(status)) {
return result;
@ -911,7 +911,7 @@ uldn_open(const char * locale,
UDialectHandling dialectHandling,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
return nullptr;
}
if (locale == nullptr) {
locale = uloc_getDefault();
@ -924,7 +924,7 @@ uldn_openForContext(const char * locale,
UDisplayContext *contexts, int32_t length,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
return nullptr;
}
if (locale == nullptr) {
locale = uloc_getDefault();

View file

@ -1845,7 +1845,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
// without goto and without another function
do {
char *separator;
char *field[5] = {0};
char *field[5] = {nullptr};
int32_t fieldLen[5] = {0};
int32_t fieldIdx;
int32_t variantField;
@ -1870,7 +1870,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
U_ASSERT(baseName == nullptr);
/*Go to heap for the fullName if necessary*/
fullName = (char *)uprv_malloc(sizeof(char)*(length + 1));
if(fullName == 0) {
if (fullName == nullptr) {
fullName = fullNameBuffer;
break; // error: out of memory
}
@ -1891,7 +1891,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
separator = field[0] = fullName;
fieldIdx = 1;
char* at = uprv_strchr(fullName, '@');
while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) != 0 &&
while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) != nullptr &&
fieldIdx < UPRV_LENGTHOF(field)-1 &&
(at == nullptr || separator < at)) {
field[fieldIdx] = separator + 1;

View file

@ -141,12 +141,12 @@ public:
/** Constructs only; init() should be called. */
ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest) :
impl(ni), str(dest),
start(NULL), reorderStart(NULL), limit(NULL),
start(nullptr), reorderStart(nullptr), limit(nullptr),
remainingCapacity(0), lastCC(0) {}
/** Constructs, removes the string contents, and initializes for a small initial capacity. */
ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &dest, UErrorCode &errorCode);
~ReorderingBuffer() {
if(start!=NULL) {
if (start != nullptr) {
str.releaseBuffer((int32_t)(limit-start));
}
}
@ -245,7 +245,7 @@ private:
*/
class U_COMMON_API Normalizer2Impl : public UObject {
public:
Normalizer2Impl() : normTrie(NULL), fCanonIterData(NULL) { }
Normalizer2Impl() : normTrie(nullptr), fCanonIterData(nullptr) {}
virtual ~Normalizer2Impl();
void init(const int32_t *inIndexes, const UCPTrie *inTrie,
@ -623,7 +623,7 @@ private:
const uint16_t *getMapping(uint16_t norm16) const { return extraData+(norm16>>OFFSET_SHIFT); }
const uint16_t *getCompositionsListForDecompYes(uint16_t norm16) const {
if(norm16<JAMO_L || MIN_NORMAL_MAYBE_YES<=norm16) {
return NULL;
return nullptr;
} else if(norm16<minMaybeYes) {
return getMapping(norm16); // for yesYes; if Jamo L: harmless empty list
} else {

View file

@ -1622,7 +1622,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
* of nullptr, will modify the libc behavior.
*/
posixID = setlocale(category, nullptr);
if ((posixID == 0)
if ((posixID == nullptr)
|| (uprv_strcmp("C", posixID) == 0)
|| (uprv_strcmp("POSIX", posixID) == 0))
{
@ -1636,16 +1636,16 @@ static const char *uprv_getPOSIXIDForCategory(int category)
posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE");
if ((posixID == 0) || (posixID[0] == '\0')) {
#else
if (posixID == 0) {
if (posixID == nullptr) {
posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE");
if (posixID == 0) {
if (posixID == nullptr) {
#endif
posixID = getenv("LANG");
}
}
}
}
if ((posixID==0)
if ((posixID == nullptr)
|| (uprv_strcmp("C", posixID) == 0)
|| (uprv_strcmp("POSIX", posixID) == 0))
{
@ -1665,7 +1665,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
static const char *uprv_getPOSIXIDForDefaultLocale()
{
static const char* posixID = nullptr;
if (posixID == 0) {
if (posixID == nullptr) {
posixID = uprv_getPOSIXIDForCategory(LC_MESSAGES);
}
return posixID;

View file

@ -1212,7 +1212,7 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c, const char* locale) {
fLanguageBreakEngines = new UStack(status);
if (fLanguageBreakEngines == nullptr || U_FAILURE(status)) {
delete fLanguageBreakEngines;
fLanguageBreakEngines = 0;
fLanguageBreakEngines = nullptr;
return nullptr;
}
}
@ -1252,7 +1252,7 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c, const char* locale) {
U_ASSERT(!fLanguageBreakEngines->hasDeleter());
if (U_FAILURE(status)) {
delete fUnhandledBreakEngine;
fUnhandledBreakEngine = 0;
fUnhandledBreakEngine = nullptr;
return nullptr;
}
}

View file

@ -86,7 +86,8 @@ RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules,
if (U_FAILURE(status)) {
return;
}
if(fSetBuilder == 0 || fScanner == 0 || fUSetNodes == 0 || fRuleStatusVals == 0) {
if (fSetBuilder == nullptr || fScanner == nullptr ||
fUSetNodes == nullptr || fRuleStatusVals == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
}
@ -156,7 +157,7 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
int32_t statusTableSize = align8(fRuleStatusVals->size() * sizeof(int32_t));
int32_t rulesLengthInUTF8 = 0;
u_strToUTF8WithSub(0, 0, &rulesLengthInUTF8,
u_strToUTF8WithSub(nullptr, 0, &rulesLengthInUTF8,
fStrippedRules.getBuffer(), fStrippedRules.length(),
0xfffd, nullptr, fStatus);
*fStatus = U_ZERO_ERROR;

View file

@ -122,7 +122,7 @@ const UnicodeFunctor *RBBISymbolTable::lookupMatcher(UChar32 ch) const
RBBISymbolTable *This = (RBBISymbolTable *)this; // cast off const
if (ch == 0xffff) {
retVal = fCachedSetLookup;
This->fCachedSetLookup = 0;
This->fCachedSetLookup = nullptr;
}
return retVal;
}

View file

@ -179,7 +179,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ResourceBundle)
ResourceBundle::ResourceBundle(UErrorCode &err)
:UObject(), fLocale(nullptr)
{
fResource = ures_open(0, Locale::getDefault().getName(), &err);
fResource = ures_open(nullptr, Locale::getDefault().getName(), &err);
}
ResourceBundle::ResourceBundle(const ResourceBundle &other)
@ -188,7 +188,7 @@ ResourceBundle::ResourceBundle(const ResourceBundle &other)
UErrorCode status = U_ZERO_ERROR;
if (other.fResource) {
fResource = ures_copyResb(0, other.fResource, &status);
fResource = ures_copyResb(nullptr, other.fResource, &status);
} else {
/* Copying a bad resource bundle */
fResource = nullptr;
@ -199,7 +199,7 @@ ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err)
:UObject(), fLocale(nullptr)
{
if (res) {
fResource = ures_copyResb(0, res, &err);
fResource = ures_copyResb(nullptr, res, &err);
} else {
/* Copying a bad resource bundle */
fResource = nullptr;
@ -218,7 +218,7 @@ ResourceBundle& ResourceBundle::operator=(const ResourceBundle& other)
if(this == &other) {
return *this;
}
if(fResource != 0) {
if (fResource != nullptr) {
ures_close(fResource);
fResource = nullptr;
}
@ -228,7 +228,7 @@ ResourceBundle& ResourceBundle::operator=(const ResourceBundle& other)
}
UErrorCode status = U_ZERO_ERROR;
if (other.fResource) {
fResource = ures_copyResb(0, other.fResource, &status);
fResource = ures_copyResb(nullptr, other.fResource, &status);
} else {
/* Copying a bad resource bundle */
fResource = nullptr;
@ -238,7 +238,7 @@ ResourceBundle& ResourceBundle::operator=(const ResourceBundle& other)
ResourceBundle::~ResourceBundle()
{
if(fResource != 0) {
if (fResource != nullptr) {
ures_close(fResource);
}
if(fLocale != nullptr) {
@ -311,7 +311,7 @@ ResourceBundle ResourceBundle::getNext(UErrorCode& status) {
UnicodeString ResourceBundle::getNextString(UErrorCode& status) {
int32_t len = 0;
const char16_t* r = ures_getNextString(fResource, &len, 0, &status);
const char16_t* r = ures_getNextString(fResource, &len, nullptr, &status);
return UnicodeString(true, r, len);
}

View file

@ -27,12 +27,12 @@ RuleCharacterIterator::RuleCharacterIterator(const UnicodeString& theText, const
text(theText),
pos(thePos),
sym(theSym),
buf(0),
buf(nullptr),
bufPos(0)
{}
UBool RuleCharacterIterator::atEnd() const {
return buf == 0 && pos.getIndex() == text.length();
return buf == nullptr && pos.getIndex() == text.length();
}
UChar32 RuleCharacterIterator::next(int32_t options, UBool& isEscaped, UErrorCode& ec) {
@ -45,8 +45,8 @@ UChar32 RuleCharacterIterator::next(int32_t options, UBool& isEscaped, UErrorCod
c = _current();
_advance(U16_LENGTH(c));
if (c == SymbolTable::SYMBOL_REF && buf == 0 &&
(options & PARSE_VARIABLES) != 0 && sym != 0) {
if (c == SymbolTable::SYMBOL_REF && buf == nullptr &&
(options & PARSE_VARIABLES) != 0 && sym != nullptr) {
UnicodeString name = sym->parseReference(text, pos, text.length());
// If name is empty there was an isolated SYMBOL_REF;
// return it. Caller must be prepared for this.
@ -55,13 +55,13 @@ UChar32 RuleCharacterIterator::next(int32_t options, UBool& isEscaped, UErrorCod
}
bufPos = 0;
buf = sym->lookup(name);
if (buf == 0) {
if (buf == nullptr) {
ec = U_UNDEFINED_VARIABLE;
return DONE;
}
// Handle empty variable value
if (buf->length() == 0) {
buf = 0;
buf = nullptr;
}
continue;
}
@ -114,7 +114,7 @@ UnicodeString& RuleCharacterIterator::lookahead(UnicodeString& result, int32_t m
if (maxLookAhead < 0) {
maxLookAhead = 0x7FFFFFFF;
}
if (buf != 0) {
if (buf != nullptr) {
buf->extract(bufPos, maxLookAhead, result);
} else {
text.extract(pos.getIndex(), maxLookAhead, result);
@ -135,7 +135,7 @@ UnicodeString& RuleCharacterIterator::toString(UnicodeString& result) const {
*/
UChar32 RuleCharacterIterator::_current() const {
if (buf != 0) {
if (buf != nullptr) {
return buf->char32At(bufPos);
} else {
int i = pos.getIndex();
@ -144,10 +144,10 @@ UChar32 RuleCharacterIterator::_current() const {
}
void RuleCharacterIterator::_advance(int32_t count) {
if (buf != 0) {
if (buf != nullptr) {
bufPos += count;
if (bufPos == buf->length()) {
buf = 0;
buf = nullptr;
}
} else {
pos.setIndex(pos.getIndex() + count);

View file

@ -224,7 +224,7 @@ private:
};
inline UBool RuleCharacterIterator::inVariable() const {
return buf != 0;
return buf != nullptr;
}
U_NAMESPACE_END

View file

@ -38,9 +38,9 @@ ubrk_open(UBreakIteratorType type,
UErrorCode *status)
{
if(U_FAILURE(*status)) return 0;
if (U_FAILURE(*status)) return nullptr;
BreakIterator *result = 0;
BreakIterator *result = nullptr;
switch(type) {
@ -70,11 +70,11 @@ ubrk_open(UBreakIteratorType type,
// check for allocation error
if (U_FAILURE(*status)) {
return 0;
return nullptr;
}
if(result == 0) {
if (result == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
@ -102,14 +102,14 @@ ubrk_openRules( const char16_t *rules,
UErrorCode *status) {
if (status == nullptr || U_FAILURE(*status)){
return 0;
return nullptr;
}
BreakIterator *result = 0;
BreakIterator *result = nullptr;
UnicodeString ruleString(rules, rulesLength);
result = RBBIRuleBuilder::createRuleBasedBreakIterator(ruleString, parseErr, *status);
if(U_FAILURE(*status)) {
return 0;
return nullptr;
}
UBreakIterator *uBI = (UBreakIterator *)result;

View file

@ -20,14 +20,14 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UCharCharacterIterator)
UCharCharacterIterator::UCharCharacterIterator()
: CharacterIterator(),
text(0)
text(nullptr)
{
// never default construct!
}
UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
int32_t length)
: CharacterIterator(textPtr != 0 ? (length>=0 ? length : u_strlen(textPtr)) : 0),
: CharacterIterator(textPtr != nullptr ? (length >= 0 ? length : u_strlen(textPtr)) : 0),
text(textPtr)
{
}
@ -35,7 +35,7 @@ UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
int32_t length,
int32_t position)
: CharacterIterator(textPtr != 0 ? (length>=0 ? length : u_strlen(textPtr)) : 0, position),
: CharacterIterator(textPtr != nullptr ? (length >= 0 ? length : u_strlen(textPtr)) : 0, position),
text(textPtr)
{
}
@ -45,7 +45,8 @@ UCharCharacterIterator::UCharCharacterIterator(ConstChar16Ptr textPtr,
int32_t textBegin,
int32_t textEnd,
int32_t position)
: CharacterIterator(textPtr != 0 ? (length>=0 ? length : u_strlen(textPtr)) : 0, textBegin, textEnd, position),
: CharacterIterator(textPtr != nullptr ? (length >= 0 ? length : u_strlen(textPtr)) : 0,
textBegin, textEnd, position),
text(textPtr)
{
}
@ -352,7 +353,7 @@ UCharCharacterIterator::move32(int32_t delta, CharacterIterator::EOrigin origin)
void UCharCharacterIterator::setText(ConstChar16Ptr newText,
int32_t newTextLength) {
text = newText;
if(newText == 0 || newTextLength < 0) {
if (newText == nullptr || newTextLength < 0) {
newTextLength = 0;
}
end = textLength = newTextLength;

View file

@ -1754,7 +1754,7 @@ ucnv_fromUChars(UConverter *cnv,
destLimit=dest+destCapacity;
/* perform the conversion */
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, nullptr, true, pErrorCode);
destLength=(int32_t)(dest-originalDest);
/* if an overflow occurs, then get the preflighting length */
@ -1765,7 +1765,7 @@ ucnv_fromUChars(UConverter *cnv,
do {
dest=buffer;
*pErrorCode=U_ZERO_ERROR;
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, nullptr, true, pErrorCode);
destLength+=(int32_t)(dest-buffer);
} while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
}
@ -1810,7 +1810,7 @@ ucnv_toUChars(UConverter *cnv,
destLimit=dest+destCapacity;
/* perform the conversion */
ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, nullptr, true, pErrorCode);
destLength=(int32_t)(dest-originalDest);
/* if an overflow occurs, then get the preflighting length */
@ -1822,7 +1822,7 @@ ucnv_toUChars(UConverter *cnv,
do {
dest=buffer;
*pErrorCode=U_ZERO_ERROR;
ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, pErrorCode);
ucnv_toUnicode(cnv, &dest, destLimit, &src, srcLimit, nullptr, true, pErrorCode);
destLength+=(int32_t)(dest-buffer);
}
while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);

View file

@ -1537,12 +1537,12 @@ _ISCII_SafeClone(const UConverter *cnv,
int32_t bufferSizeNeeded = sizeof(struct cloneISCIIStruct);
if (U_FAILURE(*status)) {
return 0;
return nullptr;
}
if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = bufferSizeNeeded;
return 0;
return nullptr;
}
localClone = (struct cloneISCIIStruct *)stackBuffer;

View file

@ -1978,12 +1978,12 @@ _SCSUSafeClone(const UConverter *cnv,
int32_t bufferSizeNeeded = sizeof(struct cloneSCSUStruct);
if (U_FAILURE(*status)){
return 0;
return nullptr;
}
if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = bufferSizeNeeded;
return 0;
return nullptr;
}
localClone = (struct cloneSCSUStruct *)stackBuffer;

View file

@ -295,7 +295,7 @@ myUCharsToChars(char* resultOfLen4, const char16_t* currency) {
static const int32_t*
_findMetaData(const char16_t* currency, UErrorCode& ec) {
if (currency == 0 || *currency == 0) {
if (currency == nullptr || *currency == 0) {
if (U_SUCCESS(ec)) {
ec = U_ILLEGAL_ARGUMENT_ERROR;
}
@ -370,7 +370,7 @@ U_CDECL_END
struct CReg;
static UMutex gCRegLock;
static CReg* gCRegHead = 0;
static CReg* gCRegHead = nullptr;
struct CReg : public icu::UMemory {
CReg *next;
@ -378,7 +378,7 @@ struct CReg : public icu::UMemory {
char id[ULOC_FULLNAME_CAPACITY];
CReg(const char16_t* _iso, const char* _id)
: next(0)
: next(nullptr)
{
int32_t len = (int32_t)uprv_strlen(_id);
if (len > (int32_t)(sizeof(id)-1)) {
@ -407,7 +407,7 @@ struct CReg : public icu::UMemory {
}
*status = U_MEMORY_ALLOCATION_ERROR;
}
return 0;
return nullptr;
}
static UBool unreg(UCurrRegistryKey key) {
@ -595,7 +595,7 @@ ucurr_forLocale(const char* locale,
ures_close(countryArray);
}
if ((U_FAILURE(localStatus)) && strchr(id.data(), '_') != 0) {
if ((U_FAILURE(localStatus)) && strchr(id.data(), '_') != nullptr) {
// We don't know about it. Check to see if we support the variant.
CharString parent = ulocimp_getParent(locale, *ec);
*ec = U_USING_FALLBACK_WARNING;
@ -669,13 +669,13 @@ ucurr_getName(const char16_t* currency,
//|}
if (U_FAILURE(*ec)) {
return 0;
return nullptr;
}
int32_t choice = (int32_t) nameStyle;
if (choice < 0 || choice > 4) {
*ec = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
// In the future, resource bundles may implement multi-level
@ -694,7 +694,7 @@ ucurr_getName(const char16_t* currency,
CharString loc = ulocimp_getName(locale, ec2);
if (U_FAILURE(ec2)) {
*ec = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
char buf[ISO_CURRENCY_CODE_LENGTH+1];
@ -721,7 +721,7 @@ ucurr_getName(const char16_t* currency,
break;
default:
*ec = U_UNSUPPORTED_ERROR;
return 0;
return nullptr;
}
key.append("/", ec2);
key.append(buf, ec2);
@ -782,7 +782,7 @@ ucurr_getPluralName(const char16_t* currency,
//|}
if (U_FAILURE(*ec)) {
return 0;
return nullptr;
}
// Use a separate UErrorCode here that does not propagate out of
@ -792,7 +792,7 @@ ucurr_getPluralName(const char16_t* currency,
CharString loc = ulocimp_getName(locale, ec2);
if (U_FAILURE(ec2)) {
*ec = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
char buf[ISO_CURRENCY_CODE_LENGTH+1];
@ -1421,7 +1421,7 @@ currency_cache_cleanup() {
for (int32_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
if (currCache[i]) {
deleteCacheEntry(currCache[i]);
currCache[i] = 0;
currCache[i] = nullptr;
}
}
return true;
@ -2703,7 +2703,7 @@ ucurr_getNumericCode(const char16_t* currency) {
if (currency && u_strlen(currency) == ISO_CURRENCY_CODE_LENGTH) {
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *bundle = ures_openDirect(0, "currencyNumericCodes", &status);
UResourceBundle *bundle = ures_openDirect(nullptr, "currencyNumericCodes", &status);
ures_getByKey(bundle, "codeMap", bundle, &status);
if (U_SUCCESS(status)) {
char alphaCode[ISO_CURRENCY_CODE_LENGTH+1];

View file

@ -850,12 +850,12 @@ static UBool extendICUData(UErrorCode *pErr)
UDataMemory_init(&copyPData);
if(pData != nullptr) {
UDatamemory_assign(&copyPData, pData);
copyPData.map = 0; /* The mapping for this data is owned by the hash table */
copyPData.mapAddr = 0; /* which will unmap it when ICU is shut down. */
/* CommonICUData is also unmapped when ICU is shut down.*/
/* To avoid unmapping the data twice, zero out the map */
/* fields in the UDataMemory that we're assigning */
/* to CommonICUData. */
copyPData.map = nullptr; /* The mapping for this data is owned by the hash table */
copyPData.mapAddr = nullptr; /* which will unmap it when ICU is shut down. */
/* CommonICUData is also unmapped when ICU is shut down.*/
/* To avoid unmapping the data twice, zero out the map */
/* fields in the UDataMemory that we're assigning */
/* to CommonICUData. */
didUpdate = /* no longer using this result */
setCommonICUData(&copyPData,/* The new common data. */

View file

@ -441,7 +441,7 @@ udata_openSwapperForInputData(const void *data, int32_t length,
pHeader->info.sizeofUChar!=2
) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
return nullptr;
}
inIsBigEndian=(UBool)pHeader->info.isBigEndian;
@ -461,7 +461,7 @@ udata_openSwapperForInputData(const void *data, int32_t length,
(length>=0 && length<headerSize)
) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
return nullptr;
}
return udata_openSwapper(inIsBigEndian, inCharset, outIsBigEndian, outCharset, pErrorCode);

View file

@ -66,7 +66,7 @@ noopSetState(UCharIterator * /*iter*/, uint32_t /*state*/, UErrorCode *pErrorCod
}
static const UCharIterator noopIterator={
0, 0, 0, 0, 0, 0,
nullptr, 0, 0, 0, 0, 0,
noopGetIndex,
noopMove,
noopHasNext,
@ -197,7 +197,7 @@ stringIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCo
}
static const UCharIterator stringIterator={
0, 0, 0, 0, 0, 0,
nullptr, 0, 0, 0, 0, 0,
stringIteratorGetIndex,
stringIteratorMove,
stringIteratorHasNext,
@ -212,8 +212,8 @@ static const UCharIterator stringIterator={
U_CAPI void U_EXPORT2
uiter_setString(UCharIterator *iter, const char16_t *s, int32_t length) {
if(iter!=0) {
if(s!=0 && length>=-1) {
if (iter != nullptr) {
if (s != nullptr && length >= -1) {
*iter=stringIterator;
iter->context=s;
if(length>=0) {
@ -283,7 +283,7 @@ utf16BEIteratorPrevious(UCharIterator *iter) {
}
static const UCharIterator utf16BEIterator={
0, 0, 0, 0, 0, 0,
nullptr, 0, 0, 0, 0, 0,
stringIteratorGetIndex,
stringIteratorMove,
stringIteratorHasNext,
@ -457,7 +457,7 @@ characterIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErro
}
static const UCharIterator characterIteratorWrapper={
0, 0, 0, 0, 0, 0,
nullptr, 0, 0, 0, 0, 0,
characterIteratorGetIndex,
characterIteratorMove,
characterIteratorHasNext,
@ -472,8 +472,8 @@ static const UCharIterator characterIteratorWrapper={
U_CAPI void U_EXPORT2
uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter) {
if(iter!=0) {
if(charIter!=0) {
if (iter != nullptr) {
if (charIter != nullptr) {
*iter=characterIteratorWrapper;
iter->context=charIter;
} else {
@ -521,7 +521,7 @@ replaceableIteratorPrevious(UCharIterator *iter) {
}
static const UCharIterator replaceableIterator={
0, 0, 0, 0, 0, 0,
nullptr, 0, 0, 0, 0, 0,
stringIteratorGetIndex,
stringIteratorMove,
stringIteratorHasNext,
@ -536,8 +536,8 @@ static const UCharIterator replaceableIterator={
U_CAPI void U_EXPORT2
uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) {
if(iter!=0) {
if(rep!=0) {
if (iter != nullptr) {
if (rep != nullptr) {
*iter=replaceableIterator;
iter->context=rep;
iter->limit=iter->length=rep->length();
@ -987,7 +987,7 @@ utf8IteratorSetState(UCharIterator *iter,
}
static const UCharIterator utf8Iterator={
0, 0, 0, 0, 0, 0,
nullptr, 0, 0, 0, 0, 0,
utf8IteratorGetIndex,
utf8IteratorMove,
utf8IteratorHasNext,
@ -1002,8 +1002,8 @@ static const UCharIterator utf8Iterator={
U_CAPI void U_EXPORT2
uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length) {
if(iter!=0) {
if(s!=0 && length>=-1) {
if (iter != nullptr) {
if (s != nullptr && length >= -1) {
*iter=utf8Iterator;
iter->context=s;
if(length>=0) {

View file

@ -1680,7 +1680,7 @@ uloc_openKeywords(const char* localeID,
UErrorCode* status)
{
if(status==nullptr || U_FAILURE(*status)) {
return 0;
return nullptr;
}
CharString tempBuffer;
@ -1705,7 +1705,7 @@ uloc_openKeywords(const char* localeID,
&tmpLocaleID,
*status);
if (U_FAILURE(*status)) {
return 0;
return nullptr;
}
/* keywords are located after '@' */

View file

@ -236,9 +236,9 @@ typedef HANDLE MemoryMap;
/* get a view of the mapping */
#if U_PLATFORM != U_PF_HPUX
data=mmap(0, length, PROT_READ, MAP_SHARED, fd, 0);
data=mmap(nullptr, length, PROT_READ, MAP_SHARED, fd, 0);
#else
data=mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0);
data=mmap(nullptr, length, PROT_READ, MAP_PRIVATE, fd, 0);
#endif
close(fd); /* no longer needed */
if(data==MAP_FAILED) {
@ -262,7 +262,7 @@ typedef HANDLE MemoryMap;
if(munmap(pData->mapAddr, dataLen)==-1) {
}
pData->pHeader=nullptr;
pData->map=0;
pData->map=nullptr;
pData->mapAddr=nullptr;
}
}

View file

@ -273,10 +273,10 @@ public:
* @see uloc_getDefault
* @stable ICU 2.0
*/
Locale( const char * language,
const char * country = 0,
const char * variant = 0,
const char * keywordsAndValues = 0);
Locale(const char* language,
const char* country = nullptr,
const char* variant = nullptr,
const char* keywordsAndValues = nullptr);
/**
* Initializes a Locale object from another Locale object.

View file

@ -1611,9 +1611,9 @@ public:
* @stable ICU 2.0
*/
inline int32_t extract(int32_t start,
int32_t startLength,
char *target,
const char *codepage = 0) const;
int32_t startLength,
char* target,
const char* codepage = nullptr) const;
/**
* Copy the characters in the range
@ -3682,10 +3682,10 @@ private:
* Return false if memory could not be allocated.
*/
UBool cloneArrayIfNeeded(int32_t newCapacity = -1,
int32_t growCapacity = -1,
UBool doCopyArray = true,
int32_t **pBufferToDelete = 0,
UBool forceClone = false);
int32_t growCapacity = -1,
UBool doCopyArray = true,
int32_t** pBufferToDelete = nullptr,
UBool forceClone = false);
/**
* Common function for UnicodeString case mappings.
@ -4508,7 +4508,7 @@ UnicodeString::extract(int32_t start,
{
// This dstSize value will be checked explicitly
return extract(start, _length, dst, dst!=0 ? 0xffffffff : 0, codepage);
return extract(start, _length, dst, dst != nullptr ? 0xffffffff : 0, codepage);
}
#endif

View file

@ -16,11 +16,11 @@ UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(UnicodeFunctor)
UnicodeFunctor::~UnicodeFunctor() {}
UnicodeMatcher* UnicodeFunctor::toMatcher() const {
return 0;
return nullptr;
}
UnicodeReplacer* UnicodeFunctor::toReplacer() const {
return 0;
return nullptr;
}
U_NAMESPACE_END

View file

@ -226,14 +226,14 @@ namespace {
class UnicodeSetPointer {
UnicodeSet* p;
public:
inline UnicodeSetPointer() : p(0) {}
inline UnicodeSetPointer() : p(nullptr) {}
inline ~UnicodeSetPointer() { delete p; }
inline UnicodeSet* pointer() { return p; }
inline UBool allocate() {
if (p == 0) {
if (p == nullptr) {
p = new UnicodeSet();
}
return p != 0;
return p != nullptr;
}
};
@ -300,7 +300,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
UChar32 c = 0;
UBool literal = false;
UnicodeSet* nested = 0; // alias - do not delete
UnicodeSet* nested = nullptr; // alias - do not delete
// -------- Check for property pattern
@ -352,9 +352,9 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
continue;
}
}
} else if (symbols != 0) {
} else if (symbols != nullptr) {
const UnicodeFunctor *m = symbols->lookupMatcher(c);
if (m != 0) {
if (m != nullptr) {
const UnicodeSet *ms = dynamic_cast<const UnicodeSet *>(m);
if (ms == nullptr) {
ec = U_MALFORMED_SET;
@ -390,7 +390,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
patLocal.append(op);
}
if (nested == 0) {
if (nested == nullptr) {
// lazy allocation
if (!scratch.allocate()) {
ec = U_MEMORY_ALLOCATION_ERROR;
@ -549,7 +549,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
UBool anchor = (c == u']' && !literal);
if (symbols == 0 && !anchor) {
if (symbols == nullptr && !anchor) {
c = SymbolTable::SYMBOL_REF;
chars.setPos(backup);
break; // literal '$'

View file

@ -283,7 +283,7 @@ UnicodeString::UnicodeString(const char *src, int32_t length, EInvariant) {
UnicodeString::UnicodeString(const char *codepageData) {
fUnion.fFields.fLengthAndFlags = kShortString;
if(codepageData != 0) {
if (codepageData != nullptr) {
setToUTF8(codepageData);
}
}
@ -291,7 +291,7 @@ UnicodeString::UnicodeString(const char *codepageData) {
UnicodeString::UnicodeString(const char *codepageData, int32_t dataLength) {
fUnion.fFields.fLengthAndFlags = kShortString;
// if there's nothing to convert, do nothing
if(codepageData == 0 || dataLength == 0 || dataLength < -1) {
if (codepageData == nullptr || dataLength == 0 || dataLength < -1) {
return;
}
if(dataLength == -1) {
@ -393,7 +393,7 @@ UnicodeString::allocate(int32_t capacity) {
}
}
fUnion.fFields.fLengthAndFlags = kIsBogus;
fUnion.fFields.fArray = 0;
fUnion.fFields.fArray = nullptr;
fUnion.fFields.fCapacity = 0;
return false;
}
@ -564,7 +564,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
// if src is bogus, set ourselves to bogus
// do not call setToBogus() here because fArray and flags are not consistent here
fUnion.fFields.fLengthAndFlags = kIsBogus;
fUnion.fFields.fArray = 0;
fUnion.fFields.fArray = nullptr;
fUnion.fFields.fCapacity = 0;
break;
}
@ -919,7 +919,7 @@ UnicodeString::extract(Char16Ptr dest, int32_t destCapacity,
UErrorCode &errorCode) const {
int32_t len = length();
if(U_SUCCESS(errorCode)) {
if(isBogus() || destCapacity<0 || (destCapacity>0 && dest==0)) {
if (isBogus() || destCapacity < 0 || (destCapacity > 0 && dest == nullptr)) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else {
const char16_t *array = getArrayStart();
@ -986,7 +986,7 @@ int32_t
UnicodeString::extract(int32_t start, int32_t len,
char *target, uint32_t dstSize) const {
// if the arguments are illegal, then do nothing
if(/*dstSize < 0 || */(dstSize > 0 && target == 0)) {
if (/*dstSize < 0 || */(dstSize > 0 && target == nullptr)) {
return 0;
}
return toUTF8(start, len, target, dstSize <= 0x7fffffff ? (int32_t)dstSize : 0x7fffffff);
@ -1071,7 +1071,7 @@ UnicodeString::indexOf(const char16_t *srcChars,
int32_t start,
int32_t length) const
{
if(isBogus() || srcChars == 0 || srcStart < 0 || srcLength == 0) {
if (isBogus() || srcChars == nullptr || srcStart < 0 || srcLength == 0) {
return -1;
}
@ -1135,7 +1135,7 @@ UnicodeString::lastIndexOf(const char16_t *srcChars,
int32_t start,
int32_t length) const
{
if(isBogus() || srcChars == 0 || srcStart < 0 || srcLength == 0) {
if (isBogus() || srcChars == nullptr || srcStart < 0 || srcLength == 0) {
return -1;
}
@ -1245,7 +1245,7 @@ UnicodeString::setToBogus()
releaseArray();
fUnion.fFields.fLengthAndFlags = kIsBogus;
fUnion.fFields.fArray = 0;
fUnion.fFields.fArray = nullptr;
fUnion.fFields.fCapacity = 0;
}
@ -1488,7 +1488,7 @@ UnicodeString::doReplace(int32_t start,
return doAppend(srcChars, srcStart, srcLength);
}
if(srcChars == 0) {
if (srcChars == nullptr) {
srcLength = 0;
} else {
// Perform all remaining operations relative to srcChars + srcStart.
@ -1537,7 +1537,7 @@ UnicodeString::doReplace(int32_t start,
}
// clone our array and allocate a bigger array if needed
int32_t *bufferToDelete = 0;
int32_t *bufferToDelete = nullptr;
if(!cloneArrayIfNeeded(newLength, getGrowCapacity(newLength),
false, &bufferToDelete)
) {
@ -1930,7 +1930,7 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
// the array is refCounted; decrement and release if 0
u_atomic_int32_t *pRefCount = ((u_atomic_int32_t *)oldArray - 1);
if(umtx_atomic_dec(pRefCount) == 0) {
if(pBufferToDelete == 0) {
if (pBufferToDelete == nullptr) {
// Note: cast to (void *) is needed with MSVC, where u_atomic_int32_t
// is defined as volatile. (Volatile has useful non-standard behavior
// with this compiler.)

View file

@ -193,7 +193,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
// This is very similar to how doReplace() keeps the old array pointer
// and deletes the old array itself after it is done.
// In addition, we are forcing cloneArrayIfNeeded() to always allocate a new array.
int32_t *bufferToDelete = 0;
int32_t *bufferToDelete = nullptr;
if (!cloneArrayIfNeeded(newLength, newLength, false, &bufferToDelete, true)) {
return *this;
}

View file

@ -62,7 +62,7 @@ UnicodeString::UnicodeString(const char *codepageData,
UnicodeString::UnicodeString(const char *codepageData,
const char *codepage) {
fUnion.fFields.fLengthAndFlags = kShortString;
if(codepageData != 0) {
if (codepageData != nullptr) {
doCodepageCreate(codepageData, (int32_t)uprv_strlen(codepageData), codepage);
}
}
@ -71,7 +71,7 @@ UnicodeString::UnicodeString(const char *codepageData,
int32_t dataLength,
const char *codepage) {
fUnion.fFields.fLengthAndFlags = kShortString;
if(codepageData != 0) {
if (codepageData != nullptr) {
doCodepageCreate(codepageData, dataLength, codepage);
}
}
@ -92,7 +92,7 @@ UnicodeString::UnicodeString(const char *src, int32_t srcLength,
srcLength=(int32_t)uprv_strlen(src);
}
if(srcLength>0) {
if(cnv!=0) {
if (cnv != nullptr) {
// use the provided converter
ucnv_resetToUnicode(cnv);
doCodepageCreate(src, srcLength, cnv, errorCode);
@ -136,7 +136,7 @@ UnicodeString::extract(int32_t start,
const char *codepage) const
{
// if the arguments are illegal, then do nothing
if(/*dstSize < 0 || */(dstSize > 0 && target == 0)) {
if (/*dstSize < 0 || */(dstSize > 0 && target == nullptr)) {
return 0;
}
@ -171,7 +171,7 @@ UnicodeString::extract(int32_t start,
// if the codepage is the default, use our cache
// if it is an empty string, then use the "invariant character" conversion
if (codepage == 0) {
if (codepage == nullptr) {
const char *defaultName = ucnv_getDefaultName();
if(UCNV_FAST_IS_UTF8(defaultName)) {
return toUTF8(start, length, target, capacity);
@ -194,7 +194,7 @@ UnicodeString::extract(int32_t start,
length = doExtract(start, length, target, capacity, converter, status);
// close the converter
if (codepage == 0) {
if (codepage == nullptr) {
u_releaseDefaultConverter(converter);
} else {
ucnv_close(converter);
@ -212,7 +212,7 @@ UnicodeString::extract(char *dest, int32_t destCapacity,
return 0;
}
if(isBogus() || destCapacity<0 || (destCapacity>0 && dest==0)) {
if (isBogus() || destCapacity < 0 || (destCapacity > 0 && dest == nullptr)) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@ -224,7 +224,7 @@ UnicodeString::extract(char *dest, int32_t destCapacity,
// get the converter
UBool isDefaultConverter;
if(cnv==0) {
if (cnv == nullptr) {
isDefaultConverter=true;
cnv=u_getDefaultConverter(&errorCode);
if(U_FAILURE(errorCode)) {
@ -264,7 +264,7 @@ UnicodeString::doExtract(int32_t start, int32_t length,
const char *destLimit;
if(destCapacity==0) {
destLimit=dest=0;
destLimit=dest=nullptr;
} else if(destCapacity==-1) {
// Pin the limit to U_MAX_PTR if the "magic" destCapacity is used.
destLimit=(char*)U_MAX_PTR(dest);
@ -275,7 +275,7 @@ UnicodeString::doExtract(int32_t start, int32_t length,
}
// perform the conversion
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, &errorCode);
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, nullptr, true, &errorCode);
length=(int32_t)(dest-originalDest);
// if an overflow occurs, then get the preflighting length
@ -286,7 +286,7 @@ UnicodeString::doExtract(int32_t start, int32_t length,
do {
dest=buffer;
errorCode=U_ZERO_ERROR;
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, 0, true, &errorCode);
ucnv_fromUnicode(cnv, &dest, destLimit, &src, srcLimit, nullptr, true, &errorCode);
length+=(int32_t)(dest-buffer);
} while(errorCode==U_BUFFER_OVERFLOW_ERROR);
}
@ -300,7 +300,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
const char *codepage)
{
// if there's nothing to convert, do nothing
if(codepageData == 0 || dataLength == 0 || dataLength < -1) {
if (codepageData == nullptr || dataLength == 0 || dataLength < -1) {
return;
}
if(dataLength == -1) {
@ -313,14 +313,14 @@ UnicodeString::doCodepageCreate(const char *codepageData,
// if the codepage is the default, use our cache
// if it is an empty string, then use the "invariant character" conversion
UConverter *converter;
if (codepage == 0) {
if (codepage == nullptr) {
const char *defaultName = ucnv_getDefaultName();
if(UCNV_FAST_IS_UTF8(defaultName)) {
setToUTF8(StringPiece(codepageData, dataLength));
return;
}
converter = u_getDefaultConverter(&status);
} else if(*codepage == 0) {
} else if (*codepage == 0) {
// use the "invariant characters" conversion
if(cloneArrayIfNeeded(dataLength, dataLength, false)) {
u_charsToUChars(codepageData, getArrayStart(), dataLength);
@ -346,7 +346,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
}
// close the converter
if(codepage == 0) {
if (codepage == nullptr) {
u_releaseDefaultConverter(converter);
} else {
ucnv_close(converter);
@ -390,7 +390,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
array = getArrayStart();
myTarget = array + length();
ucnv_toUnicode(converter, &myTarget, array + getCapacity(),
&mySource, mySourceEnd, 0, true, &status);
&mySource, mySourceEnd, nullptr, true, &status);
// update the conversion parameters
setLength((int32_t)(myTarget - array));

View file

@ -68,7 +68,7 @@ UnicodeString::trim()
// move string forward over leading white space
if(start > 0) {
doReplace(0, start, 0, 0, 0);
doReplace(0, start, nullptr, 0, 0);
}
return *this;

View file

@ -403,7 +403,7 @@ unorm_cmpEquivFold(const char16_t *s1, int32_t length1,
}
if( level1<2 && (options&_COMPARE_EQUIV) &&
0!=(p=nfcImpl->getDecomposition((UChar32)cp1, decomp1, length))
nullptr != (p = nfcImpl->getDecomposition((UChar32)cp1, decomp1, length))
) {
/* cp1 decomposes into p[length] */
if(U_IS_SURROGATE(c1)) {
@ -444,7 +444,7 @@ unorm_cmpEquivFold(const char16_t *s1, int32_t length1,
}
if( level2<2 && (options&_COMPARE_EQUIV) &&
0!=(p=nfcImpl->getDecomposition((UChar32)cp2, decomp2, length))
nullptr != (p = nfcImpl->getDecomposition((UChar32)cp2, decomp2, length))
) {
/* cp2 decomposes into p[length] */
if(U_IS_SURROGATE(c2)) {
@ -566,7 +566,7 @@ unorm_compare(const char16_t *s1, int32_t length1,
if(U_FAILURE(*pErrorCode)) {
return 0;
}
if(s1==0 || length1<-1 || s2==0 || length2<-1) {
if (s1 == nullptr || length1 < -1 || s2 == nullptr || length2 < -1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}

View file

@ -1709,7 +1709,7 @@ U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
static const char16_t* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
if(RES_GET_TYPE(r) == URES_ALIAS) {
const char16_t* result = 0;
const char16_t* result = nullptr;
UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, nullptr, status);
result = ures_getString(tempRes, len, status);
ures_close(tempRes);
@ -2574,7 +2574,7 @@ U_CAPI const char16_t* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB
return res_getString({resB, key}, &dataEntry->fData, res, len);
case URES_ALIAS:
{
const char16_t* result = 0;
const char16_t* result = nullptr;
UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status);
result = ures_getString(tempRes, len, status);
ures_close(tempRes);
@ -2596,7 +2596,7 @@ U_CAPI const char16_t* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB
return res_getString({resB, key}, &resB->getResData(), res, len);
case URES_ALIAS:
{
const char16_t* result = 0;
const char16_t* result = nullptr;
UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status);
result = ures_getString(tempRes, len, status);
ures_close(tempRes);
@ -2949,7 +2949,7 @@ ures_loc_nextLocale(UEnumeration* en,
UResourceBundle *k = nullptr;
const char *result = nullptr;
int32_t len = 0;
if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) {
if (ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != nullptr) {
result = ures_getKey(k);
len = (int32_t)uprv_strlen(result);
}
@ -3043,7 +3043,7 @@ static void getParentForFunctionalEquivalent(const char* localeID,
// such as collation, data may have different parents than in parentLocales).
UErrorCode subStatus = U_ZERO_ERROR;
parent.clear();
if (res != NULL) {
if (res != nullptr) {
ures_getByKey(res, "%%Parent", bund1, &subStatus);
if (U_SUCCESS(subStatus)) {
int32_t length16;
@ -3238,9 +3238,9 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
// root and has a different language than the parent. Use of the VALID locale
// here is similar to the procedure used at the end of the previous do-while loop
// for all resource types.
if (res != NULL && uprv_strcmp(resName, "collations") == 0) {
if (res != nullptr && uprv_strcmp(resName, "collations") == 0) {
const char *validLoc = ures_getLocaleByType(res, ULOC_VALID_LOCALE, &subStatus);
if (U_SUCCESS(subStatus) && validLoc != NULL && validLoc[0] != 0 && uprv_strcmp(validLoc, "root") != 0) {
if (U_SUCCESS(subStatus) && validLoc != nullptr && validLoc[0] != 0 && uprv_strcmp(validLoc, "root") != 0) {
CharString validLang = ulocimp_getLanguage(validLoc, subStatus);
CharString parentLang = ulocimp_getLanguage(parent.data(), subStatus);
if (U_SUCCESS(subStatus) && validLang != parentLang) {
@ -3421,8 +3421,8 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
valuesBuf[0]=0;
valuesBuf[1]=0;
while((locale = uenum_next(locs, &locLen, status)) != 0) {
while ((locale = uenum_next(locs, &locLen, status)) != nullptr) {
UResourceBundle *bund = nullptr;
UResourceBundle *subPtr = nullptr;
UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */
@ -3446,8 +3446,8 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
bund = nullptr;
continue;
}
while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0
while ((subPtr = ures_getNextResource(&item, &subItem, &subStatus)) != nullptr
&& U_SUCCESS(subStatus)) {
const char *k;
int32_t i;

View file

@ -36,9 +36,9 @@ uset_openPattern(const char16_t* pattern, int32_t patternLength,
UnicodeString pat(patternLength==-1, pattern, patternLength);
UnicodeSet* set = new UnicodeSet(pat, *ec);
/* test for nullptr */
if(set == 0) {
if (set == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
if (U_FAILURE(*ec)) {
@ -56,9 +56,9 @@ uset_openPatternOptions(const char16_t* pattern, int32_t patternLength,
UnicodeString pat(patternLength==-1, pattern, patternLength);
UnicodeSet* set = new UnicodeSet(pat, options, nullptr, *ec);
/* test for nullptr */
if(set == 0) {
if (set == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
if (U_FAILURE(*ec)) {

View file

@ -228,7 +228,7 @@ loadData(UStringPrepProfile* profile,
const char* type,
UErrorCode* errorCode) {
/* load Unicode SPREP data from file */
UTrie _sprepTrie={ 0,0,0,0,0,0,0 };
UTrie _sprepTrie = {nullptr, nullptr, nullptr, 0, 0, 0, 0};
UDataMemory *dataMemory;
const int32_t *p=nullptr;
const uint8_t *pb;

View file

@ -1857,7 +1857,7 @@ u_strCaseCompare(const char16_t *s1, int32_t length1,
uint32_t options,
UErrorCode *pErrorCode) {
/* argument checking */
if(pErrorCode==0 || U_FAILURE(*pErrorCode)) {
if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
if(s1==nullptr || length1<-1 || s2==nullptr || length2<-1) {

View file

@ -168,8 +168,8 @@ const char *UStringEnumeration::next(int32_t *resultLength, UErrorCode &status)
const UnicodeString* UStringEnumeration::snext(UErrorCode& status) {
int32_t length;
const char16_t* str = uenum_unext(uenum, &length, &status);
if (str == 0 || U_FAILURE(status)) {
return 0;
if (str == nullptr || U_FAILURE(status)) {
return nullptr;
}
return &unistr.setTo(str, length);
}
@ -360,7 +360,7 @@ U_CAPI UEnumeration* U_EXPORT2
uenum_openCharStringsEnumeration(const char* const strings[], int32_t count,
UErrorCode* ec) {
UCharStringEnumeration* result = nullptr;
if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != 0)) {
if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != nullptr)) {
result = (UCharStringEnumeration*) uprv_malloc(sizeof(UCharStringEnumeration));
if (result == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;
@ -379,7 +379,7 @@ U_CAPI UEnumeration* U_EXPORT2
uenum_openUCharStringsEnumeration(const char16_t* const strings[], int32_t count,
UErrorCode* ec) {
UCharStringEnumeration* result = nullptr;
if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != 0)) {
if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != nullptr)) {
result = (UCharStringEnumeration*) uprv_malloc(sizeof(UCharStringEnumeration));
if (result == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;

View file

@ -137,33 +137,33 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
UTrie2 *trie;
if(U_FAILURE(*pErrorCode)) {
return 0;
return nullptr;
}
if( length<=0 || (U_POINTER_MASK_LSB(data, 3)!=0) ||
valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
/* enough data for a trie header? */
if(length<(int32_t)sizeof(UTrie2Header)) {
*pErrorCode=U_INVALID_FORMAT_ERROR;
return 0;
return nullptr;
}
/* check the signature */
header=(const UTrie2Header *)data;
if(header->signature!=UTRIE2_SIG) {
*pErrorCode=U_INVALID_FORMAT_ERROR;
return 0;
return nullptr;
}
/* get the options */
if(valueBits!=(UTrie2ValueBits)(header->options&UTRIE2_OPTIONS_VALUE_BITS_MASK)) {
*pErrorCode=U_INVALID_FORMAT_ERROR;
return 0;
return nullptr;
}
/* get the length values and offsets */
@ -188,14 +188,14 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
}
if(length<actualLength) {
*pErrorCode=U_INVALID_FORMAT_ERROR; /* not enough bytes */
return 0;
return nullptr;
}
/* allocate the trie */
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
if(trie==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
uprv_memcpy(trie, &tempTrie, sizeof(tempTrie));
trie->memory=(uint32_t *)data;
@ -226,7 +226,7 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
break;
default:
*pErrorCode=U_INVALID_FORMAT_ERROR;
return 0;
return nullptr;
}
if(pActualLength!=nullptr) {
@ -247,12 +247,12 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
int32_t dataMove; /* >0 if the data is moved to the end of the index array */
if(U_FAILURE(*pErrorCode)) {
return 0;
return nullptr;
}
if(valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
/* calculate the total length of the dummy trie data */
@ -269,14 +269,14 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
if(trie==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
uprv_memset(trie, 0, sizeof(UTrie2));
trie->memory=uprv_malloc(length);
if(trie->memory==nullptr) {
uprv_free(trie);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
trie->length=length;
trie->isMemoryOwned=true;
@ -364,7 +364,7 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
break;
default:
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
return trie;

View file

@ -131,7 +131,7 @@ utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode)
uprv_free(newTrie);
uprv_free(data);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
uprv_memset(trie, 0, sizeof(UTrie2));

View file

@ -183,7 +183,7 @@ void UVector::insertElementAt(int32_t elem, int32_t index, UErrorCode &status) {
}
void* UVector::elementAt(int32_t index) const {
return (0 <= index && index < count) ? elements[index].pointer : 0;
return (0 <= index && index < count) ? elements[index].pointer : nullptr;
}
int32_t UVector::elementAti(int32_t index) const {

View file

@ -39,7 +39,7 @@ UVector32::UVector32(int32_t initialCapacity, UErrorCode &status) :
count(0),
capacity(0),
maxCapacity(0),
elements(0)
elements(nullptr)
{
_init(initialCapacity, status);
}
@ -58,7 +58,7 @@ void UVector32::_init(int32_t initialCapacity, UErrorCode &status) {
initialCapacity = uprv_min(DEFAULT_CAPACITY, maxCapacity);
}
elements = (int32_t *)uprv_malloc(sizeof(int32_t)*initialCapacity);
if (elements == 0) {
if (elements == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
} else {
capacity = initialCapacity;
@ -67,7 +67,7 @@ void UVector32::_init(int32_t initialCapacity, UErrorCode &status) {
UVector32::~UVector32() {
uprv_free(elements);
elements = 0;
elements = nullptr;
}
/**

View file

@ -36,7 +36,7 @@ UVector64::UVector64(int32_t initialCapacity, UErrorCode &status) :
count(0),
capacity(0),
maxCapacity(0),
elements(0)
elements(nullptr)
{
_init(initialCapacity, status);
}
@ -55,7 +55,7 @@ void UVector64::_init(int32_t initialCapacity, UErrorCode &status) {
initialCapacity = uprv_min(DEFAULT_CAPACITY, maxCapacity);
}
elements = (int64_t *)uprv_malloc(sizeof(int64_t)*initialCapacity);
if (elements == 0) {
if (elements == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
} else {
capacity = initialCapacity;
@ -64,7 +64,7 @@ void UVector64::_init(int32_t initialCapacity, UErrorCode &status) {
UVector64::~UVector64() {
uprv_free(elements);
elements = 0;
elements = nullptr;
}
/**

View file

@ -71,7 +71,7 @@ U_CFUNC char uconvmsg_dat[];
#define DEFAULT_BUFSZ 4096
#define UCONVMSG "uconvmsg"
static UResourceBundle *gBundle = 0; /* Bundle containing messages. */
static UResourceBundle *gBundle = nullptr; /* Bundle containing messages. */
/*
* Initialize the message bundle so that message strings can be fetched
@ -138,17 +138,17 @@ static struct callback_ent {
const void *touctxt;
} transcode_callbacks[] = {
{ "substitute",
UCNV_FROM_U_CALLBACK_SUBSTITUTE, 0,
UCNV_TO_U_CALLBACK_SUBSTITUTE, 0 },
UCNV_FROM_U_CALLBACK_SUBSTITUTE, nullptr,
UCNV_TO_U_CALLBACK_SUBSTITUTE, nullptr },
{ "skip",
UCNV_FROM_U_CALLBACK_SKIP, 0,
UCNV_TO_U_CALLBACK_SKIP, 0 },
UCNV_FROM_U_CALLBACK_SKIP, nullptr,
UCNV_TO_U_CALLBACK_SKIP, nullptr },
{ "stop",
UCNV_FROM_U_CALLBACK_STOP, 0,
UCNV_TO_U_CALLBACK_STOP, 0 },
UCNV_FROM_U_CALLBACK_STOP, nullptr,
UCNV_TO_U_CALLBACK_STOP, nullptr },
{ "escape",
UCNV_FROM_U_CALLBACK_ESCAPE, 0,
UCNV_TO_U_CALLBACK_ESCAPE, 0},
UCNV_FROM_U_CALLBACK_ESCAPE, nullptr,
UCNV_TO_U_CALLBACK_ESCAPE, nullptr },
{ "escape-icu",
UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_ICU,
UCNV_TO_U_CALLBACK_ESCAPE, UCNV_ESCAPE_ICU },
@ -186,7 +186,7 @@ static const struct callback_ent *findCallback(const char *name) {
}
}
return 0;
return nullptr;
}
/* Print converter information. If lookfor is set, only that converter will
@ -590,8 +590,8 @@ ConvertFile::convertFile(const char *pname,
{
FILE *infile;
UBool ret = true;
UConverter *convfrom = 0;
UConverter *convto = 0;
UConverter *convfrom = nullptr;
UConverter *convto = nullptr;
UErrorCode err = U_ZERO_ERROR;
UBool flush;
UBool closeFile = false;
@ -606,7 +606,7 @@ ConvertFile::convertFile(const char *pname,
size_t rd, wr;
#if !UCONFIG_NO_TRANSLITERATION
Transliterator *t = 0; // Transliterator acting on Unicode data.
Transliterator *t = nullptr;// Transliterator acting on Unicode data.
UnicodeString chunk; // One chunk of the text being collected for transformation.
#endif
UnicodeString u; // String to do the transliteration.
@ -619,9 +619,9 @@ ConvertFile::convertFile(const char *pname,
// Open the correct input file or connect to stdin for reading input
if (infilestr != 0 && strcmp(infilestr, "-")) {
if (infilestr != nullptr && strcmp(infilestr, "-")) {
infile = fopen(infilestr, "rb");
if (infile == 0) {
if (infile == nullptr) {
UnicodeString str1(infilestr, "");
str1.append((UChar32) 0);
UnicodeString str2(strerror(errno), "");
@ -681,7 +681,7 @@ ConvertFile::convertFile(const char *pname,
if (t) {
delete t;
t = 0;
t = nullptr;
}
goto error_exit;
}
@ -702,7 +702,7 @@ ConvertFile::convertFile(const char *pname,
u_wmsg_errorName(err));
goto error_exit;
}
ucnv_setToUCallBack(convfrom, toucallback, touctxt, 0, 0, &err);
ucnv_setToUCallBack(convfrom, toucallback, touctxt, nullptr, nullptr, &err);
if (U_FAILURE(err)) {
initMsg(pname);
u_wmsg(stderr, "cantSetCallback", u_wmsg_errorName(err));
@ -717,7 +717,7 @@ ConvertFile::convertFile(const char *pname,
u_wmsg_errorName(err));
goto error_exit;
}
ucnv_setFromUCallBack(convto, fromucallback, fromuctxt, 0, 0, &err);
ucnv_setFromUCallBack(convto, fromucallback, fromuctxt, nullptr, nullptr, &err);
if (U_FAILURE(err)) {
initMsg(pname);
u_wmsg(stderr, "cantSetCallback", u_wmsg_errorName(err));
@ -1103,16 +1103,16 @@ main(int argc, char **argv)
size_t bufsz = DEFAULT_BUFSZ;
const char *fromcpage = 0;
const char *tocpage = 0;
const char *translit = 0;
const char *outfilestr = 0;
const char *fromcpage = nullptr;
const char *tocpage = nullptr;
const char *translit = nullptr;
const char *outfilestr = nullptr;
UBool fallback = false;
UConverterFromUCallback fromucallback = UCNV_FROM_U_CALLBACK_STOP;
const void *fromuctxt = 0;
const void *fromuctxt = nullptr;
UConverterToUCallback toucallback = UCNV_TO_U_CALLBACK_STOP;
const void *touctxt = 0;
const void *touctxt = nullptr;
char **iter, **remainArgv, **remainArgvLimit;
char **end = argv + argc;
@ -1120,7 +1120,7 @@ main(int argc, char **argv)
const char *pname;
UBool printConvs = false, printCanon = false, printTranslits = false;
const char *printName = 0;
const char *printName = nullptr;
UBool verbose = false;
UErrorCode status = U_ZERO_ERROR;
@ -1322,9 +1322,9 @@ main(int argc, char **argv)
}
// Open the correct output file or connect to stdout for reading input
if (outfilestr != 0 && strcmp(outfilestr, "-")) {
if (outfilestr != nullptr && strcmp(outfilestr, "-")) {
outfile = fopen(outfilestr, "wb");
if (outfile == 0) {
if (outfile == nullptr) {
UnicodeString str1(outfilestr, "");
UnicodeString str2(strerror(errno), "");
initMsg(pname);
@ -1361,7 +1361,7 @@ main(int argc, char **argv)
} else {
if (!cf.convertFile(
pname, fromcpage, toucallback, touctxt, tocpage,
fromucallback, fromuctxt, fallback, translit, 0,
fromucallback, fromuctxt, fallback, translit, nullptr,
outfile, verbose)
) {
goto error_exit;

View file

@ -38,7 +38,7 @@ public:
* Constructs a transliterator.
* @param adoptedFilter the filter for this transliterator.
*/
BreakTransliterator(UnicodeFilter* adoptedFilter = 0);
BreakTransliterator(UnicodeFilter* adoptedFilter = nullptr);
/**
* Destructor.

View file

@ -741,7 +741,7 @@ fSkippedWallTime(UCAL_WALLTIME_LAST)
delete zone;
return;
}
if(zone == 0) {
if (zone == nullptr) {
#if defined (U_DEBUG_CAL)
fprintf(stderr, "%s:%d: ILLEGAL ARG because timezone cannot be 0\n",
__FILE__, __LINE__);

View file

@ -91,7 +91,7 @@ UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(CaseMapTransliterator)
* Constructs a transliterator.
*/
CaseMapTransliterator::CaseMapTransliterator(const UnicodeString &id, UCaseMapFull *map) :
Transliterator(id, 0),
Transliterator(id, nullptr),
fMap(map)
{
// TODO test incremental mode with context-sensitive text (e.g. greek sigma)

View file

@ -431,7 +431,7 @@ Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale,
UErrorCode& status)
{
if (U_FAILURE(status))
return 0;
return nullptr;
if (desiredLocale.isBogus()) {
// Locale constructed from malformed locale ID or language tag.
status = U_ILLEGAL_ARGUMENT_ERROR;

View file

@ -53,7 +53,7 @@ CompoundTransliterator::CompoundTransliterator(
int32_t transliteratorCount,
UnicodeFilter* adoptedFilter) :
Transliterator(joinIDs(transliterators, transliteratorCount), adoptedFilter),
trans(0), count(0), numAnonymousRBTs(0) {
trans(nullptr), count(0), numAnonymousRBTs(0) {
setTransliterators(transliterators, transliteratorCount);
}
@ -70,7 +70,7 @@ CompoundTransliterator::CompoundTransliterator(const UnicodeString& id,
UParseError& /*parseError*/,
UErrorCode& status) :
Transliterator(id, adoptedFilter),
trans(0), numAnonymousRBTs(0) {
trans(nullptr), numAnonymousRBTs(0) {
// TODO add code for parseError...currently unused, but
// later may be used by parsing code...
init(id, direction, true, status);
@ -79,8 +79,8 @@ CompoundTransliterator::CompoundTransliterator(const UnicodeString& id,
CompoundTransliterator::CompoundTransliterator(const UnicodeString& id,
UParseError& /*parseError*/,
UErrorCode& status) :
Transliterator(id, 0), // set filter to 0 here!
trans(0), numAnonymousRBTs(0) {
Transliterator(id, nullptr), // set filter to 0 here!
trans(nullptr), numAnonymousRBTs(0) {
// TODO add code for parseError...currently unused, but
// later may be used by parsing code...
init(id, UTRANS_FORWARD, true, status);
@ -97,7 +97,7 @@ CompoundTransliterator::CompoundTransliterator(const UnicodeString& newID,
UParseError& /*parseError*/,
UErrorCode& status) :
Transliterator(newID, adoptedFilter),
trans(0), numAnonymousRBTs(anonymousRBTs)
trans(nullptr), numAnonymousRBTs(anonymousRBTs)
{
init(list, UTRANS_FORWARD, false, status);
}
@ -111,7 +111,7 @@ CompoundTransliterator::CompoundTransliterator(UVector& list,
UParseError& /*parseError*/,
UErrorCode& status) :
Transliterator(UnicodeString(), nullptr),
trans(0), numAnonymousRBTs(0)
trans(nullptr), numAnonymousRBTs(0)
{
// TODO add code for parseError...currently unused, but
// later may be used by parsing code...
@ -124,7 +124,7 @@ CompoundTransliterator::CompoundTransliterator(UVector& list,
UParseError& /*parseError*/,
UErrorCode& status) :
Transliterator(UnicodeString(), nullptr),
trans(0), numAnonymousRBTs(anonymousRBTs)
trans(nullptr), numAnonymousRBTs(anonymousRBTs)
{
init(list, UTRANS_FORWARD, false, status);
}
@ -198,13 +198,13 @@ void CompoundTransliterator::init(UVector& list,
count = list.size();
trans = (Transliterator **)uprv_malloc(count * sizeof(Transliterator *));
/* test for nullptr */
if (trans == 0) {
if (trans == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
if (U_FAILURE(status) || trans == 0) {
if (U_FAILURE(status) || trans == nullptr) {
// assert(trans == 0);
return;
}
@ -254,7 +254,7 @@ UnicodeString CompoundTransliterator::joinIDs(Transliterator* const transliterat
* Copy constructor.
*/
CompoundTransliterator::CompoundTransliterator(const CompoundTransliterator& t) :
Transliterator(t), trans(0), count(0), numAnonymousRBTs(-1) {
Transliterator(t), trans(nullptr), count(0), numAnonymousRBTs(-1) {
*this = t;
}
@ -266,13 +266,13 @@ CompoundTransliterator::~CompoundTransliterator() {
}
void CompoundTransliterator::freeTransliterators() {
if (trans != 0) {
if (trans != nullptr) {
for (int32_t i=0; i<count; ++i) {
delete trans[i];
}
uprv_free(trans);
}
trans = 0;
trans = nullptr;
count = 0;
}
@ -289,7 +289,7 @@ CompoundTransliterator& CompoundTransliterator::operator=(
if (trans != nullptr) {
for (i=0; i<count; ++i) {
delete trans[i];
trans[i] = 0;
trans[i] = nullptr;
}
}
if (t.count > count) {

View file

@ -63,7 +63,7 @@ public:
*/
CompoundTransliterator(Transliterator* const transliterators[],
int32_t transliteratorCount,
UnicodeFilter* adoptedFilter = 0);
UnicodeFilter* adoptedFilter = nullptr);
/**
* Constructs a new compound transliterator.

View file

@ -443,20 +443,20 @@ UEnumeration * CharsetDetector::getAllDetectableCharsets(UErrorCode &status)
setRecognizers(status);
if(U_FAILURE(status)) {
return 0;
return nullptr;
}
UEnumeration *en = NEW_ARRAY(UEnumeration, 1);
if (en == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
memcpy(en, &gCSDetEnumeration, sizeof(UEnumeration));
en->context = (void*)NEW_ARRAY(Context, 1);
if (en->context == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
DELETE_ARRAY(en);
return 0;
return nullptr;
}
uprv_memset(en->context, 0, sizeof(Context));
((Context*)en->context)->all = true;
@ -466,20 +466,20 @@ UEnumeration * CharsetDetector::getAllDetectableCharsets(UErrorCode &status)
UEnumeration * CharsetDetector::getDetectableCharsets(UErrorCode &status) const
{
if(U_FAILURE(status)) {
return 0;
return nullptr;
}
UEnumeration *en = NEW_ARRAY(UEnumeration, 1);
if (en == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
memcpy(en, &gCSDetEnumeration, sizeof(UEnumeration));
en->context = (void*)NEW_ARRAY(Context, 1);
if (en->context == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
DELETE_ARRAY(en);
return 0;
return nullptr;
}
uprv_memset(en->context, 0, sizeof(Context));
((Context*)en->context)->all = false;

View file

@ -162,7 +162,7 @@ int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars
if (iter.charValue > 0xFF) {
doubleByteCharCount++;
if (commonChars != 0) {
if (commonChars != nullptr) {
if (binarySearch(commonChars, commonCharsLen, static_cast<uint16_t>(iter.charValue)) >= 0){
commonCharCount += 1;
}
@ -205,7 +205,7 @@ int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars
return confidence;
}
if (commonChars == 0) {
if (commonChars == nullptr) {
// We have no statistics on frequently occurring characters.
// Assess confidence purely on having a reasonable number of
// multi-byte characters (the more the better)

View file

@ -122,8 +122,8 @@ DateFmtBestPatternKey::~DateFmtBestPatternKey() { }
DateFormat::DateFormat()
: fCalendar(0),
fNumberFormat(0),
: fCalendar(nullptr),
fNumberFormat(nullptr),
fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
{
}
@ -132,8 +132,8 @@ DateFormat::DateFormat()
DateFormat::DateFormat(const DateFormat& other)
: Format(other),
fCalendar(0),
fNumberFormat(0),
fCalendar(nullptr),
fNumberFormat(nullptr),
fCapitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
{
*this = other;

View file

@ -1353,7 +1353,7 @@ DateFormatSymbols::initZoneStringsArray() {
UDate now = Calendar::getNow();
UnicodeString tzDispName;
while ((tzid = tzids->snext(status)) != 0) {
while ((tzid = tzids->snext(status)) != nullptr) {
if (U_FAILURE(status)) {
break;
}

View file

@ -706,7 +706,7 @@ DateIntervalFormat::create(const Locale& locale,
} else if ( U_FAILURE(status) ) {
// safe to delete f, although nothing actually is saved
delete f;
f = 0;
f = nullptr;
}
return f;
}
@ -1477,7 +1477,7 @@ DateIntervalFormat::setIntervalPattern(UCalendarDateFields field,
// look for the best match skeleton, for example: "yMMM"
const UnicodeString* tmpBest = fInfo->getBestSkeleton(
*extendedBestSkeleton, differenceInfo);
if ( tmpBest != 0 && differenceInfo != -1 ) {
if (tmpBest != nullptr && differenceInfo != -1) {
fInfo->getIntervalPattern(*tmpBest, field, pattern, status);
bestSkeleton = tmpBest;
}

View file

@ -250,7 +250,7 @@ public:
virtual ~PatternMap();
void add(const UnicodeString& basePattern, const PtnSkeleton& skeleton, const UnicodeString& value, UBool skeletonWasSpecified, UErrorCode& status);
const UnicodeString* getPatternFromBasePattern(const UnicodeString& basePattern, UBool& skeletonWasSpecified) const;
const UnicodeString* getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr = 0) const;
const UnicodeString* getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr = nullptr) const;
void copyFrom(const PatternMap& other, UErrorCode& status);
PtnElem* getHeader(char16_t baseChar) const;
UBool equals(const PatternMap& other) const;

View file

@ -111,7 +111,7 @@ EscapeTransliterator::EscapeTransliterator(const EscapeTransliterator& o) :
radix(o.radix),
minDigits(o.minDigits),
grokSupplementals(o.grokSupplementals) {
supplementalHandler = (o.supplementalHandler != 0) ?
supplementalHandler = o.supplementalHandler != nullptr ?
new EscapeTransliterator(*o.supplementalHandler) : nullptr;
}

View file

@ -351,7 +351,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
// values.
GregorianCalendar *cal = new GregorianCalendar(getTimeZone(), status);
/* test for nullptr */
if (cal == 0) {
if (cal == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}

View file

@ -30,8 +30,8 @@ InputText::InputText(UErrorCode &status)
// removed if appropriate.
fByteStats(NEW_ARRAY(int16_t, 256)), // byte frequency statistics for the input text.
// Value is percent, not absolute.
fDeclaredEncoding(0),
fRawInput(0),
fDeclaredEncoding(nullptr),
fRawInput(nullptr),
fRawLength(0)
{
if (fInputBytes == nullptr || fByteStats == nullptr) {

View file

@ -29,7 +29,7 @@ Measure::Measure(const Formattable& _number, MeasureUnit* adoptedUnit,
UErrorCode& ec) :
number(_number), unit(adoptedUnit) {
if (U_SUCCESS(ec) &&
(!number.isNumeric() || adoptedUnit == 0)) {
(!number.isNumeric() || adoptedUnit == nullptr)) {
ec = U_ILLEGAL_ARGUMENT_ERROR;
}
}

View file

@ -1086,7 +1086,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
// that formats the number without subtracting the offset.
appendTo.formatAndAppend(pluralNumber.formatter, *arg, success);
}
} else if ((formatter = getCachedFormatter(i -2)) != 0) {
} else if ((formatter = getCachedFormatter(i - 2)) != nullptr) {
// Handles all ArgType.SIMPLE, and formatters from setFormat() and its siblings.
if (dynamic_cast<const ChoiceFormat*>(formatter) ||
dynamic_cast<const PluralFormat*>(formatter) ||

View file

@ -33,7 +33,7 @@ public:
* Constructs a transliterator.
* @param adoptedFilter the filter for this transliterator.
*/
NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = 0);
NameUnicodeTransliterator(UnicodeFilter* adoptedFilter = nullptr);
/**
* Destructor.

View file

@ -118,7 +118,7 @@ NFRule::makeRules(UnicodeString& description,
// description string)
NFRule* rule1 = new NFRule(rbnf, description, status);
/* test for nullptr */
if (rule1 == 0) {
if (rule1 == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -162,7 +162,7 @@ NFRule::makeRules(UnicodeString& description,
// goes SECOND in the rule set's rule list)
rule2 = new NFRule(rbnf, UnicodeString(), status);
/* test for nullptr */
if (rule2 == 0) {
if (rule2 == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}

View file

@ -75,7 +75,7 @@ Transliterator* NormalizationTransliterator::_create(const UnicodeString& ID,
*/
NormalizationTransliterator::NormalizationTransliterator(const UnicodeString& id,
const Normalizer2 &norm2) :
Transliterator(id, 0), fNorm2(norm2) {}
Transliterator(id, nullptr), fNorm2(norm2) {}
/**
* Destructor.

View file

@ -20,7 +20,7 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(NullTransliterator)
NullTransliterator::NullTransliterator() : Transliterator(UNICODE_STRING_SIMPLE("Any-Null"), 0) {}
NullTransliterator::NullTransliterator() : Transliterator(UNICODE_STRING_SIMPLE("Any-Null"), nullptr) {}
NullTransliterator::~NullTransliterator() {}

View file

@ -266,7 +266,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
* Copy constructor
*/
OlsonTimeZone::OlsonTimeZone(const OlsonTimeZone& other) :
BasicTimeZone(other), finalZone(0) {
BasicTimeZone(other), finalZone(nullptr) {
*this = other;
}
@ -290,7 +290,7 @@ OlsonTimeZone& OlsonTimeZone::operator=(const OlsonTimeZone& other) {
typeMapData = other.typeMapData;
delete finalZone;
finalZone = (other.finalZone != 0) ? other.finalZone->clone() : 0;
finalZone = other.finalZone != nullptr ? other.finalZone->clone() : nullptr;
finalStartYear = other.finalStartYear;
finalStartMillis = other.finalStartMillis;

View file

@ -1557,7 +1557,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
// our rule list is an array of the appropriate size
fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
/* test for nullptr */
if (fRuleSets == 0) {
if (fRuleSets == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}

View file

@ -33,7 +33,7 @@ void RuleBasedTransliterator::_construct(const UnicodeString& rules,
UTransDirection direction,
UParseError& parseError,
UErrorCode& status) {
fData = 0;
fData = nullptr;
isDataOwned = true;
if (U_FAILURE(status)) {
return;
@ -153,7 +153,7 @@ RuleBasedTransliterator::RuleBasedTransliterator(const UnicodeString& id,
RuleBasedTransliterator::RuleBasedTransliterator(const UnicodeString& id,
TransliterationRuleData* theData,
UBool isDataAdopted) :
Transliterator(id, 0),
Transliterator(id, nullptr),
fData(theData),
isDataOwned(isDataAdopted) {
setMaximumContextLength(fData->ruleSet.getMaximumContextLength());

View file

@ -115,7 +115,7 @@ private:
*/
RuleBasedTransliterator(const UnicodeString& id,
const TransliterationRuleData* theData,
UnicodeFilter* adoptedFilter = 0);
UnicodeFilter* adoptedFilter = nullptr);
friend class Transliterator; // to access following ct

View file

@ -25,13 +25,13 @@ U_NAMESPACE_BEGIN
TransliterationRuleData::TransliterationRuleData(UErrorCode& status)
: UMemory(), ruleSet(status), variableNames(status),
variables(0), variablesAreOwned(true)
variables(nullptr), variablesAreOwned(true)
{
if (U_FAILURE(status)) {
return;
}
variableNames.setValueDeleter(uprv_deleteUObject);
variables = 0;
variables = nullptr;
variablesLength = 0;
}
@ -46,7 +46,7 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
variableNames.setValueDeleter(uprv_deleteUObject);
int32_t pos = UHASH_FIRST;
const UHashElement *e;
while ((e = other.variableNames.nextElement(pos)) != 0) {
while ((e = other.variableNames.nextElement(pos)) != nullptr) {
UnicodeString* value =
new UnicodeString(*(const UnicodeString*)e->value.pointer);
// Exit out if value could not be created.
@ -56,11 +56,11 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
variableNames.put(*(UnicodeString*)e->key.pointer, value, status);
}
variables = 0;
if (other.variables != 0) {
variables = nullptr;
if (other.variables != nullptr) {
variables = (UnicodeFunctor **)uprv_malloc(variablesLength * sizeof(UnicodeFunctor *));
/* test for nullptr */
if (variables == 0) {
if (variables == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -87,7 +87,7 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
}
TransliterationRuleData::~TransliterationRuleData() {
if (variablesAreOwned && variables != 0) {
if (variablesAreOwned && variables != nullptr) {
for (int32_t i=0; i<variablesLength; ++i) {
delete variables[i];
}
@ -98,19 +98,19 @@ TransliterationRuleData::~TransliterationRuleData() {
UnicodeFunctor*
TransliterationRuleData::lookup(UChar32 standIn) const {
int32_t i = standIn - variablesBase;
return (i >= 0 && i < variablesLength) ? variables[i] : 0;
return (i >= 0 && i < variablesLength) ? variables[i] : nullptr;
}
UnicodeMatcher*
TransliterationRuleData::lookupMatcher(UChar32 standIn) const {
UnicodeFunctor *f = lookup(standIn);
return (f != 0) ? f->toMatcher() : 0;
return f != nullptr ? f->toMatcher() : nullptr;
}
UnicodeReplacer*
TransliterationRuleData::lookupReplacer(UChar32 standIn) const {
UnicodeFunctor *f = lookup(standIn);
return (f != 0) ? f->toReplacer() : 0;
return f != nullptr ? f->toReplacer() : nullptr;
}

View file

@ -142,9 +142,9 @@ public:
const Hashtable* variableNames; // alias
ParseData(const TransliterationRuleData* data = 0,
const UVector* variablesVector = 0,
const Hashtable* variableNames = 0);
ParseData(const TransliterationRuleData* data = nullptr,
const UVector* variablesVector = nullptr,
const Hashtable* variableNames = nullptr);
virtual ~ParseData();
@ -196,7 +196,7 @@ const UnicodeFunctor* ParseData::lookupMatcher(UChar32 ch) const {
if (i >= 0 && i < variablesVector->size()) {
int32_t j = ch - data->variablesBase;
set = (j < variablesVector->size()) ?
(UnicodeFunctor*) variablesVector->elementAt(j) : 0;
(UnicodeFunctor*) variablesVector->elementAt(j) : nullptr;
}
return set;
}
@ -913,7 +913,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
delete (UnicodeFunctor*)variablesVector.orphanElementAt(0);
}
variableNames.removeAll();
parseData = new ParseData(0, &variablesVector, &variableNames);
parseData = new ParseData(nullptr, &variablesVector, &variableNames);
if (parseData == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
@ -1109,7 +1109,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
TransliterationRuleData* data = (TransliterationRuleData*)dataVector.elementAt(i);
data->variablesLength = variablesVector.size();
if (data->variablesLength == 0) {
data->variables = 0;
data->variables = nullptr;
} else {
data->variables = (UnicodeFunctor**)uprv_malloc(data->variablesLength * sizeof(UnicodeFunctor*));
// nullptr pointer check

View file

@ -65,7 +65,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
const TransliterationRuleData* theData,
UErrorCode& status) :
UMemory(),
segments(0),
segments(nullptr),
data(theData) {
if (U_FAILURE(status)) {
@ -121,7 +121,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
anteContext = new StringMatcher(pattern, 0, anteContextLength,
false, *data);
/* test for nullptr */
if (anteContext == 0) {
if (anteContext == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -132,7 +132,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
key = new StringMatcher(pattern, anteContextLength, anteContextLength + keyLength,
false, *data);
/* test for nullptr */
if (key == 0) {
if (key == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -144,7 +144,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
postContext = new StringMatcher(pattern, anteContextLength + keyLength, pattern.length(),
false, *data);
/* test for nullptr */
if (postContext == 0) {
if (postContext == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -152,7 +152,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
this->output = new StringReplacer(outputStr, cursorPosition + cursorOffset, data);
/* test for nullptr */
if (this->output == 0) {
if (this->output == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}

View file

@ -197,7 +197,7 @@ TransliterationRuleSet::TransliterationRuleSet(const TransliterationRuleSet& oth
ruleVector->adoptElement(tempTranslitRule.orphan(), status);
}
}
if (other.rules != 0 && U_SUCCESS(status)) {
if (other.rules != nullptr && U_SUCCESS(status)) {
UParseError p;
freeze(p, status);
}
@ -253,7 +253,7 @@ void TransliterationRuleSet::addRule(TransliterationRule* adoptedRule,
}
uprv_free(rules);
rules = 0;
rules = nullptr;
}
/**
@ -297,7 +297,7 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
*/
int16_t* indexValue = (int16_t*) uprv_malloc( sizeof(int16_t) * (n > 0 ? n : 1) );
/* test for nullptr */
if (indexValue == 0) {
if (indexValue == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -341,7 +341,7 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
}
rules = (TransliterationRule **)uprv_malloc(v.size() * sizeof(TransliterationRule *));
/* test for nullptr */
if (rules == 0) {
if (rules == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}

View file

@ -357,214 +357,214 @@ static const struct RegexTableEl gRuleParseStateTable[] = {
, {doSetFinish, 255, 14,0, false} // 205 set-finish
, {doExit, 255, 206,0, true} // 206 errorDeath
};
static const char * const RegexStateNames[] = { 0,
static const char * const RegexStateNames[] = {nullptr,
"start",
"term",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"expr-quant",
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"expr-cont",
0,
0,
nullptr,
nullptr,
"open-paren-quant",
0,
nullptr,
"open-paren-quant2",
0,
nullptr,
"open-paren",
0,
nullptr,
"open-paren-extended",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"open-paren-lookbehind",
0,
0,
0,
nullptr,
nullptr,
nullptr,
"paren-comment",
0,
0,
nullptr,
nullptr,
"paren-flag",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"named-capture",
0,
0,
0,
nullptr,
nullptr,
nullptr,
"quant-star",
0,
0,
nullptr,
nullptr,
"quant-plus",
0,
0,
nullptr,
nullptr,
"quant-opt",
0,
0,
nullptr,
nullptr,
"interval-open",
0,
nullptr,
"interval-lower",
0,
0,
0,
nullptr,
nullptr,
nullptr,
"interval-upper",
0,
0,
nullptr,
nullptr,
"interval-type",
0,
0,
nullptr,
nullptr,
"backslash",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"named-backref",
0,
nullptr,
"named-backref-2",
0,
nullptr,
"named-backref-3",
0,
0,
0,
nullptr,
nullptr,
nullptr,
"set-open",
0,
0,
nullptr,
nullptr,
"set-open2",
0,
nullptr,
"set-posix",
0,
0,
nullptr,
nullptr,
"set-start",
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"set-start-dash",
0,
nullptr,
"set-start-amp",
0,
nullptr,
"set-after-lit",
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"set-after-set",
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"set-after-range",
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"set-after-op",
0,
0,
0,
nullptr,
nullptr,
nullptr,
"set-set-amp",
0,
0,
nullptr,
nullptr,
"set-lit-amp",
0,
nullptr,
"set-set-dash",
0,
0,
nullptr,
nullptr,
"set-range-dash",
0,
nullptr,
"set-range-amp",
0,
nullptr,
"set-lit-dash",
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
"set-lit-dash-escape",
0,
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"set-escape",
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
"set-finish",
"errorDeath",
0};
nullptr};
U_NAMESPACE_END
#endif

View file

@ -44,13 +44,13 @@ void RemoveTransliterator::registerIDs() {
UNICODE_STRING_SIMPLE("Null"), false);
}
RemoveTransliterator::RemoveTransliterator() : Transliterator(UnicodeString(true, ::CURR_ID, -1), 0) {}
RemoveTransliterator::RemoveTransliterator() : Transliterator(UnicodeString(true, ::CURR_ID, -1), nullptr) {}
RemoveTransliterator::~RemoveTransliterator() {}
RemoveTransliterator* RemoveTransliterator::clone() const {
RemoveTransliterator* result = new RemoveTransliterator();
if (result != nullptr && getFilter() != 0) {
if (result != nullptr && getFilter() != nullptr) {
result->adoptFilter(getFilter()->clone());
}
return result;

View file

@ -164,7 +164,7 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
//--------------------------------------------------------------------------
void RegexPattern::init() {
fFlags = 0;
fCompiledPat = 0;
fCompiledPat = nullptr;
fLiteralText.remove();
fSets = nullptr;
fSets8 = nullptr;

View file

@ -731,7 +731,7 @@ UBool SimpleTimeZone::inDaylightTime(UDate date, UErrorCode& status) const
if (U_FAILURE(status)) return false;
GregorianCalendar *gc = new GregorianCalendar(*this, status);
/* test for nullptr */
if (gc == 0) {
if (gc == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return false;
}

View file

@ -507,7 +507,7 @@ SimpleDateFormat::SimpleDateFormat(const Locale& locale,
// This constructor doesn't fail; it uses last resort data
fSymbols = new DateFormatSymbols(status);
/* test for nullptr */
if (fSymbols == 0) {
if (fSymbols == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@ -709,7 +709,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
fSymbols = DateFormatSymbols::createForLocale(locale, status);
if (U_FAILURE(status)) return;
/* test for nullptr */
if (fSymbols == 0) {
if (fSymbols == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}

View file

@ -98,7 +98,7 @@ UMatchDegree StringMatcher::matches(const Replaceable& text,
for (i=pattern.length()-1; i>=0; --i) {
char16_t keyChar = pattern.charAt(i);
UnicodeMatcher* subm = data->lookupMatcher(keyChar);
if (subm == 0) {
if (subm == nullptr) {
if (cursor > limit &&
keyChar == text.charAt(cursor)) {
--cursor;
@ -129,7 +129,7 @@ UMatchDegree StringMatcher::matches(const Replaceable& text,
}
char16_t keyChar = pattern.charAt(i);
UnicodeMatcher* subm = data->lookupMatcher(keyChar);
if (subm == 0) {
if (subm == nullptr) {
// Don't need the cursor < limit check if
// incremental is true (because it's done above); do need
// it otherwise.
@ -170,7 +170,7 @@ UnicodeString& StringMatcher::toPattern(UnicodeString& result,
for (int32_t i=0; i<pattern.length(); ++i) {
char16_t keyChar = pattern.charAt(i);
const UnicodeMatcher* m = data->lookupMatcher(keyChar);
if (m == 0) {
if (m == nullptr) {
ICU_Utility::appendToRule(result, keyChar, false, escapeUnprintable, quoteBuf);
} else {
ICU_Utility::appendToRule(result, m->toPattern(str, escapeUnprintable),
@ -195,7 +195,7 @@ UBool StringMatcher::matchesIndexValue(uint8_t v) const {
}
UChar32 c = pattern.char32At(0);
const UnicodeMatcher *m = data->lookupMatcher(c);
return (m == 0) ? ((c & 0xFF) == v) : m->matchesIndexValue(v);
return (m == nullptr) ? ((c & 0xFF) == v) : m->matchesIndexValue(v);
}
/**

View file

@ -291,9 +291,9 @@ StringSearch * StringSearch::safeClone() const
m_breakiterator_,
status);
/* test for nullptr */
if (result == 0) {
if (result == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
result->setOffset(getOffset(), status);
result->setMatchStart(m_strsrch_->search->matchedIndex);

View file

@ -160,17 +160,17 @@ static UBool U_CALLCONV timeZone_cleanup()
LEN_SYSTEM_ZONES = 0;
uprv_free(MAP_SYSTEM_ZONES);
MAP_SYSTEM_ZONES = 0;
MAP_SYSTEM_ZONES = nullptr;
gSystemZonesInitOnce.reset();
LEN_CANONICAL_SYSTEM_ZONES = 0;
uprv_free(MAP_CANONICAL_SYSTEM_ZONES);
MAP_CANONICAL_SYSTEM_ZONES = 0;
MAP_CANONICAL_SYSTEM_ZONES = nullptr;
gCanonicalZonesInitOnce.reset();
LEN_CANONICAL_SYSTEM_LOCATION_ZONES = 0;
uprv_free(MAP_CANONICAL_SYSTEM_LOCATION_ZONES);
MAP_CANONICAL_SYSTEM_LOCATION_ZONES = 0;
MAP_CANONICAL_SYSTEM_LOCATION_ZONES = nullptr;
gCanonicalLocationZonesInitOnce.reset();
return true;
@ -283,7 +283,7 @@ static UResourceBundle* openOlsonResource(const UnicodeString& id,
char buf[128];
id.extract(0, sizeof(buf)-1, buf, sizeof(buf), "");
#endif
UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);
UResourceBundle *top = ures_openDirect(nullptr, kZONEINFO, &ec);
U_DEBUG_TZ_MSG(("pre: res sz=%d\n", ures_getSize(&res)));
/* &res = */ getZoneByName(top, id, &res, ec);
// Dereference if this is an alias. Docs say result should be 1
@ -392,7 +392,7 @@ createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) {
if (U_FAILURE(ec)) {
return nullptr;
}
TimeZone* z = 0;
TimeZone* z = nullptr;
StackUResourceBundle res;
U_DEBUG_TZ_MSG(("pre-err=%s\n", u_errorName(ec)));
UResourceBundle *top = openOlsonResource(id, res.ref(), ec);
@ -626,7 +626,7 @@ TimeZone::setDefault(const TimeZone& zone)
static void U_CALLCONV initMap(USystemTimeZoneType type, UErrorCode& ec) {
ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
UResourceBundle *res = ures_openDirect(0, kZONEINFO, &ec);
UResourceBundle *res = ures_openDirect(nullptr, kZONEINFO, &ec);
res = ures_getByKey(res, kNAMES, res, &ec); // dereference Zones section
if (U_SUCCESS(ec)) {
int32_t size = ures_getSize(res);
@ -779,7 +779,7 @@ private:
UBool getID(int32_t i, UErrorCode& ec) {
int32_t idLen = 0;
const char16_t* id = nullptr;
UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);
UResourceBundle *top = ures_openDirect(nullptr, kZONEINFO, &ec);
top = ures_getByKey(top, kNAMES, top, &ec); // dereference Zones section
id = ures_getStringByIndex(top, i, &idLen, &ec);
if(U_FAILURE(ec)) {
@ -855,7 +855,7 @@ public:
}
// Walk through the base map
UResourceBundle *res = ures_openDirect(0, kZONEINFO, &ec);
UResourceBundle *res = ures_openDirect(nullptr, kZONEINFO, &ec);
res = ures_getByKey(res, kNAMES, res, &ec); // dereference Zones section
for (int32_t i = 0; i < baseLen; i++) {
int32_t zidx = baseMap[i];
@ -970,7 +970,7 @@ public:
++pos;
return &unistr;
}
return 0;
return nullptr;
}
virtual void reset(UErrorCode& /*status*/) override {

View file

@ -96,7 +96,7 @@ static icu::UMutex registryMutex;
/**
* System transliterator registry; non-null when initialized.
*/
static icu::TransliteratorRegistry* registry = 0;
static icu::TransliteratorRegistry* registry = nullptr;
// Macro to check/initialize the registry. ONLY USE WITHIN
// MUTEX. Avoids function call when registry is initialized.
@ -149,14 +149,14 @@ Transliterator::~Transliterator() {
* Copy constructor.
*/
Transliterator::Transliterator(const Transliterator& other) :
UObject(other), ID(other.ID), filter(0),
UObject(other), ID(other.ID), filter(nullptr),
maximumContextLength(other.maximumContextLength)
{
// NUL-terminate the ID string, which is a non-aliased copy.
ID.append((char16_t)0);
ID.truncate(ID.length()-1);
if (other.filter != 0) {
if (other.filter != nullptr) {
// We own the filter, so we must have our own copy
filter = other.filter->clone();
}
@ -176,7 +176,7 @@ Transliterator& Transliterator::operator=(const Transliterator& other) {
ID.getTerminatedBuffer();
maximumContextLength = other.maximumContextLength;
adoptFilter((other.filter == 0) ? 0 : other.filter->clone());
adoptFilter(other.filter == nullptr ? nullptr : other.filter->clone());
return *this;
}
@ -322,7 +322,7 @@ void Transliterator::transliterate(Replaceable& text,
void Transliterator::transliterate(Replaceable& text,
UTransPosition& index,
UErrorCode& status) const {
_transliterate(text, index, 0, status);
_transliterate(text, index, nullptr, status);
}
/**
@ -365,7 +365,7 @@ void Transliterator::_transliterate(Replaceable& text,
}
// int32_t originalStart = index.contextStart;
if (insertion != 0) {
if (insertion != nullptr) {
text.handleReplaceBetween(index.limit, index.limit, *insertion);
index.limit += insertion->length();
index.contextLimit += insertion->length();
@ -431,7 +431,7 @@ void Transliterator::filteredTransliterate(Replaceable& text,
UBool rollback) const {
// Short circuit path for transliterators with no filter in
// non-incremental mode.
if (filter == 0 && !rollback) {
if (filter == nullptr && !rollback) {
handleTransliterate(text, index, incremental);
return;
}
@ -915,7 +915,7 @@ Transliterator::createInstance(const UnicodeString& ID,
UErrorCode& status)
{
if (U_FAILURE(status)) {
return 0;
return nullptr;
}
UnicodeString canonID;
@ -978,8 +978,8 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
const UnicodeString* canon) {
UParseError pe;
UErrorCode ec = U_ZERO_ERROR;
TransliteratorAlias* alias = 0;
Transliterator* t = 0;
TransliteratorAlias* alias = nullptr;
Transliterator* t = nullptr;
umtx_lock(&registryMutex);
if (HAVE_REGISTRY(ec)) {
@ -990,7 +990,7 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
if (U_FAILURE(ec)) {
delete t;
delete alias;
return 0;
return nullptr;
}
// We may have not gotten a transliterator: Because we can't
@ -1000,7 +1000,7 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
// registry mutex. The alias may, in turn, generate another alias, so
// we handle aliases in a loop. The max times through the loop is two.
// [alan]
while (alias != 0) {
while (alias != nullptr) {
U_ASSERT(t==0);
// Rule-based aliases are handled with TransliteratorAlias::
// parse(), followed by TransliteratorRegistry::reget().
@ -1010,7 +1010,7 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
TransliteratorParser parser(ec);
alias->parse(parser, pe, ec);
delete alias;
alias = 0;
alias = nullptr;
// Step 2. reget
umtx_lock(&registryMutex);
@ -1023,7 +1023,7 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
} else {
t = alias->create(pe, ec);
delete alias;
alias = 0;
alias = nullptr;
break;
}
if (U_FAILURE(ec)) {
@ -1062,7 +1062,7 @@ Transliterator::createFromRules(const UnicodeString& ID,
parser.parse(rules, dir, parseError, status);
if (U_FAILURE(status)) {
return 0;
return nullptr;
}
// NOTE: The logic here matches that in TransliteratorRegistry.
@ -1476,14 +1476,14 @@ char16_t Transliterator::filteredCharAt(const Replaceable& text, int32_t i) cons
* cannot itself proceed until the registry is initialized.
*/
UBool Transliterator::initializeRegistry(UErrorCode &status) {
if (registry != 0) {
if (registry != nullptr) {
return true;
}
registry = new TransliteratorRegistry(status);
if (registry == 0 || U_FAILURE(status)) {
if (registry == nullptr || U_FAILURE(status)) {
delete registry;
registry = 0;
registry = nullptr;
return false; // can't create registry, no recovery
}
@ -1526,7 +1526,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
UErrorCode lstatus = U_ZERO_ERROR;
UResourceBundle *bundle, *transIDs, *colBund;
bundle = ures_open(U_ICUDATA_TRANSLIT, nullptr/*open default locale*/, &lstatus);
transIDs = ures_getByKey(bundle, RB_RULE_BASED_IDS, 0, &lstatus);
transIDs = ures_getByKey(bundle, RB_RULE_BASED_IDS, nullptr, &lstatus);
const UnicodeString T_PART = UNICODE_STRING_SIMPLE("-t-");
int32_t row, maxRows;
@ -1539,7 +1539,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
if (U_SUCCESS(lstatus)) {
maxRows = ures_getSize(transIDs);
for (row = 0; row < maxRows; row++) {
colBund = ures_getByIndex(transIDs, row, 0, &lstatus);
colBund = ures_getByIndex(transIDs, row, nullptr, &lstatus);
if (U_SUCCESS(lstatus)) {
UnicodeString id(ures_getKey(colBund), -1, US_INV);
if(id.indexOf(T_PART) != -1) {

View file

@ -85,7 +85,7 @@ TransliteratorAlias::TransliteratorAlias(const UnicodeString& theAliasID,
const UnicodeSet* cpdFilter) :
ID(),
aliasesOrRules(theAliasID),
transes(0),
transes(nullptr),
compoundFilter(cpdFilter),
direction(UTRANS_FORWARD),
type(TransliteratorAlias::SIMPLE) {
@ -108,8 +108,8 @@ TransliteratorAlias::TransliteratorAlias(const UnicodeString& theID,
UTransDirection dir) :
ID(theID),
aliasesOrRules(rules),
transes(0),
compoundFilter(0),
transes(nullptr),
compoundFilter(nullptr),
direction(dir),
type(TransliteratorAlias::RULES) {
}
@ -122,16 +122,16 @@ TransliteratorAlias::~TransliteratorAlias() {
Transliterator* TransliteratorAlias::create(UParseError& pe,
UErrorCode& ec) {
if (U_FAILURE(ec)) {
return 0;
return nullptr;
}
Transliterator *t = nullptr;
switch (type) {
case SIMPLE:
t = Transliterator::createInstance(aliasesOrRules, UTRANS_FORWARD, pe, ec);
if(U_FAILURE(ec)){
return 0;
return nullptr;
}
if (compoundFilter != 0)
if (compoundFilter != nullptr)
t->adoptFilter(compoundFilter->clone());
break;
case COMPOUND:
@ -171,9 +171,9 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
t = new CompoundTransliterator(ID, transliterators,
(compoundFilter ? compoundFilter->clone() : nullptr),
anonymousRBTs, pe, ec);
if (t == 0) {
if (t == nullptr) {
ec = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
} else {
for (int32_t i = 0; i < transliterators.size(); i++)
@ -253,7 +253,7 @@ class TransliteratorSpec : public UMemory {
TransliteratorSpec::TransliteratorSpec(const UnicodeString& theSpec)
: top(theSpec),
res(0)
res(nullptr)
{
UErrorCode status = U_ZERO_ERROR;
Locale topLoc("");
@ -261,12 +261,12 @@ TransliteratorSpec::TransliteratorSpec(const UnicodeString& theSpec)
if (!topLoc.isBogus()) {
res = new ResourceBundle(U_ICUDATA_TRANSLIT, topLoc, status);
/* test for nullptr */
if (res == 0) {
if (res == nullptr) {
return;
}
if (U_FAILURE(status) || status == U_USING_DEFAULT_WARNING) {
delete res;
res = 0;
res = nullptr;
}
}
@ -281,7 +281,7 @@ TransliteratorSpec::TransliteratorSpec(const UnicodeString& theSpec)
}
// Canonicalize top
if (res != 0) {
if (res != nullptr) {
// Canonicalize locale name
UnicodeString locStr;
LocaleUtility::initNameFromLocale(topLoc, locStr);
@ -308,7 +308,7 @@ UBool TransliteratorSpec::hasFallback() const {
void TransliteratorSpec::reset() {
if (spec != top) {
spec = top;
isSpecLocale = (res != 0);
isSpecLocale = (res != nullptr);
setupNext();
}
}
@ -474,7 +474,7 @@ private:
};
TransliteratorEntry::TransliteratorEntry() {
u.prototype = 0;
u.prototype = nullptr;
compoundFilter = nullptr;
entryType = NONE;
DEBUG_newEntry(this);
@ -553,7 +553,7 @@ Transliterator* TransliteratorRegistry::get(const UnicodeString& ID,
UErrorCode& status) {
U_ASSERT(aliasReturn == nullptr);
TransliteratorEntry *entry = find(ID);
return (entry == 0) ? 0
return entry == nullptr ? nullptr
: instantiateEntry(ID, entry, aliasReturn, status);
}
@ -564,11 +564,11 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
U_ASSERT(aliasReturn == nullptr);
TransliteratorEntry *entry = find(ID);
if (entry == 0) {
if (entry == nullptr) {
// We get to this point if there are two threads, one of which
// is instantiating an ID, and another of which is removing
// the same ID from the registry, and the timing is just right.
return 0;
return nullptr;
}
// The usage model for the caller is that they will first call
@ -588,7 +588,7 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
entry->entryType == TransliteratorEntry::LOCALE_RULES) {
if (parser.idBlockVector.isEmpty() && parser.dataVector.isEmpty()) {
entry->u.data = 0;
entry->u.data = nullptr;
entry->entryType = TransliteratorEntry::ALIAS;
entry->stringArg = UNICODE_STRING_SIMPLE("Any-nullptr");
}
@ -771,14 +771,14 @@ int32_t TransliteratorRegistry::countAvailableSources() const {
UnicodeString& TransliteratorRegistry::getAvailableSource(int32_t index,
UnicodeString& result) const {
int32_t pos = UHASH_FIRST;
const UHashElement *e = 0;
const UHashElement* e = nullptr;
while (index-- >= 0) {
e = specDAG.nextElement(pos);
if (e == 0) {
if (e == nullptr) {
break;
}
}
if (e == 0) {
if (e == nullptr) {
result.truncate(0);
} else {
result = *(UnicodeString*) e->key.pointer;
@ -788,26 +788,26 @@ UnicodeString& TransliteratorRegistry::getAvailableSource(int32_t index,
int32_t TransliteratorRegistry::countAvailableTargets(const UnicodeString& source) const {
Hashtable *targets = (Hashtable*) specDAG.get(source);
return (targets == 0) ? 0 : targets->count();
return (targets == nullptr) ? 0 : targets->count();
}
UnicodeString& TransliteratorRegistry::getAvailableTarget(int32_t index,
const UnicodeString& source,
UnicodeString& result) const {
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == 0) {
if (targets == nullptr) {
result.truncate(0); // invalid source
return result;
}
int32_t pos = UHASH_FIRST;
const UHashElement *e = 0;
const UHashElement* e = nullptr;
while (index-- >= 0) {
e = targets->nextElement(pos);
if (e == 0) {
if (e == nullptr) {
break;
}
}
if (e == 0) {
if (e == nullptr) {
result.truncate(0); // invalid index
} else {
result = *(UnicodeString*) e->key.pointer;
@ -818,7 +818,7 @@ UnicodeString& TransliteratorRegistry::getAvailableTarget(int32_t index,
int32_t TransliteratorRegistry::countAvailableVariants(const UnicodeString& source,
const UnicodeString& target) const {
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == 0) {
if (targets == nullptr) {
return 0;
}
uint32_t varMask = targets->geti(target);
@ -837,7 +837,7 @@ UnicodeString& TransliteratorRegistry::getAvailableVariant(int32_t index,
const UnicodeString& target,
UnicodeString& result) const {
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == 0) {
if (targets == nullptr) {
result.truncate(0); // invalid source
return result;
}
@ -986,7 +986,7 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source,
// assert(target.length() > 0);
UErrorCode status = U_ZERO_ERROR;
Hashtable *targets = (Hashtable*) specDAG.get(source);
if (targets == 0) {
if (targets == nullptr) {
int32_t size = 3;
if (source.compare(ANY,3) == 0) {
size = ANY_TARGETS_INIT_SIZE;
@ -1084,7 +1084,7 @@ TransliteratorEntry* TransliteratorRegistry::findInDynamicStore(const Transliter
TransliteratorEntry* TransliteratorRegistry::findInStaticStore(const TransliteratorSpec& src,
const TransliteratorSpec& trg,
const UnicodeString& variant) {
TransliteratorEntry* entry = 0;
TransliteratorEntry* entry = nullptr;
if (src.isLocale()) {
entry = findInBundle(src, trg, variant, UTRANS_FORWARD);
} else if (trg.isLocale()) {
@ -1093,7 +1093,7 @@ TransliteratorEntry* TransliteratorRegistry::findInStaticStore(const Translitera
// If we found an entry, store it in the Hashtable for next
// time.
if (entry != 0) {
if (entry != nullptr) {
registerEntry(src.getTop(), trg.getTop(), variant, entry, false);
}
@ -1179,7 +1179,7 @@ TransliteratorEntry* TransliteratorRegistry::findInBundle(const TransliteratorSp
// We have succeeded in loading a string from the locale
// resources. Create a new registry entry to hold it and return it.
TransliteratorEntry *entry = new TransliteratorEntry();
if (entry != 0) {
if (entry != nullptr) {
// The direction is always forward for the
// TransliterateTo_xxx and TransliterateFrom_xxx
// items; those are unidirectional forward rules.
@ -1240,7 +1240,7 @@ TransliteratorEntry* TransliteratorRegistry::find(UnicodeString& source,
UnicodeString ID;
TransliteratorIDParser::STVtoID(source, target, variant, ID);
entry = (TransliteratorEntry*) registry.get(ID);
if (entry != 0) {
if (entry != nullptr) {
// std::string ss;
// std::cout << ID.toUTF8String(ss) << std::endl;
return entry;
@ -1250,13 +1250,13 @@ TransliteratorEntry* TransliteratorRegistry::find(UnicodeString& source,
// Seek exact match in hashtable
entry = findInDynamicStore(src, trg, variant);
if (entry != 0) {
if (entry != nullptr) {
return entry;
}
// Seek exact match in locale resources
entry = findInStaticStore(src, trg, variant);
if (entry != 0) {
if (entry != nullptr) {
return entry;
}
}
@ -1266,13 +1266,13 @@ TransliteratorEntry* TransliteratorRegistry::find(UnicodeString& source,
for (;;) {
// Seek match in hashtable
entry = findInDynamicStore(src, trg, NO_VARIANT);
if (entry != 0) {
if (entry != nullptr) {
return entry;
}
// Seek match in locale resources
entry = findInStaticStore(src, trg, NO_VARIANT);
if (entry != 0) {
if (entry != nullptr) {
return entry;
}
if (!src.hasFallback()) {
@ -1286,7 +1286,7 @@ TransliteratorEntry* TransliteratorRegistry::find(UnicodeString& source,
trg.next();
}
return 0;
return nullptr;
}
/**
@ -1305,31 +1305,31 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
TransliteratorEntry *entry,
TransliteratorAlias* &aliasReturn,
UErrorCode& status) {
Transliterator *t = 0;
Transliterator* t = nullptr;
U_ASSERT(aliasReturn == 0);
switch (entry->entryType) {
case TransliteratorEntry::RBT_DATA:
t = new RuleBasedTransliterator(ID, entry->u.data);
if (t == 0) {
if (t == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return t;
case TransliteratorEntry::PROTOTYPE:
t = entry->u.prototype->clone();
if (t == 0) {
if (t == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return t;
case TransliteratorEntry::ALIAS:
aliasReturn = new TransliteratorAlias(entry->stringArg, entry->compoundFilter);
if (aliasReturn == 0) {
if (aliasReturn == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return 0;
return nullptr;
case TransliteratorEntry::FACTORY:
t = entry->u.factory.function(ID, entry->u.factory.context);
if (t == 0) {
if (t == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return t;
@ -1346,29 +1346,29 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
// TODO: Should passNumber be turned into a decimal-string representation (1 -> "1")?
Transliterator* tl = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++),
(TransliterationRuleData*)(entry->u.dataVector->elementAt(i)), false);
if (tl == 0)
if (tl == nullptr)
status = U_MEMORY_ALLOCATION_ERROR;
else
rbts->adoptElement(tl, status);
}
if (U_FAILURE(status)) {
delete rbts;
return 0;
return nullptr;
}
rbts->setDeleter(nullptr);
aliasReturn = new TransliteratorAlias(ID, entry->stringArg, rbts, entry->compoundFilter);
}
if (aliasReturn == 0) {
if (aliasReturn == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return 0;
return nullptr;
case TransliteratorEntry::LOCALE_RULES:
aliasReturn = new TransliteratorAlias(ID, entry->stringArg,
(UTransDirection) entry->intArg);
if (aliasReturn == 0) {
if (aliasReturn == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return 0;
return nullptr;
case TransliteratorEntry::RULES_FORWARD:
case TransliteratorEntry::RULES_REVERSE:
// Process the rule data into a TransliteratorRuleData object,
@ -1404,12 +1404,12 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
aliasReturn = new TransliteratorAlias(ID, rules,
((entry->entryType == TransliteratorEntry::RULES_REVERSE) ?
UTRANS_REVERSE : UTRANS_FORWARD));
if (aliasReturn == 0) {
if (aliasReturn == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
//}
}
return 0;
return nullptr;
default:
UPRV_UNREACHABLE_EXIT; // can't get here
}

View file

@ -279,9 +279,9 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
UErrorCode ec = U_ZERO_ERROR;
filter = new UnicodeSet(id, ppos, USET_IGNORE_SPACE, nullptr, ec);
/* test for nullptr */
if (filter == 0) {
if (filter == nullptr) {
pos = start;
return 0;
return nullptr;
}
if (U_FAILURE(ec)) {
delete filter;

View file

@ -1168,7 +1168,7 @@ static void sweepCache() {
}
TimeZoneGenericNames::TimeZoneGenericNames()
: fRef(0) {
: fRef(nullptr) {
}
TimeZoneGenericNames::~TimeZoneGenericNames() {

View file

@ -87,7 +87,7 @@ static void sweepCache() {
const UHashElement* elem;
double now = (double)uprv_getUTCtime();
while ((elem = uhash_nextElement(gTimeZoneNamesCache, &pos)) != 0) {
while ((elem = uhash_nextElement(gTimeZoneNamesCache, &pos)) != nullptr) {
TimeZoneNamesCacheEntry *entry = (TimeZoneNamesCacheEntry *)elem->value.pointer;
if (entry->refCount <= 0 && (now - entry->lastAccess) > CACHE_EXPIRATION) {
// delete this entry
@ -128,7 +128,7 @@ private:
};
TimeZoneNamesDelegate::TimeZoneNamesDelegate()
: fTZnamesCacheEntry(0) {
: fTZnamesCacheEntry(nullptr) {
}
TimeZoneNamesDelegate::TimeZoneNamesDelegate(const Locale& locale, UErrorCode& status) {

View file

@ -73,7 +73,9 @@ enum UTimeZoneNameTypeIndex {
UTZNM_INDEX_SHORT_DAYLIGHT,
UTZNM_INDEX_COUNT
};
static const char16_t* const EMPTY_NAMES[UTZNM_INDEX_COUNT] = {0,0,0,0,0,0,0};
static const char16_t* const EMPTY_NAMES[UTZNM_INDEX_COUNT] = {
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
};
U_CDECL_BEGIN
static UBool U_CALLCONV tzdbTimeZoneNames_cleanup() {
@ -2088,7 +2090,7 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
const UnicodeString *mzID;
StringEnumeration *mzIDs = TimeZoneNamesImpl::_getAvailableMetaZoneIDs(status);
if (U_SUCCESS(status)) {
while ((mzID = mzIDs->snext(status)) != 0 && U_SUCCESS(status)) {
while ((mzID = mzIDs->snext(status)) != nullptr && U_SUCCESS(status)) {
const TZDBNames *names = TZDBTimeZoneNames::getMetaZoneNames(*mzID, status);
if (U_FAILURE(status)) {
break;

View file

@ -193,13 +193,13 @@ U_CAPI UCalendar* U_EXPORT2
ucal_clone(const UCalendar* cal,
UErrorCode* status)
{
if(U_FAILURE(*status)) return 0;
if (U_FAILURE(*status)) return nullptr;
Calendar* res = ((Calendar*)cal)->clone();
if(res == 0) {
if (res == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
return (UCalendar*) res;
@ -544,7 +544,7 @@ ucal_getLimit( const UCalendar* cal,
UCalendarDateFields field,
UCalendarLimitType type,
UErrorCode *status) UPRV_NO_SANITIZE_UNDEFINED {
if(status==0 || U_FAILURE(*status)) {
if (status == nullptr || U_FAILURE(*status)) {
return -1;
}
if (field < 0 || UCAL_FIELD_COUNT <= field) {
@ -600,13 +600,13 @@ ucal_getTZDataVersion(UErrorCode* status)
U_CAPI int32_t U_EXPORT2
ucal_getCanonicalTimeZoneID(const char16_t* id, int32_t len,
char16_t* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status) {
if(status == 0 || U_FAILURE(*status)) {
if (status == nullptr || U_FAILURE(*status)) {
return 0;
}
if (isSystemID) {
*isSystemID = false;
}
if (id == 0 || len == 0 || result == 0 || resultCapacity <= 0) {
if (id == nullptr || len == 0 || result == nullptr || resultCapacity <= 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}

View file

@ -488,7 +488,7 @@ ucol_openFromShortString( const char *definition,
UTRACE_ENTRY_OC(UTRACE_UCOL_OPEN_FROM_SHORT_STRING);
UTRACE_DATA1(UTRACE_INFO, "short string = \"%s\"", definition);
if(U_FAILURE(*status)) return 0;
if (U_FAILURE(*status)) return nullptr;
UParseError internalParseError;

View file

@ -32,7 +32,7 @@ U_CAPI UCharsetDetector * U_EXPORT2
ucsdet_open(UErrorCode *status)
{
if(U_FAILURE(*status)) {
return 0;
return nullptr;
}
CharsetDetector* csd = new CharsetDetector(*status);

View file

@ -151,7 +151,7 @@ udat_open(UDateFormatStyle timeStyle,
} // else fall through.
}
if(timeStyle != UDAT_PATTERN) {
if(locale == 0) {
if (locale == nullptr) {
fmt = DateFormat::createDateTimeInstance((DateFormat::EStyle)dateStyle,
(DateFormat::EStyle)timeStyle);
}
@ -164,7 +164,7 @@ udat_open(UDateFormatStyle timeStyle,
else {
UnicodeString pat((UBool)(patternLength == -1), pattern, patternLength);
if(locale == 0) {
if (locale == nullptr) {
fmt = new SimpleDateFormat(pat, *status);
}
else {
@ -181,9 +181,9 @@ udat_open(UDateFormatStyle timeStyle,
return nullptr;
}
if(tzID != 0) {
if (tzID != nullptr) {
TimeZone *zone = TimeZone::createTimeZone(UnicodeString((UBool)(tzIDLength == -1), tzID, tzIDLength));
if(zone == 0) {
if (zone == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
delete fmt;
return nullptr;
@ -206,13 +206,13 @@ U_CAPI UDateFormat* U_EXPORT2
udat_clone(const UDateFormat *fmt,
UErrorCode *status)
{
if(U_FAILURE(*status)) return 0;
if (U_FAILURE(*status)) return nullptr;
Format *res = ((DateFormat*)fmt)->clone();
if(res == 0) {
if (res == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
return (UDateFormat*) res;
@ -243,12 +243,12 @@ udat_format( const UDateFormat* format,
FieldPosition fp;
if(position != 0)
if (position != nullptr)
fp.setField(position->field);
((DateFormat*)format)->format(dateToFormat, res, fp);
if(position != 0) {
if (position != nullptr) {
position->beginIndex = fp.getBeginIndex();
position->endIndex = fp.getEndIndex();
}
@ -281,12 +281,12 @@ udat_formatCalendar(const UDateFormat* format,
FieldPosition fp;
if(position != 0)
if (position != nullptr)
fp.setField(position->field);
((DateFormat*)format)->format(*(Calendar*)calendar, res, fp);
if(position != 0) {
if (position != nullptr) {
position->beginIndex = fp.getBeginIndex();
position->endIndex = fp.getEndIndex();
}

View file

@ -57,7 +57,7 @@ udtitvfmt_open(const char* locale,
if (U_FAILURE(*status)) {
return nullptr;
}
if(tzID != 0) {
if (tzID != nullptr) {
TimeZone *zone = TimeZone::createTimeZone(UnicodeString((UBool)(tzIDLength == -1), tzID, tzIDLength));
if(zone == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
@ -99,7 +99,7 @@ udtitvfmt_format(const UDateIntervalFormat* formatter,
res.setTo(result, 0, resultCapacity);
}
FieldPosition fp;
if (position != 0) {
if (position != nullptr) {
fp.setField(position->field);
}
@ -108,7 +108,7 @@ udtitvfmt_format(const UDateIntervalFormat* formatter,
if (U_FAILURE(*status)) {
return -1;
}
if (position != 0) {
if (position != nullptr) {
position->beginIndex = fp.getBeginIndex();
position->endIndex = fp.getEndIndex();
}

View file

@ -232,11 +232,11 @@ umsg_open( const char16_t *pattern,
//check arguments
if(status==nullptr || U_FAILURE(*status))
{
return 0;
return nullptr;
}
if(pattern==nullptr||patternLength<-1){
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
UParseError tErr;
@ -282,9 +282,9 @@ umsg_clone(const UMessageFormat *fmt,
return nullptr;
}
UMessageFormat retVal = (UMessageFormat)((MessageFormat*)fmt)->clone();
if(retVal == 0) {
if (retVal == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
return retVal;
}
@ -344,7 +344,7 @@ umsg_toPattern(const UMessageFormat *fmt,
if(status ==nullptr||U_FAILURE(*status)){
return -1;
}
if(fmt==nullptr||resultLength<0 || (resultLength>0 && result==0)){
if (fmt == nullptr || resultLength < 0 || (resultLength > 0 && result == nullptr)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return -1;
}
@ -393,11 +393,11 @@ umsg_vformat( const UMessageFormat *fmt,
UErrorCode *status)
{
//check arguments
if(status==0 || U_FAILURE(*status))
if (status == nullptr || U_FAILURE(*status))
{
return -1;
}
if(fmt==nullptr||resultLength<0 || (resultLength>0 && result==0)) {
if (fmt == nullptr || resultLength < 0 || (resultLength > 0 && result == nullptr)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return -1;
}

View file

@ -33,7 +33,7 @@ class UnicodeNameTransliterator : public Transliterator {
* Constructs a transliterator.
* @param adoptedFilter the filter to be adopted.
*/
UnicodeNameTransliterator(UnicodeFilter* adoptedFilter = 0);
UnicodeNameTransliterator(UnicodeFilter* adoptedFilter = nullptr);
/**
* Destructor.

View file

@ -645,7 +645,7 @@ private:
UnicodeString& getMutableFieldDisplayName(UDateTimePatternField field, UDateTimePGDisplayWidth width);
void getAppendName(UDateTimePatternField field, UnicodeString& value);
UnicodeString mapSkeletonMetacharacters(const UnicodeString& patternForm, int32_t* flags, UErrorCode& status);
const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = 0);
const UnicodeString* getBestRaw(DateTimeMatcher& source, int32_t includeMask, DistanceInfo* missingFields, UErrorCode& status, const PtnSkeleton** specifiedSkeletonPtr = nullptr);
UnicodeString adjustFieldTypes(const UnicodeString& pattern, const PtnSkeleton* specifiedSkeleton, int32_t flags, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
UnicodeString getBestAppending(int32_t missingFields, int32_t flags, UErrorCode& status, UDateTimePatternMatchOptions options = UDATPG_MATCH_NO_OPTIONS);
int32_t getTopBitNumber(int32_t foundMask) const;

View file

@ -167,9 +167,9 @@ unum_clone(const UNumberFormat *fmt,
UErrorCode *status)
{
if(U_FAILURE(*status))
return 0;
Format *res = 0;
return nullptr;
Format* res = nullptr;
const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
if (df != nullptr) {
@ -180,9 +180,9 @@ unum_clone(const UNumberFormat *fmt,
res = rbnf->clone();
}
if(res == 0) {
if (res == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
return nullptr;
}
return (UNumberFormat*) res;
@ -218,13 +218,13 @@ unum_formatInt64(const UNumberFormat* fmt,
}
FieldPosition fp;
if(pos != 0)
if (pos != nullptr)
fp.setField(pos->field);
((const NumberFormat*)fmt)->format(number, res, fp, *status);
if(pos != 0) {
if (pos != nullptr) {
pos->beginIndex = fp.getBeginIndex();
pos->endIndex = fp.getEndIndex();
}
@ -251,13 +251,13 @@ unum_formatDouble( const UNumberFormat* fmt,
}
FieldPosition fp;
if(pos != 0)
if (pos != nullptr)
fp.setField(pos->field);
((const NumberFormat*)fmt)->format(number, res, fp, *status);
if(pos != 0) {
if (pos != nullptr) {
pos->beginIndex = fp.getBeginIndex();
pos->endIndex = fp.getEndIndex();
}
@ -311,7 +311,7 @@ unum_formatDecimal(const UNumberFormat* fmt,
}
FieldPosition fp;
if(pos != 0) {
if (pos != nullptr) {
fp.setField(pos->field);
}
@ -327,7 +327,7 @@ unum_formatDecimal(const UNumberFormat* fmt,
resultStr.setTo(result, 0, resultLength);
}
((const NumberFormat*)fmt)->format(numFmtbl, resultStr, fp, *status);
if(pos != 0) {
if (pos != nullptr) {
pos->beginIndex = fp.getBeginIndex();
pos->endIndex = fp.getEndIndex();
}
@ -355,7 +355,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt,
}
FieldPosition fp;
if (pos != 0) {
if (pos != nullptr) {
fp.setField(pos->field);
}
CurrencyAmount *tempCurrAmnt = new CurrencyAmount(number, currency, *status);
@ -366,8 +366,8 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt,
}
Formattable n(tempCurrAmnt);
((const NumberFormat*)fmt)->format(n, res, fp, *status);
if (pos != 0) {
if (pos != nullptr) {
pos->beginIndex = fp.getBeginIndex();
pos->endIndex = fp.getEndIndex();
}
@ -388,18 +388,18 @@ parseRes(Formattable& res,
const UnicodeString src((UBool)(textLength == -1), text, textLength);
ParsePosition pp;
if(parsePos != 0)
if (parsePos != nullptr)
pp.setIndex(*parsePos);
((const NumberFormat*)fmt)->parse(src, res, pp);
if(pp.getErrorIndex() != -1) {
*status = U_PARSE_ERROR;
if(parsePos != 0) {
if (parsePos != nullptr) {
*parsePos = pp.getErrorIndex();
}
} else if(parsePos != 0) {
} else if (parsePos != nullptr) {
*parsePos = pp.getIndex();
}
}
@ -978,12 +978,12 @@ unum_formatUFormattable(const UNumberFormat* fmt,
FieldPosition fp;
if(pos != 0)
if (pos != nullptr)
fp.setField(pos->field);
((const NumberFormat*)fmt)->format(*(Formattable::fromUFormattable(number)), res, fp, *status);
if(pos != 0) {
if (pos != nullptr) {
pos->beginIndex = fp.getBeginIndex();
pos->endIndex = fp.getEndIndex();
}

View file

@ -1204,11 +1204,11 @@ uregex_replaceAllUText(URegularExpression *regexp2,
UErrorCode *status) {
RegularExpression *regexp = (RegularExpression*)regexp2;
if (validateRE(regexp, true, status) == false) {
return 0;
return nullptr;
}
if (replacementText == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
dest = regexp->fMatcher->replaceAll(replacementText, dest, *status);
@ -1265,11 +1265,11 @@ uregex_replaceFirstUText(URegularExpression *regexp2,
UErrorCode *status) {
RegularExpression *regexp = (RegularExpression*)regexp2;
if (validateRE(regexp, true, status) == false) {
return 0;
return nullptr;
}
if (replacementText == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return nullptr;
}
dest = regexp->fMatcher->replaceFirst(replacementText, dest, *status);

Some files were not shown because too many files have changed in this diff Show more