+// © 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.
********************************************************************
*
#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
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);
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;
* 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;
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));