OLD | NEW |
1 /* | 1 /* |
2 ****************************************************************************** | 2 ****************************************************************************** |
3 * | 3 * |
4 * Copyright (C) 2008-2013, International Business Machines | 4 * Copyright (C) 2008-2015, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ****************************************************************************** | 7 ****************************************************************************** |
8 * file name: uspoof_conf.cpp | 8 * file name: uspoof_conf.cpp |
9 * encoding: US-ASCII | 9 * encoding: US-ASCII |
10 * tab size: 8 (not used) | 10 * tab size: 8 (not used) |
11 * indentation:4 | 11 * indentation:4 |
12 * | 12 * |
13 * created on: 2009Jan05 (refactoring earlier files) | 13 * created on: 2009Jan05 (refactoring earlier files) |
14 * created by: Andy Heninger | 14 * created by: Andy Heninger |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // Put the map (value) string into the string pool | 293 // Put the map (value) string into the string pool |
294 // This a little like a Java intern() - any duplicates will be eliminate
d. | 294 // This a little like a Java intern() - any duplicates will be eliminate
d. |
295 SPUString *smapString = stringPool->addString(mapString, status); | 295 SPUString *smapString = stringPool->addString(mapString, status); |
296 | 296 |
297 // Add the UChar32 -> string mapping to the appropriate table. | 297 // Add the UChar32 -> string mapping to the appropriate table. |
298 UHashtable *table = uregex_start(fParseLine, 3, &status) >= 0 ? fSLTable
: | 298 UHashtable *table = uregex_start(fParseLine, 3, &status) >= 0 ? fSLTable
: |
299 uregex_start(fParseLine, 4, &status) >= 0 ? fSATable
: | 299 uregex_start(fParseLine, 4, &status) >= 0 ? fSATable
: |
300 uregex_start(fParseLine, 5, &status) >= 0 ? fMLTable
: | 300 uregex_start(fParseLine, 5, &status) >= 0 ? fMLTable
: |
301 uregex_start(fParseLine, 6, &status) >= 0 ? fMATable
: | 301 uregex_start(fParseLine, 6, &status) >= 0 ? fMATable
: |
302 NULL; | 302 NULL; |
303 U_ASSERT(table != NULL); | 303 if (U_SUCCESS(status) && table == NULL) { |
304 uhash_iput(table, keyChar, smapString, &status); | 304 status = U_PARSE_ERROR; |
| 305 } |
| 306 if (U_FAILURE(status)) { |
| 307 return; |
| 308 } |
| 309 |
| 310 // For Unicode 8, the SL, SA and ML tables have been discontinued. |
| 311 // All input data from confusables.txt is tagged MA. |
| 312 // ICU spoof check functions should ignore the specified
table and always |
| 313 // use this MA Data. |
| 314 // For now, implement by populating the MA data into all
four tables, and |
| 315 // keep the multiple table implementation in place, in ca
se it comes back |
| 316 // at some time in the future. |
| 317 // There is no run time size penalty to keeping the four
table implementation - |
| 318 // the data is shared when it's the same betweeen tables. |
| 319 if (table != fMATable) { |
| 320 status = U_PARSE_ERROR; |
| 321 return; |
| 322 }; |
| 323 // uhash_iput(table, keyChar, smapString, &status); |
| 324 uhash_iput(fSLTable, keyChar, smapString, &status); |
| 325 uhash_iput(fSATable, keyChar, smapString, &status); |
| 326 uhash_iput(fMLTable, keyChar, smapString, &status); |
| 327 uhash_iput(fMATable, keyChar, smapString, &status); |
305 fKeySet->add(keyChar); | 328 fKeySet->add(keyChar); |
306 if (U_FAILURE(status)) { | 329 if (U_FAILURE(status)) { |
307 return; | 330 return; |
308 } | 331 } |
309 } | 332 } |
310 | 333 |
311 // Input data is now all parsed and collected. | 334 // Input data is now all parsed and collected. |
312 // Now create the run-time binary form of the data. | 335 // Now create the run-time binary form of the data. |
313 // | 336 // |
314 // This is done in two steps. First the data is assembled into vectors and
strings, | 337 // This is done in two steps. First the data is assembled into vectors and
strings, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 return UnicodeString(*fStringTable, value, length); | 619 return UnicodeString(*fStringTable, value, length); |
597 default: | 620 default: |
598 U_ASSERT(FALSE); | 621 U_ASSERT(FALSE); |
599 } | 622 } |
600 return UnicodeString(); | 623 return UnicodeString(); |
601 } | 624 } |
602 | 625 |
603 #endif | 626 #endif |
604 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS | 627 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS |
605 | 628 |
OLD | NEW |