mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-15 01:42:37 +00:00
ICU-10585 Review fixes: Improve arg check, then don't skip res.setTo for preflight case
X-SVN-Rev: 34906
This commit is contained in:
parent
c64fb93a29
commit
93ac2bd3b5
1 changed files with 6 additions and 6 deletions
|
@ -498,14 +498,14 @@ utrans_toRules( const UTransliterator* trans,
|
|||
UBool escapeUnprintable,
|
||||
UChar* result, int32_t resultLength,
|
||||
UErrorCode* status) {
|
||||
utrans_ENTRY(status) -1;
|
||||
utrans_ENTRY(status) 0;
|
||||
if ( (result==NULL)? resultLength!=0: resultLength<0 ) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
UnicodeString res;
|
||||
if (!(result==NULL && resultLength==0)) {
|
||||
// NULL destination for pure preflighting: empty dummy string
|
||||
// otherwise, alias the destination buffer
|
||||
res.setTo(result, 0, resultLength);
|
||||
}
|
||||
res.setTo(result, 0, resultLength);
|
||||
((Transliterator*) trans)->toRules(res, escapeUnprintable);
|
||||
return res.extract(result, resultLength, *status);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue