ICU-535 reinstate readable UTF16_..._SAFE macros, removing unwarranted new _STRICT/_LENIENT variants

X-SVN-Rev: 3206
This commit is contained in:
Markus Scherer 2000-12-12 22:11:08 +00:00
parent 9f7d830b5d
commit 76972c7a1a
2 changed files with 1 additions and 49 deletions

View File

@ -143,7 +143,7 @@ ucnv_getUChar32KeepOverflow(UConverter *cnv, const UChar *buffer, int32_t length
/* get the first code point in the buffer */
i=0;
UTF_NEXT_CHAR_SAFE_LENIENT(buffer, i, length, c);
UTF_NEXT_CHAR_SAFE(buffer, i, length, c, FALSE);
if(i<length) {
/* there are UChars left in the buffer that need to go into the overflow buffer */
UChar *overflow=cnv->UCharErrorBuffer;

View File

@ -151,18 +151,10 @@ void TestGetChar()
if(c != result[i+1]){
log_err("ERROR: UTF16_GET_CHAR_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+1], c);
}
UTF16_GET_CHAR_SAFE_LENIENT(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c);
if(c != result[i+1]){
log_err("ERROR: UTF16_GET_CHAR_SAFE failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+1], c);
}
UTF16_GET_CHAR_SAFE(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c, TRUE);
if(c != result[i+2]){
log_err("ERROR: UTF16_GET_CHAR_SAFE(strict) failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
UTF16_GET_CHAR_SAFE_STRICT(input, 0, offset, sizeof(input)/U_SIZEOF_UCHAR, c);
if(c != result[i+2]){
log_err("ERROR: UTF16_GET_CHAR_SAFE(strict) failed for offset=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
i=(uint16_t)(i+3);
}
@ -226,16 +218,6 @@ void TestNextPrevChar(){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+1], c);
}
setOffset=offset;
UTF16_NEXT_CHAR_SAFE_LENIENT(input, setOffset, sizeof(input)/U_SIZEOF_UCHAR, c);
if(setOffset != movedOffset[i+1]){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
offset, movedOffset[i+1], setOffset);
}
if(c != result[i+1]){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+1], c);
}
setOffset=offset;
UTF16_NEXT_CHAR_SAFE(input, setOffset, sizeof(input)/U_SIZEOF_UCHAR, c, TRUE);
if(setOffset != movedOffset[i+1]){
@ -246,16 +228,6 @@ void TestNextPrevChar(){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
setOffset=offset;
UTF16_NEXT_CHAR_SAFE_STRICT(input, setOffset, sizeof(input)/U_SIZEOF_UCHAR, c);
if(setOffset != movedOffset[i+1]){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE(strict) failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
offset, movedOffset[i+2], setOffset);
}
if(c != result[i+2]){
log_err("ERROR: UTF16_NEXT_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+2], c);
}
i=(uint16_t)(i+6);
}
i=0;
@ -280,16 +252,6 @@ void TestNextPrevChar(){
log_err("ERROR: UTF16_PREV_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+4], c);
}
setOffset=offset;
UTF16_PREV_CHAR_SAFE_LENIENT(input, 0, setOffset, c);
if(setOffset != movedOffset[i+4]){
log_err("ERROR: UTF16_PREV_CHAR_SAFE failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
offset, movedOffset[i+4], setOffset);
}
if(c != result[i+4]){
log_err("ERROR: UTF16_PREV_CHAR_SAFE failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+4], c);
}
setOffset=offset;
UTF16_PREV_CHAR_SAFE(input, 0, setOffset, c, TRUE);
if(setOffset != movedOffset[i+5]){
@ -300,16 +262,6 @@ void TestNextPrevChar(){
log_err("ERROR: UTF16_PREV_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+5], c);
}
setOffset=offset;
UTF16_PREV_CHAR_SAFE_STRICT(input, 0, setOffset, c);
if(setOffset != movedOffset[i+5]){
log_err("ERROR: UTF16_PREV_CHAR_SAFE(strict) failed to move the offset correctly at %d\n ExpectedOffset:%d Got %d\n",
offset, movedOffset[i+5], setOffset);
}
if(c != result[i+5]){
log_err("ERROR: UTF16_PREV_CHAR_SAFE(strict) failed for input=%ld. Expected:%lx Got:%lx\n", offset, result[i+5], c);
}
i=(uint16_t)(i+6);
}