ICU-2235 fix generation of options-only collation tailoring binaries

X-SVN-Rev: 13144
This commit is contained in:
Markus Scherer 2003-09-18 23:18:23 +00:00
parent 100749a525
commit 2b352413b0

View File

@ -687,7 +687,37 @@ ucol_cloneRuleData(const UCollator *coll, int32_t *length, UErrorCode *status)
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memcpy(result, UCA->image, sizeof(UCATableHeader));
/* build the UCATableHeader with minimal entries */
/* do not copy the header from the UCA file because its values are wrong! */
/* uprv_memcpy(result, UCA->image, sizeof(UCATableHeader)); */
/* reset everything */
uprv_memset(result, 0, *length);
/* set the tailoring-specific values */
UCATableHeader *myData = (UCATableHeader *)result;
myData->size = *length;
/* offset for the options, the only part of the data that is present after the header */
myData->options = sizeof(UCATableHeader);
/* need to always set the expansion value for an upper bound of the options */
myData->expansion = myData->options + sizeof(UColOptionSet);
myData->magic = UCOL_HEADER_MAGIC;
myData->isBigEndian = U_IS_BIG_ENDIAN;
myData->charSetFamily = U_CHARSET_FAMILY;
/* copy UCA's version; genrb will override all but the builder version with tailoring data */
uprv_memcpy(myData->version, coll->image->version, sizeof(UVersionInfo));
uprv_memcpy(myData->UCAVersion, coll->image->UCAVersion, sizeof(UVersionInfo));
uprv_memcpy(myData->UCDVersion, coll->image->UCDVersion, sizeof(UVersionInfo));
uprv_memcpy(myData->formatVersion, coll->image->formatVersion, sizeof(UVersionInfo));
myData->jamoSpecial = coll->image->jamoSpecial;
/* copy the collator options */
uprv_memcpy(result+paddedsize(sizeof(UCATableHeader)), coll->options, sizeof(UColOptionSet));
}
return result;