diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index ace6fd5e68..7ad49621d4 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -66,15 +66,18 @@ isAcceptableUCA(void * /*context*/, if( pInfo->size>=20 && pInfo->isBigEndian==U_IS_BIG_ENDIAN && pInfo->charsetFamily==U_CHARSET_FAMILY && - pInfo->dataFormat[0]==0x55 && /* dataFormat="UCol" */ - pInfo->dataFormat[1]==0x43 && - pInfo->dataFormat[2]==0x6f && - pInfo->dataFormat[3]==0x6c && - pInfo->formatVersion[0]==1 && - pInfo->dataVersion[0]==3 && - pInfo->dataVersion[1]==0 && - pInfo->dataVersion[2]==0 && - pInfo->dataVersion[3]==0) { + 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[2]==ucaDataInfo.formatVersion[2] && + pInfo->formatVersion[3]==ucaDataInfo.formatVersion[3] && + pInfo->dataVersion[0]==ucaDataInfo.dataVersion[0] && + pInfo->dataVersion[1]==ucaDataInfo.dataVersion[1] && + pInfo->dataVersion[2]==ucaDataInfo.dataVersion[2] && + pInfo->dataVersion[3]==ucaDataInfo.dataVersion[3]) { return TRUE; } else { return FALSE; diff --git a/icu4c/source/i18n/ucol_bld.cpp b/icu4c/source/i18n/ucol_bld.cpp index 5e0321cb85..69db037f37 100644 --- a/icu4c/source/i18n/ucol_bld.cpp +++ b/icu4c/source/i18n/ucol_bld.cpp @@ -33,15 +33,18 @@ isAcceptableInvUCA(void * /*context*/, if( pInfo->size>=20 && pInfo->isBigEndian==U_IS_BIG_ENDIAN && pInfo->charsetFamily==U_CHARSET_FAMILY && - pInfo->dataFormat[0]==0x49 && /* dataFormat="InvC" */ - pInfo->dataFormat[1]==0x6e && - pInfo->dataFormat[2]==0x76 && - pInfo->dataFormat[3]==0x43 && - pInfo->formatVersion[0]==1 && - pInfo->dataVersion[0]==3 && - pInfo->dataVersion[1]==0 && - pInfo->dataVersion[2]==0 && - pInfo->dataVersion[3]==0) { + 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]==ucaDataInfo.formatVersion[0] && + pInfo->formatVersion[1]==ucaDataInfo.formatVersion[1] && + pInfo->formatVersion[2]==ucaDataInfo.formatVersion[2] && + pInfo->formatVersion[3]==ucaDataInfo.formatVersion[3] && + pInfo->dataVersion[0]==invUcaDataInfo.dataVersion[0] && + pInfo->dataVersion[1]==invUcaDataInfo.dataVersion[1] && + pInfo->dataVersion[2]==invUcaDataInfo.dataVersion[2] && + pInfo->dataVersion[3]==invUcaDataInfo.dataVersion[3]) { return TRUE; } else { return FALSE; diff --git a/icu4c/source/i18n/ucol_imp.h b/icu4c/source/i18n/ucol_imp.h index 23c084664a..5059588dd1 100644 --- a/icu4c/source/i18n/ucol_imp.h +++ b/icu4c/source/i18n/ucol_imp.h @@ -31,6 +31,36 @@ #include "unicode/ures.h" #include "unicode/udata.h" +/* UDataInfo for UCA mapping table */ +static const UDataInfo ucaDataInfo={ + sizeof(UDataInfo), + 0, + + U_IS_BIG_ENDIAN, + U_CHARSET_FAMILY, + sizeof(UChar), + 0, + + {0x55, 0x43, 0x6f, 0x6c}, /* dataFormat="UCol" */ + {1, 1, 0, 0}, /* formatVersion */ + {3, 0, 0, 0} /* dataVersion = Unicode Version*/ +}; + +/* UDataInfo for inverse UCA table */ +static const UDataInfo invUcaDataInfo={ + sizeof(UDataInfo), + 0, + + U_IS_BIG_ENDIAN, + U_CHARSET_FAMILY, + sizeof(UChar), + 0, + + {0x49, 0x6E, 0x76, 0x43}, /* dataFormat="InvC" */ + {1, 1, 0, 0}, /* formatVersion */ + {3, 0, 0, 0} /* dataVersion = Unicode Version*/ +}; + /* This is the size of the stack allocated buffer for sortkey generation and similar operations */ /* if it is too small, heap allocation will occur.*/ /* you can change this value if you need memory - it will affect the performance, though, since we're going to malloc */ diff --git a/icu4c/source/tools/genuca/genuca.cpp b/icu4c/source/tools/genuca/genuca.cpp index 2a8639248c..488317fd83 100644 --- a/icu4c/source/tools/genuca/genuca.cpp +++ b/icu4c/source/tools/genuca/genuca.cpp @@ -302,7 +302,7 @@ static void writeOutInverseData(InverseTableHeader *data, long dataLength; - pData=udata_create(outputDir, INVC_DATA_TYPE, INVC_DATA_NAME, &invDataInfo, + pData=udata_create(outputDir, INVC_DATA_TYPE, INVC_DATA_NAME, &invUcaDataInfo, copyright, status); if(U_FAILURE(*status)) { @@ -538,7 +538,7 @@ void writeOutData(UCATableHeader *data, long dataLength; - pData=udata_create(outputDir, UCA_DATA_TYPE, UCA_DATA_NAME, &dataInfo, + pData=udata_create(outputDir, UCA_DATA_TYPE, UCA_DATA_NAME, &ucaDataInfo, copyright, status); if(U_FAILURE(*status)) { @@ -735,7 +735,7 @@ int main(int argc, char* argv[]) { if(options[3].doesOccur) { fprintf(stdout, "genuca version %hu.%hu, ICU tool to read UCA text data and create UCA data tables for collation.\n", - dataInfo.formatVersion[0], dataInfo.formatVersion[1]); + ucaDataInfo.formatVersion[0], ucaDataInfo.formatVersion[1]); fprintf(stdout, "Copyright (C) 2000-2001, International Business Machines\n"); fprintf(stdout, "Corporation and others. All Rights Reserved.\n"); exit(0); diff --git a/icu4c/source/tools/genuca/genuca.h b/icu4c/source/tools/genuca/genuca.h index 09897f4ac6..404067b5b5 100644 --- a/icu4c/source/tools/genuca/genuca.h +++ b/icu4c/source/tools/genuca/genuca.h @@ -32,36 +32,6 @@ #include "umemstrm.h" #include "unewdata.h" -/* UDataInfo for UCA mapping table */ -static const UDataInfo dataInfo={ - sizeof(UDataInfo), - 0, - - U_IS_BIG_ENDIAN, - U_CHARSET_FAMILY, - sizeof(UChar), - 0, - - {0x55, 0x43, 0x6f, 0x6c}, /* dataFormat="UCol" */ - {1, 0, 0, 0}, /* formatVersion */ - {3, 0, 0, 0} /* dataVersion = Unicode Version*/ -}; - -/* UDataInfo for inverse UCA table */ -static const UDataInfo invDataInfo={ - sizeof(UDataInfo), - 0, - - U_IS_BIG_ENDIAN, - U_CHARSET_FAMILY, - sizeof(UChar), - 0, - - {0x49, 0x6E, 0x76, 0x43}, /* dataFormat="InvC" */ - {1, 0, 0, 0}, /* formatVersion */ - {3, 0, 0, 0} /* dataVersion = Unicode Version*/ -}; - void deleteElement(void *element); int32_t readElement(char **from, char *to, char separator, UErrorCode *status);