ICU-96 if the tailoring has no contractions, don't write them out (and don't malloc(0))

X-SVN-Rev: 4116
This commit is contained in:
Vladimir Weinstein 2001-03-15 23:07:38 +00:00
parent 8939476885
commit 990542a318
2 changed files with 16 additions and 11 deletions

View File

@ -87,7 +87,7 @@ int32_t uprv_cnttab_moveTable(CntTable *table, uint32_t oldOffset, uint32_t newO
int32_t uprv_cnttab_constructTable(CntTable *table, uint32_t mainOffset, UErrorCode *status) {
int32_t i = 0, j = 0;
if(U_FAILURE(*status)) {
if(U_FAILURE(*status) || table->size == 0) {
return 0;
}

View File

@ -552,17 +552,22 @@ UCATableHeader *uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status) {
tableOffset += paddedsize(expansions->position*sizeof(uint32_t));
/* contractions block */
/* copy contraction index */
/*myData->contractionIndex = (UChar *)(dataStart+tableOffset);*/
myData->contractionIndex = tableOffset;
memcpy(dataStart+tableOffset, contractions->codePoints, contractionsSize*sizeof(UChar));
tableOffset += paddedsize(contractionsSize*sizeof(UChar));
if(contractionsSize != 0) {
/* copy contraction index */
/*myData->contractionIndex = (UChar *)(dataStart+tableOffset);*/
myData->contractionIndex = tableOffset;
memcpy(dataStart+tableOffset, contractions->codePoints, contractionsSize*sizeof(UChar));
tableOffset += paddedsize(contractionsSize*sizeof(UChar));
/* copy contraction collation elements */
/*myData->contractionCEs = (uint32_t *)(dataStart+tableOffset);*/
myData->contractionCEs = tableOffset;
memcpy(dataStart+tableOffset, contractions->CEs, contractionsSize*sizeof(uint32_t));
tableOffset += paddedsize(contractionsSize*sizeof(uint32_t));
/* copy contraction collation elements */
/*myData->contractionCEs = (uint32_t *)(dataStart+tableOffset);*/
myData->contractionCEs = tableOffset;
memcpy(dataStart+tableOffset, contractions->CEs, contractionsSize*sizeof(uint32_t));
tableOffset += paddedsize(contractionsSize*sizeof(uint32_t));
} else {
myData->contractionIndex = 0;
myData->contractionIndex = 0;
}
/* copy mapping table */
/*myData->mappingPosition = dataStart+tableOffset;*/