]> granicus.if.org Git - icu/commitdiff
ICU-13340 obsolete unicode/utf_old.h: add U_HIDE_OBSOLETE_UTF_OLD_H to optionally...
authorMarkus Scherer <markus.icu@gmail.com>
Thu, 14 Sep 2017 06:24:35 +0000 (06:24 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Thu, 14 Sep 2017 06:24:35 +0000 (06:24 +0000)
X-SVN-Rev: 40413

27 files changed:
icu4c/readme.html
icu4c/source/common/unicode/utf_old.h
icu4c/source/common/utf_impl.cpp
icu4c/source/test/cintltst/cbiditransformtst.c
icu4c/source/test/cintltst/cintltst.h
icu4c/source/test/cintltst/citertst.c
icu4c/source/test/cintltst/crestst.c
icu4c/source/test/cintltst/creststn.c
icu4c/source/test/cintltst/cucdtst.c
icu4c/source/test/cintltst/ncnvtst.c
icu4c/source/test/cintltst/reapits.c
icu4c/source/test/cintltst/trie2test.c
icu4c/source/test/cintltst/ucnvseltst.c
icu4c/source/test/cintltst/utf16tst.c
icu4c/source/test/cintltst/utf8tst.c
icu4c/source/test/intltest/citrtest.cpp
icu4c/source/test/intltest/convtest.cpp
icu4c/source/test/intltest/idnaconf.cpp
icu4c/source/test/intltest/intltest.cpp
icu4c/source/test/intltest/intltest.h
icu4c/source/test/intltest/regextst.cpp
icu4c/source/test/intltest/strtest.cpp
icu4c/source/test/intltest/testidna.cpp
icu4c/source/test/intltest/testutil.cpp
icu4c/source/test/intltest/ucharstrietest.cpp
icu4c/source/test/intltest/usettest.cpp
icu4c/source/test/intltest/utxttest.cpp

index 953ff43bc744e8419cbee935886fd61199c6d5fc..68d4804577bb1ef549523c5ef5b35a8540ab20fe 100644 (file)
         (via -D or uconfig.h, as above)
         and include those header files explicitly that you actually need.<br />
         Note: The ICU test suites cannot be compiled with this setting.</li>
+      <li><b>utf_old.h:</b>
+        All of utf_old.h is deprecated or obsolete.<br />
+        Beginning with ICU 60,
+        you should define <code>U_HIDE_OBSOLETE_UTF_OLD_H</code> to 1
+        (via -D or uconfig.h, as above).
+        Use of any of these macros should be replaced as noted
+        in the comments for the obsolete macro.<br />
+        Note: The ICU test suites <i>can</i> be compiled with this setting.</li>
       <li><b>.dat file:</b> By default, the ICU data is built into
         a shared library (DLL). This is convenient because it requires no
         install-time or runtime configuration,
index 250cb8c0ae01b3fa1afc5d0668840a521c93d06b..55c17c01df6db34f1a5041263f4dc5627f7537f3 100644 (file)
 #ifndef __UTF_OLD_H__
 #define __UTF_OLD_H__
 
-#ifndef U_HIDE_DEPRECATED_API
+/**
+ * \def U_HIDE_OBSOLETE_UTF_OLD_H
+ *
+ * Hides the obsolete definitions in unicode/utf_old.h.
+ * Recommended to be set to 1 at compile time to make sure
+ * the long-deprecated macros are no longer used.
+ *
+ * For reasons for the deprecation see the utf_old.h file comments.
+ *
+ * @internal
+ */
+#ifndef U_HIDE_OBSOLETE_UTF_OLD_H
+#   define U_HIDE_OBSOLETE_UTF_OLD_H 0
+#endif
+
+#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H
 
 #include "unicode/utf.h"
 #include "unicode/utf8.h"
@@ -1184,7 +1199,6 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[];    /* U_IMPORT2? */ /*U_I
  */
 #define UTF_SET_CHAR_LIMIT(s, start, i, length) U16_SET_CP_LIMIT(s, start, i, length)
 
-#endif /* U_HIDE_DEPRECATED_API */
+#endif  // !U_HIDE_DEPRECATED_API && !U_HIDE_OBSOLETE_UTF_OLD_H
 
 #endif
-
index 293e6f181f3a3f9d9932392503afbd47604f6f93..856072cb767fab7ef2dffab97877de476c511f67 100644 (file)
@@ -27,7 +27,6 @@
 #include "unicode/utypes.h"
 #include "unicode/utf.h"
 #include "unicode/utf8.h"
-#include "unicode/utf_old.h"
 #include "uassert.h"
 
 /*
@@ -93,7 +92,10 @@ utf8_minLegal[4]={ 0, 0x80, 0x800, 0x10000 };
 
 static const UChar32
 utf8_errorValue[6]={
-    UTF8_ERROR_VALUE_1, UTF8_ERROR_VALUE_2, UTF_ERROR_VALUE, 0x10ffff,
+    // Same values as UTF8_ERROR_VALUE_1, UTF8_ERROR_VALUE_2, UTF_ERROR_VALUE,
+    // but without relying on the obsolete unicode/utf_old.h.
+    0x15, 0x9f, 0xffff,
+    0x10ffff,
     0x3ffffff, 0x7fffffff
 };
 
@@ -232,7 +234,7 @@ utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool
             s+=i;
             offset=0;
             c=utf8_errorValue[length-1];
-            UTF8_APPEND_CHAR_UNSAFE(s, offset, c);
+            U8_APPEND_UNSAFE(s, offset, c);
             i=i+offset;
         }
     }
index 0d2fe4fba8e91e13668a490f739396bdc1d9dd04..1ce753d73cb30a4476f437911fba3024a79003b2 100644 (file)
@@ -16,6 +16,7 @@
 #include "unicode/ubiditransform.h"
 #include "unicode/ushape.h"
 #include "unicode/ustring.h"
+#include "unicode/utf16.h"
 
 #ifdef __cplusplus
 extern "C" {
index ef6a42f1c3d5d2620fbc88093a80803f5753634e..d038f36308e00fb542a1c82074233731b42f0bad 100644 (file)
@@ -25,11 +25,6 @@ The main root for C API tests
 #include "unicode/putil.h"
 #include "unicode/ctest.h"
 
-#if U_NO_DEFAULT_INCLUDE_UTF_HEADERS
-/* deprecated  - make tests pass with U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
-#include "unicode/utf_old.h" 
-#endif
-
 #include <stdlib.h>
 
 #ifndef U_USE_DEPRECATED_API
index 895b29b2f61e5d67424c31bec9251b0a0f395954..c93c19c36850742cd98308f6d06430e473158093 100644 (file)
@@ -28,6 +28,7 @@
 #include "unicode/uloc.h"
 #include "unicode/uchar.h"
 #include "unicode/ustring.h"
+#include "unicode/utf16.h"
 #include "unicode/putil.h"
 #include "callcoll.h"
 #include "cmemory.h"
index 03cf52c3ea5a4ec3924dea30dff088ab290ca52c..9d832fcf379a2f9f7c27ab3c7feb54eaad0ad004 100644 (file)
@@ -20,6 +20,7 @@
 #include "unicode/utypes.h"
 #include "cintltst.h"
 #include "unicode/ustring.h"
+#include "unicode/utf16.h"
 #include "cmemory.h"
 #include "cstring.h"
 #include "filestrm.h"
index da64f20f921ac0a7bcdd1b7712239eb8b4771df5..48717c1065344a5390a1255469b2acc001bd0f54 100644 (file)
@@ -23,6 +23,8 @@
 #include "unicode/putil.h"
 #include "unicode/ustring.h"
 #include "unicode/ucnv.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
 #include "string.h"
 #include "cmemory.h"
 #include "cstring.h"
index 8b9e8bb67b9149eca3248554d8c577e1dd7647da..788aa8037570a6e7b1cbfe5c49188c47dc6e739c 100644 (file)
@@ -25,7 +25,8 @@
 #include "unicode/ustring.h"
 #include "unicode/uloc.h"
 #include "unicode/unorm2.h"
-
+#include "unicode/utf16.h"
+#include "unicode/utf_old.h"
 #include "cintltst.h"
 #include "putilimp.h"
 #include "uparse.h"
@@ -1387,6 +1388,26 @@ static void TestCodeUnit(){
 
     for(i=0; i<UPRV_LENGTHOF(codeunit); i++){
         UChar c=codeunit[i];
+        if(i<4){
+            if(!(U16_IS_SINGLE(c)) || (U16_IS_LEAD(c)) || (U16_IS_TRAIL(c)) ||
+                    U16_IS_SURROGATE(c) || U_IS_SURROGATE(c)) {
+                log_err("ERROR: U+%04x is a single", c);
+            }
+
+        }
+        if(i >= 4 && i< 8){
+            if(!(U16_IS_LEAD(c)) || U16_IS_SINGLE(c) || U16_IS_TRAIL(c) ||
+                    !U16_IS_SURROGATE(c) || !U_IS_SURROGATE(c)){
+                log_err("ERROR: U+%04x is a first surrogate", c);
+            }
+        }
+        if(i >= 8 && i< 12){
+            if(!(U16_IS_TRAIL(c)) || U16_IS_SINGLE(c) || U16_IS_LEAD(c) ||
+                    !U16_IS_SURROGATE(c) || !U_IS_SURROGATE(c)){
+                log_err("ERROR: U+%04x is a second surrogate", c);
+            }
+        }
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         if(i<4){
             if(!(UTF_IS_SINGLE(c)) || (UTF_IS_LEAD(c)) || (UTF_IS_TRAIL(c)) ||(UTF_IS_SURROGATE(c))){
                 log_err("ERROR: U+%04x is a single", c);
@@ -1403,8 +1424,8 @@ static void TestCodeUnit(){
                 log_err("ERROR: U+%04x is a second surrogate", c);
             }
         }
+#endif
     }
-
 }
 
 static void TestCodePoint(){
@@ -1437,42 +1458,72 @@ static void TestCodePoint(){
         0xfffe,
     };
     int32_t i;
-    for(i=0; i<UPRV_LENGTHOF(codePoint); i++){
+    for(i=0; i<UPRV_LENGTHOF(codePoint); i++) {
         UChar32 c=codePoint[i];
+        if(i<6) {
+            if(!U_IS_SURROGATE(c) || !U16_IS_SURROGATE(c)) {
+                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
+            }
+            if(U_IS_UNICODE_CHAR(c)) {
+                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
+            }
+        } else if(i >=6 && i<18) {
+            if(U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)) {
+                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
+            }
+            if(!U_IS_UNICODE_CHAR(c)) {
+                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
+            }
+        } else if(i >=18 && i<20) {
+            if(U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)) {
+                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
+            }
+            if(!U_IS_UNICODE_CHAR(c)) {
+                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
+            }
+        } else if(i >=18 && i<UPRV_LENGTHOF(codePoint)) {
+            if(U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)) {
+                log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
+            }
+            if(U_IS_UNICODE_CHAR(c)) {
+                log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
+            }
+        }
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         if(i<6){
-            if(!UTF_IS_SURROGATE(c) || !U_IS_SURROGATE(c) || !U16_IS_SURROGATE(c)){
+            if(!UTF_IS_SURROGATE(c)){
                 log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
             }
             if(UTF_IS_VALID(c)){
                 log_err("ERROR: isValid() failed for U+%04x\n", c);
             }
-            if(UTF_IS_UNICODE_CHAR(c) || U_IS_UNICODE_CHAR(c)){
+            if(UTF_IS_UNICODE_CHAR(c)){
                 log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
             }
             if(UTF_IS_ERROR(c)){
                 log_err("ERROR: isError() failed for U+%04x\n", c);
             }
         }else if(i >=6 && i<18){
-            if(UTF_IS_SURROGATE(c) || U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)){
+            if(UTF_IS_SURROGATE(c)){
                 log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
             }
             if(!UTF_IS_VALID(c)){
                 log_err("ERROR: isValid() failed for U+%04x\n", c);
             }
-            if(!UTF_IS_UNICODE_CHAR(c) || !U_IS_UNICODE_CHAR(c)){
+            if(!UTF_IS_UNICODE_CHAR(c)){
                 log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
             }
             if(UTF_IS_ERROR(c)){
                 log_err("ERROR: isError() failed for U+%04x\n", c);
             }
         }else if(i >=18 && i<20){
-            if(UTF_IS_SURROGATE(c) || U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)){
+            if(UTF_IS_SURROGATE(c)){
                 log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
             }
             if(UTF_IS_VALID(c)){
                 log_err("ERROR: isValid() failed for U+%04x\n", c);
             }
-            if(!UTF_IS_UNICODE_CHAR(c) || !U_IS_UNICODE_CHAR(c)){
+            if(!UTF_IS_UNICODE_CHAR(c)){
                 log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
             }
             if(!UTF_IS_ERROR(c)){
@@ -1480,19 +1531,20 @@ static void TestCodePoint(){
             }
         }
         else if(i >=18 && i<UPRV_LENGTHOF(codePoint)){
-            if(UTF_IS_SURROGATE(c) || U_IS_SURROGATE(c) || U16_IS_SURROGATE(c)){
+            if(UTF_IS_SURROGATE(c)){
                 log_err("ERROR: isSurrogate() failed for U+%04x\n", c);
             }
             if(UTF_IS_VALID(c)){
                 log_err("ERROR: isValid() failed for U+%04x\n", c);
             }
-            if(UTF_IS_UNICODE_CHAR(c) || U_IS_UNICODE_CHAR(c)){
+            if(UTF_IS_UNICODE_CHAR(c)){
                 log_err("ERROR: isUnicodeChar() failed for U+%04x\n", c);
             }
             if(!UTF_IS_ERROR(c)){
                 log_err("ERROR: isError() failed for U+%04x\n", c);
             }
         }
+#endif
     }
 
     if(
@@ -1530,16 +1582,24 @@ static void TestCharLength()
     };
 
     int32_t i;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     UBool multiple;
+#endif
     for(i=0; i<UPRV_LENGTHOF(codepoint); i=(int16_t)(i+2)){
         UChar32 c=codepoint[i+1];
-        if(UTF_CHAR_LENGTH(c) != codepoint[i] || U16_LENGTH(c) != codepoint[i]){
+        if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                UTF_CHAR_LENGTH(c) != codepoint[i] ||
+#endif
+                U16_LENGTH(c) != codepoint[i]) {
             log_err("The no: of code units for U+%04x:- Expected: %d Got: %d\n", c, codepoint[i], U16_LENGTH(c));
         }
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE);
         if(UTF_NEED_MULTIPLE_UCHAR(c) != multiple){
             log_err("ERROR: Unicode::needMultipleUChar() failed for U+%04x\n", c);
         }
+#endif
     }
 }
 
index cdeb4d680560b6142b10639aaa562d8ad74651bc..c1e5b4fdc6e210e66fcfb54e33e8561c801eeb66 100644 (file)
@@ -22,6 +22,8 @@
 #include "unicode/utypes.h"
 #include "unicode/ustring.h"
 #include "unicode/uset.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
 #include "cintltst.h"
 #include "cmemory.h"
 
@@ -703,8 +705,8 @@ static void TestRegressionUTF8(){
             if (currCh == SURROGATE_HIGH_START) {
                 currCh = SURROGATE_LOW_END + 1; /* Skip surrogate range */
             }
