Lines Matching defs:cc
89 ConversionCase cc;
115 cc.caseNr=i;
119 cc.charset=charset;
130 cc.bytes=testCase->getBinary(cc.bytesLength, "bytes", errorCode);
132 cc.unicode=unicode.getBuffer();
133 cc.unicodeLength=unicode.length();
136 cc.offsets=testCase->getIntVector(offsetsLength, "offsets", errorCode);
138 cc.offsets=NULL;
145 cc.finalFlush= 0!=testCase->getInt28("flush", errorCode);
146 cc.fallbacks= 0!=testCase->getInt28("fallbacks", errorCode);
150 cc.outErrorCode=U_INVALID_CHAR_FOUND;
152 cc.outErrorCode=U_ILLEGAL_CHAR_FOUND;
154 cc.outErrorCode=U_TRUNCATED_CHAR_FOUND;
156 cc.outErrorCode=U_ILLEGAL_ESCAPE_SEQUENCE;
158 cc.outErrorCode=U_UNSUPPORTED_ESCAPE_SEQUENCE;
160 cc.outErrorCode=U_ZERO_ERROR;
165 cc.cbopt=cbopt;
188 cc.invalidChars=testCase->getBinary(cc.invalidLength, "invalidChars", errorCode);
196 ToUnicodeCase(cc, callback, option);
210 ConversionCase cc;
237 cc.caseNr=i;
241 cc.charset=charset;
253 cc.unicode=unicode.getBuffer();
254 cc.unicodeLength=unicode.length();
255 cc.bytes=testCase->getBinary(cc.bytesLength, "bytes", errorCode);
258 cc.offsets=testCase->getIntVector(offsetsLength, "offsets", errorCode);
260 cc.offsets=NULL;
261 } else if(offsetsLength!=cc.bytesLength) {
263 i, cc.bytesLength, offsetsLength);
267 cc.finalFlush= 0!=testCase->getInt28("flush", errorCode);
268 cc.fallbacks= 0!=testCase->getInt28("fallbacks", errorCode);
272 cc.outErrorCode=U_INVALID_CHAR_FOUND;
274 cc.outErrorCode=U_ILLEGAL_CHAR_FOUND;
276 cc.outErrorCode=U_TRUNCATED_CHAR_FOUND;
278 cc.outErrorCode=U_ZERO_ERROR;
282 cc.setSub=0; // default: no subchar
292 if(length<=0 || length>=(int32_t)sizeof(cc.subchar)) {
298 cc.subchar[j]=(char)p[j];
301 cc.subchar[j]=0;
302 cc.setSub=1;
311 if(length<0 || length>=UPRV_LENGTHOF(cc.subString)) {
314 u_memcpy(cc.subString, p, length);
316 cc.subString[length]=0;
317 cc.setSub=-1;
325 cc.cbopt=cbopt;
349 cc.invalidUChars=invalidUChars.getBuffer();
350 cc.invalidLength=invalidUChars.length();
358 FromUnicodeCase(cc, callback, option);
857 stepToUnicode(ConversionCase &cc, UConverter *cnv,
866 source=(const char *)cc.bytes;
868 bytesLimit=source+cc.bytesLength;
881 flush=cc.finalFlush;
937 flush=(UBool)(cc.finalFlush && sourceLimit==bytesLimit);
1047 ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback, const char *option) {
1050 LocalUConverterPointer cnv(cnv_open(cc.charset, errorCode));
1053 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, errorCode.errorName());
1063 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
1094 if(step<0 && !cc.finalFlush) {
1101 cc.offsets=NULL;
1108 resultLength=stepToUnicode(cc, cnv.getAlias(),
1113 cc, cnv.getAlias(), steps[i].name,
1115 cc.offsets!=NULL ? resultOffsets : NULL,
1117 if(errorCode.isFailure() || !cc.finalFlush) {
1122 if (cc.offsets != NULL && resultOffsets[resultLength] != -1) {
1124 cc.caseNr, cc.charset, resultLength);
1128 cc.caseNr, cc.charset, resultLength);
1133 while(ok && cc.finalFlush) {
1140 (const char *)cc.bytes, cc.bytesLength,
1143 cc, cnv.getAlias(), "toUChars",
1156 (const char *)cc.bytes, cc.bytesLength,
1162 cc, cnv.getAlias(), "preflight toUChars",
1174 ConversionTest::checkToUnicode(ConversionCase &cc, UConverter *cnv, const char *name,
1192 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, u_errorName(errorCode));
1197 if(cc.unicodeLength!=resultLength) {
1199 } else if(0!=u_memcmp(cc.unicode, result, cc.unicodeLength)) {
1201 } else if(cc.offsets!=NULL && 0!=memcmp(cc.offsets, resultOffsets, cc.unicodeLength*sizeof(*cc.offsets))) {
1203 } else if(cc.outErrorCode!=resultErrorCode) {
1205 } else if(cc.invalidLength!=resultInvalidLength) {
1207 } else if(0!=memcmp(cc.invalidChars, resultInvalidChars, cc.invalidLength)) {
1220 s=printBytes(cc.bytes, cc.bytesLength, bytesString);
1221 s=printUnicode(cc.unicode, cc.unicodeLength, unicodeString=s);
1223 s=printOffsets(cc.offsets, cc.unicodeLength, offsetsString=s);
1225 s=printBytes(cc.invalidChars, cc.invalidLength, invalidCharsString=s);
1230 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, (int)(s-buffer));
1242 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, msg,
1243 bytesString, cc.bytesLength,
1244 unicodeString, cc.unicodeLength,
1248 u_errorName(cc.outErrorCode), u_errorName(resultErrorCode),
1258 stepFromUTF8(ConversionCase &cc,
1269 source=cc.utf8;
1272 utf8Limit=source+cc.utf8Length;
1284 flush=cc.finalFlush;
1356 flush=(UBool)(cc.finalFlush && sourceLimit==utf8Limit);
1364 stepFromUnicode(ConversionCase &cc, UConverter *cnv,
1373 source=cc.unicode;
1375 unicodeLimit=source+cc.unicodeLength;
1387 flush=cc.finalFlush;
1443 flush=(UBool)(cc.finalFlush && sourceLimit==unicodeLimit);
1451 ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback callback, const char *option) {
1457 cnv=cnv_open(cc.charset, errorCode);
1460 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
1470 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
1478 ucnv_setFallback(cnv, cc.fallbacks);
1483 if(cc.setSub>0) {
1484 length=(int32_t)strlen(cc.subchar);
1485 ucnv_setSubstChars(cnv, cc.subchar, (int8_t)length, &errorCode);
1488 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
1492 } else if(cc.setSub<0) {
1493 ucnv_setSubstString(cnv, cc.subString, -1, &errorCode);
1496 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
1504 cc.utf8=utf8;
1505 u_strToUTF8(utf8, UPRV_LENGTHOF(utf8), &cc.utf8Length,
1506 cc.unicode, cc.unicodeLength,
1512 cc.utf8Length=-1;
1537 resultLength=stepFromUnicode(cc, cnv,
1542 cc, cnv, steps[i].name,
1544 cc.offsets!=NULL ? resultOffsets : NULL,
1546 if(U_FAILURE(errorCode) || !cc.finalFlush) {
1553 cc.caseNr, cc.charset, resultLength);
1557 cc.caseNr, cc.charset, resultLength);
1561 cc.offsets=NULL;
1564 if(cc.utf8Length>=0) {
1566 resultLength=stepFromUTF8(cc, utf8Cnv, cnv,
1570 cc, cnv, steps[i].utf8Name,
1574 if(U_FAILURE(errorCode) || !cc.finalFlush) {
1584 while(ok && cc.finalFlush) {
1591 cc.unicode, cc.unicodeLength,
1594 cc, cnv, "fromUChars",
1607 cc.unicode, cc.unicodeLength,
1613 cc, cnv, "preflight fromUChars",
1625 ConversionTest::checkFromUnicode(ConversionCase &cc, UConverter *cnv, const char *name,
1643 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, u_errorName(errorCode));
1648 if(cc.bytesLength!=resultLength) {
1650 } else if(0!=memcmp(cc.bytes, result, cc.bytesLength)) {
1652 } else if(cc.offsets!=NULL && 0!=memcmp(cc.offsets, resultOffsets, cc.bytesLength*sizeof(*cc.offsets))) {
1654 } else if(cc.outErrorCode!=resultErrorCode) {
1656 } else if(cc.invalidLength!=resultInvalidLength) {
1658 } else if(0!=u_memcmp(cc.invalidUChars, resultInvalidUChars, cc.invalidLength)) {
1671 s=printUnicode(cc.unicode, cc.unicodeLength, unicodeString);
1672 s=printBytes(cc.bytes, cc.bytesLength, bytesString=s);
1674 s=printOffsets(cc.offsets, cc.bytesLength, offsetsString=s);
1676 s=printUnicode(cc.invalidUChars, cc.invalidLength, invalidCharsString=s);
1681 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, (int)(s-buffer));
1693 cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, name, msg,
1694 unicodeString, cc.unicodeLength,
1695 bytesString, cc.bytesLength,
1699 u_errorName(cc.outErrorCode), u_errorName(resultErrorCode),