X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/51004dcb01e06fef634b61be77ed73dd61cb6db9..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/test/iotest/iotest.cpp diff --git a/icuSources/test/iotest/iotest.cpp b/icuSources/test/iotest/iotest.cpp index 2b97a2ed..204e5981 100644 --- a/icuSources/test/iotest/iotest.cpp +++ b/icuSources/test/iotest/iotest.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2002-2012, International Business Machines +* Copyright (C) 2002-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * file name: iotest.cpp @@ -20,6 +20,7 @@ #include "unicode/uchar.h" #include "unicode/unistr.h" #include "unicode/ustring.h" +#include "cmemory.h" #include "ustr_cnv.h" #include "iotest.h" #include "unicode/tstdtmod.h" @@ -237,14 +238,14 @@ static void U_CALLCONV DataDrivenPrintf(void) STANDARD_TEST_FILE); continue; } - u_memset(uBuffer, 0x2A, sizeof(uBuffer)/sizeof(uBuffer[0])); - uBuffer[sizeof(uBuffer)/sizeof(uBuffer[0])-1] = 0; + u_memset(uBuffer, 0x2A, UPRV_LENGTHOF(uBuffer)); + uBuffer[UPRV_LENGTHOF(uBuffer)-1] = 0; tempStr=testCase->getString("format", errorCode); - tempStr.extract(format, sizeof(format)/sizeof(format[0]), errorCode); + tempStr.extract(format, UPRV_LENGTHOF(format), errorCode); tempStr=testCase->getString("result", errorCode); - tempStr.extract(expectedResult, sizeof(expectedResult)/sizeof(expectedResult[0]), errorCode); + tempStr.extract(expectedResult, UPRV_LENGTHOF(expectedResult), errorCode); tempStr=testCase->getString("argument", errorCode); - tempStr.extract(argument, sizeof(argument)/sizeof(argument[0]), errorCode); + tempStr.extract(argument, UPRV_LENGTHOF(argument), errorCode); u_austrncpy(cBuffer, format, sizeof(cBuffer)); if(U_FAILURE(errorCode)) { log_err("error retrieving icuio/printf test case %d - %s\n", @@ -321,7 +322,7 @@ static void U_CALLCONV DataDrivenPrintf(void) STANDARD_TEST_FILE); } uBuffer[0]=0; - u_fgets(uBuffer, sizeof(uBuffer)/sizeof(uBuffer[0]), testFile.getAlias()); + u_fgets(uBuffer, UPRV_LENGTHOF(uBuffer), testFile.getAlias()); if (u_strcmp(uBuffer, expectedResult) != 0) { u_austrncpy(cBuffer, uBuffer, sizeof(cBuffer)); u_austrncpy(cFormat, format, sizeof(cFormat)); @@ -402,14 +403,14 @@ static void U_CALLCONV DataDrivenScanf(void) log_err("Can't open test file - %s\n", STANDARD_TEST_FILE); }*/ - u_memset(uBuffer, 0x2A, sizeof(uBuffer)/sizeof(uBuffer[0])); - uBuffer[sizeof(uBuffer)/sizeof(uBuffer[0])-1] = 0; + u_memset(uBuffer, 0x2A, UPRV_LENGTHOF(uBuffer)); + uBuffer[UPRV_LENGTHOF(uBuffer)-1] = 0; tempStr=testCase->getString("format", errorCode); - tempStr.extract(format, sizeof(format)/sizeof(format[0]), errorCode); + tempStr.extract(format, UPRV_LENGTHOF(format), errorCode); tempStr=testCase->getString("result", errorCode); - tempStr.extract(expectedResult, sizeof(expectedResult)/sizeof(expectedResult[0]), errorCode); + tempStr.extract(expectedResult, UPRV_LENGTHOF(expectedResult), errorCode); tempStr=testCase->getString("argument", errorCode); - tempStr.extract(argument, sizeof(argument)/sizeof(argument[0]), errorCode); + tempStr.extract(argument, UPRV_LENGTHOF(argument), errorCode); u_austrncpy(cBuffer, format, sizeof(cBuffer)); if(U_FAILURE(errorCode)) { log_err("error retrieving icuio/printf test case %d - %s\n", @@ -522,7 +523,7 @@ static void U_CALLCONV DataDrivenScanf(void) STANDARD_TEST_FILE); } uBuffer[0]; - u_fgets(uBuffer, sizeof(uBuffer)/sizeof(uBuffer[0]), testFile); + u_fgets(uBuffer, UPRV_LENGTHOF(uBuffer), testFile); if (u_strcmp(uBuffer, expectedResult) != 0) { u_austrncpy(cBuffer, uBuffer, sizeof(cBuffer)); u_austrncpy(cFormat, format, sizeof(cFormat)); @@ -596,14 +597,14 @@ static void U_CALLCONV DataDrivenPrintfPrecision(void) errorCode=U_ZERO_ERROR; continue; } - u_memset(uBuffer, 0x2A, sizeof(uBuffer)/sizeof(uBuffer[0])); - uBuffer[sizeof(uBuffer)/sizeof(uBuffer[0])-1] = 0; + u_memset(uBuffer, 0x2A, UPRV_LENGTHOF(uBuffer)); + uBuffer[UPRV_LENGTHOF(uBuffer)-1] = 0; tempStr=testCase->getString("format", errorCode); - tempStr.extract(format, sizeof(format)/sizeof(format[0]), errorCode); + tempStr.extract(format, UPRV_LENGTHOF(format), errorCode); tempStr=testCase->getString("result", errorCode); - tempStr.extract(expectedResult, sizeof(expectedResult)/sizeof(expectedResult[0]), errorCode); + tempStr.extract(expectedResult, UPRV_LENGTHOF(expectedResult), errorCode); tempStr=testCase->getString("argument", errorCode); - tempStr.extract(argument, sizeof(argument)/sizeof(argument[0]), errorCode); + tempStr.extract(argument, UPRV_LENGTHOF(argument), errorCode); precision=testCase->getInt28("precision", errorCode); u_austrncpy(cBuffer, format, sizeof(cBuffer)); if(U_FAILURE(errorCode)) {