Changeset 82787 in webkit
- Timestamp:
- Apr 2, 2011 9:55:07 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r82786 r82787 1 2011-04-02 Nico Weber <thakis@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Explicitly use icu namespace for ports building with U_USING_ICU_NAMESPACE=0 6 7 By default, ICU includes |using namespace icu;| in its header files 8 for backwards compatibility. Clients can define 9 U_USING_ICU_NAMESPACE=0 to tell ICU to not do this. Prefixing all ICU 10 classes with |icu::| makes this file compile no matter what 11 U_USING_ICU_NAMESPACE is set to. 12 13 https://bugs.webkit.org/show_bug.cgi?id=57715 14 15 * platform/text/LocalizedNumberICU.cpp: 16 (WebCore::createFormatterForCurrentLocale): 17 (WebCore::numberFormatter): 18 (WebCore::parseLocalizedNumber): 19 (WebCore::formatLocalizedNumber): 20 1 21 2011-04-02 Dan Bernstein <mitz@apple.com> 2 22 -
trunk/Source/WebCore/platform/text/LocalizedNumberICU.cpp
r81649 r82787 42 42 namespace WebCore { 43 43 44 static PassOwnPtr< NumberFormat> createFormatterForCurrentLocale()44 static PassOwnPtr<icu::NumberFormat> createFormatterForCurrentLocale() 45 45 { 46 46 UErrorCode status = U_ZERO_ERROR; 47 OwnPtr< NumberFormat> formatter = adoptPtr(NumberFormat::createInstance(status));47 OwnPtr<icu::NumberFormat> formatter = adoptPtr(icu::NumberFormat::createInstance(status)); 48 48 return U_SUCCESS(status) ? formatter.release() : 0; 49 49 } 50 50 51 51 // This might return 0. 52 static NumberFormat* numberFormatter()52 static icu::NumberFormat* numberFormatter() 53 53 { 54 54 ASSERT(isMainThread()); 55 static NumberFormat* formatter = createFormatterForCurrentLocale().leakPtr();55 static icu::NumberFormat* formatter = createFormatterForCurrentLocale().leakPtr(); 56 56 return formatter; 57 57 } … … 61 61 if (numberString.isEmpty()) 62 62 return numeric_limits<double>::quiet_NaN(); 63 NumberFormat* formatter = numberFormatter();63 icu::NumberFormat* formatter = numberFormatter(); 64 64 if (!formatter) 65 65 return numeric_limits<double>::quiet_NaN(); 66 UnicodeString numberUnicodeString(numberString.characters(), numberString.length());67 Formattable result;68 ParsePosition position(0);66 icu::UnicodeString numberUnicodeString(numberString.characters(), numberString.length()); 67 icu::Formattable result; 68 icu::ParsePosition position(0); 69 69 formatter->parse(numberUnicodeString, result, position); 70 70 if (position.getIndex() != numberUnicodeString.length()) … … 77 77 String formatLocalizedNumber(double number, unsigned fractionDigits) 78 78 { 79 NumberFormat* formatter = numberFormatter();79 icu::NumberFormat* formatter = numberFormatter(); 80 80 if (!formatter) 81 81 return String(); 82 UnicodeString result;82 icu::UnicodeString result; 83 83 formatter->setMaximumFractionDigits(clampToInteger(fractionDigits)); 84 84 formatter->format(number, result);
Note: See TracChangeset
for help on using the changeset viewer.