diff --git a/icu4c/source/test/cintltst/cdtdptst.c b/icu4c/source/test/cintltst/cdtdptst.c index c8babec3869..d19b7eedac4 100644 --- a/icu4c/source/test/cintltst/cdtdptst.c +++ b/icu4c/source/test/cintltst/cdtdptst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2005, International Business Machines Corporation and + * Copyright (c) 1997-2006, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -233,11 +233,11 @@ void TestCzechMonths459() UErrorCode status = U_ZERO_ERROR; UChar *date; - ctest_setTimeZone(NULL, &status); + ctest_setTimeZone(NULL, &status); fmt = udat_open(UDAT_FULL, UDAT_FULL, "cs", NULL, 0, NULL, 0, &status); if(U_FAILURE(status)){ log_err("Error in constructing the date format\n"); - ctest_resetTimeZone(); + ctest_resetTimeZone(); return; } lneed=0; @@ -286,7 +286,7 @@ void TestCzechMonths459() else log_verbose("Pass: Date = %s (czech month July)\n", aescstrdup(date, -1)); - ctest_resetTimeZone(); + ctest_resetTimeZone(); udat_close(fmt); ucal_close(cal); free(pattern); diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index 4b0f8b13c13..d4253384198 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -2264,7 +2264,7 @@ static void TestNonexistentLanguageExemplars(void) { } static void TestLanguageExemplarsFallbacks(void) { - /* Test that en_US fallsback, but en doesn't fallback. */ + /* Test that en_US fallsback, but en doesn't fallback. */ UErrorCode ec = U_ZERO_ERROR; ULocaleData *uld = ulocdata_open("en_US",&ec); uset_close(ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_STANDARD, &ec)); @@ -2273,7 +2273,7 @@ static void TestLanguageExemplarsFallbacks(void) { u_errorName(ec)); } ulocdata_close(uld); - ec = U_ZERO_ERROR; + ec = U_ZERO_ERROR; uld = ulocdata_open("en",&ec); uset_close(ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_STANDARD, &ec)); if (ec != U_ZERO_ERROR) { diff --git a/icu4c/source/test/cintltst/cucdtst.c b/icu4c/source/test/cintltst/cucdtst.c index 24e741b8edd..0aa15affa92 100644 --- a/icu4c/source/test/cintltst/cucdtst.c +++ b/icu4c/source/test/cintltst/cucdtst.c @@ -1835,18 +1835,18 @@ TestMirroring() { errorCode=U_ZERO_ERROR; set=uset_openPattern(mirroredPattern, 17, &errorCode); - if (U_FAILURE(errorCode)) { - log_data_err("uset_openPattern(mirroredPattern, 17, &errorCode) failed!"); - } else { - for(i=0; 0==uset_getItem(set, i, &start, &end, NULL, 0, &errorCode); ++i) { - do { - c2=u_charMirror(start); - c3=u_charMirror(c2); - if(c3!=start) { - log_err("u_charMirror() does not roundtrip: U+%04lx->U+%04lx->U+%04lx\n", (long)start, (long)c2, (long)c3); - } - } while(++start<=end); - } + if (U_FAILURE(errorCode)) { + log_data_err("uset_openPattern(mirroredPattern, 17, &errorCode) failed!"); + } else { + for(i=0; 0==uset_getItem(set, i, &start, &end, NULL, 0, &errorCode); ++i) { + do { + c2=u_charMirror(start); + c3=u_charMirror(c2); + if(c3!=start) { + log_err("u_charMirror() does not roundtrip: U+%04lx->U+%04lx->U+%04lx\n", (long)start, (long)c2, (long)c3); + } + } while(++start<=end); + } } uset_close(set); diff --git a/icu4c/source/test/cintltst/custrtrn.c b/icu4c/source/test/cintltst/custrtrn.c index 029e22d09b1..0335a005575 100644 --- a/icu4c/source/test/cintltst/custrtrn.c +++ b/icu4c/source/test/cintltst/custrtrn.c @@ -1066,7 +1066,7 @@ static void Test_UChar_WCHART_API(void){ } } #else - log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); + log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); #endif } @@ -1108,7 +1108,7 @@ static void Test_widestrs() log_err("u_strFromWCS: wcs = %S, wl = %d,rts = %s, rtl = %d!\n", wcs, wl, u_austrcpy(astr, rts), rtl); } #else - log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); + log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); #endif } @@ -1172,7 +1172,7 @@ Test_WCHART_LongString(){ /* close the bundle */ ures_close(theBundle); #else - log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); + log_info("Not testing u_str*WCS because (!UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION) and wchar is neither utf16 nor utf32"); #endif } diff --git a/icu4c/source/test/cintltst/reapits.c b/icu4c/source/test/cintltst/reapits.c index aeff077a1cf..d2999ed54cc 100644 --- a/icu4c/source/test/cintltst/reapits.c +++ b/icu4c/source/test/cintltst/reapits.c @@ -984,10 +984,10 @@ static void TestRegexCAPI(void) { } static void TestBug4315(void) { - UErrorCode theICUError = U_ZERO_ERROR; - URegularExpression *theRegEx; + UErrorCode theICUError = U_ZERO_ERROR; + URegularExpression *theRegEx; UChar *textBuff; - const char *thePattern; + const char *thePattern; UChar theString[100]; UChar *destFields[24]; int32_t neededLength1; @@ -996,7 +996,7 @@ static void TestBug4315(void) { int32_t wordCount = 0; int32_t destFieldsSize = 24; - thePattern = "ck "; + thePattern = "ck "; u_uastrcpy(theString, "The quick brown fox jumped over the slow black turtle."); /* open a regex */ diff --git a/icu4c/source/test/intltest/canittst.cpp b/icu4c/source/test/intltest/canittst.cpp index 58fe8aa76ae..8e97744c4d7 100644 --- a/icu4c/source/test/intltest/canittst.cpp +++ b/icu4c/source/test/intltest/canittst.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2002-2005, International Business Machines Corporation and + * Copyright (c) 2002-2006, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************** * @@ -90,10 +90,10 @@ void CanonicalIteratorTest::TestExhaustive() { || type == U_SURROGATE) continue; s = i; - characterTest(s, i, it); + characterTest(s, i, it); s += (UChar32)0x0345; //"\\u0345"; - characterTest(s, i, it); + characterTest(s, i, it); } } @@ -176,7 +176,7 @@ void CanonicalIteratorTest::characterTest(UnicodeString &s, UChar32 ch, Canonica UBool gotComp = FALSE; UBool gotSource = FALSE; - Normalizer::decompose(s, FALSE, 0, decomp, status); + Normalizer::decompose(s, FALSE, 0, decomp, status); Normalizer::compose(s, FALSE, 0, comp, status); // skip characters that don't have either decomp. diff --git a/icu4c/source/test/intltest/canittst.h b/icu4c/source/test/intltest/canittst.h index 2a907718394..650cc089db0 100644 --- a/icu4c/source/test/intltest/canittst.h +++ b/icu4c/source/test/intltest/canittst.h @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2002-2005, International Business Machines Corporation and + * Copyright (c) 2002-2006, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************** * @@ -46,7 +46,7 @@ public: //static UnicodeString collectionToString(Collection col); private: void expectEqual(const UnicodeString &message, const UnicodeString &item, const UnicodeString &a, const UnicodeString &b); - void characterTest(UnicodeString &s, UChar32 ch, CanonicalIterator &it); + void characterTest(UnicodeString &s, UChar32 ch, CanonicalIterator &it); Transliterator *nameTrans; Transliterator *hexTrans; diff --git a/icu4c/source/test/intltest/idnaref.cpp b/icu4c/source/test/intltest/idnaref.cpp index 73914eb68de..61045c567c3 100644 --- a/icu4c/source/test/intltest/idnaref.cpp +++ b/icu4c/source/test/intltest/idnaref.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 2003-2005, International Business Machines + * Copyright (C) 2003-2006, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -34,7 +34,7 @@ static const UChar ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ; #define MAX_LABEL_LENGTH 63 #define HYPHEN 0x002D /* The Max length of the labels should not be more than 64 */ -#define MAX_LABEL_BUFFER_SIZE 100 +#define MAX_LABEL_BUFFER_SIZE 100 #define MAX_IDN_BUFFER_SIZE 300 #define CAPITAL_A 0x0041 @@ -43,7 +43,7 @@ static const UChar ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ; #define FULL_STOP 0x002E -inline static UBool +inline static UBool startsWithPrefix(const UChar* src , int32_t srcLength){ UBool startsWithPrefix = TRUE; @@ -59,7 +59,7 @@ startsWithPrefix(const UChar* src , int32_t srcLength){ return startsWithPrefix; } -inline static UChar +inline static UChar toASCIILower(UChar ch){ if(CAPITAL_A <= ch && ch <= CAPITAL_Z){ return ch + LOWER_CASE_DELTA; @@ -68,7 +68,7 @@ toASCIILower(UChar ch){ } inline static int32_t -compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len, +compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len, const UChar* s2, int32_t s2Len){ if(s1Len != s2Len){ return (s1Len > s2Len) ? s1Len : s2Len; @@ -81,10 +81,10 @@ compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len, if(i == s1Len) { return 0; } - + c1 = s1[i]; c2 = s2[i]; - + /* Case-insensitive comparison */ if(c1!=c2) { rc=(int32_t)toASCIILower(c1)-(int32_t)toASCIILower(c2); @@ -93,7 +93,7 @@ compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len, } } } - + } static UErrorCode getError(enum punycode_status status){ @@ -125,8 +125,8 @@ static inline int32_t convertUCharsToASCII(const UChar* src,char* dest, int32_t } return i; } -// wrapper around the reference Punycode implementation -static int32_t convertToPuny(const UChar* src, int32_t srcLength, +// wrapper around the reference Punycode implementation +static int32_t convertToPuny(const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, UErrorCode& status){ uint32_t b1Stack[MAX_LABEL_BUFFER_SIZE]; @@ -149,7 +149,7 @@ static int32_t convertToPuny(const UChar* src, int32_t srcLength, } status = U_ZERO_ERROR; // reset error - + u_strToUTF32((UChar32*)b1,b1Len,&b1Len,src,srcLength,&status); } if(U_FAILURE(status)){ @@ -160,7 +160,7 @@ static int32_t convertToPuny(const UChar* src, int32_t srcLength, error = punycode_encode(b1Len,b1,caseFlags, (uint32_t*)&b2Len, b2); status = getError(error); - + if(status == U_BUFFER_OVERFLOW_ERROR){ /* we do not have enough room so grow the buffer*/ b2 = (char*) uprv_malloc( b2Len * sizeof(char)); @@ -177,7 +177,7 @@ static int32_t convertToPuny(const UChar* src, int32_t srcLength, if(U_FAILURE(status)){ goto CLEANUP; } - + if(b2Len < destCapacity){ convertASCIIToUChars(b2,dest,b2Len); }else{ @@ -236,17 +236,17 @@ CLEANUP: } uprv_free(caseFlags); - return destLen; + return destLen; } - + U_CFUNC int32_t U_EXPORT2 -idnaref_toASCII(const UChar* src, int32_t srcLength, +idnaref_toASCII(const UChar* src, int32_t srcLength, UChar* dest, int32_t destCapacity, int32_t options, UParseError* parseError, UErrorCode* status){ - + if(status == NULL || U_FAILURE(*status)){ return 0; } @@ -257,8 +257,8 @@ idnaref_toASCII(const UChar* src, int32_t srcLength, UChar b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE]; //initialize pointers to stack buffers UChar *b1 = b1Stack, *b2 = b2Stack; - int32_t b1Len=0, b2Len=0, - b1Capacity = MAX_LABEL_BUFFER_SIZE, + int32_t b1Len=0, b2Len=0, + b1Capacity = MAX_LABEL_BUFFER_SIZE, b2Capacity = MAX_LABEL_BUFFER_SIZE , reqLength=0; @@ -267,18 +267,18 @@ idnaref_toASCII(const UChar* src, int32_t srcLength, UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0); UBool* caseFlags = NULL; - + // assume the source contains all ascii codepoints UBool srcIsASCII = TRUE; // assume the source contains all LDH codepoints - UBool srcIsLDH = TRUE; + UBool srcIsLDH = TRUE; int32_t j=0; if(srcLength == -1){ srcLength = u_strlen(src); } - // step 1 + // step 1 for( j=0;j 0x7F){ srcIsASCII = FALSE; @@ -291,9 +291,9 @@ idnaref_toASCII(const UChar* src, int32_t srcLength, if(U_FAILURE(*status)){ goto CLEANUP; } - + b1Len = prep->process(src,srcLength,b1, b1Capacity,allowUnassigned,parseError,*status); - + if(*status == U_BUFFER_OVERFLOW_ERROR){ // redo processing of string /* we do not have enough room so grow the buffer*/ @@ -304,29 +304,29 @@ idnaref_toASCII(const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - + b1Len = prep->process(src,srcLength,b1, b1Len,allowUnassigned, parseError, *status); } // error bail out if(U_FAILURE(*status)){ goto CLEANUP; - } + } if(b1Len == 0){ *status = U_IDNA_ZERO_LENGTH_LABEL_ERROR; goto CLEANUP; - } + } srcIsASCII = TRUE; // step 3 & 4 for( j=0;j 0x7F){// check if output of usprep_prepare is all ASCII + if(b1[j] > 0x7F){// check if output of usprep_prepare is all ASCII srcIsASCII = FALSE; }else if(prep->isLDHChar(b1[j])==FALSE){ // if the char is in ASCII range verify that it is an LDH character{ srcIsLDH = FALSE; } } - + if(useSTD3ASCIIRules == TRUE){ // verify 3a and 3b if( srcIsLDH == FALSE /* source contains some non-LDH characters */ @@ -355,14 +355,14 @@ idnaref_toASCII(const UChar* src, int32_t srcLength, if(*status == U_BUFFER_OVERFLOW_ERROR){ // redo processing of string /* we do not have enough room so grow the buffer*/ - b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR); + b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR); if(b2 == NULL){ *status = U_MEMORY_ALLOCATION_ERROR; goto CLEANUP; } *status = U_ZERO_ERROR; // reset error - + b2Len = convertToPuny(b1, b1Len, b2, b2Len, *status); //b2Len = u_strToPunycode(b2,b2Len,b1,b1Len, caseFlags, status); @@ -383,7 +383,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength, uprv_memcpy(dest+ACE_PREFIX_LENGTH, b2, b2Len * U_SIZEOF_UCHAR); }else{ - *status = U_IDNA_ACE_PREFIX_ERROR; + *status = U_IDNA_ACE_PREFIX_ERROR; goto CLEANUP; } } @@ -400,7 +400,7 @@ CLEANUP: uprv_free(b2); } uprv_free(caseFlags); - + // delete prep; return u_terminateUChars(dest, destCapacity, reqLength, status); @@ -423,18 +423,18 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, } - + UChar b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE], b3Stack[MAX_LABEL_BUFFER_SIZE]; //initialize pointers to stack buffers UChar *b1 = b1Stack, *b2 = b2Stack, *b1Prime=NULL, *b3=b3Stack; int32_t b1Len, b2Len, b1PrimeLen, b3Len, - b1Capacity = MAX_LABEL_BUFFER_SIZE, + b1Capacity = MAX_LABEL_BUFFER_SIZE, b2Capacity = MAX_LABEL_BUFFER_SIZE, b3Capacity = MAX_LABEL_BUFFER_SIZE, reqLength=0; // UParseError parseError; - + NamePrepTransform* prep = TestIDNA::getInstance(*status); b1Len = 0; UBool* caseFlags = NULL; @@ -450,7 +450,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, if(U_FAILURE(*status)){ goto CLEANUP; } - // step 1: find out if all the codepoints in src are ASCII + // step 1: find out if all the codepoints in src are ASCII if(srcLength==-1){ srcLength = 0; for(;src[srcLength]!=0;){ @@ -492,7 +492,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - + b1Len = prep->process(src,srcLength,b1, b1Len,allowUnassigned, parseError, *status); } //bail out on error @@ -536,12 +536,12 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - + b2Len = convertFromPuny(b1Prime,b1PrimeLen, b2, b2Len, *status); //b2Len = u_strFromPunycode(b2, b2Len,b1Prime,b1PrimeLen,caseFlags, status); } - - + + //step 6:Apply toASCII b3Len = idnaref_toASCII(b2,b2Len,b3,b3Capacity,options,parseError, status); @@ -555,9 +555,9 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - + b3Len = idnaref_toASCII(b2,b2Len,b3,b3Len, options, parseError, status); - + } //bail out on error if(U_FAILURE(*status)){ @@ -566,7 +566,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, //step 7: verify if(compareCaseInsensitiveASCII(b1, b1Len, b3, b3Len) !=0){ - *status = U_IDNA_VERIFICATION_ERROR; + *status = U_IDNA_VERIFICATION_ERROR; goto CLEANUP; } @@ -587,7 +587,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength, // failPos is always set the index of failure uprv_syntaxError(src,failPos, srcLength,parseError); }else if(src[0] == HYPHEN){ - // fail position is 0 + // fail position is 0 uprv_syntaxError(src,0,srcLength,parseError); }else{ // the last index in the source is always length-1 @@ -613,7 +613,7 @@ CLEANUP: uprv_free(b2); } uprv_free(caseFlags); - + // delete prep; return u_terminateUChars(dest, destCapacity, reqLength, status); @@ -636,7 +636,7 @@ getNextSeparator(UChar *src,int32_t srcLength,NamePrepTransform* prep, if(prep->isLabelSeparator(src[i],*status)){ *limit = src + (i+1); // go past the delimiter return i; - + } } }else{ @@ -675,7 +675,7 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, // UParseError parseError; NamePrepTransform* prep = TestIDNA::getInstance(*status); - + //initialize pointers to stack buffers UChar b1Stack[MAX_LABEL_BUFFER_SIZE]; UChar *b1 = b1Stack; @@ -684,7 +684,7 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, UChar* labelStart = (UChar*)src; int32_t remainingLen = srcLength; int32_t b1Capacity = MAX_LABEL_BUFFER_SIZE; - + //get the options // UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0); // UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0); @@ -697,7 +697,7 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, if(srcLength == -1){ for(;;){ - + if(*delimiter == 0){ break; } @@ -705,8 +705,8 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, labelLen = getNextSeparator(labelStart, -1, prep, &delimiter, &done, status); b1Len = 0; if(!(labelLen==0 && done)){// make sure this is not a root label separator. - - b1Len = idnaref_toASCII(labelStart, labelLen, b1, b1Capacity, + + b1Len = idnaref_toASCII(labelStart, labelLen, b1, b1Capacity, options, parseError, status); if(*status == U_BUFFER_OVERFLOW_ERROR){ @@ -719,12 +719,12 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - + b1Len = idnaref_toASCII(labelStart, labelLen, b1, b1Len, options, parseError, status); - + } - } + } if(U_FAILURE(*status)){ goto CLEANUP; @@ -749,13 +749,13 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, } }else{ for(;;){ - + if(delimiter == src+srcLength){ break; } labelLen = getNextSeparator(labelStart, remainingLen, prep, &delimiter, &done, status); - + b1Len = idnaref_toASCII(labelStart, labelLen, b1, b1Capacity, options,parseError, status); @@ -769,12 +769,12 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - - b1Len = idnaref_toASCII(labelStart, labelLen, b1, b1Len, + + b1Len = idnaref_toASCII(labelStart, labelLen, b1, b1Len, options, parseError, status); - + } - + if(U_FAILURE(*status)){ goto CLEANUP; } @@ -801,11 +801,11 @@ idnaref_IDNToASCII( const UChar* src, int32_t srcLength, CLEANUP: - + if(b1 != b1Stack){ uprv_free(b1); } - + // delete prep; return u_terminateUChars(dest, destCapacity, reqLength, status); @@ -817,7 +817,7 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, int32_t options, UParseError* parseError, UErrorCode* status){ - + if(status == NULL || U_FAILURE(*status)){ return 0; } @@ -827,11 +827,11 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, } int32_t reqLength = 0; - + UBool done = FALSE; NamePrepTransform* prep = TestIDNA::getInstance(*status); - + //initialize pointers to stack buffers UChar b1Stack[MAX_LABEL_BUFFER_SIZE]; UChar *b1 = b1Stack; @@ -840,25 +840,25 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, UChar* labelStart = (UChar*)src; int32_t remainingLen = srcLength; int32_t b1Capacity = MAX_LABEL_BUFFER_SIZE; - + //get the options // UBool allowUnassigned = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0); // UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0); - + if(U_FAILURE(*status)){ goto CLEANUP; } - + if(srcLength == -1){ for(;;){ - + if(*delimiter == 0){ break; } labelLen = getNextSeparator(labelStart, -1, prep, &delimiter, &done, status); - - if(labelLen==0 && done==FALSE){ + + if(labelLen==0 && done==FALSE){ *status = U_IDNA_ZERO_LENGTH_LABEL_ERROR; } b1Len = idnaref_toUnicode(labelStart, labelLen, b1, b1Capacity, @@ -874,12 +874,12 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - - b1Len = idnaref_toUnicode( labelStart, labelLen, b1, b1Len, + + b1Len = idnaref_toUnicode( labelStart, labelLen, b1, b1Len, options, parseError, status); - + } - + if(U_FAILURE(*status)){ goto CLEANUP; } @@ -902,17 +902,17 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, } }else{ for(;;){ - + if(delimiter == src+srcLength){ break; } labelLen = getNextSeparator(labelStart, remainingLen, prep, &delimiter, &done, status); - - if(labelLen==0 && done==FALSE){ + + if(labelLen==0 && done==FALSE){ *status = U_IDNA_ZERO_LENGTH_LABEL_ERROR; - } - + } + b1Len = idnaref_toUnicode( labelStart,labelLen, b1, b1Capacity, options, parseError, status); @@ -926,12 +926,12 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, } *status = U_ZERO_ERROR; // reset error - - b1Len = idnaref_toUnicode( labelStart, labelLen, b1, b1Len, + + b1Len = idnaref_toUnicode( labelStart, labelLen, b1, b1Len, options, parseError, status); - + } - + if(U_FAILURE(*status)){ goto CLEANUP; } @@ -957,13 +957,13 @@ idnaref_IDNToUnicode( const UChar* src, int32_t srcLength, } CLEANUP: - + if(b1 != b1Stack){ uprv_free(b1); } - + // delete prep; - + return u_terminateUChars(dest, destCapacity, reqLength, status); } @@ -981,7 +981,7 @@ idnaref_compare( const UChar *s1, int32_t length1, UChar *b1 = b1Stack, *b2 = b2Stack; int32_t b1Len, b2Len, b1Capacity = MAX_IDN_BUFFER_SIZE, b2Capacity = MAX_IDN_BUFFER_SIZE; int32_t result = -1; - + UParseError parseError; b1Len = idnaref_IDNToASCII(s1, length1, b1, b1Capacity, options, &parseError, status); @@ -995,9 +995,9 @@ idnaref_compare( const UChar *s1, int32_t length1, } *status = U_ZERO_ERROR; // reset error - + b1Len = idnaref_IDNToASCII(s1,length1,b1,b1Len, options, &parseError, status); - + } b2Len = idnaref_IDNToASCII(s2,length2,b2,b2Capacity,options, &parseError, status); @@ -1011,9 +1011,9 @@ idnaref_compare( const UChar *s1, int32_t length1, } *status = U_ZERO_ERROR; // reset error - + b2Len = idnaref_IDNToASCII(s2,length2,b2,b2Len,options, &parseError, status); - + } // when toASCII is applied all label separators are replaced with FULL_STOP result = compareCaseInsensitiveASCII(b1,b1Len,b2,b2Len); diff --git a/icu4c/source/test/intltest/tmsgfmt.cpp b/icu4c/source/test/intltest/tmsgfmt.cpp index 3e214f7ddff..4b2269c9290 100644 --- a/icu4c/source/test/intltest/tmsgfmt.cpp +++ b/icu4c/source/test/intltest/tmsgfmt.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2005, International Business Machines Corporation and + * Copyright (c) 1997-2006, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* @@ -1238,19 +1238,19 @@ void TestMessageFormat::testAutoQuoteApostrophe(void) { int32_t pattern_count = sizeof(patterns)/sizeof(patterns[0]); for (int i = 0; i < pattern_count; i += 2) { - UErrorCode status = U_ZERO_ERROR; + UErrorCode status = U_ZERO_ERROR; UnicodeString result = MessageFormat::autoQuoteApostrophe(patterns[i], status); UnicodeString target(patterns[i+1]); if (target != result) { - const int BUF2_LEN = 64; - char buf[256]; - char buf2[BUF2_LEN]; - int32_t len = result.extract(0, result.length(), buf2, BUF2_LEN); - if (len >= BUF2_LEN) { - buf2[BUF2_LEN-1] = 0; - } - sprintf(buf, "[%2d] test \"%s\": target (\"%s\") != result (\"%s\")\n", i/2, patterns[i], patterns[i+1], buf2); - errln(buf); + const int BUF2_LEN = 64; + char buf[256]; + char buf2[BUF2_LEN]; + int32_t len = result.extract(0, result.length(), buf2, BUF2_LEN); + if (len >= BUF2_LEN) { + buf2[BUF2_LEN-1] = 0; + } + sprintf(buf, "[%2d] test \"%s\": target (\"%s\") != result (\"%s\")\n", i/2, patterns[i], patterns[i+1], buf2); + errln(buf); } } } diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index 50af6517a0f..38be8a2aca6 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -4319,79 +4319,79 @@ void TransliteratorTest::TestBeginEndToRules() { } void TransliteratorTest::TestRegisterAlias() { - UnicodeString longID("Lower;[aeiou]Upper"); - UnicodeString shortID("Any-CapVowels"); - UnicodeString reallyShortID("CapVowels"); - - Transliterator::registerAlias(shortID, longID); + UnicodeString longID("Lower;[aeiou]Upper"); + UnicodeString shortID("Any-CapVowels"); + UnicodeString reallyShortID("CapVowels"); - UErrorCode err = U_ZERO_ERROR; - Transliterator* t1 = Transliterator::createInstance(longID, UTRANS_FORWARD, err); - if (U_FAILURE(err)) { - errln("Failed to instantiate transliterator with long ID"); - Transliterator::unregister(shortID); - return; - } - Transliterator* t2 = Transliterator::createInstance(reallyShortID, UTRANS_FORWARD, err); - if (U_FAILURE(err)) { - errln("Failed to instantiate transliterator with short ID"); - delete t1; - Transliterator::unregister(shortID); - return; - } - - if (t1->getID() != longID) - errln("Transliterator instantiated with long ID doesn't have long ID"); - if (t2->getID() != reallyShortID) - errln("Transliterator instantiated with short ID doesn't have short ID"); + Transliterator::registerAlias(shortID, longID); - UnicodeString rules1; - UnicodeString rules2; + UErrorCode err = U_ZERO_ERROR; + Transliterator* t1 = Transliterator::createInstance(longID, UTRANS_FORWARD, err); + if (U_FAILURE(err)) { + errln("Failed to instantiate transliterator with long ID"); + Transliterator::unregister(shortID); + return; + } + Transliterator* t2 = Transliterator::createInstance(reallyShortID, UTRANS_FORWARD, err); + if (U_FAILURE(err)) { + errln("Failed to instantiate transliterator with short ID"); + delete t1; + Transliterator::unregister(shortID); + return; + } - t1->toRules(rules1, TRUE); - t2->toRules(rules2, TRUE); - if (rules1 != rules2) - errln("Alias transliterators aren't the same"); + if (t1->getID() != longID) + errln("Transliterator instantiated with long ID doesn't have long ID"); + if (t2->getID() != reallyShortID) + errln("Transliterator instantiated with short ID doesn't have short ID"); - delete t1; - delete t2; - Transliterator::unregister(shortID); + UnicodeString rules1; + UnicodeString rules2; - t1 = Transliterator::createInstance(shortID, UTRANS_FORWARD, err); - if (U_SUCCESS(err)) { - errln("Instantiation with short ID succeeded after short ID was unregistered"); - delete t1; - } + t1->toRules(rules1, TRUE); + t2->toRules(rules2, TRUE); + if (rules1 != rules2) + errln("Alias transliterators aren't the same"); - // try the same thing again, but this time with something other than - // an instance of CompoundTransliterator - UnicodeString realID("Latin-Greek"); - UnicodeString fakeID("Latin-dlgkjdflkjdl"); - Transliterator::registerAlias(fakeID, realID); + delete t1; + delete t2; + Transliterator::unregister(shortID); - err = U_ZERO_ERROR; - t1 = Transliterator::createInstance(realID, UTRANS_FORWARD, err); - if (U_FAILURE(err)) { - errln("Failed to instantiate transliterator with real ID"); - Transliterator::unregister(realID); - return; - } - t2 = Transliterator::createInstance(fakeID, UTRANS_FORWARD, err); - if (U_FAILURE(err)) { - errln("Failed to instantiate transliterator with fake ID"); - delete t1; - Transliterator::unregister(realID); - return; - } + t1 = Transliterator::createInstance(shortID, UTRANS_FORWARD, err); + if (U_SUCCESS(err)) { + errln("Instantiation with short ID succeeded after short ID was unregistered"); + delete t1; + } - t1->toRules(rules1, TRUE); - t2->toRules(rules2, TRUE); - if (rules1 != rules2) - errln("Alias transliterators aren't the same"); + // try the same thing again, but this time with something other than + // an instance of CompoundTransliterator + UnicodeString realID("Latin-Greek"); + UnicodeString fakeID("Latin-dlgkjdflkjdl"); + Transliterator::registerAlias(fakeID, realID); - delete t1; - delete t2; - Transliterator::unregister(fakeID); + err = U_ZERO_ERROR; + t1 = Transliterator::createInstance(realID, UTRANS_FORWARD, err); + if (U_FAILURE(err)) { + errln("Failed to instantiate transliterator with real ID"); + Transliterator::unregister(realID); + return; + } + t2 = Transliterator::createInstance(fakeID, UTRANS_FORWARD, err); + if (U_FAILURE(err)) { + errln("Failed to instantiate transliterator with fake ID"); + delete t1; + Transliterator::unregister(realID); + return; + } + + t1->toRules(rules1, TRUE); + t2->toRules(rules2, TRUE); + if (rules1 != rules2) + errln("Alias transliterators aren't the same"); + + delete t1; + delete t2; + Transliterator::unregister(fakeID); } //====================================================================== diff --git a/icu4c/source/test/intltest/transtst.h b/icu4c/source/test/intltest/transtst.h index e8e58c71998..8ffac67bc3e 100644 --- a/icu4c/source/test/intltest/transtst.h +++ b/icu4c/source/test/intltest/transtst.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2005, International Business Machines +* Copyright (C) 1999-2006, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -345,19 +345,19 @@ private: void TestAlternateSyntax(void); /** - * Tests the multiple-pass syntax - */ - void TestBeginEnd(void); + * Tests the multiple-pass syntax + */ + void TestBeginEnd(void); /** - * Tests that toRules() works right with the multiple-pass syntax - */ - void TestBeginEndToRules(void); + * Tests that toRules() works right with the multiple-pass syntax + */ + void TestBeginEndToRules(void); - /** - * Tests the registerAlias() function - */ - void TestRegisterAlias(void); + /** + * Tests the registerAlias() function + */ + void TestRegisterAlias(void); //====================================================================== // Support methods diff --git a/icu4c/source/test/intltest/tsdtfmsy.cpp b/icu4c/source/test/intltest/tsdtfmsy.cpp index 38a4a4b8937..e281505b6f0 100644 --- a/icu4c/source/test/intltest/tsdtfmsy.cpp +++ b/icu4c/source/test/intltest/tsdtfmsy.cpp @@ -61,17 +61,17 @@ void IntlTestDateFormatSymbols::TestGetMonths2() DateFormatSymbols::DtWidthType width[] = {DateFormatSymbols::WIDE, DateFormatSymbols::ABBREVIATED, DateFormatSymbols::NARROW}; for (int32_t i = 0; i < 2; i++) { - for (int32_t j = 0; j < 3; j++) { + for (int32_t j = 0; j < 3; j++) { int32_t cnt; - const UnicodeString * month = symbol->getMonths(cnt,context[i],width[j]); + const UnicodeString * month = symbol->getMonths(cnt,context[i],width[j]); - logln((UnicodeString)"size = " + cnt); + logln((UnicodeString)"size = " + cnt); - for (int32_t k = 0; k < cnt; k++) { - logln(month[k]); - } - } - } + for (int32_t k = 0; k < cnt; k++) { + logln(month[k]); + } + } + } delete symbol; } @@ -86,17 +86,17 @@ void IntlTestDateFormatSymbols::TestGetWeekdays2() DateFormatSymbols::DtWidthType width[] = {DateFormatSymbols::WIDE, DateFormatSymbols::ABBREVIATED, DateFormatSymbols::NARROW}; for (int32_t i = 0; i < 2; i++) { - for (int32_t j = 0; j < 3; j++) { + for (int32_t j = 0; j < 3; j++) { int32_t cnt; - const UnicodeString * wd = symbol->getWeekdays(cnt,context[i],width[j]); + const UnicodeString * wd = symbol->getWeekdays(cnt,context[i],width[j]); - logln((UnicodeString)"size = " + cnt); + logln((UnicodeString)"size = " + cnt); - for (int32_t k = 0; k < cnt; k++) { - logln(wd[k]); - } - } - } + for (int32_t k = 0; k < cnt; k++) { + logln(wd[k]); + } + } + } delete symbol; } diff --git a/icu4c/source/test/iotest/filetst.c b/icu4c/source/test/iotest/filetst.c index 49de135a7e8..1e908e42a1b 100644 --- a/icu4c/source/test/iotest/filetst.c +++ b/icu4c/source/test/iotest/filetst.c @@ -436,12 +436,12 @@ static void TestfgetsBuffers(void) { } u_fputc(0x3BC, myFile); - if (u_fputc(0x110000, myFile) != U_EOF) { + if (u_fputc(0x110000, myFile) != U_EOF) { log_err("u_fputc should return U_EOF for 0x110000.\n"); - } - if (u_fputc((UChar32)0xFFFFFFFFu, myFile) != U_EOF) { + } + if (u_fputc((UChar32)0xFFFFFFFFu, myFile) != U_EOF) { log_err("u_fputc should return U_EOF for 0xFFFFFFFF.\n"); - } + } u_fputc(0xFF41, myFile); u_memset(buffer, 0xBEEF, sizeof(buffer)/sizeof(buffer[0])); u_memset(expectedBuffer, 0, sizeof(expectedBuffer)/sizeof(expectedBuffer[0])); @@ -1399,32 +1399,32 @@ static void TestVargs(void) { static void TestUnicodeFormat(void) { #if !UCONFIG_NO_FORMATTING - /* Make sure that invariant conversion doesn't happen on the _u formats. */ + /* Make sure that invariant conversion doesn't happen on the _u formats. */ UChar myUString[256]; - UFILE *myFile; - static const UChar TEST_STR[] = { 0x03BC, 0x0025, 0x0024, 0}; - static const UChar PERCENT_S[] = { 0x03BC, 0x0025, 0x0053, 0}; + UFILE *myFile; + static const UChar TEST_STR[] = { 0x03BC, 0x0025, 0x0024, 0}; + static const UChar PERCENT_S[] = { 0x03BC, 0x0025, 0x0053, 0}; - u_memset(myUString, 0x2a, sizeof(myUString)/sizeof(*myUString)); + u_memset(myUString, 0x2a, sizeof(myUString)/sizeof(*myUString)); myFile = u_fopen(STANDARD_TEST_FILE, "w", NULL, "UTF-8"); if (!myFile) { log_err("Test file can't be opened\n"); return; } - u_fprintf_u(myFile, PERCENT_S, TEST_STR); - u_fclose(myFile); + u_fprintf_u(myFile, PERCENT_S, TEST_STR); + u_fclose(myFile); myFile = u_fopen(STANDARD_TEST_FILE, "r", NULL, "UTF-8"); if (!myFile) { log_err("Test file can't be opened\n"); return; } - u_fscanf_u(myFile, PERCENT_S, myUString); - u_fclose(myFile); - if (u_strcmp(TEST_STR, myUString) != 0) { + u_fscanf_u(myFile, PERCENT_S, myUString); + u_fclose(myFile); + if (u_strcmp(TEST_STR, myUString) != 0) { log_err("u_fscanf_u doesn't work.\n"); - } + } #endif } diff --git a/icu4c/source/test/iotest/strtst.c b/icu4c/source/test/iotest/strtst.c index c8a267335c5..0412f25efb2 100644 --- a/icu4c/source/test/iotest/strtst.c +++ b/icu4c/source/test/iotest/strtst.c @@ -282,7 +282,7 @@ static void TestLocalizedString(void) { u_fprintf(strFile, "%d", 1234); u_frewind(strFile); - numResult = -1; + numResult = -1; u_fscanf(strFile, "%d", &numResult); u_fclose(strFile); u_uastrcpy(uBuffer,"1.234"); @@ -297,15 +297,15 @@ static void TestLocalizedString(void) { strFile = u_fstropen(testStr, sizeof(testStr)/sizeof(testStr[0]), NULL); u_fprintf(strFile, "%d", 1234); u_frewind(strFile); - numResult = -1; + numResult = -1; u_fscanf(strFile, "%d", &numResult); u_fclose(strFile); if (numResult != 1234) { - log_err("u_fscanf failed to work on a default locale string Got: %d, Expected: 1234\n", numResult); + log_err("u_fscanf failed to work on a default locale string Got: %d, Expected: 1234\n", numResult); + } + if (u_fstropen(testStr, -1, NULL) != NULL) { + log_err("u_fstropen returned a UFILE* on a negative buffer size\n", numResult); } - if (u_fstropen(testStr, -1, NULL) != NULL) { - log_err("u_fstropen returned a UFILE* on a negative buffer size\n", numResult); - } #endif }