ICU-9456 Reduce writable/relocatable data.
X-SVN-Rev: 32149
This commit is contained in:
parent
81a751e0d2
commit
1384c72211
@ -17,6 +17,8 @@
|
||||
#include "ulocimp.h"
|
||||
#include "uassert.h"
|
||||
|
||||
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
|
||||
|
||||
/* struct holding a single variant */
|
||||
typedef struct VariantListEntry {
|
||||
const char *variant;
|
||||
@ -62,19 +64,19 @@ typedef struct ULanguageTag {
|
||||
#define ISALPHA(c) uprv_isASCIILetter(c)
|
||||
#define ISNUMERIC(c) ((c)>='0' && (c)<='9')
|
||||
|
||||
static const char* EMPTY = "";
|
||||
static const char* LANG_UND = "und";
|
||||
static const char* PRIVATEUSE_KEY = "x";
|
||||
static const char* _POSIX = "_POSIX";
|
||||
static const char* POSIX_KEY = "va";
|
||||
static const char* POSIX_VALUE = "posix";
|
||||
static const char* LOCALE_ATTRIBUTE_KEY = "attribute";
|
||||
static const char* PRIVUSE_VARIANT_PREFIX = "lvariant";
|
||||
static const char* LOCALE_TYPE_YES = "yes";
|
||||
static const char EMPTY[] = "";
|
||||
static const char LANG_UND[] = "und";
|
||||
static const char PRIVATEUSE_KEY[] = "x";
|
||||
static const char _POSIX[] = "_POSIX";
|
||||
static const char POSIX_KEY[] = "va";
|
||||
static const char POSIX_VALUE[] = "posix";
|
||||
static const char LOCALE_ATTRIBUTE_KEY[] = "attribute";
|
||||
static const char PRIVUSE_VARIANT_PREFIX[] = "lvariant";
|
||||
static const char LOCALE_TYPE_YES[] = "yes";
|
||||
|
||||
#define LANG_UND_LEN 3
|
||||
|
||||
static const char* GRANDFATHERED[] = {
|
||||
static const char* const GRANDFATHERED[] = {
|
||||
/* grandfathered preferred */
|
||||
"art-lojban", "jbo",
|
||||
"cel-gaulish", "xtg-x-cel-gaulish",
|
||||
@ -105,12 +107,11 @@ static const char* GRANDFATHERED[] = {
|
||||
NULL, NULL
|
||||
};
|
||||
|
||||
static const char* DEPRECATEDLANGS[] = {
|
||||
static const char DEPRECATEDLANGS[][4] = {
|
||||
/* deprecated new */
|
||||
"iw", "he",
|
||||
"ji", "yi",
|
||||
"in", "id",
|
||||
NULL, NULL
|
||||
"in", "id"
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1028,7 +1029,7 @@ _appendLanguageToLanguageTag(const char* localeID, char* appendAt, int32_t capac
|
||||
reslen += LANG_UND_LEN;
|
||||
} else {
|
||||
/* resolve deprecated */
|
||||
for (i = 0; DEPRECATEDLANGS[i] != NULL; i += 2) {
|
||||
for (i = 0; i < LENGTHOF(DEPRECATEDLANGS); i += 2) {
|
||||
if (uprv_compareInvCharsAsAscii(buf, DEPRECATEDLANGS[i]) == 0) {
|
||||
uprv_strcpy(buf, DEPRECATEDLANGS[i + 1]);
|
||||
len = (int32_t)uprv_strlen(buf);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2010, International Business Machines
|
||||
* Copyright (C) 2003-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -46,13 +46,13 @@ static UHashtable *SHARED_DATA_HASHTABLE = NULL;
|
||||
static UMTX usprepMutex = NULL;
|
||||
|
||||
/* format version of spp file */
|
||||
static uint8_t formatVersion[4]={ 0, 0, 0, 0 };
|
||||
//static uint8_t formatVersion[4]={ 0, 0, 0, 0 };
|
||||
|
||||
/* the Unicode version of the sprep data */
|
||||
static UVersionInfo dataVersion={ 0, 0, 0, 0 };
|
||||
|
||||
/* Profile names must be aligned to UStringPrepProfileType */
|
||||
static const char *PROFILE_NAMES[] = {
|
||||
static const char * const PROFILE_NAMES[] = {
|
||||
"rfc3491", /* USPREP_RFC3491_NAMEPREP */
|
||||
"rfc3530cs", /* USPREP_RFC3530_NFS4_CS_PREP */
|
||||
"rfc3530csci", /* USPREP_RFC3530_NFS4_CS_PREP_CI */
|
||||
@ -86,7 +86,7 @@ isSPrepAcceptable(void * /* context */,
|
||||
pInfo->formatVersion[2]==UTRIE_SHIFT &&
|
||||
pInfo->formatVersion[3]==UTRIE_INDEX_SHIFT
|
||||
) {
|
||||
uprv_memcpy(formatVersion, pInfo->formatVersion, 4);
|
||||
//uprv_memcpy(formatVersion, pInfo->formatVersion, 4);
|
||||
uprv_memcpy(dataVersion, pInfo->dataVersion, 4);
|
||||
return TRUE;
|
||||
} else {
|
||||
|
@ -861,7 +861,7 @@ UVector *AlphabeticIndex::firstStringsInScript(Collator *ruleBasedCollator, UErr
|
||||
// Character constants copied from corresponding declaration in ICU4J.
|
||||
// See main/classes/collate/src/com/ibm/icu/text/AlphabeticIndex.java
|
||||
|
||||
static UChar HACK_FIRST_CHARS_IN_SCRIPTS[] = { 0x61, 0, 0x03B1, 0,
|
||||
static const UChar HACK_FIRST_CHARS_IN_SCRIPTS[] = { 0x61, 0, 0x03B1, 0,
|
||||
0x2C81, 0, 0x0430, 0, 0x2C30, 0, 0x10D0, 0, 0x0561, 0, 0x05D0, 0, 0xD802, 0xDD00, 0, 0x0800, 0, 0x0621, 0, 0x0710, 0,
|
||||
0x0780, 0, 0x07CA, 0, 0x2D30, 0, 0x1200, 0, 0x0950, 0, 0x0985, 0, 0x0A74, 0, 0x0AD0, 0, 0x0B05, 0, 0x0BD0, 0,
|
||||
0x0C05, 0, 0x0C85, 0, 0x0D05, 0, 0x0D85, 0,
|
||||
|
@ -1164,7 +1164,7 @@ uint8_t *CharsetRecog_IBM420_ar::unshapeLamAlef(const uint8_t *inputBytes, int32
|
||||
|
||||
if (bigBuffer != NULL) {
|
||||
int32_t bufferIndex;
|
||||
uint8_t unshapedLamAlef[] = { 0xb1, 0x56 };
|
||||
static const uint8_t unshapedLamAlef[] = { 0xb1, 0x56 };
|
||||
|
||||
for (int32_t i = bufferIndex = 0; i < inputBytesLength; i++) {
|
||||
if (isLamAlef(inputBytes[i])) {
|
||||
@ -1199,7 +1199,7 @@ void CharsetRecog_IBM420_ar::matchFinish(InputText *textIn) {
|
||||
}
|
||||
|
||||
UBool CharsetRecog_IBM420_ar::isLamAlef(uint8_t b) {
|
||||
uint8_t shapedLamAlef[] = {
|
||||
static const uint8_t shapedLamAlef[] = {
|
||||
0xb2, 0xb3, 0xb4, 0xb5, 0xb7, 0xb8
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
|
||||
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
|
||||
|
||||
static const InverseUCATableHeader* _staticInvUCA = NULL;
|
||||
static UDataMemory* invUCA_DATA_MEM = NULL;
|
||||
|
||||
@ -1393,13 +1395,12 @@ ucol_initInverseUCA(UErrorCode *status)
|
||||
/* This is the data that is used for non-script reordering codes. These _must_ be kept
|
||||
* in order that they are to be applied as defaults and in synch with the UColReorderCode enum.
|
||||
*/
|
||||
static const char* ReorderingTokenNames[] = {
|
||||
static const char * const ReorderingTokenNames[] = {
|
||||
"SPACE",
|
||||
"PUNCT",
|
||||
"SYMBOL",
|
||||
"CURRENCY",
|
||||
"DIGIT",
|
||||
NULL
|
||||
"DIGIT"
|
||||
};
|
||||
|
||||
static void toUpper(const char* src, char* dst, uint32_t length) {
|
||||
@ -1413,7 +1414,7 @@ U_INTERNAL int32_t U_EXPORT2
|
||||
ucol_findReorderingEntry(const char* name) {
|
||||
char buffer[32];
|
||||
toUpper(name, buffer, 32);
|
||||
for (uint32_t entry = 0; ReorderingTokenNames[entry] != NULL; entry++) {
|
||||
for (uint32_t entry = 0; entry < LENGTHOF(ReorderingTokenNames); entry++) {
|
||||
if (uprv_strcmp(buffer, ReorderingTokenNames[entry]) == 0) {
|
||||
return entry + UCOL_REORDER_CODE_FIRST;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user