-            UTF16_APPEND_CHAR_SAFE(standardForm, offset16, MAX_LENGTH, currCh);
-            UTF8_APPEND_CHAR_SAFE(utf8, offset8, MAX_LENGTH, currCh);
+            U16_APPEND_UNSAFE(standardForm, offset16, currCh);
+            U8_APPEND_UNSAFE(utf8, offset8, currCh);
             currCh++;
         }
         if(!convertFromU(standardForm, offset16, 
@@ -774,8 +776,8 @@ static void TestRegressionUTF32(){
             if (currCh == SURROGATE_HIGH_START) {
                 currCh = SURROGATE_LOW_END + 1; /* Skip surrogate range */
             }
-            UTF16_APPEND_CHAR_SAFE(standardForm, offset16, MAX_LENGTH, currCh);
-            UTF32_APPEND_CHAR_SAFE(utf32, offset32, MAX_LENGTH, currCh);
+            U16_APPEND_UNSAFE(standardForm, offset16, currCh);
+            utf32[offset32++] = currCh;
             currCh++;
         }
         if(!convertFromU(standardForm, offset16, 
index 2ea322ce08cd853adc7d354d2e778730d2952b5a..6b1ba782c6fcaea78f534052b0f9154f73cfce4e 100644 (file)
@@ -29,6 +29,7 @@
 #include "unicode/uregex.h"
 #include "unicode/ustring.h"
 #include "unicode/utext.h"
+#include "unicode/utf8.h"
 #include "cintltst.h"
 #include "cmemory.h"
 
index 95b9a65a41167557136acfc4d992068d29c6bd48..5d11733e85088f91b35f326ad1131a0e9e0894ac 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <stdio.h>
 #include "unicode/utypes.h"
+#include "unicode/utf8.h"
 #include "utrie2.h"
 #include "utrie.h"
 #include "cstring.h"
index 6d4dc2d9b1ef4645fb6114e07d2c06bf2ceaf973..deb0a2b9f8e01616a4662f27d7ec4a901880fcf1 100644 (file)
@@ -22,6 +22,7 @@
 #include "unicode/utypes.h"
 #include "unicode/ucnvsel.h"
 #include "unicode/ustring.h"
+#include "unicode/utf8.h"
 #include "cmemory.h"
 #include "cstring.h"
 #include "propsvec.h"
index b73c6083efdc753920d2a79b99af1495863e8ab2..2d3cecdd71e8149204b0334b2b59277f5bdf56a5 100644 (file)
 */
 
 #include "unicode/utypes.h"
-#include "unicode/utf16.h"
 #include "unicode/ustring.h"
+#include "unicode/utf16.h"
+#include "unicode/utf_old.h"
 #include "cmemory.h"
 #include "cstring.h"
 #include "cintltst.h"
 #include <stdio.h>
 
-static void printUChars(const UChar *uchars);
+// Obsolete macro from obsolete unicode/utf_old.h, for some old test data.
+#ifndef UTF_ERROR_VALUE
+#   define UTF_ERROR_VALUE 0xffff
+#endif
+
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+static void printUChars(const UChar *uchars) {
+    int16_t i=0;
+    for(i=0; i<u_strlen(uchars); i++) {
+        printf("%x ", *(uchars+i));
+    }
+}
+#endif
 
 static void TestCodeUnitValues(void);
 static void TestCharLength(void);
@@ -62,17 +75,29 @@ static void TestCodeUnitValues()
         UChar c=codeunit[i];
         log_verbose("Testing code unit value of %x\n", c);
         if(i<4){
-            if(!UTF16_IS_SINGLE(c) || UTF16_IS_LEAD(c) || UTF16_IS_TRAIL(c) || !U16_IS_SINGLE(c) || U16_IS_LEAD(c) || U16_IS_TRAIL(c)){
+            if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                    !UTF16_IS_SINGLE(c) || UTF16_IS_LEAD(c) || UTF16_IS_TRAIL(c) ||
+#endif
+                    !U16_IS_SINGLE(c) || U16_IS_LEAD(c) || U16_IS_TRAIL(c)) {
                 log_err("ERROR: %x is a single character\n", c);
             }
         }
         if(i >= 4 && i< 8){
-            if(!UTF16_IS_LEAD(c) || UTF16_IS_SINGLE(c) || UTF16_IS_TRAIL(c) || !U16_IS_LEAD(c) || U16_IS_SINGLE(c) || U16_IS_TRAIL(c)){
+            if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                    !UTF16_IS_LEAD(c) || UTF16_IS_SINGLE(c) || UTF16_IS_TRAIL(c) ||
+#endif
+                    !U16_IS_LEAD(c) || U16_IS_SINGLE(c) || U16_IS_TRAIL(c)){
                 log_err("ERROR: %x is a first surrogate\n", c);
             }
         }
         if(i >= 8 && i< 12){
-            if(!UTF16_IS_TRAIL(c) || UTF16_IS_SINGLE(c) || UTF16_IS_LEAD(c) || !U16_IS_TRAIL(c) || U16_IS_SINGLE(c) || U16_IS_LEAD(c)){
+            if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                    !UTF16_IS_TRAIL(c) || UTF16_IS_SINGLE(c) || UTF16_IS_LEAD(c) ||
+#endif
+                    !U16_IS_TRAIL(c) || U16_IS_SINGLE(c) || U16_IS_LEAD(c)) {
                 log_err("ERROR: %x is a second surrogate\n", c);
             }
         }
@@ -95,18 +120,26 @@ static void TestCharLength()
     };
     
     int16_t i;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     UBool multiple;
+#endif
     for(i=0; i<UPRV_LENGTHOF(codepoint); i=(int16_t)(i+2)){
         UChar32 c=codepoint[i+1];
-        if(UTF16_CHAR_LENGTH(c) != (uint16_t)codepoint[i] || U16_LENGTH(c) != (uint16_t)codepoint[i]){
-              log_err("The no: of code units for %lx:- Expected: %d Got: %d\n", c, codepoint[i], UTF16_CHAR_LENGTH(c));
+        if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                UTF16_CHAR_LENGTH(c) != (uint16_t)codepoint[i] ||
+#endif
+                U16_LENGTH(c) != (uint16_t)codepoint[i]) {
+          log_err("The no: of code units for %lx:- Expected: %d Got: %d\n", c, codepoint[i], U16_LENGTH(c));
         }else{
-              log_verbose("The no: of code units for %lx is %d\n",c, UTF16_CHAR_LENGTH(c) ); 
+              log_verbose("The no: of code units for %lx is %d\n",c, U16_LENGTH(c));
         }
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE);
         if(UTF16_NEED_MULTIPLE_UCHAR(c) != multiple){
               log_err("ERROR: UTF16_NEED_MULTIPLE_UCHAR failed for %lx\n", c);
         }
+#endif
     }
 }
 
@@ -151,23 +184,24 @@ static void TestGetChar()
     uint16_t offset=0;
     for(offset=0; offset<UPRV_LENGTHOF(input); offset++) {
         if(0<offset && offset<UPRV_LENGTHOF(input)-1){
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
             UTF16_GET_CHAR_UNSAFE(input, offset, c);
             if(c != result[i]){
                 log_err("ERROR: UTF16_GET_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
             }
-
+#endif
             U16_GET_UNSAFE(input, offset, c);
             if(c != result[i]){
                 log_err("ERROR: U16_GET_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
             }
         }
-
-        UTF16_GET_CHAR_SAFE(input, 0, offset, UPRV_LENGTHOF(input), c, FALSE);
         expected=result[i+1];
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+        UTF16_GET_CHAR_SAFE(input, 0, offset, UPRV_LENGTHOF(input), c, FALSE);
         if(c != expected) {
             log_err("ERROR: UTF16_GET_CHAR_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#endif
         U16_GET(input, 0, offset, UPRV_LENGTHOF(input), c);
         if(c != expected) {
             log_err("ERROR: U16_GET failed for offset=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
@@ -178,14 +212,14 @@ static void TestGetChar()
         if(c != expected) {
             log_err("ERROR: U16_GET_OR_FFFD failed for offset=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         UTF16_GET_CHAR_SAFE(input, 0, offset, UPRV_LENGTHOF(input), c, TRUE);
         if(c != result[i+2]){
             log_err("ERROR: UTF16_GET_CHAR_SAFE(strict) failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
         }
+#endif
         i=(uint16_t)(i+3);
     }
-
 }
 
 static void TestNextPrevChar(){
@@ -228,6 +262,7 @@ static void TestNextPrevChar(){
     uint16_t offset=0, setOffset=0;
     for(offset=0; offset<UPRV_LENGTHOF(input); offset++){
          setOffset=offset;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          UTF16_NEXT_CHAR_UNSAFE(input, setOffset, c);
          if(setOffset != movedOffset[i]){
              log_err("ERROR: UTF16_NEXT_CHAR_UNSAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
@@ -236,7 +271,7 @@ static void TestNextPrevChar(){
          if(c != result[i]){
              log_err("ERROR: UTF16_NEXT_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
          }
-
+#endif
          setOffset=offset;
          U16_NEXT_UNSAFE(input, setOffset, c);
          if(setOffset != movedOffset[i]){
@@ -246,18 +281,18 @@ static void TestNextPrevChar(){
          if(c != result[i]){
              log_err("ERROR: U16_NEXT_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
          }
-
+        expected=result[i+1];
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF16_NEXT_CHAR_SAFE(input, setOffset, UPRV_LENGTHOF(input), c, FALSE);
          if(setOffset != movedOffset[i+1]){
              log_err("ERROR: UTF16_NEXT_CHAR_SAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
                  offset, movedOffset[i+1], setOffset);
          }
-        expected=result[i+1];
         if(c != expected) {
             log_err("ERROR: UTF16_NEXT_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#endif
          setOffset=offset;
          U16_NEXT(input, setOffset, UPRV_LENGTHOF(input), c);
          if(setOffset != movedOffset[i+1]){
@@ -278,7 +313,7 @@ static void TestNextPrevChar(){
         if(c != expected){
             log_err("ERROR: U16_NEXT_OR_FFFD failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF16_NEXT_CHAR_SAFE(input, setOffset, UPRV_LENGTHOF(input), c, TRUE);
          if(setOffset != movedOffset[i+1]){
@@ -288,12 +323,13 @@ static void TestNextPrevChar(){
          if(c != result[i+2]){
              log_err("ERROR: UTF16_NEXT_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
          }
-
+#endif
          i=(uint16_t)(i+6);
     }
     i=0;
     for(offset=(uint16_t)UPRV_LENGTHOF(input); offset > 0; --offset){
          setOffset=offset;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          UTF16_PREV_CHAR_UNSAFE(input, setOffset, c);
          if(setOffset != movedOffset[i+3]){
              log_err("ERROR: UTF16_PREV_CHAR_UNSAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
@@ -302,7 +338,7 @@ static void TestNextPrevChar(){
          if(c != result[i+3]){
              log_err("ERROR: UTF16_PREV_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+3], c);
          }
-
+#endif
          setOffset=offset;
          U16_PREV_UNSAFE(input, setOffset, c);
          if(setOffset != movedOffset[i+3]){
@@ -312,7 +348,7 @@ static void TestNextPrevChar(){
          if(c != result[i+3]){
              log_err("ERROR: U16_PREV_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+3], c);
          }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF16_PREV_CHAR_SAFE(input, 0, setOffset, c, FALSE);
          if(setOffset != movedOffset[i+4]){
@@ -322,7 +358,7 @@ static void TestNextPrevChar(){
          if(c != result[i+4]){
              log_err("ERROR: UTF16_PREV_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+4], c);
          }
-
+#endif
          setOffset=offset;
          U16_PREV(input, 0, setOffset, c);
          if(setOffset != movedOffset[i+4]){
@@ -344,7 +380,7 @@ static void TestNextPrevChar(){
         if(c != expected) {
             log_err("ERROR: U16_PREV_OR_FFFD failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF16_PREV_CHAR_SAFE(input, 0,  setOffset, c, TRUE);
          if(setOffset != movedOffset[i+5]){
@@ -354,7 +390,7 @@ static void TestNextPrevChar(){
          if(c != result[i+5]){
              log_err("ERROR: UTF16_PREV_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+5], c);
          }
-
+#endif
          i=(uint16_t)(i+6);
     }
 
@@ -456,6 +492,7 @@ static void TestFwdBack(){
 
     uint16_t offunsafe=0, offsafe=0;
     uint16_t i=0;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     while(offunsafe < UPRV_LENGTHOF(input)){
         UTF16_FWD_1_UNSAFE(input, offunsafe);
         if(offunsafe != fwd_unsafe[i]){
@@ -463,7 +500,7 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#endif
     offunsafe=0, offsafe=0;
     i=0;
     while(offunsafe < UPRV_LENGTHOF(input)){
@@ -473,7 +510,8 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+    offunsafe=0, offsafe=0;
     i=0;
     while(offsafe < UPRV_LENGTHOF(input)){
         UTF16_FWD_1_SAFE(input, offsafe, UPRV_LENGTHOF(input));
@@ -482,7 +520,8 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#endif
+    offunsafe=0, offsafe=0;
     i=0;
     while(offsafe < UPRV_LENGTHOF(input)){
         U16_FWD_1(input, offsafe, UPRV_LENGTHOF(input));
@@ -491,7 +530,7 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     offunsafe=UPRV_LENGTHOF(input);
     offsafe=UPRV_LENGTHOF(input);
     i=0;
@@ -502,7 +541,7 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#endif
     offunsafe=UPRV_LENGTHOF(input);
     offsafe=UPRV_LENGTHOF(input);
     i=0;
@@ -513,7 +552,9 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+    offunsafe=UPRV_LENGTHOF(input);
+    offsafe=UPRV_LENGTHOF(input);
     i=0;
     while(offsafe > 0){
         UTF16_BACK_1_SAFE(input,0,  offsafe);
@@ -522,7 +563,9 @@ static void TestFwdBack(){
         }
         i++;
     }
-
+#endif
+    offunsafe=UPRV_LENGTHOF(input);
+    offsafe=UPRV_LENGTHOF(input);
     i=0;
     while(offsafe > 0){
         U16_BACK_1(input,0,  offsafe);
@@ -534,13 +577,14 @@ static void TestFwdBack(){
 
     offunsafe=0;
     offsafe=0;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     for(i=0; i<UPRV_LENGTHOF(Nvalue)-2; i++){  /*didn't want it to fail(we assume 0<i<length)*/
         UTF16_FWD_N_UNSAFE(input, offunsafe, Nvalue[i]);
         if(offunsafe != fwd_N_unsafe[i]){
             log_err("ERROR: Forward_N_unsafe offset expected:%d, Got:%d\n", fwd_N_unsafe[i], offunsafe);
         }
     }
-
+#endif
     offunsafe=0;
     for(i=0; i<UPRV_LENGTHOF(Nvalue)-2; i++){  /*didn't want it to fail(we assume 0<i<length)*/
         U16_FWD_N_UNSAFE(input, offunsafe, Nvalue[i]);
@@ -548,25 +592,23 @@ static void TestFwdBack(){
             log_err("ERROR: U16_FWD_N_UNSAFE offset expected:%d, Got:%d\n", fwd_N_unsafe[i], offunsafe);
         }
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     offsafe=0;
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         UTF16_FWD_N_SAFE(input, offsafe, UPRV_LENGTHOF(input), Nvalue[i]);
         if(offsafe != fwd_N_safe[i]){
             log_err("ERROR: Forward_N_safe offset expected:%d, Got:%d\n", fwd_N_safe[i], offsafe);
         }
-    
     }
-
+#endif
     offsafe=0;
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         U16_FWD_N(input, offsafe, UPRV_LENGTHOF(input), Nvalue[i]);
         if(offsafe != fwd_N_safe[i]){
             log_err("ERROR: U16_FWD_N offset expected:%d, Got:%d\n", fwd_N_safe[i], offsafe);
         }
-    
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     offunsafe=UPRV_LENGTHOF(input);
     for(i=0; i<UPRV_LENGTHOF(Nvalue)-2; i++){
         UTF16_BACK_N_UNSAFE(input, offunsafe, Nvalue[i]);
@@ -574,7 +616,7 @@ static void TestFwdBack(){
             log_err("ERROR: backward_N_unsafe offset expected:%d, Got:%d\n", back_N_unsafe[i], offunsafe);
         }
     }
-
+#endif
     offunsafe=UPRV_LENGTHOF(input);
     for(i=0; i<UPRV_LENGTHOF(Nvalue)-2; i++){
         U16_BACK_N_UNSAFE(input, offunsafe, Nvalue[i]);
@@ -582,7 +624,7 @@ static void TestFwdBack(){
             log_err("ERROR: U16_BACK_N_UNSAFE offset expected:%d, Got:%d\n", back_N_unsafe[i], offunsafe);
         }
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     offsafe=UPRV_LENGTHOF(input);
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         UTF16_BACK_N_SAFE(input, 0, offsafe, Nvalue[i]);
@@ -590,7 +632,7 @@ static void TestFwdBack(){
             log_err("ERROR: backward_N_safe offset expected:%d, Got:%d\n", back_N_safe[i], offsafe);
         }
     }
-
+#endif
     offsafe=UPRV_LENGTHOF(input);
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         U16_BACK_N(input, 0, offsafe, Nvalue[i]);
@@ -610,24 +652,25 @@ static void TestSetChar(){
     uint16_t i=0;
     uint16_t offset=0, setOffset=0;
     for(offset=0; offset<UPRV_LENGTHOF(input); offset++){
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF16_SET_CHAR_START_UNSAFE(input, setOffset);
          if(setOffset != start_unsafe[i]){
              log_err("ERROR: UTF16_SET_CHAR_START_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, start_unsafe[i], setOffset);
          }
-
+#endif
          setOffset=offset;
          U16_SET_CP_START_UNSAFE(input, setOffset);
          if(setOffset != start_unsafe[i]){
              log_err("ERROR: U16_SET_CHAR_START_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, start_unsafe[i], setOffset);
          }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF16_SET_CHAR_START_SAFE(input, 0, setOffset);
          if(setOffset != start_safe[i]){
              log_err("ERROR: UTF16_SET_CHAR_START_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, start_safe[i], setOffset);
          }
-
+#endif
          setOffset=offset;
          U16_SET_CP_START(input, 0, setOffset);
          if(setOffset != start_safe[i]){
@@ -635,12 +678,13 @@ static void TestSetChar(){
          }
 
          if (offset > 0) {
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
              setOffset=offset;
              UTF16_SET_CHAR_LIMIT_UNSAFE(input, setOffset);
              if(setOffset != limit_unsafe[i]){
                  log_err("ERROR: UTF16_SET_CHAR_LIMIT_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, limit_unsafe[i], setOffset);
              }
-
+#endif
              setOffset=offset;
              U16_SET_CP_LIMIT_UNSAFE(input, setOffset);
              if(setOffset != limit_unsafe[i]){
@@ -659,6 +703,7 @@ static void TestSetChar(){
 }
 
 static void TestAppendChar(){
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     static UChar s[5]={0x0061, 0x0062, 0x0063, 0x0064, 0x0000};
     static uint32_t test[]={
      /*append-position(unsafe),  CHAR to be appended  */
@@ -754,7 +799,7 @@ static void TestAppendChar(){
         count++;
     }  
     free(str);
-
+#endif
 }
 
 static void TestAppend() {
@@ -822,27 +867,28 @@ static void TestSurrogate(){
     static UChar32 s[] = {0x10000, 0x10ffff, 0x50000, 0x100000, 0x1abcd};
     int i = 0;
     while (i < 5) {
-        UChar first  = UTF_FIRST_SURROGATE(s[i]);
-        UChar second = UTF_SECOND_SURROGATE(s[i]);
+        UChar first  = U16_LEAD(s[i]);
+        UChar second = U16_TRAIL(s[i]);
         /* algorithm from the Unicode consortium */
         UChar firstresult  = (UChar)(((s[i] - 0x10000) / 0x400) + 0xD800);
         UChar secondresult = (UChar)(((s[i] - 0x10000) % 0x400) + 0xDC00);
 
-        if (first != UTF16_LEAD(s[i]) || first != U16_LEAD(s[i]) || first != firstresult) {
+        if (
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                first != UTF16_LEAD(s[i]) || first != UTF_FIRST_SURROGATE(s[i]) ||
+#endif
+                first != firstresult) {
             log_err("Failure in first surrogate in 0x%x expected to be 0x%x\n",
                     s[i], firstresult);
         }
-        if (second != UTF16_TRAIL(s[i]) || second != U16_TRAIL(s[i]) || second != secondresult) {
+        if (
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                second != UTF16_TRAIL(s[i]) || second != UTF_SECOND_SURROGATE(s[i]) ||
+#endif
+                second != secondresult) {
             log_err("Failure in second surrogate in 0x%x expected to be 0x%x\n",
                     s[i], secondresult);
         }
         i ++;
     }
 }
-
-static void printUChars(const UChar *uchars){
-    int16_t i=0;
-    for(i=0; i<u_strlen(uchars); i++){
-        printf("%x ", *(uchars+i));
-    }
-}
index 75547cfe810b243746a4be9bcfa365ed3314adc4..bbc67f4bb7305c6fbe5901f28763ca26e8d10ba5 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "unicode/utypes.h"
 #include "unicode/utf8.h"
+#include "unicode/utf_old.h"
 #include "cmemory.h"
 #include "cintltst.h"
 
 
 /* -------------------------------------------------------------------------- */
 
-static void printUChars(const uint8_t *uchars, int16_t len);
+// Obsolete macros from obsolete unicode/utf_old.h, for some old test data.
+#ifndef UTF8_ERROR_VALUE_1
+#   define UTF8_ERROR_VALUE_1 0x15
+#endif
+#ifndef UTF8_ERROR_VALUE_2
+#   define UTF8_ERROR_VALUE_2 0x9f
+#endif
+#ifndef UTF_ERROR_VALUE
+#   define UTF_ERROR_VALUE 0xffff
+#endif
+#ifndef UTF_IS_ERROR
+#   define UTF_IS_ERROR(c) \
+        (((c)&0xfffe)==0xfffe || (c)==UTF8_ERROR_VALUE_1 || (c)==UTF8_ERROR_VALUE_2)
+#endif
+
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+static void printUChars(const uint8_t *uchars, int16_t len){
+    int16_t i=0;
+    for(i=0; i<len; i++){
+        log_err("0x%02x ", *(uchars+i));
+    }
+}
+#endif
 
 static void TestCodeUnitValues(void);
 static void TestCharLength(void);
@@ -105,19 +128,31 @@ static void TestCodeUnitValues()
         uint8_t c=codeunit[i];
         log_verbose("Testing code unit value of %x\n", c);
         if(i<4){
-            if(!UTF8_IS_SINGLE(c) || UTF8_IS_LEAD(c) || UTF8_IS_TRAIL(c) || !U8_IS_SINGLE(c) || U8_IS_LEAD(c) || U8_IS_TRAIL(c)){
+            if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                    !UTF8_IS_SINGLE(c) || UTF8_IS_LEAD(c) || UTF8_IS_TRAIL(c) ||
+#endif
+                    !U8_IS_SINGLE(c) || U8_IS_LEAD(c) || U8_IS_TRAIL(c)) {
                 log_err("ERROR: 0x%02x is a single byte but results in single: %c lead: %c trail: %c\n",
-                    c, UTF8_IS_SINGLE(c) ? 'y' : 'n', UTF8_IS_LEAD(c) ? 'y' : 'n', UTF8_IS_TRAIL(c) ? 'y' : 'n');
+                    c, U8_IS_SINGLE(c) ? 'y' : 'n', U8_IS_LEAD(c) ? 'y' : 'n', U8_IS_TRAIL(c) ? 'y' : 'n');
             }
         } else if(i< 8){
-            if(!UTF8_IS_LEAD(c) || UTF8_IS_SINGLE(c) || UTF8_IS_TRAIL(c) || !U8_IS_LEAD(c) || U8_IS_SINGLE(c) || U8_IS_TRAIL(c)){
+            if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                    !UTF8_IS_LEAD(c) || UTF8_IS_SINGLE(c) || UTF8_IS_TRAIL(c) ||
+#endif
+                    !U8_IS_LEAD(c) || U8_IS_SINGLE(c) || U8_IS_TRAIL(c)) {
                 log_err("ERROR: 0x%02x is a lead byte but results in single: %c lead: %c trail: %c\n",
-                    c, UTF8_IS_SINGLE(c) ? 'y' : 'n', UTF8_IS_LEAD(c) ? 'y' : 'n', UTF8_IS_TRAIL(c) ? 'y' : 'n');
+                    c, U8_IS_SINGLE(c) ? 'y' : 'n', U8_IS_LEAD(c) ? 'y' : 'n', U8_IS_TRAIL(c) ? 'y' : 'n');
             }
         } else if(i< 12){
-            if(!UTF8_IS_TRAIL(c) || UTF8_IS_SINGLE(c) || UTF8_IS_LEAD(c) || !U8_IS_TRAIL(c) || U8_IS_SINGLE(c) || U8_IS_LEAD(c)){
+            if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                    !UTF8_IS_TRAIL(c) || UTF8_IS_SINGLE(c) || UTF8_IS_LEAD(c) ||
+#endif
+                    !U8_IS_TRAIL(c) || U8_IS_SINGLE(c) || U8_IS_LEAD(c)){
                 log_err("ERROR: 0x%02x is a trail byte but results in single: %c lead: %c trail: %c\n",
-                    c, UTF8_IS_SINGLE(c) ? 'y' : 'n', UTF8_IS_LEAD(c) ? 'y' : 'n', UTF8_IS_TRAIL(c) ? 'y' : 'n');
+                    c, U8_IS_SINGLE(c) ? 'y' : 'n', U8_IS_LEAD(c) ? 'y' : 'n', U8_IS_TRAIL(c) ? 'y' : 'n');
             }
         }
     }
@@ -143,18 +178,26 @@ static void TestCharLength()
     };
 
     int16_t i;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     UBool multiple;
+#endif
     for(i=0; i<UPRV_LENGTHOF(codepoint); i=(int16_t)(i+2)){
         UChar32 c=codepoint[i+1];
-        if(UTF8_CHAR_LENGTH(c) != (uint16_t)codepoint[i] || U8_LENGTH(c) != (uint16_t)codepoint[i]){
-              log_err("The no: of code units for %lx:- Expected: %d Got: %d\n", c, codepoint[i], UTF8_CHAR_LENGTH(c));
+        if(
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+                UTF8_CHAR_LENGTH(c) != (uint16_t)codepoint[i] ||
+#endif
+                U8_LENGTH(c) != (uint16_t)codepoint[i]) {
+            log_err("The no: of code units for %lx:- Expected: %d Got: %d\n", c, codepoint[i], U8_LENGTH(c));
         }else{
-              log_verbose("The no: of code units for %lx is %d\n",c, UTF8_CHAR_LENGTH(c));
+              log_verbose("The no: of code units for %lx is %d\n",c, U8_LENGTH(c));
         }
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         multiple=(UBool)(codepoint[i] == 1 ? FALSE : TRUE);
         if(UTF8_NEED_MULTIPLE_UCHAR(c) != multiple){
               log_err("ERROR: UTF8_NEED_MULTIPLE_UCHAR failed for %lx\n", c);
         }
+#endif
     }
 }
 
@@ -200,25 +243,26 @@ static void TestGetChar()
 
     for(offset=0; offset<sizeof(input); offset++) {
         if (offset < sizeof(input) - 1) {
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
             UTF8_GET_CHAR_UNSAFE(input, offset, c);
             if(c != result[i]){
                 log_err("ERROR: UTF8_GET_CHAR_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
 
             }
-
+#endif
             U8_GET_UNSAFE(input, offset, c);
             if(c != result[i]){
                 log_err("ERROR: U8_GET_UNSAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i], c);
 
             }
         }
-
-        UTF8_GET_CHAR_SAFE(input, 0, offset, sizeof(input), c, FALSE);
         expected=result[i+1];
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
+        UTF8_GET_CHAR_SAFE(input, 0, offset, sizeof(input), c, FALSE);
         if(c != expected){
             log_err("ERROR: UTF8_GET_CHAR_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#endif
         U8_GET(input, 0, offset, sizeof(input), c);
         if(UTF_IS_ERROR(expected)) { expected=U_SENTINEL; }
         if(c != expected){
@@ -230,12 +274,12 @@ static void TestGetChar()
         if(c != expected){
             log_err("ERROR: U8_GET_OR_FFFD failed for offset=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         UTF8_GET_CHAR_SAFE(input, 0, offset, sizeof(input), c, TRUE);
         if(c != result[i+2]){
             log_err("ERROR: UTF8_GET_CHAR_SAFE(strict) failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
         }
-
+#endif
         i=(uint16_t)(i+3);
     }
 }
@@ -287,17 +331,18 @@ static void TestNextPrevChar() {
     uint32_t offset=0;
     int32_t setOffset=0;
     for(offset=0; offset<sizeof(input); offset++){
+        expected=result[i+1];
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF8_NEXT_CHAR_SAFE(input, setOffset, sizeof(input), c, FALSE);
          if(setOffset != movedOffset[i+1]){
              log_err("ERROR: UTF8_NEXT_CHAR_SAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
                  offset, movedOffset[i+1], setOffset);
          }
-        expected=result[i+1];
         if(c != expected){
             log_err("ERROR: UTF8_NEXT_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#endif
          setOffset=offset;
          U8_NEXT(input, setOffset, sizeof(input), c);
          if(setOffset != movedOffset[i+1]){
@@ -319,7 +364,7 @@ static void TestNextPrevChar() {
         if(c != expected){
             log_err("ERROR: U8_NEXT_OR_FFFD failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF8_NEXT_CHAR_SAFE(input, setOffset, sizeof(input), c, TRUE);
          if(setOffset != movedOffset[i+1]){
@@ -329,23 +374,24 @@ static void TestNextPrevChar() {
          if(c != result[i+2]){
              log_err("ERROR: UTF8_NEXT_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
          }
-
+#endif
          i=i+6;
     }
 
     i=0;
     for(offset=sizeof(input); offset > 0; --offset){
+        expected=result[i+4];
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF8_PREV_CHAR_SAFE(input, 0, setOffset, c, FALSE);
          if(setOffset != movedOffset[i+4]){
              log_err("ERROR: UTF8_PREV_CHAR_SAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
                  offset, movedOffset[i+4], setOffset);
          }
-        expected=result[i+4];
         if(c != expected){
             log_err("ERROR: UTF8_PREV_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#endif
          setOffset=offset;
          U8_PREV(input, 0, setOffset, c);
          if(setOffset != movedOffset[i+4]){
@@ -367,7 +413,7 @@ static void TestNextPrevChar() {
         if(c != expected){
             log_err("ERROR: U8_PREV_OR_FFFD failed for input=%ld. Expected:%lx Got:%lx\n", offset, expected, c);
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
          setOffset=offset;
          UTF8_PREV_CHAR_SAFE(input, 0,  setOffset, c, TRUE);
          if(setOffset != movedOffset[i+5]){
@@ -377,7 +423,7 @@ static void TestNextPrevChar() {
          if(c != result[i+5]){
              log_err("ERROR: UTF8_PREV_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+5], c);
          }
-
+#endif
          i=i+6;
     }
 }
@@ -527,6 +573,7 @@ static void TestNextPrevCharUnsafe() {
     UChar32 c;
     int32_t i;
     uint32_t offset;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     for(i=0, offset=0; offset<sizeof(input); ++i) {
         UTF8_NEXT_CHAR_UNSAFE(input, offset, c);
         if(c != codePoints[i]){
@@ -534,6 +581,7 @@ static void TestNextPrevCharUnsafe() {
                     offset, codePoints[i], c);
         }
     }
+#endif
     for(i=0, offset=0; offset<sizeof(input); ++i) {
         U8_NEXT_UNSAFE(input, offset, c);
         if(c != codePoints[i]){
@@ -541,7 +589,7 @@ static void TestNextPrevCharUnsafe() {
                     offset, codePoints[i], c);
         }
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     for(i=UPRV_LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){
          UTF8_PREV_CHAR_UNSAFE(input, offset, c);
          if(c != codePoints[i]){
@@ -549,6 +597,7 @@ static void TestNextPrevCharUnsafe() {
                      offset, codePoints[i], c);
          }
     }
+#endif
     for(i=UPRV_LENGTHOF(codePoints)-1, offset=sizeof(input); offset > 0; --i){
          U8_PREV_UNSAFE(input, offset, c);
          if(c != codePoints[i]){
@@ -570,6 +619,7 @@ static void TestFwdBack() {
     uint32_t offsafe=0;
 
     uint32_t i=0;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     while(offsafe < sizeof(input)){
         UTF8_FWD_1_SAFE(input, offsafe, sizeof(input));
         if(offsafe != fwd_safe[i]){
@@ -577,7 +627,8 @@ static void TestFwdBack() {
         }
         i++;
     }
-
+#endif
+    offsafe=0;
     i=0;
     while(offsafe < sizeof(input)){
         U8_FWD_1(input, offsafe, sizeof(input));
@@ -586,7 +637,7 @@ static void TestFwdBack() {
         }
         i++;
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     i=0;
     offsafe=sizeof(input);
     while(offsafe > 0){
@@ -596,7 +647,7 @@ static void TestFwdBack() {
         }
         i++;
     }
-
+#endif
     i=0;
     offsafe=sizeof(input);
     while(offsafe > 0){
@@ -606,7 +657,7 @@ static void TestFwdBack() {
         }
         i++;
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     offsafe=0;
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         UTF8_FWD_N_SAFE(input, offsafe, sizeof(input), Nvalue[i]);
@@ -615,7 +666,7 @@ static void TestFwdBack() {
         }
 
     }
-
+#endif
     offsafe=0;
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         U8_FWD_N(input, offsafe, sizeof(input), Nvalue[i]);
@@ -624,7 +675,7 @@ static void TestFwdBack() {
         }
 
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     offsafe=sizeof(input);
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         UTF8_BACK_N_SAFE(input, 0, offsafe, Nvalue[i]);
@@ -632,7 +683,7 @@ static void TestFwdBack() {
             log_err("ERROR: backward_N_safe offset=%d expected:%d, Got:%ld\n", i, back_N_safe[i], offsafe);
         }
     }
-
+#endif
     offsafe=sizeof(input);
     for(i=0; i<UPRV_LENGTHOF(Nvalue); i++){
         U8_BACK_N(input, 0, offsafe, Nvalue[i]);
@@ -660,32 +711,35 @@ static void TestFwdBackUnsafe() {
 
     int32_t offset;
     int32_t i;
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     for(i=1, offset=0; offset<UPRV_LENGTHOF(input); ++i) {
         UTF8_FWD_1_UNSAFE(input, offset);
         if(offset != boundaries[i]){
             log_err("ERROR: UTF8_FWD_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
         }
     }
+#endif
     for(i=1, offset=0; offset<UPRV_LENGTHOF(input); ++i) {
         U8_FWD_1_UNSAFE(input, offset);
         if(offset != boundaries[i]){
             log_err("ERROR: U8_FWD_1_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
         }
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     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);
         }
     }
+#endif
     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);
         }
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
         offset=0;
         UTF8_FWD_N_UNSAFE(input, offset, i);
@@ -693,6 +747,7 @@ static void TestFwdBackUnsafe() {
             log_err("ERROR: UTF8_FWD_N_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
         }
     }
+#endif
     for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
         offset=0;
         U8_FWD_N_UNSAFE(input, offset, i);
@@ -700,7 +755,7 @@ static void TestFwdBackUnsafe() {
             log_err("ERROR: U8_FWD_N_UNSAFE offset expected:%d, Got:%d\n", boundaries[i], offset);
         }
     }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
         int32_t j=UPRV_LENGTHOF(boundaries)-1-i;
         offset=UPRV_LENGTHOF(input);
@@ -709,6 +764,7 @@ static void TestFwdBackUnsafe() {
             log_err("ERROR: UTF8_BACK_N_UNSAFE offset expected:%d, Got:%d\n", boundaries[j], offset);
         }
     }
+#endif
     for(i=0; i<UPRV_LENGTHOF(boundaries); ++i) {
         int32_t j=UPRV_LENGTHOF(boundaries)-1-i;
         offset=UPRV_LENGTHOF(input);
@@ -731,25 +787,26 @@ static void TestSetChar() {
     int32_t offset=0, setOffset=0;
     for(offset=0; offset<=UPRV_LENGTHOF(input); offset++){
         if (offset<UPRV_LENGTHOF(input)){
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
             setOffset=offset;
             UTF8_SET_CHAR_START_SAFE(input, 0, setOffset);
             if(setOffset != start_safe[i]){
                 log_err("ERROR: UTF8_SET_CHAR_START_SAFE failed for offset=%ld. Expected:%ld Got:%ld\n", offset, start_safe[i], setOffset);
             }
-
+#endif
             setOffset=offset;
             U8_SET_CP_START(input, 0, setOffset);
             if(setOffset != start_safe[i]){
                 log_err("ERROR: U8_SET_CP_START failed for offset=%ld. Expected:%ld Got:%ld\n", offset, start_safe[i], setOffset);
             }
         }
-
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
         setOffset=offset;
         UTF8_SET_CHAR_LIMIT_SAFE(input,0, setOffset, sizeof(input));
         if(setOffset != limit_safe[i]){
             log_err("ERROR: UTF8_SET_CHAR_LIMIT_SAFE failed for offset=%ld. Expected:%ld Got:%ld\n", offset, limit_safe[i], setOffset);
         }
-
+#endif
         setOffset=offset;
         U8_SET_CP_LIMIT(input,0, setOffset, sizeof(input));
         if(setOffset != limit_safe[i]){
@@ -772,12 +829,13 @@ static void TestSetCharUnsafe() {
     int32_t offset=0, setOffset=0;
     for(offset=0; offset<=UPRV_LENGTHOF(input); offset++){
         if (offset<UPRV_LENGTHOF(input)){
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
             setOffset=offset;
             UTF8_SET_CHAR_START_UNSAFE(input, setOffset);
             if(setOffset != start_unsafe[i]){
                 log_err("ERROR: UTF8_SET_CHAR_START_UNSAFE failed for offset=%ld. Expected:%ld Got:%ld\n", offset, start_unsafe[i], setOffset);
             }
-
+#endif
             setOffset=offset;
             U8_SET_CP_START_UNSAFE(input, setOffset);
             if(setOffset != start_unsafe[i]){
@@ -786,12 +844,13 @@ static void TestSetCharUnsafe() {
         }
 
         if (offset != 0) { /* Can't have it go off the end of the array */
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
             setOffset=offset;
             UTF8_SET_CHAR_LIMIT_UNSAFE(input, setOffset);
             if(setOffset != limit_unsafe[i]){
                 log_err("ERROR: UTF8_SET_CHAR_LIMIT_UNSAFE failed for offset=%ld. Expected:%ld Got:%ld\n", offset, limit_unsafe[i], setOffset);
             }
-
+#endif
             setOffset=offset;
             U8_SET_CP_LIMIT_UNSAFE(input, setOffset);
             if(setOffset != limit_unsafe[i]){
@@ -804,6 +863,7 @@ static void TestSetCharUnsafe() {
 }
 
 static void TestAppendChar(){
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     static const uint8_t s[11]={0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x00};
     static const uint32_t test[]={
     /*  append-position(unsafe),  CHAR to be appended */
@@ -968,8 +1028,7 @@ static void TestAppendChar(){
         }
         count++;
     }
-
-
+#endif
 }
 
 static void TestAppend() {
@@ -1123,10 +1182,3 @@ TestSurrogates() {
         i=iu;   /* go back by one UTF-8 sequence */
     }
 }
-
-static void printUChars(const uint8_t *uchars, int16_t len){
-    int16_t i=0;
-    for(i=0; i<len; i++){
-        log_err("0x%02x ", *(uchars+i));
-    }
-}
index 233f82b9374190e6388a79a5445d2e793aae25b7..84a2b69ee09491e8b2e5d8890e8b6fecbbedb483 100644 (file)
@@ -611,7 +611,7 @@ void CharIterTest::TestIterationUChar32() {
                 errln("setIndex32() isn't working right");
             if (c != CharacterIterator::DONE) {
                 c = iter.next32();
-                i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i+2 : i+1;
+                i += U16_LENGTH(c);
             }
         } while (c != CharacterIterator::DONE);
         if(iter.hasNext() == TRUE)
@@ -650,7 +650,7 @@ void CharIterTest::TestIterationUChar32() {
                 errln("getIndex() isn't working right");
             if (c != CharacterIterator::DONE) {
                 c = iter.previous32();
-                i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i-2 : i-1;
+                i -= U16_LENGTH(c);
             }
         } while (c != CharacterIterator::DONE);
         if(iter.hasPrevious() == TRUE)
@@ -684,7 +684,7 @@ void CharIterTest::TestIterationUChar32() {
             if(c != text.char32At(i))
                 errln("Character mismatch at position %d, iterator has %X, string has %X", i, c, text.char32At(i));
 
-            i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i+2 : i+1;
+            i += U16_LENGTH(c);
             if(iter.getIndex() != i)
                 errln("getIndex() aftr next32PostInc() isn't working right");
             if(iter.current32() != text.char32At(i))
@@ -725,7 +725,7 @@ void CharIterTest::TestIterationUChar32() {
 
             if (c != CharacterIterator::DONE) {
                 c = iter.next32();
-                i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i+2 : i+1;
+                i += U16_LENGTH(c);
             }
         } while (c != CharacterIterator::DONE);
         c=iter.next32();
@@ -753,7 +753,7 @@ void CharIterTest::TestIterationUChar32() {
 
             if (c != CharacterIterator::DONE) {
                 c = iter.previous32();
-                i=UTF16_NEED_MULTIPLE_UCHAR(c) ? i-2 : i-1;
+                i -= U16_LENGTH(c);
             }
            
         } while (c != CharacterIterator::DONE);
index 203a4386283efcc2f29875262eee1c1cef41e9f0..6286ff54f32de62a4a3200bacaa40a828039a0d5 100644 (file)
@@ -37,6 +37,7 @@
 #include "unicode/uniset.h"
 #include "unicode/ustring.h"
 #include "unicode/ures.h"
+#include "unicode/utf16.h"
 #include "convtest.h"
 #include "cmemory.h"
 #include "unicode/tstdtmod.h"
index 3b423b45b76b6f6e54abb67804e21c0bcc24e7ff..bad84cdd73b57ada24c7a60a1b136db14ce9999c 100644 (file)
@@ -21,7 +21,7 @@
 #include "unicode/ucnv.h"
 #include "unicode/ustring.h"
 #include "unicode/uidna.h"
-
+#include "unicode/utf16.h"
 #include "idnaconf.h"
 
 static const UChar C_TAG[] = {0x3D, 0x3D, 0x3D, 0x3D, 0x3D, 0}; // =====
index ab5ce8c1272ca130354baa43bb81565f3b3bfd5f..8147bbfdfa9a64bf5d8b462e6a8e39802d2d8c27 100644 (file)
@@ -29,6 +29,7 @@
 #include "unicode/ucnv.h"
 #include "unicode/unistr.h"
 #include "unicode/ures.h"
+#include "unicode/utf16.h"
 
 #include "intltest.h"
 
index 90e94cdbb1d5eb7fb479d4579edb69c316a993db..389b313807fddc74aedea309ff4d7227dd8e1a5a 100644 (file)
 #include "unicode/fmtable.h"
 #include "unicode/testlog.h"
 
-
-#if U_NO_DEFAULT_INCLUDE_UTF_HEADERS
-/* deprecated  - make tests pass with U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
-#include "unicode/utf_old.h"
-#endif
-
 U_NAMESPACE_USE
 
 #if U_PLATFORM == U_PF_OS390
index 0dbc9103846a8d52afb56ce6464de16c4b62a4d8..398bc68e2799fb957f3e362e3323310d8c76c0a7 100644 (file)
@@ -38,7 +38,7 @@
 #include "unicode/usetiter.h"
 #include "unicode/ustring.h"
 #include "unicode/utext.h"
-
+#include "unicode/utf16.h"
 #include "regextst.h"
 #include "regexcmp.h"
 #include "uvector.h"
index afb1a47272f533d40f2d318a74d8f2343964763a..9f542e811af5b92a031d24a99bc23e749c878ff4 100644 (file)
@@ -144,24 +144,22 @@ StringTest::Test_UNICODE_STRING_SIMPLE() {
 
 void
 StringTest::Test_UTF8_COUNT_TRAIL_BYTES() {
+#if !U_HIDE_OBSOLETE_UTF_OLD_H
     if(UTF8_COUNT_TRAIL_BYTES(0x7F) != 0
-        || UTF8_COUNT_TRAIL_BYTES(0xC0) != 1
-        || UTF8_COUNT_TRAIL_BYTES(0xE0) != 2
-        || UTF8_COUNT_TRAIL_BYTES(0xF0) != 3)
-    {
-        errln("Test_UTF8_COUNT_TRAIL_BYTES: UTF8_COUNT_TRAIL_BYTES does not work right! "
-              "See utf_old.h.");
-    }
-       // Note: U8_COUNT_TRAIL_BYTES (current) and UTF8_COUNT_TRAIL_BYTES (deprecated)
-       //       have completely different implementations.
-       if (U8_COUNT_TRAIL_BYTES(0x7F) != 0
-               || U8_COUNT_TRAIL_BYTES(0xC0) != 1
-               || U8_COUNT_TRAIL_BYTES(0xE0) != 2
-               || U8_COUNT_TRAIL_BYTES(0xF0) != 3)
-       {
-               errln("Test_UTF8_COUNT_TRAIL_BYTES: U8_COUNT_TRAIL_BYTES does not work right! "
-                       "See utf8.h.");
-       }
+            || UTF8_COUNT_TRAIL_BYTES(0xC0) != 1
+            || UTF8_COUNT_TRAIL_BYTES(0xE0) != 2
+            || UTF8_COUNT_TRAIL_BYTES(0xF0) != 3) {
+        errln("UTF8_COUNT_TRAIL_BYTES does not work right! See utf_old.h.");
+    }
+#endif
+    // Note: U8_COUNT_TRAIL_BYTES (current) and UTF8_COUNT_TRAIL_BYTES (deprecated)
+    //       have completely different implementations.
+    if (U8_COUNT_TRAIL_BYTES(0x7F) != 0
+            || U8_COUNT_TRAIL_BYTES(0xC0) != 1
+            || U8_COUNT_TRAIL_BYTES(0xE0) != 2
+            || U8_COUNT_TRAIL_BYTES(0xF0) != 3) {
+        errln("U8_COUNT_TRAIL_BYTES does not work right! See utf8.h.");
+    }
 }
 
 void StringTest::runIndexedTest(int32_t index, UBool exec, const char *&name, char * /*par*/) {
index 3c92d8823298f9b0b7a9dedd16e4cf79732c8435..acda1f60bc14351c1c66057110bfba10dff52978 100644 (file)
@@ -28,6 +28,7 @@
 #include "unicode/ustring.h"
 #include "unicode/usprep.h"
 #include "unicode/uniset.h"
+#include "unicode/utf16.h"
 #include "cmemory.h"
 #include "testidna.h"
 #include "idnaref.h"
index 513e7220a0017a363c2d057e19c89f89f1152436..f58c57a3e56e60ef76a728aea1c1c93100a8cfb9 100644 (file)
@@ -15,6 +15,7 @@
 #include "unicode/utypes.h"
 #include "unicode/edits.h"
 #include "unicode/unistr.h"
+#include "unicode/utf16.h"
 #include "testutil.h"
 #include "intltest.h"
 
index 816a67a34485484375da508b4707f67806e268c7..ac7be45799bf172916b1038fca3094da3e62ee07 100644 (file)
@@ -23,6 +23,7 @@
 #include "unicode/ucharstriebuilder.h"
 #include "unicode/uniset.h"
 #include "unicode/unistr.h"
+#include "unicode/utf16.h"
 #include "intltest.h"
 #include "cmemory.h"
 
index dc1eeacf0c2e2c1e29ffdae09794760c8703fdec..d142f048d58c962422648fa73f1ab8a5e2fd6ca9 100644 (file)
@@ -23,6 +23,8 @@
 #include "unicode/ustring.h"
 #include "unicode/parsepos.h"
 #include "unicode/symtable.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
 #include "unicode/uversion.h"
 #include "cmemory.h"
 #include "hash.h"
index 622e0633803831c3a74013fbf3fe58af256de518..f2298eaa2e9c40c25bc4be2d7ab5c44855293443 100644 (file)
@@ -16,6 +16,7 @@
 #include "unicode/utypes.h"
 #include "unicode/utext.h"
 #include "unicode/utf8.h"
+#include "unicode/utf16.h"
 #include "unicode/ustring.h"
 #include "unicode/uchriter.h"
 #include "cmemory.h"