| OLD | NEW |
| 1 /* | 1 /* |
| 2 ******************************************************************** | 2 ******************************************************************** |
| 3 * COPYRIGHT: | 3 * COPYRIGHT: |
| 4 * Copyright (c) 1996-2013, International Business Machines Corporation and | 4 * Copyright (c) 1996-2013, International Business Machines Corporation and |
| 5 * others. All Rights Reserved. | 5 * others. All Rights Reserved. |
| 6 ******************************************************************** | 6 ******************************************************************** |
| 7 * | 7 * |
| 8 * uconv_bld.cpp: | 8 * uconv_bld.cpp: |
| 9 * | 9 * |
| 10 * Defines functions that are used in the creation/initialization/deletion | 10 * Defines functions that are used in the creation/initialization/deletion |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #else | 62 #else |
| 63 &_MBCSData, | 63 &_MBCSData, |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 &_Latin1Data, | 66 &_Latin1Data, |
| 67 &_UTF8Data, &_UTF16BEData, &_UTF16LEData, &_UTF32BEData, &_UTF32LEData, | 67 &_UTF8Data, &_UTF16BEData, &_UTF16LEData, &_UTF32BEData, &_UTF32LEData, |
| 68 NULL, | 68 NULL, |
| 69 | 69 |
| 70 #if UCONFIG_NO_LEGACY_CONVERSION | 70 #if UCONFIG_NO_LEGACY_CONVERSION |
| 71 NULL, | 71 NULL, |
| 72 #else | |
| 73 &_ISO2022Data, | |
| 74 #endif | |
| 75 | |
| 76 #if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_NO_NON_HTML5_CONVERSION | |
| 77 NULL, NULL, NULL, NULL, NULL, NULL, | 72 NULL, NULL, NULL, NULL, NULL, NULL, |
| 78 NULL, NULL, NULL, NULL, NULL, NULL, | 73 NULL, NULL, NULL, NULL, NULL, NULL, |
| 79 NULL, | 74 NULL, |
| 80 #else | 75 #else |
| 76 &_ISO2022Data, |
| 81 &_LMBCSData1,&_LMBCSData2, &_LMBCSData3, &_LMBCSData4, &_LMBCSData5, &_LMBCS
Data6, | 77 &_LMBCSData1,&_LMBCSData2, &_LMBCSData3, &_LMBCSData4, &_LMBCSData5, &_LMBCS
Data6, |
| 82 &_LMBCSData8,&_LMBCSData11,&_LMBCSData16,&_LMBCSData17,&_LMBCSData18,&_LMBCS
Data19, | 78 &_LMBCSData8,&_LMBCSData11,&_LMBCSData16,&_LMBCSData17,&_LMBCSData18,&_LMBCS
Data19, |
| 83 &_HZData, | 79 &_HZData, |
| 84 #endif | 80 #endif |
| 85 | 81 |
| 86 #if UCONFIG_NO_NON_HTML5_CONVERSION | |
| 87 NULL, | |
| 88 #else | |
| 89 &_SCSUData, | 82 &_SCSUData, |
| 90 #endif | |
| 91 | 83 |
| 92 | 84 #if UCONFIG_NO_LEGACY_CONVERSION |
| 93 #if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_NO_NON_HTML5_CONVERSION | |
| 94 NULL, | 85 NULL, |
| 95 #else | 86 #else |
| 96 &_ISCIIData, | 87 &_ISCIIData, |
| 97 #endif | 88 #endif |
| 98 | 89 |
| 99 &_ASCIIData, | 90 &_ASCIIData, |
| 100 #if UCONFIG_NO_NON_HTML5_CONVERSION | |
| 101 NULL, NULL, &_UTF16Data, &_UTF32Data, NULL, NULL, | |
| 102 #else | |
| 103 &_UTF7Data, &_Bocu1Data, &_UTF16Data, &_UTF32Data, &_CESU8Data, &_IMAPData, | 91 &_UTF7Data, &_Bocu1Data, &_UTF16Data, &_UTF32Data, &_CESU8Data, &_IMAPData, |
| 104 #endif | |
| 105 | 92 |
| 106 #if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_NO_NON_HTML5_CONVERSION | 93 #if UCONFIG_NO_LEGACY_CONVERSION |
| 107 NULL, | 94 NULL, |
| 108 #else | 95 #else |
| 109 &_CompoundTextData | 96 &_CompoundTextData |
| 110 #endif | 97 #endif |
| 111 }; | 98 }; |
| 112 | 99 |
| 113 /* Please keep this in binary sorted order for getAlgorithmicTypeFromName. | 100 /* Please keep this in binary sorted order for getAlgorithmicTypeFromName. |
| 114 Also the name should be in lower case and all spaces, dashes and underscores | 101 Also the name should be in lower case and all spaces, dashes and underscores |
| 115 removed | 102 removed |
| 116 */ | 103 */ |
| 117 static struct { | 104 static struct { |
| 118 const char *name; | 105 const char *name; |
| 119 const UConverterType type; | 106 const UConverterType type; |
| 120 } const cnvNameType[] = { | 107 } const cnvNameType[] = { |
| 121 #if !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 122 { "bocu1", UCNV_BOCU1 }, | 108 { "bocu1", UCNV_BOCU1 }, |
| 123 { "cesu8", UCNV_CESU8 }, | 109 { "cesu8", UCNV_CESU8 }, |
| 124 #endif | 110 #if !UCONFIG_NO_LEGACY_CONVERSION |
| 125 #if !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 126 { "hz",UCNV_HZ }, | 111 { "hz",UCNV_HZ }, |
| 127 #endif | 112 #endif |
| 128 #if !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 129 { "imapmailboxname", UCNV_IMAP_MAILBOX }, | 113 { "imapmailboxname", UCNV_IMAP_MAILBOX }, |
| 130 #endif | 114 #if !UCONFIG_NO_LEGACY_CONVERSION |
| 131 #if !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 132 { "iscii", UCNV_ISCII }, | 115 { "iscii", UCNV_ISCII }, |
| 133 #endif | |
| 134 #if !UCONFIG_NO_LEGACY_CONVERSION | |
| 135 { "iso2022", UCNV_ISO_2022 }, | 116 { "iso2022", UCNV_ISO_2022 }, |
| 136 #endif | 117 #endif |
| 137 { "iso88591", UCNV_LATIN_1 }, | 118 { "iso88591", UCNV_LATIN_1 }, |
| 138 #if !UCONFIG_NO_LEGACY_CONVERSION && !UCONFIG_NO_NON_HTML5_CONVERSION | 119 #if !UCONFIG_NO_LEGACY_CONVERSION |
| 139 { "lmbcs1", UCNV_LMBCS_1 }, | 120 { "lmbcs1", UCNV_LMBCS_1 }, |
| 140 { "lmbcs11",UCNV_LMBCS_11 }, | 121 { "lmbcs11",UCNV_LMBCS_11 }, |
| 141 { "lmbcs16",UCNV_LMBCS_16 }, | 122 { "lmbcs16",UCNV_LMBCS_16 }, |
| 142 { "lmbcs17",UCNV_LMBCS_17 }, | 123 { "lmbcs17",UCNV_LMBCS_17 }, |
| 143 { "lmbcs18",UCNV_LMBCS_18 }, | 124 { "lmbcs18",UCNV_LMBCS_18 }, |
| 144 { "lmbcs19",UCNV_LMBCS_19 }, | 125 { "lmbcs19",UCNV_LMBCS_19 }, |
| 145 { "lmbcs2", UCNV_LMBCS_2 }, | 126 { "lmbcs2", UCNV_LMBCS_2 }, |
| 146 { "lmbcs3", UCNV_LMBCS_3 }, | 127 { "lmbcs3", UCNV_LMBCS_3 }, |
| 147 { "lmbcs4", UCNV_LMBCS_4 }, | 128 { "lmbcs4", UCNV_LMBCS_4 }, |
| 148 { "lmbcs5", UCNV_LMBCS_5 }, | 129 { "lmbcs5", UCNV_LMBCS_5 }, |
| 149 { "lmbcs6", UCNV_LMBCS_6 }, | 130 { "lmbcs6", UCNV_LMBCS_6 }, |
| 150 { "lmbcs8", UCNV_LMBCS_8 }, | 131 { "lmbcs8", UCNV_LMBCS_8 }, |
| 151 #endif | 132 #endif |
| 152 #if !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 153 { "scsu", UCNV_SCSU }, | 133 { "scsu", UCNV_SCSU }, |
| 154 #endif | |
| 155 { "usascii", UCNV_US_ASCII }, | 134 { "usascii", UCNV_US_ASCII }, |
| 156 { "utf16", UCNV_UTF16 }, | 135 { "utf16", UCNV_UTF16 }, |
| 157 { "utf16be", UCNV_UTF16_BigEndian }, | 136 { "utf16be", UCNV_UTF16_BigEndian }, |
| 158 { "utf16le", UCNV_UTF16_LittleEndian }, | 137 { "utf16le", UCNV_UTF16_LittleEndian }, |
| 159 #if U_IS_BIG_ENDIAN | 138 #if U_IS_BIG_ENDIAN |
| 160 { "utf16oppositeendian", UCNV_UTF16_LittleEndian }, | 139 { "utf16oppositeendian", UCNV_UTF16_LittleEndian }, |
| 161 { "utf16platformendian", UCNV_UTF16_BigEndian }, | 140 { "utf16platformendian", UCNV_UTF16_BigEndian }, |
| 162 #else | 141 #else |
| 163 { "utf16oppositeendian", UCNV_UTF16_BigEndian}, | 142 { "utf16oppositeendian", UCNV_UTF16_BigEndian}, |
| 164 { "utf16platformendian", UCNV_UTF16_LittleEndian }, | 143 { "utf16platformendian", UCNV_UTF16_LittleEndian }, |
| 165 #endif | 144 #endif |
| 166 { "utf32", UCNV_UTF32 }, | 145 { "utf32", UCNV_UTF32 }, |
| 167 { "utf32be", UCNV_UTF32_BigEndian }, | 146 { "utf32be", UCNV_UTF32_BigEndian }, |
| 168 { "utf32le", UCNV_UTF32_LittleEndian }, | 147 { "utf32le", UCNV_UTF32_LittleEndian }, |
| 169 #if U_IS_BIG_ENDIAN | 148 #if U_IS_BIG_ENDIAN |
| 170 { "utf32oppositeendian", UCNV_UTF32_LittleEndian }, | 149 { "utf32oppositeendian", UCNV_UTF32_LittleEndian }, |
| 171 { "utf32platformendian", UCNV_UTF32_BigEndian }, | 150 { "utf32platformendian", UCNV_UTF32_BigEndian }, |
| 172 #else | 151 #else |
| 173 { "utf32oppositeendian", UCNV_UTF32_BigEndian }, | 152 { "utf32oppositeendian", UCNV_UTF32_BigEndian }, |
| 174 { "utf32platformendian", UCNV_UTF32_LittleEndian }, | 153 { "utf32platformendian", UCNV_UTF32_LittleEndian }, |
| 175 #endif | 154 #endif |
| 176 #if !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 177 { "utf7", UCNV_UTF7 }, | 155 { "utf7", UCNV_UTF7 }, |
| 178 #endif | |
| 179 { "utf8", UCNV_UTF8 }, | 156 { "utf8", UCNV_UTF8 }, |
| 180 #if !UCONFIG_NO_NON_HTML5_CONVERSION | |
| 181 { "x11compoundtext", UCNV_COMPOUND_TEXT} | 157 { "x11compoundtext", UCNV_COMPOUND_TEXT} |
| 182 #endif | |
| 183 }; | 158 }; |
| 184 | 159 |
| 185 | 160 |
| 186 /*initializes some global variables */ | 161 /*initializes some global variables */ |
| 187 static UHashtable *SHARED_DATA_HASHTABLE = NULL; | 162 static UHashtable *SHARED_DATA_HASHTABLE = NULL; |
| 188 static UMutex cnvCacheMutex = U_MUTEX_INITIALIZER; /* Mutex for synchronizing c
nv cache access. */ | 163 static UMutex cnvCacheMutex = U_MUTEX_INITIALIZER; /* Mutex for synchronizing c
nv cache access. */ |
| 189 /* Note: the global mutex
is used for */ | 164 /* Note: the global mutex
is used for */ |
| 190 /* reference count u
pdates. */ | 165 /* reference count u
pdates. */ |
| 191 | 166 |
| 192 static const char **gAvailableConverters = NULL; | 167 static const char **gAvailableConverters = NULL; |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 *pErrorCode=U_UNSUPPORTED_ERROR; | 1695 *pErrorCode=U_UNSUPPORTED_ERROR; |
| 1721 return 0; | 1696 return 0; |
| 1722 } | 1697 } |
| 1723 | 1698 |
| 1724 return headerSize+(int32_t)staticDataSize+size; | 1699 return headerSize+(int32_t)staticDataSize+size; |
| 1725 } | 1700 } |
| 1726 | 1701 |
| 1727 #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ | 1702 #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */ |
| 1728 | 1703 |
| 1729 #endif | 1704 #endif |
| OLD | NEW |