X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/08b89b0a244153b9f5bbb2f49c55ab0f7298122e..b331163bffd790ced0e88b73f44f86d49ccc48a5:/icuSources/test/cintltst/utf8tst.c diff --git a/icuSources/test/cintltst/utf8tst.c b/icuSources/test/cintltst/utf8tst.c index 88e1a091..987715ae 100644 --- a/icuSources/test/cintltst/utf8tst.c +++ b/icuSources/test/cintltst/utf8tst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1998-2012, International Business Machines Corporation and + * Copyright (c) 1998-2014, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* @@ -18,8 +18,6 @@ #include "cmemory.h" #include "cintltst.h" -#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) - /* lenient UTF-8 ------------------------------------------------------------ */ /* @@ -101,7 +99,7 @@ static void TestCodeUnitValues() static const uint8_t codeunit[]={0x00, 0x65, 0x7e, 0x7f, 0xc0, 0xc4, 0xf0, 0xfd, 0x80, 0x81, 0xbc, 0xbe,}; int16_t i; - for(i=0; i 0; --i){ + for(i=UPRV_LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){ UTF8_PREV_CHAR_UNSAFE(input, offset, c); if(c != codePoints[i]){ log_err("ERROR: UTF8_PREV_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, codePoints[i], c); } } - for(i=LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){ + for(i=UPRV_LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){ U8_PREV_UNSAFE(input, offset, c); if(c != codePoints[i]){ log_err("ERROR: U8_PREV_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", @@ -608,7 +606,7 @@ static void TestFwdBack() { } offsafe=0; - for(i=0; i0; --i) { + for(i=UPRV_LENGTHOF(boundaries)-2, offset=UPRV_LENGTHOF(input); offset>0; --i) { UTF8_BACK_1_UNSAFE(input, offset); if(offset != boundaries[i]){ log_err("ERROR: UTF8_BACK_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset); } } - for(i=LENGTHOF(boundaries)-2, offset=LENGTHOF(input); offset>0; --i) { + for(i=UPRV_LENGTHOF(boundaries)-2, offset=UPRV_LENGTHOF(input); offset>0; --i) { U8_BACK_1_UNSAFE(input, offset); if(offset != boundaries[i]){ log_err("ERROR: U8_BACK_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset); } } - for(i=0; i