ICU-21170 Fix function prototypes
This commit is contained in:
parent
8727c56501
commit
de0306daaa
@ -886,7 +886,7 @@ typedef struct DefaultTZInfo {
|
||||
* It is currently use to compare two TZ files.
|
||||
*/
|
||||
static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFileName, DefaultTZInfo* tzInfo) {
|
||||
FILE* file;
|
||||
FILE* file;
|
||||
int64_t sizeFile;
|
||||
int64_t sizeFileLeft;
|
||||
int32_t sizeFileRead;
|
||||
@ -1044,7 +1044,7 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
|
||||
#endif
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uprv_tzname_clear_cache()
|
||||
uprv_tzname_clear_cache(void)
|
||||
{
|
||||
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
|
||||
gTimeZoneBufferPtr = NULL;
|
||||
@ -1091,10 +1091,10 @@ uprv_tzname(int n)
|
||||
&& uprv_strcmp(tzid, TZ_ENV_CHECK) != 0
|
||||
#endif
|
||||
) {
|
||||
/* The colon forces tzset() to treat the remainder as zoneinfo path */
|
||||
if (tzid[0] == ':') {
|
||||
tzid++;
|
||||
}
|
||||
/* The colon forces tzset() to treat the remainder as zoneinfo path */
|
||||
if (tzid[0] == ':') {
|
||||
tzid++;
|
||||
}
|
||||
/* This might be a good Olson ID. */
|
||||
skipZoneIDPrefix(&tzid);
|
||||
return tzid;
|
||||
@ -1115,7 +1115,7 @@ uprv_tzname(int n)
|
||||
int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
|
||||
gTimeZoneBuffer[ret] = 0;
|
||||
char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
|
||||
|
||||
|
||||
if (tzZoneInfoTailPtr != NULL
|
||||
&& isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
|
||||
{
|
||||
@ -1445,7 +1445,7 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#define TO_STRING(x) TO_STRING_2(x)
|
||||
#define TO_STRING(x) TO_STRING_2(x)
|
||||
#define TO_STRING_2(x) #x
|
||||
|
||||
static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
|
||||
@ -1552,7 +1552,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
|
||||
{
|
||||
/* Maybe we got some garbage. Try something more reasonable */
|
||||
posixID = getenv("LC_ALL");
|
||||
/* Solaris speaks POSIX - See IEEE Std 1003.1-2008
|
||||
/* Solaris speaks POSIX - See IEEE Std 1003.1-2008
|
||||
* This is needed to properly handle empty env. variables
|
||||
*/
|
||||
#if U_PLATFORM == U_PF_SOLARIS
|
||||
@ -1563,7 +1563,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
|
||||
if (posixID == 0) {
|
||||
posixID = getenv(category == LC_MESSAGES ? "LC_MESSAGES" : "LC_CTYPE");
|
||||
if (posixID == 0) {
|
||||
#endif
|
||||
#endif
|
||||
posixID = getenv("LANG");
|
||||
}
|
||||
}
|
||||
@ -1671,7 +1671,7 @@ The leftmost codepage (.xxx) wins.
|
||||
// (The "C"/"POSIX" case is handled in uprv_getPOSIXIDForCategory())
|
||||
uprv_strcpy(correctedPOSIXLocale, "en_US_POSIX");
|
||||
}
|
||||
|
||||
|
||||
/* Note that we scan the *uncorrected* ID. */
|
||||
const char *p;
|
||||
if ((p = uprv_strrchr(posixID, '@')) != nullptr) {
|
||||
@ -2092,7 +2092,7 @@ int_getDefaultCodepage()
|
||||
#endif
|
||||
// Special case for UTF-8
|
||||
if (codepageNumber == 65001)
|
||||
{
|
||||
{
|
||||
return "UTF-8";
|
||||
}
|
||||
// Windows codepages can look like windows-1252, so format the found number
|
||||
@ -2285,7 +2285,7 @@ u_getVersion(UVersionInfo versionArray) {
|
||||
}
|
||||
|
||||
/**
|
||||
* icucfg.h dependent code
|
||||
* icucfg.h dependent code
|
||||
*/
|
||||
|
||||
#if U_ENABLE_DYLOAD && HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API
|
||||
@ -2345,15 +2345,15 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
HMODULE lib = NULL;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
|
||||
|
||||
lib = LoadLibraryA(libName);
|
||||
|
||||
|
||||
if(lib==NULL) {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
return (void*)lib;
|
||||
}
|
||||
|
||||
@ -2361,9 +2361,9 @@ U_INTERNAL void U_EXPORT2
|
||||
uprv_dl_close(void *lib, UErrorCode *status) {
|
||||
HMODULE handle = (HMODULE)lib;
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
|
||||
FreeLibrary(handle);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2371,11 +2371,11 @@ U_INTERNAL UVoidFunction* U_EXPORT2
|
||||
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
HMODULE handle = (HMODULE)lib;
|
||||
UVoidFunction* addr = NULL;
|
||||
|
||||
|
||||
if(U_FAILURE(*status) || lib==NULL) return NULL;
|
||||
|
||||
|
||||
addr = (UVoidFunction*)GetProcAddress(handle, sym);
|
||||
|
||||
|
||||
if(addr==NULL) {
|
||||
DWORD lastError = GetLastError();
|
||||
if(lastError == ERROR_PROC_NOT_FOUND) {
|
||||
@ -2384,7 +2384,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
|
||||
*status = U_UNSUPPORTED_ERROR; /* other unknown error. */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re
|
||||
* Return the default codepage for this platform and locale.
|
||||
* This function can call setlocale() on Unix platforms. Please read the
|
||||
* platform documentation on setlocale() before calling this function.
|
||||
* @return the default codepage for this platform
|
||||
* @return the default codepage for this platform
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
|
||||
@ -377,7 +377,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
|
||||
/**
|
||||
* Please use uloc_getDefault() instead.
|
||||
* Return the default locale ID string by querying the system, or
|
||||
* zero if one cannot be found.
|
||||
* zero if one cannot be found.
|
||||
* This function can call setlocale() on Unix platforms. Please read the
|
||||
* platform documentation on setlocale() before calling this function.
|
||||
* @return the default locale ID string
|
||||
@ -441,7 +441,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
|
||||
* Reset the global tzname cache.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL void uprv_tzname_clear_cache();
|
||||
U_INTERNAL void uprv_tzname_clear_cache(void);
|
||||
|
||||
/**
|
||||
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
|
||||
|
@ -224,7 +224,7 @@ static UBool gDefaultConverterContainsOption;
|
||||
static const char DATA_TYPE[] = "cnv";
|
||||
|
||||
/* ucnv_flushAvailableConverterCache. This is only called from ucnv_cleanup().
|
||||
* If it is ever to be called from elsewhere, synchronization
|
||||
* If it is ever to be called from elsewhere, synchronization
|
||||
* will need to be considered.
|
||||
*/
|
||||
static void
|
||||
@ -262,7 +262,7 @@ static UBool U_CALLCONV ucnv_cleanup(void) {
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
ucnv_enableCleanup() {
|
||||
ucnv_enableCleanup(void) {
|
||||
ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup);
|
||||
}
|
||||
|
||||
@ -1309,7 +1309,7 @@ ucnv_setDefaultName(const char *converterName) {
|
||||
|
||||
/* The close may make the current name go away. */
|
||||
ucnv_close(cnv);
|
||||
|
||||
|
||||
/* reset the converter cache */
|
||||
u_flushDefaultConverter();
|
||||
}
|
||||
|
@ -66,8 +66,8 @@ typedef struct UConverterImpl UConverterImpl;
|
||||
|
||||
typedef struct UConverterStaticData { /* +offset: size */
|
||||
uint32_t structSize; /* +0: 4 Size of this structure */
|
||||
|
||||
char name
|
||||
|
||||
char name
|
||||
[UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60 internal name of the converter- invariant chars */
|
||||
|
||||
int32_t codepage; /* +64: 4 codepage # (now IBM-$codepage) */
|
||||
@ -80,7 +80,7 @@ typedef struct UConverterStaticData { /* +offset: size */
|
||||
|
||||
uint8_t subChar[UCNV_MAX_SUBCHAR_LEN]; /* +72: 4 [note: 4 and 8 byte boundary] */
|
||||
int8_t subCharLen; /* +76: 1 */
|
||||
|
||||
|
||||
uint8_t hasToUnicodeFallback; /* +77: 1 UBool needs to be changed to UBool to be consistent across platform */
|
||||
uint8_t hasFromUnicodeFallback; /* +78: 1 */
|
||||
uint8_t unicodeMask; /* +79: 1 bit 0: has supplementary bit 1: has single surrogates */
|
||||
@ -289,7 +289,7 @@ ucnv_swap(const UDataSwapper *ds,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
ucnv_enableCleanup();
|
||||
ucnv_enableCleanup(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -34,76 +34,76 @@
|
||||
#define DO_DEBUG_OUT 0
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* StringPrep profile file format ------------------------------------
|
||||
*
|
||||
*
|
||||
* The file format prepared and written here contains a 16-bit trie and a mapping table.
|
||||
*
|
||||
*
|
||||
* Before the data contents described below, there are the headers required by
|
||||
* the udata API for loading ICU data. Especially, a UDataInfo structure
|
||||
* precedes the actual data. It contains platform properties values and the
|
||||
* file format version.
|
||||
*
|
||||
*
|
||||
* The following is a description of format version 2.
|
||||
*
|
||||
*
|
||||
* Data contents:
|
||||
*
|
||||
*
|
||||
* The contents is a parsed, binary form of RFC3454 and possibly
|
||||
* NormalizationCorrections.txt depending on the options specified on the profile.
|
||||
*
|
||||
*
|
||||
* Any Unicode code point from 0 to 0x10ffff can be looked up to get
|
||||
* the trie-word, if any, for that code point. This means that the input
|
||||
* to the lookup are 21-bit unsigned integers, with not all of the
|
||||
* 21-bit range used.
|
||||
*
|
||||
*
|
||||
* *.spp files customarily begin with a UDataInfo structure, see udata.h and .c.
|
||||
* After that there are the following structures:
|
||||
*
|
||||
* int32_t indexes[_SPREP_INDEX_TOP]; -- _SPREP_INDEX_TOP=16, see enum in sprpimpl.h file
|
||||
*
|
||||
* UTrie stringPrepTrie; -- size in bytes=indexes[_SPREP_INDEX_TRIE_SIZE]
|
||||
*
|
||||
* uint16_t mappingTable[]; -- Contains the sequecence of code units that the code point maps to
|
||||
*
|
||||
* uint16_t mappingTable[]; -- Contains the sequecence of code units that the code point maps to
|
||||
* size in bytes = indexes[_SPREP_INDEX_MAPPING_DATA_SIZE]
|
||||
*
|
||||
* The indexes array contains the following values:
|
||||
* indexes[_SPREP_INDEX_TRIE_SIZE] -- The size of the StringPrep trie in bytes
|
||||
* indexes[_SPREP_INDEX_MAPPING_DATA_SIZE] -- The size of the mappingTable in bytes
|
||||
* indexes[_SPREP_NORM_CORRECTNS_LAST_UNI_VERSION] -- The index of Unicode version of last entry in NormalizationCorrections.txt
|
||||
* indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] -- The starting index of 1 UChar mapping index in the mapping table
|
||||
* indexes[_SPREP_INDEX_MAPPING_DATA_SIZE] -- The size of the mappingTable in bytes
|
||||
* indexes[_SPREP_NORM_CORRECTNS_LAST_UNI_VERSION] -- The index of Unicode version of last entry in NormalizationCorrections.txt
|
||||
* indexes[_SPREP_ONE_UCHAR_MAPPING_INDEX_START] -- The starting index of 1 UChar mapping index in the mapping table
|
||||
* indexes[_SPREP_TWO_UCHARS_MAPPING_INDEX_START] -- The starting index of 2 UChars mapping index in the mapping table
|
||||
* indexes[_SPREP_THREE_UCHARS_MAPPING_INDEX_START] -- The starting index of 3 UChars mapping index in the mapping table
|
||||
* indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START] -- The starting index of 4 UChars mapping index in the mapping table
|
||||
* indexes[_SPREP_OPTIONS] -- Bit set of options to turn on in the profile, e.g: USPREP_NORMALIZATION_ON, USPREP_CHECK_BIDI_ON
|
||||
*
|
||||
*
|
||||
*
|
||||
* StringPrep Trie :
|
||||
*
|
||||
* The StringPrep tries is a 16-bit trie that contains data for the profile.
|
||||
* The StringPrep tries is a 16-bit trie that contains data for the profile.
|
||||
* Each code point is associated with a value (trie-word) in the trie.
|
||||
*
|
||||
* - structure of data words from the trie
|
||||
*
|
||||
* i) A value greater than or equal to _SPREP_TYPE_THRESHOLD (0xFFF0)
|
||||
*
|
||||
* i) A value greater than or equal to _SPREP_TYPE_THRESHOLD (0xFFF0)
|
||||
* represents the type associated with the code point
|
||||
* if(trieWord >= _SPREP_TYPE_THRESHOLD){
|
||||
* type = trieWord - 0xFFF0;
|
||||
* }
|
||||
* The type can be :
|
||||
* USPREP_UNASSIGNED
|
||||
* USPREP_PROHIBITED
|
||||
* USPREP_DELETE
|
||||
*
|
||||
* USPREP_UNASSIGNED
|
||||
* USPREP_PROHIBITED
|
||||
* USPREP_DELETE
|
||||
*
|
||||
* ii) A value less than _SPREP_TYPE_THRESHOLD means the type is USPREP_MAP and
|
||||
* contains distribution described below
|
||||
*
|
||||
*
|
||||
* 0 - ON : The code point is prohibited (USPREP_PROHIBITED). This is to allow for codepoint that are both prohibited and mapped.
|
||||
* 1 - ON : The value in the next 14 bits is an index into the mapping table
|
||||
* OFF: The value in the next 14 bits is an delta value from the code point
|
||||
* 2..15 - Contains data as described by bit 1. If all bits are set
|
||||
* 2..15 - Contains data as described by bit 1. If all bits are set
|
||||
* (value = _SPREP_MAX_INDEX_VALUE) then the type is USPREP_DELETE
|
||||
*
|
||||
*
|
||||
*
|
||||
* Mapping Table:
|
||||
* The data in mapping table is sorted according to the length of the mapping sequence.
|
||||
* If the type of the code point is USPREP_MAP and value in trie word is an index, the index
|
||||
@ -120,10 +120,10 @@
|
||||
* index < indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START]){
|
||||
* length = 3;
|
||||
* }else{
|
||||
* // The first position in the mapping table contains the length
|
||||
* // The first position in the mapping table contains the length
|
||||
* // of the sequence
|
||||
* length = mappingTable[index++];
|
||||
*
|
||||
*
|
||||
* }
|
||||
*
|
||||
*/
|
||||
@ -192,7 +192,7 @@ static UNewTrie *sprepTrie;
|
||||
#define MAX_DATA_LENGTH 11500
|
||||
|
||||
|
||||
#define SPREP_DELTA_RANGE_POSITIVE_LIMIT 8191
|
||||
#define SPREP_DELTA_RANGE_POSITIVE_LIMIT 8191
|
||||
#define SPREP_DELTA_RANGE_NEGATIVE_LIMIT -8192
|
||||
|
||||
|
||||
@ -235,8 +235,8 @@ static UBool U_CALLCONV compareEntries(const UHashTok p1, const UHashTok p2) {
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
storeMappingData(){
|
||||
static void
|
||||
storeMappingData(void){
|
||||
|
||||
int32_t pos = UHASH_FIRST;
|
||||
const UHashElement* element = NULL;
|
||||
@ -260,10 +260,10 @@ storeMappingData(){
|
||||
while(writtenElementCount < elementCount){
|
||||
|
||||
while( (element = uhash_nextElement(hashTable, &pos))!=NULL){
|
||||
|
||||
|
||||
codepoint = element->key.integer;
|
||||
value = (ValueStruct*)element->value.pointer;
|
||||
|
||||
|
||||
/* store the start of indexes */
|
||||
if(oldMappingLength != mappingLength){
|
||||
/* Assume that index[] is used according to the enums defined */
|
||||
@ -272,9 +272,9 @@ storeMappingData(){
|
||||
}
|
||||
if(oldMappingLength <= _SPREP_MAX_INDEX_TOP_LENGTH &&
|
||||
mappingLength == _SPREP_MAX_INDEX_TOP_LENGTH +1){
|
||||
|
||||
|
||||
limitIndex = currentIndex;
|
||||
|
||||
|
||||
}
|
||||
oldMappingLength = mappingLength;
|
||||
}
|
||||
@ -284,7 +284,7 @@ storeMappingData(){
|
||||
trieWord = currentIndex << 2;
|
||||
/* turn on the 2nd bit to signal that the following bits contain an index */
|
||||
trieWord += 0x02;
|
||||
|
||||
|
||||
if(trieWord > _SPREP_TYPE_THRESHOLD){
|
||||
fprintf(stderr,"trieWord cannot contain value greater than 0x%04X.\n",_SPREP_TYPE_THRESHOLD);
|
||||
exit(U_ILLEGAL_CHAR_FOUND);
|
||||
@ -296,19 +296,19 @@ storeMappingData(){
|
||||
/* turn on the first bit in trie word */
|
||||
trieWord += 0x01;
|
||||
}else{
|
||||
/*
|
||||
/*
|
||||
* the codepoint has value something other than prohibited
|
||||
* and a mapping .. error!
|
||||
* and a mapping .. error!
|
||||
*/
|
||||
fprintf(stderr,"Type for codepoint \\U%08X already set!.\n", (int)codepoint);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/* now set the value in the trie */
|
||||
if(!utrie_set32(sprepTrie,codepoint,trieWord)){
|
||||
fprintf(stderr,"Could not set the value for code point.\n");
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
|
||||
/* written the trie word for the codepoint... increment the count*/
|
||||
@ -316,7 +316,7 @@ storeMappingData(){
|
||||
|
||||
/* sanity check are we exceeding the max number allowed */
|
||||
if(currentIndex+value->length+1 > _SPREP_MAX_INDEX_VALUE){
|
||||
fprintf(stderr, "Too many entries in the mapping table %i. Maximum allowed is %i\n",
|
||||
fprintf(stderr, "Too many entries in the mapping table %i. Maximum allowed is %i\n",
|
||||
currentIndex+value->length, _SPREP_MAX_INDEX_VALUE);
|
||||
exit(U_INDEX_OUTOFBOUNDS_ERROR);
|
||||
}
|
||||
@ -346,7 +346,7 @@ storeMappingData(){
|
||||
}else{
|
||||
indexes[_SPREP_FOUR_UCHARS_MAPPING_INDEX_START] = limitIndex;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
extern void setOptions(int32_t options){
|
||||
@ -355,8 +355,8 @@ extern void setOptions(int32_t options){
|
||||
extern void
|
||||
storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
|
||||
UStringPrepType type, UErrorCode* status){
|
||||
|
||||
|
||||
|
||||
|
||||
UChar* map = NULL;
|
||||
int16_t adjustedLen=0, i, j;
|
||||
uint16_t trieWord = 0;
|
||||
@ -368,7 +368,7 @@ storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
|
||||
hashTable = uhash_open(hashEntry, compareEntries, NULL, status);
|
||||
uhash_setValueDeleter(hashTable, valueDeleter);
|
||||
}
|
||||
|
||||
|
||||
/* figure out if the code point has type already stored */
|
||||
savedTrieWord= utrie_get32(sprepTrie,codepoint,NULL);
|
||||
if(savedTrieWord!=0){
|
||||
@ -376,16 +376,16 @@ storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
|
||||
/* turn on the first bit in trie word */
|
||||
trieWord += 0x01;
|
||||
}else{
|
||||
/*
|
||||
/*
|
||||
* the codepoint has value something other than prohibited
|
||||
* and a mapping .. error!
|
||||
* and a mapping .. error!
|
||||
*/
|
||||
fprintf(stderr,"Type for codepoint \\U%08X already set!.\n", (int)codepoint);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/* figure out the real length */
|
||||
/* figure out the real length */
|
||||
for(i=0; i<length; i++){
|
||||
adjustedLen += U16_LENGTH(mapping[i]);
|
||||
}
|
||||
@ -393,11 +393,11 @@ storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
|
||||
if(adjustedLen == 0){
|
||||
trieWord = (uint16_t)(_SPREP_MAX_INDEX_VALUE << 2);
|
||||
/* make sure that the value of trieWord is less than the threshold */
|
||||
if(trieWord < _SPREP_TYPE_THRESHOLD){
|
||||
if(trieWord < _SPREP_TYPE_THRESHOLD){
|
||||
/* now set the value in the trie */
|
||||
if(!utrie_set32(sprepTrie,codepoint,trieWord)){
|
||||
fprintf(stderr,"Could not set the value for code point.\n");
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
/* value is set so just return */
|
||||
return;
|
||||
@ -422,28 +422,28 @@ storeMapping(uint32_t codepoint, uint32_t* mapping,int32_t length,
|
||||
exit(U_INTERNAL_PROGRAM_ERROR);
|
||||
}
|
||||
/* make sure that the value of trieWord is less than the threshold */
|
||||
if(trieWord < _SPREP_TYPE_THRESHOLD){
|
||||
if(trieWord < _SPREP_TYPE_THRESHOLD){
|
||||
/* now set the value in the trie */
|
||||
if(!utrie_set32(sprepTrie,codepoint,trieWord)){
|
||||
fprintf(stderr,"Could not set the value for code point.\n");
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
/* value is set so just return */
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*
|
||||
/*
|
||||
* if the delta is not in the given range or if the trieWord is larger than the threshold
|
||||
* just fall through for storing the mapping in the mapping table
|
||||
*/
|
||||
}
|
||||
|
||||
map = (UChar*) uprv_calloc(adjustedLen + 1, U_SIZEOF_UCHAR);
|
||||
|
||||
|
||||
for (i=0, j=0; i<length; i++) {
|
||||
U16_APPEND_UNSAFE(map, j, mapping[i]);
|
||||
}
|
||||
|
||||
|
||||
value = (ValueStruct*) uprv_malloc(sizeof(ValueStruct));
|
||||
value->mapping = map;
|
||||
value->type = type;
|
||||
@ -478,9 +478,9 @@ storeRange(uint32_t start, uint32_t end, UStringPrepType type, UErrorCode* statu
|
||||
uint32_t savedTrieWord = utrie_get32(sprepTrie, start, NULL);
|
||||
if(savedTrieWord>0){
|
||||
if(savedTrieWord < _SPREP_TYPE_THRESHOLD && type == USPREP_PROHIBITED){
|
||||
/*
|
||||
* A mapping is stored in the trie word
|
||||
* and the only other possible type that a
|
||||
/*
|
||||
* A mapping is stored in the trie word
|
||||
* and the only other possible type that a
|
||||
* code point can have is USPREP_PROHIBITED
|
||||
*
|
||||
*/
|
||||
@ -492,11 +492,11 @@ storeRange(uint32_t start, uint32_t end, UStringPrepType type, UErrorCode* statu
|
||||
trieWord = (uint16_t)savedTrieWord;
|
||||
|
||||
/* make sure that the value of trieWord is less than the threshold */
|
||||
if(trieWord < _SPREP_TYPE_THRESHOLD){
|
||||
if(trieWord < _SPREP_TYPE_THRESHOLD){
|
||||
/* now set the value in the trie */
|
||||
if(!utrie_set32(sprepTrie,start,trieWord)){
|
||||
fprintf(stderr,"Could not set the value for code point.\n");
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
/* value is set so just return */
|
||||
return;
|
||||
@ -504,7 +504,7 @@ storeRange(uint32_t start, uint32_t end, UStringPrepType type, UErrorCode* statu
|
||||
fprintf(stderr,"trieWord cannot contain value greater than threshold 0x%04X.\n",_SPREP_TYPE_THRESHOLD);
|
||||
exit(U_ILLEGAL_CHAR_FOUND);
|
||||
}
|
||||
|
||||
|
||||
}else if(savedTrieWord != trieWord){
|
||||
fprintf(stderr,"Value for codepoint \\U%08X already set!.\n", (int)start);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
@ -513,12 +513,12 @@ storeRange(uint32_t start, uint32_t end, UStringPrepType type, UErrorCode* statu
|
||||
}
|
||||
if(!utrie_set32(sprepTrie,start,trieWord)){
|
||||
fprintf(stderr,"Could not set the value for code point \\U%08X.\n", (int)start);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
exit(U_ILLEGAL_ARGUMENT_ERROR);
|
||||
}
|
||||
}else{
|
||||
if(!utrie_setRange32(sprepTrie, start, end+1, trieWord, FALSE)){
|
||||
fprintf(stderr,"Value for certain codepoint already set.\n");
|
||||
exit(U_ILLEGAL_CHAR_FOUND);
|
||||
exit(U_ILLEGAL_CHAR_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
@ -567,13 +567,13 @@ generateData(const char *dataDir, const char* bundleName) {
|
||||
|
||||
/* sort and add mapping data */
|
||||
storeMappingData();
|
||||
|
||||
|
||||
sprepTrieSize=utrie_serialize(sprepTrie, sprepTrieBlock, sizeof(sprepTrieBlock), getFoldedValue, TRUE, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
fprintf(stderr, "error: utrie_serialize(sprep trie) failed, %s\n", u_errorName(errorCode));
|
||||
exit(errorCode);
|
||||
}
|
||||
|
||||
|
||||
size = sprepTrieSize + mappingDataCapacity*U_SIZEOF_UCHAR + sizeof(indexes);
|
||||
if(beVerbose) {
|
||||
printf("size of sprep trie %5u bytes\n", (int)sprepTrieSize);
|
||||
@ -599,11 +599,11 @@ generateData(const char *dataDir, const char* bundleName) {
|
||||
|
||||
indexes[_SPREP_INDEX_TRIE_SIZE]=sprepTrieSize;
|
||||
indexes[_SPREP_INDEX_MAPPING_DATA_SIZE]=mappingDataCapacity*U_SIZEOF_UCHAR;
|
||||
|
||||
|
||||
udata_writeBlock(pData, indexes, sizeof(indexes));
|
||||
udata_writeBlock(pData, sprepTrieBlock, sprepTrieSize);
|
||||
udata_writeBlock(pData, mappingData, indexes[_SPREP_INDEX_MAPPING_DATA_SIZE]);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user