mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-05 13:35:32 +00:00
ICU-21833 Replace NULL with nullptr in all C++ code.
This commit is contained in:
parent
a47717934a
commit
2e0d30cfcf
764 changed files with 12466 additions and 12466 deletions
|
@ -63,7 +63,7 @@ Appendable::getAppendBuffer(int32_t minCapacity,
|
|||
int32_t *resultCapacity) {
|
||||
if(minCapacity<1 || scratchCapacity<minCapacity) {
|
||||
*resultCapacity=0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
*resultCapacity=scratchCapacity;
|
||||
return scratch;
|
||||
|
|
|
@ -20,7 +20,7 @@ char* ByteSink::GetAppendBuffer(int32_t min_capacity,
|
|||
int32_t* result_capacity) {
|
||||
if (min_capacity < 1 || scratch_capacity < min_capacity) {
|
||||
*result_capacity = 0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
*result_capacity = scratch_capacity;
|
||||
return scratch;
|
||||
|
@ -70,7 +70,7 @@ char* CheckedArrayByteSink::GetAppendBuffer(int32_t min_capacity,
|
|||
int32_t* result_capacity) {
|
||||
if (min_capacity < 1 || scratch_capacity < min_capacity) {
|
||||
*result_capacity = 0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
int32_t available = capacity_ - size_;
|
||||
if (available >= min_capacity) {
|
||||
|
|
|
@ -68,7 +68,7 @@ BytesTrie::jumpByDelta(const uint8_t *pos) {
|
|||
UStringTrieResult
|
||||
BytesTrie::current() const {
|
||||
const uint8_t *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return USTRINGTRIE_NO_MATCH;
|
||||
} else {
|
||||
int32_t node;
|
||||
|
@ -182,7 +182,7 @@ BytesTrie::nextImpl(const uint8_t *pos, int32_t inByte) {
|
|||
UStringTrieResult
|
||||
BytesTrie::next(int32_t inByte) {
|
||||
const uint8_t *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return USTRINGTRIE_NO_MATCH;
|
||||
}
|
||||
if(inByte<0) {
|
||||
|
@ -212,7 +212,7 @@ BytesTrie::next(const char *s, int32_t sLength) {
|
|||
return current();
|
||||
}
|
||||
const uint8_t *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return USTRINGTRIE_NO_MATCH;
|
||||
}
|
||||
int32_t length=remainingMatchLength_; // Actual remaining match length minus 1.
|
||||
|
@ -317,8 +317,8 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length,
|
|||
UBool haveUniqueValue, int32_t &uniqueValue) {
|
||||
while(length>kMaxBranchLinearSubNodeLength) {
|
||||
++pos; // ignore the comparison byte
|
||||
if(NULL==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
|
||||
return NULL;
|
||||
if(nullptr==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
|
||||
return nullptr;
|
||||
}
|
||||
length=length-(length>>1);
|
||||
pos=skipDelta(pos);
|
||||
|
@ -333,7 +333,7 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length,
|
|||
if(isFinal) {
|
||||
if(haveUniqueValue) {
|
||||
if(value!=uniqueValue) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
uniqueValue=value;
|
||||
|
@ -341,7 +341,7 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length,
|
|||
}
|
||||
} else {
|
||||
if(!findUniqueValue(pos+value, haveUniqueValue, uniqueValue)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
haveUniqueValue=true;
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ BytesTrie::findUniqueValue(const uint8_t *pos, UBool haveUniqueValue, int32_t &u
|
|||
node=*pos++;
|
||||
}
|
||||
pos=findUniqueValueFromBranch(pos, node+1, haveUniqueValue, uniqueValue);
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return false;
|
||||
}
|
||||
haveUniqueValue=true;
|
||||
|
@ -387,7 +387,7 @@ BytesTrie::findUniqueValue(const uint8_t *pos, UBool haveUniqueValue, int32_t &u
|
|||
int32_t
|
||||
BytesTrie::getNextBytes(ByteSink &out) const {
|
||||
const uint8_t *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if(remainingMatchLength_>=0) {
|
||||
|
|
|
@ -127,13 +127,13 @@ BytesTrieElement::compareStringTo(const BytesTrieElement &other, const CharStrin
|
|||
}
|
||||
|
||||
BytesTrieBuilder::BytesTrieBuilder(UErrorCode &errorCode)
|
||||
: strings(NULL), elements(NULL), elementsCapacity(0), elementsLength(0),
|
||||
bytes(NULL), bytesCapacity(0), bytesLength(0) {
|
||||
: strings(nullptr), elements(nullptr), elementsCapacity(0), elementsLength(0),
|
||||
bytes(nullptr), bytesCapacity(0), bytesLength(0) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
strings=new CharString();
|
||||
if(strings==NULL) {
|
||||
if(strings==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ BytesTrieBuilder::add(StringPiece s, int32_t value, UErrorCode &errorCode) {
|
|||
newCapacity=4*elementsCapacity;
|
||||
}
|
||||
BytesTrieElement *newElements=new BytesTrieElement[newCapacity];
|
||||
if(newElements==NULL) {
|
||||
if(newElements==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return *this; // error instead of dereferencing null
|
||||
}
|
||||
|
@ -192,13 +192,13 @@ U_CDECL_END
|
|||
BytesTrie *
|
||||
BytesTrieBuilder::build(UStringTrieBuildOption buildOption, UErrorCode &errorCode) {
|
||||
buildBytes(buildOption, errorCode);
|
||||
BytesTrie *newTrie=NULL;
|
||||
BytesTrie *newTrie=nullptr;
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
newTrie=new BytesTrie(bytes, bytes+(bytesCapacity-bytesLength));
|
||||
if(newTrie==NULL) {
|
||||
if(newTrie==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
} else {
|
||||
bytes=NULL; // The new trie now owns the array.
|
||||
bytes=nullptr; // The new trie now owns the array.
|
||||
bytesCapacity=0;
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
if(bytes!=NULL && bytesLength>0) {
|
||||
if(bytes!=nullptr && bytesLength>0) {
|
||||
// Already built.
|
||||
return;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err
|
|||
if(bytesCapacity<capacity) {
|
||||
uprv_free(bytes);
|
||||
bytes=static_cast<char *>(uprv_malloc(capacity));
|
||||
if(bytes==NULL) {
|
||||
if(bytes==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
bytesCapacity=0;
|
||||
return;
|
||||
|
@ -264,7 +264,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err
|
|||
bytesCapacity=capacity;
|
||||
}
|
||||
StringTrieBuilder::build(buildOption, elementsLength, errorCode);
|
||||
if(bytes==NULL) {
|
||||
if(bytes==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ BytesTrieBuilder::createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t le
|
|||
|
||||
UBool
|
||||
BytesTrieBuilder::ensureCapacity(int32_t length) {
|
||||
if(bytes==NULL) {
|
||||
if(bytes==nullptr) {
|
||||
return false; // previous memory allocation had failed
|
||||
}
|
||||
if(length>bytesCapacity) {
|
||||
|
@ -383,10 +383,10 @@ BytesTrieBuilder::ensureCapacity(int32_t length) {
|
|||
newCapacity*=2;
|
||||
} while(newCapacity<=length);
|
||||
char *newBytes=static_cast<char *>(uprv_malloc(newCapacity));
|
||||
if(newBytes==NULL) {
|
||||
if(newBytes==nullptr) {
|
||||
// unable to allocate memory
|
||||
uprv_free(bytes);
|
||||
bytes=NULL;
|
||||
bytes=nullptr;
|
||||
bytesCapacity=0;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength,
|
|||
: bytes_(static_cast<const uint8_t *>(trieBytes)),
|
||||
pos_(bytes_), initialPos_(bytes_),
|
||||
remainingMatchLength_(-1), initialRemainingMatchLength_(-1),
|
||||
str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) {
|
||||
str_(nullptr), maxLength_(maxStringLength), value_(0), stack_(nullptr) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength,
|
|||
// cost is minimal.
|
||||
str_=new CharString();
|
||||
stack_=new UVector32(errorCode);
|
||||
if(U_SUCCESS(errorCode) && (str_==NULL || stack_==NULL)) {
|
||||
if(U_SUCCESS(errorCode) && (str_==nullptr || stack_==nullptr)) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ BytesTrie::Iterator::Iterator(const BytesTrie &trie, int32_t maxStringLength,
|
|||
: bytes_(trie.bytes_), pos_(trie.pos_), initialPos_(trie.pos_),
|
||||
remainingMatchLength_(trie.remainingMatchLength_),
|
||||
initialRemainingMatchLength_(trie.remainingMatchLength_),
|
||||
str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) {
|
||||
str_(nullptr), maxLength_(maxStringLength), value_(0), stack_(nullptr) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ BytesTrie::Iterator::Iterator(const BytesTrie &trie, int32_t maxStringLength,
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
if(str_==NULL || stack_==NULL) {
|
||||
if(str_==nullptr || stack_==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ BytesTrie::Iterator::reset() {
|
|||
}
|
||||
|
||||
UBool
|
||||
BytesTrie::Iterator::hasNext() const { return pos_!=NULL || !stack_->isEmpty(); }
|
||||
BytesTrie::Iterator::hasNext() const { return pos_!=nullptr || !stack_->isEmpty(); }
|
||||
|
||||
UBool
|
||||
BytesTrie::Iterator::next(UErrorCode &errorCode) {
|
||||
|
@ -104,7 +104,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
return false;
|
||||
}
|
||||
const uint8_t *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
if(stack_->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
length=(int32_t)((uint32_t)length>>16);
|
||||
if(length>1) {
|
||||
pos=branchNext(pos, length, errorCode);
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return true; // Reached a final value.
|
||||
}
|
||||
} else {
|
||||
|
@ -137,7 +137,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
UBool isFinal=(UBool)(node&kValueIsFinal);
|
||||
value_=readValue(pos, node>>1);
|
||||
if(isFinal || (maxLength_>0 && str_->length()==maxLength_)) {
|
||||
pos_=NULL;
|
||||
pos_=nullptr;
|
||||
} else {
|
||||
pos_=skipValue(pos, node);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
node=*pos++;
|
||||
}
|
||||
pos=branchNext(pos, node+1, errorCode);
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return true; // Reached a final value.
|
||||
}
|
||||
} else {
|
||||
|
@ -170,12 +170,12 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
|
||||
StringPiece
|
||||
BytesTrie::Iterator::getString() const {
|
||||
return str_ == NULL ? StringPiece() : str_->toStringPiece();
|
||||
return str_ == nullptr ? StringPiece() : str_->toStringPiece();
|
||||
}
|
||||
|
||||
UBool
|
||||
BytesTrie::Iterator::truncateAndStop() {
|
||||
pos_=NULL;
|
||||
pos_=nullptr;
|
||||
value_=-1; // no real value for str
|
||||
return true;
|
||||
}
|
||||
|
@ -203,9 +203,9 @@ BytesTrie::Iterator::branchNext(const uint8_t *pos, int32_t length, UErrorCode &
|
|||
stack_->addElement(((length-1)<<16)|str_->length(), errorCode);
|
||||
str_->append((char)trieByte, errorCode);
|
||||
if(isFinal) {
|
||||
pos_=NULL;
|
||||
pos_=nullptr;
|
||||
value_=value;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
return pos+value;
|
||||
}
|
||||
|
|
|
@ -68,10 +68,10 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CanonicalIterator)
|
|||
*@param source string to get results for
|
||||
*/
|
||||
CanonicalIterator::CanonicalIterator(const UnicodeString &sourceStr, UErrorCode &status) :
|
||||
pieces(NULL),
|
||||
pieces(nullptr),
|
||||
pieces_length(0),
|
||||
pieces_lengths(NULL),
|
||||
current(NULL),
|
||||
pieces_lengths(nullptr),
|
||||
current(nullptr),
|
||||
current_length(0),
|
||||
nfd(*Normalizer2::getNFDInstance(status)),
|
||||
nfcImpl(*Normalizer2Factory::getNFCImpl(status))
|
||||
|
@ -87,23 +87,23 @@ CanonicalIterator::~CanonicalIterator() {
|
|||
|
||||
void CanonicalIterator::cleanPieces() {
|
||||
int32_t i = 0;
|
||||
if(pieces != NULL) {
|
||||
if(pieces != nullptr) {
|
||||
for(i = 0; i < pieces_length; i++) {
|
||||
if(pieces[i] != NULL) {
|
||||
if(pieces[i] != nullptr) {
|
||||
delete[] pieces[i];
|
||||
}
|
||||
}
|
||||
uprv_free(pieces);
|
||||
pieces = NULL;
|
||||
pieces = nullptr;
|
||||
pieces_length = 0;
|
||||
}
|
||||
if(pieces_lengths != NULL) {
|
||||
if(pieces_lengths != nullptr) {
|
||||
uprv_free(pieces_lengths);
|
||||
pieces_lengths = NULL;
|
||||
pieces_lengths = nullptr;
|
||||
}
|
||||
if(current != NULL) {
|
||||
if(current != nullptr) {
|
||||
uprv_free(current);
|
||||
current = NULL;
|
||||
current = nullptr;
|
||||
current_length = 0;
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
|||
UChar32 cp = 0;
|
||||
int32_t start = 0;
|
||||
int32_t i = 0;
|
||||
UnicodeString *list = NULL;
|
||||
UnicodeString *list = nullptr;
|
||||
|
||||
nfd.normalize(newSource, source, status);
|
||||
if(U_FAILURE(status)) {
|
||||
|
@ -187,7 +187,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
|||
pieces_length = 1;
|
||||
current = (int32_t*)uprv_malloc(1 * sizeof(int32_t));
|
||||
current_length = 1;
|
||||
if (pieces == NULL || pieces_lengths == NULL || current == NULL) {
|
||||
if (pieces == nullptr || pieces_lengths == nullptr || current == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto CleanPartialInitialization;
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
|||
pieces_lengths = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
|
||||
current = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
|
||||
current_length = list_length;
|
||||
if (pieces == NULL || pieces_lengths == NULL || current == NULL) {
|
||||
if (pieces == nullptr || pieces_lengths == nullptr || current == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
goto CleanPartialInitialization;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
|||
return;
|
||||
// Common section to cleanup all local variables and reset object variables.
|
||||
CleanPartialInitialization:
|
||||
if (list != NULL) {
|
||||
if (list != nullptr) {
|
||||
delete[] list;
|
||||
}
|
||||
cleanPieces();
|
||||
|
@ -276,7 +276,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
|
|||
// we check for length < 2 to keep from counting code points all the time
|
||||
if (source.length() <= 2 && source.countChar32() <= 1) {
|
||||
UnicodeString *toPut = new UnicodeString(source);
|
||||
/* test for NULL */
|
||||
/* test for nullptr */
|
||||
if (toPut == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -295,7 +295,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
|
|||
|
||||
for (i = 0; i < source.length(); i += U16_LENGTH(cp)) {
|
||||
cp = source.char32At(i);
|
||||
const UHashElement *ne = NULL;
|
||||
const UHashElement *ne = nullptr;
|
||||
int32_t el = UHASH_FIRST;
|
||||
UnicodeString subPermuteString = source;
|
||||
|
||||
|
@ -321,11 +321,11 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
|
|||
|
||||
// prefix this character to all of them
|
||||
ne = subpermute.nextElement(el);
|
||||
while (ne != NULL) {
|
||||
while (ne != nullptr) {
|
||||
UnicodeString *permRes = (UnicodeString *)(ne->value.pointer);
|
||||
UnicodeString *chStr = new UnicodeString(cp);
|
||||
//test for NULL
|
||||
if (chStr == NULL) {
|
||||
//test for nullptr
|
||||
if (chStr == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -360,23 +360,23 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
|||
// add only the ones that are canonically equivalent
|
||||
// TODO: optimize by not permuting any class zero.
|
||||
|
||||
const UHashElement *ne = NULL;
|
||||
const UHashElement *ne = nullptr;
|
||||
int32_t el = UHASH_FIRST;
|
||||
//Iterator it = basic.iterator();
|
||||
ne = basic.nextElement(el);
|
||||
//while (it.hasNext())
|
||||
while (ne != NULL) {
|
||||
while (ne != nullptr) {
|
||||
//String item = (String) it.next();
|
||||
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
|
||||
|
||||
permutations.removeAll();
|
||||
permute(item, CANITER_SKIP_ZEROES, &permutations, status);
|
||||
const UHashElement *ne2 = NULL;
|
||||
const UHashElement *ne2 = nullptr;
|
||||
int32_t el2 = UHASH_FIRST;
|
||||
//Iterator it2 = permutations.iterator();
|
||||
ne2 = permutations.nextElement(el2);
|
||||
//while (it2.hasNext())
|
||||
while (ne2 != NULL) {
|
||||
while (ne2 != nullptr) {
|
||||
//String possible = (String) it2.next();
|
||||
//UnicodeString *possible = new UnicodeString(*((UnicodeString *)(ne2->value.pointer)));
|
||||
UnicodeString possible(*((UnicodeString *)(ne2->value.pointer)));
|
||||
|
@ -403,24 +403,24 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
|||
}
|
||||
// convert into a String[] to clean up storage
|
||||
//String[] finalResult = new String[result.size()];
|
||||
UnicodeString *finalResult = NULL;
|
||||
UnicodeString *finalResult = nullptr;
|
||||
int32_t resultCount;
|
||||
if((resultCount = result.count()) != 0) {
|
||||
finalResult = new UnicodeString[resultCount];
|
||||
if (finalResult == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
//result.toArray(finalResult);
|
||||
result_len = 0;
|
||||
el = UHASH_FIRST;
|
||||
ne = result.nextElement(el);
|
||||
while(ne != NULL) {
|
||||
while(ne != nullptr) {
|
||||
finalResult[result_len++] = *((UnicodeString *)(ne->value.pointer));
|
||||
ne = result.nextElement(el);
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
|||
Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status) {
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//if (PROGRESS) printf("Adding: %s\n", UToS(Tr(segment)));
|
||||
|
@ -457,7 +457,7 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
|
|||
UChar32 cp2 = iter.getCodepoint();
|
||||
Hashtable remainder(status);
|
||||
remainder.setValueDeleter(uprv_deleteUObject);
|
||||
if (extract(&remainder, cp2, segment, segLen, i, status) == NULL) {
|
||||
if (extract(&remainder, cp2, segment, segLen, i, status) == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -467,13 +467,13 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
|
|||
|
||||
int32_t el = UHASH_FIRST;
|
||||
const UHashElement *ne = remainder.nextElement(el);
|
||||
while (ne != NULL) {
|
||||
while (ne != nullptr) {
|
||||
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
|
||||
UnicodeString *toAdd = new UnicodeString(prefix);
|
||||
/* test for NULL */
|
||||
/* test for nullptr */
|
||||
if (toAdd == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
*toAdd += item;
|
||||
fillinResult->put(*toAdd, toAdd, status);
|
||||
|
@ -487,7 +487,7 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
|
|||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return fillinResult;
|
||||
}
|
||||
|
@ -503,7 +503,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
|
|||
//if (PROGRESS) printf("%s, %i\n", UToS(Tr(segment)), segmentPos);
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UnicodeString temp(comp);
|
||||
|
@ -511,11 +511,11 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
|
|||
UnicodeString decompString;
|
||||
nfd.normalize(temp, decompString, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (decompString.isBogus()) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
const UChar *decomp=decompString.getBuffer();
|
||||
int32_t decompLen=decompString.length();
|
||||
|
@ -561,7 +561,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
|
|||
}
|
||||
}
|
||||
if (!ok)
|
||||
return NULL; // we failed, characters left over
|
||||
return nullptr; // we failed, characters left over
|
||||
|
||||
//if (PROGRESS) printf("Matches\n");
|
||||
|
||||
|
@ -575,7 +575,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
|
|||
UnicodeString trial;
|
||||
nfd.normalize(temp, trial, status);
|
||||
if(U_FAILURE(status) || trial.compare(segment+segmentPos, segLen - segmentPos) != 0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return getEquivalents2(fillinResult, temp.getBuffer()+inputLen, temp.length()-inputLen, status);
|
||||
|
|
|
@ -113,7 +113,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return *this;
|
||||
}
|
||||
if(sLength<-1 || (s==NULL && sLength!=0)) {
|
||||
if(sLength<-1 || (s==nullptr && sLength!=0)) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return *this;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ char *CharString::getAppendBuffer(int32_t minCapacity,
|
|||
UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
resultCapacity=0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
int32_t appendCapacity=buffer.getCapacity()-len-1; // -1 for NUL
|
||||
if(appendCapacity>=minCapacity) {
|
||||
|
@ -193,7 +193,7 @@ char *CharString::getAppendBuffer(int32_t minCapacity,
|
|||
return buffer.getAlias()+len;
|
||||
}
|
||||
resultCapacity=0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CharString &CharString::appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode) {
|
||||
|
@ -226,8 +226,8 @@ UBool CharString::ensureCapacity(int32_t capacity,
|
|||
if(desiredCapacityHint==0) {
|
||||
desiredCapacityHint=capacity+buffer.getCapacity();
|
||||
}
|
||||
if( (desiredCapacityHint<=capacity || buffer.resize(desiredCapacityHint, len+1)==NULL) &&
|
||||
buffer.resize(capacity, len+1)==NULL
|
||||
if( (desiredCapacityHint<=capacity || buffer.resize(desiredCapacityHint, len+1)==nullptr) &&
|
||||
buffer.resize(capacity, len+1)==nullptr
|
||||
) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
* If you have a need to replace ICU allocation, this is the
|
||||
* place to do it.
|
||||
*
|
||||
* Note that uprv_malloc(0) returns a non-NULL pointer, and
|
||||
* that a subsequent free of that pointer value is a NOP.
|
||||
* Note that uprv_malloc(0) returns a non-nullptr pointer,
|
||||
* and that a subsequent free of that pointer value is a NOP.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
@ -103,7 +103,7 @@ uprv_free(void *buffer) {
|
|||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_calloc(size_t num, size_t size) {
|
||||
void *mem = NULL;
|
||||
void *mem = nullptr;
|
||||
size *= num;
|
||||
mem = uprv_malloc(size);
|
||||
if (mem) {
|
||||
|
@ -118,7 +118,7 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem
|
|||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
if (a==NULL || r==NULL || f==NULL) {
|
||||
if (a==nullptr || r==nullptr || f==nullptr) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem
|
|||
|
||||
|
||||
U_CFUNC UBool cmemory_cleanup(void) {
|
||||
pContext = NULL;
|
||||
pAlloc = NULL;
|
||||
pRealloc = NULL;
|
||||
pFree = NULL;
|
||||
pContext = nullptr;
|
||||
pAlloc = nullptr;
|
||||
pRealloc = nullptr;
|
||||
pFree = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -192,13 +192,13 @@ public:
|
|||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an array of T items that is adopted
|
||||
*/
|
||||
explicit LocalMemory(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {}
|
||||
/**
|
||||
* Move constructor, leaves src with isNull().
|
||||
* @param src source smart pointer
|
||||
*/
|
||||
LocalMemory(LocalMemory<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
|
||||
src.ptr=NULL;
|
||||
src.ptr=nullptr;
|
||||
}
|
||||
/**
|
||||
* Destructor deletes the memory it owns.
|
||||
|
@ -215,7 +215,7 @@ public:
|
|||
LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
LocalPointerBase<T>::ptr=src.ptr;
|
||||
src.ptr=NULL;
|
||||
src.ptr=nullptr;
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
|
@ -248,21 +248,21 @@ public:
|
|||
* Deletes the array it owns, allocates a new one and reset its bytes to 0.
|
||||
* Returns the new array pointer.
|
||||
* If the allocation fails, then the current array is unchanged and
|
||||
* this method returns NULL.
|
||||
* this method returns nullptr.
|
||||
* @param newCapacity must be >0
|
||||
* @return the allocated array pointer, or NULL if the allocation failed
|
||||
* @return the allocated array pointer, or nullptr if the allocation failed
|
||||
*/
|
||||
inline T *allocateInsteadAndReset(int32_t newCapacity=1);
|
||||
/**
|
||||
* Deletes the array it owns and allocates a new one, copying length T items.
|
||||
* Returns the new array pointer.
|
||||
* If the allocation fails, then the current array is unchanged and
|
||||
* this method returns NULL.
|
||||
* this method returns nullptr.
|
||||
* @param newCapacity must be >0
|
||||
* @param length number of T items to be copied from the old array to the new one;
|
||||
* must be no more than the capacity of the old array,
|
||||
* which the caller must track because the LocalMemory does not track it
|
||||
* @return the allocated array pointer, or NULL if the allocation failed
|
||||
* @return the allocated array pointer, or nullptr if the allocation failed
|
||||
*/
|
||||
inline T *allocateInsteadAndCopy(int32_t newCapacity=1, int32_t length=0);
|
||||
/**
|
||||
|
@ -278,14 +278,14 @@ template<typename T>
|
|||
inline T *LocalMemory<T>::allocateInsteadAndReset(int32_t newCapacity) {
|
||||
if(newCapacity>0) {
|
||||
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(p!=nullptr) {
|
||||
uprv_memset(p, 0, newCapacity*sizeof(T));
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ template<typename T>
|
|||
inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) {
|
||||
if(newCapacity>0) {
|
||||
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(p!=nullptr) {
|
||||
if(length>0) {
|
||||
if(length>newCapacity) {
|
||||
length=newCapacity;
|
||||
|
@ -306,7 +306,7 @@ inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t le
|
|||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,11 +403,11 @@ public:
|
|||
/**
|
||||
* Deletes the array (if owned) and aliases another one, no transfer of ownership.
|
||||
* If the arguments are illegal, then the current array is unchanged.
|
||||
* @param otherArray must not be NULL
|
||||
* @param otherArray must not be nullptr
|
||||
* @param otherCapacity must be >0
|
||||
*/
|
||||
void aliasInstead(T *otherArray, int32_t otherCapacity) {
|
||||
if(otherArray!=NULL && otherCapacity>0) {
|
||||
if(otherArray!=nullptr && otherCapacity>0) {
|
||||
releaseArray();
|
||||
ptr=otherArray;
|
||||
capacity=otherCapacity;
|
||||
|
@ -418,17 +418,17 @@ public:
|
|||
* Deletes the array (if owned) and allocates a new one, copying length T items.
|
||||
* Returns the new array pointer.
|
||||
* If the allocation fails, then the current array is unchanged and
|
||||
* this method returns NULL.
|
||||
* this method returns nullptr.
|
||||
* @param newCapacity can be less than or greater than the current capacity;
|
||||
* must be >0
|
||||
* @param length number of T items to be copied from the old array to the new one
|
||||
* @return the allocated array pointer, or NULL if the allocation failed
|
||||
* @return the allocated array pointer, or nullptr if the allocation failed
|
||||
*/
|
||||
inline T *resize(int32_t newCapacity, int32_t length=0);
|
||||
/**
|
||||
* Gives up ownership of the array if owned, or else clones it,
|
||||
* copying length T items; resets itself to the internal stack array.
|
||||
* Returns NULL if the allocation failed.
|
||||
* Returns nullptr if the allocation failed.
|
||||
* @param length number of T items to copy when cloning,
|
||||
* and capacity of the clone when cloning
|
||||
* @param resultCapacity will be set to the returned array's capacity (output-only)
|
||||
|
@ -443,7 +443,7 @@ protected:
|
|||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
if (this->resize(src.capacity, 0) == NULL) {
|
||||
if (this->resize(src.capacity, 0) == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t
|
|||
::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T));
|
||||
#endif
|
||||
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(p!=nullptr) {
|
||||
if(length>0) {
|
||||
if(length>capacity) {
|
||||
length=capacity;
|
||||
|
@ -525,7 +525,7 @@ inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t
|
|||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
|
|||
if(needToRelease) {
|
||||
p=ptr;
|
||||
} else if(length<=0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
if(length>capacity) {
|
||||
length=capacity;
|
||||
|
@ -544,8 +544,8 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
|
|||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
::fprintf(::stderr,"MaybeStacArray (orphan) alloc %d * %lu\n", length,sizeof(T));
|
||||
#endif
|
||||
if(p==NULL) {
|
||||
return NULL;
|
||||
if(p==nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
|
||||
}
|
||||
|
@ -618,11 +618,11 @@ public:
|
|||
/**
|
||||
* Deletes the memory block (if owned) and aliases another one, no transfer of ownership.
|
||||
* If the arguments are illegal, then the current memory is unchanged.
|
||||
* @param otherArray must not be NULL
|
||||
* @param otherArray must not be nullptr
|
||||
* @param otherCapacity must be >0
|
||||
*/
|
||||
void aliasInstead(H *otherMemory, int32_t otherCapacity) {
|
||||
if(otherMemory!=NULL && otherCapacity>0) {
|
||||
if(otherMemory!=nullptr && otherCapacity>0) {
|
||||
releaseMemory();
|
||||
ptr=otherMemory;
|
||||
capacity=otherCapacity;
|
||||
|
@ -634,17 +634,17 @@ public:
|
|||
* copying the header and length T array items.
|
||||
* Returns the new header pointer.
|
||||
* If the allocation fails, then the current memory is unchanged and
|
||||
* this method returns NULL.
|
||||
* this method returns nullptr.
|
||||
* @param newCapacity can be less than or greater than the current capacity;
|
||||
* must be >0
|
||||
* @param length number of T items to be copied from the old array to the new one
|
||||
* @return the allocated pointer, or NULL if the allocation failed
|
||||
* @return the allocated pointer, or nullptr if the allocation failed
|
||||
*/
|
||||
inline H *resize(int32_t newCapacity, int32_t length=0);
|
||||
/**
|
||||
* Gives up ownership of the memory if owned, or else clones it,
|
||||
* copying the header and length T array items; resets itself to the internal memory.
|
||||
* Returns NULL if the allocation failed.
|
||||
* Returns nullptr if the allocation failed.
|
||||
* @param length number of T items to copy when cloning,
|
||||
* and array capacity of the clone when cloning
|
||||
* @param resultCapacity will be set to the returned array's capacity (output-only)
|
||||
|
@ -680,7 +680,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapac
|
|||
::fprintf(::stderr,"MaybeStackHeaderAndArray alloc %d + %d * %ul\n", sizeof(H),newCapacity,sizeof(T));
|
||||
#endif
|
||||
H *p=(H *)uprv_malloc(sizeof(H)+newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(p!=nullptr) {
|
||||
if(length<0) {
|
||||
length=0;
|
||||
} else if(length>0) {
|
||||
|
@ -699,7 +699,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapac
|
|||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,8 +719,8 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
|
|||
::fprintf(::stderr,"MaybeStackHeaderAndArray (orphan) alloc %ul + %d * %lu\n", sizeof(H),length,sizeof(T));
|
||||
#endif
|
||||
p=(H *)uprv_malloc(sizeof(H)+length*sizeof(T));
|
||||
if(p==NULL) {
|
||||
return NULL;
|
||||
if(p==nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN
|
|||
CStr::CStr(const UnicodeString &in) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
#if !UCONFIG_NO_CONVERSION || U_CHARSET_IS_UTF8
|
||||
int32_t length = in.extract(0, in.length(), static_cast<char *>(NULL), static_cast<uint32_t>(0));
|
||||
int32_t length = in.extract(0, in.length(), static_cast<char *>(nullptr), static_cast<uint32_t>(0));
|
||||
int32_t resultCapacity = 0;
|
||||
char *buf = s.getAppendBuffer(length, length, resultCapacity, status);
|
||||
if (U_SUCCESS(status)) {
|
||||
|
|
|
@ -189,7 +189,7 @@ T_CString_integerToString(char* buffer, int32_t v, int32_t radix)
|
|||
/*
|
||||
* Takes a int64_t and fills in a char* string with that number "radix"-based.
|
||||
* Writes at most 21: chars ("-9223372036854775807" plus NUL).
|
||||
* Returns the length of the string, not including the terminating NULL.
|
||||
* Returns the length of the string, not including the terminating NUL.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
|
||||
|
@ -233,16 +233,16 @@ T_CString_stringToInteger(const char *integerString, int32_t radix)
|
|||
|
||||
U_CAPI int U_EXPORT2
|
||||
uprv_stricmp(const char *str1, const char *str2) {
|
||||
if(str1==NULL) {
|
||||
if(str2==NULL) {
|
||||
if(str1==nullptr) {
|
||||
if(str2==nullptr) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if(str2==NULL) {
|
||||
} else if(str2==nullptr) {
|
||||
return 1;
|
||||
} else {
|
||||
/* compare non-NULL strings lexically with lowercase */
|
||||
/* compare non-nullptr strings lexically with lowercase */
|
||||
int rc;
|
||||
unsigned char c1, c2;
|
||||
|
||||
|
@ -272,16 +272,16 @@ uprv_stricmp(const char *str1, const char *str2) {
|
|||
|
||||
U_CAPI int U_EXPORT2
|
||||
uprv_strnicmp(const char *str1, const char *str2, uint32_t n) {
|
||||
if(str1==NULL) {
|
||||
if(str2==NULL) {
|
||||
if(str1==nullptr) {
|
||||
if(str2==nullptr) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if(str2==NULL) {
|
||||
} else if(str2==nullptr) {
|
||||
return 1;
|
||||
} else {
|
||||
/* compare non-NULL strings lexically with lowercase */
|
||||
/* compare non-nullptr strings lexically with lowercase */
|
||||
int rc;
|
||||
unsigned char c1, c2;
|
||||
|
||||
|
|
|
@ -57,13 +57,13 @@ int32_t UCharsDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
|
|||
codePointsMatched += 1;
|
||||
if (USTRINGTRIE_HAS_VALUE(result)) {
|
||||
if (wordCount < limit) {
|
||||
if (values != NULL) {
|
||||
if (values != nullptr) {
|
||||
values[wordCount] = uct.getValue();
|
||||
}
|
||||
if (lengths != NULL) {
|
||||
if (lengths != nullptr) {
|
||||
lengths[wordCount] = lengthMatched;
|
||||
}
|
||||
if (cpLengths != NULL) {
|
||||
if (cpLengths != nullptr) {
|
||||
cpLengths[wordCount] = codePointsMatched;
|
||||
}
|
||||
++wordCount;
|
||||
|
@ -80,7 +80,7 @@ int32_t UCharsDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
if (prefix != NULL) {
|
||||
if (prefix != nullptr) {
|
||||
*prefix = codePointsMatched;
|
||||
}
|
||||
return wordCount;
|
||||
|
@ -124,13 +124,13 @@ int32_t BytesDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
|
|||
codePointsMatched += 1;
|
||||
if (USTRINGTRIE_HAS_VALUE(result)) {
|
||||
if (wordCount < limit) {
|
||||
if (values != NULL) {
|
||||
if (values != nullptr) {
|
||||
values[wordCount] = bt.getValue();
|
||||
}
|
||||
if (lengths != NULL) {
|
||||
if (lengths != nullptr) {
|
||||
lengths[wordCount] = lengthMatched;
|
||||
}
|
||||
if (cpLengths != NULL) {
|
||||
if (cpLengths != nullptr) {
|
||||
cpLengths[wordCount] = codePointsMatched;
|
||||
}
|
||||
++wordCount;
|
||||
|
@ -147,7 +147,7 @@ int32_t BytesDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
|
|||
}
|
||||
}
|
||||
|
||||
if (prefix != NULL) {
|
||||
if (prefix != nullptr) {
|
||||
*prefix = codePointsMatched;
|
||||
}
|
||||
return wordCount;
|
||||
|
@ -170,7 +170,7 @@ udict_swap(const UDataSwapper *ds, const void *inData, int32_t length,
|
|||
int32_t i, offset, size;
|
||||
|
||||
headerSize = udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
|
||||
if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) return 0;
|
||||
if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) return 0;
|
||||
pInfo = (const UDataInfo *)((const char *)inData + 4);
|
||||
if (!(pInfo->dataFormat[0] == 0x44 &&
|
||||
pInfo->dataFormat[1] == 0x69 &&
|
||||
|
|
|
@ -79,15 +79,15 @@ public:
|
|||
* matching words to be found.
|
||||
* @param lengths output array, filled with the lengths of the matches, in order,
|
||||
* from shortest to longest. Lengths are in native indexing units
|
||||
* of the UText. May be NULL.
|
||||
* of the UText. May be nullptr.
|
||||
* @param cpLengths output array, filled with the lengths of the matches, in order,
|
||||
* from shortest to longest. Lengths are the number of Unicode code points.
|
||||
* May be NULL.
|
||||
* May be nullptr.
|
||||
* @param values Output array, filled with the values associated with the words found.
|
||||
* May be NULL.
|
||||
* May be nullptr.
|
||||
* @param prefix Output parameter, the code point length of the prefix match, even if that
|
||||
* prefix didn't lead to a complete word. Will always be >= the cpLength
|
||||
* of the longest complete word matched. May be NULL.
|
||||
* of the longest complete word matched. May be nullptr.
|
||||
* @return Number of matching words found.
|
||||
*/
|
||||
virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit,
|
||||
|
|
|
@ -233,7 +233,7 @@ UBool Edits::growArray() {
|
|||
return false;
|
||||
}
|
||||
uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)newCapacity * 2);
|
||||
if (newArray == NULL) {
|
||||
if (newArray == nullptr) {
|
||||
errorCode_ = U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ static void _fb_trace(const char *m, const UnicodeString *s, UBool b, int32_t d,
|
|||
if(s) {
|
||||
s->extract(0,s->length(),buf,2048);
|
||||
} else {
|
||||
strcpy(buf,"NULL");
|
||||
strcpy(buf,"nullptr");
|
||||
}
|
||||
fprintf(stderr,"%s:%d: %s. s='%s'(%p), b=%c, d=%d\n",
|
||||
f, l, m, buf, (const void*)s, b?'T':'F',(int)d);
|
||||
|
|
|
@ -346,15 +346,15 @@ U_NAMESPACE_USE
|
|||
U_CAPI UNormalizer2 * U_EXPORT2
|
||||
unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode) {
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if(filterSet==NULL) {
|
||||
if(filterSet==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Normalizer2 *fn2=new FilteredNormalizer2(*(Normalizer2 *)norm2,
|
||||
*UnicodeSet::fromUSet(filterSet));
|
||||
if(fn2==NULL) {
|
||||
if(fn2==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
return (UNormalizer2 *)fn2;
|
||||
|
|
|
@ -159,7 +159,7 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status)
|
|||
: uhash_hashUnicodeString,
|
||||
ignoreKeyCase ? uhash_compareCaselessUnicodeString
|
||||
: uhash_compareUnicodeString,
|
||||
NULL,
|
||||
nullptr,
|
||||
status);
|
||||
}
|
||||
|
||||
|
@ -170,25 +170,25 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& statu
|
|||
: uhash_hashUnicodeString,
|
||||
ignoreKeyCase ? uhash_compareCaselessUnicodeString
|
||||
: uhash_compareUnicodeString,
|
||||
NULL, size,
|
||||
nullptr, size,
|
||||
status);
|
||||
}
|
||||
|
||||
inline Hashtable::Hashtable(UErrorCode& status)
|
||||
: hash(0)
|
||||
{
|
||||
init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status);
|
||||
init(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, status);
|
||||
}
|
||||
|
||||
inline Hashtable::Hashtable()
|
||||
: hash(0)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status);
|
||||
init(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, status);
|
||||
}
|
||||
|
||||
inline Hashtable::~Hashtable() {
|
||||
if (hash != NULL) {
|
||||
if (hash != nullptr) {
|
||||
uhash_close(hash);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
#include "uresimp.h" /* for ures_getVersionByKey */
|
||||
|
||||
U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status) {
|
||||
UResourceBundle *icudatares = NULL;
|
||||
UResourceBundle *icudatares = nullptr;
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataVersionFillin != NULL) {
|
||||
icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
|
||||
if (dataVersionFillin != nullptr) {
|
||||
icudatares = ures_openDirect(nullptr, U_ICU_VERSION_BUNDLE , status);
|
||||
if (U_SUCCESS(*status)) {
|
||||
ures_getVersionByKey(icudatares, U_ICU_DATA_KEY, dataVersionFillin, status);
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ struct UPlugData {
|
|||
UPlugEntrypoint *entrypoint; /**< plugin entrypoint */
|
||||
uint32_t structSize; /**< initialized to the size of this structure */
|
||||
uint32_t token; /**< must be U_PLUG_TOKEN */
|
||||
void *lib; /**< plugin library, or NULL */
|
||||
void *lib; /**< plugin library, or nullptr */
|
||||
char libName[UPLUG_NAME_MAX]; /**< library name */
|
||||
char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
|
||||
char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or nullptr */
|
||||
char config[UPLUG_NAME_MAX]; /**< configuration data */
|
||||
void *context; /**< user context data */
|
||||
char name[UPLUG_NAME_MAX]; /**< name of plugin */
|
||||
|
@ -148,9 +148,9 @@ static int32_t searchForLibrary(void *lib) {
|
|||
U_CAPI char * U_EXPORT2
|
||||
uplug_findLibrary(void *lib, UErrorCode *status) {
|
||||
int32_t libEnt;
|
||||
char *ret = NULL;
|
||||
char *ret = nullptr;
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
libEnt = searchForLibrary(lib);
|
||||
if(libEnt!=-1) {
|
||||
|
@ -164,9 +164,9 @@ uplug_findLibrary(void *lib, UErrorCode *status) {
|
|||
U_CAPI void * U_EXPORT2
|
||||
uplug_openLibrary(const char *libName, UErrorCode *status) {
|
||||
int32_t libEntry = -1;
|
||||
void *lib = NULL;
|
||||
void *lib = nullptr;
|
||||
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
if(U_FAILURE(*status)) return nullptr;
|
||||
|
||||
libEntry = searchForLibraryName(libName);
|
||||
if(libEntry == -1) {
|
||||
|
@ -177,7 +177,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status) {
|
|||
#if UPLUG_TRACE
|
||||
DBG((stderr, "uplug_openLibrary() - out of library slots (max %d)\n", libraryMax));
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
/* Some operating systems don't want
|
||||
DL operations from multiple threads. */
|
||||
|
@ -186,9 +186,9 @@ uplug_openLibrary(const char *libName, UErrorCode *status) {
|
|||
DBG((stderr, "uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib));
|
||||
#endif
|
||||
|
||||
if(libraryList[libEntry].lib == NULL || U_FAILURE(*status)) {
|
||||
if(libraryList[libEntry].lib == nullptr || U_FAILURE(*status)) {
|
||||
/* cleanup. */
|
||||
libraryList[libEntry].lib = NULL; /* failure with open */
|
||||
libraryList[libEntry].lib = nullptr; /* failure with open */
|
||||
libraryList[libEntry].name[0] = 0;
|
||||
#if UPLUG_TRACE
|
||||
DBG((stderr, "uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib));
|
||||
|
@ -252,14 +252,14 @@ static int32_t uplug_pluginNumber(UPlugData* d) {
|
|||
|
||||
U_CAPI UPlugData * U_EXPORT2
|
||||
uplug_nextPlug(UPlugData *prior) {
|
||||
if(prior==NULL) {
|
||||
if(prior==nullptr) {
|
||||
return pluginList;
|
||||
} else {
|
||||
UPlugData *nextPlug = &prior[1];
|
||||
UPlugData *pastPlug = &pluginList[pluginCount];
|
||||
|
||||
if(nextPlug>=pastPlug) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
return nextPlug;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ uplug_nextPlug(UPlugData *prior) {
|
|||
*/
|
||||
static void uplug_callPlug(UPlugData *plug, UPlugReason reason, UErrorCode *status) {
|
||||
UPlugTokenReturn token;
|
||||
if(plug==NULL||U_FAILURE(*status)) {
|
||||
if(plug==nullptr||U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
token = (*(plug->entrypoint))(plug, reason, status);
|
||||
|
@ -330,15 +330,15 @@ static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) {
|
|||
|
||||
static UPlugData *uplug_allocateEmptyPlug(UErrorCode *status)
|
||||
{
|
||||
UPlugData *plug = NULL;
|
||||
UPlugData *plug = nullptr;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(pluginCount == UPLUG_PLUGIN_INITIAL_COUNT) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
plug = &pluginList[pluginCount++];
|
||||
|
@ -353,8 +353,8 @@ static UPlugData *uplug_allocateEmptyPlug(UErrorCode *status)
|
|||
plug->libName[0] = 0;
|
||||
plug->config[0]=0;
|
||||
plug->sym[0]=0;
|
||||
plug->lib=NULL;
|
||||
plug->entrypoint=NULL;
|
||||
plug->lib=nullptr;
|
||||
plug->entrypoint=nullptr;
|
||||
|
||||
|
||||
return plug;
|
||||
|
@ -364,16 +364,16 @@ static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *co
|
|||
UErrorCode *status) {
|
||||
UPlugData *plug = uplug_allocateEmptyPlug(status);
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(config!=NULL) {
|
||||
if(config!=nullptr) {
|
||||
uprv_strncpy(plug->config, config, UPLUG_NAME_MAX);
|
||||
} else {
|
||||
plug->config[0] = 0;
|
||||
}
|
||||
|
||||
if(symName!=NULL) {
|
||||
if(symName!=nullptr) {
|
||||
uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX);
|
||||
} else {
|
||||
plug->sym[0] = 0;
|
||||
|
@ -393,7 +393,7 @@ static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) {
|
|||
uplug_closeLibrary(plug->lib, &subStatus);
|
||||
#endif
|
||||
}
|
||||
plug->lib = NULL;
|
||||
plug->lib = nullptr;
|
||||
if(U_SUCCESS(*status) && U_FAILURE(subStatus)) {
|
||||
*status = subStatus;
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) {
|
|||
}
|
||||
|
||||
static void uplug_doUnloadPlug(UPlugData *plugToRemove, UErrorCode *status) {
|
||||
if(plugToRemove != NULL) {
|
||||
if(plugToRemove != nullptr) {
|
||||
uplug_unloadPlug(plugToRemove, status);
|
||||
uplug_deallocatePlug(plugToRemove, status);
|
||||
}
|
||||
|
@ -418,14 +418,14 @@ static void uplug_doUnloadPlug(UPlugData *plugToRemove, UErrorCode *status) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_removePlug(UPlugData *plug, UErrorCode *status) {
|
||||
UPlugData *cursor = NULL;
|
||||
UPlugData *plugToRemove = NULL;
|
||||
UPlugData *cursor = nullptr;
|
||||
UPlugData *plugToRemove = nullptr;
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
for(cursor=pluginList;cursor!=NULL;) {
|
||||
for(cursor=pluginList;cursor!=nullptr;) {
|
||||
if(cursor==plug) {
|
||||
plugToRemove = plug;
|
||||
cursor=NULL;
|
||||
cursor=nullptr;
|
||||
} else {
|
||||
cursor = uplug_nextPlug(cursor);
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ uplug_getLibraryName(UPlugData *data, UErrorCode *status) {
|
|||
#if U_ENABLE_DYLOAD
|
||||
return uplug_findLibrary(data->lib, status);
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ uplug_getConfiguration(UPlugData *data) {
|
|||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_getPlugInternal(int32_t n) {
|
||||
if(n <0 || n >= pluginCount) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
return &(pluginList[n]);
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ uplug_getPlugLoadStatus(UPlugData *plug) {
|
|||
*/
|
||||
static UPlugData* uplug_initPlugFromEntrypointAndLibrary(UPlugEntrypoint *entrypoint, const char *config, void *lib, const char *sym,
|
||||
UErrorCode *status) {
|
||||
UPlugData *plug = NULL;
|
||||
UPlugData *plug = nullptr;
|
||||
|
||||
plug = uplug_allocatePlug(entrypoint, config, lib, sym, status);
|
||||
|
||||
|
@ -538,13 +538,13 @@ static UPlugData* uplug_initPlugFromEntrypointAndLibrary(UPlugEntrypoint *entryp
|
|||
return plug;
|
||||
} else {
|
||||
uplug_deallocatePlug(plug, status);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status) {
|
||||
UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, NULL, NULL, status);
|
||||
UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, nullptr, nullptr, status);
|
||||
uplug_loadPlug(plug, status);
|
||||
return plug;
|
||||
}
|
||||
|
@ -555,25 +555,25 @@ static UPlugData*
|
|||
uplug_initErrorPlug(const char *libName, const char *sym, const char *config, const char *nameOrError, UErrorCode loadStatus, UErrorCode *status)
|
||||
{
|
||||
UPlugData *plug = uplug_allocateEmptyPlug(status);
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
if(U_FAILURE(*status)) return nullptr;
|
||||
|
||||
plug->pluginStatus = loadStatus;
|
||||
plug->awaitingLoad = false; /* Won't load. */
|
||||
plug->dontUnload = true; /* cannot unload. */
|
||||
|
||||
if(sym!=NULL) {
|
||||
if(sym!=nullptr) {
|
||||
uprv_strncpy(plug->sym, sym, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
if(libName!=NULL) {
|
||||
if(libName!=nullptr) {
|
||||
uprv_strncpy(plug->libName, libName, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
if(nameOrError!=NULL) {
|
||||
if(nameOrError!=nullptr) {
|
||||
uprv_strncpy(plug->name, nameOrError, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
if(config!=NULL) {
|
||||
if(config!=nullptr) {
|
||||
uprv_strncpy(plug->config, config, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
|
@ -585,39 +585,39 @@ uplug_initErrorPlug(const char *libName, const char *sym, const char *config, co
|
|||
*/
|
||||
static UPlugData*
|
||||
uplug_initPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
|
||||
void *lib = NULL;
|
||||
UPlugData *plug = NULL;
|
||||
if(U_FAILURE(*status)) { return NULL; }
|
||||
void *lib = nullptr;
|
||||
UPlugData *plug = nullptr;
|
||||
if(U_FAILURE(*status)) { return nullptr; }
|
||||
lib = uplug_openLibrary(libName, status);
|
||||
if(lib!=NULL && U_SUCCESS(*status)) {
|
||||
UPlugEntrypoint *entrypoint = NULL;
|
||||
if(lib!=nullptr && U_SUCCESS(*status)) {
|
||||
UPlugEntrypoint *entrypoint = nullptr;
|
||||
entrypoint = (UPlugEntrypoint*)uprv_dlsym_func(lib, sym, status);
|
||||
|
||||
if(entrypoint!=NULL&&U_SUCCESS(*status)) {
|
||||
if(entrypoint!=nullptr&&U_SUCCESS(*status)) {
|
||||
plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, lib, sym, status);
|
||||
if(plug!=NULL&&U_SUCCESS(*status)) {
|
||||
if(plug!=nullptr&&U_SUCCESS(*status)) {
|
||||
plug->lib = lib; /* plug takes ownership of library */
|
||||
lib = NULL; /* library is now owned by plugin. */
|
||||
lib = nullptr; /* library is now owned by plugin. */
|
||||
}
|
||||
} else {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
|
||||
plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==nullptr)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
|
||||
}
|
||||
if(lib!=NULL) { /* still need to close the lib */
|
||||
if(lib!=nullptr) { /* still need to close the lib */
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
uplug_closeLibrary(lib, &subStatus); /* don't care here */
|
||||
}
|
||||
} else {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
|
||||
plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==nullptr)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
|
||||
}
|
||||
return plug;
|
||||
}
|
||||
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
|
||||
UPlugData *plug = NULL;
|
||||
if(U_FAILURE(*status)) { return NULL; }
|
||||
UPlugData *plug = nullptr;
|
||||
if(U_FAILURE(*status)) { return nullptr; }
|
||||
plug = uplug_initPlugFromLibrary(libName, sym, config, status);
|
||||
uplug_loadPlug(plug, status);
|
||||
|
||||
|
@ -712,7 +712,7 @@ uplug_getPluginFile() {
|
|||
#if U_ENABLE_DYLOAD && !UCONFIG_NO_FILE_IO
|
||||
return plugin_file;
|
||||
#else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ uplug_init(UErrorCode *status) {
|
|||
const char *env = getenv("ICU_PLUGINS");
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
if(env != NULL) {
|
||||
if(env != nullptr) {
|
||||
plugin_dir.append(env, -1, *status);
|
||||
}
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
@ -791,7 +791,7 @@ uplug_init(UErrorCode *status) {
|
|||
#ifdef __MVS__
|
||||
if (iscics()) /* 12 Nov 2011 JAM */
|
||||
{
|
||||
f = NULL;
|
||||
f = nullptr;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -799,9 +799,9 @@ uplug_init(UErrorCode *status) {
|
|||
f = fopen(pluginFile.data(), "r");
|
||||
}
|
||||
|
||||
if(f != NULL) {
|
||||
if(f != nullptr) {
|
||||
char linebuf[1024];
|
||||
char *p, *libName=NULL, *symName=NULL, *config=NULL;
|
||||
char *p, *libName=nullptr, *symName=nullptr, *config=nullptr;
|
||||
int32_t line = 0;
|
||||
|
||||
|
||||
|
@ -843,7 +843,7 @@ uplug_init(UErrorCode *status) {
|
|||
}
|
||||
|
||||
/* chop whitespace at the end of the config */
|
||||
if(config!=NULL&&*config!=0) {
|
||||
if(config!=nullptr&&*config!=0) {
|
||||
p = config+strlen(config);
|
||||
while(p>config&&isspace((int)*(--p))) {
|
||||
*p=0;
|
||||
|
|
|
@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN
|
|||
|
||||
class LoadedNormalizer2Impl : public Normalizer2Impl {
|
||||
public:
|
||||
LoadedNormalizer2Impl() : memory(NULL), ownedTrie(NULL) {}
|
||||
LoadedNormalizer2Impl() : memory(nullptr), ownedTrie(nullptr) {}
|
||||
virtual ~LoadedNormalizer2Impl();
|
||||
|
||||
void load(const char *packageName, const char *name, UErrorCode &errorCode);
|
||||
|
@ -93,7 +93,7 @@ LoadedNormalizer2Impl::load(const char *packageName, const char *name, UErrorCod
|
|||
int32_t offset=inIndexes[IX_NORM_TRIE_OFFSET];
|
||||
int32_t nextOffset=inIndexes[IX_EXTRA_DATA_OFFSET];
|
||||
ownedTrie=ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, UCPTRIE_VALUE_BITS_16,
|
||||
inBytes+offset, nextOffset-offset, NULL,
|
||||
inBytes+offset, nextOffset-offset, nullptr,
|
||||
&errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
|
@ -117,12 +117,12 @@ Norm2AllModes::createInstance(const char *packageName,
|
|||
const char *name,
|
||||
UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
LoadedNormalizer2Impl *impl=new LoadedNormalizer2Impl;
|
||||
if(impl==NULL) {
|
||||
if(impl==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
impl->load(packageName, name, errorCode);
|
||||
return createInstance(impl, errorCode);
|
||||
|
@ -143,19 +143,19 @@ static icu::UInitOnce nfkcInitOnce {};
|
|||
static Norm2AllModes *nfkc_cfSingleton;
|
||||
static icu::UInitOnce nfkc_cfInitOnce {};
|
||||
|
||||
static UHashtable *cache=NULL;
|
||||
static UHashtable *cache=nullptr;
|
||||
|
||||
// UInitOnce singleton initialization function
|
||||
static void U_CALLCONV initSingletons(const char *what, UErrorCode &errorCode) {
|
||||
#if !NORM2_HARDCODE_NFC_DATA
|
||||
if (uprv_strcmp(what, "nfc") == 0) {
|
||||
nfcSingleton = Norm2AllModes::createInstance(NULL, "nfc", errorCode);
|
||||
nfcSingleton = Norm2AllModes::createInstance(nullptr, "nfc", errorCode);
|
||||
} else
|
||||
#endif
|
||||
if (uprv_strcmp(what, "nfkc") == 0) {
|
||||
nfkcSingleton = Norm2AllModes::createInstance(NULL, "nfkc", errorCode);
|
||||
nfkcSingleton = Norm2AllModes::createInstance(nullptr, "nfkc", errorCode);
|
||||
} else if (uprv_strcmp(what, "nfkc_cf") == 0) {
|
||||
nfkc_cfSingleton = Norm2AllModes::createInstance(NULL, "nfkc_cf", errorCode);
|
||||
nfkc_cfSingleton = Norm2AllModes::createInstance(nullptr, "nfkc_cf", errorCode);
|
||||
} else {
|
||||
UPRV_UNREACHABLE_EXIT; // Unknown singleton
|
||||
}
|
||||
|
@ -171,20 +171,20 @@ static void U_CALLCONV deleteNorm2AllModes(void *allModes) {
|
|||
static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup() {
|
||||
#if !NORM2_HARDCODE_NFC_DATA
|
||||
delete nfcSingleton;
|
||||
nfcSingleton = NULL;
|
||||
nfcSingleton = nullptr;
|
||||
nfcInitOnce.reset();
|
||||
#endif
|
||||
|
||||
delete nfkcSingleton;
|
||||
nfkcSingleton = NULL;
|
||||
nfkcSingleton = nullptr;
|
||||
nfkcInitOnce.reset();
|
||||
|
||||
delete nfkc_cfSingleton;
|
||||
nfkc_cfSingleton = NULL;
|
||||
nfkc_cfSingleton = nullptr;
|
||||
nfkc_cfInitOnce.reset();
|
||||
|
||||
uhash_close(cache);
|
||||
cache=NULL;
|
||||
cache=nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ U_CDECL_END
|
|||
#if !NORM2_HARDCODE_NFC_DATA
|
||||
const Norm2AllModes *
|
||||
Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
if(U_FAILURE(errorCode)) { return nullptr; }
|
||||
umtx_initOnce(nfcInitOnce, &initSingletons, "nfc", errorCode);
|
||||
return nfcSingleton;
|
||||
}
|
||||
|
@ -201,14 +201,14 @@ Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
|
|||
|
||||
const Norm2AllModes *
|
||||
Norm2AllModes::getNFKCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
if(U_FAILURE(errorCode)) { return nullptr; }
|
||||
umtx_initOnce(nfkcInitOnce, &initSingletons, "nfkc", errorCode);
|
||||
return nfkcSingleton;
|
||||
}
|
||||
|
||||
const Norm2AllModes *
|
||||
Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
if(U_FAILURE(errorCode)) { return nullptr; }
|
||||
umtx_initOnce(nfkc_cfInitOnce, &initSingletons, "nfkc_cf", errorCode);
|
||||
return nfkc_cfSingleton;
|
||||
}
|
||||
|
@ -217,48 +217,48 @@ Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) {
|
|||
const Normalizer2 *
|
||||
Normalizer2::getNFCInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->comp : NULL;
|
||||
return allModes!=nullptr ? &allModes->comp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *
|
||||
Normalizer2::getNFDInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->decomp : NULL;
|
||||
return allModes!=nullptr ? &allModes->decomp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->fcd : NULL;
|
||||
return allModes!=nullptr ? &allModes->fcd : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->fcc : NULL;
|
||||
return allModes!=nullptr ? &allModes->fcc : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2Impl *
|
||||
Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? allModes->impl : NULL;
|
||||
return allModes!=nullptr ? allModes->impl : nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
const Normalizer2 *
|
||||
Normalizer2::getNFKCInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->comp : NULL;
|
||||
return allModes!=nullptr ? &allModes->comp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *
|
||||
Normalizer2::getNFKDInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->decomp : NULL;
|
||||
return allModes!=nullptr ? &allModes->decomp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *
|
||||
Normalizer2::getNFKCCasefoldInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFKC_CFInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->comp : NULL;
|
||||
return allModes!=nullptr ? &allModes->comp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *
|
||||
|
@ -267,14 +267,14 @@ Normalizer2::getInstance(const char *packageName,
|
|||
UNormalization2Mode mode,
|
||||
UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if(name==NULL || *name==0) {
|
||||
if(name==nullptr || *name==0) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
const Norm2AllModes *allModes=NULL;
|
||||
if(packageName==NULL) {
|
||||
const Norm2AllModes *allModes=nullptr;
|
||||
if(packageName==nullptr) {
|
||||
if(0==uprv_strcmp(name, "nfc")) {
|
||||
allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
} else if(0==uprv_strcmp(name, "nfkc")) {
|
||||
|
@ -283,34 +283,34 @@ Normalizer2::getInstance(const char *packageName,
|
|||
allModes=Norm2AllModes::getNFKC_CFInstance(errorCode);
|
||||
}
|
||||
}
|
||||
if(allModes==NULL && U_SUCCESS(errorCode)) {
|
||||
if(allModes==nullptr && U_SUCCESS(errorCode)) {
|
||||
{
|
||||
Mutex lock;
|
||||
if(cache!=NULL) {
|
||||
if(cache!=nullptr) {
|
||||
allModes=(Norm2AllModes *)uhash_get(cache, name);
|
||||
}
|
||||
}
|
||||
if(allModes==NULL) {
|
||||
if(allModes==nullptr) {
|
||||
ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
|
||||
LocalPointer<Norm2AllModes> localAllModes(
|
||||
Norm2AllModes::createInstance(packageName, name, errorCode));
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
Mutex lock;
|
||||
if(cache==NULL) {
|
||||
cache=uhash_open(uhash_hashChars, uhash_compareChars, NULL, &errorCode);
|
||||
if(cache==nullptr) {
|
||||
cache=uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uhash_setKeyDeleter(cache, uprv_free);
|
||||
uhash_setValueDeleter(cache, deleteNorm2AllModes);
|
||||
}
|
||||
void *temp=uhash_get(cache, name);
|
||||
if(temp==NULL) {
|
||||
if(temp==nullptr) {
|
||||
int32_t keyLength= static_cast<int32_t>(uprv_strlen(name)+1);
|
||||
char *nameCopy=(char *)uprv_malloc(keyLength);
|
||||
if(nameCopy==NULL) {
|
||||
if(nameCopy==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(nameCopy, name, keyLength);
|
||||
allModes=localAllModes.getAlias();
|
||||
|
@ -322,7 +322,7 @@ Normalizer2::getInstance(const char *packageName,
|
|||
}
|
||||
}
|
||||
}
|
||||
if(allModes!=NULL && U_SUCCESS(errorCode)) {
|
||||
if(allModes!=nullptr && U_SUCCESS(errorCode)) {
|
||||
switch(mode) {
|
||||
case UNORM2_COMPOSE:
|
||||
return &allModes->comp;
|
||||
|
@ -336,13 +336,13 @@ Normalizer2::getInstance(const char *packageName,
|
|||
break; // do nothing
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *
|
||||
Normalizer2Factory::getInstance(UNormalizationMode mode, UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
switch(mode) {
|
||||
case UNORM_NFD:
|
||||
|
@ -363,13 +363,13 @@ Normalizer2Factory::getInstance(UNormalizationMode mode, UErrorCode &errorCode)
|
|||
const Normalizer2Impl *
|
||||
Normalizer2Factory::getNFKCImpl(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
|
||||
return allModes!=NULL ? allModes->impl : NULL;
|
||||
return allModes!=nullptr ? allModes->impl : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2Impl *
|
||||
Normalizer2Factory::getNFKC_CFImpl(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFKC_CFInstance(errorCode);
|
||||
return allModes!=NULL ? allModes->impl : NULL;
|
||||
return allModes!=nullptr ? allModes->impl : nullptr;
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
static icu::Locale* availableLocaleList = NULL;
|
||||
static icu::Locale* availableLocaleList = nullptr;
|
||||
static int32_t availableLocaleListCount;
|
||||
static icu::UInitOnce gInitOnceLocale {};
|
||||
|
||||
|
@ -49,7 +49,7 @@ static UBool U_CALLCONV locale_available_cleanup(void)
|
|||
|
||||
if (availableLocaleList) {
|
||||
delete []availableLocaleList;
|
||||
availableLocaleList = NULL;
|
||||
availableLocaleList = nullptr;
|
||||
}
|
||||
availableLocaleListCount = 0;
|
||||
gInitOnceLocale.reset();
|
||||
|
@ -71,7 +71,7 @@ void U_CALLCONV locale_available_init() {
|
|||
if(availableLocaleListCount) {
|
||||
availableLocaleList = new Locale[availableLocaleListCount];
|
||||
}
|
||||
if (availableLocaleList == NULL) {
|
||||
if (availableLocaleList == nullptr) {
|
||||
availableLocaleListCount= 0;
|
||||
}
|
||||
for (int32_t locCount=availableLocaleListCount-1; locCount>=0; --locCount) {
|
||||
|
@ -212,7 +212,7 @@ static UBool U_CALLCONV uloc_cleanup(void) {
|
|||
static void U_CALLCONV loadInstalledLocales(UErrorCode& status) {
|
||||
ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);
|
||||
|
||||
icu::LocalUResourceBundlePointer rb(ures_openDirect(NULL, "res_index", &status));
|
||||
icu::LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "res_index", &status));
|
||||
AvailableLocalesSink sink;
|
||||
ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ Locale LocaleBased::getLocale(ULocDataLocaleType type, UErrorCode& status) const
|
|||
|
||||
const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
|
@ -32,7 +32,7 @@ const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status
|
|||
return actual;
|
||||
default:
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -304,10 +304,10 @@ _getStringOrCopyKey(const char *path, const char *locale,
|
|||
const char *substitute,
|
||||
UChar *dest, int32_t destCapacity,
|
||||
UErrorCode *pErrorCode) {
|
||||
const UChar *s = NULL;
|
||||
const UChar *s = nullptr;
|
||||
int32_t length = 0;
|
||||
|
||||
if(itemKey==NULL) {
|
||||
if(itemKey==nullptr) {
|
||||
/* top-level item: normal resource bundle access */
|
||||
icu::LocalUResourceBundlePointer rb(ures_open(path, locale, pErrorCode));
|
||||
|
||||
|
@ -318,7 +318,7 @@ _getStringOrCopyKey(const char *path, const char *locale,
|
|||
} else {
|
||||
bool isLanguageCode = (uprv_strncmp(tableKey, _kLanguages, 9) == 0);
|
||||
/* Language code should not be a number. If it is, set the error code. */
|
||||
if (isLanguageCode && uprv_strtol(itemKey, NULL, 10)) {
|
||||
if (isLanguageCode && uprv_strtol(itemKey, nullptr, 10)) {
|
||||
*pErrorCode = U_MISSING_RESOURCE_ERROR;
|
||||
} else {
|
||||
/* second-level item, use special fallback */
|
||||
|
@ -344,7 +344,7 @@ _getStringOrCopyKey(const char *path, const char *locale,
|
|||
|
||||
if(U_SUCCESS(*pErrorCode)) {
|
||||
int32_t copyLength=uprv_min(length, destCapacity);
|
||||
if(copyLength>0 && s != NULL) {
|
||||
if(copyLength>0 && s != nullptr) {
|
||||
u_memcpy(dest, s, copyLength);
|
||||
}
|
||||
} else {
|
||||
|
@ -369,14 +369,14 @@ _getDisplayNameForComponent(const char *locale,
|
|||
char localeBuffer[ULOC_FULLNAME_CAPACITY*4];
|
||||
int32_t length;
|
||||
UErrorCode localStatus;
|
||||
const char* root = NULL;
|
||||
const char* root = nullptr;
|
||||
|
||||
/* argument checking */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ _getDisplayNameForComponent(const char *locale,
|
|||
root = tag == _kCountries ? U_ICUDATA_REGION : U_ICUDATA_LANG;
|
||||
|
||||
return _getStringOrCopyKey(root, displayLocale,
|
||||
tag, NULL, localeBuffer,
|
||||
tag, nullptr, localeBuffer,
|
||||
localeBuffer,
|
||||
dest, destCapacity,
|
||||
pErrorCode);
|
||||
|
@ -522,11 +522,11 @@ uloc_getDisplayName(const char *locale,
|
|||
|
||||
int32_t langi = 0; /* index of the language substitution (0 or 1), virtually always 0 */
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ uloc_getDisplayName(const char *locale,
|
|||
icu::LocalUResourceBundlePointer locbundle(
|
||||
ures_open(U_ICUDATA_LANG, displayLocale, &status));
|
||||
icu::LocalUResourceBundlePointer dspbundle(
|
||||
ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, NULL, &status));
|
||||
ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, nullptr, &status));
|
||||
|
||||
separator=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kSeparator, &sepLen, &status);
|
||||
pattern=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kPattern, &patLen, &status);
|
||||
|
@ -559,7 +559,7 @@ uloc_getDisplayName(const char *locale,
|
|||
{
|
||||
UChar *p0=u_strstr(separator, sub0);
|
||||
UChar *p1=u_strstr(separator, sub1);
|
||||
if (p0==NULL || p1==NULL || p1<p0) {
|
||||
if (p0==nullptr || p1==nullptr || p1<p0) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ uloc_getDisplayName(const char *locale,
|
|||
} else { /* non-default pattern */
|
||||
UChar *p0=u_strstr(pattern, sub0);
|
||||
UChar *p1=u_strstr(pattern, sub1);
|
||||
if (p0==NULL || p1==NULL) {
|
||||
if (p0==nullptr || p1==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ uloc_getDisplayName(const char *locale,
|
|||
int32_t t=sub0Pos; sub0Pos=sub1Pos; sub1Pos=t;
|
||||
langi=1;
|
||||
}
|
||||
if (u_strchr(pattern, 0xFF08) != NULL) {
|
||||
if (u_strchr(pattern, 0xFF08) != nullptr) {
|
||||
formatOpenParen = 0xFF08; // fullwidth (
|
||||
formatReplaceOpenParen = 0xFF3B; // fullwidth [
|
||||
formatCloseParen = 0xFF09; // fullwidth )
|
||||
|
@ -665,7 +665,7 @@ uloc_getDisplayName(const char *locale,
|
|||
U_FALLTHROUGH;
|
||||
default: {
|
||||
const char* kw=uenum_next(kenum.getAlias(), &len, pErrorCode);
|
||||
if (kw == NULL) {
|
||||
if (kw == nullptr) {
|
||||
len=0; /* mark that we didn't add a component */
|
||||
subdone=true;
|
||||
} else {
|
||||
|
@ -793,19 +793,19 @@ uloc_getDisplayKeyword(const char* keyword,
|
|||
UErrorCode* status){
|
||||
|
||||
/* argument checking */
|
||||
if(status==NULL || U_FAILURE(*status)) {
|
||||
if(status==nullptr || U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
|
||||
*status=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* pass itemKey=NULL to look for a top-level item */
|
||||
/* pass itemKey=nullptr to look for a top-level item */
|
||||
return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale,
|
||||
_kKeys, NULL,
|
||||
_kKeys, nullptr,
|
||||
keyword,
|
||||
keyword,
|
||||
dest, destCapacity,
|
||||
|
@ -826,11 +826,11 @@ uloc_getDisplayKeywordValue( const char* locale,
|
|||
|
||||
|
||||
/* argument checking */
|
||||
if(status==NULL || U_FAILURE(*status)) {
|
||||
if(status==nullptr || U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
|
||||
if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
|
||||
*status=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -849,14 +849,14 @@ uloc_getDisplayKeywordValue( const char* locale,
|
|||
if(uprv_stricmp(keyword, _kCurrency)==0){
|
||||
|
||||
int32_t dispNameLen = 0;
|
||||
const UChar *dispName = NULL;
|
||||
const UChar *dispName = nullptr;
|
||||
|
||||
icu::LocalUResourceBundlePointer bundle(
|
||||
ures_open(U_ICUDATA_CURR, displayLocale, status));
|
||||
icu::LocalUResourceBundlePointer currencies(
|
||||
ures_getByKey(bundle.getAlias(), _kCurrencies, NULL, status));
|
||||
ures_getByKey(bundle.getAlias(), _kCurrencies, nullptr, status));
|
||||
icu::LocalUResourceBundlePointer currency(
|
||||
ures_getByKeyWithFallback(currencies.getAlias(), keywordValue.data(), NULL, status));
|
||||
ures_getByKeyWithFallback(currencies.getAlias(), keywordValue.data(), nullptr, status));
|
||||
|
||||
dispName = ures_getStringByIndex(currency.getAlias(), UCURRENCY_DISPLAY_NAME_INDEX, &dispNameLen, status);
|
||||
|
||||
|
@ -869,8 +869,8 @@ uloc_getDisplayKeywordValue( const char* locale,
|
|||
}
|
||||
}
|
||||
|
||||
/* now copy the dispName over if not NULL */
|
||||
if(dispName != NULL){
|
||||
/* now copy the dispName over if not nullptr */
|
||||
if(dispName != nullptr){
|
||||
if(dispNameLen <= destCapacity){
|
||||
u_memcpy(dest, dispName, dispNameLen);
|
||||
return u_terminateUChars(dest, destCapacity, dispNameLen, status);
|
||||
|
|
|
@ -40,7 +40,7 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) {
|
|||
char *p = buffer;
|
||||
const char* e = buffer + buflen - 1;
|
||||
|
||||
if (buffer == NULL || buflen < 1) {
|
||||
if (buffer == nullptr || buflen < 1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -86,16 +86,16 @@ public:
|
|||
|
||||
inline UnicodeString &
|
||||
ICUDataTable::get(const char* tableKey, const char* itemKey, UnicodeString& result) const {
|
||||
return get(tableKey, NULL, itemKey, result);
|
||||
return get(tableKey, nullptr, itemKey, result);
|
||||
}
|
||||
|
||||
inline UnicodeString &
|
||||
ICUDataTable::getNoFallback(const char* tableKey, const char* itemKey, UnicodeString& result) const {
|
||||
return getNoFallback(tableKey, NULL, itemKey, result);
|
||||
return getNoFallback(tableKey, nullptr, itemKey, result);
|
||||
}
|
||||
|
||||
ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
|
||||
: path(NULL), locale(Locale::getRoot())
|
||||
: path(nullptr), locale(Locale::getRoot())
|
||||
{
|
||||
if (path) {
|
||||
int32_t len = static_cast<int32_t>(uprv_strlen(path));
|
||||
|
@ -110,7 +110,7 @@ ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
|
|||
ICUDataTable::~ICUDataTable() {
|
||||
if (path) {
|
||||
uprv_free((void*) path);
|
||||
path = NULL;
|
||||
path = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
|
|||
, langData(U_ICUDATA_LANG, locale)
|
||||
, regionData(U_ICUDATA_REGION, locale)
|
||||
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
|
||||
, capitalizationBrkIter(NULL)
|
||||
, capitalizationBrkIter(nullptr)
|
||||
, nameLength(UDISPCTX_LENGTH_FULL)
|
||||
, substitute(UDISPCTX_SUBSTITUTE)
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
|
|||
, langData(U_ICUDATA_LANG, locale)
|
||||
, regionData(U_ICUDATA_REGION, locale)
|
||||
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
|
||||
, capitalizationBrkIter(NULL)
|
||||
, capitalizationBrkIter(nullptr)
|
||||
, nameLength(UDISPCTX_LENGTH_FULL)
|
||||
, substitute(UDISPCTX_SUBSTITUTE)
|
||||
{
|
||||
|
@ -492,7 +492,7 @@ LocaleDisplayNamesImpl::initialize(void) {
|
|||
// Also check whether we will need a break iterator (depends on the data)
|
||||
UBool needBrkIter = false;
|
||||
if (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE) {
|
||||
LocalUResourceBundlePointer resource(ures_open(NULL, locale.getName(), &status));
|
||||
LocalUResourceBundlePointer resource(ures_open(nullptr, locale.getName(), &status));
|
||||
if (U_FAILURE(status)) { return; }
|
||||
CapitalizationContextSink sink(*this);
|
||||
ures_getAllItemsWithFallback(resource.getAlias(), "contextTransforms", sink, status);
|
||||
|
@ -510,7 +510,7 @@ LocaleDisplayNamesImpl::initialize(void) {
|
|||
capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status);
|
||||
if (U_FAILURE(status)) {
|
||||
delete capitalizationBrkIter;
|
||||
capitalizationBrkIter = NULL;
|
||||
capitalizationBrkIter = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -554,7 +554,7 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
|
|||
UnicodeString& result) const {
|
||||
#if !UCONFIG_NO_BREAK_ITERATION
|
||||
// check to see whether we need to titlecase result
|
||||
if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= NULL &&
|
||||
if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= nullptr &&
|
||||
( capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || fCapitalization[usage] ) ) {
|
||||
// note fCapitalization[usage] won't be set unless capitalizationContext is UI_LIST_OR_MENU or STANDALONE
|
||||
static UMutex capitalizationBrkIterLock;
|
||||
|
@ -660,7 +660,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
|
|||
UnicodeString temp2;
|
||||
char value[ULOC_KEYWORD_AND_VALUES_CAPACITY]; // sigh, no ULOC_VALUE_CAPACITY
|
||||
const char* key;
|
||||
while ((key = e->next((int32_t *)0, status)) != NULL) {
|
||||
while ((key = e->next((int32_t *)0, status)) != nullptr) {
|
||||
value[0] = 0;
|
||||
loc.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
|
||||
if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
|
||||
|
@ -702,7 +702,7 @@ LocaleDisplayNamesImpl::appendWithSep(UnicodeString& buffer, const UnicodeString
|
|||
} else {
|
||||
const UnicodeString *values[2] = { &buffer, &src };
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
separatorFormat.formatAndReplace(values, 2, buffer, NULL, 0, status);
|
||||
separatorFormat.formatAndReplace(values, 2, buffer, nullptr, 0, status);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ LocaleDisplayNamesImpl::localeIdName(const char* localeId,
|
|||
}
|
||||
}
|
||||
langData.getNoFallback("Languages", localeId, result);
|
||||
if (result.isBogus() && uprv_strchr(localeId, '_') == NULL) {
|
||||
if (result.isBogus() && uprv_strchr(localeId, '_') == nullptr) {
|
||||
// Canonicalize lang and try again, ICU-20870
|
||||
// (only for language codes without script or region)
|
||||
Locale canonLocale = Locale::createCanonical(localeId);
|
||||
|
@ -747,7 +747,7 @@ LocaleDisplayNamesImpl::localeIdName(const char* localeId,
|
|||
UnicodeString&
|
||||
LocaleDisplayNamesImpl::languageDisplayName(const char* lang,
|
||||
UnicodeString& result) const {
|
||||
if (uprv_strcmp("root", lang) == 0 || uprv_strchr(lang, '_') != NULL) {
|
||||
if (uprv_strcmp("root", lang) == 0 || uprv_strchr(lang, '_') != nullptr) {
|
||||
return result = UnicodeString(lang, -1, US_INV);
|
||||
}
|
||||
if (nameLength == UDISPCTX_LENGTH_SHORT) {
|
||||
|
@ -922,7 +922,7 @@ LocaleDisplayNames::createInstance(const Locale& locale,
|
|||
LocaleDisplayNames*
|
||||
LocaleDisplayNames::createInstance(const Locale& locale,
|
||||
UDisplayContext *contexts, int32_t length) {
|
||||
if (contexts == NULL) {
|
||||
if (contexts == nullptr) {
|
||||
length = 0;
|
||||
}
|
||||
return new LocaleDisplayNamesImpl(locale, contexts, length);
|
||||
|
@ -941,7 +941,7 @@ uldn_open(const char * locale,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (locale == NULL) {
|
||||
if (locale == nullptr) {
|
||||
locale = uloc_getDefault();
|
||||
}
|
||||
return (ULocaleDisplayNames *)LocaleDisplayNames::createInstance(Locale(locale), dialectHandling);
|
||||
|
@ -954,7 +954,7 @@ uldn_openForContext(const char * locale,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (locale == NULL) {
|
||||
if (locale == nullptr) {
|
||||
locale = uloc_getDefault();
|
||||
}
|
||||
return (ULocaleDisplayNames *)LocaleDisplayNames::createInstance(Locale(locale), contexts, length);
|
||||
|
@ -971,7 +971,7 @@ uldn_getLocale(const ULocaleDisplayNames *ldn) {
|
|||
if (ldn) {
|
||||
return ((const LocaleDisplayNames *)ldn)->getLocale().getName();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI UDialectHandling U_EXPORT2
|
||||
|
@ -1001,7 +1001,7 @@ uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || locale == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
|
||||
if (ldn == nullptr || locale == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || lang == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
|
||||
if (ldn == nullptr || lang == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1041,7 +1041,7 @@ uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || script == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
|
||||
if (ldn == nullptr || script == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1068,7 +1068,7 @@ uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || region == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
|
||||
if (ldn == nullptr || region == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || variant == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
|
||||
if (ldn == nullptr || variant == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || key == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
|
||||
if (ldn == nullptr || key == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (ldn == NULL || key == NULL || value == NULL || (result == NULL && maxResultSize > 0)
|
||||
if (ldn == nullptr || key == nullptr || value == nullptr || (result == nullptr && maxResultSize > 0)
|
||||
|| maxResultSize < 0) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
|
|
@ -63,13 +63,13 @@ U_CDECL_END
|
|||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
static Locale *gLocaleCache = NULL;
|
||||
static Locale *gLocaleCache = nullptr;
|
||||
static UInitOnce gLocaleCacheInitOnce {};
|
||||
|
||||
// gDefaultLocaleMutex protects all access to gDefaultLocalesHashT and gDefaultLocale.
|
||||
static UMutex gDefaultLocaleMutex;
|
||||
static UHashtable *gDefaultLocalesHashT = NULL;
|
||||
static Locale *gDefaultLocale = NULL;
|
||||
static UHashtable *gDefaultLocalesHashT = nullptr;
|
||||
static Locale *gDefaultLocale = nullptr;
|
||||
|
||||
/**
|
||||
* \def ULOC_STRING_LIMIT
|
||||
|
@ -120,14 +120,14 @@ static UBool U_CALLCONV locale_cleanup(void)
|
|||
U_NAMESPACE_USE
|
||||
|
||||
delete [] gLocaleCache;
|
||||
gLocaleCache = NULL;
|
||||
gLocaleCache = nullptr;
|
||||
gLocaleCacheInitOnce.reset();
|
||||
|
||||
if (gDefaultLocalesHashT) {
|
||||
uhash_close(gDefaultLocalesHashT); // Automatically deletes all elements, using deleter func.
|
||||
gDefaultLocalesHashT = NULL;
|
||||
gDefaultLocalesHashT = nullptr;
|
||||
}
|
||||
gDefaultLocale = NULL;
|
||||
gDefaultLocale = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -135,9 +135,9 @@ static UBool U_CALLCONV locale_cleanup(void)
|
|||
static void U_CALLCONV locale_init(UErrorCode &status) {
|
||||
U_NAMESPACE_USE
|
||||
|
||||
U_ASSERT(gLocaleCache == NULL);
|
||||
U_ASSERT(gLocaleCache == nullptr);
|
||||
gLocaleCache = new Locale[(int)eMAX_LOCALES];
|
||||
if (gLocaleCache == NULL) {
|
||||
if (gLocaleCache == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -173,11 +173,11 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
|
|||
|
||||
UBool canonicalize = false;
|
||||
|
||||
// If given a NULL string for the locale id, grab the default
|
||||
// If given a nullptr string for the locale id, grab the default
|
||||
// name from the system.
|
||||
// (Different from most other locale APIs, where a null name means use
|
||||
// the current ICU default locale.)
|
||||
if (id == NULL) {
|
||||
if (id == nullptr) {
|
||||
id = uprv_getDefaultLocaleID(); // This function not thread safe? TODO: verify.
|
||||
canonicalize = true; // always canonicalize host ID
|
||||
}
|
||||
|
@ -196,8 +196,8 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
|
|||
return gDefaultLocale;
|
||||
}
|
||||
|
||||
if (gDefaultLocalesHashT == NULL) {
|
||||
gDefaultLocalesHashT = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status);
|
||||
if (gDefaultLocalesHashT == nullptr) {
|
||||
gDefaultLocalesHashT = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
return gDefaultLocale;
|
||||
}
|
||||
|
@ -206,9 +206,9 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
|
|||
}
|
||||
|
||||
Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf.data());
|
||||
if (newDefault == NULL) {
|
||||
if (newDefault == nullptr) {
|
||||
newDefault = new Locale(Locale::eBOGUS);
|
||||
if (newDefault == NULL) {
|
||||
if (newDefault == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return gDefaultLocale;
|
||||
}
|
||||
|
@ -257,19 +257,19 @@ Locale::~Locale()
|
|||
if ((baseName != fullName) && (baseName != fullNameBuffer)) {
|
||||
uprv_free(baseName);
|
||||
}
|
||||
baseName = NULL;
|
||||
baseName = nullptr;
|
||||
/*if fullName is on the heap, we free it*/
|
||||
if (fullName != fullNameBuffer)
|
||||
{
|
||||
uprv_free(fullName);
|
||||
fullName = NULL;
|
||||
fullName = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Locale::Locale()
|
||||
: UObject(), fullName(fullNameBuffer), baseName(NULL)
|
||||
: UObject(), fullName(fullNameBuffer), baseName(nullptr)
|
||||
{
|
||||
init(NULL, false);
|
||||
init(nullptr, false);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -278,7 +278,7 @@ Locale::Locale()
|
|||
* the default locale.)
|
||||
*/
|
||||
Locale::Locale(Locale::ELocaleType)
|
||||
: UObject(), fullName(fullNameBuffer), baseName(NULL)
|
||||
: UObject(), fullName(fullNameBuffer), baseName(nullptr)
|
||||
{
|
||||
setToBogus();
|
||||
}
|
||||
|
@ -288,11 +288,11 @@ Locale::Locale( const char * newLanguage,
|
|||
const char * newCountry,
|
||||
const char * newVariant,
|
||||
const char * newKeywords)
|
||||
: UObject(), fullName(fullNameBuffer), baseName(NULL)
|
||||
: UObject(), fullName(fullNameBuffer), baseName(nullptr)
|
||||
{
|
||||
if( (newLanguage==NULL) && (newCountry == NULL) && (newVariant == NULL) )
|
||||
if( (newLanguage==nullptr) && (newCountry == nullptr) && (newVariant == nullptr) )
|
||||
{
|
||||
init(NULL, false); /* shortcut */
|
||||
init(nullptr, false); /* shortcut */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ Locale::Locale( const char * newLanguage,
|
|||
// Check the sizes of the input strings.
|
||||
|
||||
// Language
|
||||
if ( newLanguage != NULL )
|
||||
if ( newLanguage != nullptr )
|
||||
{
|
||||
lsize = (int32_t)uprv_strlen(newLanguage);
|
||||
if ( lsize < 0 || lsize > ULOC_STRING_LIMIT ) { // int32 wrap
|
||||
|
@ -317,7 +317,7 @@ Locale::Locale( const char * newLanguage,
|
|||
CharString togo(newLanguage, lsize, status); // start with newLanguage
|
||||
|
||||
// _Country
|
||||
if ( newCountry != NULL )
|
||||
if ( newCountry != nullptr )
|
||||
{
|
||||
csize = (int32_t)uprv_strlen(newCountry);
|
||||
if ( csize < 0 || csize > ULOC_STRING_LIMIT ) { // int32 wrap
|
||||
|
@ -327,7 +327,7 @@ Locale::Locale( const char * newLanguage,
|
|||
}
|
||||
|
||||
// _Variant
|
||||
if ( newVariant != NULL )
|
||||
if ( newVariant != nullptr )
|
||||
{
|
||||
// remove leading _'s
|
||||
while(newVariant[0] == SEP_CHAR)
|
||||
|
@ -347,7 +347,7 @@ Locale::Locale( const char * newLanguage,
|
|||
}
|
||||
}
|
||||
|
||||
if ( newKeywords != NULL)
|
||||
if ( newKeywords != nullptr)
|
||||
{
|
||||
ksize = (int32_t)uprv_strlen(newKeywords);
|
||||
if ( ksize < 0 || ksize > ULOC_STRING_LIMIT ) {
|
||||
|
@ -402,7 +402,7 @@ Locale::Locale( const char * newLanguage,
|
|||
}
|
||||
|
||||
Locale::Locale(const Locale &other)
|
||||
: UObject(other), fullName(fullNameBuffer), baseName(NULL)
|
||||
: UObject(other), fullName(fullNameBuffer), baseName(nullptr)
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
|
@ -1513,7 +1513,7 @@ AliasReplacer::replaceTransformedExtensions(
|
|||
CharString& transformedExtensions, CharString& output, UErrorCode& status)
|
||||
{
|
||||
// The content of the transformedExtensions will be modified in this
|
||||
// function to NULL-terminating (tkey-tvalue) pairs.
|
||||
// function to NUL-terminating (tkey-tvalue) pairs.
|
||||
if (U_FAILURE(status)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1548,7 +1548,7 @@ AliasReplacer::replaceTransformedExtensions(
|
|||
}
|
||||
const char* nextTKey = ultag_getTKeyStart(tvalue);
|
||||
if (nextTKey != nullptr) {
|
||||
*((char*)(nextTKey-1)) = '\0'; // NULL terminate tvalue
|
||||
*((char*)(nextTKey-1)) = '\0'; // NUL terminate tvalue
|
||||
}
|
||||
tfields.insertElementAt((void*)tkey, tfields.size(), status);
|
||||
if (U_FAILURE(status)) {
|
||||
|
@ -1570,7 +1570,7 @@ AliasReplacer::replaceTransformedExtensions(
|
|||
return false;
|
||||
}
|
||||
// Split the "tkey-tvalue" pair string so that we can canonicalize the tvalue.
|
||||
*((char*)tvalue++) = '\0'; // NULL terminate tkey
|
||||
*((char*)tvalue++) = '\0'; // NUL terminate tkey
|
||||
output.append(tfield, status).append('-', status);
|
||||
const char* bcpTValue = ulocimp_toBcpType(tfield, tvalue, nullptr, nullptr);
|
||||
output.append((bcpTValue == nullptr) ? tvalue : bcpTValue, status);
|
||||
|
@ -1822,7 +1822,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
|
|||
if ((baseName != fullName) && (baseName != fullNameBuffer)) {
|
||||
uprv_free(baseName);
|
||||
}
|
||||
baseName = NULL;
|
||||
baseName = nullptr;
|
||||
if(fullName != fullNameBuffer) {
|
||||
uprv_free(fullName);
|
||||
fullName = fullNameBuffer;
|
||||
|
@ -1840,7 +1840,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
|
|||
int32_t length;
|
||||
UErrorCode err;
|
||||
|
||||
if(localeID == NULL) {
|
||||
if(localeID == nullptr) {
|
||||
// not an error, just set the default locale
|
||||
return *this = getDefault();
|
||||
}
|
||||
|
@ -1889,8 +1889,8 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
|
|||
// variant may contain @foo or .foo POSIX cruft; remove it
|
||||
separator = uprv_strchr(field[fieldIdx-1], '@');
|
||||
char* sep2 = uprv_strchr(field[fieldIdx-1], '.');
|
||||
if (separator!=NULL || sep2!=NULL) {
|
||||
if (separator==NULL || (sep2!=NULL && separator > sep2)) {
|
||||
if (separator!=nullptr || sep2!=nullptr) {
|
||||
if (separator==nullptr || (sep2!=nullptr && separator > sep2)) {
|
||||
separator = sep2;
|
||||
}
|
||||
fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
|
||||
|
@ -1974,14 +1974,14 @@ Locale::initBaseName(UErrorCode &status) {
|
|||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
U_ASSERT(baseName==NULL || baseName==fullName);
|
||||
U_ASSERT(baseName==nullptr || baseName==fullName);
|
||||
const char *atPtr = uprv_strchr(fullName, '@');
|
||||
const char *eqPtr = uprv_strchr(fullName, '=');
|
||||
if (atPtr && eqPtr && atPtr < eqPtr) {
|
||||
// Key words exist.
|
||||
int32_t baseNameLength = (int32_t)(atPtr - fullName);
|
||||
baseName = (char *)uprv_malloc(baseNameLength + 1);
|
||||
if (baseName == NULL) {
|
||||
if (baseName == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -2012,7 +2012,7 @@ Locale::setToBogus() {
|
|||
if((baseName != fullName) && (baseName != fullNameBuffer)) {
|
||||
uprv_free(baseName);
|
||||
}
|
||||
baseName = NULL;
|
||||
baseName = nullptr;
|
||||
if(fullName != fullNameBuffer) {
|
||||
uprv_free(fullName);
|
||||
fullName = fullNameBuffer;
|
||||
|
@ -2030,12 +2030,12 @@ Locale::getDefault()
|
|||
{
|
||||
{
|
||||
Mutex lock(&gDefaultLocaleMutex);
|
||||
if (gDefaultLocale != NULL) {
|
||||
if (gDefaultLocale != nullptr) {
|
||||
return *gDefaultLocale;
|
||||
}
|
||||
}
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
return *locale_set_default_internal(NULL, status);
|
||||
return *locale_set_default_internal(nullptr, status);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2381,12 +2381,12 @@ Locale::getLocale(int locid)
|
|||
{
|
||||
Locale *localeCache = getLocaleCache();
|
||||
U_ASSERT((locid < eMAX_LOCALES)&&(locid>=0));
|
||||
if (localeCache == NULL) {
|
||||
if (localeCache == nullptr) {
|
||||
// Failure allocating the locale cache.
|
||||
// The best we can do is return a NULL reference.
|
||||
// The best we can do is return a nullptr reference.
|
||||
locid = 0;
|
||||
}
|
||||
return localeCache[locid]; /*operating on NULL*/
|
||||
return localeCache[locid]; /*operating on nullptr*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2416,11 +2416,11 @@ public:
|
|||
KeywordEnumeration(const char *keys, int32_t keywordLen, int32_t currentIndex, UErrorCode &status)
|
||||
: keywords((char *)&fgClassID), current((char *)&fgClassID), length(0) {
|
||||
if(U_SUCCESS(status) && keywordLen != 0) {
|
||||
if(keys == NULL || keywordLen < 0) {
|
||||
if(keys == nullptr || keywordLen < 0) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
} else {
|
||||
keywords = (char *)uprv_malloc(keywordLen+1);
|
||||
if (keywords == NULL) {
|
||||
if (keywords == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
else {
|
||||
|
@ -2458,14 +2458,14 @@ public:
|
|||
result = current;
|
||||
len = (int32_t)uprv_strlen(current);
|
||||
current += len+1;
|
||||
if(resultLength != NULL) {
|
||||
if(resultLength != nullptr) {
|
||||
*resultLength = len;
|
||||
}
|
||||
} else {
|
||||
if(resultLength != NULL) {
|
||||
if(resultLength != nullptr) {
|
||||
*resultLength = 0;
|
||||
}
|
||||
result = NULL;
|
||||
result = nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -2518,7 +2518,7 @@ UnicodeKeywordEnumeration::~UnicodeKeywordEnumeration() = default;
|
|||
StringEnumeration *
|
||||
Locale::createKeywords(UErrorCode &status) const
|
||||
{
|
||||
StringEnumeration *result = NULL;
|
||||
StringEnumeration *result = nullptr;
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
|
@ -2547,7 +2547,7 @@ Locale::createKeywords(UErrorCode &status) const
|
|||
StringEnumeration *
|
||||
Locale::createUnicodeKeywords(UErrorCode &status) const
|
||||
{
|
||||
StringEnumeration *result = NULL;
|
||||
StringEnumeration *result = nullptr;
|
||||
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
|
|
|
@ -54,23 +54,23 @@ findLikelySubtags(const char* localeID,
|
|||
char* buffer,
|
||||
int32_t bufferLength,
|
||||
UErrorCode* err) {
|
||||
const char* result = NULL;
|
||||
const char* result = nullptr;
|
||||
|
||||
if (!U_FAILURE(*err)) {
|
||||
int32_t resLen = 0;
|
||||
const UChar* s = NULL;
|
||||
const UChar* s = nullptr;
|
||||
UErrorCode tmpErr = U_ZERO_ERROR;
|
||||
icu::LocalUResourceBundlePointer subtags(ures_openDirect(NULL, "likelySubtags", &tmpErr));
|
||||
icu::LocalUResourceBundlePointer subtags(ures_openDirect(nullptr, "likelySubtags", &tmpErr));
|
||||
if (U_SUCCESS(tmpErr)) {
|
||||
icu::CharString und;
|
||||
if (localeID != NULL) {
|
||||
if (localeID != nullptr) {
|
||||
if (*localeID == '\0') {
|
||||
localeID = unknownLanguage;
|
||||
} else if (*localeID == '_') {
|
||||
und.append(unknownLanguage, *err);
|
||||
und.append(localeID, *err);
|
||||
if (U_FAILURE(*err)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
localeID = und.data();
|
||||
}
|
||||
|
@ -140,12 +140,12 @@ appendTag(
|
|||
|
||||
/**
|
||||
* Create a tag string from the supplied parameters. The lang, script and region
|
||||
* parameters may be NULL pointers. If they are, their corresponding length parameters
|
||||
* parameters may be nullptr pointers. If they are, their corresponding length parameters
|
||||
* must be less than or equal to 0.
|
||||
*
|
||||
* If any of the language, script or region parameters are empty, and the alternateTags
|
||||
* parameter is not NULL, it will be parsed for potential language, script and region tags
|
||||
* to be used when constructing the new tag. If the alternateTags parameter is NULL, or
|
||||
* parameter is not nullptr, it will be parsed for potential language, script and region tags
|
||||
* to be used when constructing the new tag. If the alternateTags parameter is nullptr, or
|
||||
* it contains no language tag, the default tag for the unknown language is used.
|
||||
*
|
||||
* If the length of the new string exceeds the capacity of the output buffer,
|
||||
|
@ -211,7 +211,7 @@ createTagStringWithAlternates(
|
|||
&tagLength,
|
||||
/*withSeparator=*/false);
|
||||
}
|
||||
else if (alternateTags == NULL) {
|
||||
else if (alternateTags == nullptr) {
|
||||
/*
|
||||
* Use the empty string for an unknown language, if
|
||||
* we found no language.
|
||||
|
@ -258,7 +258,7 @@ createTagStringWithAlternates(
|
|||
&tagLength,
|
||||
/*withSeparator=*/true);
|
||||
}
|
||||
else if (alternateTags != NULL) {
|
||||
else if (alternateTags != nullptr) {
|
||||
/*
|
||||
* Parse the alternateTags string for the script.
|
||||
*/
|
||||
|
@ -295,7 +295,7 @@ createTagStringWithAlternates(
|
|||
|
||||
regionAppended = true;
|
||||
}
|
||||
else if (alternateTags != NULL) {
|
||||
else if (alternateTags != nullptr) {
|
||||
/*
|
||||
* Parse the alternateTags string for the region.
|
||||
*/
|
||||
|
@ -362,7 +362,7 @@ error:
|
|||
|
||||
/**
|
||||
* Create a tag string from the supplied parameters. The lang, script and region
|
||||
* parameters may be NULL pointers. If they are, their corresponding length parameters
|
||||
* parameters may be nullptr pointers. If they are, their corresponding length parameters
|
||||
* must be less than or equal to 0. If the lang parameter is an empty string, the
|
||||
* default value for an unknown language is written to the output buffer.
|
||||
*
|
||||
|
@ -406,7 +406,7 @@ createTagString(
|
|||
regionLength,
|
||||
trailing,
|
||||
trailingLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
sink,
|
||||
err);
|
||||
}
|
||||
|
@ -454,13 +454,13 @@ parseTagString(
|
|||
int32_t subtagLength = 0;
|
||||
|
||||
if(U_FAILURE(*err) ||
|
||||
localeID == NULL ||
|
||||
lang == NULL ||
|
||||
langLength == NULL ||
|
||||
script == NULL ||
|
||||
scriptLength == NULL ||
|
||||
region == NULL ||
|
||||
regionLength == NULL) {
|
||||
localeID == nullptr ||
|
||||
lang == nullptr ||
|
||||
langLength == nullptr ||
|
||||
script == nullptr ||
|
||||
scriptLength == nullptr ||
|
||||
region == nullptr ||
|
||||
regionLength == nullptr) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,7 @@ createLikelySubtagsString(
|
|||
**/
|
||||
if (scriptLength > 0 && regionLength > 0) {
|
||||
|
||||
const char* likelySubtags = NULL;
|
||||
const char* likelySubtags = nullptr;
|
||||
|
||||
icu::CharString tagBuffer;
|
||||
{
|
||||
|
@ -587,7 +587,7 @@ createLikelySubtagsString(
|
|||
scriptLength,
|
||||
region,
|
||||
regionLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
sink,
|
||||
err);
|
||||
|
@ -606,16 +606,16 @@ createLikelySubtagsString(
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (likelySubtags != NULL) {
|
||||
if (likelySubtags != nullptr) {
|
||||
/* Always use the language tag from the
|
||||
maximal string, since it may be more
|
||||
specific than the one provided. */
|
||||
createTagStringWithAlternates(
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
variants,
|
||||
variantsLength,
|
||||
|
@ -631,7 +631,7 @@ createLikelySubtagsString(
|
|||
**/
|
||||
if (scriptLength > 0) {
|
||||
|
||||
const char* likelySubtags = NULL;
|
||||
const char* likelySubtags = nullptr;
|
||||
|
||||
icu::CharString tagBuffer;
|
||||
{
|
||||
|
@ -641,9 +641,9 @@ createLikelySubtagsString(
|
|||
langLength,
|
||||
script,
|
||||
scriptLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
sink,
|
||||
err);
|
||||
|
@ -662,14 +662,14 @@ createLikelySubtagsString(
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (likelySubtags != NULL) {
|
||||
if (likelySubtags != nullptr) {
|
||||
/* Always use the language tag from the
|
||||
maximal string, since it may be more
|
||||
specific than the one provided. */
|
||||
createTagStringWithAlternates(
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
region,
|
||||
regionLength,
|
||||
|
@ -687,7 +687,7 @@ createLikelySubtagsString(
|
|||
**/
|
||||
if (regionLength > 0) {
|
||||
|
||||
const char* likelySubtags = NULL;
|
||||
const char* likelySubtags = nullptr;
|
||||
|
||||
icu::CharString tagBuffer;
|
||||
{
|
||||
|
@ -695,11 +695,11 @@ createLikelySubtagsString(
|
|||
createTagString(
|
||||
lang,
|
||||
langLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
region,
|
||||
regionLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
sink,
|
||||
err);
|
||||
|
@ -718,16 +718,16 @@ createLikelySubtagsString(
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (likelySubtags != NULL) {
|
||||
if (likelySubtags != nullptr) {
|
||||
/* Always use the language tag from the
|
||||
maximal string, since it may be more
|
||||
specific than the one provided. */
|
||||
createTagStringWithAlternates(
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
script,
|
||||
scriptLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
variants,
|
||||
variantsLength,
|
||||
|
@ -742,7 +742,7 @@ createLikelySubtagsString(
|
|||
* Finally, try just the language.
|
||||
**/
|
||||
{
|
||||
const char* likelySubtags = NULL;
|
||||
const char* likelySubtags = nullptr;
|
||||
|
||||
icu::CharString tagBuffer;
|
||||
{
|
||||
|
@ -750,11 +750,11 @@ createLikelySubtagsString(
|
|||
createTagString(
|
||||
lang,
|
||||
langLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
sink,
|
||||
err);
|
||||
|
@ -773,12 +773,12 @@ createLikelySubtagsString(
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (likelySubtags != NULL) {
|
||||
if (likelySubtags != nullptr) {
|
||||
/* Always use the language tag from the
|
||||
maximal string, since it may be more
|
||||
specific than the one provided. */
|
||||
createTagStringWithAlternates(
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
script,
|
||||
scriptLength,
|
||||
|
@ -841,7 +841,7 @@ _uloc_addLikelySubtags(const char* localeID,
|
|||
if(U_FAILURE(*err)) {
|
||||
goto error;
|
||||
}
|
||||
if (localeID == NULL) {
|
||||
if (localeID == nullptr) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
if(U_FAILURE(*err)) {
|
||||
goto error;
|
||||
}
|
||||
else if (localeID == NULL) {
|
||||
else if (localeID == nullptr) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -974,7 +974,7 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
scriptLength,
|
||||
region,
|
||||
regionLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
baseSink,
|
||||
err);
|
||||
|
@ -1031,11 +1031,11 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
createLikelySubtagsString(
|
||||
lang,
|
||||
langLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
tagSink,
|
||||
err);
|
||||
|
@ -1053,9 +1053,9 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
createTagString(
|
||||
lang,
|
||||
langLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
trailing,
|
||||
trailingLength,
|
||||
|
@ -1076,11 +1076,11 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
createLikelySubtagsString(
|
||||
lang,
|
||||
langLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
region,
|
||||
regionLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
tagSink,
|
||||
err);
|
||||
|
@ -1098,7 +1098,7 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
createTagString(
|
||||
lang,
|
||||
langLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
region,
|
||||
regionLength,
|
||||
|
@ -1124,9 +1124,9 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
langLength,
|
||||
script,
|
||||
scriptLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
tagSink,
|
||||
err);
|
||||
|
@ -1146,7 +1146,7 @@ _uloc_minimizeSubtags(const char* localeID,
|
|||
langLength,
|
||||
script,
|
||||
scriptLength,
|
||||
NULL,
|
||||
nullptr,
|
||||
0,
|
||||
trailing,
|
||||
trailingLength,
|
||||
|
@ -1324,7 +1324,7 @@ uloc_isRightToLeft(const char *locale) {
|
|||
}
|
||||
if (langLength > 0) {
|
||||
const char* langPtr = uprv_strstr(LANG_DIR_STRING, lang);
|
||||
if (langPtr != NULL) {
|
||||
if (langPtr != nullptr) {
|
||||
switch (langPtr[langLength]) {
|
||||
case '-': return false;
|
||||
case '+': return true;
|
||||
|
|
|
@ -1054,7 +1054,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
|
|||
uint16_t langID;
|
||||
uint32_t localeIndex;
|
||||
UBool bLookup = true;
|
||||
const char *pPosixID = NULL;
|
||||
const char *pPosixID = nullptr;
|
||||
|
||||
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
|
||||
static_assert(ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH, "Windows locale names have smaller length than ICU locale names.");
|
||||
|
@ -1110,7 +1110,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
|
|||
#endif
|
||||
|
||||
if (bLookup) {
|
||||
const char *pCandidate = NULL;
|
||||
const char *pCandidate = nullptr;
|
||||
langID = LANGUAGE_LCID(hostid);
|
||||
|
||||
for (localeIndex = 0; localeIndex < gLocaleCount; localeIndex++) {
|
||||
|
@ -1123,7 +1123,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
|
|||
/* On Windows, when locale name has a variant, we still look up the hardcoded table.
|
||||
If a match in the hardcoded table is longer than the Windows locale name without
|
||||
variant, we use the one as the result */
|
||||
if (pCandidate && (pPosixID == NULL || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) {
|
||||
if (pCandidate && (pPosixID == nullptr || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) {
|
||||
pPosixID = pCandidate;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
|
|||
UErrorCode *pErrorCode)
|
||||
{
|
||||
/* char localeBuffer[ULOC_FULLNAME_CAPACITY*4];*/
|
||||
const UChar *item=NULL;
|
||||
const UChar *item=nullptr;
|
||||
UErrorCode errorCode;
|
||||
char explicitFallbackName[ULOC_FULLNAME_CAPACITY] = {0};
|
||||
|
||||
|
@ -63,7 +63,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
|
|||
if(U_FAILURE(errorCode)) {
|
||||
/* total failure, not even root could be opened */
|
||||
*pErrorCode=errorCode;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else if(errorCode==U_USING_DEFAULT_WARNING ||
|
||||
(errorCode==U_USING_FALLBACK_WARNING && *pErrorCode!=U_USING_DEFAULT_WARNING)
|
||||
) {
|
||||
|
@ -76,7 +76,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
|
|||
icu::StackUResourceBundle subTable;
|
||||
ures_getByKeyWithFallback(rb.getAlias(), tableKey, table.getAlias(), &errorCode);
|
||||
|
||||
if (subTableKey != NULL) {
|
||||
if (subTableKey != nullptr) {
|
||||
/*
|
||||
ures_getByKeyWithFallback(table.getAlias(), subTableKey, subTable.getAlias(), &errorCode);
|
||||
item = ures_getStringByKeyWithFallback(subTable.getAlias(), itemKey, pLength, &errorCode);
|
||||
|
@ -91,7 +91,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
|
|||
if(U_SUCCESS(errorCode)){
|
||||
item = ures_getStringByKeyWithFallback(table.getAlias(), itemKey, pLength, &errorCode);
|
||||
if(U_FAILURE(errorCode)){
|
||||
const char* replacement = NULL;
|
||||
const char* replacement = nullptr;
|
||||
*pErrorCode = errorCode; /*save the errorCode*/
|
||||
errorCode = U_ZERO_ERROR;
|
||||
/* may be a deprecated code */
|
||||
|
@ -101,7 +101,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
|
|||
replacement = uloc_getCurrentLanguageID(itemKey);
|
||||
}
|
||||
/*pointer comparison is ok since uloc_getCurrentCountryID & uloc_getCurrentLanguageID return the key itself is replacement is not found*/
|
||||
if(replacement!=NULL && itemKey != replacement){
|
||||
if(replacement!=nullptr && itemKey != replacement){
|
||||
item = ures_getStringByKeyWithFallback(table.getAlias(), replacement, pLength, &errorCode);
|
||||
if(U_SUCCESS(errorCode)){
|
||||
*pErrorCode = errorCode;
|
||||
|
@ -117,7 +117,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
|
|||
|
||||
/* still can't figure out ?.. try the fallback mechanism */
|
||||
int32_t len = 0;
|
||||
const UChar* fallbackLocale = NULL;
|
||||
const UChar* fallbackLocale = nullptr;
|
||||
*pErrorCode = errorCode;
|
||||
errorCode = U_ZERO_ERROR;
|
||||
|
||||
|
@ -164,10 +164,10 @@ _uloc_getOrientationHelper(const char* localeId,
|
|||
if (!U_FAILURE(*status)) {
|
||||
const UChar* const value =
|
||||
uloc_getTableStringWithFallback(
|
||||
NULL,
|
||||
nullptr,
|
||||
localeBuffer,
|
||||
"layout",
|
||||
NULL,
|
||||
nullptr,
|
||||
key,
|
||||
&length,
|
||||
status);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
// see LocaleUtility::getAvailableLocaleNames
|
||||
static icu::UInitOnce LocaleUtilityInitOnce {};
|
||||
static icu::Hashtable * LocaleUtility_cache = NULL;
|
||||
static icu::Hashtable * LocaleUtility_cache = nullptr;
|
||||
|
||||
#define UNDERSCORE_CHAR ((UChar)0x005f)
|
||||
#define AT_SIGN_CHAR ((UChar)64)
|
||||
|
@ -39,7 +39,7 @@ U_CDECL_BEGIN
|
|||
static UBool U_CALLCONV service_cleanup(void) {
|
||||
if (LocaleUtility_cache) {
|
||||
delete LocaleUtility_cache;
|
||||
LocaleUtility_cache = NULL;
|
||||
LocaleUtility_cache = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -47,15 +47,15 @@ static UBool U_CALLCONV service_cleanup(void) {
|
|||
|
||||
static void U_CALLCONV locale_utility_init(UErrorCode &status) {
|
||||
using namespace icu;
|
||||
U_ASSERT(LocaleUtility_cache == NULL);
|
||||
U_ASSERT(LocaleUtility_cache == nullptr);
|
||||
ucln_common_registerCleanup(UCLN_COMMON_SERVICE, service_cleanup);
|
||||
LocaleUtility_cache = new Hashtable(status);
|
||||
if (U_FAILURE(status)) {
|
||||
delete LocaleUtility_cache;
|
||||
LocaleUtility_cache = NULL;
|
||||
LocaleUtility_cache = nullptr;
|
||||
return;
|
||||
}
|
||||
if (LocaleUtility_cache == NULL) {
|
||||
if (LocaleUtility_cache == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ U_NAMESPACE_BEGIN
|
|||
UnicodeString&
|
||||
LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& result)
|
||||
{
|
||||
if (id == NULL) {
|
||||
if (id == nullptr) {
|
||||
result.setToBogus();
|
||||
} else {
|
||||
// Fix case only (no other changes) up to the first '@' or '.' or
|
||||
|
@ -214,45 +214,45 @@ LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID)
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
umtx_initOnce(LocaleUtilityInitOnce, locale_utility_init, status);
|
||||
Hashtable *cache = LocaleUtility_cache;
|
||||
if (cache == NULL) {
|
||||
if (cache == nullptr) {
|
||||
// Catastrophic failure.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Hashtable* htp;
|
||||
umtx_lock(NULL);
|
||||
umtx_lock(nullptr);
|
||||
htp = (Hashtable*) cache->get(bundleID);
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
|
||||
if (htp == NULL) {
|
||||
if (htp == nullptr) {
|
||||
htp = new Hashtable(status);
|
||||
if (htp && U_SUCCESS(status)) {
|
||||
CharString cbundleID;
|
||||
cbundleID.appendInvariantChars(bundleID, status);
|
||||
const char* path = cbundleID.isEmpty() ? NULL : cbundleID.data();
|
||||
const char* path = cbundleID.isEmpty() ? nullptr : cbundleID.data();
|
||||
icu::LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status));
|
||||
for (;;) {
|
||||
const UChar* id = uenum_unext(uenum.getAlias(), NULL, &status);
|
||||
if (id == NULL) {
|
||||
const UChar* id = uenum_unext(uenum.getAlias(), nullptr, &status);
|
||||
if (id == nullptr) {
|
||||
break;
|
||||
}
|
||||
htp->put(UnicodeString(id), (void*)htp, status);
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
delete htp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
umtx_lock(NULL);
|
||||
umtx_lock(nullptr);
|
||||
Hashtable *t = static_cast<Hashtable *>(cache->get(bundleID));
|
||||
if (t != NULL) {
|
||||
if (t != nullptr) {
|
||||
// Another thread raced through this code, creating the cache entry first.
|
||||
// Discard ours and return theirs.
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
delete htp;
|
||||
htp = t;
|
||||
} else {
|
||||
cache->put(bundleID, (void*)htp, status);
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ MessagePatternList<T, stackCapacity>::copyFrom(
|
|||
int32_t length,
|
||||
UErrorCode &errorCode) {
|
||||
if(U_SUCCESS(errorCode) && length>0) {
|
||||
if(length>a.getCapacity() && NULL==a.resize(length)) {
|
||||
if(length>a.getCapacity() && nullptr==a.resize(length)) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ MessagePatternList<T, stackCapacity>::ensureCapacityForOneMore(int32_t oldLength
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return false;
|
||||
}
|
||||
if(a.getCapacity()>oldLength || a.resize(2*oldLength, oldLength)!=NULL) {
|
||||
if(a.getCapacity()>oldLength || a.resize(2*oldLength, oldLength)!=nullptr) {
|
||||
return true;
|
||||
}
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -145,24 +145,24 @@ class MessagePatternPartsList : public MessagePatternList<MessagePattern::Part,
|
|||
|
||||
MessagePattern::MessagePattern(UErrorCode &errorCode)
|
||||
: aposMode(UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE),
|
||||
partsList(NULL), parts(NULL), partsLength(0),
|
||||
numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
|
||||
partsList(nullptr), parts(nullptr), partsLength(0),
|
||||
numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
|
||||
hasArgNames(false), hasArgNumbers(false), needsAutoQuoting(false) {
|
||||
init(errorCode);
|
||||
}
|
||||
|
||||
MessagePattern::MessagePattern(UMessagePatternApostropheMode mode, UErrorCode &errorCode)
|
||||
: aposMode(mode),
|
||||
partsList(NULL), parts(NULL), partsLength(0),
|
||||
numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
|
||||
partsList(nullptr), parts(nullptr), partsLength(0),
|
||||
numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
|
||||
hasArgNames(false), hasArgNumbers(false), needsAutoQuoting(false) {
|
||||
init(errorCode);
|
||||
}
|
||||
|
||||
MessagePattern::MessagePattern(const UnicodeString &pattern, UParseError *parseError, UErrorCode &errorCode)
|
||||
: aposMode(UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE),
|
||||
partsList(NULL), parts(NULL), partsLength(0),
|
||||
numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
|
||||
partsList(nullptr), parts(nullptr), partsLength(0),
|
||||
numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
|
||||
hasArgNames(false), hasArgNumbers(false), needsAutoQuoting(false) {
|
||||
if(init(errorCode)) {
|
||||
parse(pattern, parseError, errorCode);
|
||||
|
@ -175,7 +175,7 @@ MessagePattern::init(UErrorCode &errorCode) {
|
|||
return false;
|
||||
}
|
||||
partsList=new MessagePatternPartsList();
|
||||
if(partsList==NULL) {
|
||||
if(partsList==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ MessagePattern::init(UErrorCode &errorCode) {
|
|||
|
||||
MessagePattern::MessagePattern(const MessagePattern &other)
|
||||
: UObject(other), aposMode(other.aposMode), msg(other.msg),
|
||||
partsList(NULL), parts(NULL), partsLength(0),
|
||||
numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
|
||||
partsList(nullptr), parts(nullptr), partsLength(0),
|
||||
numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
|
||||
hasArgNames(other.hasArgNames), hasArgNumbers(other.hasArgNumbers),
|
||||
needsAutoQuoting(other.needsAutoQuoting) {
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
|
@ -217,13 +217,13 @@ MessagePattern::copyStorage(const MessagePattern &other, UErrorCode &errorCode)
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return false;
|
||||
}
|
||||
parts=NULL;
|
||||
parts=nullptr;
|
||||
partsLength=0;
|
||||
numericValues=NULL;
|
||||
numericValues=nullptr;
|
||||
numericValuesLength=0;
|
||||
if(partsList==NULL) {
|
||||
if(partsList==nullptr) {
|
||||
partsList=new MessagePatternPartsList();
|
||||
if(partsList==NULL) {
|
||||
if(partsList==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -238,9 +238,9 @@ MessagePattern::copyStorage(const MessagePattern &other, UErrorCode &errorCode)
|
|||
partsLength=other.partsLength;
|
||||
}
|
||||
if(other.numericValuesLength>0) {
|
||||
if(numericValuesList==NULL) {
|
||||
if(numericValuesList==nullptr) {
|
||||
numericValuesList=new MessagePatternDoubleList();
|
||||
if(numericValuesList==NULL) {
|
||||
if(numericValuesList==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ MessagePattern::preParse(const UnicodeString &pattern, UParseError *parseError,
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
if(parseError!=NULL) {
|
||||
if(parseError!=nullptr) {
|
||||
parseError->line=0;
|
||||
parseError->offset=0;
|
||||
parseError->preContext[0]=0;
|
||||
|
@ -422,10 +422,10 @@ MessagePattern::preParse(const UnicodeString &pattern, UParseError *parseError,
|
|||
|
||||
void
|
||||
MessagePattern::postParse() {
|
||||
if(partsList!=NULL) {
|
||||
if(partsList!=nullptr) {
|
||||
parts=partsList->a.getAlias();
|
||||
}
|
||||
if(numericValuesList!=NULL) {
|
||||
if(numericValuesList!=nullptr) {
|
||||
numericValues=numericValuesList->a.getAlias();
|
||||
}
|
||||
}
|
||||
|
@ -1127,9 +1127,9 @@ MessagePattern::addArgDoublePart(double numericValue, int32_t start, int32_t len
|
|||
return;
|
||||
}
|
||||
int32_t numericIndex=numericValuesLength;
|
||||
if(numericValuesList==NULL) {
|
||||
if(numericValuesList==nullptr) {
|
||||
numericValuesList=new MessagePatternDoubleList();
|
||||
if(numericValuesList==NULL) {
|
||||
if(numericValuesList==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ MessagePattern::addArgDoublePart(double numericValue, int32_t start, int32_t len
|
|||
|
||||
void
|
||||
MessagePattern::setParseError(UParseError *parseError, int32_t index) {
|
||||
if(parseError==NULL) {
|
||||
if(parseError==nullptr) {
|
||||
return;
|
||||
}
|
||||
parseError->offset=index;
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
return dest;
|
||||
}
|
||||
const UChar *sArray=src.getBuffer();
|
||||
if(&dest==&src || sArray==NULL) {
|
||||
if(&dest==&src || sArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
dest.setToBogus();
|
||||
return dest;
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
return first;
|
||||
}
|
||||
const UChar *secondArray=second.getBuffer();
|
||||
if(&first==&second || secondArray==NULL) {
|
||||
if(&first==&second || secondArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return first;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
UChar buffer[4];
|
||||
int32_t length;
|
||||
const UChar *d=impl.getDecomposition(c, buffer, length);
|
||||
if(d==NULL) {
|
||||
if(d==nullptr) {
|
||||
return false;
|
||||
}
|
||||
if(d==buffer) {
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
UChar buffer[30];
|
||||
int32_t length;
|
||||
const UChar *d=impl.getRawDecomposition(c, buffer, length);
|
||||
if(d==NULL) {
|
||||
if(d==nullptr) {
|
||||
return false;
|
||||
}
|
||||
if(d==buffer) {
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
const UChar *sArray=s.getBuffer();
|
||||
if(sArray==NULL) {
|
||||
if(sArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
return 0;
|
||||
}
|
||||
const UChar *sArray=s.getBuffer();
|
||||
if(sArray==NULL) {
|
||||
if(sArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ private:
|
|||
|
||||
virtual const UChar *
|
||||
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
|
||||
return impl.decompose(src, limit, NULL, errorCode);
|
||||
return impl.decompose(src, limit, nullptr, errorCode);
|
||||
}
|
||||
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
|
||||
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
|
||||
|
@ -289,7 +289,7 @@ private:
|
|||
return false;
|
||||
}
|
||||
const UChar *sArray=s.getBuffer();
|
||||
if(sArray==NULL) {
|
||||
if(sArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ private:
|
|||
return UNORM_MAYBE;
|
||||
}
|
||||
const UChar *sArray=s.getBuffer();
|
||||
if(sArray==NULL) {
|
||||
if(sArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return UNORM_MAYBE;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ private:
|
|||
}
|
||||
virtual const UChar *
|
||||
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE {
|
||||
return impl.composeQuickCheck(src, limit, onlyContiguous, NULL);
|
||||
return impl.composeQuickCheck(src, limit, onlyContiguous, nullptr);
|
||||
}
|
||||
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
|
||||
virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
|
||||
|
@ -363,7 +363,7 @@ private:
|
|||
}
|
||||
virtual const UChar *
|
||||
spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
|
||||
return impl.makeFCD(src, limit, NULL, errorCode);
|
||||
return impl.makeFCD(src, limit, nullptr, errorCode);
|
||||
}
|
||||
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
|
||||
virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
|
||||
|
|
|
@ -190,7 +190,7 @@ static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
|
|||
return;
|
||||
}
|
||||
noopSingleton=new NoopNormalizer2;
|
||||
if(noopSingleton==NULL) {
|
||||
if(noopSingleton==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
|
|||
}
|
||||
|
||||
const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
if(U_FAILURE(errorCode)) { return nullptr; }
|
||||
umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
|
||||
return noopSingleton;
|
||||
}
|
||||
|
@ -216,13 +216,13 @@ Norm2AllModes *
|
|||
Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
delete impl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Norm2AllModes *allModes=new Norm2AllModes(impl);
|
||||
if(allModes==NULL) {
|
||||
if(allModes==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
delete impl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return allModes;
|
||||
}
|
||||
|
@ -231,12 +231,12 @@ Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
|
|||
Norm2AllModes *
|
||||
Norm2AllModes::createNFCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Normalizer2Impl *impl=new Normalizer2Impl;
|
||||
if(impl==NULL) {
|
||||
if(impl==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
impl->init(norm2_nfc_data_indexes, &norm2_nfc_data_trie,
|
||||
norm2_nfc_data_extraData, norm2_nfc_data_smallFCD);
|
||||
|
@ -254,7 +254,7 @@ static void U_CALLCONV initNFCSingleton(UErrorCode &errorCode) {
|
|||
|
||||
const Norm2AllModes *
|
||||
Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) { return NULL; }
|
||||
if(U_FAILURE(errorCode)) { return nullptr; }
|
||||
umtx_initOnce(nfcInitOnce, &initNFCSingleton, errorCode);
|
||||
return nfcSingleton;
|
||||
}
|
||||
|
@ -262,29 +262,29 @@ Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
|
|||
const Normalizer2 *
|
||||
Normalizer2::getNFCInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->comp : NULL;
|
||||
return allModes!=nullptr ? &allModes->comp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *
|
||||
Normalizer2::getNFDInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->decomp : NULL;
|
||||
return allModes!=nullptr ? &allModes->decomp : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->fcd : NULL;
|
||||
return allModes!=nullptr ? &allModes->fcd : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? &allModes->fcc : NULL;
|
||||
return allModes!=nullptr ? &allModes->fcc : nullptr;
|
||||
}
|
||||
|
||||
const Normalizer2Impl *
|
||||
Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
|
||||
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
|
||||
return allModes!=NULL ? allModes->impl : NULL;
|
||||
return allModes!=nullptr ? allModes->impl : nullptr;
|
||||
}
|
||||
#endif // NORM2_HARDCODE_NFC_DATA
|
||||
|
||||
|
@ -292,11 +292,11 @@ U_CDECL_BEGIN
|
|||
|
||||
static UBool U_CALLCONV uprv_normalizer2_cleanup() {
|
||||
delete noopSingleton;
|
||||
noopSingleton = NULL;
|
||||
noopSingleton = nullptr;
|
||||
noopInitOnce.reset();
|
||||
#if NORM2_HARDCODE_NFC_DATA
|
||||
delete nfcSingleton;
|
||||
nfcSingleton = NULL;
|
||||
nfcSingleton = nullptr;
|
||||
nfcInitOnce.reset();
|
||||
#endif
|
||||
return true;
|
||||
|
@ -333,23 +333,23 @@ unorm2_normalize(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if( (src==NULL ? length!=0 : length<-1) ||
|
||||
(dest==NULL ? capacity!=0 : capacity<0) ||
|
||||
(src==dest && src!=NULL)
|
||||
if( (src==nullptr ? length!=0 : length<-1) ||
|
||||
(dest==nullptr ? capacity!=0 : capacity<0) ||
|
||||
(src==dest && src!=nullptr)
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
UnicodeString destString(dest, 0, capacity);
|
||||
// length==0: Nothing to do, and n2wi->normalize(NULL, NULL, buffer, ...) would crash.
|
||||
// length==0: Nothing to do, and n2wi->normalize(nullptr, nullptr, buffer, ...) would crash.
|
||||
if(length!=0) {
|
||||
const Normalizer2 *n2=(const Normalizer2 *)norm2;
|
||||
const Normalizer2WithImpl *n2wi=dynamic_cast<const Normalizer2WithImpl *>(n2);
|
||||
if(n2wi!=NULL) {
|
||||
if(n2wi!=nullptr) {
|
||||
// Avoid duplicate argument checking and support NUL-terminated src.
|
||||
ReorderingBuffer buffer(n2wi->impl, destString);
|
||||
if(buffer.init(length, *pErrorCode)) {
|
||||
n2wi->normalize(src, length>=0 ? src+length : NULL, buffer, *pErrorCode);
|
||||
n2wi->normalize(src, length>=0 ? src+length : nullptr, buffer, *pErrorCode);
|
||||
}
|
||||
} else {
|
||||
UnicodeString srcString(length<0, src, length);
|
||||
|
@ -368,27 +368,27 @@ normalizeSecondAndAppend(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if( (second==NULL ? secondLength!=0 : secondLength<-1) ||
|
||||
(first==NULL ? (firstCapacity!=0 || firstLength!=0) :
|
||||
if( (second==nullptr ? secondLength!=0 : secondLength<-1) ||
|
||||
(first==nullptr ? (firstCapacity!=0 || firstLength!=0) :
|
||||
(firstCapacity<0 || firstLength<-1)) ||
|
||||
(first==second && first!=NULL)
|
||||
(first==second && first!=nullptr)
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
UnicodeString firstString(first, firstLength, firstCapacity);
|
||||
firstLength=firstString.length(); // In case it was -1.
|
||||
// secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(NULL, NULL, buffer, ...) would crash.
|
||||
// secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(nullptr, nullptr, buffer, ...) would crash.
|
||||
if(secondLength!=0) {
|
||||
const Normalizer2 *n2=(const Normalizer2 *)norm2;
|
||||
const Normalizer2WithImpl *n2wi=dynamic_cast<const Normalizer2WithImpl *>(n2);
|
||||
if(n2wi!=NULL) {
|
||||
if(n2wi!=nullptr) {
|
||||
// Avoid duplicate argument checking and support NUL-terminated src.
|
||||
UnicodeString safeMiddle;
|
||||
{
|
||||
ReorderingBuffer buffer(n2wi->impl, firstString);
|
||||
if(buffer.init(firstLength+secondLength+1, *pErrorCode)) { // destCapacity>=-1
|
||||
n2wi->normalizeAndAppend(second, secondLength>=0 ? second+secondLength : NULL,
|
||||
n2wi->normalizeAndAppend(second, secondLength>=0 ? second+secondLength : nullptr,
|
||||
doNormalize, safeMiddle, buffer, *pErrorCode);
|
||||
}
|
||||
} // The ReorderingBuffer destructor finalizes firstString.
|
||||
|
@ -396,7 +396,7 @@ normalizeSecondAndAppend(const UNormalizer2 *norm2,
|
|||
// Restore the modified suffix of the first string.
|
||||
// This does not restore first[] array contents between firstLength and firstCapacity.
|
||||
// (That might be uninitialized memory, as far as we know.)
|
||||
if(first!=NULL) { /* don't dereference NULL */
|
||||
if(first!=nullptr) { /* don't dereference nullptr */
|
||||
safeMiddle.extract(0, 0x7fffffff, first+firstLength-safeMiddle.length());
|
||||
if(firstLength<firstCapacity) {
|
||||
first[firstLength]=0; // NUL-terminate in case it was originally.
|
||||
|
@ -444,7 +444,7 @@ unorm2_getDecomposition(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(decomposition==NULL ? capacity!=0 : capacity<0) {
|
||||
if(decomposition==nullptr ? capacity!=0 : capacity<0) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ unorm2_getRawDecomposition(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(decomposition==NULL ? capacity!=0 : capacity<0) {
|
||||
if(decomposition==nullptr ? capacity!=0 : capacity<0) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -492,7 +492,7 @@ unorm2_isNormalized(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if((s==NULL && length!=0) || length<-1) {
|
||||
if((s==nullptr && length!=0) || length<-1) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ unorm2_quickCheck(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return UNORM_NO;
|
||||
}
|
||||
if((s==NULL && length!=0) || length<-1) {
|
||||
if((s==nullptr && length!=0) || length<-1) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return UNORM_NO;
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if((s==NULL && length!=0) || length<-1) {
|
||||
if((s==nullptr && length!=0) || length<-1) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ ReorderingBuffer::ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &des
|
|||
UBool ReorderingBuffer::init(int32_t destCapacity, UErrorCode &errorCode) {
|
||||
int32_t length=str.length();
|
||||
start=str.getBuffer(destCapacity);
|
||||
if(start==NULL) {
|
||||
if(start==nullptr) {
|
||||
// getBuffer() already did str.setToBogus()
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
|
@ -362,7 +362,7 @@ UBool ReorderingBuffer::resize(int32_t appendLength, UErrorCode &errorCode) {
|
|||
newCapacity=256;
|
||||
}
|
||||
start=str.getBuffer(newCapacity);
|
||||
if(start==NULL) {
|
||||
if(start==nullptr) {
|
||||
// getBuffer() already did str.setToBogus()
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
|
@ -540,7 +540,7 @@ Normalizer2Impl::copyLowPrefixFromNulTerminated(const UChar *src,
|
|||
// Back out the last character for full processing.
|
||||
// Copy this prefix.
|
||||
if(--src!=prevSrc) {
|
||||
if(buffer!=NULL) {
|
||||
if(buffer!=nullptr) {
|
||||
buffer->appendZeroCC(prevSrc, src, errorCode);
|
||||
}
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest,
|
|||
return dest;
|
||||
}
|
||||
const UChar *sArray=src.getBuffer();
|
||||
if(&dest==&src || sArray==NULL) {
|
||||
if(&dest==&src || sArray==nullptr) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
dest.setToBogus();
|
||||
return dest;
|
||||
|
@ -569,7 +569,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
|
|||
UnicodeString &dest,
|
||||
int32_t destLengthEstimate,
|
||||
UErrorCode &errorCode) const {
|
||||
if(destLengthEstimate<0 && limit!=NULL) {
|
||||
if(destLengthEstimate<0 && limit!=nullptr) {
|
||||
destLengthEstimate=(int32_t)(limit-src);
|
||||
}
|
||||
dest.remove();
|
||||
|
@ -580,14 +580,14 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
|
|||
}
|
||||
|
||||
// Dual functionality:
|
||||
// buffer!=NULL: normalize
|
||||
// buffer==NULL: isNormalized/spanQuickCheckYes
|
||||
// buffer!=nullptr: normalize
|
||||
// buffer==nullptr: isNormalized/spanQuickCheckYes
|
||||
const UChar *
|
||||
Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
|
||||
ReorderingBuffer *buffer,
|
||||
UErrorCode &errorCode) const {
|
||||
UChar32 minNoCP=minDecompNoCP;
|
||||
if(limit==NULL) {
|
||||
if(limit==nullptr) {
|
||||
src=copyLowPrefixFromNulTerminated(src, minNoCP, buffer, errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return src;
|
||||
|
@ -629,7 +629,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
|
|||
}
|
||||
// copy these code units all at once
|
||||
if(src!=prevSrc) {
|
||||
if(buffer!=NULL) {
|
||||
if(buffer!=nullptr) {
|
||||
if(!buffer->appendZeroCC(prevSrc, src, errorCode)) {
|
||||
break;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
|
|||
|
||||
// Check one above-minimum, relevant code point.
|
||||
src+=U16_LENGTH(c);
|
||||
if(buffer!=NULL) {
|
||||
if(buffer!=nullptr) {
|
||||
if(!decompose(c, norm16, *buffer, errorCode)) {
|
||||
break;
|
||||
}
|
||||
|
@ -982,7 +982,7 @@ Normalizer2Impl::getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &lengt
|
|||
uint16_t norm16;
|
||||
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
|
||||
// c does not decompose
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
|
||||
// Hangul syllable: decompose algorithmically
|
||||
Hangul::getRawDecomposition(c, buffer);
|
||||
|
@ -1048,7 +1048,7 @@ void Normalizer2Impl::decomposeAndAppend(const UChar *src, const UChar *limit,
|
|||
}
|
||||
prevCC = cc;
|
||||
}
|
||||
if(limit==NULL) { // appendZeroCC() needs limit!=NULL
|
||||
if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr
|
||||
limit=u_strchr(p, 0);
|
||||
}
|
||||
|
||||
|
@ -1233,8 +1233,8 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
|
|||
|
||||
// Some of the following variables are not used until we have a forward-combining starter
|
||||
// and are only initialized now to avoid compiler warnings.
|
||||
compositionsList=NULL; // used as indicator for whether we have a forward-combining starter
|
||||
starter=NULL;
|
||||
compositionsList=nullptr; // used as indicator for whether we have a forward-combining starter
|
||||
starter=nullptr;
|
||||
starterIsSupplementary=false;
|
||||
prevCC=0;
|
||||
|
||||
|
@ -1244,7 +1244,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
|
|||
if( // this character combines backward and
|
||||
isMaybe(norm16) &&
|
||||
// we have seen a starter that combines forward and
|
||||
compositionsList!=NULL &&
|
||||
compositionsList!=nullptr &&
|
||||
// the backward-combining character is not blocked
|
||||
(prevCC<cc || prevCC==0)
|
||||
) {
|
||||
|
@ -1284,7 +1284,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
|
|||
if(p==limit) {
|
||||
break;
|
||||
}
|
||||
compositionsList=NULL;
|
||||
compositionsList=nullptr;
|
||||
continue;
|
||||
} else if((compositeAndFwd=combine(compositionsList, c))>=0) {
|
||||
// The starter and the combining mark (c) do combine.
|
||||
|
@ -1346,7 +1346,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
|
|||
compositionsList=
|
||||
getCompositionsListForComposite(getRawNorm16(composite));
|
||||
} else {
|
||||
compositionsList=NULL;
|
||||
compositionsList=nullptr;
|
||||
}
|
||||
|
||||
// We combined; continue with looking for compositions.
|
||||
|
@ -1363,7 +1363,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
|
|||
// If c did not combine, then check if it is a starter.
|
||||
if(cc==0) {
|
||||
// Found a new starter.
|
||||
if((compositionsList=getCompositionsListForDecompYes(norm16))!=NULL) {
|
||||
if((compositionsList=getCompositionsListForDecompYes(norm16))!=nullptr) {
|
||||
// It may combine with something, prepare for it.
|
||||
if(U_IS_BMP(c)) {
|
||||
starterIsSupplementary=false;
|
||||
|
@ -1375,7 +1375,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
|
|||
}
|
||||
} else if(onlyContiguous) {
|
||||
// FCC: no discontiguous compositions; any intervening character blocks.
|
||||
compositionsList=NULL;
|
||||
compositionsList=nullptr;
|
||||
}
|
||||
}
|
||||
buffer.setReorderingLimit(limit);
|
||||
|
@ -1442,9 +1442,9 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
|
|||
UErrorCode &errorCode) const {
|
||||
const UChar *prevBoundary=src;
|
||||
UChar32 minNoMaybeCP=minCompNoMaybeCP;
|
||||
if(limit==NULL) {
|
||||
if(limit==nullptr) {
|
||||
src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP,
|
||||
doCompose ? &buffer : NULL,
|
||||
doCompose ? &buffer : nullptr,
|
||||
errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return false;
|
||||
|
@ -1703,17 +1703,17 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
|
|||
}
|
||||
|
||||
// Very similar to compose(): Make the same changes in both places if relevant.
|
||||
// pQCResult==NULL: spanQuickCheckYes
|
||||
// pQCResult!=NULL: quickCheck (*pQCResult must be UNORM_YES)
|
||||
// pQCResult==nullptr: spanQuickCheckYes
|
||||
// pQCResult!=nullptr: quickCheck (*pQCResult must be UNORM_YES)
|
||||
const UChar *
|
||||
Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
|
||||
UBool onlyContiguous,
|
||||
UNormalizationCheckResult *pQCResult) const {
|
||||
const UChar *prevBoundary=src;
|
||||
UChar32 minNoMaybeCP=minCompNoMaybeCP;
|
||||
if(limit==NULL) {
|
||||
if(limit==nullptr) {
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, NULL, errorCode);
|
||||
src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, nullptr, errorCode);
|
||||
limit=u_strchr(src, 0);
|
||||
if (prevBoundary != src) {
|
||||
if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) {
|
||||
|
@ -1821,7 +1821,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
|
|||
}
|
||||
}
|
||||
}
|
||||
if(pQCResult!=NULL) {
|
||||
if(pQCResult!=nullptr) {
|
||||
*pQCResult=UNORM_NO;
|
||||
}
|
||||
return prevBoundary;
|
||||
|
@ -1856,7 +1856,7 @@ void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit,
|
|||
if(doCompose) {
|
||||
compose(src, limit, onlyContiguous, true, buffer, errorCode);
|
||||
} else {
|
||||
if(limit==NULL) { // appendZeroCC() needs limit!=NULL
|
||||
if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr
|
||||
limit=u_strchr(src, 0);
|
||||
}
|
||||
buffer.appendZeroCC(src, limit, errorCode);
|
||||
|
@ -2267,8 +2267,8 @@ uint16_t Normalizer2Impl::getFCD16FromNormData(UChar32 c) const {
|
|||
#endif
|
||||
|
||||
// Dual functionality:
|
||||
// buffer!=NULL: normalize
|
||||
// buffer==NULL: isNormalized/quickCheck/spanQuickCheckYes
|
||||
// buffer!=nullptr: normalize
|
||||
// buffer==nullptr: isNormalized/quickCheck/spanQuickCheckYes
|
||||
const UChar *
|
||||
Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
|
||||
ReorderingBuffer *buffer,
|
||||
|
@ -2277,7 +2277,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
|
|||
// Similar to the prevBoundary in the compose() implementation.
|
||||
const UChar *prevBoundary=src;
|
||||
int32_t prevFCD16=0;
|
||||
if(limit==NULL) {
|
||||
if(limit==nullptr) {
|
||||
src=copyLowPrefixFromNulTerminated(src, minLcccCP, buffer, errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return src;
|
||||
|
@ -2330,7 +2330,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
|
|||
}
|
||||
// copy these code units all at once
|
||||
if(src!=prevSrc) {
|
||||
if(buffer!=NULL && !buffer->appendZeroCC(prevSrc, src, errorCode)) {
|
||||
if(buffer!=nullptr && !buffer->appendZeroCC(prevSrc, src, errorCode)) {
|
||||
break;
|
||||
}
|
||||
if(src==limit) {
|
||||
|
@ -2376,12 +2376,12 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
|
|||
if((fcd16&0xff)<=1) {
|
||||
prevBoundary=src;
|
||||
}
|
||||
if(buffer!=NULL && !buffer->appendZeroCC(c, errorCode)) {
|
||||
if(buffer!=nullptr && !buffer->appendZeroCC(c, errorCode)) {
|
||||
break;
|
||||
}
|
||||
prevFCD16=fcd16;
|
||||
continue;
|
||||
} else if(buffer==NULL) {
|
||||
} else if(buffer==nullptr) {
|
||||
return prevBoundary; // quick check "no"
|
||||
} else {
|
||||
/*
|
||||
|
@ -2436,7 +2436,7 @@ void Normalizer2Impl::makeFCDAndAppend(const UChar *src, const UChar *limit,
|
|||
if(doMakeFCD) {
|
||||
makeFCD(src, limit, &buffer, errorCode);
|
||||
} else {
|
||||
if(limit==NULL) { // appendZeroCC() needs limit!=NULL
|
||||
if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr
|
||||
limit=u_strchr(src, 0);
|
||||
}
|
||||
buffer.appendZeroCC(src, limit, errorCode);
|
||||
|
@ -2479,7 +2479,7 @@ const UChar *Normalizer2Impl::findNextFCDBoundary(const UChar *p, const UChar *l
|
|||
|
||||
CanonIterData::CanonIterData(UErrorCode &errorCode) :
|
||||
mutableTrie(umutablecptrie_open(0, 0, &errorCode)), trie(nullptr),
|
||||
canonStartSets(uprv_deleteUObject, NULL, errorCode) {}
|
||||
canonStartSets(uprv_deleteUObject, nullptr, errorCode) {}
|
||||
|
||||
CanonIterData::~CanonIterData() {
|
||||
umutablecptrie_close(mutableTrie);
|
||||
|
@ -2535,9 +2535,9 @@ initCanonIterData(Normalizer2Impl *impl, UErrorCode &errorCode) {
|
|||
U_CDECL_END
|
||||
|
||||
void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
|
||||
U_ASSERT(impl->fCanonIterData == NULL);
|
||||
U_ASSERT(impl->fCanonIterData == nullptr);
|
||||
impl->fCanonIterData = new CanonIterData(errorCode);
|
||||
if (impl->fCanonIterData == NULL) {
|
||||
if (impl->fCanonIterData == nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
if (U_SUCCESS(errorCode)) {
|
||||
|
@ -2562,7 +2562,7 @@ void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
|
|||
}
|
||||
if (U_FAILURE(errorCode)) {
|
||||
delete impl->fCanonIterData;
|
||||
impl->fCanonIterData = NULL;
|
||||
impl->fCanonIterData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2710,7 +2710,7 @@ unorm2_swap(const UDataSwapper *ds,
|
|||
|
||||
/* udata_swapDataHeader checks the arguments */
|
||||
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Normalizer)
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
|
||||
UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
|
||||
UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0),
|
||||
text(new StringCharacterIterator(str)),
|
||||
currentIndex(0), nextIndex(0),
|
||||
buffer(), bufferPos(0)
|
||||
|
@ -47,7 +47,7 @@ Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
|
|||
}
|
||||
|
||||
Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode) :
|
||||
UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
|
||||
UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0),
|
||||
text(new UCharCharacterIterator(str, length)),
|
||||
currentIndex(0), nextIndex(0),
|
||||
buffer(), bufferPos(0)
|
||||
|
@ -56,7 +56,7 @@ Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mo
|
|||
}
|
||||
|
||||
Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) :
|
||||
UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
|
||||
UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0),
|
||||
text(iter.clone()),
|
||||
currentIndex(0), nextIndex(0),
|
||||
buffer(), bufferPos(0)
|
||||
|
@ -65,7 +65,7 @@ Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) :
|
|||
}
|
||||
|
||||
Normalizer::Normalizer(const Normalizer ©) :
|
||||
UObject(copy), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(copy.fUMode), fOptions(copy.fOptions),
|
||||
UObject(copy), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(copy.fUMode), fOptions(copy.fOptions),
|
||||
text(copy.text->clone()),
|
||||
currentIndex(copy.currentIndex), nextIndex(copy.nextIndex),
|
||||
buffer(copy.buffer), bufferPos(copy.bufferPos)
|
||||
|
@ -410,7 +410,7 @@ Normalizer::setText(const UnicodeString& newText,
|
|||
return;
|
||||
}
|
||||
CharacterIterator *newIter = new StringCharacterIterator(newText);
|
||||
if (newIter == NULL) {
|
||||
if (newIter == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ Normalizer::setText(const CharacterIterator& newText,
|
|||
return;
|
||||
}
|
||||
CharacterIterator *newIter = newText.clone();
|
||||
if (newIter == NULL) {
|
||||
if (newIter == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -449,7 +449,7 @@ Normalizer::setText(ConstChar16Ptr newText,
|
|||
return;
|
||||
}
|
||||
CharacterIterator *newIter = new UCharCharacterIterator(newText, length);
|
||||
if (newIter == NULL) {
|
||||
if (newIter == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ PluralMapBase::toCategory(const UnicodeString &pluralForm) {
|
|||
const char *PluralMapBase::getCategoryName(Category c) {
|
||||
int32_t index = c;
|
||||
return (index < 0 || index >= UPRV_LENGTHOF(gPluralForms)) ?
|
||||
NULL : gPluralForms[index];
|
||||
nullptr : gPluralForms[index];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
/**
|
||||
* Converts a category to a name.
|
||||
* Passing NONE or CATEGORY_COUNT for category returns NULL.
|
||||
* Passing NONE or CATEGORY_COUNT for category returns nullptr.
|
||||
*/
|
||||
static const char *getCategoryName(Category category);
|
||||
};
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
fVariants[0] = &fOtherVariant;
|
||||
for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) {
|
||||
fVariants[i] = other.fVariants[i] ?
|
||||
new T(*other.fVariants[i]) : NULL;
|
||||
new T(*other.fVariants[i]) : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,12 +98,12 @@ public:
|
|||
return *this;
|
||||
}
|
||||
for (int32_t i = 0; i < UPRV_LENGTHOF(fVariants); ++i) {
|
||||
if (fVariants[i] != NULL && other.fVariants[i] != NULL) {
|
||||
if (fVariants[i] != nullptr && other.fVariants[i] != nullptr) {
|
||||
*fVariants[i] = *other.fVariants[i];
|
||||
} else if (fVariants[i] != NULL) {
|
||||
} else if (fVariants[i] != nullptr) {
|
||||
delete fVariants[i];
|
||||
fVariants[i] = NULL;
|
||||
} else if (other.fVariants[i] != NULL) {
|
||||
fVariants[i] = nullptr;
|
||||
} else if (other.fVariants[i] != nullptr) {
|
||||
fVariants[i] = new T(*other.fVariants[i]);
|
||||
} else {
|
||||
// do nothing
|
||||
|
@ -125,28 +125,28 @@ public:
|
|||
*fVariants[0] = T();
|
||||
for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) {
|
||||
delete fVariants[i];
|
||||
fVariants[i] = NULL;
|
||||
fVariants[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through the mappings in this instance, set index to NONE
|
||||
* prior to using. Call next repeatedly to get the values until it
|
||||
* returns NULL. Each time next returns, caller may pass index
|
||||
* returns nullptr. Each time next returns, caller may pass index
|
||||
* to getCategoryName() to get the name of the plural category.
|
||||
* When this function returns NULL, index is CATEGORY_COUNT
|
||||
* When this function returns nullptr, index is CATEGORY_COUNT
|
||||
*/
|
||||
const T *next(Category &index) const {
|
||||
int32_t idx = index;
|
||||
++idx;
|
||||
for (; idx < UPRV_LENGTHOF(fVariants); ++idx) {
|
||||
if (fVariants[idx] != NULL) {
|
||||
if (fVariants[idx] != nullptr) {
|
||||
index = static_cast<Category>(idx);
|
||||
return fVariants[idx];
|
||||
}
|
||||
}
|
||||
index = static_cast<Category>(idx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
*/
|
||||
const T &get(Category v) const {
|
||||
int32_t index = v;
|
||||
if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == NULL) {
|
||||
if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == nullptr) {
|
||||
return *fVariants[0];
|
||||
}
|
||||
return *fVariants[index];
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
T *getMutable(
|
||||
Category category,
|
||||
UErrorCode &status) {
|
||||
return getMutable(category, NULL, status);
|
||||
return getMutable(category, nullptr, status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
T *getMutable(
|
||||
const char *category,
|
||||
UErrorCode &status) {
|
||||
return getMutable(toCategory(category), NULL, status);
|
||||
return getMutable(toCategory(category), nullptr, status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
if (fVariants[i] == rhs.fVariants[i]) {
|
||||
continue;
|
||||
}
|
||||
if (fVariants[i] == NULL || rhs.fVariants[i] == NULL) {
|
||||
if (fVariants[i] == nullptr || rhs.fVariants[i] == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (!eqFunc(*fVariants[i], *rhs.fVariants[i])) {
|
||||
|
@ -262,15 +262,15 @@ private:
|
|||
const T *defaultValue,
|
||||
UErrorCode &status) {
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
int32_t index = category;
|
||||
if (index < 0 || index >= UPRV_LENGTHOF(fVariants)) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (fVariants[index] == NULL) {
|
||||
fVariants[index] = defaultValue == NULL ?
|
||||
if (fVariants[index] == nullptr) {
|
||||
fVariants[index] = defaultValue == nullptr ?
|
||||
new T() : new T(*defaultValue);
|
||||
}
|
||||
if (!fVariants[index]) {
|
||||
|
@ -282,7 +282,7 @@ private:
|
|||
void initializeNew() {
|
||||
fVariants[0] = &fOtherVariant;
|
||||
for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) {
|
||||
fVariants[i] = NULL;
|
||||
fVariants[i] = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -204,20 +204,20 @@ int32_t PropNameData::findPropertyValueNameGroup(int32_t valueMapIndex, int32_t
|
|||
const char *PropNameData::getName(const char *nameGroup, int32_t nameIndex) {
|
||||
int32_t numNames=*nameGroup++;
|
||||
if(nameIndex<0 || numNames<=nameIndex) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// Skip nameIndex names.
|
||||
for(; nameIndex>0; --nameIndex) {
|
||||
nameGroup=uprv_strchr(nameGroup, 0)+1;
|
||||
}
|
||||
if(*nameGroup==0) {
|
||||
return NULL; // no name (Property[Value]Aliases.txt has "n/a")
|
||||
return nullptr; // no name (Property[Value]Aliases.txt has "n/a")
|
||||
}
|
||||
return nameGroup;
|
||||
}
|
||||
|
||||
UBool PropNameData::containsName(BytesTrie &trie, const char *name) {
|
||||
if(name==NULL) {
|
||||
if(name==nullptr) {
|
||||
return false;
|
||||
}
|
||||
UStringTrieResult result=USTRINGTRIE_NO_VALUE;
|
||||
|
@ -239,7 +239,7 @@ UBool PropNameData::containsName(BytesTrie &trie, const char *name) {
|
|||
const char *PropNameData::getPropertyName(int32_t property, int32_t nameChoice) {
|
||||
int32_t valueMapIndex=findProperty(property);
|
||||
if(valueMapIndex==0) {
|
||||
return NULL; // Not a known property.
|
||||
return nullptr; // Not a known property.
|
||||
}
|
||||
return getName(nameGroups+valueMaps[valueMapIndex], nameChoice);
|
||||
}
|
||||
|
@ -247,11 +247,11 @@ const char *PropNameData::getPropertyName(int32_t property, int32_t nameChoice)
|
|||
const char *PropNameData::getPropertyValueName(int32_t property, int32_t value, int32_t nameChoice) {
|
||||
int32_t valueMapIndex=findProperty(property);
|
||||
if(valueMapIndex==0) {
|
||||
return NULL; // Not a known property.
|
||||
return nullptr; // Not a known property.
|
||||
}
|
||||
int32_t nameGroupOffset=findPropertyValueNameGroup(valueMaps[valueMapIndex+1], value);
|
||||
if(nameGroupOffset==0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return getName(nameGroups+nameGroupOffset, nameChoice);
|
||||
}
|
||||
|
|
|
@ -47,21 +47,21 @@ upvec_open(int32_t columns, UErrorCode *pErrorCode) {
|
|||
uint32_t cp;
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if(columns<1) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
columns+=2; /* count range start and limit columns */
|
||||
|
||||
pv=(UPropsVectors *)uprv_malloc(sizeof(UPropsVectors));
|
||||
v=(uint32_t *)uprv_malloc(UPVEC_INITIAL_ROWS*columns*4);
|
||||
if(pv==NULL || v==NULL) {
|
||||
if(pv==nullptr || v==nullptr) {
|
||||
uprv_free(pv);
|
||||
uprv_free(v);
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memset(pv, 0, sizeof(UPropsVectors));
|
||||
pv->v=v;
|
||||
|
@ -85,7 +85,7 @@ upvec_open(int32_t columns, UErrorCode *pErrorCode) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
upvec_close(UPropsVectors *pv) {
|
||||
if(pv!=NULL) {
|
||||
if(pv!=nullptr) {
|
||||
uprv_free(pv->v);
|
||||
uprv_free(pv);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ upvec_setValue(UPropsVectors *pv,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if( pv==NULL ||
|
||||
if( pv==nullptr ||
|
||||
start<0 || start>end || end>UPVEC_MAX_CP ||
|
||||
column<0 || column>=(pv->columns-2)
|
||||
) {
|
||||
|
@ -216,7 +216,7 @@ upvec_setValue(UPropsVectors *pv,
|
|||
return;
|
||||
}
|
||||
newVectors=(uint32_t *)uprv_malloc(newMaxRows*columns*4);
|
||||
if(newVectors==NULL) {
|
||||
if(newVectors==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -296,15 +296,15 @@ upvec_getRow(const UPropsVectors *pv, int32_t rowIndex,
|
|||
int32_t columns;
|
||||
|
||||
if(pv->isCompacted || rowIndex<0 || rowIndex>=pv->rows) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
columns=pv->columns;
|
||||
row=pv->v+rowIndex*columns;
|
||||
if(pRangeStart!=NULL) {
|
||||
if(pRangeStart!=nullptr) {
|
||||
*pRangeStart=(UChar32)row[0];
|
||||
}
|
||||
if(pRangeEnd!=NULL) {
|
||||
if(pRangeEnd!=nullptr) {
|
||||
*pRangeEnd=(UChar32)row[1]-1;
|
||||
}
|
||||
return row+2;
|
||||
|
@ -342,7 +342,7 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(handler==NULL) {
|
||||
if(handler==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -437,12 +437,12 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE
|
|||
U_CAPI const uint32_t * U_EXPORT2
|
||||
upvec_getArray(const UPropsVectors *pv, int32_t *pRows, int32_t *pColumns) {
|
||||
if(!pv->isCompacted) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if(pRows!=NULL) {
|
||||
if(pRows!=nullptr) {
|
||||
*pRows=pv->rows;
|
||||
}
|
||||
if(pColumns!=NULL) {
|
||||
if(pColumns!=nullptr) {
|
||||
*pColumns=pv->columns-2;
|
||||
}
|
||||
return pv->v;
|
||||
|
@ -455,23 +455,23 @@ upvec_cloneArray(const UPropsVectors *pv,
|
|||
int32_t byteLength;
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if(!pv->isCompacted) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
byteLength=pv->rows*(pv->columns-2)*4;
|
||||
clonedArray=(uint32_t *)uprv_malloc(byteLength);
|
||||
if(clonedArray==NULL) {
|
||||
if(clonedArray==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(clonedArray, pv->v, byteLength);
|
||||
if(pRows!=NULL) {
|
||||
if(pRows!=nullptr) {
|
||||
*pRows=pv->rows;
|
||||
}
|
||||
if(pColumns!=NULL) {
|
||||
if(pColumns!=nullptr) {
|
||||
*pColumns=pv->columns-2;
|
||||
}
|
||||
return clonedArray;
|
||||
|
@ -479,12 +479,12 @@ upvec_cloneArray(const UPropsVectors *pv,
|
|||
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode) {
|
||||
UPVecToUTrie2Context toUTrie2={ NULL, 0, 0, 0 };
|
||||
UPVecToUTrie2Context toUTrie2={ nullptr, 0, 0, 0 };
|
||||
upvec_compact(pv, upvec_compactToUTrie2Handler, &toUTrie2, pErrorCode);
|
||||
utrie2_freeze(toUTrie2.trie, UTRIE2_16_VALUE_BITS, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
utrie2_close(toUTrie2.trie);
|
||||
toUTrie2.trie=NULL;
|
||||
toUTrie2.trie=nullptr;
|
||||
}
|
||||
return toUTrie2.trie;
|
||||
}
|
||||
|
|
|
@ -189,11 +189,11 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
|
|||
UChar c, c2;
|
||||
|
||||
/* argument checking */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) {
|
||||
if(src==nullptr || srcLength<-1 || (dest==nullptr && destCapacity!=0)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -221,13 +221,13 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
|
|||
cpBuffer[srcCPCount++]=0;
|
||||
if(destLength<destCapacity) {
|
||||
dest[destLength]=
|
||||
caseFlags!=NULL ?
|
||||
caseFlags!=nullptr ?
|
||||
asciiCaseMap((char)c, caseFlags[j]) :
|
||||
(char)c;
|
||||
}
|
||||
++destLength;
|
||||
} else {
|
||||
n=(caseFlags!=NULL && caseFlags[j])<<31L;
|
||||
n=(caseFlags!=nullptr && caseFlags[j])<<31L;
|
||||
if(U16_IS_SINGLE(c)) {
|
||||
n|=c;
|
||||
} else if(U16_IS_LEAD(c) && U16_IS_TRAIL(c2=src[j+1])) {
|
||||
|
@ -249,13 +249,13 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
|
|||
cpBuffer[srcCPCount++]=0;
|
||||
if(destLength<destCapacity) {
|
||||
dest[destLength]=
|
||||
caseFlags!=NULL ?
|
||||
caseFlags!=nullptr ?
|
||||
asciiCaseMap((char)c, caseFlags[j]) :
|
||||
(char)c;
|
||||
}
|
||||
++destLength;
|
||||
} else {
|
||||
n=(caseFlags!=NULL && caseFlags[j])<<31L;
|
||||
n=(caseFlags!=nullptr && caseFlags[j])<<31L;
|
||||
if(U16_IS_SINGLE(c)) {
|
||||
n|=c;
|
||||
} else if(U16_IS_LEAD(c) && (j+1)<srcLength && U16_IS_TRAIL(c2=src[j+1])) {
|
||||
|
@ -380,11 +380,11 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
UChar b;
|
||||
|
||||
/* argument checking */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) {
|
||||
if(src==nullptr || srcLength<-1 || (dest==nullptr && destCapacity!=0)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
if(j<destCapacity) {
|
||||
dest[j]=(UChar)b;
|
||||
|
||||
if(caseFlags!=NULL) {
|
||||
if(caseFlags!=nullptr) {
|
||||
caseFlags[j]=IS_BASIC_UPPERCASE(b);
|
||||
}
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
|
||||
/* Insert n at position i of the output: */
|
||||
cpLength=U16_LENGTH(n);
|
||||
if(dest!=NULL && ((destLength+cpLength)<=destCapacity)) {
|
||||
if(dest!=nullptr && ((destLength+cpLength)<=destCapacity)) {
|
||||
int32_t codeUnitIndex;
|
||||
|
||||
/*
|
||||
|
@ -555,7 +555,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
uprv_memmove(dest+codeUnitIndex+cpLength,
|
||||
dest+codeUnitIndex,
|
||||
(destLength-codeUnitIndex)*U_SIZEOF_UCHAR);
|
||||
if(caseFlags!=NULL) {
|
||||
if(caseFlags!=nullptr) {
|
||||
uprv_memmove(caseFlags+codeUnitIndex+cpLength,
|
||||
caseFlags+codeUnitIndex,
|
||||
destLength-codeUnitIndex);
|
||||
|
@ -569,7 +569,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
|
|||
dest[codeUnitIndex]=U16_LEAD(n);
|
||||
dest[codeUnitIndex+1]=U16_TRAIL(n);
|
||||
}
|
||||
if(caseFlags!=NULL) {
|
||||
if(caseFlags!=nullptr) {
|
||||
/* Case of last character determines uppercase flag: */
|
||||
caseFlags[codeUnitIndex]=IS_BASIC_UPPERCASE(src[in-1]);
|
||||
if(cpLength==2) {
|
||||
|
|
|
@ -248,7 +248,7 @@ UBool fakeClock_set = false; /** True if fake clock has spun up **/
|
|||
|
||||
static UDate getUTCtime_real() {
|
||||
struct timeval posixTime;
|
||||
gettimeofday(&posixTime, NULL);
|
||||
gettimeofday(&posixTime, nullptr);
|
||||
return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000));
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ static UDate getUTCtime_fake() {
|
|||
if(!fakeClock_set) {
|
||||
UDate real = getUTCtime_real();
|
||||
const char *fake_start = getenv("U_FAKETIME_START");
|
||||
if((fake_start!=NULL) && (fake_start[0]!=0)) {
|
||||
if((fake_start!=nullptr) && (fake_start[0]!=0)) {
|
||||
sscanf(fake_start,"%lf",&fakeClock_t0);
|
||||
fakeClock_dt = fakeClock_t0 - real;
|
||||
fprintf(stderr,"U_DEBUG_FAKETIME was set at compile time, so the ICU clock will start at a preset value\n"
|
||||
|
@ -319,7 +319,7 @@ uprv_getRawUTCtime()
|
|||
|
||||
#if HAVE_GETTIMEOFDAY
|
||||
struct timeval posixTime;
|
||||
gettimeofday(&posixTime, NULL);
|
||||
gettimeofday(&posixTime, nullptr);
|
||||
return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000));
|
||||
#else
|
||||
time_t epochtime;
|
||||
|
@ -612,11 +612,11 @@ uprv_maximumPtr(void * base)
|
|||
* Unlike other operating systems, the pointer model isn't determined at
|
||||
* compile time on i5/OS.
|
||||
*/
|
||||
if ((base != NULL) && (_TESTPTR(base, _C_TERASPACE_CHECK))) {
|
||||
if ((base != nullptr) && (_TESTPTR(base, _C_TERASPACE_CHECK))) {
|
||||
/* if it is a TERASPACE pointer the max is 2GB - 4k */
|
||||
return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0x7fffefff)));
|
||||
}
|
||||
/* otherwise 16MB since NULL ptr is not checkable or the ptr is not TERASPACE */
|
||||
/* otherwise 16MB since nullptr ptr is not checkable or the ptr is not TERASPACE */
|
||||
return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0xffefff)));
|
||||
|
||||
#else
|
||||
|
@ -722,7 +722,7 @@ extern U_IMPORT char *U_TZNAME[];
|
|||
#include <dirent.h> /* Needed to search through system timezone files */
|
||||
#endif
|
||||
static char gTimeZoneBuffer[PATH_MAX];
|
||||
static char *gTimeZoneBufferPtr = NULL;
|
||||
static char *gTimeZoneBufferPtr = nullptr;
|
||||
#endif
|
||||
|
||||
#if !U_PLATFORM_USES_ONLY_WIN32_API
|
||||
|
@ -879,7 +879,7 @@ static const char* remapShortTimeZone(const char *stdID, const char *dstID, int3
|
|||
return OFFSET_ZONE_MAPPINGS[idx].olsonID;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -907,14 +907,14 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
|
|||
char bufferFile[MAX_READ_SIZE];
|
||||
UBool result = true;
|
||||
|
||||
if (tzInfo->defaultTZFilePtr == NULL) {
|
||||
if (tzInfo->defaultTZFilePtr == nullptr) {
|
||||
tzInfo->defaultTZFilePtr = fopen(defaultTZFileName, "r");
|
||||
}
|
||||
file = fopen(TZFileName, "r");
|
||||
|
||||
tzInfo->defaultTZPosition = 0; /* reset position to begin search */
|
||||
|
||||
if (file != NULL && tzInfo->defaultTZFilePtr != NULL) {
|
||||
if (file != nullptr && tzInfo->defaultTZFilePtr != nullptr) {
|
||||
/* First check that the file size are equal. */
|
||||
if (tzInfo->defaultTZFileSize == 0) {
|
||||
fseek(tzInfo->defaultTZFilePtr, 0, SEEK_END);
|
||||
|
@ -930,7 +930,7 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
|
|||
/* Store the data from the files in separate buffers and
|
||||
* compare each byte to determine equality.
|
||||
*/
|
||||
if (tzInfo->defaultTZBuffer == NULL) {
|
||||
if (tzInfo->defaultTZBuffer == nullptr) {
|
||||
rewind(tzInfo->defaultTZFilePtr);
|
||||
tzInfo->defaultTZBuffer = (char*)uprv_malloc(sizeof(char) * tzInfo->defaultTZFileSize);
|
||||
sizeFileRead = fread(tzInfo->defaultTZBuffer, 1, tzInfo->defaultTZFileSize, tzInfo->defaultTZFilePtr);
|
||||
|
@ -953,7 +953,7 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
|
|||
result = false;
|
||||
}
|
||||
|
||||
if (file != NULL) {
|
||||
if (file != nullptr) {
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
|
@ -965,16 +965,16 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
|
|||
#define SKIP1 "."
|
||||
#define SKIP2 ".."
|
||||
static UBool U_CALLCONV putil_cleanup(void);
|
||||
static CharString *gSearchTZFileResult = NULL;
|
||||
static CharString *gSearchTZFileResult = nullptr;
|
||||
|
||||
/*
|
||||
* This method recursively traverses the directory given for a matching TZ file and returns the first match.
|
||||
* This function is not thread safe - it uses a global, gSearchTZFileResult, to hold its results.
|
||||
*/
|
||||
static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
||||
DIR* dirp = NULL;
|
||||
struct dirent* dirEntry = NULL;
|
||||
char* result = NULL;
|
||||
DIR* dirp = nullptr;
|
||||
struct dirent* dirEntry = nullptr;
|
||||
char* result = nullptr;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
/* Save the current path */
|
||||
|
@ -984,20 +984,20 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
|||
}
|
||||
|
||||
dirp = opendir(path);
|
||||
if (dirp == NULL) {
|
||||
if (dirp == nullptr) {
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
|
||||
if (gSearchTZFileResult == NULL) {
|
||||
if (gSearchTZFileResult == nullptr) {
|
||||
gSearchTZFileResult = new CharString;
|
||||
if (gSearchTZFileResult == NULL) {
|
||||
if (gSearchTZFileResult == nullptr) {
|
||||
goto cleanupAndReturn;
|
||||
}
|
||||
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
|
||||
}
|
||||
|
||||
/* Check each entry in the directory. */
|
||||
while((dirEntry = readdir(dirp)) != NULL) {
|
||||
while((dirEntry = readdir(dirp)) != nullptr) {
|
||||
const char* dirName = dirEntry->d_name;
|
||||
if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0
|
||||
&& uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) {
|
||||
|
@ -1008,8 +1008,8 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
|||
break;
|
||||
}
|
||||
|
||||
DIR* subDirp = NULL;
|
||||
if ((subDirp = opendir(newpath.data())) != NULL) {
|
||||
DIR* subDirp = nullptr;
|
||||
if ((subDirp = opendir(newpath.data())) != nullptr) {
|
||||
/* If this new path is a directory, make a recursive call with the newpath. */
|
||||
closedir(subDirp);
|
||||
newpath.append('/', status);
|
||||
|
@ -1021,11 +1021,11 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
|||
Have to get out here. Otherwise, we'd keep looking
|
||||
and return the first match in the top-level directory
|
||||
if there's a match in the top-level. If not, this function
|
||||
would return NULL and set gTimeZoneBufferPtr to NULL in initDefault().
|
||||
would return nullptr and set gTimeZoneBufferPtr to nullptr in initDefault().
|
||||
It worked without this in most cases because we have a fallback of calling
|
||||
localtime_r to figure out the default timezone.
|
||||
*/
|
||||
if (result != NULL)
|
||||
if (result != nullptr)
|
||||
break;
|
||||
} else {
|
||||
if(compareBinaryFiles(TZDEFAULT, newpath.data(), tzInfo)) {
|
||||
|
@ -1104,7 +1104,7 @@ uprv_tzname_clear_cache(void)
|
|||
#endif
|
||||
|
||||
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
|
||||
gTimeZoneBufferPtr = NULL;
|
||||
gTimeZoneBufferPtr = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1112,11 +1112,11 @@ U_CAPI const char* U_EXPORT2
|
|||
uprv_tzname(int n)
|
||||
{
|
||||
(void)n; // Avoid unreferenced parameter warning.
|
||||
const char *tzid = NULL;
|
||||
const char *tzid = nullptr;
|
||||
#if U_PLATFORM_USES_ONLY_WIN32_API
|
||||
tzid = uprv_detectWindowsTimeZone();
|
||||
|
||||
if (tzid != NULL) {
|
||||
if (tzid != nullptr) {
|
||||
return tzid;
|
||||
}
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ uprv_tzname(int n)
|
|||
int ret;
|
||||
|
||||
tzid = getenv("TZFILE");
|
||||
if (tzid != NULL) {
|
||||
if (tzid != nullptr) {
|
||||
return tzid;
|
||||
}
|
||||
#endif*/
|
||||
|
@ -1146,7 +1146,7 @@ uprv_tzname(int n)
|
|||
#else
|
||||
tzid = getenv("TZ");
|
||||
#endif
|
||||
if (tzid != NULL && isValidOlsonID(tzid)
|
||||
if (tzid != nullptr && isValidOlsonID(tzid)
|
||||
#if U_PLATFORM == U_PF_SOLARIS
|
||||
/* Don't misinterpret TZ "localtime" on Solaris as a time zone name. */
|
||||
&& uprv_strcmp(tzid, TZ_ENV_CHECK) != 0
|
||||
|
@ -1165,7 +1165,7 @@ uprv_tzname(int n)
|
|||
|
||||
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
|
||||
/* Caller must handle threading issues */
|
||||
if (gTimeZoneBufferPtr == NULL) {
|
||||
if (gTimeZoneBufferPtr == nullptr) {
|
||||
/*
|
||||
This is a trick to look at the name of the link to get the Olson ID
|
||||
because the tzfile contents is underspecified.
|
||||
|
@ -1177,7 +1177,7 @@ uprv_tzname(int n)
|
|||
gTimeZoneBuffer[ret] = 0;
|
||||
char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
|
||||
|
||||
if (tzZoneInfoTailPtr != NULL
|
||||
if (tzZoneInfoTailPtr != nullptr
|
||||
&& isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
|
||||
{
|
||||
return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen);
|
||||
|
@ -1185,26 +1185,26 @@ uprv_tzname(int n)
|
|||
} else {
|
||||
#if defined(SEARCH_TZFILE)
|
||||
DefaultTZInfo* tzInfo = (DefaultTZInfo*)uprv_malloc(sizeof(DefaultTZInfo));
|
||||
if (tzInfo != NULL) {
|
||||
tzInfo->defaultTZBuffer = NULL;
|
||||
if (tzInfo != nullptr) {
|
||||
tzInfo->defaultTZBuffer = nullptr;
|
||||
tzInfo->defaultTZFileSize = 0;
|
||||
tzInfo->defaultTZFilePtr = NULL;
|
||||
tzInfo->defaultTZFilePtr = nullptr;
|
||||
tzInfo->defaultTZstatus = false;
|
||||
tzInfo->defaultTZPosition = 0;
|
||||
|
||||
gTimeZoneBufferPtr = searchForTZFile(TZZONEINFO, tzInfo);
|
||||
|
||||
/* Free previously allocated memory */
|
||||
if (tzInfo->defaultTZBuffer != NULL) {
|
||||
if (tzInfo->defaultTZBuffer != nullptr) {
|
||||
uprv_free(tzInfo->defaultTZBuffer);
|
||||
}
|
||||
if (tzInfo->defaultTZFilePtr != NULL) {
|
||||
if (tzInfo->defaultTZFilePtr != nullptr) {
|
||||
fclose(tzInfo->defaultTZFilePtr);
|
||||
}
|
||||
uprv_free(tzInfo);
|
||||
}
|
||||
|
||||
if (gTimeZoneBufferPtr != NULL && isValidOlsonID(gTimeZoneBufferPtr)) {
|
||||
if (gTimeZoneBufferPtr != nullptr && isValidOlsonID(gTimeZoneBufferPtr)) {
|
||||
return gTimeZoneBufferPtr;
|
||||
}
|
||||
#endif
|
||||
|
@ -1247,7 +1247,7 @@ uprv_tzname(int n)
|
|||
daylightType = U_DAYLIGHT_NONE;
|
||||
}
|
||||
tzid = remapShortTimeZone(U_TZNAME[0], U_TZNAME[1], daylightType, uprv_timezone());
|
||||
if (tzid != NULL) {
|
||||
if (tzid != nullptr) {
|
||||
return tzid;
|
||||
}
|
||||
}
|
||||
|
@ -1261,13 +1261,13 @@ uprv_tzname(int n)
|
|||
/* Get and set the ICU data directory --------------------------------------- */
|
||||
|
||||
static icu::UInitOnce gDataDirInitOnce {};
|
||||
static char *gDataDirectory = NULL;
|
||||
static char *gDataDirectory = nullptr;
|
||||
|
||||
UInitOnce gTimeZoneFilesInitOnce {};
|
||||
static CharString *gTimeZoneFilesDirectory = NULL;
|
||||
static CharString *gTimeZoneFilesDirectory = nullptr;
|
||||
|
||||
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
|
||||
static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */
|
||||
static const char *gCorrectedPOSIXLocale = nullptr; /* Sometimes heap allocated */
|
||||
static bool gCorrectedPOSIXLocaleHeapAllocated = false;
|
||||
#endif
|
||||
|
||||
|
@ -1276,22 +1276,22 @@ static UBool U_CALLCONV putil_cleanup(void)
|
|||
if (gDataDirectory && *gDataDirectory) {
|
||||
uprv_free(gDataDirectory);
|
||||
}
|
||||
gDataDirectory = NULL;
|
||||
gDataDirectory = nullptr;
|
||||
gDataDirInitOnce.reset();
|
||||
|
||||
delete gTimeZoneFilesDirectory;
|
||||
gTimeZoneFilesDirectory = NULL;
|
||||
gTimeZoneFilesDirectory = nullptr;
|
||||
gTimeZoneFilesInitOnce.reset();
|
||||
|
||||
#ifdef SEARCH_TZFILE
|
||||
delete gSearchTZFileResult;
|
||||
gSearchTZFileResult = NULL;
|
||||
gSearchTZFileResult = nullptr;
|
||||
#endif
|
||||
|
||||
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
|
||||
if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) {
|
||||
uprv_free(const_cast<char *>(gCorrectedPOSIXLocale));
|
||||
gCorrectedPOSIXLocale = NULL;
|
||||
gCorrectedPOSIXLocale = nullptr;
|
||||
gCorrectedPOSIXLocaleHeapAllocated = false;
|
||||
}
|
||||
#endif
|
||||
|
@ -1307,9 +1307,9 @@ u_setDataDirectory(const char *directory) {
|
|||
char *newDataDir;
|
||||
int32_t length;
|
||||
|
||||
if(directory==NULL || *directory==0) {
|
||||
if(directory==nullptr || *directory==0) {
|
||||
/* A small optimization to prevent the malloc and copy when the
|
||||
shared library is used, and this is a way to make sure that NULL
|
||||
shared library is used, and this is a way to make sure that nullptr
|
||||
is never returned.
|
||||
*/
|
||||
newDataDir = (char *)"";
|
||||
|
@ -1318,7 +1318,7 @@ u_setDataDirectory(const char *directory) {
|
|||
length=(int32_t)uprv_strlen(directory);
|
||||
newDataDir = (char *)uprv_malloc(length + 2);
|
||||
/* Exit out if newDataDir could not be created. */
|
||||
if (newDataDir == NULL) {
|
||||
if (newDataDir == nullptr) {
|
||||
return;
|
||||
}
|
||||
uprv_strcpy(newDataDir, directory);
|
||||
|
@ -1326,7 +1326,7 @@ u_setDataDirectory(const char *directory) {
|
|||
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
|
||||
{
|
||||
char *p;
|
||||
while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) {
|
||||
while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != nullptr) {
|
||||
*p = U_FILE_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
|
@ -1419,7 +1419,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
|
|||
return;
|
||||
}
|
||||
|
||||
const char *path = NULL;
|
||||
const char *path = nullptr;
|
||||
#if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
|
||||
char datadir_path_buffer[PATH_MAX];
|
||||
#endif
|
||||
|
@ -1452,7 +1452,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
|
|||
* set their own path.
|
||||
*/
|
||||
#if defined(ICU_DATA_DIR) || defined(U_ICU_DATA_DEFAULT_DIR)
|
||||
if(path==NULL || *path==0) {
|
||||
if(path==nullptr || *path==0) {
|
||||
# if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
|
||||
const char *prefix = getenv(ICU_DATA_DIR_PREFIX_ENV_VAR);
|
||||
# endif
|
||||
|
@ -1462,7 +1462,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
|
|||
path=U_ICU_DATA_DEFAULT_DIR;
|
||||
# endif
|
||||
# if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
|
||||
if (prefix != NULL) {
|
||||
if (prefix != nullptr) {
|
||||
snprintf(datadir_path_buffer, sizeof(datadir_path_buffer), "%s%s", prefix, path);
|
||||
path=datadir_path_buffer;
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
|
|||
}
|
||||
#endif
|
||||
|
||||
if(path==NULL) {
|
||||
if(path==nullptr) {
|
||||
/* It looks really bad, set it to something. */
|
||||
path = "";
|
||||
}
|
||||
|
@ -1500,7 +1500,7 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
|
|||
gTimeZoneFilesDirectory->append(path, status);
|
||||
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
|
||||
char *p = gTimeZoneFilesDirectory->data();
|
||||
while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) {
|
||||
while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != nullptr) {
|
||||
*p = U_FILE_SEP_CHAR;
|
||||
}
|
||||
#endif
|
||||
|
@ -1510,10 +1510,10 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
|
|||
#define TO_STRING_2(x) #x
|
||||
|
||||
static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
|
||||
U_ASSERT(gTimeZoneFilesDirectory == NULL);
|
||||
U_ASSERT(gTimeZoneFilesDirectory == nullptr);
|
||||
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
|
||||
gTimeZoneFilesDirectory = new CharString();
|
||||
if (gTimeZoneFilesDirectory == NULL) {
|
||||
if (gTimeZoneFilesDirectory == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1541,18 +1541,18 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
|
|||
#endif // U_PLATFORM_HAS_WINUWP_API
|
||||
|
||||
#if defined(U_TIMEZONE_FILES_DIR)
|
||||
if (dir == NULL) {
|
||||
if (dir == nullptr) {
|
||||
// Build time configuration setting.
|
||||
dir = TO_STRING(U_TIMEZONE_FILES_DIR);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dir == NULL) {
|
||||
if (dir == nullptr) {
|
||||
dir = "";
|
||||
}
|
||||
|
||||
#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
|
||||
if (prefix != NULL) {
|
||||
if (prefix != nullptr) {
|
||||
snprintf(timezonefilesdir_path_buffer, sizeof(timezonefilesdir_path_buffer), "%s%s", prefix, dir);
|
||||
dir = timezonefilesdir_path_buffer;
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status) {
|
|||
*/
|
||||
static const char *uprv_getPOSIXIDForCategory(int category)
|
||||
{
|
||||
const char* posixID = NULL;
|
||||
const char* posixID = nullptr;
|
||||
if (category == LC_MESSAGES || category == LC_CTYPE) {
|
||||
/*
|
||||
* On Solaris two different calls to setlocale can result in
|
||||
|
@ -1596,7 +1596,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
|
|||
*
|
||||
* LC_ALL can't be used because it's platform dependent. The LANG
|
||||
* environment variable seems to affect LC_CTYPE variable by default.
|
||||
* Here is what setlocale(LC_ALL, NULL) can return.
|
||||
* Here is what setlocale(LC_ALL, nullptr) can return.
|
||||
* HPUX can return 'C C C C C C C'
|
||||
* Solaris can return /en_US/C/C/C/C/C on the second try.
|
||||
* Linux can return LC_CTYPE=C;LC_NUMERIC=C;...
|
||||
|
@ -1604,9 +1604,9 @@ static const char *uprv_getPOSIXIDForCategory(int category)
|
|||
* The default codepage detection also needs to use LC_CTYPE.
|
||||
*
|
||||
* Do not call setlocale(LC_*, "")! Using an empty string instead
|
||||
* of NULL, will modify the libc behavior.
|
||||
* of nullptr, will modify the libc behavior.
|
||||
*/
|
||||
posixID = setlocale(category, NULL);
|
||||
posixID = setlocale(category, nullptr);
|
||||
if ((posixID == 0)
|
||||
|| (uprv_strcmp("C", posixID) == 0)
|
||||
|| (uprv_strcmp("POSIX", posixID) == 0))
|
||||
|
@ -1649,7 +1649,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
|
|||
*/
|
||||
static const char *uprv_getPOSIXIDForDefaultLocale(void)
|
||||
{
|
||||
static const char* posixID = NULL;
|
||||
static const char* posixID = nullptr;
|
||||
if (posixID == 0) {
|
||||
posixID = uprv_getPOSIXIDForCategory(LC_MESSAGES);
|
||||
}
|
||||
|
@ -1662,7 +1662,7 @@ static const char *uprv_getPOSIXIDForDefaultLocale(void)
|
|||
*/
|
||||
static const char *uprv_getPOSIXIDForDefaultCodepage(void)
|
||||
{
|
||||
static const char* posixID = NULL;
|
||||
static const char* posixID = nullptr;
|
||||
if (posixID == 0) {
|
||||
posixID = uprv_getPOSIXIDForCategory(LC_CTYPE);
|
||||
}
|
||||
|
@ -1861,16 +1861,16 @@ The leftmost codepage (.xxx) wins.
|
|||
const char *localeID = getenv("LC_ALL");
|
||||
char *p;
|
||||
|
||||
if (localeID == NULL)
|
||||
if (localeID == nullptr)
|
||||
localeID = getenv("LANG");
|
||||
if (localeID == NULL)
|
||||
localeID = setlocale(LC_ALL, NULL);
|
||||
if (localeID == nullptr)
|
||||
localeID = setlocale(LC_ALL, nullptr);
|
||||
/* Make sure we have something... */
|
||||
if (localeID == NULL)
|
||||
if (localeID == nullptr)
|
||||
return "en_US_POSIX";
|
||||
|
||||
/* Extract the locale name from the path. */
|
||||
if((p = uprv_strrchr(localeID, '/')) != NULL)
|
||||
if((p = uprv_strrchr(localeID, '/')) != nullptr)
|
||||
{
|
||||
/* Increment p to start of locale name. */
|
||||
p++;
|
||||
|
@ -1881,7 +1881,7 @@ The leftmost codepage (.xxx) wins.
|
|||
uprv_strcpy(correctedLocale, localeID);
|
||||
|
||||
/* Strip off the '.locale' extension. */
|
||||
if((p = uprv_strchr(correctedLocale, '.')) != NULL) {
|
||||
if((p = uprv_strchr(correctedLocale, '.')) != nullptr) {
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
|
@ -1961,12 +1961,12 @@ names to the ICU alias table in the data directory.
|
|||
*/
|
||||
static const char*
|
||||
remapPlatformDependentCodepage(const char *locale, const char *name) {
|
||||
if (locale != NULL && *locale == 0) {
|
||||
if (locale != nullptr && *locale == 0) {
|
||||
/* Make sure that an empty locale is handled the same way. */
|
||||
locale = NULL;
|
||||
locale = nullptr;
|
||||
}
|
||||
if (name == NULL) {
|
||||
return NULL;
|
||||
if (name == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
#if U_PLATFORM == U_PF_AIX
|
||||
if (uprv_strcmp(name, "IBM-943") == 0) {
|
||||
|
@ -1978,7 +1978,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
name = "IBM-5348";
|
||||
}
|
||||
#elif U_PLATFORM == U_PF_SOLARIS
|
||||
if (locale != NULL && uprv_strcmp(name, "EUC") == 0) {
|
||||
if (locale != nullptr && uprv_strcmp(name, "EUC") == 0) {
|
||||
/* Solaris underspecifies the "EUC" name. */
|
||||
if (uprv_strcmp(locale, "zh_CN") == 0) {
|
||||
name = "EUC-CN";
|
||||
|
@ -2005,7 +2005,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
name = "ISO-8859-1";
|
||||
}
|
||||
#elif U_PLATFORM_IS_DARWIN_BASED
|
||||
if (locale == NULL && *name == 0) {
|
||||
if (locale == nullptr && *name == 0) {
|
||||
/*
|
||||
No locale was specified, and an empty name was passed in.
|
||||
This usually indicates that nl_langinfo didn't return valid information.
|
||||
|
@ -2017,7 +2017,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
/* Remap CP949 to a similar codepage to avoid issues with backslash and won symbol. */
|
||||
name = "EUC-KR";
|
||||
}
|
||||
else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) {
|
||||
else if (locale != nullptr && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) {
|
||||
/*
|
||||
* For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII.
|
||||
*/
|
||||
|
@ -2029,7 +2029,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
name = "EUC-KR";
|
||||
}
|
||||
#elif U_PLATFORM == U_PF_HPUX
|
||||
if (locale != NULL && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) {
|
||||
if (locale != nullptr && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) {
|
||||
/* HP decided to extend big5 as hkbig5 even though it's not compatible :-( */
|
||||
/* zh_TW.big5 is not the same charset as zh_HK.big5! */
|
||||
name = "hkbig5";
|
||||
|
@ -2043,7 +2043,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
name = "eucjis";
|
||||
}
|
||||
#elif U_PLATFORM == U_PF_LINUX
|
||||
if (locale != NULL && uprv_strcmp(name, "euc") == 0) {
|
||||
if (locale != nullptr && uprv_strcmp(name, "euc") == 0) {
|
||||
/* Linux underspecifies the "EUC" name. */
|
||||
if (uprv_strcmp(locale, "korean") == 0) {
|
||||
name = "EUC-KR";
|
||||
|
@ -2061,7 +2061,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
*/
|
||||
name = "eucjis";
|
||||
}
|
||||
else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 &&
|
||||
else if (locale != nullptr && uprv_strcmp(locale, "en_US_POSIX") != 0 &&
|
||||
(uprv_strcmp(name, "ANSI_X3.4-1968") == 0 || uprv_strcmp(name, "US-ASCII") == 0)) {
|
||||
/*
|
||||
* For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII.
|
||||
|
@ -2070,13 +2070,13 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
|
|||
}
|
||||
/*
|
||||
* Linux returns ANSI_X3.4-1968 for C/POSIX, but the call site takes care of
|
||||
* it by falling back to 'US-ASCII' when NULL is returned from this
|
||||
* it by falling back to 'US-ASCII' when nullptr is returned from this
|
||||
* function. So, we don't have to worry about it here.
|
||||
*/
|
||||
#endif
|
||||
/* return NULL when "" is passed in */
|
||||
/* return nullptr when "" is passed in */
|
||||
if (*name == 0) {
|
||||
name = NULL;
|
||||
name = nullptr;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
@ -2085,16 +2085,16 @@ static const char*
|
|||
getCodepageFromPOSIXID(const char *localeName, char * buffer, int32_t buffCapacity)
|
||||
{
|
||||
char localeBuf[100];
|
||||
const char *name = NULL;
|
||||
char *variant = NULL;
|
||||
const char *name = nullptr;
|
||||
char *variant = nullptr;
|
||||
|
||||
if (localeName != NULL && (name = (uprv_strchr(localeName, '.'))) != NULL) {
|
||||
if (localeName != nullptr && (name = (uprv_strchr(localeName, '.'))) != nullptr) {
|
||||
size_t localeCapacity = uprv_min(sizeof(localeBuf), (name-localeName)+1);
|
||||
uprv_strncpy(localeBuf, localeName, localeCapacity);
|
||||
localeBuf[localeCapacity-1] = 0; /* ensure NULL termination */
|
||||
localeBuf[localeCapacity-1] = 0; /* ensure NUL termination */
|
||||
name = uprv_strncpy(buffer, name+1, buffCapacity);
|
||||
buffer[buffCapacity-1] = 0; /* ensure NULL termination */
|
||||
if ((variant = const_cast<char *>(uprv_strchr(name, '@'))) != NULL) {
|
||||
buffer[buffCapacity-1] = 0; /* ensure NUL termination */
|
||||
if ((variant = const_cast<char *>(uprv_strchr(name, '@'))) != nullptr) {
|
||||
*variant = 0;
|
||||
}
|
||||
name = remapPlatformDependentCodepage(localeBuf, name);
|
||||
|
@ -2132,7 +2132,7 @@ int_getDefaultCodepage()
|
|||
|
||||
strncpy(codepage, nl_langinfo(CODESET),63-strlen(UCNV_SWAP_LFNL_OPTION_STRING));
|
||||
strcat(codepage,UCNV_SWAP_LFNL_OPTION_STRING);
|
||||
codepage[63] = 0; /* NULL terminate */
|
||||
codepage[63] = 0; /* NUL terminate */
|
||||
|
||||
return codepage;
|
||||
|
||||
|
@ -2169,8 +2169,8 @@ int_getDefaultCodepage()
|
|||
|
||||
#elif U_POSIX_LOCALE
|
||||
static char codesetName[100];
|
||||
const char *localeName = NULL;
|
||||
const char *name = NULL;
|
||||
const char *localeName = nullptr;
|
||||
const char *name = nullptr;
|
||||
|
||||
localeName = uprv_getPOSIXIDForDefaultCodepage();
|
||||
uprv_memset(codesetName, 0, sizeof(codesetName));
|
||||
|
@ -2193,10 +2193,10 @@ int_getDefaultCodepage()
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
codeset = remapPlatformDependentCodepage(NULL, codeset);
|
||||
codeset = remapPlatformDependentCodepage(nullptr, codeset);
|
||||
}
|
||||
|
||||
if (codeset != NULL) {
|
||||
if (codeset != nullptr) {
|
||||
uprv_strncpy(codesetName, codeset, sizeof(codesetName));
|
||||
codesetName[sizeof(codesetName)-1] = 0;
|
||||
return codesetName;
|
||||
|
@ -2229,12 +2229,12 @@ int_getDefaultCodepage()
|
|||
U_CAPI const char* U_EXPORT2
|
||||
uprv_getDefaultCodepage()
|
||||
{
|
||||
static char const *name = NULL;
|
||||
umtx_lock(NULL);
|
||||
if (name == NULL) {
|
||||
static char const *name = nullptr;
|
||||
umtx_lock(nullptr);
|
||||
if (name == nullptr) {
|
||||
name = int_getDefaultCodepage();
|
||||
}
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
return name;
|
||||
}
|
||||
#endif /* !U_CHARSET_IS_UTF8 */
|
||||
|
@ -2249,11 +2249,11 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) {
|
|||
char *end;
|
||||
uint16_t part=0;
|
||||
|
||||
if(versionArray==NULL) {
|
||||
if(versionArray==nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(versionString!=NULL) {
|
||||
if(versionString!=nullptr) {
|
||||
for(;;) {
|
||||
versionArray[part]=(uint8_t)uprv_strtoul(versionString, &end, 10);
|
||||
if(end==versionString || ++part==U_MAX_VERSION_LENGTH || *end!=U_VERSION_DELIMITER) {
|
||||
|
@ -2270,7 +2270,7 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_versionFromUString(UVersionInfo versionArray, const UChar *versionString) {
|
||||
if(versionArray!=NULL && versionString!=NULL) {
|
||||
if(versionArray!=nullptr && versionString!=nullptr) {
|
||||
char versionChars[U_MAX_VERSION_STRING_LENGTH+1];
|
||||
int32_t len = u_strlen(versionString);
|
||||
if(len>U_MAX_VERSION_STRING_LENGTH) {
|
||||
|
@ -2287,11 +2287,11 @@ u_versionToString(const UVersionInfo versionArray, char *versionString) {
|
|||
uint16_t count, part;
|
||||
uint8_t field;
|
||||
|
||||
if(versionString==NULL) {
|
||||
if(versionString==nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(versionArray==NULL) {
|
||||
if(versionArray==nullptr) {
|
||||
versionString[0]=0;
|
||||
return;
|
||||
}
|
||||
|
@ -2362,10 +2362,10 @@ u_getVersion(UVersionInfo versionArray) {
|
|||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
void *ret = NULL;
|
||||
void *ret = nullptr;
|
||||
if(U_FAILURE(*status)) return ret;
|
||||
ret = dlopen(libName, RTLD_NOW|RTLD_GLOBAL);
|
||||
if(ret==NULL) {
|
||||
if(ret==nullptr) {
|
||||
#ifdef U_TRACE_DYLOAD
|
||||
printf("dlerror on dlopen(%s): %s\n", libName, dlerror());
|
||||
#endif
|
||||
|
@ -2386,10 +2386,10 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
UVoidFunction *fp;
|
||||
void *vp;
|
||||
} uret;
|
||||
uret.fp = NULL;
|
||||
uret.fp = nullptr;
|
||||
if(U_FAILURE(*status)) return uret.fp;
|
||||
uret.vp = dlsym(lib, sym);
|
||||
if(uret.vp == NULL) {
|
||||
if(uret.vp == nullptr) {
|
||||
#ifdef U_TRACE_DYLOAD
|
||||
printf("dlerror on dlsym(%p,%s): %s\n", lib,sym, dlerror());
|
||||
#endif
|
||||
|
@ -2405,13 +2405,13 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
HMODULE lib = NULL;
|
||||
HMODULE lib = nullptr;
|
||||
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
if(U_FAILURE(*status)) return nullptr;
|
||||
|
||||
lib = LoadLibraryA(libName);
|
||||
|
||||
if(lib==NULL) {
|
||||
if(lib==nullptr) {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
}
|
||||
|
||||
|
@ -2431,13 +2431,13 @@ uprv_dl_close(void *lib, UErrorCode *status) {
|
|||
U_CAPI UVoidFunction* U_EXPORT2
|
||||
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
HMODULE handle = (HMODULE)lib;
|
||||
UVoidFunction* addr = NULL;
|
||||
UVoidFunction* addr = nullptr;
|
||||
|
||||
if(U_FAILURE(*status) || lib==NULL) return NULL;
|
||||
if(U_FAILURE(*status) || lib==nullptr) return nullptr;
|
||||
|
||||
addr = (UVoidFunction*)GetProcAddress(handle, sym);
|
||||
|
||||
if(addr==NULL) {
|
||||
if(addr==nullptr) {
|
||||
DWORD lastError = GetLastError();
|
||||
if(lastError == ERROR_PROC_NOT_FOUND) {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
|
@ -2456,9 +2456,9 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
U_CAPI void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
(void)libName;
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
if(U_FAILURE(*status)) return nullptr;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
|
@ -2476,7 +2476,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
|||
if(U_SUCCESS(*status)) {
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
}
|
||||
return (UVoidFunction*)NULL;
|
||||
return (UVoidFunction*)nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -177,13 +177,13 @@ U_NAMESPACE_BEGIN
|
|||
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ResourceBundle)
|
||||
|
||||
ResourceBundle::ResourceBundle(UErrorCode &err)
|
||||
:UObject(), fLocale(NULL)
|
||||
:UObject(), fLocale(nullptr)
|
||||
{
|
||||
fResource = ures_open(0, Locale::getDefault().getName(), &err);
|
||||
}
|
||||
|
||||
ResourceBundle::ResourceBundle(const ResourceBundle &other)
|
||||
:UObject(other), fLocale(NULL)
|
||||
:UObject(other), fLocale(nullptr)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
@ -191,23 +191,23 @@ ResourceBundle::ResourceBundle(const ResourceBundle &other)
|
|||
fResource = ures_copyResb(0, other.fResource, &status);
|
||||
} else {
|
||||
/* Copying a bad resource bundle */
|
||||
fResource = NULL;
|
||||
fResource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err)
|
||||
:UObject(), fLocale(NULL)
|
||||
:UObject(), fLocale(nullptr)
|
||||
{
|
||||
if (res) {
|
||||
fResource = ures_copyResb(0, res, &err);
|
||||
} else {
|
||||
/* Copying a bad resource bundle */
|
||||
fResource = NULL;
|
||||
fResource = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err)
|
||||
:UObject(), fLocale(NULL)
|
||||
:UObject(), fLocale(nullptr)
|
||||
{
|
||||
fResource = ures_open(path, locale.getName(), &err);
|
||||
}
|
||||
|
@ -220,18 +220,18 @@ ResourceBundle& ResourceBundle::operator=(const ResourceBundle& other)
|
|||
}
|
||||
if(fResource != 0) {
|
||||
ures_close(fResource);
|
||||
fResource = NULL;
|
||||
fResource = nullptr;
|
||||
}
|
||||
if (fLocale != NULL) {
|
||||
if (fLocale != nullptr) {
|
||||
delete fLocale;
|
||||
fLocale = NULL;
|
||||
fLocale = nullptr;
|
||||
}
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
if (other.fResource) {
|
||||
fResource = ures_copyResb(0, other.fResource, &status);
|
||||
} else {
|
||||
/* Copying a bad resource bundle */
|
||||
fResource = NULL;
|
||||
fResource = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ ResourceBundle::~ResourceBundle()
|
|||
if(fResource != 0) {
|
||||
ures_close(fResource);
|
||||
}
|
||||
if(fLocale != NULL) {
|
||||
if(fLocale != nullptr) {
|
||||
delete(fLocale);
|
||||
}
|
||||
}
|
||||
|
@ -380,14 +380,14 @@ void ResourceBundle::getVersion(UVersionInfo versionInfo) const {
|
|||
const Locale &ResourceBundle::getLocale(void) const {
|
||||
static UMutex gLocaleLock;
|
||||
Mutex lock(&gLocaleLock);
|
||||
if (fLocale != NULL) {
|
||||
if (fLocale != nullptr) {
|
||||
return *fLocale;
|
||||
}
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
const char *localeName = ures_getLocaleInternal(fResource, &status);
|
||||
ResourceBundle *ncThis = const_cast<ResourceBundle *>(this);
|
||||
ncThis->fLocale = new Locale(localeName);
|
||||
return ncThis->fLocale != NULL ? *ncThis->fLocale : Locale::getDefault();
|
||||
return ncThis->fLocale != nullptr ? *ncThis->fLocale : Locale::getDefault();
|
||||
}
|
||||
|
||||
const Locale ResourceBundle::getLocale(ULocDataLocaleType type, UErrorCode &status) const
|
||||
|
|
|
@ -27,14 +27,14 @@ U_NAMESPACE_BEGIN
|
|||
ResourceBundle::ResourceBundle( const UnicodeString& path,
|
||||
const Locale& locale,
|
||||
UErrorCode& error)
|
||||
:UObject(), fLocale(NULL)
|
||||
:UObject(), fLocale(nullptr)
|
||||
{
|
||||
constructForLocale(path, locale, error);
|
||||
}
|
||||
|
||||
ResourceBundle::ResourceBundle( const UnicodeString& path,
|
||||
UErrorCode& error)
|
||||
:UObject(), fLocale(NULL)
|
||||
:UObject(), fLocale(nullptr)
|
||||
{
|
||||
constructForLocale(path, Locale::getDefault(), error);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ ResourceBundle::constructForLocale(const UnicodeString& path,
|
|||
UErrorCode& error)
|
||||
{
|
||||
if (path.isEmpty()) {
|
||||
fResource = ures_open(NULL, locale.getName(), &error);
|
||||
fResource = ures_open(nullptr, locale.getName(), &error);
|
||||
}
|
||||
else {
|
||||
UnicodeString nullTerminatedPath(path);
|
||||
|
|
|
@ -45,7 +45,7 @@ class ResourceValue;
|
|||
class U_COMMON_API ResourceArray {
|
||||
public:
|
||||
/** Constructs an empty array object. */
|
||||
ResourceArray() : items16(NULL), items32(NULL), length(0) {}
|
||||
ResourceArray() : items16(nullptr), items32(nullptr), length(0) {}
|
||||
|
||||
/** Only for implementation use. @internal */
|
||||
ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len,
|
||||
|
@ -80,7 +80,7 @@ private:
|
|||
class U_COMMON_API ResourceTable {
|
||||
public:
|
||||
/** Constructs an empty table object. */
|
||||
ResourceTable() : keys16(NULL), keys32(NULL), items16(NULL), items32(NULL), length(0) {}
|
||||
ResourceTable() : keys16(nullptr), keys32(nullptr), items16(nullptr), items32(nullptr), length(0) {}
|
||||
|
||||
/** Only for implementation use. @internal */
|
||||
ResourceTable(const uint16_t *k16, const int32_t *k32,
|
||||
|
|
|
@ -144,7 +144,7 @@ SimpleFactory::create(const ICUServiceKey& key, const ICUService* service, UErro
|
|||
return service->cloneInstance(_instance);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
CacheEntry* unref() {
|
||||
if ((--refcount) == 0) {
|
||||
delete this;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -294,14 +294,14 @@ StringPair::create(const UnicodeString& displayName,
|
|||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
StringPair* sp = new StringPair(displayName, id);
|
||||
if (sp == NULL || sp->isBogus()) {
|
||||
if (sp == nullptr || sp->isBogus()) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete sp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UBool
|
||||
|
@ -332,20 +332,20 @@ static UMutex lock;
|
|||
ICUService::ICUService()
|
||||
: name()
|
||||
, timestamp(0)
|
||||
, factories(NULL)
|
||||
, serviceCache(NULL)
|
||||
, idCache(NULL)
|
||||
, dnCache(NULL)
|
||||
, factories(nullptr)
|
||||
, serviceCache(nullptr)
|
||||
, idCache(nullptr)
|
||||
, dnCache(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
ICUService::ICUService(const UnicodeString& newName)
|
||||
: name(newName)
|
||||
, timestamp(0)
|
||||
, factories(NULL)
|
||||
, serviceCache(NULL)
|
||||
, idCache(NULL)
|
||||
, dnCache(NULL)
|
||||
, factories(nullptr)
|
||||
, serviceCache(nullptr)
|
||||
, idCache(nullptr)
|
||||
, dnCache(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -355,20 +355,20 @@ ICUService::~ICUService()
|
|||
Mutex mutex(&lock);
|
||||
clearCaches();
|
||||
delete factories;
|
||||
factories = NULL;
|
||||
factories = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
UObject*
|
||||
ICUService::get(const UnicodeString& descriptor, UErrorCode& status) const
|
||||
{
|
||||
return get(descriptor, NULL, status);
|
||||
return get(descriptor, nullptr, status);
|
||||
}
|
||||
|
||||
UObject*
|
||||
ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const
|
||||
{
|
||||
UObject* result = NULL;
|
||||
UObject* result = nullptr;
|
||||
ICUServiceKey* key = createKey(&descriptor, status);
|
||||
if (key) {
|
||||
result = getKey(*key, actualReturn, status);
|
||||
|
@ -380,7 +380,7 @@ ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UE
|
|||
UObject*
|
||||
ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
|
||||
{
|
||||
return getKey(key, NULL, status);
|
||||
return getKey(key, nullptr, status);
|
||||
}
|
||||
|
||||
// this is a vector that subclasses of ICUService can override to further customize the result object
|
||||
|
@ -389,7 +389,7 @@ ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
|
|||
UObject*
|
||||
ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const
|
||||
{
|
||||
return getKey(key, actualReturn, NULL, status);
|
||||
return getKey(key, actualReturn, nullptr, status);
|
||||
}
|
||||
|
||||
// make it possible to call reentrantly on systems that don't have reentrant mutexes.
|
||||
|
@ -417,7 +417,7 @@ UObject*
|
|||
ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const
|
||||
{
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (isDefault()) {
|
||||
|
@ -426,7 +426,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
|
||||
ICUService* ncthis = (ICUService*)this; // cast away semantic const
|
||||
|
||||
CacheEntry* result = NULL;
|
||||
CacheEntry* result = nullptr;
|
||||
{
|
||||
// The factory list can't be modified until we're done,
|
||||
// otherwise we might update the cache with an invalid result.
|
||||
|
@ -437,17 +437,17 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
// if factory is not null, we're calling from within the mutex,
|
||||
// and since some unix machines don't have reentrant mutexes we
|
||||
// need to make sure not to try to lock it again.
|
||||
XMutex mutex(&lock, factory != NULL);
|
||||
XMutex mutex(&lock, factory != nullptr);
|
||||
|
||||
if (serviceCache == NULL) {
|
||||
if (serviceCache == nullptr) {
|
||||
ncthis->serviceCache = new Hashtable(status);
|
||||
if (ncthis->serviceCache == NULL) {
|
||||
if (ncthis->serviceCache == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
delete serviceCache;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
serviceCache->setValueDeleter(cacheDeleter);
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
int32_t limit = factories->size();
|
||||
UBool cacheResult = true;
|
||||
|
||||
if (factory != NULL) {
|
||||
if (factory != nullptr) {
|
||||
for (int32_t i = 0; i < limit; ++i) {
|
||||
if (factory == (const ICUServiceFactory*)factories->elementAt(i)) {
|
||||
startIndex = i + 1;
|
||||
|
@ -470,7 +470,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
if (startIndex == 0) {
|
||||
// throw new InternalError("Factory " + factory + "not registered with service: " + this);
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
cacheResult = false;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
currentDescriptor.remove();
|
||||
key.currentDescriptor(currentDescriptor);
|
||||
result = (CacheEntry*)serviceCache->get(currentDescriptor);
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -493,13 +493,13 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(index++);
|
||||
LocalPointer<UObject> service(f->create(key, this, status));
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (service.isValid()) {
|
||||
result = new CacheEntry(currentDescriptor, service.getAlias());
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
service.orphan(); // result now owns service.
|
||||
|
||||
|
@ -513,32 +513,32 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
|
|||
// fallback to the one that succeeded, we want to hit the
|
||||
// cache the first time next goaround.
|
||||
if (cacheDescriptorList.isNull()) {
|
||||
cacheDescriptorList.adoptInsteadAndCheckErrorCode(new UVector(uprv_deleteUObject, NULL, 5, status), status);
|
||||
cacheDescriptorList.adoptInsteadAndCheckErrorCode(new UVector(uprv_deleteUObject, nullptr, 5, status), status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
LocalPointer<UnicodeString> idToCache(new UnicodeString(currentDescriptor), status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (idToCache->isBogus()) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
cacheDescriptorList->adoptElement(idToCache.orphan(), status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} while (key.fallback());
|
||||
outerEnd:
|
||||
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
if (putInCache && cacheResult) {
|
||||
serviceCache->put(result->actualDescriptor, result, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (cacheDescriptorList.isValid()) {
|
||||
|
@ -547,7 +547,7 @@ outerEnd:
|
|||
|
||||
serviceCache->put(*desc, result, status);
|
||||
if (U_FAILURE(status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
result->ref();
|
||||
|
@ -556,7 +556,7 @@ outerEnd:
|
|||
}
|
||||
}
|
||||
|
||||
if (actualReturn != NULL) {
|
||||
if (actualReturn != nullptr) {
|
||||
// strip null prefix
|
||||
if (result->actualDescriptor.indexOf((UChar)0x2f) == 0) { // U+002f=slash (/)
|
||||
actualReturn->remove();
|
||||
|
@ -570,7 +570,7 @@ outerEnd:
|
|||
if (actualReturn->isBogus()) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete result;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -588,12 +588,12 @@ outerEnd:
|
|||
UObject*
|
||||
ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UVector&
|
||||
ICUService::getVisibleIDs(UVector& result, UErrorCode& status) const {
|
||||
return getVisibleIDs(result, NULL, status);
|
||||
return getVisibleIDs(result, nullptr, status);
|
||||
}
|
||||
|
||||
UVector&
|
||||
|
@ -609,17 +609,17 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
|
|||
{
|
||||
Mutex mutex(&lock);
|
||||
const Hashtable* map = getVisibleIDMap(status);
|
||||
if (map != NULL) {
|
||||
if (map != nullptr) {
|
||||
ICUServiceKey* fallbackKey = createKey(matchID, status);
|
||||
|
||||
for (int32_t pos = UHASH_FIRST; U_SUCCESS(status); ) {
|
||||
const UHashElement* e = map->nextElement(pos);
|
||||
if (e == NULL) {
|
||||
if (e == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
const UnicodeString* id = (const UnicodeString*)e->key.pointer;
|
||||
if (fallbackKey != NULL) {
|
||||
if (fallbackKey != nullptr) {
|
||||
if (!fallbackKey->isFallbackOf(*id)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -640,23 +640,23 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
|
|||
|
||||
const Hashtable*
|
||||
ICUService::getVisibleIDMap(UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) return NULL;
|
||||
if (U_FAILURE(status)) return nullptr;
|
||||
|
||||
// must only be called when lock is already held
|
||||
|
||||
ICUService* ncthis = (ICUService*)this; // cast away semantic const
|
||||
if (idCache == NULL) {
|
||||
if (idCache == nullptr) {
|
||||
ncthis->idCache = new Hashtable(status);
|
||||
if (idCache == NULL) {
|
||||
if (idCache == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
} else if (factories != NULL) {
|
||||
} else if (factories != nullptr) {
|
||||
for (int32_t pos = factories->size(); --pos >= 0;) {
|
||||
ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(pos);
|
||||
f->updateVisibleIDs(*idCache, status);
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
delete idCache;
|
||||
ncthis->idCache = NULL;
|
||||
ncthis->idCache = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -678,9 +678,9 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
|
|||
UErrorCode status = U_ZERO_ERROR;
|
||||
Mutex mutex(&lock);
|
||||
const Hashtable* map = getVisibleIDMap(status);
|
||||
if (map != NULL) {
|
||||
if (map != nullptr) {
|
||||
ICUServiceFactory* f = (ICUServiceFactory*)map->get(id);
|
||||
if (f != NULL) {
|
||||
if (f != nullptr) {
|
||||
f->getDisplayName(id, locale, result);
|
||||
return result;
|
||||
}
|
||||
|
@ -688,11 +688,11 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
|
|||
// fallback
|
||||
status = U_ZERO_ERROR;
|
||||
ICUServiceKey* fallbackKey = createKey(&id, status);
|
||||
while (fallbackKey != NULL && fallbackKey->fallback()) {
|
||||
while (fallbackKey != nullptr && fallbackKey->fallback()) {
|
||||
UnicodeString us;
|
||||
fallbackKey->currentID(us);
|
||||
f = (ICUServiceFactory*)map->get(us);
|
||||
if (f != NULL) {
|
||||
if (f != nullptr) {
|
||||
f->getDisplayName(id, locale, result);
|
||||
delete fallbackKey;
|
||||
return result;
|
||||
|
@ -708,14 +708,14 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
|
|||
UVector&
|
||||
ICUService::getDisplayNames(UVector& result, UErrorCode& status) const
|
||||
{
|
||||
return getDisplayNames(result, Locale::getDefault(), NULL, status);
|
||||
return getDisplayNames(result, Locale::getDefault(), nullptr, status);
|
||||
}
|
||||
|
||||
|
||||
UVector&
|
||||
ICUService::getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const
|
||||
{
|
||||
return getDisplayNames(result, locale, NULL, status);
|
||||
return getDisplayNames(result, locale, nullptr, status);
|
||||
}
|
||||
|
||||
UVector&
|
||||
|
@ -730,25 +730,25 @@ ICUService::getDisplayNames(UVector& result,
|
|||
ICUService* ncthis = (ICUService*)this; // cast away semantic const
|
||||
Mutex mutex(&lock);
|
||||
|
||||
if (dnCache != NULL && dnCache->locale != locale) {
|
||||
if (dnCache != nullptr && dnCache->locale != locale) {
|
||||
delete dnCache;
|
||||
ncthis->dnCache = NULL;
|
||||
ncthis->dnCache = nullptr;
|
||||
}
|
||||
|
||||
if (dnCache == NULL) {
|
||||
if (dnCache == nullptr) {
|
||||
const Hashtable* m = getVisibleIDMap(status);
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
ncthis->dnCache = new DNCache(locale);
|
||||
if (dnCache == NULL) {
|
||||
if (dnCache == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t pos = UHASH_FIRST;
|
||||
const UHashElement* entry = NULL;
|
||||
while ((entry = m->nextElement(pos)) != NULL) {
|
||||
const UHashElement* entry = nullptr;
|
||||
while ((entry = m->nextElement(pos)) != nullptr) {
|
||||
const UnicodeString* id = (const UnicodeString*)entry->key.pointer;
|
||||
ICUServiceFactory* f = (ICUServiceFactory*)entry->value.pointer;
|
||||
UnicodeString dname;
|
||||
|
@ -762,7 +762,7 @@ ICUService::getDisplayNames(UVector& result,
|
|||
}
|
||||
}
|
||||
delete dnCache;
|
||||
ncthis->dnCache = NULL;
|
||||
ncthis->dnCache = nullptr;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -774,10 +774,10 @@ ICUService::getDisplayNames(UVector& result,
|
|||
* at the next position, which in this case will be 0.
|
||||
*/
|
||||
int32_t pos = UHASH_FIRST;
|
||||
const UHashElement *entry = NULL;
|
||||
while ((entry = dnCache->cache.nextElement(pos)) != NULL) {
|
||||
const UHashElement *entry = nullptr;
|
||||
while ((entry = dnCache->cache.nextElement(pos)) != nullptr) {
|
||||
const UnicodeString* id = (const UnicodeString*)entry->value.pointer;
|
||||
if (matchKey != NULL && !matchKey->isFallbackOf(*id)) {
|
||||
if (matchKey != nullptr && !matchKey->isFallbackOf(*id)) {
|
||||
continue;
|
||||
}
|
||||
const UnicodeString* dn = (const UnicodeString*)entry->key.pointer;
|
||||
|
@ -803,30 +803,30 @@ URegistryKey
|
|||
ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
|
||||
{
|
||||
ICUServiceKey* key = createKey(&id, status);
|
||||
if (key != NULL) {
|
||||
if (key != nullptr) {
|
||||
UnicodeString canonicalID;
|
||||
key->canonicalID(canonicalID);
|
||||
delete key;
|
||||
|
||||
ICUServiceFactory* f = createSimpleFactory(objToAdopt, canonicalID, visible, status);
|
||||
if (f != NULL) {
|
||||
if (f != nullptr) {
|
||||
return registerFactory(f, status);
|
||||
}
|
||||
}
|
||||
delete objToAdopt;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ICUServiceFactory*
|
||||
ICUService::createSimpleFactory(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
|
||||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
if ((objToAdopt != NULL) && (!id.isBogus())) {
|
||||
if ((objToAdopt != nullptr) && (!id.isBogus())) {
|
||||
return new SimpleFactory(objToAdopt, id, visible);
|
||||
}
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
URegistryKey
|
||||
|
@ -865,7 +865,7 @@ ICUService::unregister(URegistryKey rkey, UErrorCode& status)
|
|||
{
|
||||
ICUServiceFactory *factory = (ICUServiceFactory*)rkey;
|
||||
UBool result = false;
|
||||
if (factory != NULL && factories != NULL) {
|
||||
if (factory != nullptr && factories != nullptr) {
|
||||
Mutex mutex(&lock);
|
||||
|
||||
if (factories->removeElement(factory)) {
|
||||
|
@ -896,7 +896,7 @@ ICUService::reset()
|
|||
void
|
||||
ICUService::reInitializeFactories()
|
||||
{
|
||||
if (factories != NULL) {
|
||||
if (factories != nullptr) {
|
||||
factories->removeAllElements();
|
||||
}
|
||||
}
|
||||
|
@ -910,7 +910,7 @@ ICUService::isDefault() const
|
|||
ICUServiceKey*
|
||||
ICUService::createKey(const UnicodeString* id, UErrorCode& status) const
|
||||
{
|
||||
return (U_FAILURE(status) || id == NULL) ? NULL : new ICUServiceKey(*id);
|
||||
return (U_FAILURE(status) || id == nullptr) ? nullptr : new ICUServiceKey(*id);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -919,23 +919,23 @@ ICUService::clearCaches()
|
|||
// callers synchronize before use
|
||||
++timestamp;
|
||||
delete dnCache;
|
||||
dnCache = NULL;
|
||||
dnCache = nullptr;
|
||||
delete idCache;
|
||||
idCache = NULL;
|
||||
delete serviceCache; serviceCache = NULL;
|
||||
idCache = nullptr;
|
||||
delete serviceCache; serviceCache = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
ICUService::clearServiceCache()
|
||||
{
|
||||
// callers synchronize before use
|
||||
delete serviceCache; serviceCache = NULL;
|
||||
delete serviceCache; serviceCache = nullptr;
|
||||
}
|
||||
|
||||
UBool
|
||||
ICUService::acceptsListener(const EventListener& l) const
|
||||
{
|
||||
return dynamic_cast<const ServiceListener*>(&l) != NULL;
|
||||
return dynamic_cast<const ServiceListener*>(&l) != nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -953,7 +953,7 @@ ICUService::getName(UnicodeString& result) const
|
|||
int32_t
|
||||
ICUService::countFactories() const
|
||||
{
|
||||
return factories == NULL ? 0 : factories->size();
|
||||
return factories == nullptr ? 0 : factories->size();
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
|
|
@ -217,7 +217,7 @@ class U_COMMON_API ICUServiceFactory : public UObject {
|
|||
|
||||
/**
|
||||
* <p>Create a service object from the key, if this factory
|
||||
* supports the key. Otherwise, return NULL.</p>
|
||||
* supports the key. Otherwise, return nullptr.</p>
|
||||
*
|
||||
* <p>If the factory supports the key, then it can call
|
||||
* the service's getKey(ICUServiceKey, String[], ICUServiceFactory) method
|
||||
|
@ -230,7 +230,7 @@ class U_COMMON_API ICUServiceFactory : public UObject {
|
|||
* @param key the service key.
|
||||
* @param service the service with which this factory is registered.
|
||||
* @param status the error code status.
|
||||
* @return the service object, or NULL if the factory does not support the key.
|
||||
* @return the service object, or nullptr if the factory does not support the key.
|
||||
*/
|
||||
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const = 0;
|
||||
|
||||
|
@ -292,7 +292,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
|
|||
/**
|
||||
* <p>Construct a SimpleFactory that maps a single ID to a single
|
||||
* service instance. If visible is true, the ID will be visible.
|
||||
* The instance must not be NULL. The SimpleFactory will adopt
|
||||
* The instance must not be nullptr. The SimpleFactory will adopt
|
||||
* the instance, which must not be changed subsequent to this call.</p>
|
||||
*
|
||||
* @param instanceToAdopt the service instance to adopt.
|
||||
|
@ -313,7 +313,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
|
|||
* @param key the service key.
|
||||
* @param service the service with which this factory is registered.
|
||||
* @param status the error code status.
|
||||
* @return the service object, or NULL if the factory does not support the key.
|
||||
* @return the service object, or nullptr if the factory does not support the key.
|
||||
*/
|
||||
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override;
|
||||
|
||||
|
@ -420,7 +420,7 @@ public:
|
|||
* @param displayName the displayName.
|
||||
* @param id the ID.
|
||||
* @param status the error code status.
|
||||
* @return a StringPair if the creation was successful, otherwise NULL.
|
||||
* @return a StringPair if the creation was successful, otherwise nullptr.
|
||||
*/
|
||||
static StringPair* create(const UnicodeString& displayName,
|
||||
const UnicodeString& id,
|
||||
|
@ -593,7 +593,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
*
|
||||
* @param descriptor the descriptor.
|
||||
* @param status the error code status.
|
||||
* @return the service instance, or NULL.
|
||||
* @return the service instance, or nullptr.
|
||||
*/
|
||||
UObject* get(const UnicodeString& descriptor, UErrorCode& status) const;
|
||||
|
||||
|
@ -602,9 +602,9 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* createKey to create a key from the provided descriptor.</p>
|
||||
*
|
||||
* @param descriptor the descriptor.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
|
||||
* @param status the error code status.
|
||||
* @return the service instance, or NULL.
|
||||
* @return the service instance, or nullptr.
|
||||
*/
|
||||
UObject* get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const;
|
||||
|
||||
|
@ -613,15 +613,15 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
*
|
||||
* @param key the key.
|
||||
* @param status the error code status.
|
||||
* @return the service instance, or NULL.
|
||||
* @return the service instance, or nullptr.
|
||||
*/
|
||||
UObject* getKey(ICUServiceKey& key, UErrorCode& status) const;
|
||||
|
||||
/**
|
||||
* <p>Given a key, return a service object, and, if actualReturn
|
||||
* is not NULL, the descriptor with which it was found in the
|
||||
* is not nullptr, the descriptor with which it was found in the
|
||||
* first element of actualReturn. If no service object matches
|
||||
* this key, returns NULL and leaves actualReturn unchanged.</p>
|
||||
* this key, returns nullptr and leaves actualReturn unchanged.</p>
|
||||
*
|
||||
* <p>This queries the cache using the key's descriptor, and if no
|
||||
* object in the cache matches, tries the key on each
|
||||
|
@ -635,9 +635,9 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* result before returning it.
|
||||
*
|
||||
* @param key the key.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
|
||||
* @param status the error code status.
|
||||
* @return the service instance, or NULL.
|
||||
* @return the service instance, or nullptr.
|
||||
*/
|
||||
virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const;
|
||||
|
||||
|
@ -648,10 +648,10 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* should not call it directly, but call through one of the other get functions.</p>
|
||||
*
|
||||
* @param key the key.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
|
||||
* @param factory the factory making the recursive call.
|
||||
* @param status the error code status.
|
||||
* @return the service instance, or NULL.
|
||||
* @return the service instance, or nullptr.
|
||||
*/
|
||||
UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const;
|
||||
|
||||
|
@ -677,11 +677,11 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* new elements, if any, are added.</p>
|
||||
*
|
||||
* <p>matchID is passed to createKey to create a key. If the key
|
||||
* is not NULL, its isFallbackOf method is used to filter out IDs
|
||||
* is not nullptr, its isFallbackOf method is used to filter out IDs
|
||||
* that don't match the key or have it as a fallback.</p>
|
||||
*
|
||||
* @param result a vector to hold the returned IDs.
|
||||
* @param matchID an ID used to filter the result, or NULL if all IDs are desired.
|
||||
* @param matchID an ID used to filter the result, or nullptr if all IDs are desired.
|
||||
* @param status the error code status.
|
||||
* @return the result vector.
|
||||
*/
|
||||
|
@ -711,7 +711,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
|
||||
/**
|
||||
* <p>Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
|
||||
* uses the current default Locale as the locale and NULL for
|
||||
* uses the current default Locale as the locale and nullptr for
|
||||
* the matchID.</p>
|
||||
*
|
||||
* @param result a vector to hold the returned displayName/id StringPairs.
|
||||
|
@ -722,7 +722,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
|
||||
/**
|
||||
* <p>Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
|
||||
* uses NULL for the matchID.</p>
|
||||
* uses nullptr for the matchID.</p>
|
||||
*
|
||||
* @param result a vector to hold the returned displayName/id StringPairs.
|
||||
* @param locale the locale in which to localize the ID.
|
||||
|
@ -746,12 +746,12 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* discarded before new elements, if any, are added.</p>
|
||||
*
|
||||
* <p>matchID is passed to createKey to create a key. If the key
|
||||
* is not NULL, its isFallbackOf method is used to filter out IDs
|
||||
* is not nullptr, its isFallbackOf method is used to filter out IDs
|
||||
* that don't match the key or have it as a fallback.</p>
|
||||
*
|
||||
* @param result a vector to hold the returned displayName/id StringPairs.
|
||||
* @param locale the locale in which to localize the ID.
|
||||
* @param matchID an ID used to filter the result, or NULL if all IDs are desired.
|
||||
* @param matchID an ID used to filter the result, or nullptr if all IDs are desired.
|
||||
* @param status the error code status.
|
||||
* @return the result vector. */
|
||||
UVector& getDisplayNames(UVector& result,
|
||||
|
@ -841,7 +841,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
virtual UBool isDefault(void) const;
|
||||
|
||||
/**
|
||||
* <p>Create a key from an ID. If ID is NULL, returns NULL.</p>
|
||||
* <p>Create a key from an ID. If ID is nullptr, returns nullptr.</p>
|
||||
*
|
||||
* <p>The default implementation creates an ICUServiceKey instance.
|
||||
* Subclasses can override to define more useful keys appropriate
|
||||
|
@ -849,7 +849,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
*
|
||||
* @param a pointer to the ID for which to create a default ICUServiceKey.
|
||||
* @param status the error code status.
|
||||
* @return the ICUServiceKey corresponding to ID, or NULL.
|
||||
* @return the ICUServiceKey corresponding to ID, or nullptr.
|
||||
*/
|
||||
virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const;
|
||||
|
||||
|
@ -859,7 +859,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* This is public so factories can call it, but should really be protected.</p>
|
||||
*
|
||||
* @param instance the service instance to clone.
|
||||
* @return a clone of the passed-in instance, or NULL if cloning was unsuccessful.
|
||||
* @return a clone of the passed-in instance, or nullptr if cloning was unsuccessful.
|
||||
*/
|
||||
virtual UObject* cloneInstance(UObject* instance) const = 0;
|
||||
|
||||
|
@ -901,12 +901,12 @@ class U_COMMON_API ICUService : public ICUNotifier {
|
|||
* <p>Default handler for this service if no factory in the factory list
|
||||
* handled the key passed to getKey.</p>
|
||||
*
|
||||
* <p>The default implementation returns NULL.</p>
|
||||
* <p>The default implementation returns nullptr.</p>
|
||||
*
|
||||
* @param key the key.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
|
||||
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
|
||||
* @param status the error code status.
|
||||
* @return the service instance, or NULL.
|
||||
* @return the service instance, or nullptr.
|
||||
*/
|
||||
virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const;
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ LocaleKey::createWithCanonicalFallback(const UnicodeString* primaryID,
|
|||
int32_t kind,
|
||||
UErrorCode& status)
|
||||
{
|
||||
if (primaryID == NULL || U_FAILURE(status)) {
|
||||
return NULL;
|
||||
if (primaryID == nullptr || U_FAILURE(status)) {
|
||||
return nullptr;
|
||||
}
|
||||
UnicodeString canonicalPrimaryID;
|
||||
LocaleUtility::canonicalLocaleString(primaryID, canonicalPrimaryID);
|
||||
|
@ -61,7 +61,7 @@ LocaleKey::LocaleKey(const UnicodeString& primaryID,
|
|||
{
|
||||
_fallbackID.setToBogus();
|
||||
if (_primaryID.length() != 0) {
|
||||
if (canonicalFallbackID != NULL && _primaryID != *canonicalFallbackID) {
|
||||
if (canonicalFallbackID != nullptr && _primaryID != *canonicalFallbackID) {
|
||||
_fallbackID = *canonicalFallbackID;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ LocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UE
|
|||
|
||||
return handleCreate(loc, kind, service, status);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UBool
|
||||
|
@ -63,7 +63,7 @@ LocaleKeyFactory::handlesKey(const ICUServiceKey& key, UErrorCode& status) const
|
|||
if (supported) {
|
||||
UnicodeString id;
|
||||
key.currentID(id);
|
||||
return supported->get(id) != NULL;
|
||||
return supported->get(id) != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -73,9 +73,9 @@ LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const
|
|||
const Hashtable* supported = getSupportedIDs(status);
|
||||
if (supported) {
|
||||
UBool visible = (_coverage & 0x1) == 0;
|
||||
const UHashElement* elem = NULL;
|
||||
const UHashElement* elem = nullptr;
|
||||
int32_t pos = UHASH_FIRST;
|
||||
while ((elem = supported->nextElement(pos)) != NULL) {
|
||||
while ((elem = supported->nextElement(pos)) != nullptr) {
|
||||
const UnicodeString& id = *((const UnicodeString*)elem->key.pointer);
|
||||
if (!visible) {
|
||||
result.remove(id);
|
||||
|
@ -109,7 +109,7 @@ LocaleKeyFactory::handleCreate(const Locale& /* loc */,
|
|||
int32_t /* kind */,
|
||||
const ICUService* /* service */,
|
||||
UErrorCode& /* status */) const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//UBool
|
||||
|
@ -120,7 +120,7 @@ LocaleKeyFactory::handleCreate(const Locale& /* loc */,
|
|||
|
||||
const Hashtable*
|
||||
LocaleKeyFactory::getSupportedIDs(UErrorCode& /* status */) const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SERVICE_DEBUG
|
||||
|
|
|
@ -258,7 +258,7 @@ public:
|
|||
protected:
|
||||
/**
|
||||
* Utility method used by create(ICUServiceKey, ICUService). Subclasses can implement
|
||||
* this instead of create. The default returns NULL.
|
||||
* this instead of create. The default returns nullptr.
|
||||
*/
|
||||
virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const;
|
||||
|
||||
|
|
|
@ -44,13 +44,13 @@ ICULocaleService::~ICULocaleService()
|
|||
UObject*
|
||||
ICULocaleService::get(const Locale& locale, UErrorCode& status) const
|
||||
{
|
||||
return get(locale, LocaleKey::KIND_ANY, NULL, status);
|
||||
return get(locale, LocaleKey::KIND_ANY, nullptr, status);
|
||||
}
|
||||
|
||||
UObject*
|
||||
ICULocaleService::get(const Locale& locale, int32_t kind, UErrorCode& status) const
|
||||
{
|
||||
return get(locale, kind, NULL, status);
|
||||
return get(locale, kind, nullptr, status);
|
||||
}
|
||||
|
||||
UObject*
|
||||
|
@ -62,7 +62,7 @@ ICULocaleService::get(const Locale& locale, Locale* actualReturn, UErrorCode& st
|
|||
UObject*
|
||||
ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn, UErrorCode& status) const
|
||||
{
|
||||
UObject* result = NULL;
|
||||
UObject* result = nullptr;
|
||||
if (U_FAILURE(status)) {
|
||||
return result;
|
||||
}
|
||||
|
@ -73,13 +73,13 @@ ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn,
|
|||
} else {
|
||||
ICUServiceKey* key = createKey(&locName, kind, status);
|
||||
if (key) {
|
||||
if (actualReturn == NULL) {
|
||||
if (actualReturn == nullptr) {
|
||||
result = getKey(*key, status);
|
||||
} else {
|
||||
UnicodeString temp;
|
||||
result = getKey(*key, &temp, status);
|
||||
|
||||
if (result != NULL) {
|
||||
if (result != nullptr) {
|
||||
key->parseSuffix(temp);
|
||||
LocaleUtility::initLocaleFromName(temp, *actualReturn);
|
||||
}
|
||||
|
@ -117,11 +117,11 @@ URegistryKey
|
|||
ICULocaleService::registerInstance(UObject* objToAdopt, const Locale& locale, int32_t kind, int32_t coverage, UErrorCode& status)
|
||||
{
|
||||
ICUServiceFactory * factory = new SimpleLocaleKeyFactory(objToAdopt, locale, kind, coverage);
|
||||
if (factory != NULL) {
|
||||
if (factory != nullptr) {
|
||||
return registerFactory(factory, status);
|
||||
}
|
||||
delete objToAdopt;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -143,11 +143,11 @@ URegistryKey
|
|||
ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale, int32_t kind, int32_t coverage, UErrorCode& status)
|
||||
{
|
||||
ICUServiceFactory * factory = new SimpleLocaleKeyFactory(objToAdopt, locale, kind, coverage);
|
||||
if (factory != NULL) {
|
||||
if (factory != nullptr) {
|
||||
return registerFactory(factory, status);
|
||||
}
|
||||
delete objToAdopt;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -162,7 +162,7 @@ private:
|
|||
ServiceEnumeration(const ICULocaleService* service, UErrorCode &status)
|
||||
: _service(service)
|
||||
, _timestamp(service->getTimestamp())
|
||||
, _ids(uprv_deleteUObject, NULL, status)
|
||||
, _ids(uprv_deleteUObject, nullptr, status)
|
||||
, _pos(0)
|
||||
{
|
||||
_service->getVisibleIDs(_ids, status);
|
||||
|
@ -171,7 +171,7 @@ private:
|
|||
ServiceEnumeration(const ServiceEnumeration &other, UErrorCode &status)
|
||||
: _service(other._service)
|
||||
, _timestamp(other._timestamp)
|
||||
, _ids(uprv_deleteUObject, NULL, status)
|
||||
, _ids(uprv_deleteUObject, nullptr, status)
|
||||
, _pos(0)
|
||||
{
|
||||
if(U_SUCCESS(status)) {
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
return result;
|
||||
}
|
||||
delete result;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual ~ServiceEnumeration();
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
ServiceEnumeration *cl = new ServiceEnumeration(*this, status);
|
||||
if(U_FAILURE(status)) {
|
||||
delete cl;
|
||||
cl = NULL;
|
||||
cl = nullptr;
|
||||
}
|
||||
return cl;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
if (upToDate(status) && (_pos < _ids.size())) {
|
||||
return (const UnicodeString*)_ids[_pos++];
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual void reset(UErrorCode& status) override {
|
||||
|
|
|
@ -24,7 +24,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
|
|||
static UMutex notifyLock;
|
||||
|
||||
ICUNotifier::ICUNotifier(void)
|
||||
: listeners(NULL)
|
||||
: listeners(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ ICUNotifier::~ICUNotifier(void) {
|
|||
{
|
||||
Mutex lmx(¬ifyLock);
|
||||
delete listeners;
|
||||
listeners = NULL;
|
||||
listeners = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,14 +41,14 @@ void
|
|||
ICUNotifier::addListener(const EventListener* l, UErrorCode& status)
|
||||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
if (l == NULL) {
|
||||
if (l == nullptr) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if (acceptsListener(*l)) {
|
||||
Mutex lmx(¬ifyLock);
|
||||
if (listeners == NULL) {
|
||||
if (listeners == nullptr) {
|
||||
LocalPointer<UVector> lpListeners(new UVector(5, status), status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
|
@ -78,14 +78,14 @@ void
|
|||
ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
|
||||
{
|
||||
if (U_SUCCESS(status)) {
|
||||
if (l == NULL) {
|
||||
if (l == nullptr) {
|
||||
status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Mutex lmx(¬ifyLock);
|
||||
if (listeners != NULL) {
|
||||
if (listeners != nullptr) {
|
||||
// identity equality check
|
||||
for (int i = 0, e = listeners->size(); i < e; ++i) {
|
||||
const EventListener* el = (const EventListener*)listeners->elementAt(i);
|
||||
|
@ -93,7 +93,7 @@ ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
|
|||
listeners->removeElementAt(i);
|
||||
if (listeners->size() == 0) {
|
||||
delete listeners;
|
||||
listeners = NULL;
|
||||
listeners = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void
|
|||
ICUNotifier::notifyChanged(void)
|
||||
{
|
||||
Mutex lmx(¬ifyLock);
|
||||
if (listeners != NULL) {
|
||||
if (listeners != nullptr) {
|
||||
for (int i = 0, e = listeners->size(); i < e; ++i) {
|
||||
EventListener* el = (EventListener*)listeners->elementAt(i);
|
||||
notifyListener(*el);
|
||||
|
|
|
@ -48,7 +48,7 @@ ICUResourceBundleFactory::getSupportedIDs(UErrorCode& status) const
|
|||
if (U_SUCCESS(status)) {
|
||||
return LocaleUtility::getAvailableLocaleNames(_bundleName);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UObject*
|
||||
|
@ -63,11 +63,11 @@ ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t /* kind */, co
|
|||
int32_t length;
|
||||
length=_bundleName.extract(0, INT32_MAX, pkg, (int32_t)sizeof(pkg), US_INV);
|
||||
if(length>=(int32_t)sizeof(pkg)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return new ResourceBundle(pkg, loc, status);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SERVICE_DEBUG
|
||||
|
|
|
@ -57,7 +57,7 @@ SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt,
|
|||
SimpleLocaleKeyFactory::~SimpleLocaleKeyFactory()
|
||||
{
|
||||
delete _obj;
|
||||
_obj = NULL;
|
||||
_obj = nullptr;
|
||||
}
|
||||
|
||||
UObject*
|
||||
|
@ -73,7 +73,7 @@ SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* servi
|
|||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//UBool
|
||||
|
|
|
@ -57,14 +57,14 @@ public:
|
|||
SharedObject() :
|
||||
softRefCount(0),
|
||||
hardRefCount(0),
|
||||
cachePtr(NULL) {}
|
||||
cachePtr(nullptr) {}
|
||||
|
||||
/** Initializes totalRefCount, softRefCount to 0. */
|
||||
SharedObject(const SharedObject &other) :
|
||||
UObject(other),
|
||||
softRefCount(0),
|
||||
hardRefCount(0),
|
||||
cachePtr(NULL) {}
|
||||
cachePtr(nullptr) {}
|
||||
|
||||
virtual ~SharedObject();
|
||||
|
||||
|
@ -116,7 +116,7 @@ public:
|
|||
* If there are multiple owners, then ptr is replaced with a
|
||||
* copy-constructed clone,
|
||||
* and that is returned.
|
||||
* Returns NULL if cloning failed.
|
||||
* Returns nullptr if cloning failed.
|
||||
*
|
||||
* T must be a subclass of SharedObject.
|
||||
*/
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
const T *p = ptr;
|
||||
if(p->getRefCount() <= 1) { return const_cast<T *>(p); }
|
||||
T *p2 = new T(*p);
|
||||
if(p2 == NULL) { return NULL; }
|
||||
if(p2 == nullptr) { return nullptr; }
|
||||
p->removeRef();
|
||||
ptr = p2;
|
||||
p2->addRef();
|
||||
|
@ -135,7 +135,7 @@ public:
|
|||
/**
|
||||
* Makes dest an owner of the object pointed to by src while adjusting
|
||||
* reference counts and deleting the previous object dest pointed to
|
||||
* if necessary. Before this call is made, dest must either be NULL or
|
||||
* if necessary. Before this call is made, dest must either be nullptr or
|
||||
* be included in the reference count of the object it points to.
|
||||
*
|
||||
* T must be a subclass of SharedObject.
|
||||
|
@ -143,20 +143,20 @@ public:
|
|||
template<typename T>
|
||||
static void copyPtr(const T *src, const T *&dest) {
|
||||
if(src != dest) {
|
||||
if(dest != NULL) { dest->removeRef(); }
|
||||
if(dest != nullptr) { dest->removeRef(); }
|
||||
dest = src;
|
||||
if(src != NULL) { src->addRef(); }
|
||||
if(src != nullptr) { src->addRef(); }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Equivalent to copyPtr(NULL, dest).
|
||||
* Equivalent to copyPtr(nullptr, dest).
|
||||
*/
|
||||
template<typename T>
|
||||
static void clearPtr(const T *&ptr) {
|
||||
if (ptr != NULL) {
|
||||
if (ptr != nullptr) {
|
||||
ptr->removeRef();
|
||||
ptr = NULL;
|
||||
ptr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ enum {
|
|||
};
|
||||
|
||||
inline UBool isInvalidArray(const void *array, int32_t length) {
|
||||
return (length < 0 || (array == NULL && length != 0));
|
||||
return (length < 0 || (array == nullptr && length != 0));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -159,7 +159,7 @@ UnicodeString& SimpleFormatter::format(
|
|||
const UnicodeString &value0,
|
||||
UnicodeString &appendTo, UErrorCode &errorCode) const {
|
||||
const UnicodeString *values[] = { &value0 };
|
||||
return formatAndAppend(values, 1, appendTo, NULL, 0, errorCode);
|
||||
return formatAndAppend(values, 1, appendTo, nullptr, 0, errorCode);
|
||||
}
|
||||
|
||||
UnicodeString& SimpleFormatter::format(
|
||||
|
@ -167,7 +167,7 @@ UnicodeString& SimpleFormatter::format(
|
|||
const UnicodeString &value1,
|
||||
UnicodeString &appendTo, UErrorCode &errorCode) const {
|
||||
const UnicodeString *values[] = { &value0, &value1 };
|
||||
return formatAndAppend(values, 2, appendTo, NULL, 0, errorCode);
|
||||
return formatAndAppend(values, 2, appendTo, nullptr, 0, errorCode);
|
||||
}
|
||||
|
||||
UnicodeString& SimpleFormatter::format(
|
||||
|
@ -176,7 +176,7 @@ UnicodeString& SimpleFormatter::format(
|
|||
const UnicodeString &value2,
|
||||
UnicodeString &appendTo, UErrorCode &errorCode) const {
|
||||
const UnicodeString *values[] = { &value0, &value1, &value2 };
|
||||
return formatAndAppend(values, 3, appendTo, NULL, 0, errorCode);
|
||||
return formatAndAppend(values, 3, appendTo, nullptr, 0, errorCode);
|
||||
}
|
||||
|
||||
UnicodeString& SimpleFormatter::formatAndAppend(
|
||||
|
@ -192,7 +192,7 @@ UnicodeString& SimpleFormatter::formatAndAppend(
|
|||
return appendTo;
|
||||
}
|
||||
return format(compiledPattern.getBuffer(), compiledPattern.length(), values,
|
||||
appendTo, NULL, true,
|
||||
appendTo, nullptr, true,
|
||||
offsets, offsetsLength, errorCode);
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ UnicodeString &SimpleFormatter::format(
|
|||
int32_t n = compiledPattern[i++];
|
||||
if (n < ARG_NUM_LIMIT) {
|
||||
const UnicodeString *value = values[n];
|
||||
if (value == NULL) {
|
||||
if (value == nullptr) {
|
||||
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
U_NAMESPACE_BEGIN
|
||||
|
||||
StringPiece::StringPiece(const char* str)
|
||||
: ptr_(str), length_((str == NULL) ? 0 : static_cast<int32_t>(uprv_strlen(str))) { }
|
||||
: ptr_(str), length_((str == nullptr) ? 0 : static_cast<int32_t>(uprv_strlen(str))) { }
|
||||
|
||||
StringPiece::StringPiece(const StringPiece& x, int32_t pos) {
|
||||
if (pos < 0) {
|
||||
|
@ -45,7 +45,7 @@ StringPiece::StringPiece(const StringPiece& x, int32_t pos, int32_t len) {
|
|||
|
||||
void StringPiece::set(const char* str) {
|
||||
ptr_ = str;
|
||||
if (str != NULL)
|
||||
if (str != nullptr)
|
||||
length_ = static_cast<int32_t>(uprv_strlen(str));
|
||||
else
|
||||
length_ = 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ U_CDECL_END
|
|||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
StringTrieBuilder::StringTrieBuilder() : nodes(NULL) {}
|
||||
StringTrieBuilder::StringTrieBuilder() : nodes(nullptr) {}
|
||||
|
||||
StringTrieBuilder::~StringTrieBuilder() {
|
||||
deleteCompactBuilder();
|
||||
|
@ -47,10 +47,10 @@ StringTrieBuilder::createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
nodes=uhash_openSize(hashStringTrieNode, equalStringTrieNodes, NULL,
|
||||
nodes=uhash_openSize(hashStringTrieNode, equalStringTrieNodes, nullptr,
|
||||
sizeGuess, &errorCode);
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
if(nodes==NULL) {
|
||||
if(nodes==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
} else {
|
||||
uhash_setKeyDeleter(nodes, uprv_deleteUObject);
|
||||
|
@ -61,7 +61,7 @@ StringTrieBuilder::createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode
|
|||
void
|
||||
StringTrieBuilder::deleteCompactBuilder() {
|
||||
uhash_close(nodes);
|
||||
nodes=NULL;
|
||||
nodes=nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -207,7 +207,7 @@ StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unit
|
|||
StringTrieBuilder::Node *
|
||||
StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
UBool hasValue=false;
|
||||
int32_t value=0;
|
||||
|
@ -244,7 +244,7 @@ StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UEr
|
|||
Node *subNode=makeBranchSubNode(start, limit, unitIndex, length, errorCode);
|
||||
node=new BranchHeadNode(length, subNode);
|
||||
}
|
||||
if(hasValue && node!=NULL) {
|
||||
if(hasValue && node!=nullptr) {
|
||||
if(matchNodesCanHaveValues()) {
|
||||
((ValueNode *)node)->setValue(value);
|
||||
} else {
|
||||
|
@ -260,7 +260,7 @@ StringTrieBuilder::Node *
|
|||
StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex,
|
||||
int32_t length, UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
UChar middleUnits[kMaxSplitBranchLevels];
|
||||
Node *lessThan[kMaxSplitBranchLevels];
|
||||
|
@ -278,12 +278,12 @@ StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitI
|
|||
length=length-length/2;
|
||||
}
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
ListBranchNode *listNode=new ListBranchNode();
|
||||
if(listNode==NULL) {
|
||||
if(listNode==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// For each unit, find its elements array start and whether it has a final value.
|
||||
int32_t unitNumber=0;
|
||||
|
@ -319,14 +319,14 @@ StringTrieBuilder::Node *
|
|||
StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
delete newNode;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if(newNode==NULL) {
|
||||
if(newNode==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
const UHashElement *old=uhash_find(nodes, newNode);
|
||||
if(old!=NULL) {
|
||||
if(old!=nullptr) {
|
||||
delete newNode;
|
||||
return (Node *)old->key.pointer;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) {
|
|||
U_ASSERT(oldValue==0);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
delete newNode;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return newNode;
|
||||
}
|
||||
|
@ -347,17 +347,17 @@ StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) {
|
|||
StringTrieBuilder::Node *
|
||||
StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
FinalValueNode key(value);
|
||||
const UHashElement *old=uhash_find(nodes, &key);
|
||||
if(old!=NULL) {
|
||||
if(old!=nullptr) {
|
||||
return (Node *)old->key.pointer;
|
||||
}
|
||||
Node *newNode=new FinalValueNode(value);
|
||||
if(newNode==NULL) {
|
||||
if(newNode==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// If uhash_puti() returns a non-zero value from an equivalent, previously
|
||||
// registered node, then uhash_find() failed to find that and we will leak newNode.
|
||||
|
@ -368,7 +368,7 @@ StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) {
|
|||
U_ASSERT(oldValue==0);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
delete newNode;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return newNode;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ StringTrieBuilder::ListBranchNode::markRightEdgesFirst(int32_t edgeNumber) {
|
|||
int32_t i=length;
|
||||
do {
|
||||
Node *edge=equal[--i];
|
||||
if(edge!=NULL) {
|
||||
if(edge!=nullptr) {
|
||||
edgeNumber=edge->markRightEdgesFirst(edgeNumber-step);
|
||||
}
|
||||
// For all but the rightmost edge, decrement the edge number.
|
||||
|
@ -515,17 +515,17 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) {
|
|||
// Instead we write the minUnit sub-node last, for a shorter delta.
|
||||
int32_t unitNumber=length-1;
|
||||
Node *rightEdge=equal[unitNumber];
|
||||
int32_t rightEdgeNumber= rightEdge==NULL ? firstEdgeNumber : rightEdge->getOffset();
|
||||
int32_t rightEdgeNumber= rightEdge==nullptr ? firstEdgeNumber : rightEdge->getOffset();
|
||||
do {
|
||||
--unitNumber;
|
||||
if(equal[unitNumber]!=NULL) {
|
||||
if(equal[unitNumber]!=nullptr) {
|
||||
equal[unitNumber]->writeUnlessInsideRightEdge(firstEdgeNumber, rightEdgeNumber, builder);
|
||||
}
|
||||
} while(unitNumber>0);
|
||||
// The maxUnit sub-node is written as the very last one because we do
|
||||
// not jump for it at all.
|
||||
unitNumber=length-1;
|
||||
if(rightEdge==NULL) {
|
||||
if(rightEdge==nullptr) {
|
||||
builder.writeValueAndFinal(values[unitNumber], true);
|
||||
} else {
|
||||
rightEdge->write(builder);
|
||||
|
@ -535,7 +535,7 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) {
|
|||
while(--unitNumber>=0) {
|
||||
int32_t value;
|
||||
UBool isFinal;
|
||||
if(equal[unitNumber]==NULL) {
|
||||
if(equal[unitNumber]==nullptr) {
|
||||
// Write the final value for the one string ending with this unit.
|
||||
value=values[unitNumber];
|
||||
isFinal=true;
|
||||
|
|
|
@ -256,10 +256,10 @@ U_CAPI void U_EXPORT2
|
|||
uprv_sortArray(void *array, int32_t length, int32_t itemSize,
|
||||
UComparator *cmp, const void *context,
|
||||
UBool sortStable, UErrorCode *pErrorCode) {
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if((length>0 && array==NULL) || length<0 || itemSize<=0 || cmp==NULL) {
|
||||
if((length>0 && array==nullptr) || length<0 || itemSize<=0 || cmp==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -135,21 +135,21 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode)
|
|||
UBiDi *pBiDi;
|
||||
|
||||
/* check the argument values */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return nullptr;
|
||||
} else if(maxLength<0 || maxRunCount<0) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL; /* invalid arguments */
|
||||
return nullptr; /* invalid arguments */
|
||||
}
|
||||
|
||||
/* allocate memory for the object */
|
||||
pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi));
|
||||
if(pBiDi==NULL) {
|
||||
if(pBiDi==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* reset the object, all pointers NULL, all flags false, all sizes 0 */
|
||||
/* reset the object, all pointers nullptr, all flags false, all sizes 0 */
|
||||
uprv_memset(pBiDi, 0, sizeof(UBiDi));
|
||||
|
||||
/* allocate memory for arrays as requested */
|
||||
|
@ -178,18 +178,18 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode)
|
|||
return pBiDi;
|
||||
} else {
|
||||
ubidi_close(pBiDi);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are allowed to allocate memory if memory==NULL or
|
||||
* We are allowed to allocate memory if memory==nullptr or
|
||||
* mayAllocate==true for each array that we need.
|
||||
* We also try to grow memory as needed if we
|
||||
* allocate it.
|
||||
*
|
||||
* Assume sizeNeeded>0.
|
||||
* If *pMemory!=NULL, then assume *pSize>0.
|
||||
* If *pMemory!=nullptr, then assume *pSize>0.
|
||||
*
|
||||
* ### this realloc() may unnecessarily copy the old data,
|
||||
* which we know we don't need any more;
|
||||
|
@ -199,9 +199,9 @@ U_CFUNC UBool
|
|||
ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded) {
|
||||
void **pMemory = (void **)bidiMem;
|
||||
/* check for existing memory */
|
||||
if(*pMemory==NULL) {
|
||||
if(*pMemory==nullptr) {
|
||||
/* we need to allocate memory */
|
||||
if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=NULL) {
|
||||
if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=nullptr) {
|
||||
*pSize=sizeNeeded;
|
||||
return true;
|
||||
} else {
|
||||
|
@ -222,7 +222,7 @@ ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAlloc
|
|||
* realloc, but it is needed when adding runs using getRunsMemory()
|
||||
* in setParaRunsOnly()
|
||||
*/
|
||||
if((memory=uprv_realloc(*pMemory, sizeNeeded))!=NULL) {
|
||||
if((memory=uprv_realloc(*pMemory, sizeNeeded))!=nullptr) {
|
||||
*pMemory=memory;
|
||||
*pSize=sizeNeeded;
|
||||
return true;
|
||||
|
@ -236,27 +236,27 @@ ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAlloc
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_close(UBiDi *pBiDi) {
|
||||
if(pBiDi!=NULL) {
|
||||
pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */
|
||||
if(pBiDi->dirPropsMemory!=NULL) {
|
||||
if(pBiDi!=nullptr) {
|
||||
pBiDi->pParaBiDi=nullptr; /* in case one tries to reuse this block */
|
||||
if(pBiDi->dirPropsMemory!=nullptr) {
|
||||
uprv_free(pBiDi->dirPropsMemory);
|
||||
}
|
||||
if(pBiDi->levelsMemory!=NULL) {
|
||||
if(pBiDi->levelsMemory!=nullptr) {
|
||||
uprv_free(pBiDi->levelsMemory);
|
||||
}
|
||||
if(pBiDi->openingsMemory!=NULL) {
|
||||
if(pBiDi->openingsMemory!=nullptr) {
|
||||
uprv_free(pBiDi->openingsMemory);
|
||||
}
|
||||
if(pBiDi->parasMemory!=NULL) {
|
||||
if(pBiDi->parasMemory!=nullptr) {
|
||||
uprv_free(pBiDi->parasMemory);
|
||||
}
|
||||
if(pBiDi->runsMemory!=NULL) {
|
||||
if(pBiDi->runsMemory!=nullptr) {
|
||||
uprv_free(pBiDi->runsMemory);
|
||||
}
|
||||
if(pBiDi->isolatesMemory!=NULL) {
|
||||
if(pBiDi->isolatesMemory!=nullptr) {
|
||||
uprv_free(pBiDi->isolatesMemory);
|
||||
}
|
||||
if(pBiDi->insertPoints.points!=NULL) {
|
||||
if(pBiDi->insertPoints.points!=nullptr) {
|
||||
uprv_free(pBiDi->insertPoints.points);
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ ubidi_close(UBiDi *pBiDi) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) {
|
||||
if(pBiDi!=NULL) {
|
||||
if(pBiDi!=nullptr) {
|
||||
pBiDi->isInverse=isInverse;
|
||||
pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L
|
||||
: UBIDI_REORDER_DEFAULT;
|
||||
|
@ -277,7 +277,7 @@ ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) {
|
|||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ubidi_isInverse(UBiDi *pBiDi) {
|
||||
if(pBiDi!=NULL) {
|
||||
if(pBiDi!=nullptr) {
|
||||
return pBiDi->isInverse;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -301,7 +301,7 @@ ubidi_isInverse(UBiDi *pBiDi) {
|
|||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
|
||||
if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
|
||||
if ((pBiDi!=nullptr) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
|
||||
&& (reorderingMode < UBIDI_REORDER_COUNT)) {
|
||||
pBiDi->reorderingMode = reorderingMode;
|
||||
pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L);
|
||||
|
@ -310,7 +310,7 @@ ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
|
|||
|
||||
U_CAPI UBiDiReorderingMode U_EXPORT2
|
||||
ubidi_getReorderingMode(UBiDi *pBiDi) {
|
||||
if (pBiDi!=NULL) {
|
||||
if (pBiDi!=nullptr) {
|
||||
return pBiDi->reorderingMode;
|
||||
} else {
|
||||
return UBIDI_REORDER_DEFAULT;
|
||||
|
@ -322,14 +322,14 @@ ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) {
|
|||
if (reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
|
||||
reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS;
|
||||
}
|
||||
if (pBiDi!=NULL) {
|
||||
if (pBiDi!=nullptr) {
|
||||
pBiDi->reorderingOptions=reorderingOptions;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
ubidi_getReorderingOptions(UBiDi *pBiDi) {
|
||||
if (pBiDi!=NULL) {
|
||||
if (pBiDi!=nullptr) {
|
||||
return pBiDi->reorderingOptions;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -344,7 +344,7 @@ int32_t length){
|
|||
UChar32 uchar;
|
||||
UCharDirection dir;
|
||||
|
||||
if( text==NULL || length<-1 ){
|
||||
if( text==nullptr || length<-1 ){
|
||||
return UBIDI_NEUTRAL;
|
||||
}
|
||||
|
||||
|
@ -1797,7 +1797,7 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag)
|
|||
if (pInsertPoints->capacity == 0)
|
||||
{
|
||||
pInsertPoints->points=static_cast<Point *>(uprv_malloc(sizeof(Point)*FIRSTALLOC));
|
||||
if (pInsertPoints->points == NULL)
|
||||
if (pInsertPoints->points == nullptr)
|
||||
{
|
||||
pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -1809,7 +1809,7 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag)
|
|||
Point * savePoints=pInsertPoints->points;
|
||||
pInsertPoints->points=static_cast<Point *>(uprv_realloc(pInsertPoints->points,
|
||||
pInsertPoints->capacity*2*sizeof(Point)));
|
||||
if (pInsertPoints->points == NULL)
|
||||
if (pInsertPoints->points == nullptr)
|
||||
{
|
||||
pInsertPoints->points=savePoints;
|
||||
pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -2331,8 +2331,8 @@ ubidi_setContext(UBiDi *pBiDi,
|
|||
UErrorCode *pErrorCode) {
|
||||
/* check the argument values */
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(pBiDi==NULL || proLength<-1 || epiLength<-1 ||
|
||||
(prologue==NULL && proLength!=0) || (epilogue==NULL && epiLength!=0)) {
|
||||
if(pBiDi==nullptr || proLength<-1 || epiLength<-1 ||
|
||||
(prologue==nullptr && proLength!=0) || (epilogue==nullptr && epiLength!=0)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -2364,7 +2364,7 @@ setParaSuccess(UBiDi *pBiDi) {
|
|||
static void
|
||||
setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
|
||||
UBiDiLevel paraLevel, UErrorCode *pErrorCode) {
|
||||
int32_t *runsOnlyMemory = NULL;
|
||||
int32_t *runsOnlyMemory = nullptr;
|
||||
int32_t *visualMap;
|
||||
UChar *visualText;
|
||||
int32_t saveLength, saveTrailingWSStart;
|
||||
|
@ -2381,12 +2381,12 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
|
||||
pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT;
|
||||
if(length==0) {
|
||||
ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
|
||||
ubidi_setPara(pBiDi, text, length, paraLevel, nullptr, pErrorCode);
|
||||
goto cleanup3;
|
||||
}
|
||||
/* obtain memory for mapping table and visual text */
|
||||
runsOnlyMemory=static_cast<int32_t *>(uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel))));
|
||||
if(runsOnlyMemory==NULL) {
|
||||
if(runsOnlyMemory==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
goto cleanup3;
|
||||
}
|
||||
|
@ -2399,7 +2399,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS;
|
||||
}
|
||||
paraLevel&=1; /* accept only 0 or 1 */
|
||||
ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
|
||||
ubidi_setPara(pBiDi, text, length, paraLevel, nullptr, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
goto cleanup3;
|
||||
}
|
||||
|
@ -2437,7 +2437,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
*/
|
||||
saveMayAllocateText=pBiDi->mayAllocateText;
|
||||
pBiDi->mayAllocateText=false;
|
||||
ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode);
|
||||
ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, nullptr, pErrorCode);
|
||||
pBiDi->mayAllocateText=saveMayAllocateText;
|
||||
ubidi_getRuns(pBiDi, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
|
@ -2559,7 +2559,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
|
||||
/* check the argument values */
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(pBiDi==NULL || text==NULL || length<-1 ||
|
||||
if(pBiDi==nullptr || text==nullptr || length<-1 ||
|
||||
(paraLevel>UBIDI_MAX_EXPLICIT_LEVEL && paraLevel<UBIDI_DEFAULT_LTR)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -2576,16 +2576,16 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
}
|
||||
|
||||
/* initialize the UBiDi structure */
|
||||
pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */
|
||||
pBiDi->pParaBiDi=nullptr; /* mark unfinished setPara */
|
||||
pBiDi->text=text;
|
||||
pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length;
|
||||
pBiDi->paraLevel=paraLevel;
|
||||
pBiDi->direction=(UBiDiDirection)(paraLevel&1);
|
||||
pBiDi->paraCount=1;
|
||||
|
||||
pBiDi->dirProps=NULL;
|
||||
pBiDi->levels=NULL;
|
||||
pBiDi->runs=NULL;
|
||||
pBiDi->dirProps=nullptr;
|
||||
pBiDi->levels=nullptr;
|
||||
pBiDi->runs=nullptr;
|
||||
pBiDi->insertPoints.size=0; /* clean up from last call */
|
||||
pBiDi->insertPoints.confirmed=0; /* clean up from last call */
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */
|
||||
|
||||
/* are explicit levels specified? */
|
||||
if(embeddingLevels==NULL) {
|
||||
if(embeddingLevels==nullptr) {
|
||||
/* no: determine explicit levels according to the (Xn) rules */\
|
||||
if(getLevelsMemory(pBiDi, length)) {
|
||||
pBiDi->levels=pBiDi->levelsMemory;
|
||||
|
@ -2737,7 +2737,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
* Examples for "insignificant" ones are empty embeddings
|
||||
* LRE-PDF, LRE-RLE-PDF-PDF, etc.
|
||||
*/
|
||||
if(embeddingLevels==NULL && pBiDi->paraCount<=1 &&
|
||||
if(embeddingLevels==nullptr && pBiDi->paraCount<=1 &&
|
||||
!(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) {
|
||||
resolveImplicitLevels(pBiDi, 0, length,
|
||||
GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)),
|
||||
|
@ -2856,14 +2856,14 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) {
|
||||
if(pBiDi!=NULL) {
|
||||
if(pBiDi!=nullptr) {
|
||||
pBiDi->orderParagraphsLTR=orderParagraphsLTR;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) {
|
||||
if(pBiDi!=NULL) {
|
||||
if(pBiDi!=nullptr) {
|
||||
return pBiDi->orderParagraphsLTR;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -2884,7 +2884,7 @@ ubidi_getText(const UBiDi *pBiDi) {
|
|||
if(IS_VALID_PARA_OR_LINE(pBiDi)) {
|
||||
return pBiDi->text;
|
||||
} else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2952,13 +2952,13 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
|
|||
} else {
|
||||
paraStart=0;
|
||||
}
|
||||
if(pParaStart!=NULL) {
|
||||
if(pParaStart!=nullptr) {
|
||||
*pParaStart=paraStart;
|
||||
}
|
||||
if(pParaLimit!=NULL) {
|
||||
if(pParaLimit!=nullptr) {
|
||||
*pParaLimit=pBiDi->paras[paraIndex].limit;
|
||||
}
|
||||
if(pParaLevel!=NULL) {
|
||||
if(pParaLevel!=nullptr) {
|
||||
*pParaLevel=GET_PARALEVEL(pBiDi, paraStart);
|
||||
}
|
||||
}
|
||||
|
@ -2987,7 +2987,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
|
|||
const void **oldContext, UErrorCode *pErrorCode)
|
||||
{
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(pBiDi==NULL) {
|
||||
if(pBiDi==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -3006,7 +3006,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
|
|||
U_CAPI void U_EXPORT2
|
||||
ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context)
|
||||
{
|
||||
if(pBiDi==NULL) {
|
||||
if(pBiDi==nullptr) {
|
||||
return;
|
||||
}
|
||||
if( fn )
|
||||
|
@ -3024,7 +3024,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c)
|
|||
{
|
||||
UCharDirection dir;
|
||||
|
||||
if( pBiDi->fnClassCallback == NULL ||
|
||||
if( pBiDi->fnClassCallback == nullptr ||
|
||||
(dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT )
|
||||
{
|
||||
dir = ubidi_getClass(c);
|
||||
|
|
|
@ -69,7 +69,7 @@ ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
|||
}
|
||||
|
||||
/* add the start code point of each same-value range of the trie */
|
||||
utrie2_enum(&ubidi_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
|
||||
utrie2_enum(&ubidi_props_singleton.trie, nullptr, _enumPropertyStartsRange, sa);
|
||||
|
||||
/* add the code points from the bidi mirroring table */
|
||||
length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
|
|
|
@ -925,7 +925,7 @@ static const uint8_t ubidi_props_jgArray2[612]={
|
|||
};
|
||||
|
||||
static const UBiDiProps ubidi_props_singleton={
|
||||
NULL,
|
||||
nullptr,
|
||||
ubidi_props_indexes,
|
||||
ubidi_props_mirrors,
|
||||
ubidi_props_jgArray,
|
||||
|
@ -933,7 +933,7 @@ static const UBiDiProps ubidi_props_singleton={
|
|||
{
|
||||
ubidi_props_trieIndex,
|
||||
ubidi_props_trieIndex+3612,
|
||||
NULL,
|
||||
nullptr,
|
||||
3612,
|
||||
9412,
|
||||
0x1a0,
|
||||
|
@ -942,7 +942,7 @@ static const UBiDiProps ubidi_props_singleton={
|
|||
0x0,
|
||||
0x110000,
|
||||
0x32dc,
|
||||
NULL, 0, false, false, 0, NULL
|
||||
nullptr, 0, false, false, 0, nullptr
|
||||
},
|
||||
{ 2,2,0,0 }
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* This means that there is a UBiDi object with a levels
|
||||
* and a dirProps array.
|
||||
* paraLevel and direction are also set.
|
||||
* Only if the length of the text is zero, then levels==dirProps==NULL.
|
||||
* Only if the length of the text is zero, then levels==dirProps==nullptr.
|
||||
*
|
||||
* The overall directionality of the paragraph
|
||||
* or line is used to bypass the reordering steps if possible.
|
||||
|
@ -134,25 +134,25 @@ ubidi_setLine(const UBiDi *pParaBiDi,
|
|||
RETURN_VOID_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode);
|
||||
RETURN_VOID_IF_BAD_RANGE(start, 0, limit, *pErrorCode);
|
||||
RETURN_VOID_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode);
|
||||
if(pLineBiDi==NULL) {
|
||||
if(pLineBiDi==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
if(ubidi_getParagraph(pParaBiDi, start, NULL, NULL, NULL, pErrorCode) !=
|
||||
ubidi_getParagraph(pParaBiDi, limit-1, NULL, NULL, NULL, pErrorCode)) {
|
||||
if(ubidi_getParagraph(pParaBiDi, start, nullptr, nullptr, nullptr, pErrorCode) !=
|
||||
ubidi_getParagraph(pParaBiDi, limit-1, nullptr, nullptr, nullptr, pErrorCode)) {
|
||||
/* the line crosses a paragraph boundary */
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* set the values in pLineBiDi from its pParaBiDi parent */
|
||||
pLineBiDi->pParaBiDi=NULL; /* mark unfinished setLine */
|
||||
pLineBiDi->pParaBiDi=nullptr; /* mark unfinished setLine */
|
||||
pLineBiDi->text=pParaBiDi->text+start;
|
||||
length=pLineBiDi->length=limit-start;
|
||||
pLineBiDi->resultLength=pLineBiDi->originalLength=length;
|
||||
pLineBiDi->paraLevel=GET_PARALEVEL(pParaBiDi, start);
|
||||
pLineBiDi->paraCount=pParaBiDi->paraCount;
|
||||
pLineBiDi->runs=NULL;
|
||||
pLineBiDi->runs=nullptr;
|
||||
pLineBiDi->flags=0;
|
||||
pLineBiDi->reorderingMode=pParaBiDi->reorderingMode;
|
||||
pLineBiDi->reorderingOptions=pParaBiDi->reorderingOptions;
|
||||
|
@ -263,11 +263,11 @@ U_CAPI const UBiDiLevel * U_EXPORT2
|
|||
ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
|
||||
int32_t start, length;
|
||||
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, NULL);
|
||||
RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, NULL);
|
||||
RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, nullptr);
|
||||
RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, nullptr);
|
||||
if((length=pBiDi->length)<=0) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if((start=pBiDi->trailingWSStart)==length) {
|
||||
/* the current levels array reflects the WS run */
|
||||
|
@ -297,7 +297,7 @@ ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
|
|||
} else {
|
||||
/* out of memory */
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,10 +373,10 @@ ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
|
|||
RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR);
|
||||
|
||||
start=pBiDi->runs[runIndex].logicalStart;
|
||||
if(pLogicalStart!=NULL) {
|
||||
if(pLogicalStart!=nullptr) {
|
||||
*pLogicalStart=GET_INDEX(start);
|
||||
}
|
||||
if(pLength!=NULL) {
|
||||
if(pLength!=nullptr) {
|
||||
if(runIndex>0) {
|
||||
*pLength=pBiDi->runs[runIndex].visualLimit-
|
||||
pBiDi->runs[runIndex-1].visualLimit;
|
||||
|
@ -713,7 +713,7 @@ prepareReorder(const UBiDiLevel *levels, int32_t length,
|
|||
int32_t start;
|
||||
UBiDiLevel level, minLevel, maxLevel;
|
||||
|
||||
if(levels==NULL || length<=0) {
|
||||
if(levels==nullptr || length<=0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@ ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap
|
|||
int32_t start, limit, sumOfSosEos;
|
||||
UBiDiLevel minLevel = 0, maxLevel = 0;
|
||||
|
||||
if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
|
||||
if(indexMap==nullptr || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -814,7 +814,7 @@ ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap)
|
|||
int32_t start, end, limit, temp;
|
||||
UBiDiLevel minLevel = 0, maxLevel = 0;
|
||||
|
||||
if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
|
||||
if(indexMap==nullptr || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
|||
ubidi_countRuns(pBiDi, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
/* no op */
|
||||
} else if(indexMap==NULL) {
|
||||
} else if(indexMap==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
} else {
|
||||
/* fill a logical-to-visual index map using the runs[] */
|
||||
|
@ -1210,7 +1210,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
|||
U_CAPI void U_EXPORT2
|
||||
ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
||||
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
|
||||
if(indexMap==NULL) {
|
||||
if(indexMap==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1317,7 +1317,7 @@ ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) {
|
||||
if(srcMap!=NULL && destMap!=NULL && length>0) {
|
||||
if(srcMap!=nullptr && destMap!=nullptr && length>0) {
|
||||
const int32_t *pi;
|
||||
int32_t destLength=-1, count=0;
|
||||
/* find highest value and count positive indexes in srcMap */
|
||||
|
|
|
@ -92,10 +92,10 @@ struct UBiDiTransform {
|
|||
U_CAPI UBiDiTransform* U_EXPORT2
|
||||
ubiditransform_open(UErrorCode *pErrorCode)
|
||||
{
|
||||
UBiDiTransform *pBiDiTransform = NULL;
|
||||
UBiDiTransform *pBiDiTransform = nullptr;
|
||||
if (U_SUCCESS(*pErrorCode)) {
|
||||
pBiDiTransform = (UBiDiTransform*) uprv_calloc(1, sizeof(UBiDiTransform));
|
||||
if (pBiDiTransform == NULL) {
|
||||
if (pBiDiTransform == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -105,11 +105,11 @@ ubiditransform_open(UErrorCode *pErrorCode)
|
|||
U_CAPI void U_EXPORT2
|
||||
ubiditransform_close(UBiDiTransform *pBiDiTransform)
|
||||
{
|
||||
if (pBiDiTransform != NULL) {
|
||||
if (pBiDiTransform->pBidi != NULL) {
|
||||
if (pBiDiTransform != nullptr) {
|
||||
if (pBiDiTransform->pBidi != nullptr) {
|
||||
ubidi_close(pBiDiTransform->pBidi);
|
||||
}
|
||||
if (pBiDiTransform->src != NULL) {
|
||||
if (pBiDiTransform->src != nullptr) {
|
||||
uprv_free(pBiDiTransform->src);
|
||||
}
|
||||
uprv_free(pBiDiTransform);
|
||||
|
@ -129,7 +129,7 @@ static UBool
|
|||
action_resolve(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
|
||||
{
|
||||
ubidi_setPara(pTransform->pBidi, pTransform->src, pTransform->srcLength,
|
||||
pTransform->pActiveScheme->baseLevel, NULL, pErrorCode);
|
||||
pTransform->pActiveScheme->baseLevel, nullptr, pErrorCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -229,12 +229,12 @@ updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength,
|
|||
}
|
||||
if (newSize > pTransform->srcSize) {
|
||||
newSize += 50; // allocate slightly more than needed right now
|
||||
if (pTransform->src != NULL) {
|
||||
if (pTransform->src != nullptr) {
|
||||
uprv_free(pTransform->src);
|
||||
pTransform->src = NULL;
|
||||
pTransform->src = nullptr;
|
||||
}
|
||||
pTransform->src = (UChar *)uprv_malloc(newSize * sizeof(UChar));
|
||||
if (pTransform->src == NULL) {
|
||||
if (pTransform->src == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
//pTransform->srcLength = pTransform->srcSize = 0;
|
||||
return;
|
||||
|
@ -331,52 +331,52 @@ static const ReorderingScheme Schemes[] =
|
|||
{
|
||||
/* 0: Logical LTR => Visual LTR */
|
||||
{LTR, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
|
||||
{action_shapeArabic, action_resolve, action_reorder, NULL}},
|
||||
{action_shapeArabic, action_resolve, action_reorder, nullptr}},
|
||||
/* 1: Logical RTL => Visual LTR */
|
||||
{RTL, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
|
||||
{action_resolve, action_reorder, action_shapeArabic, NULL}},
|
||||
{action_resolve, action_reorder, action_shapeArabic, nullptr}},
|
||||
/* 2: Logical LTR => Visual RTL */
|
||||
{LTR, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
|
||||
{action_shapeArabic, action_resolve, action_reorder, action_reverse, NULL}},
|
||||
{action_shapeArabic, action_resolve, action_reorder, action_reverse, nullptr}},
|
||||
/* 3: Logical RTL => Visual RTL */
|
||||
{RTL, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
|
||||
{action_resolve, action_reorder, action_shapeArabic, action_reverse, NULL}},
|
||||
{action_resolve, action_reorder, action_shapeArabic, action_reverse, nullptr}},
|
||||
/* 4: Visual LTR => Logical RTL */
|
||||
{LTR, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
|
||||
{action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
|
||||
{action_shapeArabic, action_setInverse, action_resolve, action_reorder, nullptr}},
|
||||
/* 5: Visual RTL => Logical RTL */
|
||||
{RTL, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
|
||||
{action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
|
||||
{action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, nullptr}},
|
||||
/* 6: Visual LTR => Logical LTR */
|
||||
{LTR, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
|
||||
{action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
|
||||
{action_setInverse, action_resolve, action_reorder, action_shapeArabic, nullptr}},
|
||||
/* 7: Visual RTL => Logical LTR */
|
||||
{RTL, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
|
||||
{action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
|
||||
{action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, nullptr}},
|
||||
/* 8: Logical LTR => Logical RTL */
|
||||
{LTR, LOGICAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
|
||||
{action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, NULL}},
|
||||
{action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, nullptr}},
|
||||
/* 9: Logical RTL => Logical LTR */
|
||||
{RTL, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, RTL,
|
||||
{action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, NULL}},
|
||||
{action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, nullptr}},
|
||||
/* 10: Visual LTR => Visual RTL */
|
||||
{LTR, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
|
||||
{action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, NULL}},
|
||||
{action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, nullptr}},
|
||||
/* 11: Visual RTL => Visual LTR */
|
||||
{RTL, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
|
||||
{action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, NULL}},
|
||||
{action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, nullptr}},
|
||||
/* 12: Logical LTR => Logical LTR */
|
||||
{LTR, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
|
||||
{action_resolve, action_mirror, action_shapeArabic, NULL}},
|
||||
{action_resolve, action_mirror, action_shapeArabic, nullptr}},
|
||||
/* 13: Logical RTL => Logical RTL */
|
||||
{RTL, LOGICAL, RTL, LOGICAL, SHAPE_VISUAL, SHAPE_LOGICAL, RTL,
|
||||
{action_resolve, action_mirror, action_shapeArabic, NULL}},
|
||||
{action_resolve, action_mirror, action_shapeArabic, nullptr}},
|
||||
/* 14: Visual LTR => Visual LTR */
|
||||
{LTR, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
|
||||
{action_resolve, action_mirror, action_shapeArabic, NULL}},
|
||||
{action_resolve, action_mirror, action_shapeArabic, nullptr}},
|
||||
/* 15: Visual RTL => Visual RTL */
|
||||
{RTL, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
|
||||
{action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, NULL}}
|
||||
{action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, nullptr}}
|
||||
};
|
||||
|
||||
static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes);
|
||||
|
@ -417,7 +417,7 @@ resolveBaseDirection(const UChar *text, uint32_t length,
|
|||
* Finds a valid <code>ReorderingScheme</code> matching the
|
||||
* caller-defined scheme.
|
||||
*
|
||||
* @return A valid <code>ReorderingScheme</code> object or NULL
|
||||
* @return A valid <code>ReorderingScheme</code> object or nullptr
|
||||
*/
|
||||
static const ReorderingScheme*
|
||||
findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
|
||||
|
@ -431,7 +431,7 @@ findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
|
|||
return pScheme;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
|
@ -446,19 +446,19 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
|
|||
uint32_t destLength = 0;
|
||||
UBool textChanged = false;
|
||||
const UBiDiTransform *pOrigTransform = pBiDiTransform;
|
||||
const UBiDiAction *action = NULL;
|
||||
const UBiDiAction *action = nullptr;
|
||||
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if (src == NULL || dest == NULL) {
|
||||
if (src == nullptr || dest == nullptr) {
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
CHECK_LEN(src, srcLength, pErrorCode);
|
||||
CHECK_LEN(dest, destSize, pErrorCode);
|
||||
|
||||
if (pBiDiTransform == NULL) {
|
||||
if (pBiDiTransform == nullptr) {
|
||||
pBiDiTransform = ubiditransform_open(pErrorCode);
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
|
@ -470,7 +470,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
|
|||
|
||||
pBiDiTransform->pActiveScheme = findMatchingScheme(inParaLevel, outParaLevel,
|
||||
inOrder, outOrder);
|
||||
if (pBiDiTransform->pActiveScheme == NULL) {
|
||||
if (pBiDiTransform->pActiveScheme == nullptr) {
|
||||
goto cleanup;
|
||||
}
|
||||
pBiDiTransform->reorderingOptions = doMirroring ? UBIDI_DO_MIRRORING
|
||||
|
@ -486,7 +486,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
goto cleanup;
|
||||
}
|
||||
if (pBiDiTransform->pBidi == NULL) {
|
||||
if (pBiDiTransform->pBidi == nullptr) {
|
||||
pBiDiTransform->pBidi = ubidi_openSized(0, 0, pErrorCode);
|
||||
if (U_FAILURE(*pErrorCode)) {
|
||||
goto cleanup;
|
||||
|
@ -521,8 +521,8 @@ cleanup:
|
|||
if (pOrigTransform != pBiDiTransform) {
|
||||
ubiditransform_close(pBiDiTransform);
|
||||
} else {
|
||||
pBiDiTransform->dest = NULL;
|
||||
pBiDiTransform->pDestLength = NULL;
|
||||
pBiDiTransform->dest = nullptr;
|
||||
pBiDiTransform->pDestLength = nullptr;
|
||||
pBiDiTransform->srcLength = 0;
|
||||
pBiDiTransform->destSize = 0;
|
||||
}
|
||||
|
|
|
@ -312,20 +312,20 @@ ubidi_writeReverse(const UChar *src, int32_t srcLength,
|
|||
UErrorCode *pErrorCode) {
|
||||
int32_t destLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* more error checking */
|
||||
if( src==NULL || srcLength<-1 ||
|
||||
destSize<0 || (destSize>0 && dest==NULL))
|
||||
if( src==nullptr || srcLength<-1 ||
|
||||
destSize<0 || (destSize>0 && dest==nullptr))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do input and output overlap? */
|
||||
if( dest!=NULL &&
|
||||
if( dest!=nullptr &&
|
||||
((src>=dest && src<dest+destSize) ||
|
||||
(dest>=src && dest<src+srcLength)))
|
||||
{
|
||||
|
@ -363,21 +363,21 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
int32_t length, destCapacity;
|
||||
int32_t run, runCount, logicalStart, runLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* more error checking */
|
||||
if( pBiDi==NULL ||
|
||||
(text=pBiDi->text)==NULL || (length=pBiDi->length)<0 ||
|
||||
destSize<0 || (destSize>0 && dest==NULL))
|
||||
if( pBiDi==nullptr ||
|
||||
(text=pBiDi->text)==nullptr || (length=pBiDi->length)<0 ||
|
||||
destSize<0 || (destSize>0 && dest==nullptr))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do input and output overlap? */
|
||||
if( dest!=NULL &&
|
||||
if( dest!=nullptr &&
|
||||
((text>=dest && text<dest+destSize) ||
|
||||
(dest>=text && dest<text+pBiDi->originalLength)))
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
}
|
||||
if(dest!=NULL) {
|
||||
if(dest!=nullptr) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
@ -495,7 +495,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
runLength=doWriteForward(src, runLength,
|
||||
dest, destSize,
|
||||
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
if(dest!=nullptr) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
@ -539,7 +539,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
runLength=doWriteReverse(src, runLength,
|
||||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
if(dest!=nullptr) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
@ -578,7 +578,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
}
|
||||
if(dest!=NULL) {
|
||||
if(dest!=nullptr) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
@ -605,7 +605,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
runLength=doWriteReverse(src, runLength,
|
||||
dest, destSize,
|
||||
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
if(dest!=nullptr) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
@ -627,7 +627,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
|
|||
runLength=doWriteForward(src, runLength,
|
||||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
if(dest!=nullptr) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
|
|
@ -50,7 +50,7 @@ ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
|||
}
|
||||
|
||||
/* add the start code point of each same-value range of the trie */
|
||||
utrie2_enum(&ucase_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
|
||||
utrie2_enum(&ucase_props_singleton.trie, nullptr, _enumPropertyStartsRange, sa);
|
||||
|
||||
/* add code points with hardcoded properties, plus the ones following them */
|
||||
|
||||
|
@ -279,7 +279,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
|
|||
closure=(const UChar *)pe+1; /* behind this slot, unless there are full case mappings */
|
||||
} else {
|
||||
closureLength=0;
|
||||
closure=NULL;
|
||||
closure=nullptr;
|
||||
}
|
||||
|
||||
/* add the full case folding */
|
||||
|
@ -353,7 +353,7 @@ U_CFUNC UBool U_EXPORT2
|
|||
ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) {
|
||||
int32_t i, start, limit, result, unfoldRows, unfoldRowWidth, unfoldStringWidth;
|
||||
|
||||
if(ucase_props_singleton.unfold==NULL || s==NULL) {
|
||||
if(ucase_props_singleton.unfold==nullptr || s==nullptr) {
|
||||
return false; /* no reverse case folding data, or no string */
|
||||
}
|
||||
if(length<=1) {
|
||||
|
@ -708,7 +708,7 @@ ucase_isCaseSensitive(UChar32 c) {
|
|||
#define is_sep(c) ((c)=='_' || (c)=='-' || (c)==0)
|
||||
|
||||
/**
|
||||
* Requires non-NULL locale ID but otherwise does the equivalent of
|
||||
* Requires non-nullptr locale ID but otherwise does the equivalent of
|
||||
* checking for language codes as if uloc_getLanguage() were called:
|
||||
* Accepts both 2- and 3-letter codes and accepts case variants.
|
||||
*/
|
||||
|
@ -721,7 +721,7 @@ ucase_getCaseLocale(const char *locale) {
|
|||
* examined and copied/transformed.
|
||||
*
|
||||
* Because this code does not want to depend on uloc, the caller must
|
||||
* pass in a non-NULL locale, i.e., may need to call uloc_getDefault().
|
||||
* pass in a non-nullptr locale, i.e., may need to call uloc_getDefault().
|
||||
*/
|
||||
char c=*locale++;
|
||||
// Fastpath for English "en" which is often used for default (=root locale) case mappings,
|
||||
|
@ -904,7 +904,7 @@ static UBool
|
|||
isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
|
||||
UChar32 c;
|
||||
|
||||
if(iter==NULL) {
|
||||
if(iter==nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -929,7 +929,7 @@ isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
|
|||
int32_t dotType;
|
||||
int8_t dir;
|
||||
|
||||
if(iter==NULL) {
|
||||
if(iter==nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -986,7 +986,7 @@ isPrecededBy_I(UCaseContextIterator *iter, void *context) {
|
|||
int32_t dotType;
|
||||
int8_t dir;
|
||||
|
||||
if(iter==NULL) {
|
||||
if(iter==nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
|
|||
int32_t dotType;
|
||||
int8_t dir;
|
||||
|
||||
if(iter==NULL) {
|
||||
if(iter==nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
|
|||
int32_t dotType;
|
||||
int8_t dir;
|
||||
|
||||
if(iter==NULL) {
|
||||
if(iter==nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1589,17 +1589,17 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) {
|
|||
* start sets for normalization and case mappings.
|
||||
*/
|
||||
case UCHAR_CHANGES_WHEN_LOWERCASED:
|
||||
return (UBool)(ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
return (UBool)(ucase_toFullLower(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
case UCHAR_CHANGES_WHEN_UPPERCASED:
|
||||
return (UBool)(ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
return (UBool)(ucase_toFullUpper(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
case UCHAR_CHANGES_WHEN_TITLECASED:
|
||||
return (UBool)(ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
return (UBool)(ucase_toFullTitle(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
/* case UCHAR_CHANGES_WHEN_CASEFOLDED: -- in uprops.c */
|
||||
case UCHAR_CHANGES_WHEN_CASEMAPPED:
|
||||
return (UBool)(
|
||||
ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
ucase_toFullLower(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullUpper(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullTitle(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -974,14 +974,14 @@ static const uint16_t ucase_props_unfold[370]={
|
|||
};
|
||||
|
||||
static const UCaseProps ucase_props_singleton={
|
||||
NULL,
|
||||
nullptr,
|
||||
ucase_props_indexes,
|
||||
ucase_props_exceptions,
|
||||
ucase_props_unfold,
|
||||
{
|
||||
ucase_props_trieIndex,
|
||||
ucase_props_trieIndex+3412,
|
||||
NULL,
|
||||
nullptr,
|
||||
3412,
|
||||
9736,
|
||||
0x188,
|
||||
|
@ -990,7 +990,7 @@ static const UCaseProps ucase_props_singleton={
|
|||
0x0,
|
||||
0xe0800,
|
||||
0x3358,
|
||||
NULL, 0, false, false, 0, NULL
|
||||
nullptr, 0, false, false, 0, nullptr
|
||||
},
|
||||
{ 4,0,0,0 }
|
||||
};
|
||||
|
|
|
@ -49,7 +49,7 @@ U_NAMESPACE_USE
|
|||
|
||||
UCaseMap::UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode) :
|
||||
#if !UCONFIG_NO_BREAK_ITERATION
|
||||
iter(NULL),
|
||||
iter(nullptr),
|
||||
#endif
|
||||
caseLocale(UCASE_LOC_UNKNOWN), options(opts) {
|
||||
ucasemap_setLocale(this, localeID, pErrorCode);
|
||||
|
@ -64,15 +64,15 @@ UCaseMap::~UCaseMap() {
|
|||
U_CAPI UCaseMap * U_EXPORT2
|
||||
ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode) {
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
UCaseMap *csm = new UCaseMap(locale, options, pErrorCode);
|
||||
if(csm==NULL) {
|
||||
if(csm==nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else if (U_FAILURE(*pErrorCode)) {
|
||||
delete csm;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return csm;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if (locale != NULL && *locale == 0) {
|
||||
if (locale != nullptr && *locale == 0) {
|
||||
csm->locale[0] = 0;
|
||||
csm->caseLocale = UCASE_LOC_ROOT;
|
||||
return;
|
||||
|
@ -143,7 +143,7 @@ appendResult(int32_t cpLength, int32_t result, const UChar *s,
|
|||
/* decode the result */
|
||||
if(result<0) {
|
||||
/* (not) original code point */
|
||||
if(edits!=NULL) {
|
||||
if(edits!=nullptr) {
|
||||
edits->addUnchanged(cpLength);
|
||||
}
|
||||
if((options & U_OMIT_UNCHANGED_TEXT) == 0) {
|
||||
|
@ -757,11 +757,11 @@ void toUpper(uint32_t options,
|
|||
int32_t newLength = (i2 - i) + numYpogegrammeni * 2; // 2 bytes per U+0399
|
||||
change |= oldLength != newLength;
|
||||
if (change) {
|
||||
if (edits != NULL) {
|
||||
if (edits != nullptr) {
|
||||
edits->addReplace(oldLength, newLength);
|
||||
}
|
||||
} else {
|
||||
if (edits != NULL) {
|
||||
if (edits != nullptr) {
|
||||
edits->addUnchanged(oldLength);
|
||||
}
|
||||
// Write unchanged text?
|
||||
|
@ -784,7 +784,7 @@ void toUpper(uint32_t options,
|
|||
}
|
||||
} else if(c>=0) {
|
||||
const UChar *s;
|
||||
c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
|
||||
c=ucase_toFullUpper(c, nullptr, nullptr, &s, UCASE_LOC_GREEK);
|
||||
if (!appendResult(nextIndex - i, c, s, sink, options, edits, errorCode)) {
|
||||
return;
|
||||
}
|
||||
|
@ -891,8 +891,8 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P
|
|||
return 0;
|
||||
}
|
||||
if( destCapacity<0 ||
|
||||
(dest==NULL && destCapacity>0) ||
|
||||
(src==NULL && srcLength!=0) || srcLength<-1
|
||||
(dest==nullptr && destCapacity>0) ||
|
||||
(src==nullptr && srcLength!=0) || srcLength<-1
|
||||
) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
@ -904,7 +904,7 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P
|
|||
}
|
||||
|
||||
/* check for overlapping source and destination */
|
||||
if( dest!=NULL &&
|
||||
if( dest!=nullptr &&
|
||||
((src>=dest && src<(dest+destCapacity)) ||
|
||||
(dest>=src && dest<(src+srcLength)))
|
||||
) {
|
||||
|
@ -940,7 +940,7 @@ ucasemap_utf8ToLower(const UCaseMap *csm,
|
|||
csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
|
||||
dest, destCapacity,
|
||||
src, srcLength,
|
||||
ucasemap_internalUTF8ToLower, NULL, *pErrorCode);
|
||||
ucasemap_internalUTF8ToLower, nullptr, *pErrorCode);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
|
@ -952,7 +952,7 @@ ucasemap_utf8ToUpper(const UCaseMap *csm,
|
|||
csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
|
||||
dest, destCapacity,
|
||||
src, srcLength,
|
||||
ucasemap_internalUTF8ToUpper, NULL, *pErrorCode);
|
||||
ucasemap_internalUTF8ToUpper, nullptr, *pErrorCode);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
|
@ -964,7 +964,7 @@ ucasemap_utf8FoldCase(const UCaseMap *csm,
|
|||
UCASE_LOC_ROOT, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
|
||||
dest, destCapacity,
|
||||
src, srcLength,
|
||||
ucasemap_internalUTF8Fold, NULL, *pErrorCode);
|
||||
ucasemap_internalUTF8Fold, nullptr, *pErrorCode);
|
||||
}
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
|
|
@ -66,7 +66,7 @@ int32_t CaseMap::utf8ToTitle(
|
|||
utext_openUTF8(&utext, src, srcLength, &errorCode);
|
||||
LocalPointer<BreakIterator> ownedIter;
|
||||
iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
|
||||
if(iter==NULL) {
|
||||
if(iter==nullptr) {
|
||||
utext_close(&utext);
|
||||
return 0;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm,
|
|||
if (U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(csm->iter==NULL) {
|
||||
if(csm->iter==nullptr) {
|
||||
LocalPointer<BreakIterator> ownedIter;
|
||||
BreakIterator *iter = ustrcase_getTitleBreakIterator(
|
||||
nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
|
||||
|
@ -126,7 +126,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm,
|
|||
csm->caseLocale, csm->options, csm->iter,
|
||||
dest, destCapacity,
|
||||
src, srcLength,
|
||||
ucasemap_internalUTF8ToTitle, NULL, *pErrorCode);
|
||||
ucasemap_internalUTF8ToTitle, nullptr, *pErrorCode);
|
||||
utext_close(&utext);
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ u_catopen(const char* name, const char* locale, UErrorCode* ec) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_catclose(u_nl_catd catd) {
|
||||
ures_close((UResourceBundle*) catd); /* may be NULL */
|
||||
ures_close((UResourceBundle*) catd); /* may be nullptr */
|
||||
}
|
||||
|
||||
U_CAPI const UChar* U_EXPORT2
|
||||
|
@ -54,7 +54,7 @@ u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
|
|||
char key[MAX_KEY_LEN];
|
||||
const UChar* result;
|
||||
|
||||
if (ec == NULL || U_FAILURE(*ec)) {
|
||||
if (ec == nullptr || U_FAILURE(*ec)) {
|
||||
goto ERROR;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
|
|||
|
||||
ERROR:
|
||||
/* In case of any failure, return s */
|
||||
if (len != NULL) {
|
||||
if (len != nullptr) {
|
||||
*len = u_strlen(s);
|
||||
}
|
||||
return s;
|
||||
|
|
|
@ -76,7 +76,7 @@ U_CAPI void U_EXPORT2
|
|||
u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) {
|
||||
struct _EnumTypeCallback callback;
|
||||
|
||||
if(enumRange==NULL) {
|
||||
if(enumRange==nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ u_forDigit(int32_t digit, int8_t radix) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_getUnicodeVersion(UVersionInfo versionArray) {
|
||||
if(versionArray!=NULL) {
|
||||
if(versionArray!=nullptr) {
|
||||
uprv_memcpy(versionArray, dataVersion, U_MAX_VERSION_LENGTH);
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ uprv_getMaxValues(int32_t column) {
|
|||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_charAge(UChar32 c, UVersionInfo versionArray) {
|
||||
if(versionArray!=NULL) {
|
||||
if(versionArray!=nullptr) {
|
||||
uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT;
|
||||
versionArray[0]=(uint8_t)(version>>4);
|
||||
versionArray[1]=(uint8_t)(version&0xf);
|
||||
|
@ -532,7 +532,7 @@ u_charAge(UChar32 c, UVersionInfo versionArray) {
|
|||
|
||||
U_CAPI UScriptCode U_EXPORT2
|
||||
uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return USCRIPT_INVALID_CODE;
|
||||
}
|
||||
if((uint32_t)c>0x10ffff) {
|
||||
|
@ -579,10 +579,10 @@ U_CAPI int32_t U_EXPORT2
|
|||
uscript_getScriptExtensions(UChar32 c,
|
||||
UScriptCode *scripts, int32_t capacity,
|
||||
UErrorCode *pErrorCode) {
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(capacity<0 || (capacity>0 && scripts==NULL)) {
|
||||
if(capacity<0 || (capacity>0 && scripts==nullptr)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
|||
}
|
||||
|
||||
/* add the start code point of each same-value range of the main trie */
|
||||
utrie2_enum(&propsTrie, NULL, _enumPropertyStartsRange, sa);
|
||||
utrie2_enum(&propsTrie, nullptr, _enumPropertyStartsRange, sa);
|
||||
|
||||
/* add code points with hardcoded properties, plus the ones following them */
|
||||
|
||||
|
@ -704,5 +704,5 @@ upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
|||
}
|
||||
|
||||
/* add the start code point of each same-value range of the properties vectors trie */
|
||||
utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
|
||||
utrie2_enum(&propsVectorsTrie, nullptr, _enumPropertyStartsRange, sa);
|
||||
}
|
||||
|
|
|
@ -1456,7 +1456,7 @@ static const uint16_t propsTrie_index[23016]={
|
|||
static const UTrie2 propsTrie={
|
||||
propsTrie_index,
|
||||
propsTrie_index+4692,
|
||||
NULL,
|
||||
nullptr,
|
||||
4692,
|
||||
18324,
|
||||
0xa40,
|
||||
|
@ -1465,7 +1465,7 @@ static const UTrie2 propsTrie={
|
|||
0x0,
|
||||
0x110000,
|
||||
0x59e4,
|
||||
NULL, 0, false, false, 0, NULL
|
||||
nullptr, 0, false, false, 0, nullptr
|
||||
};
|
||||
|
||||
static const uint16_t propsVectorsTrie_index[32692]={
|
||||
|
@ -3518,7 +3518,7 @@ static const uint16_t propsVectorsTrie_index[32692]={
|
|||
static const UTrie2 propsVectorsTrie={
|
||||
propsVectorsTrie_index,
|
||||
propsVectorsTrie_index+5348,
|
||||
NULL,
|
||||
nullptr,
|
||||
5348,
|
||||
27344,
|
||||
0xa40,
|
||||
|
@ -3527,7 +3527,7 @@ static const UTrie2 propsVectorsTrie={
|
|||
0x0,
|
||||
0x110000,
|
||||
0x7fb0,
|
||||
NULL, 0, false, false, 0, NULL
|
||||
nullptr, 0, false, false, 0, nullptr
|
||||
};
|
||||
|
||||
static const uint32_t propsVectors[7230]={
|
||||
|
|
|
@ -31,7 +31,7 @@ UCharsTrie::~UCharsTrie() {
|
|||
UStringTrieResult
|
||||
UCharsTrie::current() const {
|
||||
const UChar *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return USTRINGTRIE_NO_MATCH;
|
||||
} else {
|
||||
int32_t node;
|
||||
|
@ -154,7 +154,7 @@ UCharsTrie::nextImpl(const UChar *pos, int32_t uchar) {
|
|||
UStringTrieResult
|
||||
UCharsTrie::next(int32_t uchar) {
|
||||
const UChar *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return USTRINGTRIE_NO_MATCH;
|
||||
}
|
||||
int32_t length=remainingMatchLength_; // Actual remaining match length minus 1.
|
||||
|
@ -182,7 +182,7 @@ UCharsTrie::next(ConstChar16Ptr ptr, int32_t sLength) {
|
|||
return current();
|
||||
}
|
||||
const UChar *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return USTRINGTRIE_NO_MATCH;
|
||||
}
|
||||
int32_t length=remainingMatchLength_; // Actual remaining match length minus 1.
|
||||
|
@ -287,8 +287,8 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
|
|||
UBool haveUniqueValue, int32_t &uniqueValue) {
|
||||
while(length>kMaxBranchLinearSubNodeLength) {
|
||||
++pos; // ignore the comparison unit
|
||||
if(NULL==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
|
||||
return NULL;
|
||||
if(nullptr==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
|
||||
return nullptr;
|
||||
}
|
||||
length=length-(length>>1);
|
||||
pos=skipDelta(pos);
|
||||
|
@ -304,7 +304,7 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
|
|||
if(isFinal) {
|
||||
if(haveUniqueValue) {
|
||||
if(value!=uniqueValue) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
uniqueValue=value;
|
||||
|
@ -312,7 +312,7 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
|
|||
}
|
||||
} else {
|
||||
if(!findUniqueValue(pos+value, haveUniqueValue, uniqueValue)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
haveUniqueValue=true;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &un
|
|||
node=*pos++;
|
||||
}
|
||||
pos=findUniqueValueFromBranch(pos, node+1, haveUniqueValue, uniqueValue);
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return false;
|
||||
}
|
||||
haveUniqueValue=true;
|
||||
|
@ -366,7 +366,7 @@ UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &un
|
|||
int32_t
|
||||
UCharsTrie::getNextUChars(Appendable &out) const {
|
||||
const UChar *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return 0;
|
||||
}
|
||||
if(remainingMatchLength_>=0) {
|
||||
|
|
|
@ -86,8 +86,8 @@ UCharsTrieElement::compareStringTo(const UCharsTrieElement &other, const Unicode
|
|||
}
|
||||
|
||||
UCharsTrieBuilder::UCharsTrieBuilder(UErrorCode & /*errorCode*/)
|
||||
: elements(NULL), elementsCapacity(0), elementsLength(0),
|
||||
uchars(NULL), ucharsCapacity(0), ucharsLength(0) {}
|
||||
: elements(nullptr), elementsCapacity(0), elementsLength(0),
|
||||
uchars(nullptr), ucharsCapacity(0), ucharsLength(0) {}
|
||||
|
||||
UCharsTrieBuilder::~UCharsTrieBuilder() {
|
||||
delete[] elements;
|
||||
|
@ -112,7 +112,7 @@ UCharsTrieBuilder::add(const UnicodeString &s, int32_t value, UErrorCode &errorC
|
|||
newCapacity=4*elementsCapacity;
|
||||
}
|
||||
UCharsTrieElement *newElements=new UCharsTrieElement[newCapacity];
|
||||
if(newElements==NULL) {
|
||||
if(newElements==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return *this;
|
||||
}
|
||||
|
@ -145,13 +145,13 @@ U_CDECL_END
|
|||
UCharsTrie *
|
||||
UCharsTrieBuilder::build(UStringTrieBuildOption buildOption, UErrorCode &errorCode) {
|
||||
buildUChars(buildOption, errorCode);
|
||||
UCharsTrie *newTrie=NULL;
|
||||
UCharsTrie *newTrie=nullptr;
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
newTrie=new UCharsTrie(uchars, uchars+(ucharsCapacity-ucharsLength));
|
||||
if(newTrie==NULL) {
|
||||
if(newTrie==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
} else {
|
||||
uchars=NULL; // The new trie now owns the array.
|
||||
uchars=nullptr; // The new trie now owns the array.
|
||||
ucharsCapacity=0;
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
if(uchars!=NULL && ucharsLength>0) {
|
||||
if(uchars!=nullptr && ucharsLength>0) {
|
||||
// Already built.
|
||||
return;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
|
|||
if(ucharsCapacity<capacity) {
|
||||
uprv_free(uchars);
|
||||
uchars=static_cast<UChar *>(uprv_malloc(capacity*2));
|
||||
if(uchars==NULL) {
|
||||
if(uchars==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
ucharsCapacity=0;
|
||||
return;
|
||||
|
@ -221,7 +221,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
|
|||
ucharsCapacity=capacity;
|
||||
}
|
||||
StringTrieBuilder::build(buildOption, elementsLength, errorCode);
|
||||
if(uchars==NULL) {
|
||||
if(uchars==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ UCharsTrieBuilder::createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t l
|
|||
|
||||
UBool
|
||||
UCharsTrieBuilder::ensureCapacity(int32_t length) {
|
||||
if(uchars==NULL) {
|
||||
if(uchars==nullptr) {
|
||||
return false; // previous memory allocation had failed
|
||||
}
|
||||
if(length>ucharsCapacity) {
|
||||
|
@ -330,10 +330,10 @@ UCharsTrieBuilder::ensureCapacity(int32_t length) {
|
|||
newCapacity*=2;
|
||||
} while(newCapacity<=length);
|
||||
UChar *newUChars=static_cast<UChar *>(uprv_malloc(newCapacity*2));
|
||||
if(newUChars==NULL) {
|
||||
if(newUChars==nullptr) {
|
||||
// unable to allocate memory
|
||||
uprv_free(uchars);
|
||||
uchars=NULL;
|
||||
uchars=nullptr;
|
||||
ucharsCapacity=0;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLengt
|
|||
pos_(uchars_), initialPos_(uchars_),
|
||||
remainingMatchLength_(-1), initialRemainingMatchLength_(-1),
|
||||
skipValue_(false),
|
||||
maxLength_(maxStringLength), value_(0), stack_(NULL) {
|
||||
maxLength_(maxStringLength), value_(0), stack_(nullptr) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLengt
|
|||
// via the UnicodeString and UVector32 implementations, so this additional
|
||||
// cost is minimal.
|
||||
stack_=new UVector32(errorCode);
|
||||
if(stack_==NULL) {
|
||||
if(stack_==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ UCharsTrie::Iterator::Iterator(const UCharsTrie &trie, int32_t maxStringLength,
|
|||
remainingMatchLength_(trie.remainingMatchLength_),
|
||||
initialRemainingMatchLength_(trie.remainingMatchLength_),
|
||||
skipValue_(false),
|
||||
maxLength_(maxStringLength), value_(0), stack_(NULL) {
|
||||
maxLength_(maxStringLength), value_(0), stack_(nullptr) {
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ UCharsTrie::Iterator::Iterator(const UCharsTrie &trie, int32_t maxStringLength,
|
|||
if(U_FAILURE(errorCode)) {
|
||||
return;
|
||||
}
|
||||
if(stack_==NULL) {
|
||||
if(stack_==nullptr) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ UCharsTrie::Iterator::reset() {
|
|||
}
|
||||
|
||||
UBool
|
||||
UCharsTrie::Iterator::hasNext() const { return pos_!=NULL || !stack_->isEmpty(); }
|
||||
UCharsTrie::Iterator::hasNext() const { return pos_!=nullptr || !stack_->isEmpty(); }
|
||||
|
||||
UBool
|
||||
UCharsTrie::Iterator::next(UErrorCode &errorCode) {
|
||||
|
@ -103,7 +103,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
return false;
|
||||
}
|
||||
const UChar *pos=pos_;
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
if(stack_->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
length=(int32_t)((uint32_t)length>>16);
|
||||
if(length>1) {
|
||||
pos=branchNext(pos, length, errorCode);
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return true; // Reached a final value.
|
||||
}
|
||||
} else {
|
||||
|
@ -145,7 +145,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
value_=readNodeValue(pos, node);
|
||||
}
|
||||
if(isFinal || (maxLength_>0 && str_.length()==maxLength_)) {
|
||||
pos_=NULL;
|
||||
pos_=nullptr;
|
||||
} else {
|
||||
// We cannot skip the value right here because it shares its
|
||||
// lead unit with a match node which we have to evaluate
|
||||
|
@ -165,7 +165,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
|
|||
node=*pos++;
|
||||
}
|
||||
pos=branchNext(pos, node+1, errorCode);
|
||||
if(pos==NULL) {
|
||||
if(pos==nullptr) {
|
||||
return true; // Reached a final value.
|
||||
}
|
||||
} else {
|
||||
|
@ -204,9 +204,9 @@ UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &e
|
|||
stack_->addElement(((length-1)<<16)|str_.length(), errorCode);
|
||||
str_.append(trieUnit);
|
||||
if(isFinal) {
|
||||
pos_=NULL;
|
||||
pos_=nullptr;
|
||||
value_=value;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
return pos+value;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ U_CAPI void U_EXPORT2
|
|||
u_cleanup(void)
|
||||
{
|
||||
UTRACE_ENTRY_OC(UTRACE_U_CLEANUP);
|
||||
icu::umtx_lock(NULL); /* Force a memory barrier, so that we are sure to see */
|
||||
icu::umtx_unlock(NULL); /* all state left around by any other threads. */
|
||||
icu::umtx_lock(nullptr); /* Force a memory barrier, so that we are sure to see */
|
||||
icu::umtx_unlock(nullptr); /* all state left around by any other threads. */
|
||||
|
||||
ucln_lib_cleanup();
|
||||
|
||||
|
@ -57,7 +57,7 @@ U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType libType)
|
|||
if (gLibCleanupFunctions[libType])
|
||||
{
|
||||
gLibCleanupFunctions[libType]();
|
||||
gLibCleanupFunctions[libType] = NULL;
|
||||
gLibCleanupFunctions[libType] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ U_CFUNC UBool ucln_lib_cleanup(void) {
|
|||
if (gCommonCleanupFunctions[commonFunc])
|
||||
{
|
||||
gCommonCleanupFunctions[commonFunc]();
|
||||
gCommonCleanupFunctions[commonFunc] = NULL;
|
||||
gCommonCleanupFunctions[commonFunc] = nullptr;
|
||||
}
|
||||
}
|
||||
#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
U_CFUNC uint16_t
|
||||
udata_getHeaderSize(const DataHeader *udh) {
|
||||
if(udh==NULL) {
|
||||
if(udh==nullptr) {
|
||||
return 0;
|
||||
} else if(udh->info.isBigEndian==U_IS_BIG_ENDIAN) {
|
||||
/* same endianness */
|
||||
|
@ -48,7 +48,7 @@ udata_getHeaderSize(const DataHeader *udh) {
|
|||
|
||||
U_CFUNC uint16_t
|
||||
udata_getInfoSize(const UDataInfo *info) {
|
||||
if(info==NULL) {
|
||||
if(info==nullptr) {
|
||||
return 0;
|
||||
} else if(info->isBigEndian==U_IS_BIG_ENDIAN) {
|
||||
/* same endianness */
|
||||
|
@ -216,7 +216,7 @@ static uint32_t U_CALLCONV
|
|||
offsetTOCEntryCount(const UDataMemory *pData) {
|
||||
int32_t retVal=0;
|
||||
const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
|
||||
if (toc != NULL) {
|
||||
if (toc != nullptr) {
|
||||
retVal = toc->count;
|
||||
}
|
||||
return retVal;
|
||||
|
@ -229,7 +229,7 @@ offsetTOCLookupFn(const UDataMemory *pData,
|
|||
UErrorCode *pErrorCode) {
|
||||
(void)pErrorCode;
|
||||
const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
|
||||
if(toc!=NULL) {
|
||||
if(toc!=nullptr) {
|
||||
const char *base=(const char *)toc;
|
||||
int32_t number, count=(int32_t)toc->count;
|
||||
|
||||
|
@ -257,7 +257,7 @@ offsetTOCLookupFn(const UDataMemory *pData,
|
|||
#ifdef UDATA_DEBUG
|
||||
fprintf(stderr, "%s: Not found.\n", tocEntryName);
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
#ifdef UDATA_DEBUG
|
||||
|
@ -271,7 +271,7 @@ offsetTOCLookupFn(const UDataMemory *pData,
|
|||
|
||||
static uint32_t U_CALLCONV pointerTOCEntryCount(const UDataMemory *pData) {
|
||||
const PointerTOC *toc = (PointerTOC *)pData->toc;
|
||||
return (uint32_t)((toc != NULL) ? (toc->count) : 0);
|
||||
return (uint32_t)((toc != nullptr) ? (toc->count) : 0);
|
||||
}
|
||||
|
||||
static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData,
|
||||
|
@ -279,7 +279,7 @@ static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData
|
|||
int32_t *pLength,
|
||||
UErrorCode *pErrorCode) {
|
||||
(void)pErrorCode;
|
||||
if(pData->toc!=NULL) {
|
||||
if(pData->toc!=nullptr) {
|
||||
const PointerTOC *toc = (PointerTOC *)pData->toc;
|
||||
int32_t number, count=(int32_t)toc->count;
|
||||
|
||||
|
@ -301,7 +301,7 @@ static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData
|
|||
#ifdef UDATA_DEBUG
|
||||
fprintf(stderr, "%s: Not found.\n", name);
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
return pData->pHeader;
|
||||
|
@ -328,7 +328,7 @@ U_CFUNC void udata_checkCommonData(UDataMemory *udm, UErrorCode *err) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(udm==NULL || udm->pHeader==NULL) {
|
||||
if(udm==nullptr || udm->pHeader==nullptr) {
|
||||
*err=U_INVALID_FORMAT_ERROR;
|
||||
} else if(!(udm->pHeader->dataHeader.magic1==0xda &&
|
||||
udm->pHeader->dataHeader.magic2==0x27 &&
|
||||
|
|
|
@ -75,11 +75,11 @@ ucnv_open (const char *name,
|
|||
{
|
||||
UConverter *r;
|
||||
|
||||
if (err == NULL || U_FAILURE (*err)) {
|
||||
return NULL;
|
||||
if (err == nullptr || U_FAILURE (*err)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
r = ucnv_createConverter(NULL, name, err);
|
||||
r = ucnv_createConverter(nullptr, name, err);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -96,14 +96,14 @@ ucnv_openU (const UChar * name,
|
|||
{
|
||||
char asciiName[UCNV_MAX_CONVERTER_NAME_LENGTH];
|
||||
|
||||
if (err == NULL || U_FAILURE(*err))
|
||||
return NULL;
|
||||
if (name == NULL)
|
||||
return ucnv_open (NULL, err);
|
||||
if (err == nullptr || U_FAILURE(*err))
|
||||
return nullptr;
|
||||
if (name == nullptr)
|
||||
return ucnv_open (nullptr, err);
|
||||
if (u_strlen(name) >= UCNV_MAX_CONVERTER_NAME_LENGTH)
|
||||
{
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return ucnv_open(u_austrcpy(asciiName, name), err);
|
||||
}
|
||||
|
@ -140,14 +140,14 @@ ucnv_openCCSID (int32_t codepage,
|
|||
char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
|
||||
int32_t myNameLen;
|
||||
|
||||
if (err == NULL || U_FAILURE (*err))
|
||||
return NULL;
|
||||
if (err == nullptr || U_FAILURE (*err))
|
||||
return nullptr;
|
||||
|
||||
/* ucnv_copyPlatformString could return "ibm-" or "cp" */
|
||||
myNameLen = ucnv_copyPlatformString(myName, platform);
|
||||
T_CString_integerToString(myName + myNameLen, codepage, 10);
|
||||
|
||||
return ucnv_createConverter(NULL, myName, err);
|
||||
return ucnv_createConverter(nullptr, myName, err);
|
||||
}
|
||||
|
||||
/* Creating a temporary stack-based object that can be used in one thread,
|
||||
|
@ -164,47 +164,47 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
UConverterToUnicodeArgs toUArgs = {
|
||||
sizeof(UConverterToUnicodeArgs),
|
||||
true,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
UConverterFromUnicodeArgs fromUArgs = {
|
||||
sizeof(UConverterFromUnicodeArgs),
|
||||
true,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
UTRACE_ENTRY_OC(UTRACE_UCNV_CLONE);
|
||||
|
||||
if (status == NULL || U_FAILURE(*status)){
|
||||
if (status == nullptr || U_FAILURE(*status)){
|
||||
UTRACE_EXIT_STATUS(status? *status: U_ILLEGAL_ARGUMENT_ERROR);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (cnv == NULL) {
|
||||
if (cnv == nullptr) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
UTRACE_EXIT_STATUS(*status);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UTRACE_DATA3(UTRACE_OPEN_CLOSE, "clone converter %s at %p into stackBuffer %p",
|
||||
ucnv_getName(cnv, status), cnv, stackBuffer);
|
||||
|
||||
if (cnv->sharedData->impl->safeClone != NULL) {
|
||||
if (cnv->sharedData->impl->safeClone != nullptr) {
|
||||
/* call the custom safeClone function for sizing */
|
||||
bufferSizeNeeded = 0;
|
||||
cnv->sharedData->impl->safeClone(cnv, NULL, &bufferSizeNeeded, status);
|
||||
cnv->sharedData->impl->safeClone(cnv, nullptr, &bufferSizeNeeded, status);
|
||||
if (U_FAILURE(*status)) {
|
||||
UTRACE_EXIT_STATUS(*status);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -213,7 +213,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
bufferSizeNeeded = sizeof(UConverter);
|
||||
}
|
||||
|
||||
if (pBufferSize == NULL) {
|
||||
if (pBufferSize == nullptr) {
|
||||
stackBufferSize = 1;
|
||||
pBufferSize = &stackBufferSize;
|
||||
} else {
|
||||
|
@ -221,7 +221,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
if (stackBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */
|
||||
*pBufferSize = bufferSizeNeeded;
|
||||
UTRACE_EXIT_VALUE(bufferSizeNeeded);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,17 +242,17 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
}
|
||||
|
||||
/* Now, see if we must allocate any memory */
|
||||
if (stackBufferSize < bufferSizeNeeded || stackBuffer == NULL)
|
||||
if (stackBufferSize < bufferSizeNeeded || stackBuffer == nullptr)
|
||||
{
|
||||
/* allocate one here...*/
|
||||
localConverter = allocatedConverter = (UConverter *) uprv_malloc (bufferSizeNeeded);
|
||||
|
||||
if(localConverter == NULL) {
|
||||
if(localConverter == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
UTRACE_EXIT_STATUS(*status);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// If pBufferSize was NULL as the input, pBufferSize is set to &stackBufferSize in this function.
|
||||
// If pBufferSize was nullptr as the input, pBufferSize is set to &stackBufferSize in this function.
|
||||
if (pBufferSize != &stackBufferSize) {
|
||||
*status = U_SAFECLONE_ALLOCATED_WARNING;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
} else {
|
||||
/* just use the stack buffer */
|
||||
localConverter = (UConverter*) stackBuffer;
|
||||
allocatedConverter = NULL;
|
||||
allocatedConverter = nullptr;
|
||||
}
|
||||
|
||||
uprv_memset(localConverter, 0, bufferSizeNeeded);
|
||||
|
@ -276,27 +276,27 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
localConverter->subChars = (uint8_t *)localConverter->subUChars;
|
||||
} else {
|
||||
localConverter->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
|
||||
if (localConverter->subChars == NULL) {
|
||||
if (localConverter->subChars == nullptr) {
|
||||
uprv_free(allocatedConverter);
|
||||
UTRACE_EXIT_STATUS(*status);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(localConverter->subChars, cnv->subChars, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
|
||||
}
|
||||
|
||||
/* now either call the safeclone fcn or not */
|
||||
if (cnv->sharedData->impl->safeClone != NULL) {
|
||||
if (cnv->sharedData->impl->safeClone != nullptr) {
|
||||
/* call the custom safeClone function */
|
||||
localConverter = cnv->sharedData->impl->safeClone(cnv, localConverter, pBufferSize, status);
|
||||
}
|
||||
|
||||
if(localConverter==NULL || U_FAILURE(*status)) {
|
||||
if (allocatedConverter != NULL && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) {
|
||||
if(localConverter==nullptr || U_FAILURE(*status)) {
|
||||
if (allocatedConverter != nullptr && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) {
|
||||
uprv_free(allocatedConverter->subChars);
|
||||
}
|
||||
uprv_free(allocatedConverter);
|
||||
UTRACE_EXIT_STATUS(*status);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* increment refcount of shared data if needed */
|
||||
|
@ -312,9 +312,9 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
|
|||
/* allow callback functions to handle any memory allocation */
|
||||
toUArgs.converter = fromUArgs.converter = localConverter;
|
||||
cbErr = U_ZERO_ERROR;
|
||||
cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, NULL, 0, UCNV_CLONE, &cbErr);
|
||||
cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, nullptr, 0, UCNV_CLONE, &cbErr);
|
||||
cbErr = U_ZERO_ERROR;
|
||||
cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLONE, &cbErr);
|
||||
cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, nullptr, 0, 0, UCNV_CLONE, &cbErr);
|
||||
|
||||
UTRACE_EXIT_PTR_STATUS(localConverter, *status);
|
||||
return localConverter;
|
||||
|
@ -336,7 +336,7 @@ ucnv_close (UConverter * converter)
|
|||
|
||||
UTRACE_ENTRY_OC(UTRACE_UCNV_CLOSE);
|
||||
|
||||
if (converter == NULL)
|
||||
if (converter == nullptr)
|
||||
{
|
||||
UTRACE_EXIT();
|
||||
return;
|
||||
|
@ -353,35 +353,35 @@ ucnv_close (UConverter * converter)
|
|||
UConverterToUnicodeArgs toUArgs = {
|
||||
sizeof(UConverterToUnicodeArgs),
|
||||
true,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
toUArgs.converter = converter;
|
||||
errorCode = U_ZERO_ERROR;
|
||||
converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_CLOSE, &errorCode);
|
||||
converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, nullptr, 0, UCNV_CLOSE, &errorCode);
|
||||
}
|
||||
if (converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
|
||||
UConverterFromUnicodeArgs fromUArgs = {
|
||||
sizeof(UConverterFromUnicodeArgs),
|
||||
true,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
fromUArgs.converter = converter;
|
||||
errorCode = U_ZERO_ERROR;
|
||||
converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLOSE, &errorCode);
|
||||
converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, nullptr, 0, 0, UCNV_CLOSE, &errorCode);
|
||||
}
|
||||
|
||||
if (converter->sharedData->impl->close != NULL) {
|
||||
if (converter->sharedData->impl->close != nullptr) {
|
||||
converter->sharedData->impl->close(converter);
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ ucnv_close (UConverter * converter)
|
|||
UTRACE_EXIT();
|
||||
}
|
||||
|
||||
/*returns a single Name from the list, will return NULL if out of bounds
|
||||
/*returns a single Name from the list, will return nullptr if out of bounds
|
||||
*/
|
||||
U_CAPI const char* U_EXPORT2
|
||||
ucnv_getAvailableName (int32_t n)
|
||||
|
@ -412,7 +412,7 @@ ucnv_getAvailableName (int32_t n)
|
|||
return name;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
|
@ -492,14 +492,14 @@ ucnv_setSubstString(UConverter *cnv,
|
|||
/* Let the following functions check all arguments. */
|
||||
cloneSize = sizeof(cloneBuffer);
|
||||
clone = ucnv_safeClone(cnv, cloneBuffer, &cloneSize, err);
|
||||
ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, err);
|
||||
ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, nullptr, nullptr, nullptr, err);
|
||||
length8 = ucnv_fromUChars(clone, chars, (int32_t)sizeof(chars), s, length, err);
|
||||
ucnv_close(clone);
|
||||
if (U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cnv->sharedData->impl->writeSub == NULL
|
||||
if (cnv->sharedData->impl->writeSub == nullptr
|
||||
#if !UCONFIG_NO_LEGACY_CONVERSION
|
||||
|| (cnv->sharedData->staticData->conversionType == UCNV_MBCS &&
|
||||
ucnv_MBCSGetType(cnv) != UCNV_EBCDIC_STATEFUL)
|
||||
|
@ -539,7 +539,7 @@ ucnv_setSubstString(UConverter *cnv,
|
|||
if (cnv->subChars == (uint8_t *)cnv->subUChars) {
|
||||
/* Allocate a new buffer for the string. */
|
||||
cnv->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
|
||||
if (cnv->subChars == NULL) {
|
||||
if (cnv->subChars == nullptr) {
|
||||
cnv->subChars = (uint8_t *)cnv->subUChars;
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -569,7 +569,7 @@ ucnv_setSubstString(UConverter *cnv,
|
|||
*/
|
||||
static void _reset(UConverter *converter, UConverterResetChoice choice,
|
||||
UBool callCallback) {
|
||||
if(converter == NULL) {
|
||||
if(converter == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -581,31 +581,31 @@ static void _reset(UConverter *converter, UConverterResetChoice choice,
|
|||
UConverterToUnicodeArgs toUArgs = {
|
||||
sizeof(UConverterToUnicodeArgs),
|
||||
true,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
toUArgs.converter = converter;
|
||||
errorCode = U_ZERO_ERROR;
|
||||
converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_RESET, &errorCode);
|
||||
converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, nullptr, 0, UCNV_RESET, &errorCode);
|
||||
}
|
||||
if(choice!=UCNV_RESET_TO_UNICODE && converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
|
||||
UConverterFromUnicodeArgs fromUArgs = {
|
||||
sizeof(UConverterFromUnicodeArgs),
|
||||
true,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
fromUArgs.converter = converter;
|
||||
errorCode = U_ZERO_ERROR;
|
||||
converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_RESET, &errorCode);
|
||||
converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, nullptr, 0, 0, UCNV_RESET, &errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ static void _reset(UConverter *converter, UConverterResetChoice choice,
|
|||
converter->preFromULength = 0;
|
||||
}
|
||||
|
||||
if (converter->sharedData->impl->reset != NULL) {
|
||||
if (converter->sharedData->impl->reset != nullptr) {
|
||||
/* call the custom reset function */
|
||||
converter->sharedData->impl->reset(converter, choice);
|
||||
}
|
||||
|
@ -667,7 +667,7 @@ ucnv_getName (const UConverter * converter, UErrorCode * err)
|
|||
|
||||
{
|
||||
if (U_FAILURE (*err))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if(converter->sharedData->impl->getName){
|
||||
const char* temp= converter->sharedData->impl->getName(converter);
|
||||
if(temp)
|
||||
|
@ -853,11 +853,11 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
|
||||
/* get the converter implementation function */
|
||||
sourceIndex=0;
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
fromUnicode=cnv->sharedData->impl->fromUnicode;
|
||||
} else {
|
||||
fromUnicode=cnv->sharedData->impl->fromUnicodeWithOffsets;
|
||||
if(fromUnicode==NULL) {
|
||||
if(fromUnicode==nullptr) {
|
||||
/* there is no WithOffsets implementation */
|
||||
fromUnicode=cnv->sharedData->impl->fromUnicode;
|
||||
/* we will write -1 for each offset */
|
||||
|
@ -867,10 +867,10 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
|
||||
if(cnv->preFromULength>=0) {
|
||||
/* normal mode */
|
||||
realSource=NULL;
|
||||
realSource=nullptr;
|
||||
|
||||
/* avoid compiler warnings - not otherwise necessary, and the values do not matter */
|
||||
realSourceLimit=NULL;
|
||||
realSourceLimit=nullptr;
|
||||
realFlush=false;
|
||||
realSourceIndex=0;
|
||||
} else {
|
||||
|
@ -942,7 +942,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
*/
|
||||
for(;;) {
|
||||
/* update offsets if we write any */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
int32_t length=(int32_t)(pArgs->target-t);
|
||||
if(length>0) {
|
||||
_updateOffsets(offsets, length, sourceIndex, errorInputLength);
|
||||
|
@ -967,7 +967,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
* switch the source to new replay units (cannot occur while replaying)
|
||||
* after offset handling and before end-of-input and callback handling
|
||||
*/
|
||||
if(realSource==NULL) {
|
||||
if(realSource==nullptr) {
|
||||
realSource=pArgs->source;
|
||||
realSourceLimit=pArgs->sourceLimit;
|
||||
realFlush=pArgs->flush;
|
||||
|
@ -984,7 +984,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
cnv->preFromULength=0;
|
||||
} else {
|
||||
/* see implementation note before _fromUnicodeWithCallback() */
|
||||
U_ASSERT(realSource==NULL);
|
||||
U_ASSERT(realSource==nullptr);
|
||||
*err=U_INTERNAL_PROGRAM_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -1000,14 +1000,14 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
* (continue converting by breaking out of only the inner loop)
|
||||
*/
|
||||
break;
|
||||
} else if(realSource!=NULL) {
|
||||
} else if(realSource!=nullptr) {
|
||||
/* switch back from replaying to the real source and continue */
|
||||
pArgs->source=realSource;
|
||||
pArgs->sourceLimit=realSourceLimit;
|
||||
pArgs->flush=realFlush;
|
||||
sourceIndex=realSourceIndex;
|
||||
|
||||
realSource=NULL;
|
||||
realSource=nullptr;
|
||||
break;
|
||||
} else if(pArgs->flush && cnv->fromUChar32!=0) {
|
||||
/*
|
||||
|
@ -1063,7 +1063,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
* copied back into the UConverter
|
||||
* and the real arguments must be restored
|
||||
*/
|
||||
if(realSource!=NULL) {
|
||||
if(realSource!=nullptr) {
|
||||
int32_t length;
|
||||
|
||||
U_ASSERT(cnv->preFromULength==0);
|
||||
|
@ -1130,10 +1130,10 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
|
|||
int32_t i, length;
|
||||
|
||||
t=*target;
|
||||
if(pOffsets!=NULL) {
|
||||
if(pOffsets!=nullptr) {
|
||||
offsets=*pOffsets;
|
||||
} else {
|
||||
offsets=NULL;
|
||||
offsets=nullptr;
|
||||
}
|
||||
|
||||
overflow=(char *)cnv->charErrorBuffer;
|
||||
|
@ -1150,7 +1150,7 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
|
|||
|
||||
cnv->charErrorBufferLength=(int8_t)j;
|
||||
*target=t;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*pOffsets=offsets;
|
||||
}
|
||||
*err=U_BUFFER_OVERFLOW_ERROR;
|
||||
|
@ -1159,7 +1159,7 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
|
|||
|
||||
/* copy the overflow contents to the target */
|
||||
*t++=overflow[i++];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1; /* no source index available for old output */
|
||||
}
|
||||
}
|
||||
|
@ -1167,7 +1167,7 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
|
|||
/* the overflow buffer is completely copied to the target */
|
||||
cnv->charErrorBufferLength=0;
|
||||
*target=t;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*pOffsets=offsets;
|
||||
}
|
||||
return false;
|
||||
|
@ -1185,11 +1185,11 @@ ucnv_fromUnicode(UConverter *cnv,
|
|||
char *t;
|
||||
|
||||
/* check parameters */
|
||||
if(err==NULL || U_FAILURE(*err)) {
|
||||
if(err==nullptr || U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(cnv==NULL || target==NULL || source==NULL) {
|
||||
if(cnv==nullptr || target==nullptr || source==nullptr) {
|
||||
*err=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1298,11 +1298,11 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
|
||||
/* get the converter implementation function */
|
||||
sourceIndex=0;
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
toUnicode=cnv->sharedData->impl->toUnicode;
|
||||
} else {
|
||||
toUnicode=cnv->sharedData->impl->toUnicodeWithOffsets;
|
||||
if(toUnicode==NULL) {
|
||||
if(toUnicode==nullptr) {
|
||||
/* there is no WithOffsets implementation */
|
||||
toUnicode=cnv->sharedData->impl->toUnicode;
|
||||
/* we will write -1 for each offset */
|
||||
|
@ -1312,10 +1312,10 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
|
||||
if(cnv->preToULength>=0) {
|
||||
/* normal mode */
|
||||
realSource=NULL;
|
||||
realSource=nullptr;
|
||||
|
||||
/* avoid compiler warnings - not otherwise necessary, and the values do not matter */
|
||||
realSourceLimit=NULL;
|
||||
realSourceLimit=nullptr;
|
||||
realFlush=false;
|
||||
realSourceIndex=0;
|
||||
} else {
|
||||
|
@ -1387,7 +1387,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
*/
|
||||
for(;;) {
|
||||
/* update offsets if we write any */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
int32_t length=(int32_t)(pArgs->target-t);
|
||||
if(length>0) {
|
||||
_updateOffsets(offsets, length, sourceIndex, errorInputLength);
|
||||
|
@ -1412,7 +1412,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
* switch the source to new replay units (cannot occur while replaying)
|
||||
* after offset handling and before end-of-input and callback handling
|
||||
*/
|
||||
if(realSource==NULL) {
|
||||
if(realSource==nullptr) {
|
||||
realSource=pArgs->source;
|
||||
realSourceLimit=pArgs->sourceLimit;
|
||||
realFlush=pArgs->flush;
|
||||
|
@ -1429,7 +1429,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
cnv->preToULength=0;
|
||||
} else {
|
||||
/* see implementation note before _fromUnicodeWithCallback() */
|
||||
U_ASSERT(realSource==NULL);
|
||||
U_ASSERT(realSource==nullptr);
|
||||
*err=U_INTERNAL_PROGRAM_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -1445,14 +1445,14 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
* (continue converting by breaking out of only the inner loop)
|
||||
*/
|
||||
break;
|
||||
} else if(realSource!=NULL) {
|
||||
} else if(realSource!=nullptr) {
|
||||
/* switch back from replaying to the real source and continue */
|
||||
pArgs->source=realSource;
|
||||
pArgs->sourceLimit=realSourceLimit;
|
||||
pArgs->flush=realFlush;
|
||||
sourceIndex=realSourceIndex;
|
||||
|
||||
realSource=NULL;
|
||||
realSource=nullptr;
|
||||
break;
|
||||
} else if(pArgs->flush && cnv->toULength>0) {
|
||||
/*
|
||||
|
@ -1510,7 +1510,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
|
|||
* copied back into the UConverter
|
||||
* and the real arguments must be restored
|
||||
*/
|
||||
if(realSource!=NULL) {
|
||||
if(realSource!=nullptr) {
|
||||
int32_t length;
|
||||
|
||||
U_ASSERT(cnv->preToULength==0);
|
||||
|
@ -1576,10 +1576,10 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
|
|||
int32_t i, length;
|
||||
|
||||
t=*target;
|
||||
if(pOffsets!=NULL) {
|
||||
if(pOffsets!=nullptr) {
|
||||
offsets=*pOffsets;
|
||||
} else {
|
||||
offsets=NULL;
|
||||
offsets=nullptr;
|
||||
}
|
||||
|
||||
overflow=cnv->UCharErrorBuffer;
|
||||
|
@ -1596,7 +1596,7 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
|
|||
|
||||
cnv->UCharErrorBufferLength=(int8_t)j;
|
||||
*target=t;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*pOffsets=offsets;
|
||||
}
|
||||
*err=U_BUFFER_OVERFLOW_ERROR;
|
||||
|
@ -1605,7 +1605,7 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
|
|||
|
||||
/* copy the overflow contents to the target */
|
||||
*t++=overflow[i++];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1; /* no source index available for old output */
|
||||
}
|
||||
}
|
||||
|
@ -1613,7 +1613,7 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
|
|||
/* the overflow buffer is completely copied to the target */
|
||||
cnv->UCharErrorBufferLength=0;
|
||||
*target=t;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*pOffsets=offsets;
|
||||
}
|
||||
return false;
|
||||
|
@ -1631,11 +1631,11 @@ ucnv_toUnicode(UConverter *cnv,
|
|||
UChar *t;
|
||||
|
||||
/* check parameters */
|
||||
if(err==NULL || U_FAILURE(*err)) {
|
||||
if(err==nullptr || U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(cnv==NULL || target==NULL || source==NULL) {
|
||||
if(cnv==nullptr || target==nullptr || source==nullptr) {
|
||||
*err=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1730,13 +1730,13 @@ ucnv_fromUChars(UConverter *cnv,
|
|||
int32_t destLength;
|
||||
|
||||
/* check arguments */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( cnv==NULL ||
|
||||
destCapacity<0 || (destCapacity>0 && dest==NULL) ||
|
||||
srcLength<-1 || (srcLength!=0 && src==NULL)
|
||||
if( cnv==nullptr ||
|
||||
destCapacity<0 || (destCapacity>0 && dest==nullptr) ||
|
||||
srcLength<-1 || (srcLength!=0 && src==nullptr)
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
@ -1786,13 +1786,13 @@ ucnv_toUChars(UConverter *cnv,
|
|||
int32_t destLength;
|
||||
|
||||
/* check arguments */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( cnv==NULL ||
|
||||
destCapacity<0 || (destCapacity>0 && dest==NULL) ||
|
||||
srcLength<-1 || (srcLength!=0 && src==NULL))
|
||||
if( cnv==nullptr ||
|
||||
destCapacity<0 || (destCapacity>0 && dest==nullptr) ||
|
||||
srcLength<-1 || (srcLength!=0 && src==nullptr))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
@ -1847,11 +1847,11 @@ ucnv_getNextUChar(UConverter *cnv,
|
|||
int32_t i, length;
|
||||
|
||||
/* check parameters */
|
||||
if(err==NULL || U_FAILURE(*err)) {
|
||||
if(err==nullptr || U_FAILURE(*err)) {
|
||||
return 0xffff;
|
||||
}
|
||||
|
||||
if(cnv==NULL || source==NULL) {
|
||||
if(cnv==nullptr || source==nullptr) {
|
||||
*err=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0xffff;
|
||||
}
|
||||
|
@ -1916,7 +1916,7 @@ ucnv_getNextUChar(UConverter *cnv,
|
|||
/* prepare the converter arguments */
|
||||
args.converter=cnv;
|
||||
args.flush=true;
|
||||
args.offsets=NULL;
|
||||
args.offsets=nullptr;
|
||||
args.source=s;
|
||||
args.sourceLimit=sourceLimit;
|
||||
args.target=buffer;
|
||||
|
@ -1932,7 +1932,7 @@ ucnv_getNextUChar(UConverter *cnv,
|
|||
* U_TRUNCATED_CHAR_FOUND for truncated input,
|
||||
* in addition to setting toULength/toUBytes[]
|
||||
*/
|
||||
if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=NULL) {
|
||||
if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=nullptr) {
|
||||
c=cnv->sharedData->impl->getNextUChar(&args, err);
|
||||
*source=s=args.source;
|
||||
if(*err==U_INDEX_OUTOFBOUNDS_ERROR) {
|
||||
|
@ -2060,13 +2060,13 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
UConverterConvert convert;
|
||||
|
||||
/* error checking */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if( targetCnv==NULL || sourceCnv==NULL ||
|
||||
source==NULL || *source==NULL ||
|
||||
target==NULL || *target==NULL || targetLimit==NULL
|
||||
if( targetCnv==nullptr || sourceCnv==nullptr ||
|
||||
source==nullptr || *source==nullptr ||
|
||||
target==nullptr || *target==nullptr || targetLimit==nullptr
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -2074,7 +2074,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
|
||||
s=*source;
|
||||
t=*target;
|
||||
if((sourceLimit!=NULL && sourceLimit<s) || targetLimit<t) {
|
||||
if((sourceLimit!=nullptr && sourceLimit<s) || targetLimit<t) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -2084,14 +2084,14 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
* int32_t. See ucnv_toUnicode() for a more detailed comment.
|
||||
*/
|
||||
if(
|
||||
(sourceLimit!=NULL && ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) ||
|
||||
(sourceLimit!=nullptr && ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) ||
|
||||
((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t)
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if(pivotStart==NULL) {
|
||||
if(pivotStart==nullptr) {
|
||||
if(!flush) {
|
||||
/* streaming conversion requires an explicit pivot buffer */
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
|
@ -2104,15 +2104,15 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
pivotTarget=&myPivotTarget;
|
||||
pivotLimit=pivotBuffer+CHUNK_SIZE;
|
||||
} else if( pivotStart>=pivotLimit ||
|
||||
pivotSource==NULL || *pivotSource==NULL ||
|
||||
pivotTarget==NULL || *pivotTarget==NULL ||
|
||||
pivotLimit==NULL
|
||||
pivotSource==nullptr || *pivotSource==nullptr ||
|
||||
pivotTarget==nullptr || *pivotTarget==nullptr ||
|
||||
pivotLimit==nullptr
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
if(sourceLimit==NULL) {
|
||||
if(sourceLimit==nullptr) {
|
||||
/* get limit of single-byte-NUL-terminated source string */
|
||||
sourceLimit=uprv_strchr(*source, 0);
|
||||
}
|
||||
|
@ -2123,7 +2123,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
*pivotSource=*pivotTarget=pivotStart;
|
||||
} else if(targetCnv->charErrorBufferLength>0) {
|
||||
/* output the targetCnv overflow buffer */
|
||||
if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, NULL, pErrorCode)) {
|
||||
if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, nullptr, pErrorCode)) {
|
||||
/* U_BUFFER_OVERFLOW_ERROR */
|
||||
return;
|
||||
}
|
||||
|
@ -2140,15 +2140,15 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
|
||||
/* Is direct-UTF-8 conversion available? */
|
||||
if( sourceCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
|
||||
targetCnv->sharedData->impl->fromUTF8!=NULL
|
||||
targetCnv->sharedData->impl->fromUTF8!=nullptr
|
||||
) {
|
||||
convert=targetCnv->sharedData->impl->fromUTF8;
|
||||
} else if( targetCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
|
||||
sourceCnv->sharedData->impl->toUTF8!=NULL
|
||||
sourceCnv->sharedData->impl->toUTF8!=nullptr
|
||||
) {
|
||||
convert=sourceCnv->sharedData->impl->toUTF8;
|
||||
} else {
|
||||
convert=NULL;
|
||||
convert=nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2170,21 +2170,21 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
* conversion, with function call overhead outweighing the benefits
|
||||
* of direct conversion.
|
||||
*/
|
||||
if(convert!=NULL && (pivotLimit-pivotStart)>32) {
|
||||
if(convert!=nullptr && (pivotLimit-pivotStart)>32) {
|
||||
pivotLimit=pivotStart+32;
|
||||
}
|
||||
|
||||
/* prepare the converter arguments */
|
||||
fromUArgs.converter=targetCnv;
|
||||
fromUArgs.flush=false;
|
||||
fromUArgs.offsets=NULL;
|
||||
fromUArgs.offsets=nullptr;
|
||||
fromUArgs.target=*target;
|
||||
fromUArgs.targetLimit=targetLimit;
|
||||
fromUArgs.size=sizeof(fromUArgs);
|
||||
|
||||
toUArgs.converter=sourceCnv;
|
||||
toUArgs.flush=flush;
|
||||
toUArgs.offsets=NULL;
|
||||
toUArgs.offsets=nullptr;
|
||||
toUArgs.source=s;
|
||||
toUArgs.sourceLimit=sourceLimit;
|
||||
toUArgs.targetLimit=pivotLimit;
|
||||
|
@ -2197,7 +2197,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
*
|
||||
* Otherwise stop using s and t from here on.
|
||||
*/
|
||||
s=t=NULL;
|
||||
s=t=nullptr;
|
||||
|
||||
/*
|
||||
* conversion loop
|
||||
|
@ -2250,7 +2250,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
*/
|
||||
/* output the sourceCnv overflow buffer */
|
||||
if(sourceCnv->UCharErrorBufferLength>0) {
|
||||
if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, NULL, pErrorCode)) {
|
||||
if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, nullptr, pErrorCode)) {
|
||||
/* U_BUFFER_OVERFLOW_ERROR */
|
||||
*pErrorCode=U_ZERO_ERROR;
|
||||
}
|
||||
|
@ -2277,7 +2277,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
|
|||
* but not if continuing a partial match
|
||||
* or flushing the toUnicode replay buffer
|
||||
*/
|
||||
if(convert!=NULL && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) {
|
||||
if(convert!=nullptr && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) {
|
||||
if(*pErrorCode==U_USING_DEFAULT_WARNING) {
|
||||
/* remove a warning that may be set by this function */
|
||||
*pErrorCode=U_ZERO_ERROR;
|
||||
|
@ -2482,12 +2482,12 @@ ucnv_convert(const char *toConverterName, const char *fromConverterName,
|
|||
UConverter *inConverter, *outConverter;
|
||||
int32_t targetLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( source==NULL || sourceLength<-1 ||
|
||||
targetCapacity<0 || (targetCapacity>0 && target==NULL)
|
||||
if( source==nullptr || sourceLength<-1 ||
|
||||
targetCapacity<0 || (targetCapacity>0 && target==nullptr)
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
@ -2533,12 +2533,12 @@ ucnv_convertAlgorithmic(UBool convertToAlgorithmic,
|
|||
UConverter *algoConverter, *to, *from;
|
||||
int32_t targetLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( cnv==NULL || source==NULL || sourceLength<-1 ||
|
||||
targetCapacity<0 || (targetCapacity>0 && target==NULL)
|
||||
if( cnv==nullptr || source==nullptr || sourceLength<-1 ||
|
||||
targetCapacity<0 || (targetCapacity>0 && target==nullptr)
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
@ -2620,11 +2620,11 @@ ucnv_getStarters(const UConverter* converter,
|
|||
UBool starters[256],
|
||||
UErrorCode* err)
|
||||
{
|
||||
if (err == NULL || U_FAILURE(*err)) {
|
||||
if (err == nullptr || U_FAILURE(*err)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(converter->sharedData->impl->getStarters != NULL) {
|
||||
if(converter->sharedData->impl->getStarters != nullptr) {
|
||||
converter->sharedData->impl->getStarters(converter, starters, err);
|
||||
} else {
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
|
@ -2637,14 +2637,14 @@ static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
|
|||
const char *name;
|
||||
int32_t i;
|
||||
|
||||
if(cnv==NULL) {
|
||||
return NULL;
|
||||
if(cnv==nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
errorCode=U_ZERO_ERROR;
|
||||
name=ucnv_getName(cnv, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for(i=0; i<UPRV_LENGTHOF(ambiguousConverters); ++i)
|
||||
|
@ -2655,7 +2655,7 @@ static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
|
@ -2666,7 +2666,7 @@ ucnv_fixFileSeparator(const UConverter *cnv,
|
|||
int32_t i;
|
||||
UChar variant5c;
|
||||
|
||||
if(cnv==NULL || source==NULL || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==NULL)
|
||||
if(cnv==nullptr || source==nullptr || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2681,7 +2681,7 @@ ucnv_fixFileSeparator(const UConverter *cnv,
|
|||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ucnv_isAmbiguous(const UConverter *cnv) {
|
||||
return (UBool)(ucnv_getAmbiguous(cnv)!=NULL);
|
||||
return (UBool)(ucnv_getAmbiguous(cnv)!=nullptr);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
|
@ -2702,11 +2702,11 @@ ucnv_getInvalidChars (const UConverter * converter,
|
|||
int8_t * len,
|
||||
UErrorCode * err)
|
||||
{
|
||||
if (err == NULL || U_FAILURE(*err))
|
||||
if (err == nullptr || U_FAILURE(*err))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (len == NULL || errBytes == NULL || converter == NULL)
|
||||
if (len == nullptr || errBytes == nullptr || converter == nullptr)
|
||||
{
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -2728,11 +2728,11 @@ ucnv_getInvalidUChars (const UConverter * converter,
|
|||
int8_t * len,
|
||||
UErrorCode * err)
|
||||
{
|
||||
if (err == NULL || U_FAILURE(*err))
|
||||
if (err == nullptr || U_FAILURE(*err))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (len == NULL || errChars == NULL || converter == NULL)
|
||||
if (len == nullptr || errChars == nullptr || converter == nullptr)
|
||||
{
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
|
@ -2763,16 +2763,16 @@ ucnv_detectUnicodeSignature( const char* source,
|
|||
char start[SIG_MAX_LEN]={ '\xa5', '\xa5', '\xa5', '\xa5', '\xa5' };
|
||||
int i = 0;
|
||||
|
||||
if((pErrorCode==NULL) || U_FAILURE(*pErrorCode)){
|
||||
return NULL;
|
||||
if((pErrorCode==nullptr) || U_FAILURE(*pErrorCode)){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(source == NULL || sourceLength < -1){
|
||||
if(source == nullptr || sourceLength < -1){
|
||||
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(signatureLength == NULL) {
|
||||
if(signatureLength == nullptr) {
|
||||
signatureLength = &dummy;
|
||||
}
|
||||
|
||||
|
@ -2836,16 +2836,16 @@ ucnv_detectUnicodeSignature( const char* source,
|
|||
|
||||
/* no known Unicode signature byte sequence recognized */
|
||||
*signatureLength=0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
|
||||
{
|
||||
if(status == NULL || U_FAILURE(*status)){
|
||||
if(status == nullptr || U_FAILURE(*status)){
|
||||
return -1;
|
||||
}
|
||||
if(cnv == NULL){
|
||||
if(cnv == nullptr){
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2864,10 +2864,10 @@ ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
|
|||
U_CAPI int32_t U_EXPORT2
|
||||
ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status){
|
||||
|
||||
if(status == NULL || U_FAILURE(*status)){
|
||||
if(status == nullptr || U_FAILURE(*status)){
|
||||
return -1;
|
||||
}
|
||||
if(cnv == NULL){
|
||||
if(cnv == nullptr){
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return -1;
|
||||
}
|
||||
|
@ -2888,7 +2888,7 @@ ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){
|
|||
return false;
|
||||
}
|
||||
|
||||
if (cnv == NULL) {
|
||||
if (cnv == nullptr) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -348,13 +348,13 @@ static const int32_t escSeqStateTable_Key_2022[MAX_STATES_2022] = {
|
|||
static const char* const escSeqStateTable_Result_2022[MAX_STATES_2022] = {
|
||||
/* 0 1 2 3 4 5 6 7 8 9 */
|
||||
|
||||
NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"latin1" ,"latin1"
|
||||
nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,"latin1" ,"latin1"
|
||||
,"latin1" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"JISX0201" ,"JISX0201" ,"latin1"
|
||||
,"latin1" ,NULL ,"JISX-208" ,"ibm-5478" ,"JISX-208" ,NULL ,NULL ,NULL ,NULL ,"UTF8"
|
||||
,"ISO-8859-1" ,"ISO-8859-7" ,"JIS-X-208" ,NULL ,"ibm-955" ,"ibm-367" ,"ibm-952" ,"ibm-949" ,"JISX-212" ,"ibm-1383"
|
||||
,"latin1" ,nullptr ,"JISX-208" ,"ibm-5478" ,"JISX-208" ,nullptr ,nullptr ,nullptr ,nullptr ,"UTF8"
|
||||
,"ISO-8859-1" ,"ISO-8859-7" ,"JIS-X-208" ,nullptr ,"ibm-955" ,"ibm-367" ,"ibm-952" ,"ibm-949" ,"JISX-212" ,"ibm-1383"
|
||||
,"ibm-952" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-5478" ,"ibm-949" ,"ISO-IR-165"
|
||||
,"CNS-11643-1992,1" ,"CNS-11643-1992,2" ,"CNS-11643-1992,3" ,"CNS-11643-1992,4" ,"CNS-11643-1992,5" ,"CNS-11643-1992,6" ,"CNS-11643-1992,7" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian"
|
||||
,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,NULL ,"latin1" ,"ibm-912" ,"ibm-913" ,"ibm-914" ,"ibm-813" ,"ibm-1089"
|
||||
,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,nullptr ,"latin1" ,"ibm-912" ,"ibm-913" ,"ibm-914" ,"ibm-813" ,"ibm-1089"
|
||||
,"ibm-920" ,"ibm-915" ,"ibm-915" ,"latin1"
|
||||
};
|
||||
|
||||
|
@ -481,7 +481,7 @@ _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
|
|||
char myLocale[7]={' ',' ',' ',' ',' ',' ', '\0'};
|
||||
|
||||
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISO2022));
|
||||
if(cnv->extraInfo != NULL) {
|
||||
if(cnv->extraInfo != nullptr) {
|
||||
UConverterNamePieces stackPieces;
|
||||
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
|
||||
UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) cnv->extraInfo;
|
||||
|
@ -557,7 +557,7 @@ _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
|
|||
if(pArgs->onlyTestIsLoadable) {
|
||||
ucnv_canCreateConverter(cnvName, errorCode); /* errorCode carries result */
|
||||
uprv_free(cnv->extraInfo);
|
||||
cnv->extraInfo=NULL;
|
||||
cnv->extraInfo=nullptr;
|
||||
return;
|
||||
} else {
|
||||
myConverterData->currentConverter=ucnv_open(cnvName, errorCode);
|
||||
|
@ -659,10 +659,10 @@ _ISO2022Close(UConverter *converter) {
|
|||
UConverterSharedData **array = myData->myConverterArray;
|
||||
int32_t i;
|
||||
|
||||
if (converter->extraInfo != NULL) {
|
||||
if (converter->extraInfo != nullptr) {
|
||||
/*close the array of converter pointers and free the memory*/
|
||||
for (i=0; i<UCNV_2022_MAX_CONVERTERS; i++) {
|
||||
if(array[i]!=NULL) {
|
||||
if(array[i]!=nullptr) {
|
||||
ucnv_unloadSharedDataIfReady(array[i]);
|
||||
}
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ _ISO2022Close(UConverter *converter) {
|
|||
|
||||
if(!converter->isExtraLocal){
|
||||
uprv_free (converter->extraInfo);
|
||||
converter->extraInfo = NULL;
|
||||
converter->extraInfo = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -694,7 +694,7 @@ _ISO2022Reset(UConverter *converter, UConverterResetChoice choice) {
|
|||
myConverterData->key = 0;
|
||||
if (converter->mode == UCNV_SO){
|
||||
ucnv_close (myConverterData->currentConverter);
|
||||
myConverterData->currentConverter=NULL;
|
||||
myConverterData->currentConverter=nullptr;
|
||||
}
|
||||
converter->mode = UCNV_SI;
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ _ISO2022getName(const UConverter* cnv){
|
|||
UConverterDataISO2022* myData= (UConverterDataISO2022*)cnv->extraInfo;
|
||||
return myData->name;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CDECL_END
|
||||
|
@ -891,7 +891,7 @@ DONE:
|
|||
case ISO_2022:
|
||||
{
|
||||
const char *chosenConverterName = escSeqStateTable_Result_2022[offset];
|
||||
if(chosenConverterName == NULL) {
|
||||
if(chosenConverterName == nullptr) {
|
||||
/* SS2 or SS3 */
|
||||
*err = U_UNSUPPORTED_ESCAPE_SEQUENCE;
|
||||
_this->toUCallbackReason = UCNV_UNASSIGNED;
|
||||
|
@ -1171,7 +1171,7 @@ MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData,
|
|||
}
|
||||
|
||||
cx=sharedData->mbcs.extIndexes;
|
||||
if(cx!=NULL) {
|
||||
if(cx!=nullptr) {
|
||||
return ucnv_extSimpleMatchFromU(cx, c, value, useFallback);
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1274,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
|
|||
mySourceLimit = getEndOfBuffer_2022(&(args->source), realSourceLimit, args->flush);
|
||||
|
||||
if(args->source < mySourceLimit) {
|
||||
if(myData->currentConverter==NULL) {
|
||||
if(myData->currentConverter==nullptr) {
|
||||
myData->currentConverter = ucnv_open("ASCII",err);
|
||||
if(U_FAILURE(*err)){
|
||||
return;
|
||||
|
@ -1322,7 +1322,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
|
|||
*/
|
||||
if (U_FAILURE(*err) ||
|
||||
(args->source == realSourceLimit) ||
|
||||
(args->offsets != NULL && (args->target != myTargetStart || args->source != sourceStart) ||
|
||||
(args->offsets != nullptr && (args->target != myTargetStart || args->source != sourceStart) ||
|
||||
(mySourceLimit < realSourceLimit && myData->currentConverter->toULength > 0))
|
||||
) {
|
||||
/* copy partial or error input for truncated detection and error handling */
|
||||
|
@ -1351,7 +1351,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
|
|||
realSourceLimit,
|
||||
ISO_2022,
|
||||
err);
|
||||
if (U_FAILURE(*err) || (args->source != sourceStart && args->offsets != NULL)) {
|
||||
if (U_FAILURE(*err) || (args->source != sourceStart && args->offsets != nullptr)) {
|
||||
/* let the ucnv.c code update its current offset */
|
||||
return;
|
||||
}
|
||||
|
@ -2624,7 +2624,7 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterToUnicodeArgs *args
|
|||
*/
|
||||
ucnv_MBCSToUnicodeWithOffsets(&subArgs, err);
|
||||
|
||||
if(args->offsets != NULL && sourceStart != args->source) {
|
||||
if(args->offsets != nullptr && sourceStart != args->source) {
|
||||
/* update offsets to base them on the actual start of the input */
|
||||
int32_t *offsets = args->offsets;
|
||||
UChar *target = args->target;
|
||||
|
@ -3599,7 +3599,7 @@ _ISO_2022_SafeClone(
|
|||
|
||||
if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
|
||||
*pBufferSize = (int32_t)sizeof(struct cloneStruct);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
cnvData = (UConverterDataISO2022 *)cnv->extraInfo;
|
||||
|
@ -3613,19 +3613,19 @@ _ISO_2022_SafeClone(
|
|||
|
||||
/* share the subconverters */
|
||||
|
||||
if(cnvData->currentConverter != NULL) {
|
||||
if(cnvData->currentConverter != nullptr) {
|
||||
size = (int32_t)sizeof(UConverter);
|
||||
localClone->mydata.currentConverter =
|
||||
ucnv_safeClone(cnvData->currentConverter,
|
||||
&localClone->currentConverter,
|
||||
&size, status);
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<UCNV_2022_MAX_CONVERTERS; ++i) {
|
||||
if(cnvData->myConverterArray[i] != NULL) {
|
||||
if(cnvData->myConverterArray[i] != nullptr) {
|
||||
ucnv_incrementRefCount(cnvData->myConverterArray[i]);
|
||||
}
|
||||
}
|
||||
|
@ -3721,7 +3721,7 @@ _ISO_2022_GetUnicodeSet(const UConverter *cnv,
|
|||
|
||||
for (i=0; i<UCNV_2022_MAX_CONVERTERS; i++) {
|
||||
UConverterSetFilter filter;
|
||||
if(cnvData->myConverterArray[i]!=NULL) {
|
||||
if(cnvData->myConverterArray[i]!=nullptr) {
|
||||
if(cnvData->locale[0]=='j' && i==JISX208) {
|
||||
/*
|
||||
* Only add code points that map to Shift-JIS codes
|
||||
|
@ -3769,8 +3769,8 @@ _ISO_2022_GetUnicodeSet(const UConverter *cnv,
|
|||
static const UConverterImpl _ISO2022Impl={
|
||||
UCNV_ISO_2022,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_ISO2022Open,
|
||||
_ISO2022Close,
|
||||
|
@ -3782,21 +3782,21 @@ static const UConverterImpl _ISO2022Impl={
|
|||
ucnv_fromUnicode_UTF8,
|
||||
ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
#endif
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_ISO2022getName,
|
||||
_ISO_2022_WriteSub,
|
||||
_ISO_2022_SafeClone,
|
||||
_ISO_2022_GetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
static const UConverterStaticData _ISO2022StaticData={
|
||||
sizeof(UConverterStaticData),
|
||||
|
@ -3821,8 +3821,8 @@ const UConverterSharedData _ISO2022Data=
|
|||
static const UConverterImpl _ISO2022JPImpl={
|
||||
UCNV_ISO_2022,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_ISO2022Open,
|
||||
_ISO2022Close,
|
||||
|
@ -3832,16 +3832,16 @@ static const UConverterImpl _ISO2022JPImpl={
|
|||
UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_ISO2022getName,
|
||||
_ISO_2022_WriteSub,
|
||||
_ISO_2022_SafeClone,
|
||||
_ISO_2022_GetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
static const UConverterStaticData _ISO2022JPStaticData={
|
||||
sizeof(UConverterStaticData),
|
||||
|
@ -3872,8 +3872,8 @@ const UConverterSharedData _ISO2022JPData=
|
|||
static const UConverterImpl _ISO2022KRImpl={
|
||||
UCNV_ISO_2022,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_ISO2022Open,
|
||||
_ISO2022Close,
|
||||
|
@ -3883,16 +3883,16 @@ static const UConverterImpl _ISO2022KRImpl={
|
|||
UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_ISO2022getName,
|
||||
_ISO_2022_WriteSub,
|
||||
_ISO_2022_SafeClone,
|
||||
_ISO_2022_GetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
static const UConverterStaticData _ISO2022KRStaticData={
|
||||
sizeof(UConverterStaticData),
|
||||
|
@ -3923,8 +3923,8 @@ static const UConverterImpl _ISO2022CNImpl={
|
|||
|
||||
UCNV_ISO_2022,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_ISO2022Open,
|
||||
_ISO2022Close,
|
||||
|
@ -3934,16 +3934,16 @@ static const UConverterImpl _ISO2022CNImpl={
|
|||
UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_ISO2022getName,
|
||||
_ISO_2022_WriteSub,
|
||||
_ISO_2022_SafeClone,
|
||||
_ISO_2022_GetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
static const UConverterStaticData _ISO2022CNStaticData={
|
||||
sizeof(UConverterStaticData),
|
||||
|
|
|
@ -57,10 +57,10 @@ extern void UCNV_DEBUG_LOG(char *what, char *who, void *p, int l);
|
|||
|
||||
static const UConverterSharedData * const
|
||||
converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={
|
||||
NULL, NULL,
|
||||
nullptr, nullptr,
|
||||
|
||||
#if UCONFIG_NO_LEGACY_CONVERSION
|
||||
NULL,
|
||||
nullptr,
|
||||
#else
|
||||
&_MBCSData,
|
||||
#endif
|
||||
|
@ -68,22 +68,22 @@ converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={
|
|||
&_Latin1Data,
|
||||
&_UTF8Data, &_UTF16BEData, &_UTF16LEData,
|
||||
#if UCONFIG_ONLY_HTML_CONVERSION
|
||||
NULL, NULL,
|
||||
nullptr, nullptr,
|
||||
#else
|
||||
&_UTF32BEData, &_UTF32LEData,
|
||||
#endif
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
#if UCONFIG_NO_LEGACY_CONVERSION
|
||||
NULL,
|
||||
nullptr,
|
||||
#else
|
||||
&_ISO2022Data,
|
||||
#endif
|
||||
|
||||
#if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
|
||||
nullptr,
|
||||
#else
|
||||
&_LMBCSData1,&_LMBCSData2, &_LMBCSData3, &_LMBCSData4, &_LMBCSData5, &_LMBCSData6,
|
||||
&_LMBCSData8,&_LMBCSData11,&_LMBCSData16,&_LMBCSData17,&_LMBCSData18,&_LMBCSData19,
|
||||
|
@ -91,27 +91,27 @@ converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={
|
|||
#endif
|
||||
|
||||
#if UCONFIG_ONLY_HTML_CONVERSION
|
||||
NULL,
|
||||
nullptr,
|
||||
#else
|
||||
&_SCSUData,
|
||||
#endif
|
||||
|
||||
|
||||
#if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION
|
||||
NULL,
|
||||
nullptr,
|
||||
#else
|
||||
&_ISCIIData,
|
||||
#endif
|
||||
|
||||
&_ASCIIData,
|
||||
#if UCONFIG_ONLY_HTML_CONVERSION
|
||||
NULL, NULL, &_UTF16Data, NULL, NULL, NULL,
|
||||
nullptr, nullptr, &_UTF16Data, nullptr, nullptr, nullptr,
|
||||
#else
|
||||
&_UTF7Data, &_Bocu1Data, &_UTF16Data, &_UTF32Data, &_CESU8Data, &_IMAPData,
|
||||
#endif
|
||||
|
||||
#if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION
|
||||
NULL,
|
||||
nullptr,
|
||||
#else
|
||||
&_CompoundTextData
|
||||
#endif
|
||||
|
@ -193,20 +193,20 @@ static struct {
|
|||
|
||||
|
||||
/*initializes some global variables */
|
||||
static UHashtable *SHARED_DATA_HASHTABLE = NULL;
|
||||
static UHashtable *SHARED_DATA_HASHTABLE = nullptr;
|
||||
static icu::UMutex cnvCacheMutex;
|
||||
/* Note: the global mutex is used for */
|
||||
/* reference count updates. */
|
||||
|
||||
static const char **gAvailableConverters = NULL;
|
||||
static const char **gAvailableConverters = nullptr;
|
||||
static uint16_t gAvailableConverterCount = 0;
|
||||
static icu::UInitOnce gAvailableConvertersInitOnce {};
|
||||
|
||||
#if !U_CHARSET_IS_UTF8
|
||||
|
||||
/* This contains the resolved converter name. So no further alias lookup is needed again. */
|
||||
static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for NULL */
|
||||
static const char *gDefaultConverterName = NULL;
|
||||
static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for nullptr */
|
||||
static const char *gDefaultConverterName = nullptr;
|
||||
|
||||
/*
|
||||
If the default converter is an algorithmic converter, this is the cached value.
|
||||
|
@ -214,7 +214,7 @@ We don't cache a full UConverter and clone it because ucnv_clone doesn't have
|
|||
less overhead than an algorithmic open. We don't cache non-algorithmic converters
|
||||
because ucnv_flushCache must be able to unload the default converter and its table.
|
||||
*/
|
||||
static const UConverterSharedData *gDefaultAlgorithmicSharedData = NULL;
|
||||
static const UConverterSharedData *gDefaultAlgorithmicSharedData = nullptr;
|
||||
|
||||
/* Does gDefaultConverterName have a converter option and require extra parsing? */
|
||||
static UBool gDefaultConverterContainsOption;
|
||||
|
@ -232,7 +232,7 @@ ucnv_flushAvailableConverterCache() {
|
|||
gAvailableConverterCount = 0;
|
||||
if (gAvailableConverters) {
|
||||
uprv_free((char **)gAvailableConverters);
|
||||
gAvailableConverters = NULL;
|
||||
gAvailableConverters = nullptr;
|
||||
}
|
||||
gAvailableConvertersInitOnce.reset();
|
||||
}
|
||||
|
@ -243,22 +243,22 @@ ucnv_flushAvailableConverterCache() {
|
|||
/* Not supported API. */
|
||||
static UBool U_CALLCONV ucnv_cleanup(void) {
|
||||
ucnv_flushCache();
|
||||
if (SHARED_DATA_HASHTABLE != NULL && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
|
||||
if (SHARED_DATA_HASHTABLE != nullptr && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
|
||||
uhash_close(SHARED_DATA_HASHTABLE);
|
||||
SHARED_DATA_HASHTABLE = NULL;
|
||||
SHARED_DATA_HASHTABLE = nullptr;
|
||||
}
|
||||
|
||||
/* Isn't called from flushCache because other threads may have preexisting references to the table. */
|
||||
ucnv_flushAvailableConverterCache();
|
||||
|
||||
#if !U_CHARSET_IS_UTF8
|
||||
gDefaultConverterName = NULL;
|
||||
gDefaultConverterName = nullptr;
|
||||
gDefaultConverterNameBuffer[0] = 0;
|
||||
gDefaultConverterContainsOption = false;
|
||||
gDefaultAlgorithmicSharedData = NULL;
|
||||
gDefaultAlgorithmicSharedData = nullptr;
|
||||
#endif
|
||||
|
||||
return (SHARED_DATA_HASHTABLE == NULL);
|
||||
return (SHARED_DATA_HASHTABLE == nullptr);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
|
@ -295,22 +295,22 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMemory *pData, UErrorCo
|
|||
UConverterType type = (UConverterType)source->conversionType;
|
||||
|
||||
if(U_FAILURE(*status))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if( (uint16_t)type >= UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES ||
|
||||
converterData[type] == NULL ||
|
||||
converterData[type] == nullptr ||
|
||||
!converterData[type]->isReferenceCounted ||
|
||||
converterData[type]->referenceCounter != 1 ||
|
||||
source->structSize != sizeof(UConverterStaticData))
|
||||
{
|
||||
*status = U_INVALID_TABLE_FORMAT;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
data = (UConverterSharedData *)uprv_malloc(sizeof(UConverterSharedData));
|
||||
if(data == NULL) {
|
||||
if(data == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* copy initial values from the static structure for this type */
|
||||
|
@ -323,11 +323,11 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMemory *pData, UErrorCo
|
|||
/* fill in fields from the loaded data */
|
||||
data->dataMemory = (void*)pData; /* for future use */
|
||||
|
||||
if(data->impl->load != NULL) {
|
||||
if(data->impl->load != nullptr) {
|
||||
data->impl->load(data, pArgs, raw + source->structSize, status);
|
||||
if(U_FAILURE(*status)) {
|
||||
uprv_free(data);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
@ -346,16 +346,16 @@ static UConverterSharedData *createConverterFromFile(UConverterLoadArgs *pArgs,
|
|||
|
||||
if (U_FAILURE (*err)) {
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UTRACE_DATA2(UTRACE_OPEN_CLOSE, "load converter %s from package %s", pArgs->name, pArgs->pkg);
|
||||
|
||||
data = udata_openChoice(pArgs->pkg, DATA_TYPE, pArgs->name, isCnvAcceptable, NULL, err);
|
||||
data = udata_openChoice(pArgs->pkg, DATA_TYPE, pArgs->name, isCnvAcceptable, nullptr, err);
|
||||
if(U_FAILURE(*err))
|
||||
{
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sharedData = ucnv_data_unFlattenClone(pArgs, data, err);
|
||||
|
@ -363,7 +363,7 @@ static UConverterSharedData *createConverterFromFile(UConverterLoadArgs *pArgs,
|
|||
{
|
||||
udata_close(data);
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -413,7 +413,7 @@ getAlgorithmicTypeFromName(const char *realName)
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -437,11 +437,11 @@ ucnv_shareConverterData(UConverterSharedData * data)
|
|||
{
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
/*Lazy evaluates the Hashtable itself */
|
||||
/*void *sanity = NULL;*/
|
||||
/*void *sanity = nullptr;*/
|
||||
|
||||
if (SHARED_DATA_HASHTABLE == NULL)
|
||||
if (SHARED_DATA_HASHTABLE == nullptr)
|
||||
{
|
||||
SHARED_DATA_HASHTABLE = uhash_openSize(uhash_hashChars, uhash_compareChars, NULL,
|
||||
SHARED_DATA_HASHTABLE = uhash_openSize(uhash_hashChars, uhash_compareChars, nullptr,
|
||||
ucnv_io_countKnownConverters(&err)*UCNV_CACHE_LOAD_FACTOR,
|
||||
&err);
|
||||
ucnv_enableCleanup();
|
||||
|
@ -454,7 +454,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
|
|||
|
||||
/*
|
||||
sanity = ucnv_getSharedConverterData (data->staticData->name);
|
||||
if(sanity != NULL)
|
||||
if(sanity != nullptr)
|
||||
{
|
||||
UCNV_DEBUG_LOG("put:overwrite!",data->staticData->name,sanity);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
|
|||
|
||||
uhash_put(SHARED_DATA_HASHTABLE,
|
||||
(void*) data->staticData->name, /* Okay to cast away const as long as
|
||||
keyDeleter == NULL */
|
||||
keyDeleter == nullptr */
|
||||
data,
|
||||
&err);
|
||||
UCNV_DEBUG_LOG("put", data->staticData->name,data);
|
||||
|
@ -475,17 +475,17 @@ ucnv_shareConverterData(UConverterSharedData * data)
|
|||
|
||||
/* Look up a converter name in the shared data cache. */
|
||||
/* cnvCacheMutex must be held by the caller to protect the hash table. */
|
||||
/* gets the shared data from the SHARED_DATA_HASHTABLE (might return NULL if it isn't there)
|
||||
/* gets the shared data from the SHARED_DATA_HASHTABLE (might return nullptr if it isn't there)
|
||||
* @param name The name of the shared data
|
||||
* @return the shared data from the SHARED_DATA_HASHTABLE
|
||||
*/
|
||||
static UConverterSharedData *
|
||||
ucnv_getSharedConverterData(const char *name)
|
||||
{
|
||||
/*special case when no Table has yet been created we return NULL */
|
||||
if (SHARED_DATA_HASHTABLE == NULL)
|
||||
/*special case when no Table has yet been created we return nullptr */
|
||||
if (SHARED_DATA_HASHTABLE == nullptr)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -519,11 +519,11 @@ ucnv_deleteSharedConverterData(UConverterSharedData * deadSharedData)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (deadSharedData->impl->unload != NULL) {
|
||||
if (deadSharedData->impl->unload != nullptr) {
|
||||
deadSharedData->impl->unload(deadSharedData);
|
||||
}
|
||||
|
||||
if(deadSharedData->dataMemory != NULL)
|
||||
if(deadSharedData->dataMemory != nullptr)
|
||||
{
|
||||
UDataMemory *data = (UDataMemory*)deadSharedData->dataMemory;
|
||||
udata_close(data);
|
||||
|
@ -537,29 +537,29 @@ ucnv_deleteSharedConverterData(UConverterSharedData * deadSharedData)
|
|||
|
||||
/**
|
||||
* Load a non-algorithmic converter.
|
||||
* If pkg==NULL, then this function must be called inside umtx_lock(&cnvCacheMutex).
|
||||
* If pkg==nullptr, then this function must be called inside umtx_lock(&cnvCacheMutex).
|
||||
*/
|
||||
UConverterSharedData *
|
||||
ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) {
|
||||
UConverterSharedData *mySharedConverterData;
|
||||
|
||||
if(err == NULL || U_FAILURE(*err)) {
|
||||
return NULL;
|
||||
if(err == nullptr || U_FAILURE(*err)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(pArgs->pkg != NULL && *pArgs->pkg != 0) {
|
||||
if(pArgs->pkg != nullptr && *pArgs->pkg != 0) {
|
||||
/* application-provided converters are not currently cached */
|
||||
return createConverterFromFile(pArgs, err);
|
||||
}
|
||||
|
||||
mySharedConverterData = ucnv_getSharedConverterData(pArgs->name);
|
||||
if (mySharedConverterData == NULL)
|
||||
if (mySharedConverterData == nullptr)
|
||||
{
|
||||
/*Not cached, we need to stream it in from file */
|
||||
mySharedConverterData = createConverterFromFile(pArgs, err);
|
||||
if (U_FAILURE (*err) || (mySharedConverterData == NULL))
|
||||
if (U_FAILURE (*err) || (mySharedConverterData == nullptr))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else if (!pArgs->onlyTestIsLoadable)
|
||||
{
|
||||
|
@ -584,7 +584,7 @@ ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) {
|
|||
*/
|
||||
U_CAPI void
|
||||
ucnv_unload(UConverterSharedData *sharedData) {
|
||||
if(sharedData != NULL) {
|
||||
if(sharedData != nullptr) {
|
||||
if (sharedData->referenceCounter > 0) {
|
||||
sharedData->referenceCounter--;
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ ucnv_unload(UConverterSharedData *sharedData) {
|
|||
U_CFUNC void
|
||||
ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
|
||||
{
|
||||
if(sharedData != NULL && sharedData->isReferenceCounted) {
|
||||
if(sharedData != nullptr && sharedData->isReferenceCounted) {
|
||||
umtx_lock(&cnvCacheMutex);
|
||||
ucnv_unload(sharedData);
|
||||
umtx_unlock(&cnvCacheMutex);
|
||||
|
@ -608,7 +608,7 @@ ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
|
|||
U_CFUNC void
|
||||
ucnv_incrementRefCount(UConverterSharedData *sharedData)
|
||||
{
|
||||
if(sharedData != NULL && sharedData->isReferenceCounted) {
|
||||
if(sharedData != nullptr && sharedData->isReferenceCounted) {
|
||||
umtx_lock(&cnvCacheMutex);
|
||||
sharedData->referenceCounter++;
|
||||
umtx_unlock(&cnvCacheMutex);
|
||||
|
@ -715,27 +715,27 @@ ucnv_loadSharedData(const char *converterName,
|
|||
UErrorCode * err) {
|
||||
UConverterNamePieces stackPieces;
|
||||
UConverterLoadArgs stackArgs;
|
||||
UConverterSharedData *mySharedConverterData = NULL;
|
||||
UConverterSharedData *mySharedConverterData = nullptr;
|
||||
UErrorCode internalErrorCode = U_ZERO_ERROR;
|
||||
UBool mayContainOption = true;
|
||||
UBool checkForAlgorithmic = true;
|
||||
|
||||
if (U_FAILURE (*err)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(pPieces == NULL) {
|
||||
if(pArgs != NULL) {
|
||||
if(pPieces == nullptr) {
|
||||
if(pArgs != nullptr) {
|
||||
/*
|
||||
* Bad: We may set pArgs pointers to stackPieces fields
|
||||
* which will be invalid after this function returns.
|
||||
*/
|
||||
*err = U_INTERNAL_PROGRAM_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
pPieces = &stackPieces;
|
||||
}
|
||||
if(pArgs == NULL) {
|
||||
if(pArgs == nullptr) {
|
||||
uprv_memset(&stackArgs, 0, sizeof(stackArgs));
|
||||
stackArgs.size = (int32_t)sizeof(stackArgs);
|
||||
pArgs = &stackArgs;
|
||||
|
@ -749,17 +749,17 @@ ucnv_loadSharedData(const char *converterName,
|
|||
pArgs->locale = pPieces->locale;
|
||||
pArgs->options = pPieces->options;
|
||||
|
||||
/* In case "name" is NULL we want to open the default converter. */
|
||||
if (converterName == NULL) {
|
||||
/* In case "name" is nullptr we want to open the default converter. */
|
||||
if (converterName == nullptr) {
|
||||
#if U_CHARSET_IS_UTF8
|
||||
pArgs->name = "UTF-8";
|
||||
return (UConverterSharedData *)converterData[UCNV_UTF8];
|
||||
#else
|
||||
/* Call ucnv_getDefaultName first to query the name from the OS. */
|
||||
pArgs->name = ucnv_getDefaultName();
|
||||
if (pArgs->name == NULL) {
|
||||
if (pArgs->name == nullptr) {
|
||||
*err = U_MISSING_RESOURCE_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
mySharedConverterData = (UConverterSharedData *)gDefaultAlgorithmicSharedData;
|
||||
checkForAlgorithmic = false;
|
||||
|
@ -777,12 +777,12 @@ ucnv_loadSharedData(const char *converterName,
|
|||
parseConverterOptions(converterName, pPieces, pArgs, err);
|
||||
if (U_FAILURE(*err)) {
|
||||
/* Very bad name used. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* get the canonical converter name */
|
||||
pArgs->name = ucnv_io_getConverterName(pArgs->name, &mayContainOption, &internalErrorCode);
|
||||
if (U_FAILURE(internalErrorCode) || pArgs->name == NULL) {
|
||||
if (U_FAILURE(internalErrorCode) || pArgs->name == nullptr) {
|
||||
/*
|
||||
* set the input name in case the converter was added
|
||||
* without updating the alias table, or when there is no alias table
|
||||
|
@ -802,7 +802,7 @@ ucnv_loadSharedData(const char *converterName,
|
|||
if (checkForAlgorithmic) {
|
||||
mySharedConverterData = (UConverterSharedData *)getAlgorithmicTypeFromName(pArgs->name);
|
||||
}
|
||||
if (mySharedConverterData == NULL)
|
||||
if (mySharedConverterData == nullptr)
|
||||
{
|
||||
/* it is a data-based converter, get its shared data. */
|
||||
/* Hold the cnvCacheMutex through the whole process of checking the */
|
||||
|
@ -810,14 +810,14 @@ ucnv_loadSharedData(const char *converterName,
|
|||
/* to prevent other threads from modifying the cache during the */
|
||||
/* process. */
|
||||
pArgs->nestedLoads=1;
|
||||
pArgs->pkg=NULL;
|
||||
pArgs->pkg=nullptr;
|
||||
|
||||
umtx_lock(&cnvCacheMutex);
|
||||
mySharedConverterData = ucnv_load(pArgs, err);
|
||||
umtx_unlock(&cnvCacheMutex);
|
||||
if (U_FAILURE (*err) || (mySharedConverterData == NULL))
|
||||
if (U_FAILURE (*err) || (mySharedConverterData == nullptr))
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -851,7 +851,7 @@ ucnv_createConverter(UConverter *myUConverter, const char *converterName, UError
|
|||
|
||||
/* exit with error */
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
|
@ -894,15 +894,15 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter,
|
|||
if(type<0 || UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES<=type) {
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sharedData = converterData[type];
|
||||
if(sharedData == NULL || sharedData->isReferenceCounted) {
|
||||
if(sharedData == nullptr || sharedData->isReferenceCounted) {
|
||||
/* not a valid type, or not an algorithmic converter */
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
stackArgs.name = "";
|
||||
|
@ -928,7 +928,7 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
|
|||
|
||||
if(U_FAILURE(*err)) {
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UTRACE_DATA2(UTRACE_OPEN_CLOSE, "open converter %s from package %s", converterName, packageName);
|
||||
|
@ -941,7 +941,7 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
|
|||
if (U_FAILURE(*err)) {
|
||||
/* Very bad name used. */
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
stackArgs.nestedLoads=1;
|
||||
stackArgs.pkg=packageName;
|
||||
|
@ -951,16 +951,16 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
|
|||
|
||||
if (U_FAILURE(*err)) {
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* create the actual converter */
|
||||
myUConverter = ucnv_createConverterFromSharedData(NULL, mySharedConverterData, &stackArgs, err);
|
||||
myUConverter = ucnv_createConverterFromSharedData(nullptr, mySharedConverterData, &stackArgs, err);
|
||||
|
||||
if (U_FAILURE(*err)) {
|
||||
ucnv_close(myUConverter);
|
||||
UTRACE_EXIT_STATUS(*err);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UTRACE_EXIT_PTR_STATUS(myUConverter, *err);
|
||||
|
@ -980,14 +980,14 @@ ucnv_createConverterFromSharedData(UConverter *myUConverter,
|
|||
ucnv_unloadSharedDataIfReady(mySharedConverterData);
|
||||
return myUConverter;
|
||||
}
|
||||
if(myUConverter == NULL)
|
||||
if(myUConverter == nullptr)
|
||||
{
|
||||
myUConverter = (UConverter *) uprv_malloc (sizeof (UConverter));
|
||||
if(myUConverter == NULL)
|
||||
if(myUConverter == nullptr)
|
||||
{
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
ucnv_unloadSharedDataIfReady(mySharedConverterData);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
isCopyLocal = false;
|
||||
} else {
|
||||
|
@ -1013,12 +1013,12 @@ ucnv_createConverterFromSharedData(UConverter *myUConverter,
|
|||
myUConverter->toUCallbackReason = UCNV_ILLEGAL; /* default reason to invoke (*fromCharErrorBehaviour) */
|
||||
}
|
||||
|
||||
if(mySharedConverterData->impl->open != NULL) {
|
||||
if(mySharedConverterData->impl->open != nullptr) {
|
||||
mySharedConverterData->impl->open(myUConverter, pArgs, err);
|
||||
if(U_FAILURE(*err) && !pArgs->onlyTestIsLoadable) {
|
||||
/* don't ucnv_close() if onlyTestIsLoadable because not fully initialized */
|
||||
ucnv_close(myUConverter);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ ucnv_createConverterFromSharedData(UConverter *myUConverter,
|
|||
U_CAPI int32_t U_EXPORT2
|
||||
ucnv_flushCache ()
|
||||
{
|
||||
UConverterSharedData *mySharedData = NULL;
|
||||
UConverterSharedData *mySharedData = nullptr;
|
||||
int32_t pos;
|
||||
int32_t tableDeletedNum = 0;
|
||||
const UHashElement *e;
|
||||
|
@ -1045,7 +1045,7 @@ ucnv_flushCache ()
|
|||
/*if shared data hasn't even been lazy evaluated yet
|
||||
* return 0
|
||||
*/
|
||||
if (SHARED_DATA_HASHTABLE == NULL) {
|
||||
if (SHARED_DATA_HASHTABLE == nullptr) {
|
||||
UTRACE_EXIT_VALUE((int32_t)0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1072,7 +1072,7 @@ ucnv_flushCache ()
|
|||
do {
|
||||
remaining = 0;
|
||||
pos = UHASH_FIRST;
|
||||
while ((e = uhash_nextElement (SHARED_DATA_HASHTABLE, &pos)) != NULL)
|
||||
while ((e = uhash_nextElement (SHARED_DATA_HASHTABLE, &pos)) != nullptr)
|
||||
{
|
||||
mySharedData = (UConverterSharedData *) e->value.pointer;
|
||||
/*deletes only if reference counter == 0 */
|
||||
|
@ -1102,7 +1102,7 @@ ucnv_flushCache ()
|
|||
|
||||
static void U_CALLCONV initAvailableConvertersList(UErrorCode &errCode) {
|
||||
U_ASSERT(gAvailableConverterCount == 0);
|
||||
U_ASSERT(gAvailableConverters == NULL);
|
||||
U_ASSERT(gAvailableConverters == nullptr);
|
||||
|
||||
ucnv_enableCleanup();
|
||||
UEnumeration *allConvEnum = ucnv_openAllNames(&errCode);
|
||||
|
@ -1121,13 +1121,13 @@ static void U_CALLCONV initAvailableConvertersList(UErrorCode &errCode) {
|
|||
/* Open the default converter to make sure that it has first dibs in the hash table. */
|
||||
UErrorCode localStatus = U_ZERO_ERROR;
|
||||
UConverter tempConverter;
|
||||
ucnv_close(ucnv_createConverter(&tempConverter, NULL, &localStatus));
|
||||
ucnv_close(ucnv_createConverter(&tempConverter, nullptr, &localStatus));
|
||||
|
||||
gAvailableConverterCount = 0;
|
||||
|
||||
for (int32_t idx = 0; idx < allConverterCount; idx++) {
|
||||
localStatus = U_ZERO_ERROR;
|
||||
const char *converterName = uenum_next(allConvEnum, NULL, &localStatus);
|
||||
const char *converterName = uenum_next(allConvEnum, nullptr, &localStatus);
|
||||
if (ucnv_canCreateConverter(converterName, &localStatus)) {
|
||||
gAvailableConverters[gAvailableConverterCount++] = converterName;
|
||||
}
|
||||
|
@ -1158,7 +1158,7 @@ ucnv_bld_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode) {
|
|||
}
|
||||
*pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* default converter name --------------------------------------------------- */
|
||||
|
@ -1181,7 +1181,7 @@ internalSetName(const char *name, UErrorCode *status) {
|
|||
UConverterNamePieces stackPieces;
|
||||
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
|
||||
int32_t length=(int32_t)(uprv_strlen(name));
|
||||
UBool containsOption = (UBool)(uprv_strchr(name, UCNV_OPTION_SEP_CHAR) != NULL);
|
||||
UBool containsOption = (UBool)(uprv_strchr(name, UCNV_OPTION_SEP_CHAR) != nullptr);
|
||||
const UConverterSharedData *algorithmicSharedData;
|
||||
|
||||
stackArgs.name = name;
|
||||
|
@ -1240,22 +1240,22 @@ ucnv_getDefaultName() {
|
|||
icu::Mutex lock(&cnvCacheMutex);
|
||||
name = gDefaultConverterName;
|
||||
}
|
||||
if(name==NULL) {
|
||||
if(name==nullptr) {
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
UConverter *cnv = NULL;
|
||||
UConverter *cnv = nullptr;
|
||||
|
||||
name = uprv_getDefaultCodepage();
|
||||
|
||||
/* if the name is there, test it out and get the canonical name with options */
|
||||
if(name != NULL) {
|
||||
if(name != nullptr) {
|
||||
cnv = ucnv_open(name, &errorCode);
|
||||
if(U_SUCCESS(errorCode) && cnv != NULL) {
|
||||
if(U_SUCCESS(errorCode) && cnv != nullptr) {
|
||||
name = ucnv_getName(cnv, &errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
if(name == NULL || name[0] == 0
|
||||
|| U_FAILURE(errorCode) || cnv == NULL
|
||||
if(name == nullptr || name[0] == 0
|
||||
|| U_FAILURE(errorCode) || cnv == nullptr
|
||||
|| uprv_strlen(name)>=sizeof(gDefaultConverterNameBuffer))
|
||||
{
|
||||
/* Panic time, let's use a fallback. */
|
||||
|
@ -1288,21 +1288,21 @@ See internalSetName or the API reference for details.
|
|||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
ucnv_setDefaultName(const char *converterName) {
|
||||
if(converterName==NULL) {
|
||||
if(converterName==nullptr) {
|
||||
/* reset to the default codepage */
|
||||
gDefaultConverterName=NULL;
|
||||
gDefaultConverterName=nullptr;
|
||||
} else {
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
UConverter *cnv = NULL;
|
||||
const char *name = NULL;
|
||||
UConverter *cnv = nullptr;
|
||||
const char *name = nullptr;
|
||||
|
||||
/* if the name is there, test it out and get the canonical name with options */
|
||||
cnv = ucnv_open(converterName, &errorCode);
|
||||
if(U_SUCCESS(errorCode) && cnv != NULL) {
|
||||
if(U_SUCCESS(errorCode) && cnv != nullptr) {
|
||||
name = ucnv_getName(cnv, &errorCode);
|
||||
}
|
||||
|
||||
if(U_SUCCESS(errorCode) && name!=NULL) {
|
||||
if(U_SUCCESS(errorCode) && name!=nullptr) {
|
||||
internalSetName(name, &errorCode);
|
||||
}
|
||||
/* else this converter is bad to use. Don't change it to a bad value. */
|
||||
|
@ -1353,7 +1353,7 @@ ucnv_swap(const UDataSwapper *ds,
|
|||
|
||||
/* udata_swapDataHeader checks the arguments */
|
||||
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1509,7 +1509,7 @@ ucnv_swap(const UDataSwapper *ds,
|
|||
}
|
||||
|
||||
/* avoid compiler warnings - not otherwise necessary, and the value does not matter */
|
||||
inExtIndexes=NULL;
|
||||
inExtIndexes=nullptr;
|
||||
} else {
|
||||
/* there is extension data after the base data, see ucnv_ext.h */
|
||||
if(length>=0 && length<(extOffset+UCNV_EXT_INDEXES_MIN_LENGTH*4)) {
|
||||
|
|
|
@ -85,7 +85,7 @@ ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
|
|||
args->targetLimit,
|
||||
source,
|
||||
sourceLimit,
|
||||
NULL, /* no offsets */
|
||||
nullptr, /* no offsets */
|
||||
false, /* no flush */
|
||||
err);
|
||||
|
||||
|
@ -140,7 +140,7 @@ ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
|
|||
newTargetLimit,
|
||||
source,
|
||||
sourceLimit,
|
||||
NULL,
|
||||
nullptr,
|
||||
false,
|
||||
&err2);
|
||||
|
||||
|
@ -205,7 +205,7 @@ ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
|
|||
return;
|
||||
}
|
||||
|
||||
if(converter->sharedData->impl->writeSub!=NULL) {
|
||||
if(converter->sharedData->impl->writeSub!=nullptr) {
|
||||
converter->sharedData->impl->writeSub(args, offsetIndex, err);
|
||||
}
|
||||
else if(converter->subChar1!=0 && (uint16_t)converter->invalidUCharBuffer[0]<=(uint16_t)0xffu) {
|
||||
|
|
|
@ -62,7 +62,7 @@ ucnv_fromUWriteBytes(UConverter *cnv,
|
|||
int32_t *o;
|
||||
|
||||
/* write bytes */
|
||||
if(offsets==NULL || (o=*offsets)==NULL) {
|
||||
if(offsets==nullptr || (o=*offsets)==nullptr) {
|
||||
while(length>0 && t<targetLimit) {
|
||||
*t++=*bytes++;
|
||||
--length;
|
||||
|
@ -80,7 +80,7 @@ ucnv_fromUWriteBytes(UConverter *cnv,
|
|||
|
||||
/* write overflow */
|
||||
if(length>0) {
|
||||
if(cnv!=NULL) {
|
||||
if(cnv!=nullptr) {
|
||||
t=(char *)cnv->charErrorBuffer;
|
||||
cnv->charErrorBufferLength=(int8_t)length;
|
||||
do {
|
||||
|
@ -102,7 +102,7 @@ ucnv_toUWriteUChars(UConverter *cnv,
|
|||
int32_t *o;
|
||||
|
||||
/* write UChars */
|
||||
if(offsets==NULL || (o=*offsets)==NULL) {
|
||||
if(offsets==nullptr || (o=*offsets)==nullptr) {
|
||||
while(length>0 && t<targetLimit) {
|
||||
*t++=*uchars++;
|
||||
--length;
|
||||
|
@ -120,7 +120,7 @@ ucnv_toUWriteUChars(UConverter *cnv,
|
|||
|
||||
/* write overflow */
|
||||
if(length>0) {
|
||||
if(cnv!=NULL) {
|
||||
if(cnv!=nullptr) {
|
||||
t=cnv->UCharErrorBuffer;
|
||||
cnv->UCharErrorBufferLength=(int8_t)length;
|
||||
do {
|
||||
|
@ -157,7 +157,7 @@ ucnv_toUWriteCodePoint(UConverter *cnv,
|
|||
}
|
||||
|
||||
/* write offsets */
|
||||
if(offsets!=NULL && (o=*offsets)!=NULL) {
|
||||
if(offsets!=nullptr && (o=*offsets)!=nullptr) {
|
||||
*o++=sourceIndex;
|
||||
if((*target+1)<t) {
|
||||
*o++=sourceIndex;
|
||||
|
@ -170,7 +170,7 @@ ucnv_toUWriteCodePoint(UConverter *cnv,
|
|||
|
||||
/* write overflow from c */
|
||||
if(c>=0) {
|
||||
if(cnv!=NULL) {
|
||||
if(cnv!=nullptr) {
|
||||
int8_t i=0;
|
||||
U16_APPEND_UNSAFE(cnv->UCharErrorBuffer, i, c);
|
||||
cnv->UCharErrorBufferLength=i;
|
||||
|
|
|
@ -261,13 +261,13 @@ static COMPOUND_TEXT_CONVERTERS findStateFromEscSeq(const char* source, const ch
|
|||
static void U_CALLCONV
|
||||
_CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
|
||||
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataCompoundText));
|
||||
if (cnv->extraInfo != NULL) {
|
||||
if (cnv->extraInfo != nullptr) {
|
||||
UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo;
|
||||
|
||||
UConverterNamePieces stackPieces;
|
||||
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
|
||||
|
||||
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = NULL;
|
||||
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = nullptr;
|
||||
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_1] = ucnv_loadSharedData("icu-internal-compound-s1", &stackPieces, &stackArgs, errorCode);
|
||||
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_2] = ucnv_loadSharedData("icu-internal-compound-s2", &stackPieces, &stackArgs, errorCode);
|
||||
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_3] = ucnv_loadSharedData("icu-internal-compound-s3", &stackPieces, &stackArgs, errorCode);
|
||||
|
@ -306,16 +306,16 @@ _CompoundTextClose(UConverter *converter) {
|
|||
UConverterDataCompoundText* myConverterData = (UConverterDataCompoundText*)(converter->extraInfo);
|
||||
int32_t i;
|
||||
|
||||
if (converter->extraInfo != NULL) {
|
||||
if (converter->extraInfo != nullptr) {
|
||||
/*close the array of converter pointers and free the memory*/
|
||||
for (i = 0; i < NUM_OF_CONVERTERS; i++) {
|
||||
if (myConverterData->myConverterArray[i] != NULL) {
|
||||
if (myConverterData->myConverterArray[i] != nullptr) {
|
||||
ucnv_unloadSharedDataIfReady(myConverterData->myConverterArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uprv_free(converter->extraInfo);
|
||||
converter->extraInfo = NULL;
|
||||
converter->extraInfo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
|
|||
COMPOUND_TEXT_CONVERTERS currentState, tmpState;
|
||||
int32_t sourceOffset = 0;
|
||||
UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) args->converter->extraInfo;
|
||||
UConverterSharedData* savedSharedData = NULL;
|
||||
UConverterSharedData* savedSharedData = nullptr;
|
||||
|
||||
UConverterToUnicodeArgs subArgs;
|
||||
int32_t minArgsSize;
|
||||
|
@ -602,8 +602,8 @@ static const UConverterImpl _CompoundTextImpl = {
|
|||
|
||||
UCNV_COMPOUND_TEXT,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_CompoundTextOpen,
|
||||
_CompoundTextClose,
|
||||
|
@ -613,15 +613,15 @@ static const UConverterImpl _CompoundTextImpl = {
|
|||
UConverter_toUnicode_CompoundText_OFFSETS,
|
||||
UConverter_fromUnicode_CompoundText_OFFSETS,
|
||||
UConverter_fromUnicode_CompoundText_OFFSETS,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_CompoundTextgetName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
_CompoundText_GetUnicodeSet,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _CompoundTextStaticData = {
|
||||
|
|
|
@ -150,7 +150,7 @@ UCNV_FROM_U_CALLBACK_SKIP (
|
|||
*/
|
||||
*err = U_ZERO_ERROR;
|
||||
}
|
||||
else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
else if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
{
|
||||
*err = U_ZERO_ERROR;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ UCNV_FROM_U_CALLBACK_SUBSTITUTE (
|
|||
*/
|
||||
*err = U_ZERO_ERROR;
|
||||
}
|
||||
else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
else if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
{
|
||||
*err = U_ZERO_ERROR;
|
||||
ucnv_cbFromUWriteSub(fromArgs, 0, err);
|
||||
|
@ -210,12 +210,12 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
|||
int32_t valueStringLength = 0;
|
||||
int32_t i = 0;
|
||||
|
||||
const UChar *myValueSource = NULL;
|
||||
const UChar *myValueSource = nullptr;
|
||||
UErrorCode err2 = U_ZERO_ERROR;
|
||||
UConverterFromUCallback original = NULL;
|
||||
UConverterFromUCallback original = nullptr;
|
||||
const void *originalContext;
|
||||
|
||||
UConverterFromUCallback ignoredCallback = NULL;
|
||||
UConverterFromUCallback ignoredCallback = nullptr;
|
||||
const void *ignoredContext;
|
||||
|
||||
if (reason > UCNV_IRREGULAR)
|
||||
|
@ -233,7 +233,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
|||
|
||||
ucnv_setFromUCallBack (fromArgs->converter,
|
||||
(UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE,
|
||||
NULL,
|
||||
nullptr,
|
||||
&original,
|
||||
&originalContext,
|
||||
&err2);
|
||||
|
@ -243,7 +243,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
|
|||
*err = err2;
|
||||
return;
|
||||
}
|
||||
if(context==NULL)
|
||||
if(context==nullptr)
|
||||
{
|
||||
while (i < length)
|
||||
{
|
||||
|
@ -373,7 +373,7 @@ UCNV_TO_U_CALLBACK_SKIP (
|
|||
(void)length;
|
||||
if (reason <= UCNV_IRREGULAR)
|
||||
{
|
||||
if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
{
|
||||
*err = U_ZERO_ERROR;
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ UCNV_TO_U_CALLBACK_SUBSTITUTE (
|
|||
(void)length;
|
||||
if (reason <= UCNV_IRREGULAR)
|
||||
{
|
||||
if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
|
||||
{
|
||||
*err = U_ZERO_ERROR;
|
||||
ucnv_cbToUWriteSub(toArgs,0,err);
|
||||
|
@ -426,7 +426,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
|
|||
return;
|
||||
}
|
||||
|
||||
if(context==NULL)
|
||||
if(context==nullptr)
|
||||
{
|
||||
while (i < length)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ ucnv_extMatchToU(const int32_t *cx, int8_t sisoState,
|
|||
int32_t i, j, idx, length, matchLength;
|
||||
uint8_t b;
|
||||
|
||||
if(cx==NULL || cx[UCNV_EXT_TO_U_LENGTH]<=0) {
|
||||
if(cx==nullptr || cx[UCNV_EXT_TO_U_LENGTH]<=0) {
|
||||
return 0; /* no extension data, no match */
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ ucnv_extSimpleMatchToU(const int32_t *cx,
|
|||
/* try to match */
|
||||
match=ucnv_extMatchToU(cx, -1,
|
||||
source, length,
|
||||
NULL, 0,
|
||||
nullptr, 0,
|
||||
&value,
|
||||
useFallback, true);
|
||||
if(match==length) {
|
||||
|
@ -508,7 +508,7 @@ ucnv_extFindFromU(const UChar *fromUSection, int32_t length, UChar u) {
|
|||
}
|
||||
|
||||
/*
|
||||
* @param cx pointer to extension data; if NULL, returns 0
|
||||
* @param cx pointer to extension data; if nullptr, returns 0
|
||||
* @param firstCP the first code point before all the other UChars
|
||||
* @param pre UChars that must match; !initialMatch: partial match with them
|
||||
* @param preLength length of pre, >=0
|
||||
|
@ -544,7 +544,7 @@ ucnv_extMatchFromU(const int32_t *cx,
|
|||
int32_t i, j, idx, length, matchLength;
|
||||
UChar c;
|
||||
|
||||
if(cx==NULL) {
|
||||
if(cx==nullptr) {
|
||||
return 0; /* no extension data, no match */
|
||||
}
|
||||
|
||||
|
@ -759,7 +759,7 @@ ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx,
|
|||
|
||||
/* try to match */
|
||||
match=ucnv_extMatchFromU(cx, cp,
|
||||
NULL, 0,
|
||||
nullptr, 0,
|
||||
*src, (int32_t)(srcLimit-*src),
|
||||
&value,
|
||||
cnv->useFallback, flush);
|
||||
|
@ -819,8 +819,8 @@ ucnv_extSimpleMatchFromU(const int32_t *cx,
|
|||
/* try to match */
|
||||
match=ucnv_extMatchFromU(cx,
|
||||
cp,
|
||||
NULL, 0,
|
||||
NULL, 0,
|
||||
nullptr, 0,
|
||||
nullptr, 0,
|
||||
&value,
|
||||
useFallback, true);
|
||||
if(match>=2) {
|
||||
|
@ -1044,7 +1044,7 @@ ucnv_extGetUnicodeSet(const UConverterSharedData *sharedData,
|
|||
int32_t length;
|
||||
|
||||
cx=sharedData->mbcs.extIndexes;
|
||||
if(cx==NULL) {
|
||||
if(cx==nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ typedef struct UAliasContext {
|
|||
static const char DATA_NAME[] = "cnvalias";
|
||||
static const char DATA_TYPE[] = "icu";
|
||||
|
||||
static UDataMemory *gAliasData=NULL;
|
||||
static UDataMemory *gAliasData=nullptr;
|
||||
static icu::UInitOnce gAliasDataInitOnce {};
|
||||
|
||||
enum {
|
||||
|
@ -220,7 +220,7 @@ static UBool U_CALLCONV ucnv_io_cleanup(void)
|
|||
{
|
||||
if (gAliasData) {
|
||||
udata_close(gAliasData);
|
||||
gAliasData = NULL;
|
||||
gAliasData = nullptr;
|
||||
}
|
||||
gAliasDataInitOnce.reset();
|
||||
|
||||
|
@ -238,8 +238,8 @@ static void U_CALLCONV initAliasData(UErrorCode &errCode) {
|
|||
|
||||
ucln_common_registerCleanup(UCLN_COMMON_UCNV_IO, ucnv_io_cleanup);
|
||||
|
||||
U_ASSERT(gAliasData == NULL);
|
||||
data = udata_openChoice(NULL, DATA_TYPE, DATA_NAME, isAcceptable, NULL, &errCode);
|
||||
U_ASSERT(gAliasData == nullptr);
|
||||
data = udata_openChoice(nullptr, DATA_TYPE, DATA_NAME, isAcceptable, nullptr, &errCode);
|
||||
if(U_FAILURE(errCode)) {
|
||||
return;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ haveAliasData(UErrorCode *pErrorCode) {
|
|||
|
||||
static inline UBool
|
||||
isAlias(const char *alias, UErrorCode *pErrorCode) {
|
||||
if(alias==NULL) {
|
||||
if(alias==nullptr) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ findConverter(const char *alias, UBool *containsOption, UErrorCode *pErrorCode)
|
|||
|
||||
/*
|
||||
* Is this alias in this list?
|
||||
* alias and listOffset should be non-NULL.
|
||||
* alias and listOffset should be non-nullptr.
|
||||
*/
|
||||
static inline UBool
|
||||
isAliasInList(const char *alias, uint32_t listOffset) {
|
||||
|
@ -650,7 +650,7 @@ findTaggedAliasListsOffset(const char *alias, const char *standard, UErrorCode *
|
|||
uint32_t tagNum = getTagNumber(standard);
|
||||
|
||||
/* Make a quick guess. Hopefully they used a TR22 canonical alias. */
|
||||
convNum = findConverter(alias, NULL, &myErr);
|
||||
convNum = findConverter(alias, nullptr, &myErr);
|
||||
if (myErr != U_ZERO_ERROR) {
|
||||
*pErrorCode = myErr;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ findTaggedConverterNum(const char *alias, const char *standard, UErrorCode *pErr
|
|||
uint32_t tagNum = getTagNumber(standard);
|
||||
|
||||
/* Make a quick guess. Hopefully they used a TR22 canonical alias. */
|
||||
convNum = findConverter(alias, NULL, &myErr);
|
||||
convNum = findConverter(alias, nullptr, &myErr);
|
||||
if (myErr != U_ZERO_ERROR) {
|
||||
*pErrorCode = myErr;
|
||||
}
|
||||
|
@ -762,7 +762,7 @@ ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *p
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
@ -804,7 +804,7 @@ ucnv_io_nextStandardAliases(UEnumeration *enumerator,
|
|||
if (resultLength) {
|
||||
*resultLength = 0;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
|
@ -822,8 +822,8 @@ U_CDECL_END
|
|||
|
||||
/* Enumerate the aliases for the specified converter and standard tag */
|
||||
static const UEnumeration gEnumAliases = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_io_closeUEnumeration,
|
||||
ucnv_io_countStandardAliases,
|
||||
uenum_unextDefault,
|
||||
|
@ -836,7 +836,7 @@ ucnv_openStandardNames(const char *convName,
|
|||
const char *standard,
|
||||
UErrorCode *pErrorCode)
|
||||
{
|
||||
UEnumeration *myEnum = NULL;
|
||||
UEnumeration *myEnum = nullptr;
|
||||
if (haveAliasData(pErrorCode) && isAlias(convName, pErrorCode)) {
|
||||
uint32_t listOffset = findTaggedAliasListsOffset(convName, standard, pErrorCode);
|
||||
|
||||
|
@ -847,16 +847,16 @@ ucnv_openStandardNames(const char *convName,
|
|||
UAliasContext *myContext;
|
||||
|
||||
myEnum = static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
|
||||
if (myEnum == NULL) {
|
||||
if (myEnum == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(myEnum, &gEnumAliases, sizeof(UEnumeration));
|
||||
myContext = static_cast<UAliasContext *>(uprv_malloc(sizeof(UAliasContext)));
|
||||
if (myContext == NULL) {
|
||||
if (myContext == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
uprv_free(myEnum);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
myContext->listOffset = listOffset;
|
||||
myContext->listIdx = 0;
|
||||
|
@ -870,7 +870,7 @@ ucnv_openStandardNames(const char *convName,
|
|||
static uint16_t
|
||||
ucnv_io_countAliases(const char *alias, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
|
||||
uint32_t convNum = findConverter(alias, NULL, pErrorCode);
|
||||
uint32_t convNum = findConverter(alias, nullptr, pErrorCode);
|
||||
if (convNum < gMainTable.converterListSize) {
|
||||
/* tagListNum - 1 is the ALL tag */
|
||||
int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum];
|
||||
|
@ -889,7 +889,7 @@ static uint16_t
|
|||
ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
|
||||
uint32_t currAlias;
|
||||
uint32_t convNum = findConverter(alias, NULL, pErrorCode);
|
||||
uint32_t convNum = findConverter(alias, nullptr, pErrorCode);
|
||||
if (convNum < gMainTable.converterListSize) {
|
||||
/* tagListNum - 1 is the ALL tag */
|
||||
int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum];
|
||||
|
@ -913,7 +913,7 @@ ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErr
|
|||
static const char *
|
||||
ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) {
|
||||
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
|
||||
uint32_t convNum = findConverter(alias, NULL, pErrorCode);
|
||||
uint32_t convNum = findConverter(alias, nullptr, pErrorCode);
|
||||
if (convNum < gMainTable.converterListSize) {
|
||||
/* tagListNum - 1 is the ALL tag */
|
||||
int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum];
|
||||
|
@ -932,7 +932,7 @@ ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) {
|
|||
}
|
||||
/* else converter not found */
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static uint16_t
|
||||
|
@ -954,7 +954,7 @@ ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode) {
|
|||
*pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
|
@ -974,7 +974,7 @@ ucnv_getStandardName(const char *alias, const char *standard, UErrorCode *pError
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CAPI uint16_t U_EXPORT2
|
||||
|
@ -1013,7 +1013,7 @@ ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErro
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
@ -1042,7 +1042,7 @@ ucnv_io_nextAllConverters(UEnumeration *enumerator,
|
|||
if (resultLength) {
|
||||
*resultLength = 0;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
|
@ -1051,8 +1051,8 @@ ucnv_io_resetAllConverters(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/
|
|||
}
|
||||
U_CDECL_END
|
||||
static const UEnumeration gEnumAllConverters = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_io_closeUEnumeration,
|
||||
ucnv_io_countAllConverters,
|
||||
uenum_unextDefault,
|
||||
|
@ -1062,21 +1062,21 @@ static const UEnumeration gEnumAllConverters = {
|
|||
|
||||
U_CAPI UEnumeration * U_EXPORT2
|
||||
ucnv_openAllNames(UErrorCode *pErrorCode) {
|
||||
UEnumeration *myEnum = NULL;
|
||||
UEnumeration *myEnum = nullptr;
|
||||
if (haveAliasData(pErrorCode)) {
|
||||
uint16_t *myContext;
|
||||
|
||||
myEnum = static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
|
||||
if (myEnum == NULL) {
|
||||
if (myEnum == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(myEnum, &gEnumAllConverters, sizeof(UEnumeration));
|
||||
myContext = static_cast<uint16_t *>(uprv_malloc(sizeof(uint16_t)));
|
||||
if (myContext == NULL) {
|
||||
if (myContext == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
uprv_free(myEnum);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
*myContext = 0;
|
||||
myEnum->context = myContext;
|
||||
|
@ -1153,7 +1153,7 @@ ucnv_swapAliases(const UDataSwapper *ds,
|
|||
|
||||
/* udata_swapDataHeader checks the arguments */
|
||||
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1251,7 +1251,7 @@ ucnv_swapAliases(const UDataSwapper *ds,
|
|||
tempTable.resort=resort;
|
||||
} else {
|
||||
tempTable.rows=(TempRow *)uprv_malloc(count*sizeof(TempRow)+count*2);
|
||||
if(tempTable.rows==NULL) {
|
||||
if(tempTable.rows==nullptr) {
|
||||
udata_printError(ds, "ucnv_swapAliases(): unable to allocate memory for sorting tables (max length: %u)\n",
|
||||
count);
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
|
|
|
@ -242,15 +242,15 @@ static const char * const OptGroupByteToCPName[ULMBCS_GRP_LAST + 1] = {
|
|||
/* 0x0004 */ "windows-1256",
|
||||
/* 0x0005 */ "windows-1251",
|
||||
/* 0x0006 */ "ibm-852",
|
||||
/* 0x0007 */ NULL, /* Unused */
|
||||
/* 0x0007 */ nullptr, /* Unused */
|
||||
/* 0x0008 */ "windows-1254",
|
||||
/* 0x0009 */ NULL, /* Control char HT */
|
||||
/* 0x000A */ NULL, /* Control char LF */
|
||||
/* 0x0009 */ nullptr, /* Control char HT */
|
||||
/* 0x000A */ nullptr, /* Control char LF */
|
||||
/* 0x000B */ "windows-874",
|
||||
/* 0x000C */ NULL, /* Unused */
|
||||
/* 0x000D */ NULL, /* Control char CR */
|
||||
/* 0x000E */ NULL, /* Unused */
|
||||
/* 0x000F */ NULL, /* Control chars: 0x0F20 + C0/C1 character: algorithmic */
|
||||
/* 0x000C */ nullptr, /* Unused */
|
||||
/* 0x000D */ nullptr, /* Control char CR */
|
||||
/* 0x000E */ nullptr, /* Unused */
|
||||
/* 0x000F */ nullptr, /* Control chars: 0x0F20 + C0/C1 character: algorithmic */
|
||||
/* 0x0010 */ "windows-932",
|
||||
/* 0x0011 */ "windows-949",
|
||||
/* 0x0012 */ "windows-950",
|
||||
|
@ -530,7 +530,7 @@ static const struct _LocaleLMBCSGrpMap
|
|||
/* {"vi", ULMBCS_GRP_L1}, */
|
||||
{"zhTW", ULMBCS_GRP_TW},
|
||||
{"zh", ULMBCS_GRP_CN},
|
||||
{NULL, ULMBCS_GRP_L1}
|
||||
{nullptr, ULMBCS_GRP_L1}
|
||||
};
|
||||
|
||||
|
||||
|
@ -589,22 +589,22 @@ U_CDECL_END
|
|||
#define DECLARE_LMBCS_DATA(n) \
|
||||
static const UConverterImpl _LMBCSImpl##n={\
|
||||
UCNV_LMBCS_##n,\
|
||||
NULL,NULL,\
|
||||
nullptr,nullptr,\
|
||||
_LMBCSOpen##n,\
|
||||
_LMBCSClose,\
|
||||
NULL,\
|
||||
nullptr,\
|
||||
_LMBCSToUnicodeWithOffsets,\
|
||||
_LMBCSToUnicodeWithOffsets,\
|
||||
_LMBCSFromUnicode,\
|
||||
_LMBCSFromUnicode,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
NULL,\
|
||||
nullptr,\
|
||||
nullptr,\
|
||||
nullptr,\
|
||||
nullptr,\
|
||||
_LMBCSSafeClone,\
|
||||
ucnv_getCompleteUnicodeSet,\
|
||||
NULL,\
|
||||
NULL\
|
||||
nullptr,\
|
||||
nullptr\
|
||||
};\
|
||||
static const UConverterStaticData _LMBCSStaticData##n={\
|
||||
sizeof(UConverterStaticData),\
|
||||
|
@ -635,7 +635,7 @@ _LMBCSOpenWorker(UConverter* _this,
|
|||
{
|
||||
UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS*)uprv_malloc (sizeof (UConverterDataLMBCS));
|
||||
_this->extraInfo = extraInfo;
|
||||
if(extraInfo != NULL)
|
||||
if(extraInfo != nullptr)
|
||||
{
|
||||
UConverterNamePieces stackPieces;
|
||||
UConverterLoadArgs stackArgs= UCNV_LOAD_ARGS_INITIALIZER;
|
||||
|
@ -647,7 +647,7 @@ _LMBCSOpenWorker(UConverter* _this,
|
|||
|
||||
for (i=0; i <= ULMBCS_GRP_LAST && U_SUCCESS(*err); i++)
|
||||
{
|
||||
if(OptGroupByteToCPName[i] != NULL) {
|
||||
if(OptGroupByteToCPName[i] != nullptr) {
|
||||
extraInfo->OptGrpConverter[i] = ucnv_loadSharedData(OptGroupByteToCPName[i], &stackPieces, &stackArgs, err);
|
||||
}
|
||||
}
|
||||
|
@ -669,19 +669,19 @@ U_CDECL_BEGIN
|
|||
static void U_CALLCONV
|
||||
_LMBCSClose(UConverter * _this)
|
||||
{
|
||||
if (_this->extraInfo != NULL)
|
||||
if (_this->extraInfo != nullptr)
|
||||
{
|
||||
ulmbcs_byte_t Ix;
|
||||
UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) _this->extraInfo;
|
||||
|
||||
for (Ix=0; Ix <= ULMBCS_GRP_LAST; Ix++)
|
||||
{
|
||||
if (extraInfo->OptGrpConverter[Ix] != NULL)
|
||||
if (extraInfo->OptGrpConverter[Ix] != nullptr)
|
||||
ucnv_unloadSharedDataIfReady(extraInfo->OptGrpConverter[Ix]);
|
||||
}
|
||||
if (!_this->isExtraLocal) {
|
||||
uprv_free (_this->extraInfo);
|
||||
_this->extraInfo = NULL;
|
||||
_this->extraInfo = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ _LMBCSSafeClone(const UConverter *cnv,
|
|||
|
||||
if(*pBufferSize<=0) {
|
||||
*pBufferSize=(int32_t)sizeof(LMBCSClone);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extraInfo=(UConverterDataLMBCS *)cnv->extraInfo;
|
||||
|
@ -715,7 +715,7 @@ _LMBCSSafeClone(const UConverter *cnv,
|
|||
|
||||
/* share the subconverters */
|
||||
for(i = 0; i <= ULMBCS_GRP_LAST; ++i) {
|
||||
if(extraInfo->OptGrpConverter[i] != NULL) {
|
||||
if(extraInfo->OptGrpConverter[i] != nullptr) {
|
||||
ucnv_incrementRefCount(extraInfo->OptGrpConverter[i]);
|
||||
}
|
||||
}
|
||||
|
@ -1177,7 +1177,7 @@ _LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
|
|||
{
|
||||
group = CurByte; /* group byte is in the source */
|
||||
extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
|
||||
if (group > ULMBCS_GRP_LAST || (cnv = extraInfo->OptGrpConverter[group]) == NULL)
|
||||
if (group > ULMBCS_GRP_LAST || (cnv = extraInfo->OptGrpConverter[group]) == nullptr)
|
||||
{
|
||||
/* this is not a valid group byte - no converter*/
|
||||
*err = U_INVALID_CHAR_FOUND;
|
||||
|
@ -1267,7 +1267,7 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
|
|||
UChar uniChar; /* one output UNICODE char */
|
||||
const char * saveSource; /* beginning of current code point */
|
||||
const char * pStartLMBCS = args->source; /* beginning of whole string */
|
||||
const char * errSource = NULL; /* pointer to actual input in case an error occurs */
|
||||
const char * errSource = nullptr; /* pointer to actual input in case an error occurs */
|
||||
int8_t savebytes = 0;
|
||||
|
||||
/* Process from source to limit, or until error */
|
||||
|
|
|
@ -34,23 +34,23 @@ ucnv_getUnicodeSet(const UConverter *cnv,
|
|||
UConverterUnicodeSet whichSet,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* argument checking */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
|
||||
if(cnv==nullptr || setFillIn==nullptr || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
/* does this converter support this function? */
|
||||
if(cnv->sharedData->impl->getUnicodeSet==NULL) {
|
||||
if(cnv->sharedData->impl->getUnicodeSet==nullptr) {
|
||||
*pErrorCode=U_UNSUPPORTED_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
USetAdder sa={
|
||||
NULL,
|
||||
nullptr,
|
||||
uset_add,
|
||||
uset_addRange,
|
||||
uset_addString,
|
||||
|
|
|
@ -102,7 +102,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
target[3]=(uint8_t)trail;
|
||||
target+=4;
|
||||
targetCapacity-=4;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1;
|
||||
*offsets++=-1;
|
||||
*offsets++=-1;
|
||||
|
@ -123,7 +123,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
count>>=1;
|
||||
length-=count;
|
||||
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
while(count>0) {
|
||||
c=*source++;
|
||||
if(U16_IS_SINGLE(c)) {
|
||||
|
@ -310,7 +310,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(U16_IS_SINGLE(c)) {
|
||||
/* output the BMP code point */
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -332,7 +332,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
*target++=c;
|
||||
if(targetCapacity>=2) {
|
||||
*target++=trail;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1;
|
||||
*offsets++=-1;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
length-=count;
|
||||
count>>=1;
|
||||
targetCapacity-=count;
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
do {
|
||||
c=((UChar)source[0]<<8)|source[1];
|
||||
source+=2;
|
||||
|
@ -452,7 +452,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
source+=2;
|
||||
length-=2;
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
cnv->UCharErrorBuffer[0]=trail;
|
||||
|
@ -610,11 +610,11 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF16BEImpl={
|
||||
UCNV_UTF16_BigEndian,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF16BEOpen,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF16BEReset,
|
||||
|
||||
_UTF16BEToUnicodeWithOffsets,
|
||||
|
@ -623,14 +623,14 @@ static const UConverterImpl _UTF16BEImpl={
|
|||
_UTF16BEFromUnicodeWithOffsets,
|
||||
_UTF16BEGetNextUChar,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF16BEGetName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _UTF16BEStaticData={
|
||||
|
@ -703,7 +703,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
target[3]=(uint8_t)(trail>>8);
|
||||
target+=4;
|
||||
targetCapacity-=4;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1;
|
||||
*offsets++=-1;
|
||||
*offsets++=-1;
|
||||
|
@ -724,7 +724,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
count>>=1;
|
||||
length-=count;
|
||||
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
while(count>0) {
|
||||
c=*source++;
|
||||
if(U16_IS_SINGLE(c)) {
|
||||
|
@ -911,7 +911,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(U16_IS_SINGLE(c)) {
|
||||
/* output the BMP code point */
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -933,7 +933,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
*target++=c;
|
||||
if(targetCapacity>=2) {
|
||||
*target++=trail;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=-1;
|
||||
*offsets++=-1;
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
length-=count;
|
||||
count>>=1;
|
||||
targetCapacity-=count;
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
do {
|
||||
c=((UChar)source[1]<<8)|source[0];
|
||||
source+=2;
|
||||
|
@ -1053,7 +1053,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
source+=2;
|
||||
length-=2;
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
cnv->UCharErrorBuffer[0]=trail;
|
||||
|
@ -1211,11 +1211,11 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF16LEImpl={
|
||||
UCNV_UTF16_LittleEndian,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF16LEOpen,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF16LEReset,
|
||||
|
||||
_UTF16LEToUnicodeWithOffsets,
|
||||
|
@ -1224,14 +1224,14 @@ static const UConverterImpl _UTF16LEImpl={
|
|||
_UTF16LEFromUnicodeWithOffsets,
|
||||
_UTF16LEGetNextUChar,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF16LEGetName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
||||
|
@ -1447,7 +1447,7 @@ _UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
}
|
||||
|
||||
/* add BOM size to offsets - see comment at offsetDelta declaration */
|
||||
if(offsets!=NULL && offsetDelta!=0) {
|
||||
if(offsets!=nullptr && offsetDelta!=0) {
|
||||
int32_t *offsetsLimit=pArgs->offsets;
|
||||
while(offsets<offsetsLimit) {
|
||||
*offsets++ += offsetDelta;
|
||||
|
@ -1493,11 +1493,11 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF16Impl = {
|
||||
UCNV_UTF16,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF16Open,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF16Reset,
|
||||
|
||||
_UTF16ToUnicodeWithOffsets,
|
||||
|
@ -1506,14 +1506,14 @@ static const UConverterImpl _UTF16Impl = {
|
|||
_UTF16PEFromUnicodeWithOffsets,
|
||||
_UTF16GetNextUChar,
|
||||
|
||||
NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
|
||||
nullptr, /* ### TODO implement getStarters for all Unicode encodings?! */
|
||||
_UTF16GetName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _UTF16StaticData = {
|
||||
|
@ -1538,11 +1538,11 @@ const UConverterSharedData _UTF16Data =
|
|||
static const UConverterImpl _UTF16v2Impl = {
|
||||
UCNV_UTF16,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF16Open,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF16Reset,
|
||||
|
||||
_UTF16ToUnicodeWithOffsets,
|
||||
|
@ -1551,14 +1551,14 @@ static const UConverterImpl _UTF16v2Impl = {
|
|||
_UTF16BEFromUnicodeWithOffsets,
|
||||
_UTF16GetNextUChar,
|
||||
|
||||
NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
|
||||
nullptr, /* ### TODO implement getStarters for all Unicode encodings?! */
|
||||
_UTF16GetName,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _UTF16v2StaticData = {
|
||||
|
|
|
@ -465,12 +465,12 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF32BEImpl = {
|
||||
UCNV_UTF32_BigEndian,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
T_UConverter_toUnicode_UTF32_BE,
|
||||
T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC,
|
||||
|
@ -478,14 +478,14 @@ static const UConverterImpl _UTF32BEImpl = {
|
|||
T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC,
|
||||
T_UConverter_getNextUChar_UTF32_BE,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
/* The 1232 CCSID refers to any version of Unicode with any endianness of UTF-32 */
|
||||
|
@ -960,12 +960,12 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF32LEImpl = {
|
||||
UCNV_UTF32_LittleEndian,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
T_UConverter_toUnicode_UTF32_LE,
|
||||
T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC,
|
||||
|
@ -973,14 +973,14 @@ static const UConverterImpl _UTF32LEImpl = {
|
|||
T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC,
|
||||
T_UConverter_getNextUChar_UTF32_LE,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
/* The 1232 CCSID refers to any version of Unicode with any endianness of UTF-32 */
|
||||
|
@ -1126,7 +1126,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
case 8:
|
||||
/* call UTF-32BE */
|
||||
pArgs->source=source;
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
|
||||
} else {
|
||||
T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(pArgs, pErrorCode);
|
||||
|
@ -1136,7 +1136,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
case 9:
|
||||
/* call UTF-32LE */
|
||||
pArgs->source=source;
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode);
|
||||
} else {
|
||||
T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(pArgs, pErrorCode);
|
||||
|
@ -1149,7 +1149,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
}
|
||||
|
||||
/* add BOM size to offsets - see comment at offsetDelta declaration */
|
||||
if(offsets!=NULL && offsetDelta!=0) {
|
||||
if(offsets!=nullptr && offsetDelta!=0) {
|
||||
int32_t *offsetsLimit=pArgs->offsets;
|
||||
while(offsets<offsetsLimit) {
|
||||
*offsets++ += offsetDelta;
|
||||
|
@ -1202,11 +1202,11 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF32Impl = {
|
||||
UCNV_UTF32,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF32Open,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF32Reset,
|
||||
|
||||
_UTF32ToUnicodeWithOffsets,
|
||||
|
@ -1220,14 +1220,14 @@ static const UConverterImpl _UTF32Impl = {
|
|||
#endif
|
||||
_UTF32GetNextUChar,
|
||||
|
||||
NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr, /* ### TODO implement getStarters for all Unicode encodings?! */
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
/* The 1236 CCSID refers to any version of Unicode with a BOM sensitive endianness of UTF-32 */
|
||||
|
|
|
@ -280,7 +280,7 @@ directMode:
|
|||
} else if(b!=PLUS) {
|
||||
/* write directly encoded character */
|
||||
*target++=b;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else /* PLUS */ {
|
||||
|
@ -375,7 +375,7 @@ unicodeMode:
|
|||
break;
|
||||
case 2:
|
||||
*target++=(UChar)((bits<<4)|(base64Value>>2));
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex-1;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ unicodeMode:
|
|||
break;
|
||||
case 5:
|
||||
*target++=(UChar)((bits<<2)|(base64Value>>4));
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex-1;
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ unicodeMode:
|
|||
break;
|
||||
case 7:
|
||||
*target++=(UChar)((bits<<6)|base64Value);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex;
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ unicodeMode:
|
|||
if(base64Counter==-1) {
|
||||
/* +- i.e. a minus immediately following a plus */
|
||||
*target++=PLUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -511,7 +511,7 @@ directMode:
|
|||
if(c<=127 && encodeDirectly[c]) {
|
||||
/* encode directly */
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else if(c==PLUS) {
|
||||
|
@ -519,14 +519,14 @@ directMode:
|
|||
*target++=PLUS;
|
||||
if(target<targetLimit) {
|
||||
*target++=MINUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
/* realign length and targetCapacity */
|
||||
goto directMode;
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
cnv->charErrorBuffer[0]=MINUS;
|
||||
|
@ -538,7 +538,7 @@ directMode:
|
|||
/* un-read this character and switch to Unicode Mode */
|
||||
--source;
|
||||
*target++=PLUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
inDirectMode=false;
|
||||
|
@ -567,7 +567,7 @@ unicodeMode:
|
|||
if(base64Counter!=0) {
|
||||
/* write remaining bits for the previous character */
|
||||
*target++=toBase64[bits];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ unicodeMode:
|
|||
/* need to terminate with a minus */
|
||||
if(target<targetLimit) {
|
||||
*target++=MINUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -601,12 +601,12 @@ unicodeMode:
|
|||
*target++=toBase64[c>>10];
|
||||
if(target<targetLimit) {
|
||||
*target++=toBase64[(c>>4)&0x3f];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
cnv->charErrorBuffer[0]=toBase64[(c>>4)&0x3f];
|
||||
|
@ -622,13 +622,13 @@ unicodeMode:
|
|||
*target++=toBase64[(c>>8)&0x3f];
|
||||
if(target<targetLimit) {
|
||||
*target++=toBase64[(c>>2)&0x3f];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ unicodeMode:
|
|||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
cnv->charErrorBuffer[0]=toBase64[(c>>8)&0x3f];
|
||||
|
@ -654,13 +654,13 @@ unicodeMode:
|
|||
*target++=toBase64[(c>>6)&0x3f];
|
||||
if(target<targetLimit) {
|
||||
*target++=toBase64[c&0x3f];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ unicodeMode:
|
|||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
cnv->charErrorBuffer[0]=toBase64[(c>>6)&0x3f];
|
||||
|
@ -699,7 +699,7 @@ unicodeMode:
|
|||
if (base64Counter!=0) {
|
||||
if(target<targetLimit) {
|
||||
*target++=toBase64[bits];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -710,7 +710,7 @@ unicodeMode:
|
|||
/* Add final MINUS to terminate unicodeMode */
|
||||
if(target<targetLimit) {
|
||||
*target++=MINUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -748,27 +748,27 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF7Impl={
|
||||
UCNV_UTF7,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF7Open,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF7Reset,
|
||||
|
||||
_UTF7ToUnicodeWithOffsets,
|
||||
_UTF7ToUnicodeWithOffsets,
|
||||
_UTF7FromUnicodeWithOffsets,
|
||||
_UTF7FromUnicodeWithOffsets,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF7GetName,
|
||||
NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
|
||||
NULL,
|
||||
nullptr, /* we don't need writeSub() because we never call a callback at fromUnicode() */
|
||||
nullptr,
|
||||
ucnv_getCompleteUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _UTF7StaticData={
|
||||
|
@ -965,7 +965,7 @@ directMode:
|
|||
} else if(b!=AMPERSAND) {
|
||||
/* write directly encoded character */
|
||||
*target++=b;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else /* AMPERSAND */ {
|
||||
|
@ -1029,7 +1029,7 @@ unicodeMode:
|
|||
goto endloop;
|
||||
}
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex-1;
|
||||
}
|
||||
|
@ -1047,7 +1047,7 @@ unicodeMode:
|
|||
goto endloop;
|
||||
}
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex-1;
|
||||
}
|
||||
|
@ -1065,7 +1065,7 @@ unicodeMode:
|
|||
goto endloop;
|
||||
}
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex;
|
||||
}
|
||||
|
@ -1083,7 +1083,7 @@ unicodeMode:
|
|||
if(base64Counter==-1) {
|
||||
/* &- i.e. a minus immediately following an ampersand */
|
||||
*target++=AMPERSAND;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -1210,7 +1210,7 @@ directMode:
|
|||
if(inSetDIMAP(c)) {
|
||||
/* encode directly */
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else if(c==AMPERSAND) {
|
||||
|
@ -1218,14 +1218,14 @@ directMode:
|
|||
*target++=AMPERSAND;
|
||||
if(target<targetLimit) {
|
||||
*target++=MINUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
/* realign length and targetCapacity */
|
||||
goto directMode;
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
cnv->charErrorBuffer[0]=MINUS;
|
||||
|
@ -1237,7 +1237,7 @@ directMode:
|
|||
/* un-read this character and switch to Unicode Mode */
|
||||
--source;
|
||||
*target++=AMPERSAND;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
inDirectMode=false;
|
||||
|
@ -1266,14 +1266,14 @@ unicodeMode:
|
|||
if(base64Counter!=0) {
|
||||
/* write remaining bits for the previous character */
|
||||
*target++=TO_BASE64_IMAP(bits);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
}
|
||||
/* need to terminate with a minus */
|
||||
if(target<targetLimit) {
|
||||
*target++=MINUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -1300,12 +1300,12 @@ unicodeMode:
|
|||
if(target<targetLimit) {
|
||||
b=(uint8_t)((c>>4)&0x3f);
|
||||
*target++=TO_BASE64_IMAP(b);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
b=(uint8_t)((c>>4)&0x3f);
|
||||
|
@ -1325,13 +1325,13 @@ unicodeMode:
|
|||
if(target<targetLimit) {
|
||||
b=(uint8_t)((c>>2)&0x3f);
|
||||
*target++=TO_BASE64_IMAP(b);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
|
@ -1341,7 +1341,7 @@ unicodeMode:
|
|||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
b=(uint8_t)((c>>8)&0x3f);
|
||||
|
@ -1363,13 +1363,13 @@ unicodeMode:
|
|||
if(target<targetLimit) {
|
||||
b=(uint8_t)(c&0x3f);
|
||||
*target++=TO_BASE64_IMAP(b);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
|
@ -1379,7 +1379,7 @@ unicodeMode:
|
|||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex++;
|
||||
}
|
||||
b=(uint8_t)((c>>6)&0x3f);
|
||||
|
@ -1411,7 +1411,7 @@ unicodeMode:
|
|||
if(base64Counter!=0) {
|
||||
if(target<targetLimit) {
|
||||
*target++=TO_BASE64_IMAP(bits);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -1422,7 +1422,7 @@ unicodeMode:
|
|||
/* need to terminate with a minus */
|
||||
if(target<targetLimit) {
|
||||
*target++=MINUS;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex-1;
|
||||
}
|
||||
} else {
|
||||
|
@ -1450,26 +1450,26 @@ U_CDECL_END
|
|||
static const UConverterImpl _IMAPImpl={
|
||||
UCNV_IMAP_MAILBOX,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_UTF7Open,
|
||||
NULL,
|
||||
nullptr,
|
||||
_UTF7Reset,
|
||||
|
||||
_IMAPToUnicodeWithOffsets,
|
||||
_IMAPToUnicodeWithOffsets,
|
||||
_IMAPFromUnicodeWithOffsets,
|
||||
_IMAPFromUnicodeWithOffsets,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr, /* we don't need writeSub() because we never call a callback at fromUnicode() */
|
||||
nullptr,
|
||||
ucnv_getCompleteUnicodeSet,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _IMAPStaticData={
|
||||
|
|
|
@ -859,12 +859,12 @@ U_CDECL_END
|
|||
static const UConverterImpl _UTF8Impl={
|
||||
UCNV_UTF8,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
ucnv_toUnicode_UTF8,
|
||||
ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
|
||||
|
@ -872,10 +872,10 @@ static const UConverterImpl _UTF8Impl={
|
|||
ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
|
||||
ucnv_getNextUChar_UTF8,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getNonSurrogateUnicodeSet,
|
||||
|
||||
ucnv_UTF8FromUTF8,
|
||||
|
@ -903,27 +903,27 @@ const UConverterSharedData _UTF8Data=
|
|||
static const UConverterImpl _CESU8Impl={
|
||||
UCNV_CESU8,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
ucnv_toUnicode_UTF8,
|
||||
ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
|
||||
ucnv_fromUnicode_UTF8,
|
||||
ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getCompleteUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _CESU8StaticData={
|
||||
|
|
|
@ -456,7 +456,7 @@ fastSingle:
|
|||
}
|
||||
/* restore real values */
|
||||
targetCapacity=(int32_t)((const uint8_t *)pArgs->targetLimit-target);
|
||||
sourceIndex=nextSourceIndex; /* wrong if offsets==NULL but does not matter */
|
||||
sourceIndex=nextSourceIndex; /* wrong if offsets==nullptr but does not matter */
|
||||
|
||||
/* regular loop for all cases */
|
||||
while(source<sourceLimit) {
|
||||
|
@ -1027,7 +1027,7 @@ fastSingle:
|
|||
++source;
|
||||
--count;
|
||||
}
|
||||
sourceIndex=nextSourceIndex; /* wrong if offsets==NULL but does not matter */
|
||||
sourceIndex=nextSourceIndex; /* wrong if offsets==nullptr but does not matter */
|
||||
|
||||
/* decode a sequence of single and lead bytes */
|
||||
while(source<sourceLimit) {
|
||||
|
@ -1371,27 +1371,27 @@ endloop:
|
|||
static const UConverterImpl _Bocu1Impl={
|
||||
UCNV_BOCU1,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_Bocu1ToUnicode,
|
||||
_Bocu1ToUnicodeWithOffsets,
|
||||
_Bocu1FromUnicode,
|
||||
_Bocu1FromUnicodeWithOffsets,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnv_getCompleteUnicodeSet,
|
||||
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _Bocu1StaticData={
|
||||
|
|
|
@ -43,17 +43,17 @@ ucnv_getDisplayName(const UConverter *cnv,
|
|||
UErrorCode localStatus = U_ZERO_ERROR;
|
||||
|
||||
/* check arguments */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(cnv==NULL || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==NULL)) {
|
||||
if(cnv==nullptr || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==nullptr)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* open the resource bundle and get the display name string */
|
||||
rb=ures_open(NULL, displayLocale, pErrorCode);
|
||||
rb=ures_open(nullptr, displayLocale, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
while(len-->0){ \
|
||||
if(targetIndex < targetLength){ \
|
||||
args->target[targetIndex] = (unsigned char) *strToAppend; \
|
||||
if(args->offsets!=NULL){ \
|
||||
if(args->offsets!=nullptr){ \
|
||||
*(offsets++) = sourceIndex-1; \
|
||||
} \
|
||||
targetIndex++; \
|
||||
|
@ -84,7 +84,7 @@ _HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
|
|||
cnv->mode=0;
|
||||
cnv->fromUChar32=0x0000;
|
||||
cnv->extraInfo = uprv_calloc(1, sizeof(UConverterDataHZ));
|
||||
if(cnv->extraInfo != NULL){
|
||||
if(cnv->extraInfo != nullptr){
|
||||
((UConverterDataHZ*)cnv->extraInfo)->gbConverter = gbConverter;
|
||||
}
|
||||
else {
|
||||
|
@ -96,12 +96,12 @@ _HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
|
|||
|
||||
static void U_CALLCONV
|
||||
_HZClose(UConverter *cnv){
|
||||
if(cnv->extraInfo != NULL) {
|
||||
if(cnv->extraInfo != nullptr) {
|
||||
ucnv_close (((UConverterDataHZ *) (cnv->extraInfo))->gbConverter);
|
||||
if(!cnv->isExtraLocal) {
|
||||
uprv_free(cnv->extraInfo);
|
||||
}
|
||||
cnv->extraInfo = NULL;
|
||||
cnv->extraInfo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ _HZReset(UConverter *cnv, UConverterResetChoice choice){
|
|||
if(choice<=UCNV_RESET_TO_UNICODE) {
|
||||
cnv->toUnicodeStatus = 0;
|
||||
cnv->mode=0;
|
||||
if(cnv->extraInfo != NULL){
|
||||
if(cnv->extraInfo != nullptr){
|
||||
((UConverterDataHZ*)cnv->extraInfo)->isStateDBCS = false;
|
||||
((UConverterDataHZ*)cnv->extraInfo)->isEmptySegment = false;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ _HZReset(UConverter *cnv, UConverterResetChoice choice){
|
|||
if(choice!=UCNV_RESET_TO_UNICODE) {
|
||||
cnv->fromUnicodeStatus= 0;
|
||||
cnv->fromUChar32=0x0000;
|
||||
if(cnv->extraInfo != NULL){
|
||||
if(cnv->extraInfo != nullptr){
|
||||
((UConverterDataHZ*)cnv->extraInfo)->isEscapeAppended = false;
|
||||
((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
|
||||
((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0;
|
||||
|
@ -166,7 +166,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
|
|||
tempBuf[1]=0;
|
||||
|
||||
/* Calling code already handles this situation. */
|
||||
/*if ((args->converter == NULL) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
|
||||
/*if ((args->converter == nullptr) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}*/
|
||||
|
@ -348,10 +348,10 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
|
|||
UBool isTargetUCharDBCS = (UBool) myConverterData->isTargetUCharDBCS;
|
||||
UBool oldIsTargetUCharDBCS;
|
||||
int len =0;
|
||||
const char* escSeq=NULL;
|
||||
const char* escSeq=nullptr;
|
||||
|
||||
/* Calling code already handles this situation. */
|
||||
/*if ((args->converter == NULL) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
|
||||
/*if ((args->converter == nullptr) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}*/
|
||||
|
@ -579,8 +579,8 @@ static const UConverterImpl _HZImpl={
|
|||
|
||||
UCNV_HZ,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_HZOpen,
|
||||
_HZClose,
|
||||
|
@ -590,15 +590,15 @@ static const UConverterImpl _HZImpl={
|
|||
UConverter_toUnicode_HZ_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
_HZ_WriteSub,
|
||||
_HZ_SafeClone,
|
||||
_HZ_GetUnicodeSet,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _HZStaticData={
|
||||
|
|
|
@ -195,7 +195,7 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
|
|||
|
||||
cnv->extraInfo = uprv_malloc(sizeof(UConverterDataISCII));
|
||||
|
||||
if (cnv->extraInfo != NULL) {
|
||||
if (cnv->extraInfo != nullptr) {
|
||||
int32_t len=0;
|
||||
UConverterDataISCII *converterData=
|
||||
(UConverterDataISCII *) cnv->extraInfo;
|
||||
|
@ -223,7 +223,7 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
|
|||
converterData->prevToUnicodeStatus = 0x0000;
|
||||
} else {
|
||||
uprv_free(cnv->extraInfo);
|
||||
cnv->extraInfo = NULL;
|
||||
cnv->extraInfo = nullptr;
|
||||
*errorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
}
|
||||
|
||||
|
@ -234,11 +234,11 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
|
|||
|
||||
static void U_CALLCONV
|
||||
_ISCIIClose(UConverter *cnv) {
|
||||
if (cnv->extraInfo!=NULL) {
|
||||
if (cnv->extraInfo!=nullptr) {
|
||||
if (!cnv->isExtraLocal) {
|
||||
uprv_free(cnv->extraInfo);
|
||||
}
|
||||
cnv->extraInfo=NULL;
|
||||
cnv->extraInfo=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ _ISCIIgetName(const UConverter* cnv) {
|
|||
UConverterDataISCII* myData= (UConverterDataISCII*)cnv->extraInfo;
|
||||
return myData->name;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
|
@ -908,7 +908,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
|
|||
uint16_t range = 0;
|
||||
UBool deltaChanged = false;
|
||||
|
||||
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
|
||||
if ((args->converter == nullptr) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1185,14 +1185,14 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
|
|||
uint32_t targetUniChar = 0x0000;
|
||||
uint8_t sourceChar = 0x0000;
|
||||
UConverterDataISCII* data;
|
||||
UChar32* toUnicodeStatus=NULL;
|
||||
UChar32* toUnicodeStatus=nullptr;
|
||||
UChar32 tempTargetUniChar = 0x0000;
|
||||
UChar* contextCharToUnicode= NULL;
|
||||
UChar* contextCharToUnicode= nullptr;
|
||||
UBool found;
|
||||
int i;
|
||||
int offset = 0;
|
||||
|
||||
if ((args->converter == NULL) || (target < args->target) || (source < args->source)) {
|
||||
if ((args->converter == nullptr) || (target < args->target) || (source < args->source)) {
|
||||
*err = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1589,8 +1589,8 @@ static const UConverterImpl _ISCIIImpl={
|
|||
|
||||
UCNV_ISCII,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_ISCIIOpen,
|
||||
_ISCIIClose,
|
||||
|
@ -1600,15 +1600,15 @@ static const UConverterImpl _ISCIIImpl={
|
|||
UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
|
||||
UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_ISCIIgetName,
|
||||
NULL,
|
||||
nullptr,
|
||||
_ISCII_SafeClone,
|
||||
_ISCIIGetUnicodeSet,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _ISCIIStaticData={
|
||||
|
|
|
@ -82,7 +82,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
source+=8;
|
||||
} while(--count>0);
|
||||
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
do {
|
||||
offsets[0]=sourceIndex++;
|
||||
offsets[1]=sourceIndex++;
|
||||
|
@ -108,7 +108,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
pArgs->target=target;
|
||||
|
||||
/* set offsets */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
while(length>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
--length;
|
||||
|
@ -233,7 +233,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
count=loops-count;
|
||||
targetCapacity-=16*count;
|
||||
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
oldTarget+=16*count;
|
||||
while(count>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
|
@ -300,7 +300,7 @@ getTrail:
|
|||
noMoreInput:
|
||||
|
||||
/* set offsets since the start */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
size_t count=target-oldTarget;
|
||||
while(count>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
|
@ -438,12 +438,12 @@ U_CDECL_END
|
|||
static const UConverterImpl _Latin1Impl={
|
||||
UCNV_LATIN_1,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_Latin1ToUnicodeWithOffsets,
|
||||
_Latin1ToUnicodeWithOffsets,
|
||||
|
@ -451,13 +451,13 @@ static const UConverterImpl _Latin1Impl={
|
|||
_Latin1FromUnicodeWithOffsets,
|
||||
_Latin1GetNextUChar,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
_Latin1GetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_Latin1FromUTF8
|
||||
};
|
||||
|
||||
|
@ -536,7 +536,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
count=loops-count;
|
||||
targetCapacity-=count*8;
|
||||
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
oldTarget+=count*8;
|
||||
while(count>0) {
|
||||
offsets[0]=sourceIndex++;
|
||||
|
@ -572,7 +572,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
}
|
||||
|
||||
/* set offsets since the start */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
size_t count=target-oldTarget;
|
||||
while(count>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
|
@ -717,12 +717,12 @@ U_CDECL_END
|
|||
static const UConverterImpl _ASCIIImpl={
|
||||
UCNV_US_ASCII,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_ASCIIToUnicodeWithOffsets,
|
||||
_ASCIIToUnicodeWithOffsets,
|
||||
|
@ -730,13 +730,13 @@ static const UConverterImpl _ASCIIImpl={
|
|||
_Latin1FromUnicodeWithOffsets,
|
||||
_ASCIIGetNextUChar,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
_ASCIIGetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_ASCIIFromUTF8
|
||||
};
|
||||
|
||||
|
|
|
@ -438,8 +438,8 @@ static const UConverterImpl _SBCSUTF8Impl={
|
|||
ucnv_MBCSUnload,
|
||||
|
||||
ucnv_MBCSOpen,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
ucnv_MBCSToUnicodeWithOffsets,
|
||||
ucnv_MBCSToUnicodeWithOffsets,
|
||||
|
@ -450,10 +450,10 @@ static const UConverterImpl _SBCSUTF8Impl={
|
|||
ucnv_MBCSGetStarters,
|
||||
ucnv_MBCSGetName,
|
||||
ucnv_MBCSWriteSub,
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_MBCSGetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_SBCSFromUTF8
|
||||
};
|
||||
|
||||
|
@ -464,8 +464,8 @@ static const UConverterImpl _DBCSUTF8Impl={
|
|||
ucnv_MBCSUnload,
|
||||
|
||||
ucnv_MBCSOpen,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
ucnv_MBCSToUnicodeWithOffsets,
|
||||
ucnv_MBCSToUnicodeWithOffsets,
|
||||
|
@ -476,10 +476,10 @@ static const UConverterImpl _DBCSUTF8Impl={
|
|||
ucnv_MBCSGetStarters,
|
||||
ucnv_MBCSGetName,
|
||||
ucnv_MBCSWriteSub,
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_MBCSGetUnicodeSet,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_DBCSFromUTF8
|
||||
};
|
||||
|
||||
|
@ -490,8 +490,8 @@ static const UConverterImpl _MBCSImpl={
|
|||
ucnv_MBCSUnload,
|
||||
|
||||
ucnv_MBCSOpen,
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
ucnv_MBCSToUnicodeWithOffsets,
|
||||
ucnv_MBCSToUnicodeWithOffsets,
|
||||
|
@ -502,10 +502,10 @@ static const UConverterImpl _MBCSImpl={
|
|||
ucnv_MBCSGetStarters,
|
||||
ucnv_MBCSGetName,
|
||||
ucnv_MBCSWriteSub,
|
||||
NULL,
|
||||
nullptr,
|
||||
ucnv_MBCSGetUnicodeSet,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
/* Static data is in tools/makeconv/ucnvstat.c for data-based
|
||||
|
@ -514,7 +514,7 @@ static const UConverterImpl _MBCSImpl={
|
|||
|
||||
const UConverterSharedData _MBCSData={
|
||||
sizeof(UConverterSharedData), 1,
|
||||
NULL, NULL, false, true, &_MBCSImpl,
|
||||
nullptr, nullptr, false, true, &_MBCSImpl,
|
||||
0, UCNV_MBCS_TABLE_INITIALIZER
|
||||
};
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ _extFromU(UConverter *cnv, const UConverterSharedData *sharedData,
|
|||
|
||||
cnv->useSubChar1=false;
|
||||
|
||||
if( (cx=sharedData->mbcs.extIndexes)!=NULL &&
|
||||
if( (cx=sharedData->mbcs.extIndexes)!=nullptr &&
|
||||
ucnv_extInitialMatchFromU(
|
||||
cnv, cx,
|
||||
cp, source, sourceLimit,
|
||||
|
@ -1178,7 +1178,7 @@ _extToU(UConverter *cnv, const UConverterSharedData *sharedData,
|
|||
UErrorCode *pErrorCode) {
|
||||
const int32_t *cx;
|
||||
|
||||
if( (cx=sharedData->mbcs.extIndexes)!=NULL &&
|
||||
if( (cx=sharedData->mbcs.extIndexes)!=nullptr &&
|
||||
ucnv_extInitialMatchToU(
|
||||
cnv, cx,
|
||||
length, (const char **)source, (const char *)sourceLimit,
|
||||
|
@ -1349,7 +1349,7 @@ _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) {
|
|||
sizeofFromUBytes+
|
||||
UCNV_MAX_CONVERTER_NAME_LENGTH+20;
|
||||
p=(uint8_t *)uprv_malloc(size);
|
||||
if(p==NULL) {
|
||||
if(p==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
@ -1383,18 +1383,18 @@ _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) {
|
|||
uprv_strcat(name, UCNV_SWAP_LFNL_OPTION_STRING);
|
||||
|
||||
/* set the pointers */
|
||||
icu::umtx_lock(NULL);
|
||||
if(mbcsTable->swapLFNLStateTable==NULL) {
|
||||
icu::umtx_lock(nullptr);
|
||||
if(mbcsTable->swapLFNLStateTable==nullptr) {
|
||||
mbcsTable->swapLFNLStateTable=newStateTable;
|
||||
mbcsTable->swapLFNLFromUnicodeBytes=(uint8_t *)newResults;
|
||||
mbcsTable->swapLFNLName=name;
|
||||
|
||||
newStateTable=NULL;
|
||||
newStateTable=nullptr;
|
||||
}
|
||||
icu::umtx_unlock(NULL);
|
||||
icu::umtx_unlock(nullptr);
|
||||
|
||||
/* release the allocated memory if another thread beat us to it */
|
||||
if(newStateTable!=NULL) {
|
||||
if(newStateTable!=nullptr) {
|
||||
uprv_free(newStateTable);
|
||||
}
|
||||
return true;
|
||||
|
@ -1489,7 +1489,7 @@ reconstituteData(UConverterMBCSTable *mbcsTable,
|
|||
uint32_t *stage2;
|
||||
uint32_t dataLength=stage1Length*2+fullStage2Length*4+mbcsTable->fromUBytesLength;
|
||||
mbcsTable->reconstitutedData=(uint8_t *)uprv_malloc(dataLength);
|
||||
if(mbcsTable->reconstitutedData==NULL) {
|
||||
if(mbcsTable->reconstitutedData==nullptr) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -1593,7 +1593,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
|
|||
const char *baseName;
|
||||
|
||||
/* extension-only file, load the base table and set values appropriately */
|
||||
if((extIndexes=mbcsTable->extIndexes)==NULL) {
|
||||
if((extIndexes=mbcsTable->extIndexes)==nullptr) {
|
||||
/* extension-only file without extension */
|
||||
*pErrorCode=U_INVALID_TABLE_FORMAT;
|
||||
return;
|
||||
|
@ -1626,7 +1626,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
|
|||
return;
|
||||
}
|
||||
if( baseSharedData->staticData->conversionType!=UCNV_MBCS ||
|
||||
baseSharedData->mbcs.baseSharedData!=NULL
|
||||
baseSharedData->mbcs.baseSharedData!=nullptr
|
||||
) {
|
||||
ucnv_unload(baseSharedData);
|
||||
*pErrorCode=U_INVALID_TABLE_FORMAT;
|
||||
|
@ -1657,15 +1657,15 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
|
|||
* It is easier to just create the data for the extension converter
|
||||
* separately when it is requested.
|
||||
*/
|
||||
mbcsTable->swapLFNLStateTable=NULL;
|
||||
mbcsTable->swapLFNLFromUnicodeBytes=NULL;
|
||||
mbcsTable->swapLFNLName=NULL;
|
||||
mbcsTable->swapLFNLStateTable=nullptr;
|
||||
mbcsTable->swapLFNLFromUnicodeBytes=nullptr;
|
||||
mbcsTable->swapLFNLName=nullptr;
|
||||
|
||||
/*
|
||||
* The reconstitutedData must be deleted only when the base converter
|
||||
* is unloaded.
|
||||
*/
|
||||
mbcsTable->reconstitutedData=NULL;
|
||||
mbcsTable->reconstitutedData=nullptr;
|
||||
|
||||
/*
|
||||
* Set a special, runtime-only outputType if the extension converter
|
||||
|
@ -1703,7 +1703,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
|
|||
/* allocate a new state table and copy the base state table contents */
|
||||
count=mbcsTable->countStates;
|
||||
newStateTable=(int32_t (*)[256])uprv_malloc((count+1)*1024);
|
||||
if(newStateTable==NULL) {
|
||||
if(newStateTable==nullptr) {
|
||||
ucnv_unload(baseSharedData);
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -1880,16 +1880,16 @@ static void U_CALLCONV
|
|||
ucnv_MBCSUnload(UConverterSharedData *sharedData) {
|
||||
UConverterMBCSTable *mbcsTable=&sharedData->mbcs;
|
||||
|
||||
if(mbcsTable->swapLFNLStateTable!=NULL) {
|
||||
if(mbcsTable->swapLFNLStateTable!=nullptr) {
|
||||
uprv_free(mbcsTable->swapLFNLStateTable);
|
||||
}
|
||||
if(mbcsTable->stateTableOwned) {
|
||||
uprv_free((void *)mbcsTable->stateTable);
|
||||
}
|
||||
if(mbcsTable->baseSharedData!=NULL) {
|
||||
if(mbcsTable->baseSharedData!=nullptr) {
|
||||
ucnv_unload(mbcsTable->baseSharedData);
|
||||
}
|
||||
if(mbcsTable->reconstitutedData!=NULL) {
|
||||
if(mbcsTable->reconstitutedData!=nullptr) {
|
||||
uprv_free(mbcsTable->reconstitutedData);
|
||||
}
|
||||
}
|
||||
|
@ -1919,9 +1919,9 @@ ucnv_MBCSOpen(UConverter *cnv,
|
|||
/* do this because double-checked locking is broken */
|
||||
UBool isCached;
|
||||
|
||||
icu::umtx_lock(NULL);
|
||||
isCached=mbcsTable->swapLFNLStateTable!=NULL;
|
||||
icu::umtx_unlock(NULL);
|
||||
icu::umtx_lock(nullptr);
|
||||
isCached=mbcsTable->swapLFNLStateTable!=nullptr;
|
||||
icu::umtx_unlock(nullptr);
|
||||
|
||||
if(!isCached) {
|
||||
if(!_EBCDICSwapLFNL(cnv->sharedData, pErrorCode)) {
|
||||
|
@ -1935,18 +1935,18 @@ ucnv_MBCSOpen(UConverter *cnv,
|
|||
}
|
||||
}
|
||||
|
||||
if(uprv_strstr(pArgs->name, "18030")!=NULL) {
|
||||
if(uprv_strstr(pArgs->name, "gb18030")!=NULL || uprv_strstr(pArgs->name, "GB18030")!=NULL) {
|
||||
if(uprv_strstr(pArgs->name, "18030")!=nullptr) {
|
||||
if(uprv_strstr(pArgs->name, "gb18030")!=nullptr || uprv_strstr(pArgs->name, "GB18030")!=nullptr) {
|
||||
/* set a flag for GB 18030 mode, which changes the callback behavior */
|
||||
cnv->options|=_MBCS_OPTION_GB18030;
|
||||
}
|
||||
} else if((uprv_strstr(pArgs->name, "KEIS")!=NULL) || (uprv_strstr(pArgs->name, "keis")!=NULL)) {
|
||||
} else if((uprv_strstr(pArgs->name, "KEIS")!=nullptr) || (uprv_strstr(pArgs->name, "keis")!=nullptr)) {
|
||||
/* set a flag for KEIS converter, which changes the SI/SO character sequence */
|
||||
cnv->options|=_MBCS_OPTION_KEIS;
|
||||
} else if((uprv_strstr(pArgs->name, "JEF")!=NULL) || (uprv_strstr(pArgs->name, "jef")!=NULL)) {
|
||||
} else if((uprv_strstr(pArgs->name, "JEF")!=nullptr) || (uprv_strstr(pArgs->name, "jef")!=nullptr)) {
|
||||
/* set a flag for JEF converter, which changes the SI/SO character sequence */
|
||||
cnv->options|=_MBCS_OPTION_JEF;
|
||||
} else if((uprv_strstr(pArgs->name, "JIPS")!=NULL) || (uprv_strstr(pArgs->name, "jips")!=NULL)) {
|
||||
} else if((uprv_strstr(pArgs->name, "JIPS")!=nullptr) || (uprv_strstr(pArgs->name, "jips")!=nullptr)) {
|
||||
/* set a flag for JIPS converter, which changes the SI/SO character sequence */
|
||||
cnv->options|=_MBCS_OPTION_JIPS;
|
||||
}
|
||||
|
@ -1957,7 +1957,7 @@ ucnv_MBCSOpen(UConverter *cnv,
|
|||
}
|
||||
|
||||
extIndexes=mbcsTable->extIndexes;
|
||||
if(extIndexes!=NULL) {
|
||||
if(extIndexes!=nullptr) {
|
||||
maxBytesPerUChar=(int8_t)UCNV_GET_MAX_BYTES_PER_UCHAR(extIndexes);
|
||||
if(outputType==MBCS_OUTPUT_2_SISO) {
|
||||
++maxBytesPerUChar; /* SO + multiple DBCS */
|
||||
|
@ -1989,7 +1989,7 @@ U_CDECL_BEGIN
|
|||
|
||||
static const char* U_CALLCONV
|
||||
ucnv_MBCSGetName(const UConverter *cnv) {
|
||||
if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=NULL) {
|
||||
if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=nullptr) {
|
||||
return cnv->sharedData->mbcs.swapLFNLName;
|
||||
} else {
|
||||
return cnv->sharedData->staticData->name;
|
||||
|
@ -2086,7 +2086,7 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
|
||||
/* output BMP code point */
|
||||
*target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
|
||||
|
@ -2106,13 +2106,13 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
entry=MBCS_ENTRY_FINAL_VALUE(entry);
|
||||
/* output surrogate pair */
|
||||
*target++=(UChar)(0xd800|(UChar)(entry>>10));
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
c=(UChar)(0xdc00|(UChar)(entry&0x3ff));
|
||||
if(target<targetLimit) {
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -2129,7 +2129,7 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
|
||||
/* output BMP code point */
|
||||
*target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
|
||||
|
@ -2277,7 +2277,7 @@ unrolled:
|
|||
count=loops-count;
|
||||
targetCapacity-=16*count;
|
||||
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
lastSource+=16*count;
|
||||
while(count>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
|
@ -2338,7 +2338,7 @@ unrolled:
|
|||
}
|
||||
|
||||
/* set offsets since the start or the last extension */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
int32_t count=(int32_t)(source-lastSource);
|
||||
|
||||
/* predecrement: do not set the offset for the callback-causing character */
|
||||
|
@ -2388,7 +2388,7 @@ unrolled:
|
|||
}
|
||||
|
||||
/* set offsets since the start or the last callback */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
size_t count=source-lastSource;
|
||||
while(count>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
|
@ -2558,7 +2558,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
|
||||
if(byteIndex==0) {
|
||||
/* optimized loop for 1/2-byte input and BMP output */
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
do {
|
||||
entry=stateTable[state][*source];
|
||||
if(MBCS_ENTRY_IS_TRANSITION(entry)) {
|
||||
|
@ -2593,7 +2593,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
}
|
||||
}
|
||||
} while(source<sourceLimit && target<targetLimit);
|
||||
} else /* offsets!=NULL */ {
|
||||
} else /* offsets!=nullptr */ {
|
||||
do {
|
||||
entry=stateTable[state][*source];
|
||||
if(MBCS_ENTRY_IS_TRANSITION(entry)) {
|
||||
|
@ -2608,7 +2608,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
) {
|
||||
++source;
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=(nextSourceIndex+=2);
|
||||
}
|
||||
|
@ -2626,7 +2626,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
/* output BMP code point */
|
||||
++source;
|
||||
*target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=++nextSourceIndex;
|
||||
}
|
||||
|
@ -2682,7 +2682,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(c<0xfffe) {
|
||||
/* output BMP code point */
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
|
@ -2690,7 +2690,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(UCNV_TO_U_USE_FALLBACK(cnv) && (entry=(int32_t)ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) {
|
||||
/* output fallback BMP code point */
|
||||
*target++=(UChar)entry;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
|
@ -2702,7 +2702,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
} else if(action==MBCS_STATE_VALID_DIRECT_16) {
|
||||
/* output BMP code point */
|
||||
*target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
|
@ -2712,20 +2712,20 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(c<0xd800) {
|
||||
/* output BMP code point below 0xd800 */
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
} else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
|
||||
/* output roundtrip or fallback surrogate pair */
|
||||
*target++=(UChar)(c&0xdbff);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
if(target<targetLimit) {
|
||||
*target++=unicodeCodeUnits[offset];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -2740,7 +2740,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
} else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
|
||||
/* output roundtrip BMP code point above 0xd800 or fallback BMP code point */
|
||||
*target++=unicodeCodeUnits[offset];
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
|
@ -2754,14 +2754,14 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
entry=MBCS_ENTRY_FINAL_VALUE(entry);
|
||||
/* output surrogate pair */
|
||||
*target++=(UChar)(0xd800|(UChar)(entry>>10));
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
c=(UChar)(0xdc00|(UChar)(entry&0x3ff));
|
||||
if(target<targetLimit) {
|
||||
*target++=c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -2794,7 +2794,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
|
|||
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
|
||||
/* output BMP code point */
|
||||
*target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
byteIndex=0;
|
||||
|
@ -3391,7 +3391,7 @@ ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData,
|
|||
if(c==0xfffe) {
|
||||
/* try an extension mapping */
|
||||
const int32_t *cx=sharedData->mbcs.extIndexes;
|
||||
if(cx!=NULL) {
|
||||
if(cx!=nullptr) {
|
||||
return ucnv_extSimpleMatchToU(cx, source, length, useFallback);
|
||||
}
|
||||
}
|
||||
|
@ -3475,7 +3475,7 @@ ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
++nextSourceIndex;
|
||||
if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) {
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
sourceIndex=nextSourceIndex;
|
||||
}
|
||||
|
@ -3585,7 +3585,7 @@ unassigned:
|
|||
if(value<=0xff) {
|
||||
/* this is easy because we know that there is enough space */
|
||||
*target++=(uint8_t)value;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -3593,13 +3593,13 @@ unassigned:
|
|||
*target++=(uint8_t)(value>>8);
|
||||
if(2<=targetCapacity) {
|
||||
*target++=(uint8_t)value;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
targetCapacity-=2;
|
||||
} else {
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
cnv->charErrorBuffer[0]=(char)value;
|
||||
|
@ -3750,7 +3750,7 @@ getTrail:
|
|||
/* length==1 */
|
||||
/* this is easy because we know that there is enough space */
|
||||
*target++=(uint8_t)value;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -3908,7 +3908,7 @@ unrolled:
|
|||
count=loops-count;
|
||||
targetCapacity-=4*count;
|
||||
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
lastSource+=4*count;
|
||||
while(count>0) {
|
||||
*offsets++=sourceIndex++;
|
||||
|
@ -3992,7 +3992,7 @@ getTrail:
|
|||
length=U16_LENGTH(c);
|
||||
|
||||
/* set offsets since the start or the last extension */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
int32_t count=(int32_t)(source-lastSource);
|
||||
|
||||
/* do not set the offset for this character */
|
||||
|
@ -4042,7 +4042,7 @@ getTrail:
|
|||
}
|
||||
|
||||
/* set offsets since the start or the last callback */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
size_t count=source-lastSource;
|
||||
if (count > 0 && *pErrorCode == U_TRUNCATED_CHAR_FOUND) {
|
||||
/*
|
||||
|
@ -4135,7 +4135,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
if(cnv->sharedData->mbcs.utf8Friendly) {
|
||||
mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
|
||||
} else {
|
||||
mbcsIndex=NULL;
|
||||
mbcsIndex=nullptr;
|
||||
}
|
||||
if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
|
||||
bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
|
||||
|
@ -4204,7 +4204,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
++nextSourceIndex;
|
||||
if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) {
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
prevSourceIndex=sourceIndex;
|
||||
sourceIndex=nextSourceIndex;
|
||||
|
@ -4218,7 +4218,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
|
|||
* to avoid dealing with surrogates.
|
||||
* MBCS_FAST_MAX must be >=0xd7ff.
|
||||
*/
|
||||
if(c<=0xd7ff && mbcsIndex!=NULL) {
|
||||
if(c<=0xd7ff && mbcsIndex!=nullptr) {
|
||||
value=mbcsIndex[c>>6];
|
||||
|
||||
/* get the bytes and the length for the output (copied from below and adapted for utf8Friendly data) */
|
||||
|
@ -4628,7 +4628,7 @@ unassigned:
|
|||
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
|
||||
|
||||
/* normal end of conversion: prepare for a new character */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
prevSourceIndex=sourceIndex;
|
||||
sourceIndex=nextSourceIndex;
|
||||
}
|
||||
|
@ -4640,7 +4640,7 @@ unassigned:
|
|||
/* write the output character bytes from value and length */
|
||||
/* from the first if in the loop we know that targetCapacity>0 */
|
||||
if(length<=targetCapacity) {
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
switch(length) {
|
||||
/* each branch falls through to the next one */
|
||||
case 4:
|
||||
|
@ -4719,19 +4719,19 @@ unassigned:
|
|||
/* each branch falls through to the next one */
|
||||
case 3:
|
||||
*target++=(uint8_t)(value>>16);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
U_FALLTHROUGH;
|
||||
case 2:
|
||||
*target++=(uint8_t)(value>>8);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
U_FALLTHROUGH;
|
||||
case 1:
|
||||
*target++=(uint8_t)value;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
U_FALLTHROUGH;
|
||||
|
@ -4749,7 +4749,7 @@ unassigned:
|
|||
|
||||
/* normal end of conversion: prepare for a new character */
|
||||
c=0;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
prevSourceIndex=sourceIndex;
|
||||
sourceIndex=nextSourceIndex;
|
||||
}
|
||||
|
@ -4787,7 +4787,7 @@ unassigned:
|
|||
*target++=(uint8_t)siBytes[1];
|
||||
}
|
||||
}
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
/* set the last source character's index (sourceIndex points at sourceLimit now) */
|
||||
*offsets++=prevSourceIndex;
|
||||
}
|
||||
|
@ -4961,7 +4961,7 @@ ucnv_MBCSFromUChar32(UConverterSharedData *sharedData,
|
|||
}
|
||||
|
||||
cx=sharedData->mbcs.extIndexes;
|
||||
if(cx!=NULL) {
|
||||
if(cx!=nullptr) {
|
||||
length=ucnv_extSimpleMatchFromU(cx, c, pValue, useFallback);
|
||||
return length>=0 ? length : -length; /* return abs(length); */
|
||||
}
|
||||
|
@ -5262,7 +5262,7 @@ moreBytes:
|
|||
c=_extFromU(cnv, cnv->sharedData,
|
||||
c, &noSource, noSource,
|
||||
&target, target+targetCapacity,
|
||||
NULL, -1,
|
||||
nullptr, -1,
|
||||
pFromUArgs->flush,
|
||||
pErrorCode);
|
||||
|
||||
|
@ -5565,7 +5565,7 @@ unassigned:
|
|||
c=_extFromU(cnv, cnv->sharedData,
|
||||
c, &noSource, noSource,
|
||||
&target, target+targetCapacity,
|
||||
NULL, -1,
|
||||
nullptr, -1,
|
||||
pFromUArgs->flush,
|
||||
pErrorCode);
|
||||
|
||||
|
@ -5658,7 +5658,7 @@ ucnv_MBCSWriteSub(UConverterFromUnicodeArgs *pArgs,
|
|||
|
||||
/* first, select between subChar and subChar1 */
|
||||
if( cnv->subChar1!=0 &&
|
||||
(cnv->sharedData->mbcs.extIndexes!=NULL ?
|
||||
(cnv->sharedData->mbcs.extIndexes!=nullptr ?
|
||||
cnv->useSubChar1 :
|
||||
(cnv->invalidUCharBuffer[0]<=0xff))
|
||||
) {
|
||||
|
|
|
@ -200,8 +200,8 @@ _SCSUOpen(UConverter *cnv,
|
|||
return;
|
||||
}
|
||||
cnv->extraInfo=uprv_malloc(sizeof(SCSUData));
|
||||
if(cnv->extraInfo!=NULL) {
|
||||
if(locale!=NULL && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
|
||||
if(cnv->extraInfo!=nullptr) {
|
||||
if(locale!=nullptr && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
|
||||
((SCSUData *)cnv->extraInfo)->locale=l_ja;
|
||||
} else {
|
||||
((SCSUData *)cnv->extraInfo)->locale=lGeneric;
|
||||
|
@ -218,11 +218,11 @@ _SCSUOpen(UConverter *cnv,
|
|||
|
||||
static void U_CALLCONV
|
||||
_SCSUClose(UConverter *cnv) {
|
||||
if(cnv->extraInfo!=NULL) {
|
||||
if(cnv->extraInfo!=nullptr) {
|
||||
if(!cnv->isExtraLocal) {
|
||||
uprv_free(cnv->extraInfo);
|
||||
}
|
||||
cnv->extraInfo=NULL;
|
||||
cnv->extraInfo=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ fastSingle:
|
|||
if(b<=0x7f) {
|
||||
/* write US-ASCII graphic character or DEL */
|
||||
*target++=(UChar)b;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -303,7 +303,7 @@ fastSingle:
|
|||
uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
|
||||
if(c<=0xffff) {
|
||||
*target++=(UChar)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -311,13 +311,13 @@ fastSingle:
|
|||
*target++=(UChar)(0xd7c0+(c>>10));
|
||||
if(target<targetLimit) {
|
||||
*target++=(UChar)(0xdc00|(c&0x3ff));
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
/* target overflow */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
|
||||
|
@ -348,7 +348,7 @@ singleByteMode:
|
|||
if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
|
||||
/* CR/LF/TAB/NUL */
|
||||
*target++=(UChar)b;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
sourceIndex=nextSourceIndex;
|
||||
|
@ -393,7 +393,7 @@ singleByteMode:
|
|||
break;
|
||||
case quotePairTwo:
|
||||
*target++=(UChar)((byteOne<<8)|b);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
sourceIndex=nextSourceIndex;
|
||||
|
@ -403,7 +403,7 @@ singleByteMode:
|
|||
if(b<0x80) {
|
||||
/* all static offsets are in the BMP */
|
||||
*target++=(UChar)(staticOffsets[quoteWindow]+b);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -411,7 +411,7 @@ singleByteMode:
|
|||
uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
|
||||
if(c<=0xffff) {
|
||||
*target++=(UChar)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
|
@ -419,13 +419,13 @@ singleByteMode:
|
|||
*target++=(UChar)(0xd7c0+(c>>10));
|
||||
if(target<targetLimit) {
|
||||
*target++=(UChar)(0xdc00|(c&0x3ff));
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
} else {
|
||||
/* target overflow */
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
|
||||
|
@ -479,7 +479,7 @@ singleByteMode:
|
|||
fastUnicode:
|
||||
while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
|
||||
*target++=(UChar)((b<<8)|source[1]);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
sourceIndex=nextSourceIndex;
|
||||
|
@ -543,7 +543,7 @@ fastUnicode:
|
|||
break;
|
||||
case quotePairTwo:
|
||||
*target++=(UChar)((byteOne<<8)|b);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
sourceIndex=nextSourceIndex;
|
||||
|
@ -1076,7 +1076,7 @@ loop:
|
|||
if((c-0x20)<=0x5f) {
|
||||
/* pass US-ASCII graphic character through */
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -1084,7 +1084,7 @@ loop:
|
|||
if((1UL<<c)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
|
||||
/* CR/LF/TAB/NUL */
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -1097,7 +1097,7 @@ loop:
|
|||
} else if((delta=c-currentOffset)<=0x7f) {
|
||||
/* use the current dynamic window */
|
||||
*target++=(uint8_t)(delta|0x80);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -1135,7 +1135,7 @@ getTrailSingle:
|
|||
if((delta=c-currentOffset)<=0x7f) {
|
||||
/* use the current dynamic window */
|
||||
*target++=(uint8_t)(delta|0x80);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -1161,7 +1161,7 @@ getTrailSingle:
|
|||
/* change to Unicode mode and output this (lead, trail) pair */
|
||||
isSingleByteMode=false;
|
||||
*target++=(uint8_t)SCU;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
--targetCapacity;
|
||||
|
@ -1255,7 +1255,7 @@ getTrailSingle:
|
|||
if(targetCapacity>=2) {
|
||||
*target++=(uint8_t)(c>>8);
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
|
@ -1392,7 +1392,7 @@ outputBytes:
|
|||
/* write the output character bytes from c and length [code copied from ucnvmbcs.c] */
|
||||
/* from the first if in the loop we know that targetCapacity>0 */
|
||||
if(length<=targetCapacity) {
|
||||
if(offsets==NULL) {
|
||||
if(offsets==nullptr) {
|
||||
switch(length) {
|
||||
/* each branch falls through to the next one */
|
||||
case 4:
|
||||
|
@ -1480,19 +1480,19 @@ outputBytes:
|
|||
/* each branch falls through to the next one */
|
||||
case 3:
|
||||
*target++=(uint8_t)(c>>16);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
U_FALLTHROUGH;
|
||||
case 2:
|
||||
*target++=(uint8_t)(c>>8);
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
U_FALLTHROUGH;
|
||||
case 1:
|
||||
*target++=(uint8_t)c;
|
||||
if(offsets!=NULL) {
|
||||
if(offsets!=nullptr) {
|
||||
*offsets++=sourceIndex;
|
||||
}
|
||||
U_FALLTHROUGH;
|
||||
|
@ -2000,8 +2000,8 @@ U_CDECL_END
|
|||
static const UConverterImpl _SCSUImpl={
|
||||
UCNV_SCSU,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
||||
_SCSUOpen,
|
||||
_SCSUClose,
|
||||
|
@ -2011,15 +2011,15 @@ static const UConverterImpl _SCSUImpl={
|
|||
_SCSUToUnicodeWithOffsets,
|
||||
_SCSUFromUnicode,
|
||||
_SCSUFromUnicodeWithOffsets,
|
||||
NULL,
|
||||
nullptr,
|
||||
|
||||
NULL,
|
||||
nullptr,
|
||||
_SCSUGetName,
|
||||
NULL,
|
||||
nullptr,
|
||||
_SCSUSafeClone,
|
||||
ucnv_getCompleteUnicodeSet,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
static const UConverterStaticData _SCSUStaticData={
|
||||
|
|
|
@ -104,7 +104,7 @@ static void generateSelectorData(UConverterSelector* result,
|
|||
UChar32 start_char;
|
||||
UChar32 end_char;
|
||||
UErrorCode smallStatus = U_ZERO_ERROR;
|
||||
uset_getItem(unicode_point_set, j, &start_char, &end_char, NULL, 0,
|
||||
uset_getItem(unicode_point_set, j, &start_char, &end_char, nullptr, 0,
|
||||
&smallStatus);
|
||||
if (U_FAILURE(smallStatus)) {
|
||||
// this will be reached for the converters that fill the set with
|
||||
|
@ -128,7 +128,7 @@ static void generateSelectorData(UConverterSelector* result,
|
|||
UChar32 start_char;
|
||||
UChar32 end_char;
|
||||
|
||||
uset_getItem(excludedCodePoints, j, &start_char, &end_char, NULL, 0,
|
||||
uset_getItem(excludedCodePoints, j, &start_char, &end_char, nullptr, 0,
|
||||
status);
|
||||
for (int32_t col = 0; col < columns; col++) {
|
||||
upvec_setValue(upvec, start_char, end_char, col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0),
|
||||
|
@ -140,25 +140,25 @@ static void generateSelectorData(UConverterSelector* result,
|
|||
// alright. Now, let's put things in the same exact form you'd get when you
|
||||
// unserialize things.
|
||||
result->trie = upvec_compactToUTrie2WithRowIndexes(upvec, status);
|
||||
result->pv = upvec_cloneArray(upvec, &result->pvCount, NULL, status);
|
||||
result->pv = upvec_cloneArray(upvec, &result->pvCount, nullptr, status);
|
||||
result->pvCount *= columns; // number of uint32_t = rows * columns
|
||||
result->ownPv = true;
|
||||
}
|
||||
|
||||
/* open a selector. If converterListSize is 0, build for all converters.
|
||||
If excludedCodePoints is NULL, don't exclude any codepoints */
|
||||
If excludedCodePoints is nullptr, don't exclude any codepoints */
|
||||
U_CAPI UConverterSelector* U_EXPORT2
|
||||
ucnvsel_open(const char* const* converterList, int32_t converterListSize,
|
||||
const USet* excludedCodePoints,
|
||||
const UConverterUnicodeSet whichSet, UErrorCode* status) {
|
||||
// check if already failed
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// ensure args make sense!
|
||||
if (converterListSize < 0 || (converterList == NULL && converterListSize != 0)) {
|
||||
if (converterListSize < 0 || (converterList == nullptr && converterListSize != 0)) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// allocate a new converter
|
||||
|
@ -166,28 +166,28 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
|
|||
(UConverterSelector*)uprv_malloc(sizeof(UConverterSelector)));
|
||||
if (newSelector.isNull()) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memset(newSelector.getAlias(), 0, sizeof(UConverterSelector));
|
||||
|
||||
if (converterListSize == 0) {
|
||||
converterList = NULL;
|
||||
converterList = nullptr;
|
||||
converterListSize = ucnv_countAvailable();
|
||||
}
|
||||
newSelector->encodings =
|
||||
(char**)uprv_malloc(converterListSize * sizeof(char*));
|
||||
if (!newSelector->encodings) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
newSelector->encodings[0] = NULL; // now we can call ucnvsel_close()
|
||||
newSelector->encodings[0] = nullptr; // now we can call ucnvsel_close()
|
||||
|
||||
// make a backup copy of the list of converters
|
||||
int32_t totalSize = 0;
|
||||
int32_t i;
|
||||
for (i = 0; i < converterListSize; i++) {
|
||||
totalSize +=
|
||||
(int32_t)uprv_strlen(converterList != NULL ? converterList[i] : ucnv_getAvailableName(i)) + 1;
|
||||
(int32_t)uprv_strlen(converterList != nullptr ? converterList[i] : ucnv_getAvailableName(i)) + 1;
|
||||
}
|
||||
// 4-align the totalSize to 4-align the size of the serialized form
|
||||
int32_t encodingStrPadding = totalSize & 3;
|
||||
|
@ -198,13 +198,13 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
|
|||
char* allStrings = (char*) uprv_malloc(totalSize);
|
||||
if (!allStrings) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (i = 0; i < converterListSize; i++) {
|
||||
newSelector->encodings[i] = allStrings;
|
||||
uprv_strcpy(newSelector->encodings[i],
|
||||
converterList != NULL ? converterList[i] : ucnv_getAvailableName(i));
|
||||
converterList != nullptr ? converterList[i] : ucnv_getAvailableName(i));
|
||||
allStrings += uprv_strlen(newSelector->encodings[i]) + 1;
|
||||
}
|
||||
while (encodingStrPadding > 0) {
|
||||
|
@ -219,7 +219,7 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
|
|||
upvec_close(upvec);
|
||||
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newSelector.orphan();
|
||||
|
@ -289,13 +289,13 @@ ucnvsel_serialize(const UConverterSelector* sel,
|
|||
// ensure args make sense!
|
||||
uint8_t *p = (uint8_t *)buffer;
|
||||
if (bufferCapacity < 0 ||
|
||||
(bufferCapacity > 0 && (p == NULL || (U_POINTER_MASK_LSB(p, 3) != 0)))
|
||||
(bufferCapacity > 0 && (p == nullptr || (U_POINTER_MASK_LSB(p, 3) != 0)))
|
||||
) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
// add up the size of the serialized form
|
||||
int32_t serializedTrieSize = utrie2_serialize(sel->trie, NULL, 0, status);
|
||||
int32_t serializedTrieSize = utrie2_serialize(sel->trie, nullptr, 0, status);
|
||||
if (*status != U_BUFFER_OVERFLOW_ERROR && U_FAILURE(*status)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -466,21 +466,21 @@ U_CAPI UConverterSelector* U_EXPORT2
|
|||
ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status) {
|
||||
// check if already failed
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// ensure args make sense!
|
||||
const uint8_t *p = (const uint8_t *)buffer;
|
||||
if (length <= 0 ||
|
||||
(length > 0 && (p == NULL || (U_POINTER_MASK_LSB(p, 3) != 0)))
|
||||
(length > 0 && (p == nullptr || (U_POINTER_MASK_LSB(p, 3) != 0)))
|
||||
) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// header
|
||||
if (length < 32) {
|
||||
// not even enough space for a minimal header
|
||||
*status = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
const DataHeader *pHeader = (const DataHeader *)p;
|
||||
if (!(
|
||||
|
@ -493,40 +493,40 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
|
|||
)) {
|
||||
/* header not valid or dataFormat not recognized */
|
||||
*status = U_INVALID_FORMAT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (pHeader->info.formatVersion[0] != 1) {
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uint8_t* swapped = NULL;
|
||||
uint8_t* swapped = nullptr;
|
||||
if (pHeader->info.isBigEndian != U_IS_BIG_ENDIAN ||
|
||||
pHeader->info.charsetFamily != U_CHARSET_FAMILY
|
||||
) {
|
||||
// swap the data
|
||||
UDataSwapper *ds =
|
||||
udata_openSwapperForInputData(p, length, U_IS_BIG_ENDIAN, U_CHARSET_FAMILY, status);
|
||||
int32_t totalSize = ucnvsel_swap(ds, p, -1, NULL, status);
|
||||
int32_t totalSize = ucnvsel_swap(ds, p, -1, nullptr, status);
|
||||
if (U_FAILURE(*status)) {
|
||||
udata_closeSwapper(ds);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (length < totalSize) {
|
||||
udata_closeSwapper(ds);
|
||||
*status = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
swapped = (uint8_t*)uprv_malloc(totalSize);
|
||||
if (swapped == NULL) {
|
||||
if (swapped == nullptr) {
|
||||
udata_closeSwapper(ds);
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
ucnvsel_swap(ds, p, length, swapped, status);
|
||||
udata_closeSwapper(ds);
|
||||
if (U_FAILURE(*status)) {
|
||||
uprv_free(swapped);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
p = swapped;
|
||||
pHeader = (const DataHeader *)p;
|
||||
|
@ -535,7 +535,7 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
|
|||
// not even enough space for the header and the indexes
|
||||
uprv_free(swapped);
|
||||
*status = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
p += pHeader->dataHeader.headerSize;
|
||||
length -= pHeader->dataHeader.headerSize;
|
||||
|
@ -544,7 +544,7 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
|
|||
if (length < indexes[UCNVSEL_INDEX_SIZE]) {
|
||||
uprv_free(swapped);
|
||||
*status = U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
p += UCNVSEL_INDEX_COUNT * 4;
|
||||
// create and populate the selector object
|
||||
|
@ -552,12 +552,12 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
|
|||
char **encodings =
|
||||
(char **)uprv_malloc(
|
||||
indexes[UCNVSEL_INDEX_NAMES_COUNT] * sizeof(char *));
|
||||
if (sel == NULL || encodings == NULL) {
|
||||
if (sel == nullptr || encodings == nullptr) {
|
||||
uprv_free(swapped);
|
||||
uprv_free(sel);
|
||||
uprv_free(encodings);
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memset(sel, 0, sizeof(UConverterSelector));
|
||||
sel->pvCount = indexes[UCNVSEL_INDEX_PV_COUNT];
|
||||
|
@ -567,12 +567,12 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
|
|||
sel->swapped = swapped;
|
||||
// trie
|
||||
sel->trie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
|
||||
p, indexes[UCNVSEL_INDEX_TRIE_SIZE], NULL,
|
||||
p, indexes[UCNVSEL_INDEX_TRIE_SIZE], nullptr,
|
||||
status);
|
||||
p += indexes[UCNVSEL_INDEX_TRIE_SIZE];
|
||||
if (U_FAILURE(*status)) {
|
||||
ucnvsel_close(sel);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// bit vectors
|
||||
sel->pv = (uint32_t *)p;
|
||||
|
@ -622,14 +622,14 @@ static const char* U_CALLCONV ucnvsel_next_encoding(UEnumeration* enumerator,
|
|||
UErrorCode* status) {
|
||||
// check if already failed
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int16_t cur = ((Enumerator*)(enumerator->context))->cur;
|
||||
const UConverterSelector* sel;
|
||||
const char* result;
|
||||
if (cur >= ((Enumerator*)(enumerator->context))->length) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
sel = ((Enumerator*)(enumerator->context))->sel;
|
||||
result = sel->encodings[((Enumerator*)(enumerator->context))->index[cur] ];
|
||||
|
@ -653,8 +653,8 @@ U_CDECL_END
|
|||
|
||||
|
||||
static const UEnumeration defaultEncodings = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucnvsel_close_selector_iterator,
|
||||
ucnvsel_count_encodings,
|
||||
uenum_unextDefault,
|
||||
|
@ -732,7 +732,7 @@ static UEnumeration *selectForMask(const UConverterSelector* sel,
|
|||
v >>= 1;
|
||||
}
|
||||
}
|
||||
} //otherwise, index will remain NULL (and will never be touched by
|
||||
} //otherwise, index will remain nullptr (and will never be touched by
|
||||
//the enumerator code anyway)
|
||||
en->context = result.orphan();
|
||||
return en.orphan();
|
||||
|
@ -744,31 +744,31 @@ ucnvsel_selectForString(const UConverterSelector* sel,
|
|||
const UChar *s, int32_t length, UErrorCode *status) {
|
||||
// check if already failed
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// ensure args make sense!
|
||||
if (sel == NULL || (s == NULL && length != 0)) {
|
||||
if (sel == nullptr || (s == nullptr && length != 0)) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t columns = (sel->encodingsCount+31)/32;
|
||||
uint32_t* mask = (uint32_t*) uprv_malloc(columns * 4);
|
||||
if (mask == NULL) {
|
||||
if (mask == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memset(mask, ~0, columns *4);
|
||||
|
||||
if(s!=NULL) {
|
||||
if(s!=nullptr) {
|
||||
const UChar *limit;
|
||||
if (length >= 0) {
|
||||
limit = s + length;
|
||||
} else {
|
||||
limit = NULL;
|
||||
limit = nullptr;
|
||||
}
|
||||
|
||||
while (limit == NULL ? *s != 0 : s != limit) {
|
||||
while (limit == nullptr ? *s != 0 : s != limit) {
|
||||
UChar32 c;
|
||||
uint16_t pvIndex;
|
||||
UTRIE2_U16_NEXT16(sel->trie, s, limit, c, pvIndex);
|
||||
|
@ -786,19 +786,19 @@ ucnvsel_selectForUTF8(const UConverterSelector* sel,
|
|||
const char *s, int32_t length, UErrorCode *status) {
|
||||
// check if already failed
|
||||
if (U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// ensure args make sense!
|
||||
if (sel == NULL || (s == NULL && length != 0)) {
|
||||
if (sel == nullptr || (s == nullptr && length != 0)) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t columns = (sel->encodingsCount+31)/32;
|
||||
uint32_t* mask = (uint32_t*) uprv_malloc(columns * 4);
|
||||
if (mask == NULL) {
|
||||
if (mask == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memset(mask, ~0, columns *4);
|
||||
|
||||
|
@ -806,7 +806,7 @@ ucnvsel_selectForUTF8(const UConverterSelector* sel,
|
|||
length = (int32_t)uprv_strlen(s);
|
||||
}
|
||||
|
||||
if(s!=NULL) {
|
||||
if(s!=nullptr) {
|
||||
const char *limit = s + length;
|
||||
|
||||
while (s != limit) {
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
U_CAPI UBool U_EXPORT2
|
||||
ucol_looksLikeCollationBinary(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length) {
|
||||
if(ds==NULL || inData==NULL || length<-1) {
|
||||
if(ds==nullptr || inData==nullptr || length<-1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// First check for format version 4+ which has a standard data header.
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
(void)udata_swapDataHeader(ds, inData, -1, NULL, &errorCode);
|
||||
(void)udata_swapDataHeader(ds, inData, -1, nullptr, &errorCode);
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
const UDataInfo &info=*(const UDataInfo *)((const char *)inData+4);
|
||||
if(info.dataFormat[0]==0x55 && // dataFormat="UCol"
|
||||
|
@ -103,7 +103,7 @@ swapFormatVersion3(const UDataSwapper *ds,
|
|||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
|
||||
if(ds==nullptr || inData==nullptr || length<-1 || (length>0 && outData==nullptr)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ swapFormatVersion4(const UDataSwapper *ds,
|
|||
for(int32_t i=indexesLength; i<=IX_TOTAL_SIZE; ++i) {
|
||||
indexes[i]=-1;
|
||||
}
|
||||
inIndexes=NULL; // Make sure we do not accidentally use these instead of indexes[].
|
||||
inIndexes=nullptr; // Make sure we do not accidentally use these instead of indexes[].
|
||||
|
||||
// Get the total length of the data.
|
||||
int32_t size;
|
||||
|
@ -537,7 +537,7 @@ ucol_swapInverseUCA(const UDataSwapper *ds,
|
|||
|
||||
/* udata_swapDataHeader checks the arguments */
|
||||
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,11 +96,11 @@ static const char CURRENCIES_VARIANT[] = "Currencies%variant";
|
|||
static const char CURRENCYPLURALS[] = "CurrencyPlurals";
|
||||
|
||||
// ISO codes mapping table
|
||||
static const UHashtable* gIsoCodes = NULL;
|
||||
static const UHashtable* gIsoCodes = nullptr;
|
||||
static icu::UInitOnce gIsoCodesInitOnce {};
|
||||
|
||||
// Currency symbol equivalances
|
||||
static const icu::Hashtable* gCurrSymbolsEquiv = NULL;
|
||||
static const icu::Hashtable* gCurrSymbolsEquiv = nullptr;
|
||||
static icu::UInitOnce gCurrSymbolsEquivInitOnce {};
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
@ -117,8 +117,8 @@ public:
|
|||
}
|
||||
inline ~EquivIterator() { }
|
||||
|
||||
// next returns the next equivalent string or NULL if there are no more.
|
||||
// If s has no equivalent strings, next returns NULL on the first call.
|
||||
// next returns the next equivalent string or nullptr if there are no more.
|
||||
// If s has no equivalent strings, next returns nullptr on the first call.
|
||||
const icu::UnicodeString *next();
|
||||
private:
|
||||
const icu::Hashtable& _hash;
|
||||
|
@ -129,12 +129,12 @@ private:
|
|||
const icu::UnicodeString *
|
||||
EquivIterator::next() {
|
||||
const icu::UnicodeString* _next = (const icu::UnicodeString*) _hash.get(*_current);
|
||||
if (_next == NULL) {
|
||||
if (_next == nullptr) {
|
||||
U_ASSERT(_current == _start);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (*_next == *_start) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
_current = _next;
|
||||
return _next;
|
||||
|
@ -161,7 +161,7 @@ static void makeEquivalent(
|
|||
const icu::UnicodeString *firstRight = rightIter.next();
|
||||
const icu::UnicodeString *nextLeft = firstLeft;
|
||||
const icu::UnicodeString *nextRight = firstRight;
|
||||
while (nextLeft != NULL && nextRight != NULL) {
|
||||
while (nextLeft != nullptr && nextRight != nullptr) {
|
||||
if (*nextLeft == rhs || *nextRight == lhs) {
|
||||
// Already equivalent
|
||||
return;
|
||||
|
@ -172,17 +172,17 @@ static void makeEquivalent(
|
|||
// Not equivalent. Must join.
|
||||
icu::UnicodeString *newFirstLeft;
|
||||
icu::UnicodeString *newFirstRight;
|
||||
if (firstRight == NULL && firstLeft == NULL) {
|
||||
if (firstRight == nullptr && firstLeft == nullptr) {
|
||||
// Neither lhs or rhs belong to an equivalence circle, so we form
|
||||
// a new equivalnce circle of just lhs and rhs.
|
||||
newFirstLeft = new icu::UnicodeString(rhs);
|
||||
newFirstRight = new icu::UnicodeString(lhs);
|
||||
} else if (firstRight == NULL) {
|
||||
} else if (firstRight == nullptr) {
|
||||
// lhs belongs to an equivalence circle, but rhs does not, so we link
|
||||
// rhs into lhs' circle.
|
||||
newFirstLeft = new icu::UnicodeString(rhs);
|
||||
newFirstRight = new icu::UnicodeString(*firstLeft);
|
||||
} else if (firstLeft == NULL) {
|
||||
} else if (firstLeft == nullptr) {
|
||||
// rhs belongs to an equivlance circle, but lhs does not, so we link
|
||||
// lhs into rhs' circle.
|
||||
newFirstLeft = new icu::UnicodeString(*firstRight);
|
||||
|
@ -193,7 +193,7 @@ static void makeEquivalent(
|
|||
newFirstLeft = new icu::UnicodeString(*firstRight);
|
||||
newFirstRight = new icu::UnicodeString(*firstLeft);
|
||||
}
|
||||
if (newFirstLeft == NULL || newFirstRight == NULL) {
|
||||
if (newFirstLeft == nullptr || newFirstRight == nullptr) {
|
||||
delete newFirstLeft;
|
||||
delete newFirstRight;
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
|
@ -209,7 +209,7 @@ static void makeEquivalent(
|
|||
static int32_t countEquivalent(const icu::Hashtable &hash, const icu::UnicodeString &s) {
|
||||
int32_t result = 0;
|
||||
icu::EquivIterator iter(hash, s);
|
||||
while (iter.next() != NULL) {
|
||||
while (iter.next() != nullptr) {
|
||||
++result;
|
||||
}
|
||||
#ifdef UCURR_DEBUG_EQUIV
|
||||
|
@ -233,9 +233,9 @@ static const icu::Hashtable* getCurrSymbolsEquiv();
|
|||
static UBool U_CALLCONV
|
||||
isoCodes_cleanup(void)
|
||||
{
|
||||
if (gIsoCodes != NULL) {
|
||||
if (gIsoCodes != nullptr) {
|
||||
uhash_close(const_cast<UHashtable *>(gIsoCodes));
|
||||
gIsoCodes = NULL;
|
||||
gIsoCodes = nullptr;
|
||||
}
|
||||
gIsoCodesInitOnce.reset();
|
||||
return true;
|
||||
|
@ -248,7 +248,7 @@ static UBool U_CALLCONV
|
|||
currSymbolsEquiv_cleanup(void)
|
||||
{
|
||||
delete const_cast<icu::Hashtable *>(gCurrSymbolsEquiv);
|
||||
gCurrSymbolsEquiv = NULL;
|
||||
gCurrSymbolsEquiv = nullptr;
|
||||
gCurrSymbolsEquivInitOnce.reset();
|
||||
return true;
|
||||
}
|
||||
|
@ -315,10 +315,10 @@ _findMetaData(const UChar* currency, UErrorCode& ec) {
|
|||
// Look up our currency, or if that's not available, then DEFAULT
|
||||
char buf[ISO_CURRENCY_CODE_LENGTH+1];
|
||||
UErrorCode ec2 = U_ZERO_ERROR; // local error code: soft failure
|
||||
UResourceBundle* rb = ures_getByKey(currencyMeta, myUCharsToChars(buf, currency), NULL, &ec2);
|
||||
UResourceBundle* rb = ures_getByKey(currencyMeta, myUCharsToChars(buf, currency), nullptr, &ec2);
|
||||
if (U_FAILURE(ec2)) {
|
||||
ures_close(rb);
|
||||
rb = ures_getByKey(currencyMeta,DEFAULT_META, NULL, &ec);
|
||||
rb = ures_getByKey(currencyMeta,DEFAULT_META, nullptr, &ec);
|
||||
if (U_FAILURE(ec)) {
|
||||
ures_close(currencyMeta);
|
||||
ures_close(rb);
|
||||
|
@ -428,7 +428,7 @@ struct CReg : public icu::UMemory {
|
|||
}
|
||||
|
||||
static const UChar* get(const char* id) {
|
||||
const UChar* result = NULL;
|
||||
const UChar* result = nullptr;
|
||||
umtx_lock(&gCRegLock);
|
||||
CReg* p = gCRegHead;
|
||||
|
||||
|
@ -465,7 +465,7 @@ ucurr_register(const UChar* isoCode, const char* locale, UErrorCode *status)
|
|||
idForLocale(locale, id, sizeof(id), status);
|
||||
return CReg::reg(isoCode, id, status);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// -------------------------------------
|
||||
|
@ -555,7 +555,7 @@ ucurr_forLocale(const char* locale,
|
|||
idDelim[0] = 0;
|
||||
}
|
||||
|
||||
const UChar* s = NULL; // Currency code from data file.
|
||||
const UChar* s = nullptr; // Currency code from data file.
|
||||
if (id[0] == 0) {
|
||||
// No point looking in the data for an empty string.
|
||||
// This is what we would get.
|
||||
|
@ -641,7 +641,7 @@ static UBool fallback(char *loc) {
|
|||
}
|
||||
/*
|
||||
char *i = uprv_strrchr(loc, '_');
|
||||
if (i == NULL) {
|
||||
if (i == nullptr) {
|
||||
i = loc;
|
||||
}
|
||||
*i = 0;
|
||||
|
@ -705,7 +705,7 @@ ucurr_getName(const UChar* currency,
|
|||
/* Normalize the keyword value to uppercase */
|
||||
T_CString_toUpperCase(buf);
|
||||
|
||||
const UChar* s = NULL;
|
||||
const UChar* s = nullptr;
|
||||
ec2 = U_ZERO_ERROR;
|
||||
LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2));
|
||||
|
||||
|
@ -734,7 +734,7 @@ ucurr_getName(const UChar* currency,
|
|||
choice = UCURR_SYMBOL_NAME;
|
||||
}
|
||||
}
|
||||
if (s == NULL) {
|
||||
if (s == nullptr) {
|
||||
ures_getByKey(rb.getAlias(), CURRENCIES, rb.getAlias(), &ec2);
|
||||
ures_getByKeyWithFallback(rb.getAlias(), buf, rb.getAlias(), &ec2);
|
||||
s = ures_getStringByIndex(rb.getAlias(), choice, len, &ec2);
|
||||
|
@ -751,11 +751,11 @@ ucurr_getName(const UChar* currency,
|
|||
|
||||
// We no longer support choice format data in names. Data should not contain
|
||||
// choice patterns.
|
||||
if (isChoiceFormat != NULL) {
|
||||
if (isChoiceFormat != nullptr) {
|
||||
*isChoiceFormat = false;
|
||||
}
|
||||
if (U_SUCCESS(ec2)) {
|
||||
U_ASSERT(s != NULL);
|
||||
U_ASSERT(s != nullptr);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -801,7 +801,7 @@ ucurr_getPluralName(const UChar* currency,
|
|||
char buf[ISO_CURRENCY_CODE_LENGTH+1];
|
||||
myUCharsToChars(buf, currency);
|
||||
|
||||
const UChar* s = NULL;
|
||||
const UChar* s = nullptr;
|
||||
ec2 = U_ZERO_ERROR;
|
||||
UResourceBundle* rb = ures_open(U_ICUDATA_CURR, loc, &ec2);
|
||||
|
||||
|
@ -831,7 +831,7 @@ ucurr_getPluralName(const UChar* currency,
|
|||
|| (ec2 == U_USING_FALLBACK_WARNING && *ec != U_USING_DEFAULT_WARNING)) {
|
||||
*ec = ec2;
|
||||
}
|
||||
U_ASSERT(s != NULL);
|
||||
U_ASSERT(s != nullptr);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -903,7 +903,7 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
|
|||
U_NAMESPACE_USE
|
||||
*total_currency_name_count = 0;
|
||||
*total_currency_symbol_count = 0;
|
||||
const UChar* s = NULL;
|
||||
const UChar* s = nullptr;
|
||||
char locale[ULOC_FULLNAME_CAPACITY] = "";
|
||||
uprv_strcpy(locale, loc);
|
||||
const icu::Hashtable *currencySymbolsEquiv = getCurrSymbolsEquiv();
|
||||
|
@ -911,14 +911,14 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
|
|||
UErrorCode ec2 = U_ZERO_ERROR;
|
||||
// TODO: ures_openDirect?
|
||||
UResourceBundle* rb = ures_open(U_ICUDATA_CURR, locale, &ec2);
|
||||
UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, NULL, &ec2);
|
||||
UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, nullptr, &ec2);
|
||||
int32_t n = ures_getSize(curr);
|
||||
for (int32_t i=0; i<n; ++i) {
|
||||
UResourceBundle* names = ures_getByIndex(curr, i, NULL, &ec2);
|
||||
UResourceBundle* names = ures_getByIndex(curr, i, nullptr, &ec2);
|
||||
int32_t len;
|
||||
s = ures_getStringByIndex(names, UCURR_SYMBOL_NAME, &len, &ec2);
|
||||
++(*total_currency_symbol_count); // currency symbol
|
||||
if (currencySymbolsEquiv != NULL) {
|
||||
if (currencySymbolsEquiv != nullptr) {
|
||||
*total_currency_symbol_count += countEquivalent(*currencySymbolsEquiv, UnicodeString(true, s, len));
|
||||
}
|
||||
++(*total_currency_symbol_count); // iso code
|
||||
|
@ -928,10 +928,10 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
|
|||
|
||||
// currency plurals
|
||||
UErrorCode ec3 = U_ZERO_ERROR;
|
||||
UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec3);
|
||||
UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, nullptr, &ec3);
|
||||
n = ures_getSize(curr_p);
|
||||
for (int32_t i=0; i<n; ++i) {
|
||||
UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec3);
|
||||
UResourceBundle* names = ures_getByIndex(curr_p, i, nullptr, &ec3);
|
||||
*total_currency_name_count += ures_getSize(names);
|
||||
ures_close(names);
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
|
|||
|
||||
static UChar*
|
||||
toUpperCase(const UChar* source, int32_t len, const char* locale) {
|
||||
UChar* dest = NULL;
|
||||
UChar* dest = nullptr;
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
int32_t destLen = u_strToUpper(dest, 0, source, len, locale, &ec);
|
||||
|
||||
|
@ -993,14 +993,14 @@ collectCurrencyNames(const char* locale,
|
|||
*currencySymbols = (CurrencyNameStruct*)uprv_malloc
|
||||
(sizeof(CurrencyNameStruct) * (*total_currency_symbol_count));
|
||||
|
||||
if(currencyNames == NULL || currencySymbols == NULL) {
|
||||
if(currencyNames == nullptr || currencySymbols == nullptr) {
|
||||
ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
|
||||
if (U_FAILURE(ec)) return;
|
||||
|
||||
const UChar* s = NULL; // currency name
|
||||
char* iso = NULL; // currency ISO code
|
||||
const UChar* s = nullptr; // currency name
|
||||
char* iso = nullptr; // currency ISO code
|
||||
|
||||
*total_currency_name_count = 0;
|
||||
*total_currency_symbol_count = 0;
|
||||
|
@ -1009,16 +1009,16 @@ collectCurrencyNames(const char* locale,
|
|||
UErrorCode ec4 = U_ZERO_ERROR;
|
||||
|
||||
// Using hash to remove duplicates caused by locale fallback
|
||||
UHashtable* currencyIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &ec3);
|
||||
UHashtable* currencyPluralIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &ec4);
|
||||
UHashtable* currencyIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &ec3);
|
||||
UHashtable* currencyPluralIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &ec4);
|
||||
for (int32_t localeLevel = 0; ; ++localeLevel) {
|
||||
ec2 = U_ZERO_ERROR;
|
||||
// TODO: ures_openDirect
|
||||
UResourceBundle* rb = ures_open(U_ICUDATA_CURR, loc, &ec2);
|
||||
UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, NULL, &ec2);
|
||||
UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, nullptr, &ec2);
|
||||
int32_t n = ures_getSize(curr);
|
||||
for (int32_t i=0; i<n; ++i) {
|
||||
UResourceBundle* names = ures_getByIndex(curr, i, NULL, &ec2);
|
||||
UResourceBundle* names = ures_getByIndex(curr, i, nullptr, &ec2);
|
||||
int32_t len;
|
||||
s = ures_getStringByIndex(names, UCURR_SYMBOL_NAME, &len, &ec2);
|
||||
// TODO: uhash_put wont change key/value?
|
||||
|
@ -1026,7 +1026,7 @@ collectCurrencyNames(const char* locale,
|
|||
if (localeLevel == 0) {
|
||||
uhash_put(currencyIsoCodes, iso, iso, &ec3);
|
||||
} else {
|
||||
if (uhash_get(currencyIsoCodes, iso) != NULL) {
|
||||
if (uhash_get(currencyIsoCodes, iso) != nullptr) {
|
||||
ures_close(names);
|
||||
continue;
|
||||
} else {
|
||||
|
@ -1039,11 +1039,11 @@ collectCurrencyNames(const char* locale,
|
|||
(*currencySymbols)[*total_currency_symbol_count].flag = 0;
|
||||
(*currencySymbols)[(*total_currency_symbol_count)++].currencyNameLen = len;
|
||||
// Add equivalent symbols
|
||||
if (currencySymbolsEquiv != NULL) {
|
||||
if (currencySymbolsEquiv != nullptr) {
|
||||
UnicodeString str(true, s, len);
|
||||
icu::EquivIterator iter(*currencySymbolsEquiv, str);
|
||||
const UnicodeString *symbol;
|
||||
while ((symbol = iter.next()) != NULL) {
|
||||
while ((symbol = iter.next()) != nullptr) {
|
||||
(*currencySymbols)[*total_currency_symbol_count].IsoCode = iso;
|
||||
(*currencySymbols)[*total_currency_symbol_count].currencyName =
|
||||
const_cast<UChar*>(symbol->getBuffer());
|
||||
|
@ -1074,16 +1074,16 @@ collectCurrencyNames(const char* locale,
|
|||
|
||||
// currency plurals
|
||||
UErrorCode ec5 = U_ZERO_ERROR;
|
||||
UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec5);
|
||||
UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, nullptr, &ec5);
|
||||
n = ures_getSize(curr_p);
|
||||
for (int32_t i=0; i<n; ++i) {
|
||||
UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec5);
|
||||
UResourceBundle* names = ures_getByIndex(curr_p, i, nullptr, &ec5);
|
||||
iso = (char*)ures_getKey(names);
|
||||
// Using hash to remove duplicated ISO codes in fallback chain.
|
||||
if (localeLevel == 0) {
|
||||
uhash_put(currencyPluralIsoCodes, iso, iso, &ec4);
|
||||
} else {
|
||||
if (uhash_get(currencyPluralIsoCodes, iso) != NULL) {
|
||||
if (uhash_get(currencyPluralIsoCodes, iso) != nullptr) {
|
||||
ures_close(names);
|
||||
continue;
|
||||
} else {
|
||||
|
@ -1388,7 +1388,7 @@ typedef struct {
|
|||
#define CURRENCY_NAME_CACHE_NUM 10
|
||||
|
||||
// Reserve 10 cache entries.
|
||||
static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {NULL};
|
||||
static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {nullptr};
|
||||
// Using an index to indicate which entry to be replaced when cache is full.
|
||||
// It is a simple round-robin replacement strategy.
|
||||
static int8_t currentCacheEntryIndex = 0;
|
||||
|
@ -1437,17 +1437,17 @@ static CurrencyNameCacheEntry*
|
|||
getCacheEntry(const char* locale, UErrorCode& ec) {
|
||||
|
||||
int32_t total_currency_name_count = 0;
|
||||
CurrencyNameStruct* currencyNames = NULL;
|
||||
CurrencyNameStruct* currencyNames = nullptr;
|
||||
int32_t total_currency_symbol_count = 0;
|
||||
CurrencyNameStruct* currencySymbols = NULL;
|
||||
CurrencyNameCacheEntry* cacheEntry = NULL;
|
||||
CurrencyNameStruct* currencySymbols = nullptr;
|
||||
CurrencyNameCacheEntry* cacheEntry = nullptr;
|
||||
|
||||
umtx_lock(&gCurrencyCacheMutex);
|
||||
// in order to handle racing correctly,
|
||||
// not putting 'search' in a separate function.
|
||||
int8_t found = -1;
|
||||
for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
|
||||
if (currCache[i]!= NULL &&
|
||||
if (currCache[i]!= nullptr &&
|
||||
uprv_strcmp(locale, currCache[i]->locale) == 0) {
|
||||
found = i;
|
||||
break;
|
||||
|
@ -1461,12 +1461,12 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
|
|||
if (found == -1) {
|
||||
collectCurrencyNames(locale, ¤cyNames, &total_currency_name_count, ¤cySymbols, &total_currency_symbol_count, ec);
|
||||
if (U_FAILURE(ec)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
umtx_lock(&gCurrencyCacheMutex);
|
||||
// check again.
|
||||
for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
|
||||
if (currCache[i]!= NULL &&
|
||||
if (currCache[i]!= nullptr &&
|
||||
uprv_strcmp(locale, currCache[i]->locale) == 0) {
|
||||
found = i;
|
||||
break;
|
||||
|
@ -2032,7 +2032,7 @@ static const struct CurrencyList {
|
|||
{"ZWD", UCURR_COMMON|UCURR_DEPRECATED},
|
||||
{"ZWL", UCURR_COMMON|UCURR_DEPRECATED},
|
||||
{"ZWR", UCURR_COMMON|UCURR_DEPRECATED},
|
||||
{ NULL, 0 } // Leave here to denote the end of the list.
|
||||
{ nullptr, 0 } // Leave here to denote the end of the list.
|
||||
};
|
||||
|
||||
#define UCURR_MATCHES_BITMASK(variable, typeToMatch) \
|
||||
|
@ -2045,7 +2045,7 @@ ucurr_countCurrencyList(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) {
|
|||
int32_t count = 0;
|
||||
|
||||
/* Count the number of items matching the type we are looking for. */
|
||||
for (int32_t idx = 0; gCurrencyList[idx].currency != NULL; idx++) {
|
||||
for (int32_t idx = 0; gCurrencyList[idx].currency != nullptr; idx++) {
|
||||
if (UCURR_MATCHES_BITMASK(gCurrencyList[idx].currType, currType)) {
|
||||
count++;
|
||||
}
|
||||
|
@ -2075,7 +2075,7 @@ ucurr_nextCurrencyList(UEnumeration *enumerator,
|
|||
if (resultLength) {
|
||||
*resultLength = 0;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
|
@ -2101,29 +2101,29 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
|
|||
// process each entry in currency map
|
||||
for (int32_t i=0; i<ures_getSize(currencyMapArray); i++) {
|
||||
// get the currency resource
|
||||
UResourceBundle *currencyArray = ures_getByIndex(currencyMapArray, i, NULL, &localStatus);
|
||||
UResourceBundle *currencyArray = ures_getByIndex(currencyMapArray, i, nullptr, &localStatus);
|
||||
// process each currency
|
||||
if (U_SUCCESS(localStatus)) {
|
||||
for (int32_t j=0; j<ures_getSize(currencyArray); j++) {
|
||||
// get the currency resource
|
||||
UResourceBundle *currencyRes = ures_getByIndex(currencyArray, j, NULL, &localStatus);
|
||||
UResourceBundle *currencyRes = ures_getByIndex(currencyArray, j, nullptr, &localStatus);
|
||||
IsoCodeEntry *entry = (IsoCodeEntry*)uprv_malloc(sizeof(IsoCodeEntry));
|
||||
if (entry == NULL) {
|
||||
if (entry == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
// get the ISO code
|
||||
int32_t isoLength = 0;
|
||||
UResourceBundle *idRes = ures_getByKey(currencyRes, "id", NULL, &localStatus);
|
||||
if (idRes == NULL) {
|
||||
UResourceBundle *idRes = ures_getByKey(currencyRes, "id", nullptr, &localStatus);
|
||||
if (idRes == nullptr) {
|
||||
continue;
|
||||
}
|
||||
const UChar *isoCode = ures_getString(idRes, &isoLength, &localStatus);
|
||||
|
||||
// get from date
|
||||
UDate fromDate = U_DATE_MIN;
|
||||
UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", NULL, &localStatus);
|
||||
UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", nullptr, &localStatus);
|
||||
|
||||
if (U_SUCCESS(localStatus)) {
|
||||
int32_t fromLength = 0;
|
||||
|
@ -2137,7 +2137,7 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
|
|||
// get to date
|
||||
UDate toDate = U_DATE_MAX;
|
||||
localStatus = U_ZERO_ERROR;
|
||||
UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus);
|
||||
UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus);
|
||||
|
||||
if (U_SUCCESS(localStatus)) {
|
||||
int32_t toLength = 0;
|
||||
|
@ -2171,8 +2171,8 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
|
|||
}
|
||||
|
||||
static const UEnumeration gEnumCurrencyList = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ucurr_closeCurrencyList,
|
||||
ucurr_countCurrencyList,
|
||||
uenum_unextDefault,
|
||||
|
@ -2183,10 +2183,10 @@ U_CDECL_END
|
|||
|
||||
|
||||
static void U_CALLCONV initIsoCodes(UErrorCode &status) {
|
||||
U_ASSERT(gIsoCodes == NULL);
|
||||
U_ASSERT(gIsoCodes == nullptr);
|
||||
ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
|
||||
|
||||
UHashtable *isoCodes = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
|
||||
UHashtable *isoCodes = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
@ -2221,11 +2221,11 @@ static void populateCurrSymbolsEquiv(icu::Hashtable *hash, UErrorCode &status) {
|
|||
}
|
||||
|
||||
static void U_CALLCONV initCurrSymbolsEquiv() {
|
||||
U_ASSERT(gCurrSymbolsEquiv == NULL);
|
||||
U_ASSERT(gCurrSymbolsEquiv == nullptr);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
|
||||
icu::Hashtable *temp = new icu::Hashtable(status);
|
||||
if (temp == NULL) {
|
||||
if (temp == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
|
@ -2249,7 +2249,7 @@ ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, UErrorCode* eError
|
|||
}
|
||||
|
||||
IsoCodeEntry* result = (IsoCodeEntry *) uhash_get(gIsoCodes, isoCode);
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
return false;
|
||||
} else if (from > to) {
|
||||
*eErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
|
@ -2267,20 +2267,20 @@ static const icu::Hashtable* getCurrSymbolsEquiv() {
|
|||
|
||||
U_CAPI UEnumeration * U_EXPORT2
|
||||
ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode) {
|
||||
UEnumeration *myEnum = NULL;
|
||||
UEnumeration *myEnum = nullptr;
|
||||
UCurrencyContext *myContext;
|
||||
|
||||
myEnum = (UEnumeration*)uprv_malloc(sizeof(UEnumeration));
|
||||
if (myEnum == NULL) {
|
||||
if (myEnum == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
uprv_memcpy(myEnum, &gEnumCurrencyList, sizeof(UEnumeration));
|
||||
myContext = (UCurrencyContext*)uprv_malloc(sizeof(UCurrencyContext));
|
||||
if (myContext == NULL) {
|
||||
if (myContext == nullptr) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
uprv_free(myEnum);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
myContext->currType = currType;
|
||||
myContext->listIdx = 0;
|
||||
|
@ -2295,7 +2295,7 @@ ucurr_countCurrencies(const char* locale,
|
|||
{
|
||||
int32_t currCount = 0;
|
||||
|
||||
if (ec != NULL && U_SUCCESS(*ec))
|
||||
if (ec != nullptr && U_SUCCESS(*ec))
|
||||
{
|
||||
// local variables
|
||||
UErrorCode localStatus = U_ZERO_ERROR;
|
||||
|
@ -2329,11 +2329,11 @@ ucurr_countCurrencies(const char* locale,
|
|||
for (int32_t i=0; i<ures_getSize(countryArray); i++)
|
||||
{
|
||||
// get the currency resource
|
||||
UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, NULL, &localStatus);
|
||||
UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, nullptr, &localStatus);
|
||||
|
||||
// get the from date
|
||||
int32_t fromLength = 0;
|
||||
UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", NULL, &localStatus);
|
||||
UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", nullptr, &localStatus);
|
||||
const int32_t *fromArray = ures_getIntVector(fromRes, &fromLength, &localStatus);
|
||||
|
||||
int64_t currDate64 = (int64_t)fromArray[0] << 32;
|
||||
|
@ -2343,7 +2343,7 @@ ucurr_countCurrencies(const char* locale,
|
|||
if (ures_getSize(currencyRes)> 2)
|
||||
{
|
||||
int32_t toLength = 0;
|
||||
UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus);
|
||||
UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus);
|
||||
const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus);
|
||||
|
||||
currDate64 = (int64_t)toArray[0] << 32;
|
||||
|
@ -2405,9 +2405,9 @@ ucurr_forLocaleAndDate(const char* locale,
|
|||
{
|
||||
int32_t resLen = 0;
|
||||
int32_t currIndex = 0;
|
||||
const UChar* s = NULL;
|
||||
const UChar* s = nullptr;
|
||||
|
||||
if (ec != NULL && U_SUCCESS(*ec))
|
||||
if (ec != nullptr && U_SUCCESS(*ec))
|
||||
{
|
||||
// check the arguments passed
|
||||
if ((buff && buffCapacity) || !buffCapacity )
|
||||
|
@ -2451,12 +2451,12 @@ ucurr_forLocaleAndDate(const char* locale,
|
|||
for (int32_t i=0; i<ures_getSize(countryArray); i++)
|
||||
{
|
||||
// get the currency resource
|
||||
UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, NULL, &localStatus);
|
||||
UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, nullptr, &localStatus);
|
||||
s = ures_getStringByKey(currencyRes, "id", &resLen, &localStatus);
|
||||
|
||||
// get the from date
|
||||
int32_t fromLength = 0;
|
||||
UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", NULL, &localStatus);
|
||||
UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", nullptr, &localStatus);
|
||||
const int32_t *fromArray = ures_getIntVector(fromRes, &fromLength, &localStatus);
|
||||
|
||||
int64_t currDate64 = (int64_t)fromArray[0] << 32;
|
||||
|
@ -2466,7 +2466,7 @@ ucurr_forLocaleAndDate(const char* locale,
|
|||
if (ures_getSize(currencyRes)> 2)
|
||||
{
|
||||
int32_t toLength = 0;
|
||||
UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus);
|
||||
UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus);
|
||||
const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus);
|
||||
|
||||
currDate64 = (int64_t)toArray[0] << 32;
|
||||
|
@ -2550,8 +2550,8 @@ ucurr_forLocaleAndDate(const char* locale,
|
|||
}
|
||||
|
||||
static const UEnumeration defaultKeywordValues = {
|
||||
NULL,
|
||||
NULL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
ulist_close_keyword_values_iterator,
|
||||
ulist_count_keyword_values,
|
||||
uenum_unextDefault,
|
||||
|
@ -2568,15 +2568,15 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
|
|||
UList *values = ulist_createEmptyList(status);
|
||||
UList *otherValues = ulist_createEmptyList(status);
|
||||
UEnumeration *en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
|
||||
if (U_FAILURE(*status) || en == NULL) {
|
||||
if (en == NULL) {
|
||||
if (U_FAILURE(*status) || en == nullptr) {
|
||||
if (en == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
} else {
|
||||
uprv_free(en);
|
||||
}
|
||||
ulist_deleteList(values);
|
||||
ulist_deleteList(otherValues);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
|
||||
en->context = values;
|
||||
|
@ -2614,7 +2614,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
|
|||
}
|
||||
char *curID = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY);
|
||||
int32_t curIDLength = ULOC_KEYWORDS_CAPACITY;
|
||||
if (curID == NULL) {
|
||||
if (curID == nullptr) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
break;
|
||||
}
|
||||
|
@ -2667,9 +2667,9 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
|
|||
}
|
||||
} else {
|
||||
// Consolidate the list
|
||||
char *value = NULL;
|
||||
char *value = nullptr;
|
||||
ulist_resetList(otherValues);
|
||||
while ((value = (char *)ulist_getNext(otherValues)) != NULL) {
|
||||
while ((value = (char *)ulist_getNext(otherValues)) != nullptr) {
|
||||
if (!ulist_containsString(values, value, (int32_t)uprv_strlen(value))) {
|
||||
char *tmpValue = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY);
|
||||
uprv_memcpy(tmpValue, value, uprv_strlen(value) + 1);
|
||||
|
@ -2685,8 +2685,8 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
|
|||
} else {
|
||||
ulist_deleteList(values);
|
||||
uprv_free(en);
|
||||
values = NULL;
|
||||
en = NULL;
|
||||
values = nullptr;
|
||||
en = nullptr;
|
||||
}
|
||||
ures_close(&to);
|
||||
ures_close(&curbndl);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue