You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by David Braaten <da...@multiactive.com> on 2000/07/07 20:34:02 UTC
xalanc: ICUBridge::FormatNumber
I made a small change to ICUBridge.cpp, ICUBridge::FormatNumber, to check
for
U_USING_DEFAULT_ERROR, because it is a valid status code...
(I hope someone will excuse my laziness and check this change into the
source tree... ;) )
unsigned long
ICUBridge::FormatNumber(
const UTF16VectorType& thePattern,
double theNumber,
UTF16VectorType& theResult)
{
const UnicodeString theUnicodePattern(&thePattern[0], thePattern.size());
UErrorCode theStatus = U_ZERO_ERROR;
UnicodeString theUnicodeResult;
DecimalFormat theFormatter(theUnicodePattern, theStatus);
if ( theStatus == U_USING_DEFAULT_ERROR )
{
//translate default to zero error because it's expected by
// callers and it's ok to be using the default.
theStatus = U_ZERO_ERROR;
}
if ( theStatus == U_ZERO_ERROR )
{
// Do the format...
theFormatter.format(theNumber, theUnicodeResult);
const int32_t theLength = theUnicodeResult.length();
// Resize the vector to the appropriate length...
theResult.clear();
theResult.resize(theLength);
theUnicodeResult.extract(0, theLength, &theResult[0]);
}
return theStatus;
}