ICU-1953 change comments style and check 0/NULL
X-SVN-Rev: 8993
This commit is contained in:
parent
994de98435
commit
b89c229c6e
@ -61,18 +61,18 @@ BreakIterator::createWordInstance(const Locale& key, UErrorCode& status)
|
||||
if(!uprv_strcmp(filename, "word_th")) {
|
||||
filename = "thaidict.brk";
|
||||
result = new DictionaryBasedBreakIterator(file, filename, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = new RuleBasedBreakIterator(file, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -105,18 +105,18 @@ BreakIterator::createLineInstance(const Locale& key, UErrorCode& status)
|
||||
if (!uprv_strcmp(key.getLanguage(), "th")) {
|
||||
filename = "thaidict.brk";
|
||||
result = new DictionaryBasedBreakIterator(file, filename, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = new RuleBasedBreakIterator(file, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,10 +142,10 @@ BreakIterator::createCharacterInstance(const Locale& key, UErrorCode& status)
|
||||
|
||||
if (!U_FAILURE(status)) {
|
||||
result = new RuleBasedBreakIterator(file, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,10 +170,10 @@ BreakIterator::createSentenceInstance(const Locale& key, UErrorCode& status)
|
||||
|
||||
if (!U_FAILURE(status)) {
|
||||
result = new RuleBasedBreakIterator(file, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,10 +198,10 @@ BreakIterator::createTitleInstance(const Locale& key, UErrorCode& status)
|
||||
|
||||
if (!U_FAILURE(status)) {
|
||||
result = new RuleBasedBreakIterator(file, status);
|
||||
//test for NULL
|
||||
if(result == NULL) {
|
||||
/* test for NULL */
|
||||
if(result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ DictionaryBasedBreakIterator::DictionaryBasedBreakIterator(UDataMemory* rbbiData
|
||||
{
|
||||
init();
|
||||
fTables = new DictionaryBasedBreakIteratorTables(dictionaryFilename, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(fTables == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -567,7 +567,7 @@ DictionaryBasedBreakIterator::divideUpDictionaryRange(int32_t startPos, int32_t
|
||||
uprv_free(cachedBreakPositions);
|
||||
}
|
||||
cachedBreakPositions = (int32_t *)uprv_malloc((currentBreakPositions.size() + 1) * sizeof(int32_t));
|
||||
//Test for NULL
|
||||
/* Test for NULL */
|
||||
if(cachedBreakPositions == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -48,7 +48,7 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode
|
||||
{
|
||||
init();
|
||||
fData = new RBBIDataWrapper(data, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(fData == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -65,7 +65,7 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &sta
|
||||
{
|
||||
init();
|
||||
fData = new RBBIDataWrapper(udm, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(fData == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -61,14 +61,14 @@ RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules,
|
||||
fDebugEnv = getenv("U_RBBIDEBUG"); // TODO: make conditional on some compile time setting
|
||||
|
||||
fScanner = new RBBIRuleScanner(this);
|
||||
//test for NULL
|
||||
/*test for NULL*/
|
||||
if(fScanner == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
fSetBuilder = new RBBISetBuilder(this);
|
||||
//test for NULL
|
||||
/*test for NULL*/
|
||||
if(fSetBuilder == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
uprv_free(fScanner);
|
||||
@ -215,18 +215,18 @@ RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules,
|
||||
// Generate the DFA state transition table.
|
||||
//
|
||||
builder.fForwardTables = new RBBITableBuilder(&builder, &builder.fForwardTree);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(builder.fForwardTables == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
builder.fReverseTables = new RBBITableBuilder(&builder, &builder.fReverseTree);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(builder.fReverseTables == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
uprv_free(builder.fForwardTables);
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
builder.fForwardTables->build();
|
||||
builder.fReverseTables->build();
|
||||
@ -253,7 +253,7 @@ RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules,
|
||||
// (Identical to creation from stored pre-compiled rules)
|
||||
//
|
||||
RuleBasedBreakIterator *This = new RuleBasedBreakIterator(data, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(This == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -469,7 +469,7 @@ RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &statu
|
||||
this->fNum = other.fNum;
|
||||
this->fNext = NULL;
|
||||
this->fIncludesSets = new UVector(status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (this->fIncludesSets == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -492,7 +492,7 @@ RangeDescriptor::RangeDescriptor(UErrorCode &status) {
|
||||
this->fNum = 0;
|
||||
this->fNext = NULL;
|
||||
this->fIncludesSets = new UVector(status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(this->fIncludesSets == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -519,7 +519,7 @@ RangeDescriptor::~RangeDescriptor() {
|
||||
void RangeDescriptor::split(UChar32 where, UErrorCode &status) {
|
||||
assert(where>fStartChar && where<=fEndChar);
|
||||
RangeDescriptor *nr = new RangeDescriptor(*this, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(nr == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -176,12 +176,9 @@ ucmp8_openAdopt(uint16_t *indexArray,
|
||||
int32_t count)
|
||||
{
|
||||
CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
|
||||
/* test for NULL */
|
||||
if(this_obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* test for NULL */
|
||||
if(this_obj == NULL)
|
||||
return NULL;
|
||||
ucmp8_initAdopt(this_obj, indexArray, newValues, count);
|
||||
this_obj->fIAmOwned = FALSE;
|
||||
return this_obj;
|
||||
@ -192,14 +189,11 @@ ucmp8_openAlias(uint16_t *indexArray,
|
||||
int8_t *newValues,
|
||||
int32_t count)
|
||||
{
|
||||
CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
|
||||
/* test for NULL */
|
||||
if(this_obj == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ucmp8_initAlias(this_obj, indexArray, newValues, count);
|
||||
CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
/* test for NULL */
|
||||
if(this_obj == NULL)
|
||||
return NULL;
|
||||
ucmp8_initAlias(this_obj, indexArray, newValues, count);
|
||||
this_obj->fIAmOwned = FALSE;
|
||||
return this_obj;
|
||||
}
|
||||
|
@ -74,7 +74,9 @@ _HZOpen(UConverter *cnv, const char *name,const char *locale,uint32_t options, U
|
||||
((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
|
||||
((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0;
|
||||
((UConverterDataHZ*)cnv->extraInfo)->isTargetUCharDBCS = FALSE;
|
||||
} else { /* test for NULL */
|
||||
}
|
||||
/* test for NULL */
|
||||
else {
|
||||
*errorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -207,8 +207,8 @@ UnicodeSet::UnicodeSet(const UnicodeString& pattern,
|
||||
buffer(0)
|
||||
{
|
||||
list = (UChar32*) uprv_malloc(sizeof(UChar32) * capacity);
|
||||
//test for NULL
|
||||
if(list == 0) {
|
||||
/* test for NULL */
|
||||
if(list == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
@ -226,8 +226,8 @@ UnicodeSet::UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
|
||||
buffer(0)
|
||||
{
|
||||
list = (UChar32*) uprv_malloc(sizeof(UChar32) * capacity);
|
||||
//test for NULL
|
||||
if(list == 0) {
|
||||
/* test for NULL */
|
||||
if(list == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
@ -243,8 +243,8 @@ UnicodeSet::UnicodeSet(const UnicodeString& pattern, ParsePosition& pos,
|
||||
buffer(0)
|
||||
{
|
||||
list = (UChar32*) uprv_malloc(sizeof(UChar32) * capacity);
|
||||
//test for NULL
|
||||
if(list == 0) {
|
||||
/* test for NULL */
|
||||
if(list == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
@ -273,8 +273,8 @@ UnicodeSet::UnicodeSet(int8_t category, UErrorCode& status) :
|
||||
pattern.insert(0, OPEN);
|
||||
pattern.append(CLOSE);
|
||||
list = (UChar32*) uprv_malloc(sizeof(UChar32) * capacity);
|
||||
//test for NULL
|
||||
if(list == 0) {
|
||||
/* test for NULL */
|
||||
if(list == NULL) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
@ -516,13 +516,11 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
||||
char *chAlias = NULL, *path = NULL, *locale = NULL, *keyPath = NULL;
|
||||
int32_t pathLen = 0, localeLen = 0, keyPathLen = 0;
|
||||
chAlias = (char *)uprv_malloc((len+1)*sizeof(char));
|
||||
|
||||
/* test for NULL */
|
||||
if(chAlias == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
u_UCharsToChars(alias, chAlias, len);
|
||||
chAlias[len] = 0;
|
||||
|
||||
@ -622,13 +620,11 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
|
||||
}
|
||||
if(resB == NULL) {
|
||||
resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
|
||||
|
||||
/* test for NULL */
|
||||
if (resB == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (resB == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
ures_setIsStackObject(resB, FALSE);
|
||||
resB->fResPath = NULL;
|
||||
} else {
|
||||
@ -681,12 +677,11 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin
|
||||
if(r == NULL) {
|
||||
isStackObject = FALSE;
|
||||
r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
|
||||
|
||||
/* test for NULL */
|
||||
if (r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
if (r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
isStackObject = ures_isStackObject(r);
|
||||
if(U_FAILURE(*status)) {
|
||||
@ -695,12 +690,11 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin
|
||||
ures_close(r);
|
||||
if(isStackObject == FALSE) {
|
||||
r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
|
||||
|
||||
/* test for NULL */
|
||||
if (r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
if (r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
uprv_memcpy(r, original, sizeof(UResourceBundle));
|
||||
@ -1053,13 +1047,11 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
|
||||
return result;
|
||||
}
|
||||
pathToResource = (char *)uprv_malloc((uprv_strlen(path)+1)*sizeof(char));
|
||||
|
||||
/*test for NULL */
|
||||
/* test for NULL */
|
||||
if(pathToResource == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
uprv_strcpy(pathToResource, path);
|
||||
locale = pathToResource;
|
||||
if(*pathToResource == RES_PATH_SEPARATOR) { /* there is a path specification */
|
||||
@ -1486,12 +1478,11 @@ ures_openW(const wchar_t* myPath,
|
||||
UResourceBundle *r;
|
||||
size_t pathSize = (uprv_wcslen(myPath) + 1) * sizeof(int32_t);
|
||||
char *path = (char *)uprv_malloc(pathSize);
|
||||
|
||||
/* test for NULL */
|
||||
if (path == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
if (path == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uprv_wcstombs(path, myPath, pathSize);
|
||||
|
||||
@ -1515,12 +1506,11 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_openU(const UChar* myPath,
|
||||
UResourceBundle *r;
|
||||
int32_t pathSize = u_strlen(myPath) + 1;
|
||||
char *path = (char *)uprv_malloc(pathSize);
|
||||
|
||||
/* test for NULL */
|
||||
if(path == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
if(path == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u_UCharsToChars(myPath, path, pathSize);
|
||||
|
||||
|
@ -37,8 +37,8 @@ uset_openPattern(const UChar* pattern, int32_t patternLength,
|
||||
UErrorCode* ec) {
|
||||
UnicodeString pat(patternLength==-1, pattern, patternLength);
|
||||
UnicodeSet* set = new UnicodeSet(pat, *ec);
|
||||
//test for NULL
|
||||
if(set == NULL) {
|
||||
/* test for NULL */
|
||||
if(set == 0) {
|
||||
*ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
@ -126,7 +126,7 @@ U_NAMESPACE_BEGIN
|
||||
*/
|
||||
class USetAccess /* not : public UObject because all methods are static */ {
|
||||
public:
|
||||
// Try to have the compiler inline these
|
||||
/* Try to have the compiler inline these*/
|
||||
inline static int32_t getStringCount(const UnicodeSet& set) {
|
||||
return set.getStringCount();
|
||||
}
|
||||
@ -135,7 +135,7 @@ public:
|
||||
return set.getString(i);
|
||||
}
|
||||
private:
|
||||
// do not instantiate
|
||||
/* do not instantiate*/
|
||||
USetAccess();
|
||||
};
|
||||
U_NAMESPACE_END
|
||||
|
@ -501,12 +501,11 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength,
|
||||
switch(options&U_SHAPE_LENGTH_MASK) {
|
||||
case U_SHAPE_LENGTH_GROW_SHRINK :
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
@ -546,11 +545,11 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength,
|
||||
case U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING :
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
@ -575,11 +574,11 @@ removeLamAlefSpaces(UChar *dest, int32_t sourceLength,
|
||||
case U_SHAPE_LENGTH_FIXED_SPACES_AT_END :
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
@ -644,11 +643,11 @@ expandLamAlef(UChar *dest, int32_t sourceLength,
|
||||
destSize = calculateSize(dest,sourceLength,destSize,options);
|
||||
tempbuffer = (UChar *)uprv_malloc((destSize+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (destSize+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
@ -686,11 +685,11 @@ expandLamAlef(UChar *dest, int32_t sourceLength,
|
||||
case U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING :
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
@ -727,11 +726,11 @@ expandLamAlef(UChar *dest, int32_t sourceLength,
|
||||
*/
|
||||
tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
|
||||
|
||||
@ -1026,11 +1025,11 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
|
||||
} else {
|
||||
tempbuffer = (UChar *)uprv_malloc(outputSize*U_SIZEOF_UCHAR);
|
||||
|
||||
/* Test for NULL */
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/*Test for NULL*/
|
||||
if(tempbuffer == NULL) {
|
||||
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
uprv_memcpy(tempbuffer, source, sourceLength*U_SIZEOF_UCHAR);
|
||||
if(sourceLength<outputSize) {
|
||||
|
@ -186,7 +186,7 @@ Calendar::createInstance(UErrorCode& success)
|
||||
if (U_FAILURE(success)) return 0;
|
||||
// right now, createInstance will always return an instance of GregorianCalendar
|
||||
Calendar* c = new GregorianCalendar(success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (c == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -203,7 +203,7 @@ Calendar::createInstance(const TimeZone& zone, UErrorCode& success)
|
||||
if (U_FAILURE(success)) return 0;
|
||||
// since the Locale isn't specified, use the default locale
|
||||
Calendar* c = new GregorianCalendar(zone, Locale::getDefault(), success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (c == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -220,7 +220,7 @@ Calendar::createInstance(const Locale& aLocale, UErrorCode& success)
|
||||
if (U_FAILURE(success)) return 0;
|
||||
// since the TimeZone isn't specfied, use the default time zone
|
||||
Calendar* c = new GregorianCalendar(TimeZone::createDefault(), aLocale, success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (c == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -256,7 +256,7 @@ Calendar::createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode
|
||||
{
|
||||
if (U_FAILURE(success)) return 0;
|
||||
Calendar* c = new GregorianCalendar(zone, aLocale, success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (c == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -377,6 +377,11 @@ Calendar::getTimeInMillis(UErrorCode& status) const
|
||||
|
||||
if ( ! fIsTimeSet)
|
||||
((Calendar*)this)->updateTime(status);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return 0.0;
|
||||
}
|
||||
return fTime;
|
||||
}
|
||||
|
||||
@ -397,6 +402,11 @@ Calendar::setTimeInMillis( double millis, UErrorCode& status ) {
|
||||
fAreFieldsSet = FALSE;
|
||||
|
||||
computeFields(status);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
fAreFieldsSet = TRUE;
|
||||
fAreAllFieldsSet = TRUE;
|
||||
}
|
||||
@ -502,10 +512,19 @@ Calendar::isSet(EDateFields field) const
|
||||
void
|
||||
Calendar::complete(UErrorCode& status)
|
||||
{
|
||||
if (!fIsTimeSet)
|
||||
if (!fIsTimeSet) {
|
||||
updateTime(status);
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!fAreFieldsSet) {
|
||||
computeFields(status); // fills in unset fields
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
fAreFieldsSet = TRUE;
|
||||
fAreAllFieldsSet = TRUE;
|
||||
}
|
||||
@ -593,6 +612,11 @@ int32_t Calendar::fieldDifference(UDate targetMs, EDateFields field, UErrorCode&
|
||||
// Set calendar to end point
|
||||
setTimeInMillis(startMs, ec);
|
||||
add(field, min, ec);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(ec)) {
|
||||
return 0;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
@ -602,10 +626,10 @@ void
|
||||
Calendar::adoptTimeZone(TimeZone* zone)
|
||||
{
|
||||
// Do nothing if passed-in zone is NULL
|
||||
if (zone == 0) return;
|
||||
if (zone == NULL) return;
|
||||
|
||||
// fZone should always be non-null
|
||||
if (fZone != 0) delete fZone;
|
||||
if (fZone != NULL) delete fZone;
|
||||
fZone = zone;
|
||||
|
||||
// if the zone changes, we need to recompute the time fields
|
||||
@ -721,6 +745,11 @@ Calendar::getActualMinimum(EDateFields field, UErrorCode& status) const
|
||||
} while (fieldValue >= endValue);
|
||||
|
||||
delete work;
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -764,6 +793,12 @@ Calendar::getActualMaximum(EDateFields field, UErrorCode& status) const
|
||||
} while (fieldValue <= endValue);
|
||||
|
||||
delete work;
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -787,7 +822,7 @@ Calendar::setWeekCountData(const Locale& desiredLocale, UErrorCode& status)
|
||||
fFirstDayOfWeek = Calendar::SUNDAY;
|
||||
fMinimalDaysInFirstWeek = 1;
|
||||
|
||||
UResourceBundle *resource = ures_open(0, desiredLocale.getName(), &status);
|
||||
UResourceBundle *resource = ures_open(NULL, desiredLocale.getName(), &status);
|
||||
|
||||
// If the resource data doesn't seem to be present at all, then use last-resort
|
||||
// hard-coded data.
|
||||
@ -799,7 +834,7 @@ Calendar::setWeekCountData(const Locale& desiredLocale, UErrorCode& status)
|
||||
}
|
||||
|
||||
//dateTimeElements = resource.getStringArray(kDateTimeElements, count, status);
|
||||
UResourceBundle *dateTimeElements = ures_getByKey(resource, kDateTimeElements, 0, &status);
|
||||
UResourceBundle *dateTimeElements = ures_getByKey(resource, kDateTimeElements, NULL, &status);
|
||||
if (U_SUCCESS(status)) {
|
||||
int32_t arrLen;
|
||||
const int32_t *dateTimeElementsArr = ures_getIntVector(dateTimeElements, &arrLen, &status);
|
||||
|
@ -181,14 +181,14 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
if (newSource.length() == 0) {
|
||||
pieces_length = 1;
|
||||
pieces = new UnicodeString*[1];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (pieces == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
current_length = 1;
|
||||
current = (int32_t*)uprv_malloc(1 * sizeof(int32_t));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (current == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete pieces;
|
||||
@ -196,7 +196,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
}
|
||||
current[0] = 0;
|
||||
pieces[0] = new UnicodeString[1];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (pieces[0] == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete pieces;
|
||||
@ -205,7 +205,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
}
|
||||
pieces[0][0] = UnicodeString("");
|
||||
pieces_lengths = (int32_t*)uprv_malloc(1 * sizeof(int32_t));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (pieces_lengths == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete[] pieces;
|
||||
@ -218,7 +218,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
|
||||
|
||||
UnicodeString *list = new UnicodeString[source.length()];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (list == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -248,7 +248,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
|
||||
// allocate the arrays, and find the strings that are CE to each segment
|
||||
pieces = new UnicodeString*[list_length];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (pieces == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete[] list;
|
||||
@ -256,7 +256,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
}
|
||||
pieces_length = list_length;
|
||||
pieces_lengths = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (pieces_lengths == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete[] list;
|
||||
@ -266,7 +266,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
|
||||
|
||||
current_length = list_length;
|
||||
current = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (current == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete[] list;
|
||||
@ -305,7 +305,7 @@ void CanonicalIterator::permute(UnicodeString &source, UBool skipZeros, Hashtabl
|
||||
// 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 NULL */
|
||||
if (toPut == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -317,7 +317,7 @@ void CanonicalIterator::permute(UnicodeString &source, UBool skipZeros, Hashtabl
|
||||
// otherwise iterate through the string, and recursively permute all the other characters
|
||||
UChar32 cp;
|
||||
Hashtable *subpermute = new Hashtable(FALSE, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (subpermute == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -345,6 +345,11 @@ void CanonicalIterator::permute(UnicodeString &source, UBool skipZeros, Hashtabl
|
||||
// see what the permutations of the characters before and after this one are
|
||||
//Hashtable *subpermute = permute(source.substring(0,i) + source.substring(i + UTF16.getCharCount(cp)));
|
||||
permute(subPermuteString.replace(i, UTF16_CHAR_LENGTH(cp), NULL, 0), skipZeros, subpermute, status);
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
delete subpermute;
|
||||
return;
|
||||
}
|
||||
// The upper replace is destructive. The question is do we have to make a copy, or we don't care about the contents
|
||||
// of source at this point.
|
||||
|
||||
@ -376,7 +381,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
||||
//private String[] getEquivalents(String segment)
|
||||
|
||||
Hashtable *result = new Hashtable(FALSE, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -394,7 +399,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
||||
// TODO: optimize by not permuting any class zero.
|
||||
|
||||
Hashtable *permutations = new Hashtable(FALSE, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (permutations == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete result;
|
||||
@ -442,10 +447,17 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
|
||||
ne = basic->nextElement(el);
|
||||
}
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
delete result;
|
||||
delete permutations;
|
||||
delete basic;
|
||||
return 0;
|
||||
}
|
||||
// convert into a String[] to clean up storage
|
||||
//String[] finalResult = new String[result.size()];
|
||||
UnicodeString *finalResult = new UnicodeString[result->count()];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (finalResult == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete result;
|
||||
@ -474,7 +486,7 @@ Hashtable *CanonicalIterator::getEquivalents2(const UChar *segment, int32_t segL
|
||||
//Hashtable *CanonicalIterator::getEquivalents2(const UnicodeString &segment, int32_t segLen, UErrorCode &status) {
|
||||
|
||||
Hashtable *result = new Hashtable(FALSE, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -516,7 +528,7 @@ Hashtable *CanonicalIterator::getEquivalents2(const UChar *segment, int32_t segL
|
||||
while (ne != NULL) {
|
||||
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
|
||||
UnicodeString *toAdd = new UnicodeString(prefix);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (toAdd == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete result;
|
||||
@ -534,6 +546,11 @@ Hashtable *CanonicalIterator::getEquivalents2(const UChar *segment, int32_t segL
|
||||
delete remainder;
|
||||
}
|
||||
}
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -614,7 +631,7 @@ Hashtable *CanonicalIterator::extract(UChar32 comp, const UChar *segment, int32_
|
||||
|
||||
if (bufLen == 0) {
|
||||
Hashtable *result = new Hashtable(FALSE, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -631,6 +648,11 @@ Hashtable *CanonicalIterator::extract(UChar32 comp, const UChar *segment, int32_
|
||||
UChar trial[bufSize];
|
||||
unorm_decompose(trial, bufSize, temp, tempLen, FALSE, FALSE, &status);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if(U_FAILURE(status)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(uprv_memcmp(segment+segmentPos, trial, (segLen - segmentPos)*sizeof(UChar)) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -270,20 +270,20 @@ ChoiceFormat::applyPattern(const UnicodeString& pattern,
|
||||
|
||||
// Allocate the required storage.
|
||||
double *newLimits = (double*) uprv_malloc( sizeof(double) * count);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (newLimits == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
UBool *newClosures = (UBool*) uprv_malloc( sizeof(UBool) * count);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (newClosures == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete newLimits;
|
||||
return;
|
||||
}
|
||||
UnicodeString *newFormats = new UnicodeString[count];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (newFormats == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete newLimits;
|
||||
|
@ -48,6 +48,12 @@ CollationElementIterator::CollationElementIterator(
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
m_data_ = ucol_openElements(other.m_data_->iteratordata_.coll, NULL, 0,
|
||||
&status);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
*this = other;
|
||||
}
|
||||
|
||||
@ -171,7 +177,7 @@ void CollationElementIterator::setText(const UnicodeString& source,
|
||||
m_data_->isWritable = TRUE;
|
||||
if (length > 0) {
|
||||
string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (string == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -180,7 +186,7 @@ void CollationElementIterator::setText(const UnicodeString& source,
|
||||
}
|
||||
else {
|
||||
string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (string == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -205,7 +211,7 @@ void CollationElementIterator::setText(CharacterIterator& source,
|
||||
|
||||
if (length == 0) {
|
||||
buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (buffer == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -214,7 +220,7 @@ void CollationElementIterator::setText(CharacterIterator& source,
|
||||
}
|
||||
else {
|
||||
buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (buffer == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -269,7 +275,7 @@ CollationElementIterator::CollationElementIterator(
|
||||
|
||||
if (length > 0) {
|
||||
string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (string == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -282,7 +288,7 @@ CollationElementIterator::CollationElementIterator(
|
||||
}
|
||||
else {
|
||||
string = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (string == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -290,6 +296,11 @@ CollationElementIterator::CollationElementIterator(
|
||||
*string = 0;
|
||||
}
|
||||
m_data_ = ucol_openElements(order->ucollator, string, length, &status);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
m_data_->isWritable = TRUE;
|
||||
}
|
||||
|
||||
@ -329,7 +340,7 @@ CollationElementIterator::CollationElementIterator(
|
||||
UChar *buffer;
|
||||
if (length > 0) {
|
||||
buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR * length);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (buffer == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -345,7 +356,7 @@ CollationElementIterator::CollationElementIterator(
|
||||
}
|
||||
else {
|
||||
buffer = (UChar *)uprv_malloc(U_SIZEOF_UCHAR);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (buffer == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -353,6 +364,11 @@ CollationElementIterator::CollationElementIterator(
|
||||
*buffer = 0;
|
||||
}
|
||||
m_data_ = ucol_openElements(order->ucollator, buffer, length, &status);
|
||||
|
||||
/* Test for buffer overflows */
|
||||
if (U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
m_data_->isWritable = TRUE;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ Collator* Collator::createInstance(const Locale& desiredLocale,
|
||||
|
||||
RuleBasedCollator* collation = new RuleBasedCollator(desiredLocale,
|
||||
status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (collation == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -102,7 +102,7 @@ Collator::createInstance(const Locale &loc,
|
||||
UVersionInfo info;
|
||||
|
||||
collator=new RuleBasedCollator(loc, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (collator == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -183,7 +183,7 @@ void CompoundTransliterator::init(UVector& list,
|
||||
if (U_SUCCESS(status)) {
|
||||
count = list.size();
|
||||
trans = new Transliterator*[count];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (trans == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -125,7 +125,7 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
|
||||
ResourceBundle numberElementsRes = resource.get(fgNumberElements, status);
|
||||
int32_t numberElementsLength = numberElementsRes.getSize();
|
||||
UnicodeString* numberElements = new UnicodeString[numberElementsLength];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (numberElements == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -138,7 +138,7 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
|
||||
ResourceBundle currencyElementsRes = resource.get(fgCurrencyElements, status);
|
||||
int32_t currencyElementsLength = currencyElementsRes.getSize();
|
||||
UnicodeString* currencyElements = new UnicodeString[currencyElementsLength];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (currencyElements == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete[] numberElements;
|
||||
|
@ -216,7 +216,7 @@ DecimalFormat::construct(UErrorCode& status,
|
||||
if (fSymbols == NULL)
|
||||
{
|
||||
fSymbols = new DecimalFormatSymbols(Locale::getDefault(), status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fSymbols == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -2772,13 +2772,13 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
delete fNegPrefixPattern;
|
||||
delete fNegSuffixPattern;
|
||||
fPosPrefixPattern = new UnicodeString(prefix);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fPosPrefixPattern == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
fPosSuffixPattern = new UnicodeString(suffix);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fPosSuffixPattern == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete fPosPrefixPattern;
|
||||
@ -2832,7 +2832,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
*fRoundingIncrement = roundingInc;
|
||||
} else {
|
||||
fRoundingIncrement = new DigitList(roundingInc);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fRoundingIncrement == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete fPosPrefixPattern;
|
||||
@ -2847,13 +2847,13 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
}
|
||||
} else {
|
||||
fNegPrefixPattern = new UnicodeString(prefix);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fNegPrefixPattern == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
fNegSuffixPattern = new UnicodeString(suffix);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fNegSuffixPattern == 0) {
|
||||
delete fNegPrefixPattern;
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -2871,7 +2871,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
fPosPrefixPattern->remove();
|
||||
} else {
|
||||
fPosPrefixPattern = new UnicodeString();
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fPosPrefixPattern == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -2881,7 +2881,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
fPosSuffixPattern->remove();
|
||||
} else {
|
||||
fPosSuffixPattern = new UnicodeString();
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fPosSuffixPattern == 0) {
|
||||
delete fPosPrefixPattern;
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -2914,7 +2914,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern,
|
||||
_copy_us_ptr(&fNegSuffixPattern, fPosSuffixPattern);
|
||||
if (fNegPrefixPattern == NULL) {
|
||||
fNegPrefixPattern = new UnicodeString();
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fNegPrefixPattern == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -542,7 +542,7 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
||||
initField(&fAmPms, fAmPmsCount, (const UChar *)gLastResortAmPmMarkers, kAmPmNum, kAmPmLen, status);
|
||||
|
||||
fZoneStrings = new UnicodeString*[1];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fZoneStrings == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -578,14 +578,14 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
||||
/* TODO: Fix the case where the zoneStrings is not a perfect square array of information. */
|
||||
fZoneStringsColCount = zoneRow.getSize();
|
||||
fZoneStrings = new UnicodeString * [fZoneStringsRowCount];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fZoneStrings == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
for(i = 0; i<fZoneStringsRowCount; i++) {
|
||||
*(fZoneStrings+i) = new UnicodeString[fZoneStringsColCount];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if ((*(fZoneStrings+i)) == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -600,7 +600,7 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
||||
ResourceBundle weekdaysData = resource.get(fgDayNamesTag, status);
|
||||
fWeekdaysCount = weekdaysData.getSize();
|
||||
fWeekdays = new UnicodeString[fWeekdaysCount+1];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fWeekdays == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -613,7 +613,7 @@ DateFormatSymbols::initializeData(const Locale& locale, UErrorCode& status, UBoo
|
||||
ResourceBundle lsweekdaysData = resource.get(fgDayAbbreviationsTag, status);
|
||||
fShortWeekdaysCount = lsweekdaysData.getSize();
|
||||
fShortWeekdays = new UnicodeString[fShortWeekdaysCount+1];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fShortWeekdays == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -340,7 +340,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
|
||||
// Normalize the year so BC values are represented as 0 and negative
|
||||
// values.
|
||||
GregorianCalendar *cal = new GregorianCalendar(getTimeZone(), status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (cal == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -118,13 +118,13 @@ MessageFormat::MessageFormat(const UnicodeString& pattern,
|
||||
fArgumentNumbers(NULL)
|
||||
{
|
||||
fOffsets = (int32_t*) uprv_malloc( sizeof(int32_t) * fCount );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fOffsets == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
fArgumentNumbers = (int32_t*) uprv_malloc( sizeof(int32_t) * fCount );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fArgumentNumbers == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete fOffsets;
|
||||
@ -147,13 +147,13 @@ MessageFormat::MessageFormat(const UnicodeString& pattern,
|
||||
fArgumentNumbers(NULL)
|
||||
{
|
||||
fOffsets = (int32_t*) uprv_malloc( sizeof(int32_t) * fCount );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fOffsets == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
fArgumentNumbers = (int32_t*) uprv_malloc( sizeof(int32_t) * fCount );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fArgumentNumbers == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete fOffsets;
|
||||
@ -177,13 +177,13 @@ MessageFormat::MessageFormat(const UnicodeString& pattern,
|
||||
fArgumentNumbers(NULL)
|
||||
{
|
||||
fOffsets = (int32_t*) uprv_malloc( sizeof(int32_t) * fCount );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fOffsets == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
fArgumentNumbers = (int32_t*) uprv_malloc( sizeof(int32_t) * fCount );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fArgumentNumbers == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete fOffsets;
|
||||
@ -779,7 +779,7 @@ MessageFormat::format( const UnicodeString& pattern,
|
||||
{
|
||||
// {sfb} why does this use a local when so many other places use a static?
|
||||
MessageFormat *temp = new MessageFormat(pattern, success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (temp == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return result;
|
||||
@ -900,7 +900,7 @@ MessageFormat::format(const Formattable* arguments,
|
||||
if (tryRecursion && arg.indexOf(LEFT_CURLY_BRACE) >= 0) {
|
||||
MessageFormat *temp = NULL;
|
||||
temp = new MessageFormat(arg, fLocale, success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (temp == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return result;
|
||||
@ -1322,7 +1322,7 @@ MessageFormat::makeFormat(/*int32_t position, */
|
||||
fFormatTypeList[argumentNumber] = Formattable::kDouble;
|
||||
|
||||
newFormat = new ChoiceFormat(segments[3], parseError, success);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (newFormat == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
fMaxOffset = oldMaxOffset;
|
||||
|
@ -102,7 +102,7 @@ NFRule::makeRules(UnicodeString& description,
|
||||
// (this also strips the rule descriptor, if any, off the
|
||||
// descripton string)
|
||||
NFRule* rule1 = new NFRule(rbnf);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (rule1 == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -144,7 +144,7 @@ NFRule::makeRules(UnicodeString& description,
|
||||
// increment the original rule's base value ("rule1" actually
|
||||
// goes SECOND in the rule set's rule list)
|
||||
rule2 = new NFRule(rbnf);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (rule2 == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -169,7 +169,7 @@ NFSubstitution::NFSubstitution(int32_t _pos,
|
||||
// belonging to our formatter)
|
||||
else if (workingDescription.charAt(0) == gPound || workingDescription.charAt(0) ==gZero) {
|
||||
this->numberFormat = new DecimalFormat(workingDescription, *(formatter->getDecimalFormatSymbols()), status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (this->numberFormat == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -130,7 +130,7 @@ RuleBasedNumberFormat::clone(void) const
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
UParseError perror;
|
||||
result = new RuleBasedNumberFormat(rules, locale, perror, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -423,7 +423,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& pErr, UErro
|
||||
// copy out the lenient-parse rules and delete them
|
||||
// from the description
|
||||
lenientParseRules = new UnicodeString();
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (lenientParseRules == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -446,7 +446,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& pErr, UErro
|
||||
|
||||
// our rule list is an array of the appropriate size
|
||||
ruleSets = new NFRuleSet*[numRuleSets + 1];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (ruleSets == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -464,7 +464,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& pErr, UErro
|
||||
// because we have to know the names and locations of all the rule
|
||||
// sets before we can actually set everything up
|
||||
UnicodeString* ruleSetDescriptions = new UnicodeString[numRuleSets];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (ruleSetDescriptions == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -476,7 +476,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& pErr, UErro
|
||||
for (int32_t p = description.indexOf(gSemiPercent); p != -1; p = description.indexOf(gSemiPercent, start)) {
|
||||
ruleSetDescriptions[curRuleSet].setTo(description, start, p + 1 - start);
|
||||
ruleSets[curRuleSet] = new NFRuleSet(ruleSetDescriptions, curRuleSet, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (ruleSets[curRuleSet] == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -486,7 +486,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& pErr, UErro
|
||||
}
|
||||
ruleSetDescriptions[curRuleSet].setTo(description, start, description.length() - start);
|
||||
ruleSets[curRuleSet] = new NFRuleSet(ruleSetDescriptions, curRuleSet, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (ruleSets[curRuleSet] == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -24,7 +24,7 @@ TransliterationRuleData::TransliterationRuleData(UErrorCode& status)
|
||||
return;
|
||||
}
|
||||
variableNames = new Hashtable(status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (variableNames == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -57,7 +57,7 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
|
||||
variables = 0;
|
||||
if (other.variables != 0) {
|
||||
variables = new UnicodeFunctor*[variablesLength];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (variables == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -112,7 +112,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
|
||||
if (anteContextLength > 0) {
|
||||
anteContext = new StringMatcher(pattern, 0, anteContextLength,
|
||||
FALSE, *data);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (anteContext == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -123,7 +123,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
|
||||
if (keyLength > 0) {
|
||||
key = new StringMatcher(pattern, anteContextLength, anteContextLength + keyLength,
|
||||
FALSE, *data);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (key == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -135,7 +135,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
|
||||
if (postContextLength > 0) {
|
||||
postContext = new StringMatcher(pattern, anteContextLength + keyLength, pattern.length(),
|
||||
FALSE, *data);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (postContext == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -143,7 +143,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
|
||||
}
|
||||
|
||||
this->output = new StringReplacer(outputStr, cursorPosition + cursorOffset, data);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (this->output == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -282,7 +282,7 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
|
||||
* Be careful not to call malloc(0).
|
||||
*/
|
||||
int16_t* indexValue = (int16_t*) uprv_malloc( sizeof(int16_t) * (n > 0 ? n : 1) );
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (indexValue == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -317,7 +317,7 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
|
||||
*/
|
||||
delete[] rules; // Contains alias pointers
|
||||
rules = new TransliterationRule*[v.size()];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (rules == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -691,7 +691,7 @@ UBool SimpleTimeZone::inDaylightTime(UDate date, UErrorCode& status) const
|
||||
// and provided only for Java compatibility as of 8/6/97 [LIU].
|
||||
if (U_FAILURE(status)) return FALSE;
|
||||
GregorianCalendar *gc = new GregorianCalendar(*this, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (gc == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return FALSE;
|
||||
|
@ -179,7 +179,7 @@ SimpleDateFormat::SimpleDateFormat(const Locale& locale,
|
||||
delete fSymbols;
|
||||
// This constructor doesn't fail; it uses last resort data
|
||||
fSymbols = new DateFormatSymbols(status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fSymbols == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -272,7 +272,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
|
||||
|
||||
// create a symbols object from the locale
|
||||
fSymbols = new DateFormatSymbols(locale, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (fSymbols == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -296,7 +296,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
|
||||
// pattern = MessageFormat.format(dateTimePatterns[8], dateTimeArgs);
|
||||
|
||||
Formattable *timeDateArray = new Formattable[2];
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (timeDateArray == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -310,7 +310,7 @@ SearchIterator * StringSearch::safeClone(void) const
|
||||
(RuleBasedCollator *)&m_collator_,
|
||||
m_breakiterator_,
|
||||
status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (result == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -161,7 +161,7 @@ RuleBasedCollator::construct(const UnicodeString& rules,
|
||||
else {
|
||||
urulestring = new UnicodeString();
|
||||
}
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (urulestring == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -604,7 +604,7 @@ RuleBasedCollator::RuleBasedCollator(const Locale& desiredLocale,
|
||||
else {
|
||||
urulestring = new UnicodeString();
|
||||
}
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (urulestring == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -912,7 +912,7 @@ Transliterator* Transliterator::createInstance(const UnicodeString& ID,
|
||||
break;
|
||||
default:
|
||||
t = new CompoundTransliterator(list, parseError, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -1008,7 +1008,7 @@ Transliterator* Transliterator::createFromRules(const UnicodeString& ID,
|
||||
// ordinary RBT_DATA.
|
||||
t = new RuleBasedTransliterator(ID, parser.orphanData(), TRUE); // TRUE == adopt data object
|
||||
}
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -1028,14 +1028,14 @@ Transliterator* Transliterator::createFromRules(const UnicodeString& ID,
|
||||
// RBT
|
||||
UnicodeString id("_", "");
|
||||
t = new RuleBasedTransliterator(id, parser.orphanData(), TRUE); // TRUE == adopt data object
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
t = new CompoundTransliterator(ID, parser.idBlock, parser.idSplitPoint,
|
||||
t, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -90,7 +90,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
|
||||
} else {
|
||||
t = new CompoundTransliterator(ID, aliasID, idSplitPoint,
|
||||
trans, ec);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (t == 0) {
|
||||
ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -177,7 +177,7 @@ Spec::Spec(const UnicodeString& theSpec) : top(theSpec) {
|
||||
CharString topch(top);
|
||||
Locale toploc(topch);
|
||||
res = new ResourceBundle(u_getDataDirectory(), toploc, status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (res == 0) {
|
||||
return;
|
||||
}
|
||||
@ -1021,7 +1021,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
|
||||
return entry->u.prototype->clone();
|
||||
} else if (entry->entryType == Entry::ALIAS) {
|
||||
aliasReturn = new TransliteratorAlias(entry->stringArg);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (aliasReturn == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
|
||||
} else if (entry->entryType == Entry::COMPOUND_RBT) {
|
||||
UnicodeString id("_", "");
|
||||
Transliterator *t = new RuleBasedTransliterator(id, entry->u.data);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (t == 0) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -251,7 +251,7 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
|
||||
ParsePosition ppos(pos);
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
filter = new UnicodeSet(id, ppos, ec);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (filter == 0) {
|
||||
pos = start;
|
||||
return 0;
|
||||
|
@ -305,7 +305,7 @@ clean:
|
||||
loc = ures_getLocale(result->rb, status);
|
||||
}
|
||||
result->requestedLocale = (char *)uprv_malloc((uprv_strlen(loc)+1)*sizeof(char));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (result->requestedLocale == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -457,7 +457,7 @@ ucol_openRules( const UChar *rules,
|
||||
result = ucol_initCollator(UCA->image,0,status);
|
||||
// And set only the options
|
||||
UColOptionSet *opts = (UColOptionSet *)uprv_malloc(sizeof(UColOptionSet));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (opts == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -472,7 +472,7 @@ ucol_openRules( const UChar *rules,
|
||||
UChar *newRules;
|
||||
result->dataInfo.dataVersion[0] = UCOL_BUILDER_VERSION;
|
||||
newRules = (UChar *)uprv_malloc((rulesLength+1)*U_SIZEOF_UCHAR);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (newRules == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -516,7 +516,7 @@ ucol_cloneRuleData(const UCollator *coll, int32_t *length, UErrorCode *status)
|
||||
if(coll->hasRealData == TRUE) {
|
||||
*length = coll->image->size;
|
||||
result = (uint8_t *)uprv_malloc(*length);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (result == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -525,7 +525,7 @@ ucol_cloneRuleData(const UCollator *coll, int32_t *length, UErrorCode *status)
|
||||
} else {
|
||||
*length = (int32_t)(paddedsize(sizeof(UCATableHeader))+paddedsize(sizeof(UColOptionSet)));
|
||||
result = (uint8_t *)uprv_malloc(*length);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (result == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -2927,7 +2927,7 @@ uint32_t ucol_prv_getSpecialPrevCE(const UCollator *coll, UChar ch, uint32_t CE,
|
||||
int32_t newsize = source->pos - source->string + 1;
|
||||
strbuffer = (UChar *)uprv_malloc(sizeof(UChar) *
|
||||
(newsize + UCOL_MAX_BUFFER));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (strbuffer == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return UCOL_NO_MORE_CES;
|
||||
@ -4202,7 +4202,7 @@ ucol_calcSortKey(const UCollator *coll,
|
||||
|
||||
if(allocateSKBuffer == TRUE) {
|
||||
*result = (uint8_t*)uprv_malloc(sortKeySize);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (*result == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -4539,7 +4539,7 @@ ucol_calcSortKeySimpleTertiary(const UCollator *coll,
|
||||
|
||||
if(allocateSKBuffer == TRUE) {
|
||||
*result = (uint8_t*)uprv_malloc(sortKeySize);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (*result == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -920,7 +920,7 @@ UCATableHeader *ucol_assembleTailoringTable(UColTokenParser *src, UErrorCode *st
|
||||
ensure that the script reordering will continue to work.
|
||||
*/
|
||||
UCATableHeader *image = (UCATableHeader *)uprv_malloc(sizeof(UCATableHeader));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (image == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
|
@ -237,7 +237,7 @@ ContractionTable *uprv_cnttab_cloneContraction(ContractionTable *t, UErrorCode *
|
||||
r->codePoints = (UChar *)uprv_malloc(sizeof(UChar)*t->size);
|
||||
r->CEs = (uint32_t *)uprv_malloc(sizeof(uint32_t)*t->size);
|
||||
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if((r->codePoints == NULL) || (r->CEs == NULL)) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -256,7 +256,7 @@ uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
|
||||
}
|
||||
int32_t i = 0;
|
||||
CntTable *r = (CntTable *)uprv_malloc(sizeof(CntTable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -268,7 +268,7 @@ uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
|
||||
r->mapping = t->mapping;
|
||||
|
||||
r->elements = (ContractionTable **)uprv_malloc(t->capacity*sizeof(ContractionTable *));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->elements == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -281,7 +281,7 @@ uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
|
||||
|
||||
if(t->CEs != NULL) {
|
||||
r->CEs = (uint32_t *)uprv_malloc(t->position*sizeof(uint32_t));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->CEs == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -293,7 +293,7 @@ uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
|
||||
|
||||
if(t->codePoints != NULL) {
|
||||
r->codePoints = (UChar *)uprv_malloc(t->position*sizeof(UChar));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->codePoints == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -305,7 +305,7 @@ uprv_cnttab_clone(CntTable *t, UErrorCode *status) {
|
||||
|
||||
if(t->offsets != NULL) {
|
||||
r->offsets = (int32_t *)uprv_malloc(t->size*sizeof(int32_t));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->offsets == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
|
@ -93,7 +93,7 @@ static int32_t uprv_uca_addExpansion(ExpansionTable *expansions, uint32_t value,
|
||||
}
|
||||
if(expansions->CEs == NULL) {
|
||||
expansions->CEs = (uint32_t *)uprv_malloc(INIT_EXP_TABLE_SIZE*sizeof(uint32_t));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (expansions->CEs == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -127,14 +127,14 @@ uhash_freeBlockWrapper(void *obj) {
|
||||
U_CAPI tempUCATable* U_EXPORT2
|
||||
uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UErrorCode *status) {
|
||||
tempUCATable *t = (tempUCATable *)uprv_malloc(sizeof(tempUCATable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (t == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
MaxExpansionTable *maxet = (MaxExpansionTable *)uprv_malloc(
|
||||
sizeof(MaxExpansionTable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (maxet == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete t;
|
||||
@ -142,7 +142,7 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
|
||||
}
|
||||
MaxJamoExpansionTable *maxjet = (MaxJamoExpansionTable *)uprv_malloc(
|
||||
sizeof(MaxJamoExpansionTable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (maxjet == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete t;
|
||||
@ -154,7 +154,7 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
|
||||
|
||||
t->UCA = UCA;
|
||||
t->expansions = (ExpansionTable *)uprv_malloc(sizeof(ExpansionTable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (t->expansions == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete t;
|
||||
@ -179,14 +179,14 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
|
||||
maxet->position = maxet->size - 1;
|
||||
maxet->endExpansionCE =
|
||||
(uint32_t *)uprv_malloc(sizeof(uint32_t) * maxet->size);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (maxet->endExpansionCE == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
maxet->expansionCESize =
|
||||
(uint8_t *)uprv_malloc(sizeof(uint8_t) * maxet->size);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (maxet->expansionCESize == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete maxet->endExpansionCE;
|
||||
@ -213,13 +213,13 @@ uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollat
|
||||
maxjet->maxTSize = 1;
|
||||
|
||||
t->unsafeCP = (uint8_t *)uprv_malloc(UCOL_UNSAFECP_TABLE_SIZE);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (t->unsafeCP == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
t->contrEndCP = (uint8_t *)uprv_malloc(UCOL_UNSAFECP_TABLE_SIZE);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (t->contrEndCP == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
delete t->unsafeCP;
|
||||
@ -237,7 +237,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
}
|
||||
|
||||
tempUCATable *r = (tempUCATable *)uprv_malloc(sizeof(tempUCATable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -257,7 +257,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
/* expansions */
|
||||
if(t->expansions != NULL) {
|
||||
r->expansions = (ExpansionTable *)uprv_malloc(sizeof(ExpansionTable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->expansions == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -266,7 +266,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
r->expansions->size = t->expansions->size;
|
||||
if(t->expansions->CEs != NULL) {
|
||||
r->expansions->CEs = (uint32_t *)uprv_malloc(sizeof(uint32_t)*t->expansions->size);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->expansions->CEs == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -284,7 +284,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
|
||||
if(t->maxExpansions != NULL) {
|
||||
r->maxExpansions = (MaxExpansionTable *)uprv_malloc(sizeof(MaxExpansionTable));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->maxExpansions == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -293,7 +293,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
r->maxExpansions->position = t->maxExpansions->position;
|
||||
if(t->maxExpansions->endExpansionCE != NULL) {
|
||||
r->maxExpansions->endExpansionCE = (uint32_t *)uprv_malloc(sizeof(uint32_t)*t->maxExpansions->size);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->maxExpansions->endExpansionCE == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -304,7 +304,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
}
|
||||
if(t->maxExpansions->expansionCESize != NULL) {
|
||||
r->maxExpansions->expansionCESize = (uint8_t *)uprv_malloc(sizeof(uint8_t)*t->maxExpansions->size);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->maxExpansions->expansionCESize == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -317,7 +317,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
|
||||
if(t->maxJamoExpansions != NULL) {
|
||||
r->maxJamoExpansions = (MaxJamoExpansionTable *)uprv_malloc(sizeof(MaxJamoExpansionTable));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (r->maxJamoExpansions == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -329,14 +329,14 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
r->maxJamoExpansions->maxTSize = t->maxJamoExpansions->maxTSize;
|
||||
if(t->maxJamoExpansions->size != 0) {
|
||||
r->maxJamoExpansions->endExpansionCE = (uint32_t *)uprv_malloc(sizeof(uint32_t)*t->maxJamoExpansions->size);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (r->maxJamoExpansions->endExpansionCE == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
uprv_memcpy(r->maxJamoExpansions->endExpansionCE, t->maxJamoExpansions->endExpansionCE, t->maxJamoExpansions->size*sizeof(uint32_t));
|
||||
r->maxJamoExpansions->isV = (UBool *)uprv_malloc(sizeof(UBool)*t->maxJamoExpansions->size);
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (r->maxJamoExpansions->isV == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -350,7 +350,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
|
||||
if(t->unsafeCP != NULL) {
|
||||
r->unsafeCP = (uint8_t *)uprv_malloc(UCOL_UNSAFECP_TABLE_SIZE);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (r->unsafeCP == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -360,7 +360,7 @@ uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status) {
|
||||
|
||||
if(t->contrEndCP != NULL) {
|
||||
r->contrEndCP = (uint8_t *)uprv_malloc(UCOL_UNSAFECP_TABLE_SIZE);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (r->contrEndCP == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -425,7 +425,7 @@ int uprv_uca_setMaxExpansion(uint32_t endexpansion,
|
||||
/* we'll always make the first element 0, for easier manipulation */
|
||||
maxexpansion->endExpansionCE =
|
||||
(uint32_t *)uprv_malloc(INIT_EXP_TABLE_SIZE * sizeof(int32_t));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (maxexpansion->endExpansionCE == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -433,7 +433,7 @@ int uprv_uca_setMaxExpansion(uint32_t endexpansion,
|
||||
*(maxexpansion->endExpansionCE) = 0;
|
||||
maxexpansion->expansionCESize =
|
||||
(uint8_t *)uprv_malloc(INIT_EXP_TABLE_SIZE * sizeof(uint8_t));
|
||||
//test for NULL;
|
||||
/* test for NULL */;
|
||||
if (maxexpansion->expansionCESize == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -593,7 +593,7 @@ int uprv_uca_setMaxJamoExpansion(UChar ch,
|
||||
/* we'll always make the first element 0, for easier manipulation */
|
||||
maxexpansion->endExpansionCE =
|
||||
(uint32_t *)uprv_malloc(INIT_EXP_TABLE_SIZE * sizeof(uint32_t));
|
||||
//test for NULL;
|
||||
/* test for NULL */;
|
||||
if (maxexpansion->endExpansionCE == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -601,7 +601,7 @@ int uprv_uca_setMaxJamoExpansion(UChar ch,
|
||||
*(maxexpansion->endExpansionCE) = 0;
|
||||
maxexpansion->isV =
|
||||
(UBool *)uprv_malloc(INIT_EXP_TABLE_SIZE * sizeof(UBool));
|
||||
//test for NULL;
|
||||
/* test for NULL */;
|
||||
if (maxexpansion->isV == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -1101,7 +1101,7 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
|
||||
// for canonical closure.
|
||||
|
||||
UCAElements *composed = (UCAElements *)uprv_malloc(sizeof(UCAElements));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (composed == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -1120,7 +1120,7 @@ uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status)
|
||||
} else { // no code points, so this spot is clean
|
||||
element->mapCE = uprv_uca_addPrefix(t, UCOL_NOT_FOUND, element, status);
|
||||
uCE = (UCAElements *)uprv_malloc(sizeof(UCAElements));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (uCE == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
@ -1341,7 +1341,7 @@ uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status) {
|
||||
|
||||
|
||||
dataStart = (uint8_t *)uprv_malloc(toAllocate);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (dataStart == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
|
@ -148,7 +148,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
|
||||
uprv_memset(src, 0, sizeof(UColTokenParser));
|
||||
|
||||
src->source = (UChar *)uprv_malloc(estimatedSize*sizeof(UChar));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (src->source == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -157,7 +157,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
|
||||
if(nSize > estimatedSize || *status == U_BUFFER_OVERFLOW_ERROR) {
|
||||
*status = U_ZERO_ERROR;
|
||||
src->source = (UChar *)uprv_realloc(src->source, (nSize+UCOL_TOK_EXTRA_RULE_SPACE_SIZE)*sizeof(UChar));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (src->source == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -193,7 +193,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
|
||||
uhash_setValueDeleter(src->tailored, uhash_freeBlock);
|
||||
|
||||
src->opts = (UColOptionSet *)uprv_malloc(sizeof(UColOptionSet));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (src->opts == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -204,7 +204,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
|
||||
// rulesToParse = src->source;
|
||||
src->lh = 0;
|
||||
src->lh = (UColTokListHeader *)uprv_malloc(512*sizeof(UColTokListHeader));
|
||||
//Test for NULL
|
||||
/* test for NULL */
|
||||
if (src->lh == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
@ -966,7 +966,7 @@ static UColToken *ucol_tok_initAReset(UColTokenParser *src, UChar *expand, uint3
|
||||
UParseError *parseError, UErrorCode *status) {
|
||||
/* do the reset thing */
|
||||
UColToken *sourceToken = (UColToken *)uprv_malloc(sizeof(UColToken));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (sourceToken == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
@ -1164,7 +1164,7 @@ uint32_t ucol_tok_assembleTokenList(UColTokenParser *src, UParseError *parseErro
|
||||
if(sourceToken == NULL) {
|
||||
/* If sourceToken is null, create new one, */
|
||||
sourceToken = (UColToken *)uprv_malloc(sizeof(UColToken));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (sourceToken == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
|
@ -53,7 +53,7 @@ ucol_openElements(const UCollator *coll,
|
||||
}
|
||||
|
||||
result = (UCollationElements *)uprv_malloc(sizeof(UCollationElements));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (result == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
|
@ -327,7 +327,7 @@ utrans_setFilter(UTransliterator* trans,
|
||||
// Create read only alias of filterPattern:
|
||||
UnicodeString pat(filterPatternLen < 0, filterPattern, filterPatternLen);
|
||||
filter = new UnicodeSet(pat, *status);
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if (filter == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
|
@ -291,11 +291,11 @@ inline int32_t ICULayoutEngine::layoutString(const UnicodeString &str,
|
||||
int32_t max = str.length();
|
||||
UChar *chars = new UChar[max];
|
||||
|
||||
//test for NULL
|
||||
if(chars == NULL) {
|
||||
success = (UErrorCode) LE_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
/* test for NULL */
|
||||
if(chars == 0) {
|
||||
success = U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
str.extract(0, max, chars);
|
||||
|
||||
|
@ -319,8 +319,8 @@ void gentz::fixupNameToEquiv() {
|
||||
|
||||
// First make a list that maps indices to offsets
|
||||
uint32_t *offsets = (uint32_t*) uprv_malloc(sizeof(uint32_t) * equivCount);
|
||||
//test for NULL
|
||||
if(offsets == 0) {
|
||||
/* test for NULL */
|
||||
if(offsets == NULL) {
|
||||
die("Out of memory");
|
||||
}
|
||||
offsets[0] = header.equivTableDelta;
|
||||
|
@ -598,14 +598,14 @@ write_uca_table(const char *filename,
|
||||
UCAElements *element = NULL;
|
||||
UChar variableTopValue = 0;
|
||||
UCATableHeader *myD = (UCATableHeader *)uprv_malloc(sizeof(UCATableHeader));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(myD == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
fclose(data);
|
||||
return 0;
|
||||
}
|
||||
UColOptionSet *opts = (UColOptionSet *)uprv_malloc(sizeof(UColOptionSet));
|
||||
//test for NULL
|
||||
/* test for NULL */
|
||||
if(opts == NULL) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
uprv_free(myD);
|
||||
|
Loading…
Reference in New Issue
Block a user