diff options
author | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-14 19:51:50 +0300 |
---|---|---|
committer | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-15 01:24:11 +0300 |
commit | cfcd865e05c0d0525ea27d1e153a043b32a85138 (patch) | |
tree | 68d3b3b25271e8a4998505897a269ff7ce119b76 /contrib/libs/icu/i18n/unum.cpp | |
parent | ccb790c507bd5e8ffe2ef9886ce5ee0a7ce22a15 (diff) | |
download | ydb-cfcd865e05c0d0525ea27d1e153a043b32a85138.tar.gz |
Update ICU to 73.2
Diffstat (limited to 'contrib/libs/icu/i18n/unum.cpp')
-rw-r--r-- | contrib/libs/icu/i18n/unum.cpp | 217 |
1 files changed, 124 insertions, 93 deletions
diff --git a/contrib/libs/icu/i18n/unum.cpp b/contrib/libs/icu/i18n/unum.cpp index 7043f7adc1..11a7bcba57 100644 --- a/contrib/libs/icu/i18n/unum.cpp +++ b/contrib/libs/icu/i18n/unum.cpp @@ -39,16 +39,16 @@ U_NAMESPACE_USE U_CAPI UNumberFormat* U_EXPORT2 unum_open( UNumberFormatStyle style, - const UChar* pattern, + const char16_t* pattern, int32_t patternLength, const char* locale, UParseError* parseErr, UErrorCode* status) { if(U_FAILURE(*status)) { - return NULL; + return nullptr; } - NumberFormat *retVal = NULL; + NumberFormat *retVal = nullptr; switch(style) { case UNUM_DECIMAL: @@ -68,22 +68,22 @@ unum_open( UNumberFormatStyle style, /* UnicodeString can handle the case when patternLength = -1. */ const UnicodeString pat(pattern, patternLength); - if(parseErr==NULL){ + if(parseErr==nullptr){ parseErr = &tErr; } DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale(locale), *status); - if(syms == NULL) { + if(syms == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; - return NULL; + return nullptr; } if (U_FAILURE(*status)) { delete syms; - return NULL; + return nullptr; } retVal = new DecimalFormat(pat, syms, *parseErr, *status); - if(retVal == NULL) { + if(retVal == nullptr) { delete syms; } } break; @@ -94,7 +94,7 @@ unum_open( UNumberFormatStyle style, /* UnicodeString can handle the case when patternLength = -1. */ const UnicodeString pat(pattern, patternLength); - if(parseErr==NULL){ + if(parseErr==nullptr){ parseErr = &tErr; } @@ -113,9 +113,20 @@ unum_open( UNumberFormatStyle style, retVal = new RuleBasedNumberFormat(URBNF_DURATION, Locale(locale), *status); break; - case UNUM_NUMBERING_SYSTEM: - retVal = new RuleBasedNumberFormat(URBNF_NUMBERING_SYSTEM, Locale(locale), *status); - break; + case UNUM_NUMBERING_SYSTEM: { + // if the locale ID specifies a numbering system, go through NumberFormat::createInstance() + // to handle it properly (we have to specify UNUM_DEFAULT to get it to handle the numbering + // system, but we'll always get a RuleBasedNumberFormat back); otherwise, just go ahead and + // create a RuleBasedNumberFormat ourselves + UErrorCode localErr = U_ZERO_ERROR; + Locale localeObj(locale); + int32_t keywordLength = localeObj.getKeywordValue("numbers", nullptr, 0, localErr); + if (keywordLength > 0) { + retVal = NumberFormat::createInstance(localeObj, UNUM_DEFAULT, *status); + } else { + retVal = new RuleBasedNumberFormat(URBNF_NUMBERING_SYSTEM, localeObj, *status); + } + } break; #endif case UNUM_DECIMAL_COMPACT_SHORT: @@ -128,16 +139,16 @@ unum_open( UNumberFormatStyle style, default: *status = U_UNSUPPORTED_ERROR; - return NULL; + return nullptr; } - if(retVal == NULL && U_SUCCESS(*status)) { + if(retVal == nullptr && U_SUCCESS(*status)) { *status = U_MEMORY_ALLOCATION_ERROR; } - if (U_FAILURE(*status) && retVal != NULL) { + if (U_FAILURE(*status) && retVal != nullptr) { delete retVal; - retVal = NULL; + retVal = nullptr; } return reinterpret_cast<UNumberFormat *>(retVal); @@ -159,11 +170,11 @@ unum_clone(const UNumberFormat *fmt, Format *res = 0; const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt); const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { res = df->clone(); } else { const RuleBasedNumberFormat* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(nf); - U_ASSERT(rbnf != NULL); + U_ASSERT(rbnf != nullptr); res = rbnf->clone(); } @@ -178,7 +189,7 @@ unum_clone(const UNumberFormat *fmt, U_CAPI int32_t U_EXPORT2 unum_format( const UNumberFormat* fmt, int32_t number, - UChar* result, + char16_t* result, int32_t resultLength, UFieldPosition *pos, UErrorCode* status) @@ -189,7 +200,7 @@ unum_format( const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_formatInt64(const UNumberFormat* fmt, int64_t number, - UChar* result, + char16_t* result, int32_t resultLength, UFieldPosition *pos, UErrorCode* status) @@ -198,8 +209,8 @@ unum_formatInt64(const UNumberFormat* fmt, return -1; UnicodeString res; - if(!(result==NULL && resultLength==0)) { - // NULL destination for pure preflighting: empty dummy string + if(!(result==nullptr && resultLength==0)) { + // nullptr destination for pure preflighting: empty dummy string // otherwise, alias the destination buffer res.setTo(result, 0, resultLength); } @@ -222,7 +233,7 @@ unum_formatInt64(const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_formatDouble( const UNumberFormat* fmt, double number, - UChar* result, + char16_t* result, int32_t resultLength, UFieldPosition *pos, /* 0 if ignore */ UErrorCode* status) @@ -231,8 +242,8 @@ unum_formatDouble( const UNumberFormat* fmt, if(U_FAILURE(*status)) return -1; UnicodeString res; - if(!(result==NULL && resultLength==0)) { - // NULL destination for pure preflighting: empty dummy string + if(!(result==nullptr && resultLength==0)) { + // nullptr destination for pure preflighting: empty dummy string // otherwise, alias the destination buffer res.setTo(result, 0, resultLength); } @@ -255,7 +266,7 @@ unum_formatDouble( const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_formatDoubleForFields(const UNumberFormat* format, double number, - UChar* result, + char16_t* result, int32_t resultLength, UFieldPositionIterator* fpositer, UErrorCode* status) @@ -263,14 +274,14 @@ unum_formatDoubleForFields(const UNumberFormat* format, if (U_FAILURE(*status)) return -1; - if (result == NULL ? resultLength != 0 : resultLength < 0) { + if (result == nullptr ? resultLength != 0 : resultLength < 0) { *status = U_ILLEGAL_ARGUMENT_ERROR; return -1; } UnicodeString res; - if (result != NULL) { - // NULL destination for pure preflighting: empty dummy string + if (result != nullptr) { + // nullptr destination for pure preflighting: empty dummy string // otherwise, alias the destination buffer res.setTo(result, 0, resultLength); } @@ -284,7 +295,7 @@ U_CAPI int32_t U_EXPORT2 unum_formatDecimal(const UNumberFormat* fmt, const char * number, int32_t length, - UChar* result, + char16_t* result, int32_t resultLength, UFieldPosition *pos, /* 0 if ignore */ UErrorCode* status) { @@ -292,7 +303,7 @@ unum_formatDecimal(const UNumberFormat* fmt, if(U_FAILURE(*status)) { return -1; } - if ((result == NULL && resultLength != 0) || resultLength < 0) { + if ((result == nullptr && resultLength != 0) || resultLength < 0) { *status = U_ILLEGAL_ARGUMENT_ERROR; return -1; } @@ -327,16 +338,16 @@ unum_formatDecimal(const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_formatDoubleCurrency(const UNumberFormat* fmt, double number, - UChar* currency, - UChar* result, + char16_t* currency, + char16_t* result, int32_t resultLength, UFieldPosition* pos, /* ignored if 0 */ UErrorCode* status) { if (U_FAILURE(*status)) return -1; UnicodeString res; - if (!(result==NULL && resultLength==0)) { - // NULL destination for pure preflighting: empty dummy string + if (!(result==nullptr && resultLength==0)) { + // nullptr destination for pure preflighting: empty dummy string // otherwise, alias the destination buffer res.setTo(result, 0, resultLength); } @@ -347,7 +358,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt, } CurrencyAmount *tempCurrAmnt = new CurrencyAmount(number, currency, *status); // Check for null pointer. - if (tempCurrAmnt == NULL) { + if (tempCurrAmnt == nullptr) { *status = U_MEMORY_ALLOCATION_ERROR; return -1; } @@ -365,7 +376,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt, static void parseRes(Formattable& res, const UNumberFormat* fmt, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t *parsePos /* 0 = start */, UErrorCode *status) @@ -393,7 +404,7 @@ parseRes(Formattable& res, U_CAPI int32_t U_EXPORT2 unum_parse( const UNumberFormat* fmt, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t *parsePos /* 0 = start */, UErrorCode *status) @@ -405,7 +416,7 @@ unum_parse( const UNumberFormat* fmt, U_CAPI int64_t U_EXPORT2 unum_parseInt64( const UNumberFormat* fmt, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t *parsePos /* 0 = start */, UErrorCode *status) @@ -417,7 +428,7 @@ unum_parseInt64( const UNumberFormat* fmt, U_CAPI double U_EXPORT2 unum_parseDouble( const UNumberFormat* fmt, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t *parsePos /* 0 = start */, UErrorCode *status) @@ -429,7 +440,7 @@ unum_parseDouble( const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_parseDecimal(const UNumberFormat* fmt, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t *parsePos /* 0 = start */, char *outBuf, @@ -439,7 +450,7 @@ unum_parseDecimal(const UNumberFormat* fmt, if (U_FAILURE(*status)) { return -1; } - if ((outBuf == NULL && outBufLength != 0) || outBufLength < 0) { + if ((outBuf == nullptr && outBufLength != 0) || outBufLength < 0) { *status = U_ILLEGAL_ARGUMENT_ERROR; return -1; } @@ -462,10 +473,10 @@ unum_parseDecimal(const UNumberFormat* fmt, U_CAPI double U_EXPORT2 unum_parseDoubleCurrency(const UNumberFormat* fmt, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t* parsePos, /* 0 = start */ - UChar* currency, + char16_t* currency, UErrorCode* status) { double doubleVal = 0.0; currency[0] = 0; @@ -474,17 +485,17 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt, } const UnicodeString src((UBool)(textLength == -1), text, textLength); ParsePosition pp; - if (parsePos != NULL) { + if (parsePos != nullptr) { pp.setIndex(*parsePos); } *status = U_PARSE_ERROR; // assume failure, reset if succeed LocalPointer<CurrencyAmount> currAmt(((const NumberFormat*)fmt)->parseCurrency(src, pp)); if (pp.getErrorIndex() != -1) { - if (parsePos != NULL) { + if (parsePos != nullptr) { *parsePos = pp.getErrorIndex(); } } else { - if (parsePos != NULL) { + if (parsePos != nullptr) { *parsePos = pp.getIndex(); } if (pp.getIndex() > 0) { @@ -508,6 +519,28 @@ unum_countAvailable() return uloc_countAvailable(); } +U_CAPI bool U_EXPORT2 +unum_hasAttribute(const UNumberFormat* fmt, + UNumberFormatAttribute attr) +{ + const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt); + bool isDecimalFormat = dynamic_cast<const DecimalFormat*>(nf) != nullptr; + + switch (attr) { + case UNUM_LENIENT_PARSE: + case UNUM_MAX_INTEGER_DIGITS: + case UNUM_MIN_INTEGER_DIGITS: + case UNUM_INTEGER_DIGITS: + case UNUM_MAX_FRACTION_DIGITS: + case UNUM_MIN_FRACTION_DIGITS: + case UNUM_FRACTION_DIGITS: + case UNUM_ROUNDING_MODE: + return true; + default: + return isDecimalFormat; + } +} + U_CAPI int32_t U_EXPORT2 unum_getAttribute(const UNumberFormat* fmt, UNumberFormatAttribute attr) @@ -543,7 +576,7 @@ unum_getAttribute(const UNumberFormat* fmt, // The remaining attributes are only supported for DecimalFormat const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { UErrorCode ignoredStatus = U_ZERO_ERROR; return df->getAttribute(attr, ignoredStatus); } @@ -588,7 +621,7 @@ unum_setAttribute( UNumberFormat* fmt, // The remaining attributes are only supported for DecimalFormat DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { UErrorCode ignoredStatus = U_ZERO_ERROR; df->setAttribute(attr, newValue, ignoredStatus); } @@ -600,7 +633,7 @@ unum_getDoubleAttribute(const UNumberFormat* fmt, { const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt); const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf); - if (df != NULL && attr == UNUM_ROUNDING_INCREMENT) { + if (df != nullptr && attr == UNUM_ROUNDING_INCREMENT) { return df->getRoundingIncrement(); } else { return -1.0; @@ -614,7 +647,7 @@ unum_setDoubleAttribute( UNumberFormat* fmt, { NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt); DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf); - if (df != NULL && attr == UNUM_ROUNDING_INCREMENT) { + if (df != nullptr && attr == UNUM_ROUNDING_INCREMENT) { df->setRoundingIncrement(newValue); } } @@ -622,7 +655,7 @@ unum_setDoubleAttribute( UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_getTextAttribute(const UNumberFormat* fmt, UNumberFormatTextAttribute tag, - UChar* result, + char16_t* result, int32_t resultLength, UErrorCode* status) { @@ -630,15 +663,15 @@ unum_getTextAttribute(const UNumberFormat* fmt, return -1; UnicodeString res; - if(!(result==NULL && resultLength==0)) { - // NULL destination for pure preflighting: empty dummy string + if(!(result==nullptr && resultLength==0)) { + // nullptr destination for pure preflighting: empty dummy string // otherwise, alias the destination buffer res.setTo(result, 0, resultLength); } const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt); const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { switch(tag) { case UNUM_POSITIVE_PREFIX: df->getPositivePrefix(res); @@ -670,14 +703,14 @@ unum_getTextAttribute(const UNumberFormat* fmt, } } else { const RuleBasedNumberFormat* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(nf); - U_ASSERT(rbnf != NULL); + U_ASSERT(rbnf != nullptr); if (tag == UNUM_DEFAULT_RULESET) { res = rbnf->getDefaultRuleSetName(); } else if (tag == UNUM_PUBLIC_RULESETS) { int32_t count = rbnf->getNumberOfRuleSetNames(); for (int i = 0; i < count; ++i) { res += rbnf->getRuleSetName(i); - res += (UChar)0x003b; // semicolon + res += (char16_t)0x003b; // semicolon } } else { *status = U_UNSUPPORTED_ERROR; @@ -691,7 +724,7 @@ unum_getTextAttribute(const UNumberFormat* fmt, U_CAPI void U_EXPORT2 unum_setTextAttribute( UNumberFormat* fmt, UNumberFormatTextAttribute tag, - const UChar* newValue, + const char16_t* newValue, int32_t newValueLength, UErrorCode *status) { @@ -701,7 +734,7 @@ unum_setTextAttribute( UNumberFormat* fmt, UnicodeString val(newValue, newValueLength); NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt); DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { switch(tag) { case UNUM_POSITIVE_PREFIX: df->setPositivePrefix(val); @@ -733,7 +766,7 @@ unum_setTextAttribute( UNumberFormat* fmt, } } else { RuleBasedNumberFormat* rbnf = dynamic_cast<RuleBasedNumberFormat*>(nf); - U_ASSERT(rbnf != NULL); + U_ASSERT(rbnf != nullptr); if (tag == UNUM_DEFAULT_RULESET) { rbnf->setDefaultRuleSet(val, *status); } else { @@ -745,7 +778,7 @@ unum_setTextAttribute( UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_toPattern( const UNumberFormat* fmt, UBool isPatternLocalized, - UChar* result, + char16_t* result, int32_t resultLength, UErrorCode* status) { @@ -753,22 +786,22 @@ unum_toPattern( const UNumberFormat* fmt, return -1; UnicodeString pat; - if(!(result==NULL && resultLength==0)) { - // NULL destination for pure preflighting: empty dummy string + if(!(result==nullptr && resultLength==0)) { + // nullptr destination for pure preflighting: empty dummy string // otherwise, alias the destination buffer pat.setTo(result, 0, resultLength); } const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt); const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { if(isPatternLocalized) df->toLocalizedPattern(pat); else df->toPattern(pat); } else { const RuleBasedNumberFormat* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(nf); - U_ASSERT(rbnf != NULL); + U_ASSERT(rbnf != nullptr); pat = rbnf->getRules(); } return pat.extract(result, resultLength, *status); @@ -777,20 +810,19 @@ unum_toPattern( const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_getSymbol(const UNumberFormat *fmt, UNumberFormatSymbol symbol, - UChar *buffer, + char16_t *buffer, int32_t size, - UErrorCode *status) -{ - if(status==NULL || U_FAILURE(*status)) { + UErrorCode *status) UPRV_NO_SANITIZE_UNDEFINED { + if(status==nullptr || U_FAILURE(*status)) { return 0; } - if(fmt==NULL || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT) { + if(fmt==nullptr || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT) { *status=U_ILLEGAL_ARGUMENT_ERROR; return 0; } const NumberFormat *nf = reinterpret_cast<const NumberFormat *>(fmt); const DecimalFormat *dcf = dynamic_cast<const DecimalFormat *>(nf); - if (dcf == NULL) { + if (dcf == nullptr) { *status = U_UNSUPPORTED_ERROR; return 0; } @@ -804,20 +836,19 @@ unum_getSymbol(const UNumberFormat *fmt, U_CAPI void U_EXPORT2 unum_setSymbol(UNumberFormat *fmt, UNumberFormatSymbol symbol, - const UChar *value, + const char16_t *value, int32_t length, - UErrorCode *status) -{ - if(status==NULL || U_FAILURE(*status)) { + UErrorCode *status) UPRV_NO_SANITIZE_UNDEFINED { + if(status==nullptr || U_FAILURE(*status)) { return; } - if(fmt==NULL || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT || value==NULL || length<-1) { + if(fmt==nullptr || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT || value==nullptr || length<-1) { *status=U_ILLEGAL_ARGUMENT_ERROR; return; } NumberFormat *nf = reinterpret_cast<NumberFormat *>(fmt); DecimalFormat *dcf = dynamic_cast<DecimalFormat *>(nf); - if (dcf == NULL) { + if (dcf == nullptr) { *status = U_UNSUPPORTED_ERROR; return; } @@ -831,7 +862,7 @@ unum_setSymbol(UNumberFormat *fmt, U_CAPI void U_EXPORT2 unum_applyPattern( UNumberFormat *fmt, UBool localized, - const UChar *pattern, + const char16_t *pattern, int32_t patternLength, UParseError *parseError, UErrorCode* status) @@ -839,21 +870,21 @@ unum_applyPattern( UNumberFormat *fmt, UErrorCode tStatus = U_ZERO_ERROR; UParseError tParseError; - if(parseError == NULL){ + if(parseError == nullptr){ parseError = &tParseError; } - if(status==NULL){ + if(status==nullptr){ status = &tStatus; } int32_t len = (patternLength == -1 ? u_strlen(pattern) : patternLength); - const UnicodeString pat((UChar*)pattern, len, len); + const UnicodeString pat((char16_t*)pattern, len, len); // Verify if the object passed is a DecimalFormat object NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt); DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf); - if (df != NULL) { + if (df != nullptr) { if(localized) { df->applyLocalizedPattern(pat,*parseError, *status); } else { @@ -870,11 +901,11 @@ unum_getLocaleByType(const UNumberFormat *fmt, ULocDataLocaleType type, UErrorCode* status) { - if (fmt == NULL) { + if (fmt == nullptr) { if (U_SUCCESS(*status)) { *status = U_ILLEGAL_ARGUMENT_ERROR; } - return NULL; + return nullptr; } return ((const Format*)fmt)->getLocaleID(type, *status); } @@ -901,23 +932,23 @@ unum_getContext(const UNumberFormat *fmt, UDisplayContextType type, UErrorCode* U_CAPI UFormattable * U_EXPORT2 unum_parseToUFormattable(const UNumberFormat* fmt, UFormattable *result, - const UChar* text, + const char16_t* text, int32_t textLength, int32_t* parsePos, /* 0 = start */ UErrorCode* status) { - UFormattable *newFormattable = NULL; + UFormattable *newFormattable = nullptr; if (U_FAILURE(*status)) return result; - if (fmt == NULL || (text==NULL && textLength!=0)) { + if (fmt == nullptr || (text==nullptr && textLength!=0)) { *status = U_ILLEGAL_ARGUMENT_ERROR; return result; } - if (result == NULL) { // allocate if not allocated. + if (result == nullptr) { // allocate if not allocated. newFormattable = result = ufmt_open(status); } parseRes(*(Formattable::fromUFormattable(result)), fmt, text, textLength, parsePos, status); - if (U_FAILURE(*status) && newFormattable != NULL) { + if (U_FAILURE(*status) && newFormattable != nullptr) { ufmt_close(newFormattable); - result = NULL; // deallocate if there was a parse error + result = nullptr; // deallocate if there was a parse error } return result; } @@ -925,15 +956,15 @@ unum_parseToUFormattable(const UNumberFormat* fmt, U_CAPI int32_t U_EXPORT2 unum_formatUFormattable(const UNumberFormat* fmt, const UFormattable *number, - UChar *result, + char16_t *result, int32_t resultLength, UFieldPosition *pos, /* ignored if 0 */ UErrorCode *status) { if (U_FAILURE(*status)) { return 0; } - if (fmt == NULL || number==NULL || - (result==NULL ? resultLength!=0 : resultLength<0)) { + if (fmt == nullptr || number==nullptr || + (result==nullptr ? resultLength!=0 : resultLength<0)) { *status = U_ILLEGAL_ARGUMENT_ERROR; return 0; } |