ICU-6176 Fix some Coverity warnings.

X-SVN-Rev: 23433
This commit is contained in:
George Rhoten 2008-02-14 04:39:06 +00:00
parent e6b92e6e4d
commit 57faac963c
2 changed files with 11 additions and 9 deletions

View file

@ -979,8 +979,17 @@ uregex_appendReplacement(URegularExpression *regexp,
int32_t RegexCImpl::appendTail(URegularExpression *regexp,
UChar **destBuf,
int32_t *destCapacity,
UErrorCode *status) {
UErrorCode *status)
{
if (destCapacity == NULL || destBuf == NULL ||
*destBuf == NULL && *destCapacity > 0 ||
*destCapacity < 0)
{
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
// If we come in with a buffer overflow error, don't suppress the operation.
// A series of appendReplacements, appendTail need to correctly preflight
// the buffer size when an overflow happens somewhere in the middle.
@ -993,13 +1002,6 @@ int32_t RegexCImpl::appendTail(URegularExpression *regexp,
if (validateRE(regexp, status) == FALSE) {
return 0;
}
if (destCapacity == NULL || destBuf == NULL ||
*destBuf == NULL && *destCapacity > 0 ||
*destCapacity < 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
RegexMatcher *m = regexp->fMatcher;
int32_t srcIdx;

View file

@ -573,7 +573,7 @@ ufile_getch(UFILE *f, UChar *ch)
*ch = *(f->str.fPos)++;
isValidChar = TRUE;
}
else if (f) {
else {
/* otherwise, fill the buffer and return the next character */
if(f->str.fPos >= f->str.fLimit) {
ufile_fill_uchar_buffer(f);