+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2016, International Business Machines Corporation and
}
static const char* const modeStrings[]={
+ "?",
"UNORM_NONE",
"UNORM_NFD",
"UNORM_NFKD",
length2= unorm_normalize(source, -1, mode, 0, NULL, 0, &status2);
if(neededLen!=length2) {
log_err("ERROR in unorm_normalize(%s)[%d]: "
- "preflight length/NUL %d!=%d preflight length/srcLength\n",
+ "preflight length/srcLength %d!=%d preflight length/NUL\n",
modeStrings[mode], (int)x, (int)neededLen, (int)length2);
}
if(status==U_BUFFER_OVERFLOW_ERROR)
}
length2=unorm_normalize(source, u_strlen(source), mode, 0, result, UPRV_LENGTHOF(result), &status);
if(U_FAILURE(status) || neededLen!=length2) {
- log_data_err("ERROR in unorm_normalize(%s/NUL) at %s: %s - (Are you missing data?)\n",
+ log_data_err("ERROR in unorm_normalize(%s/srcLength) at %s: %s - (Are you missing data?)\n",
modeStrings[mode], austrdup(source), myErrorName(status));
} else {
assertEqual(result, cases[x][expIndex], x);
}
length2=unorm_normalize(source, -1, mode, 0, result, UPRV_LENGTHOF(result), &status);
if(U_FAILURE(status) || neededLen!=length2) {
- log_data_err("ERROR in unorm_normalize(%s/srcLength) at %s: %s - (Are you missing data?)\n",
+ log_data_err("ERROR in unorm_normalize(%s/NUL) at %s: %s - (Are you missing data?)\n",
modeStrings[mode], austrdup(source), myErrorName(status));
} else {
assertEqual(result, cases[x][expIndex], x);
UChar nfd[100];
int normsize = 0;
int nfdsize = 0;
-
+
while (size != 19) {
- data[size] = datachar[(rand() * 50) / RAND_MAX];
+ data[size] = datachar[rand() % UPRV_LENGTHOF(datachar)];
log_verbose("0x%x", data[size]);
- normsize += unorm_normalize(data + size, 1, UNORM_NFD, 0,
- norm + normsize, 100 - normsize, &status);
+ normsize += unorm_normalize(data + size, 1, UNORM_NFD, 0,
+ norm + normsize, 100 - normsize, &status);
if (U_FAILURE(status)) {
log_data_err("unorm_quickCheck(FCD) failed: exception occured at data generation - (Are you missing data?)\n");
break;
}
log_verbose("\n");
- nfdsize = unorm_normalize(data, size, UNORM_NFD, 0,
- nfd, 100, &status);
+ nfdsize = unorm_normalize(data, size, UNORM_NFD, 0,
+ nfd, 100, &status);
if (U_FAILURE(status)) {
log_data_err("unorm_quickCheck(FCD) failed: exception occured at normalized data generation - (Are you missing data?)\n");
}
}
length=unorm_normalize(s, length, UNORM_NFD, 0, nfd, UPRV_LENGTHOF(nfd), &errorCode);
+ if (U_FAILURE(errorCode)) {
+ log_data_err("%s:%d errorCode=%s\n", __FILE__, __LINE__, u_errorName(errorCode));
+ break;
+ }
/* length-length == 0 is used to get around a compiler warning. */
U16_GET(nfd, 0, length-length, length, lead);
U16_GET(nfd, 0, length-1, length, trail);