ICU-3905 Fix some compiler warnings, and reduce the amount of duplicate data in the libraries.
X-SVN-Rev: 16211
This commit is contained in:
parent
e15fa2960f
commit
1fcd7ea903
@ -84,15 +84,15 @@ isAcceptableUCA(void * /*context*/,
|
||||
if( pInfo->size>=20 &&
|
||||
pInfo->isBigEndian==U_IS_BIG_ENDIAN &&
|
||||
pInfo->charsetFamily==U_CHARSET_FAMILY &&
|
||||
pInfo->dataFormat[0]==ucaDataInfo.dataFormat[0] && /* dataFormat="UCol" */
|
||||
pInfo->dataFormat[1]==ucaDataInfo.dataFormat[1] &&
|
||||
pInfo->dataFormat[2]==ucaDataInfo.dataFormat[2] &&
|
||||
pInfo->dataFormat[3]==ucaDataInfo.dataFormat[3] &&
|
||||
pInfo->formatVersion[0]==ucaDataInfo.formatVersion[0] &&
|
||||
pInfo->formatVersion[1]>=ucaDataInfo.formatVersion[1]// &&
|
||||
//pInfo->formatVersion[1]==ucaDataInfo.formatVersion[1] &&
|
||||
//pInfo->formatVersion[2]==ucaDataInfo.formatVersion[2] && // Too harsh
|
||||
//pInfo->formatVersion[3]==ucaDataInfo.formatVersion[3] && // Too harsh
|
||||
pInfo->dataFormat[0]==UCA_DATA_FORMAT_0 && /* dataFormat="UCol" */
|
||||
pInfo->dataFormat[1]==UCA_DATA_FORMAT_1 &&
|
||||
pInfo->dataFormat[2]==UCA_DATA_FORMAT_2 &&
|
||||
pInfo->dataFormat[3]==UCA_DATA_FORMAT_3 &&
|
||||
pInfo->formatVersion[0]==UCA_FORMAT_VERSION_0 &&
|
||||
pInfo->formatVersion[1]>=UCA_FORMAT_VERSION_1// &&
|
||||
//pInfo->formatVersion[1]==UCA_FORMAT_VERSION_1 &&
|
||||
//pInfo->formatVersion[2]==UCA_FORMAT_VERSION_2 && // Too harsh
|
||||
//pInfo->formatVersion[3]==UCA_FORMAT_VERSION_3 && // Too harsh
|
||||
) {
|
||||
UVersionInfo UCDVersion;
|
||||
u_getUnicodeVersion(UCDVersion);
|
||||
|
@ -40,15 +40,15 @@ isAcceptableInvUCA(void * /*context*/,
|
||||
if( pInfo->size>=20 &&
|
||||
pInfo->isBigEndian==U_IS_BIG_ENDIAN &&
|
||||
pInfo->charsetFamily==U_CHARSET_FAMILY &&
|
||||
pInfo->dataFormat[0]==invUcaDataInfo.dataFormat[0] && /* dataFormat="InvC" */
|
||||
pInfo->dataFormat[1]==invUcaDataInfo.dataFormat[1] &&
|
||||
pInfo->dataFormat[2]==invUcaDataInfo.dataFormat[2] &&
|
||||
pInfo->dataFormat[3]==invUcaDataInfo.dataFormat[3] &&
|
||||
pInfo->formatVersion[0]==invUcaDataInfo.formatVersion[0] &&
|
||||
pInfo->formatVersion[1]>=invUcaDataInfo.formatVersion[1] //&&
|
||||
//pInfo->formatVersion[1]==invUcaDataInfo.formatVersion[1] &&
|
||||
//pInfo->formatVersion[2]==invUcaDataInfo.formatVersion[2] &&
|
||||
//pInfo->formatVersion[3]==invUcaDataInfo.formatVersion[3] &&
|
||||
pInfo->dataFormat[0]==INVUCA_DATA_FORMAT_0 && /* dataFormat="InvC" */
|
||||
pInfo->dataFormat[1]==INVUCA_DATA_FORMAT_1 &&
|
||||
pInfo->dataFormat[2]==INVUCA_DATA_FORMAT_2 &&
|
||||
pInfo->dataFormat[3]==INVUCA_DATA_FORMAT_3 &&
|
||||
pInfo->formatVersion[0]==INVUCA_FORMAT_VERSION_0 &&
|
||||
pInfo->formatVersion[1]>=INVUCA_FORMAT_VERSION_1 //&&
|
||||
//pInfo->formatVersion[1]==INVUCA_FORMAT_VERSION_1 &&
|
||||
//pInfo->formatVersion[2]==INVUCA_FORMAT_VERSION_2 &&
|
||||
//pInfo->formatVersion[3]==INVUCA_FORMAT_VERSION_3 &&
|
||||
) {
|
||||
UVersionInfo UCDVersion;
|
||||
u_getUnicodeVersion(UCDVersion);
|
||||
|
@ -1357,7 +1357,10 @@ uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status) {
|
||||
myData->magic = UCOL_HEADER_MAGIC;
|
||||
myData->isBigEndian = U_IS_BIG_ENDIAN;
|
||||
myData->charSetFamily = U_CHARSET_FAMILY;
|
||||
uprv_memcpy(myData->formatVersion, ucaDataInfo.formatVersion, sizeof(UVersionInfo));
|
||||
myData->formatVersion[0] = UCA_FORMAT_VERSION_0;
|
||||
myData->formatVersion[1] = UCA_FORMAT_VERSION_1;
|
||||
myData->formatVersion[2] = UCA_FORMAT_VERSION_2;
|
||||
myData->formatVersion[3] = UCA_FORMAT_VERSION_3;
|
||||
myData->jamoSpecial = t->image->jamoSpecial;
|
||||
|
||||
// Don't copy stuff from UCA header!
|
||||
|
@ -170,42 +170,28 @@
|
||||
#define UCOL_HEADER_MAGIC 0x20030618
|
||||
|
||||
/* UDataInfo for UCA mapping table */
|
||||
static const UDataInfo ucaDataInfo={
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
/* dataFormat="UCol" */
|
||||
#define UCA_DATA_FORMAT_0 ((uint8_t)0x55)
|
||||
#define UCA_DATA_FORMAT_1 ((uint8_t)0x43)
|
||||
#define UCA_DATA_FORMAT_2 ((uint8_t)0x6f)
|
||||
#define UCA_DATA_FORMAT_3 ((uint8_t)0x6c)
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
sizeof(UChar),
|
||||
0,
|
||||
|
||||
{0x55, 0x43, 0x6f, 0x6c}, /* dataFormat="UCol" */
|
||||
/* 03/26/2002 bumped up version since format has changed */
|
||||
/* 09/16/2002 bumped up version since we went from UColAttributeValue */
|
||||
/* to int32_t in UColOptionSet */
|
||||
/* 05/13/2003 This one also updated since we added UCA and UCD versions */
|
||||
/* to header */
|
||||
/* 09/11/2003 Adding information required by data swapper */
|
||||
{2, 3, 0, 0}, /* formatVersion */
|
||||
{3, 0, 0, 0} /* dataVersion = Unicode Version*/
|
||||
};
|
||||
#define UCA_FORMAT_VERSION_0 ((uint8_t)2)
|
||||
#define UCA_FORMAT_VERSION_1 ((uint8_t)3)
|
||||
#define UCA_FORMAT_VERSION_2 ((uint8_t)0)
|
||||
#define UCA_FORMAT_VERSION_3 ((uint8_t)0)
|
||||
|
||||
/* UDataInfo for inverse UCA table */
|
||||
static const UDataInfo invUcaDataInfo={
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
/* dataFormat="InvC" */
|
||||
#define INVUCA_DATA_FORMAT_0 ((uint8_t)0x49)
|
||||
#define INVUCA_DATA_FORMAT_1 ((uint8_t)0x6E)
|
||||
#define INVUCA_DATA_FORMAT_2 ((uint8_t)0x76)
|
||||
#define INVUCA_DATA_FORMAT_3 ((uint8_t)0x43)
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
sizeof(UChar),
|
||||
0,
|
||||
|
||||
{0x49, 0x6E, 0x76, 0x43}, /* dataFormat="InvC" */
|
||||
/* 03/26/2002 bumped up version since format has changed */
|
||||
/* 04/29/2003 2.1 format - we have added UCA version to header */
|
||||
{2, 1, 0, 0}, /* formatVersion */
|
||||
{3, 0, 0, 0} /* dataVersion = Unicode Version*/
|
||||
};
|
||||
#define INVUCA_FORMAT_VERSION_0 ((uint8_t)2)
|
||||
#define INVUCA_FORMAT_VERSION_1 ((uint8_t)1)
|
||||
#define INVUCA_FORMAT_VERSION_2 ((uint8_t)0)
|
||||
#define INVUCA_FORMAT_VERSION_3 ((uint8_t)0)
|
||||
|
||||
/* This is the size of the stack allocated buffer for sortkey generation and similar operations */
|
||||
/* if it is too small, heap allocation will occur.*/
|
||||
|
@ -61,6 +61,42 @@ static UDataInfo dummyDataInfo = {
|
||||
|
||||
#else
|
||||
|
||||
static const UDataInfo ucaDataInfo={
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
sizeof(UChar),
|
||||
0,
|
||||
|
||||
{UCA_DATA_FORMAT_0, UCA_DATA_FORMAT_1, UCA_DATA_FORMAT_2, UCA_DATA_FORMAT_3}, /* dataFormat="UCol" */
|
||||
/* 03/26/2002 bumped up version since format has changed */
|
||||
/* 09/16/2002 bumped up version since we went from UColAttributeValue */
|
||||
/* to int32_t in UColOptionSet */
|
||||
/* 05/13/2003 This one also updated since we added UCA and UCD versions */
|
||||
/* to header */
|
||||
/* 09/11/2003 Adding information required by data swapper */
|
||||
{UCA_FORMAT_VERSION_0, UCA_FORMAT_VERSION_1, UCA_FORMAT_VERSION_2, UCA_FORMAT_VERSION_3}, /* formatVersion */
|
||||
{0, 0, 0, 0} /* dataVersion = Unicode Version*/
|
||||
};
|
||||
|
||||
static const UDataInfo invUcaDataInfo={
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
sizeof(UChar),
|
||||
0,
|
||||
|
||||
{INVUCA_DATA_FORMAT_0, INVUCA_DATA_FORMAT_1, INVUCA_DATA_FORMAT_2, INVUCA_DATA_FORMAT_3}, /* dataFormat="InvC" */
|
||||
/* 03/26/2002 bumped up version since format has changed */
|
||||
/* 04/29/2003 2.1 format - we have added UCA version to header */
|
||||
{INVUCA_FORMAT_VERSION_0, INVUCA_FORMAT_VERSION_1, INVUCA_FORMAT_VERSION_2, INVUCA_FORMAT_VERSION_3}, /* formatVersion */
|
||||
{0, 0, 0, 0} /* dataVersion = Unicode Version*/
|
||||
};
|
||||
|
||||
UCAElements le;
|
||||
|
||||
int32_t readElement(char **from, char *to, char separator, UErrorCode *status) {
|
||||
@ -1046,7 +1082,7 @@ int main(int argc, char* argv[]) {
|
||||
#if UCONFIG_NO_COLLATION
|
||||
0, 0
|
||||
#else
|
||||
ucaDataInfo.formatVersion[0], ucaDataInfo.formatVersion[1]
|
||||
UCA_FORMAT_VERSION_0, UCA_FORMAT_VERSION_1
|
||||
#endif
|
||||
);
|
||||
fprintf(stdout, U_COPYRIGHT_STRING"\n");
|
||||
|
Loading…
Reference in New Issue
Block a user