X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/4388f060552cc537e71e957d32f35e9d75a61233..1a147d096ae81f4c8262f7bfc56bd19fc2dee932:/icuSources/test/cintltst/ucnvseltst.c diff --git a/icuSources/test/cintltst/ucnvseltst.c b/icuSources/test/cintltst/ucnvseltst.c index 6497871f..d990ea4f 100644 --- a/icuSources/test/cintltst/ucnvseltst.c +++ b/icuSources/test/cintltst/ucnvseltst.c @@ -1,5 +1,7 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /******************************************************************** - * Copyright (c) 1997-2011, International Business Machines + * Copyright (c) 1997-2014, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************** * @@ -20,12 +22,11 @@ #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" -#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) - #define FILENAME_BUFFER 1024 #define TDSRCPATH ".." U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING @@ -164,8 +165,8 @@ static FILE *fopenOrError(const char *filename) { int32_t needLen; FILE *f; char fnbuf[FILENAME_BUFFER]; - const char* directory= ctest_dataSrcDir(); - needLen = uprv_strlen(directory)+uprv_strlen(TDSRCPATH)+uprv_strlen(filename)+1; + const char* directory = ctest_dataSrcDir(); + needLen = (int32_t)(uprv_strlen(directory) + uprv_strlen(TDSRCPATH) + uprv_strlen(filename) + 1); if(needLen > FILENAME_BUFFER) { log_err("FAIL: Could not load %s. Filename buffer overflow, needed %d but buffer is %d\n", filename, needLen, FILENAME_BUFFER); @@ -393,7 +394,7 @@ static void TestSelector() excluded_sets[i] = uset_open(i*30, i*30+500); } - for(testCaseIdx = 0; testCaseIdx < LENGTHOF(getEncodingsFns); testCaseIdx++) + for(testCaseIdx = 0; testCaseIdx < UPRV_LENGTHOF(getEncodingsFns); testCaseIdx++) { int32_t excluded_set_id; int32_t num_encodings; @@ -411,7 +412,7 @@ static void TestSelector() * The handling of the exclusion set is independent of the * set of encodings, so there is no need to test every combination. */ - excluded_set_id = testCaseIdx % LENGTHOF(excluded_sets); + excluded_set_id = testCaseIdx % UPRV_LENGTHOF(excluded_sets); { UConverterSelector *sel_rt, *sel_fb; char *buffer_fb = NULL; @@ -469,7 +470,7 @@ static void TestSelector() verifyResult(ucnvsel_selectForUTF8(sel_rt, s, -1, &status), manual_rt); verifyResult(ucnvsel_selectForUTF8(sel_fb, s, -1, &status), manual_fb); - u_strFromUTF8(utf16, LENGTHOF(utf16), &length16, s, length8, &status); + u_strFromUTF8(utf16, UPRV_LENGTHOF(utf16), &length16, s, length8, &status); if (U_FAILURE(status)) { log_err("error converting the test text (string %ld) to UTF-16 - %s\n", (long)text.number, u_errorName(status));