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