]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/test/iotest/stream.cpp
ICU-57131.0.1.tar.gz
[apple/icu.git] / icuSources / test / iotest / stream.cpp
index a821636c77e92106e2114c13eb7af4b5a40321d5..e54e8b6a3679742bc3fcc6943d282b6d9ab31482 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 2002-2011, International Business Machines
+*   Copyright (C) 2002-2016, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *   file name:  iotest.cpp
@@ -18,6 +18,7 @@
 #include "unicode/ucnv.h"
 #include "unicode/ustring.h"
 #include "ustr_cnv.h"
+#include "cmemory.h"
 #include "iotest.h"
 
 #if U_IOSTREAM_SOURCE >= 199711
@@ -74,7 +75,7 @@ static void U_CALLCONV TestStream(void)
         return;
     }
     ucnv_close(defConv);
-    strncpy(defConvName, ucnv_getDefaultName(), sizeof(defConvName)/sizeof(defConvName[0]));
+    strncpy(defConvName, ucnv_getDefaultName(), UPRV_LENGTHOF(defConvName));
     ucnv_setDefaultName("UTF-8");
 
     static const char * const TESTSTRING = "\x20\x74\x48\x69\x73\xCE\xBC\xE2\x80\x82\x20\x6D\x75\x20\x77\x6F\x72\x6C\x64";
@@ -151,7 +152,7 @@ static void U_CALLCONV TestStream(void)
     ostrstream outLargeStream(testLargeStreamBuf, sizeof(testLargeStreamBuf));
 #endif
     UChar large_array[200];
-    int32_t large_array_length = sizeof(large_array)/sizeof(UChar);
+    int32_t large_array_length = UPRV_LENGTHOF(large_array);
     for (int32_t i = 0; i < large_array_length; i++) {
         large_array[i] = 0x41;
     }