ICU-516 streaming conversion functions set U_BUFFER_OVERFLOW_ERROR instead of U_INDEX_OUTOFBOUNDS_ERROR

X-SVN-Rev: 2203
This commit is contained in:
Markus Scherer 2000-08-11 20:11:06 +00:00
parent 7ad13c4086
commit 35f850ef92
9 changed files with 15 additions and 17 deletions

View File

@ -93,7 +93,7 @@ u_file_write( const UChar *chars,
written += (myTarget - f->fCharBuffer); written += (myTarget - f->fCharBuffer);
myTarget = f->fCharBuffer; myTarget = f->fCharBuffer;
} }
while(status == U_INDEX_OUTOFBOUNDS_ERROR); while(status == U_BUFFER_OVERFLOW_ERROR);
/* return # of chars written */ /* return # of chars written */
return written; return written;

View File

@ -921,8 +921,6 @@ int32_t XMLUConvert( UConverter* inConverter,
flush, flush,
err); err);
if (*err == U_INDEX_OUTOFBOUNDS_ERROR) *err = U_BUFFER_OVERFLOW_ERROR;
// *inBufSize = inBufferAlias; // *inBufSize = inBufferAlias;
return outBufferAlias - outBuffer; return outBufferAlias - outBuffer;
} }
@ -969,11 +967,11 @@ void XMLU_fromCodepageToCodepage( UConverter* outConverter,
flush, flush,
err); err);
/*U_INDEX_OUTOFBOUNDS_ERROR means that the output "CHUNK" is full /*U_BUFFER_OVERFLOW_ERROR means that the output "CHUNK" is full
*we will require at least another loop (it's a recoverable error) *we will require at least another loop (it's a recoverable error)
*/ */
if (U_SUCCESS(*err) || (*err == U_INDEX_OUTOFBOUNDS_ERROR)) if (U_SUCCESS(*err) || (*err == U_BUFFER_OVERFLOW_ERROR))
{ {
*err = U_ZERO_ERROR; *err = U_ZERO_ERROR;
out_chunk_alias2 = out_chunk; out_chunk_alias2 = out_chunk;
@ -1024,11 +1022,11 @@ void XMLU_fromCodepageToCodepage( UConverter* outConverter,
flush, flush,
err); err);
/*U_INDEX_OUTOFBOUNDS_ERROR means that the output "CHUNK" is full /*U_BUFFER_OVERFLOW_ERROR means that the output "CHUNK" is full
*we will require at least another loop (it's a recoverable error) *we will require at least another loop (it's a recoverable error)
*/ */
if (U_SUCCESS (*err) || (*err == U_INDEX_OUTOFBOUNDS_ERROR)) if (U_SUCCESS (*err) || (*err == U_BUFFER_OVERFLOW_ERROR))
{ {
*err = U_ZERO_ERROR; *err = U_ZERO_ERROR;
out_chunk_alias2 = out_chunk; out_chunk_alias2 = out_chunk;

View File

@ -66,7 +66,7 @@ uprint(const UChar *s,
myTarget = buf; myTarget = buf;
arraySize = BUF_SIZE; arraySize = BUF_SIZE;
} }
while(*status == U_INDEX_OUTOFBOUNDS_ERROR); while(*status == U_BUFFER_OVERFLOW_ERROR);
finish: finish:

View File

@ -67,7 +67,7 @@ uprint(const UChar *s,
myTarget = buf; myTarget = buf;
arraySize = BUF_SIZE; arraySize = BUF_SIZE;
} }
while(*status == U_INDEX_OUTOFBOUNDS_ERROR); while(*status == U_BUFFER_OVERFLOW_ERROR);
finish: finish:

View File

@ -242,7 +242,7 @@ UErrorCode compsample_02()
scsu_compress(&comp, &target, output+SAMPLE2BUFFERSIZE, scsu_compress(&comp, &target, output+SAMPLE2BUFFERSIZE,
&source, input+sourceLen, &status); &source, input+sourceLen, &status);
if( (status == U_ZERO_ERROR) || (status == U_INDEX_OUTOFBOUNDS_ERROR)) { if( (status == U_ZERO_ERROR) || (status == U_BUFFER_OVERFLOW_ERROR)) {
/* got all of it */ /* got all of it */
// printBytes("out", output, target-output); // Uncomment for very verbose output.. // printBytes("out", output, target-output); // Uncomment for very verbose output..

View File

@ -325,7 +325,7 @@ UErrorCode convsample_03()
size of input and output buffer can be used, as long as the size of input and output buffer can be used, as long as the
program handles the following cases: If the input buffer is empty, program handles the following cases: If the input buffer is empty,
the source pointer will be equal to sourceLimit. If the output the source pointer will be equal to sourceLimit. If the output
buffer is empty, U_INDEX_OUTOFBOUNDS_ERROR will be returned. buffer has overflowed, U_BUFFER_OVERFLOW_ERROR will be returned.
*/ */
UErrorCode convsample_05() UErrorCode convsample_05()
@ -383,7 +383,7 @@ UErrorCode convsample_05()
/* is true (when no more data will come) */ /* is true (when no more data will come) */
&status); &status);
if(status != U_INDEX_OUTOFBOUNDS_ERROR) if(status == U_BUFFER_OVERFLOW_ERROR)
{ {
// simply ran out of space - we'll reset the target ptr the next // simply ran out of space - we'll reset the target ptr the next
// time through the loop. // time through the loop.

View File

@ -1041,7 +1041,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
} }
} }
} while ( (status == U_INDEX_OUTOFBOUNDS_ERROR) || (U_SUCCESS(status) && (sourceLimit < realSourceEnd)) ); } while ( (status == U_BUFFER_OVERFLOW_ERROR) || (U_SUCCESS(status) && (sourceLimit < realSourceEnd)) );
if(U_FAILURE(status)) if(U_FAILURE(status))
{ {
@ -1246,7 +1246,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
} }
} }
} while ( (status == U_INDEX_OUTOFBOUNDS_ERROR) || (U_SUCCESS(status) && (srcLimit < realSourceEnd)) ); /* while we just need another buffer */ } while ( (status == U_BUFFER_OVERFLOW_ERROR) || (U_SUCCESS(status) && (srcLimit < realSourceEnd)) ); /* while we just need another buffer */
if(U_FAILURE(status)) if(U_FAILURE(status))

