ICU-3050 #ifdef out the names array
X-SVN-Rev: 13020
This commit is contained in:
parent
85a7ef9d1c
commit
820e942574
@ -39,6 +39,7 @@ enum UStringPrepType{
|
||||
|
||||
typedef enum UStringPrepType UStringPrepType;
|
||||
|
||||
#ifdef USPREP_TYPE_NAMES_ARRAY
|
||||
static const char* usprepTypeNames[] ={
|
||||
"UNASSIGNED" ,
|
||||
"MAP" ,
|
||||
@ -47,6 +48,8 @@ static const char* usprepTypeNames[] ={
|
||||
"DELETE",
|
||||
"TYPE_LIMIT"
|
||||
};
|
||||
#endif
|
||||
|
||||
enum{
|
||||
_SPREP_NORMALIZATION_ON = 0x0001,
|
||||
_SPREP_CHECK_BIDI_ON = 0x0002
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
#if !UCONFIG_NO_IDNA
|
||||
|
||||
#define USPREP_TYPE_NAMES_ARRAY
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "cintltst.h"
|
||||
|
@ -63,8 +63,11 @@ NamePrepTransform::NamePrepTransform(UParseError& parseError, UErrorCode& status
|
||||
// create the mapping transliterator
|
||||
int32_t ruleLen = 0;
|
||||
const UChar* ruleUChar = ures_getStringByKey(bundle, "MapNFKC",&ruleLen, &status);
|
||||
UnicodeString rule(ruleUChar, ruleLen);
|
||||
|
||||
int32_t mapRuleLen = 0;
|
||||
const UChar *mapRuleUChar = ures_getStringByKey(bundle, "MapNoNormalization", &mapRuleLen, &status);
|
||||
UnicodeString rule(mapRuleUChar, mapRuleLen);
|
||||
rule.append(ruleUChar, ruleLen);
|
||||
|
||||
mapping = Transliterator::createFromRules(UnicodeString("NamePrepTransform", ""), rule,
|
||||
UTRANS_FORWARD, parseError,status);
|
||||
if(U_FAILURE(status)) {
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#if !UCONFIG_NO_IDNA && !UCONFIG_NO_TRANSLITERATION
|
||||
|
||||
#define USPREP_TYPE_NAMES_ARRAY
|
||||
|
||||
#include "unicode/uchar.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "cmemory.h"
|
||||
|
@ -146,8 +146,8 @@ static UChar unicodeIn[][41] ={
|
||||
0x043e, 0x043d, 0x0438, 0x043d, 0x0435, 0x0433, 0x043e, 0x0432,
|
||||
0x043e, 0x0440, 0x044f, 0x0442, 0x043f, 0x043e, 0x0440, 0x0443,
|
||||
0x0441, 0x0441, 0x043a, 0x0438
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
static const char *asciiIn[] = {
|
||||
@ -174,7 +174,6 @@ static const char *asciiIn[] = {
|
||||
"xn--hxargifdar", // Greek
|
||||
"xn--bonusaa-5bb1da", // Maltese
|
||||
"xn--b1abfaaepdrnnbgefbadotcwatmq2g4l", // Russian (Cyrillic)
|
||||
|
||||
};
|
||||
|
||||
static const char *domainNames[] = {
|
||||
@ -1573,6 +1572,27 @@ void TestIDNA::TestIDNAMonkeyTest(){
|
||||
source.append("\\uCF18\\U00021161\\U000EEF11\\U0002BB82\\U0001D63C");
|
||||
debug(source.getBuffer(),source.length(),UIDNA_ALLOW_UNASSIGNED);
|
||||
source.releaseBuffer();
|
||||
|
||||
{ // test deletion of code points
|
||||
UnicodeString source("\\u043f\\u00AD\\u034f\\u043e\\u0447\\u0435\\u043c\\u0443\\u0436\\u0435\\u043e\\u043d\\u0438\\u043d\\u0435\\u0433\\u043e\\u0432\\u043e\\u0440\\u044f\\u0442\\u043f\\u043e\\u0440\\u0443\\u0441\\u0441\\u043a\\u0438\\u0000");
|
||||
source = source.unescape();
|
||||
UnicodeString expected("\\u043f\\u043e\\u0447\\u0435\\u043c\\u0443\\u0436\\u0435\\u043e\\u043d\\u0438\\u043d\\u0435\\u0433\\u043e\\u0432\\u043e\\u0440\\u044f\\u0442\\u043f\\u043e\\u0440\\u0443\\u0441\\u0441\\u043a\\u0438\\u0000");
|
||||
expected = expected.unescape();
|
||||
UnicodeString ascii("xn--b1abfaaepdrnnbgefbadotcwatmq2g4l");
|
||||
ascii.append((UChar)0x0000);
|
||||
testAPI(source.getBuffer(),ascii.getBuffer(), "uidna_toASCII", FALSE, U_ZERO_ERROR, TRUE, TRUE, uidna_toASCII);
|
||||
source.releaseBuffer();
|
||||
ascii.releaseBuffer();
|
||||
|
||||
testAPI(source.getBuffer(),ascii.getBuffer(), "idnaref_toASCII", FALSE, U_ZERO_ERROR, TRUE, TRUE, idnaref_toASCII);
|
||||
source.releaseBuffer();
|
||||
ascii.releaseBuffer();
|
||||
|
||||
|
||||
testCompareReferenceImpl(source.getBuffer(), source.length()-1);
|
||||
source.releaseBuffer();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
* in various StringPrep conversion processes.
|
||||
*/
|
||||
|
||||
#define USPREP_TYPE_NAMES_ARRAY 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user