ICU-3353 initialize allocated memory

X-SVN-Rev: 13562
This commit is contained in:
Vladimir Weinstein 2003-11-04 18:56:31 +00:00
parent a7927d5799
commit bdd48cb6c6
2 changed files with 8 additions and 1 deletions

View File

@ -1632,6 +1632,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
uprv_memset(src->source, 0, estimatedSize*sizeof(UChar));
nSize = unorm_normalize(rules, rulesLength, UNORM_NFD, 0, src->source, estimatedSize, status);
if(nSize > estimatedSize || *status == U_BUFFER_OVERFLOW_ERROR) {
*status = U_ZERO_ERROR;
@ -1676,6 +1677,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
uprv_memset(src->opts, 0, sizeof(UColOptionSet));
uprv_memcpy(src->opts, UCA->options, sizeof(UColOptionSet));
@ -1688,6 +1690,7 @@ void ucol_tok_initTokenList(UColTokenParser *src, const UChar *rules, const uint
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
uprv_memset(src->lh, 0, src->listCapacity*sizeof(UColTokListHeader));
src->resultLen = 0;
UCAConstants *consts = (UCAConstants *)((uint8_t *)src->UCA->image + src->UCA->image->UCAConsts);

View File

@ -305,6 +305,7 @@ static InverseUCATableHeader *assembleInverseTable(UErrorCode *status)
uint32_t i = 0;
result = (InverseUCATableHeader *)uprv_malloc(headerByteSize + inverseTableByteSize + contsByteSize);
uprv_memset(result, 0, headerByteSize + inverseTableByteSize + contsByteSize);
if(result != NULL) {
result->byteSize = headerByteSize + inverseTableByteSize + contsByteSize;
@ -750,6 +751,7 @@ write_uca_table(const char *filename,
fclose(data);
return 0;
}
uprv_memset(myD, 0, sizeof(UCATableHeader));
UColOptionSet *opts = (UColOptionSet *)uprv_malloc(sizeof(UColOptionSet));
/* test for NULL */
if(opts == NULL) {
@ -758,7 +760,9 @@ write_uca_table(const char *filename,
fclose(data);
return 0;
}
uprv_memset(opts, 0, sizeof(UColOptionSet));
UChar contractionCEs[256][3];
uprv_memset(contractionCEs, 0, 256*3*sizeof(UChar));
uint32_t noOfContractions = 0;
UCAConstants consts;
#if 0
@ -799,7 +803,7 @@ write_uca_table(const char *filename,
return -1;
}
memset(inverseTable, 0xDA, sizeof(int32_t)*3*0xFFFF);
uprv_memset(inverseTable, 0xDA, sizeof(int32_t)*3*0xFFFF);
opts->variableTopValue = variableTopValue;
opts->strength = UCOL_TERTIARY;