View File

@ -196,7 +196,7 @@ UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t
doFlush, /* flush if we're at the end of the input data */ doFlush, /* flush if we're at the end of the input data */
&status); &status);
} while ( (status == U_INDEX_OUTOFBOUNDS_ERROR) || (sourceLimit < realSourceEnd) ); } while ( (status == U_BUFFER_OVERFLOW_ERROR) || (sourceLimit < realSourceEnd) );
if(U_FAILURE(status)) if(U_FAILURE(status))
{ {
@ -358,7 +358,7 @@ UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *e
checkOffsets ? offs : NULL, checkOffsets ? offs : NULL,
(UBool)(srcLimit == realSourceEnd), /* flush if we're at the end of hte source data */ (UBool)(srcLimit == realSourceEnd), /* flush if we're at the end of hte source data */
&status); &status);
} while ( (status == U_INDEX_OUTOFBOUNDS_ERROR) || (srcLimit < realSourceEnd) ); /* while we just need another buffer */ } while ( (status == U_BUFFER_OVERFLOW_ERROR) || (srcLimit < realSourceEnd) ); /* while we just need another buffer */
if(U_FAILURE(status)) if(U_FAILURE(status))

View File

@ -77,7 +77,7 @@ uprint(const UChar *s,
myTarget = buf; myTarget = buf;
arraySize = BUF_SIZE; arraySize = BUF_SIZE;
} }
while(*status == U_INDEX_OUTOFBOUNDS_ERROR); while(*status == U_BUFFER_OVERFLOW_ERROR);
finish: finish: