Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: third_party/WebKit/Source/platform/text/LocaleICU.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011,2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011,2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 UDateFormat* formatter = 159 UDateFormat* formatter =
160 udat_open(UDAT_PATTERN, UDAT_PATTERN, m_locale.data(), 0, -1, 160 udat_open(UDAT_PATTERN, UDAT_PATTERN, m_locale.data(), 0, -1,
161 monthPattern, isShort ? 3 : 4, &status); 161 monthPattern, isShort ? 3 : 4, &status);
162 udat_setContext(formatter, UDISPCTX_CAPITALIZATION_FOR_STANDALONE, &status); 162 udat_setContext(formatter, UDISPCTX_CAPITALIZATION_FOR_STANDALONE, &status);
163 ASSERT(U_SUCCESS(status)); 163 ASSERT(U_SUCCESS(status));
164 return formatter; 164 return formatter;
165 } 165 }
166 166
167 static String getDateFormatPattern(const UDateFormat* dateFormat) { 167 static String getDateFormatPattern(const UDateFormat* dateFormat) {
168 if (!dateFormat) 168 if (!dateFormat)
169 return emptyString(); 169 return emptyString;
170 170
171 UErrorCode status = U_ZERO_ERROR; 171 UErrorCode status = U_ZERO_ERROR;
172 int32_t length = udat_toPattern(dateFormat, TRUE, 0, 0, &status); 172 int32_t length = udat_toPattern(dateFormat, TRUE, 0, 0, &status);
173 if (status != U_BUFFER_OVERFLOW_ERROR || !length) 173 if (status != U_BUFFER_OVERFLOW_ERROR || !length)
174 return emptyString(); 174 return emptyString;
175 StringBuffer<UChar> buffer(length); 175 StringBuffer<UChar> buffer(length);
176 status = U_ZERO_ERROR; 176 status = U_ZERO_ERROR;
177 udat_toPattern(dateFormat, TRUE, buffer.characters(), length, &status); 177 udat_toPattern(dateFormat, TRUE, buffer.characters(), length, &status);
178 if (U_FAILURE(status)) 178 if (U_FAILURE(status))
179 return emptyString(); 179 return emptyString;
180 return String::adopt(buffer); 180 return String::adopt(buffer);
181 } 181 }
182 182
183 std::unique_ptr<Vector<String>> LocaleICU::createLabelVector( 183 std::unique_ptr<Vector<String>> LocaleICU::createLabelVector(
184 const UDateFormat* dateFormat, 184 const UDateFormat* dateFormat,
185 UDateFormatSymbolType type, 185 UDateFormatSymbolType type,
186 int32_t startIndex, 186 int32_t startIndex,
187 int32_t size) { 187 int32_t size) {
188 if (!dateFormat) 188 if (!dateFormat)
189 return std::unique_ptr<Vector<String>>(); 189 return std::unique_ptr<Vector<String>>();
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 m_shortStandAloneMonthLabels = shortMonthLabels(); 451 m_shortStandAloneMonthLabels = shortMonthLabels();
452 return m_shortStandAloneMonthLabels; 452 return m_shortStandAloneMonthLabels;
453 } 453 }
454 454
455 const Vector<String>& LocaleICU::timeAMPMLabels() { 455 const Vector<String>& LocaleICU::timeAMPMLabels() {
456 initializeDateTimeFormat(); 456 initializeDateTimeFormat();
457 return m_timeAMPMLabels; 457 return m_timeAMPMLabels;
458 } 458 }
459 459
460 } // namespace blink 460 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/network/HTTPParsersTest.cpp ('k') | third_party/WebKit/Source/platform/text/LocaleWin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698