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

Unified Diff: Source/core/platform/text/LocaleICU.cpp

Issue 20002008: Don't use Vector<UChar> to build strings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix unit test Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/graphics/Color.cpp ('k') | Source/wtf/text/StringBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/text/LocaleICU.cpp
diff --git a/Source/core/platform/text/LocaleICU.cpp b/Source/core/platform/text/LocaleICU.cpp
index a0f05dd2d3fc9784e212f7fce9b04b87a4c5b0c8..e94fed94b72368a82d642622a03d34160dc46b0e 100644
--- a/Source/core/platform/text/LocaleICU.cpp
+++ b/Source/core/platform/text/LocaleICU.cpp
@@ -36,6 +36,7 @@
#include <limits>
#include "wtf/DateMath.h"
#include "wtf/PassOwnPtr.h"
+#include "wtf/text/StringBuffer.h"
#include "wtf/text/StringBuilder.h"
using namespace icu;
@@ -83,9 +84,9 @@ String LocaleICU::decimalSymbol(UNumberFormatSymbol symbol)
ASSERT(U_SUCCESS(status) || status == U_BUFFER_OVERFLOW_ERROR);
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
return String();
- Vector<UChar> buffer(bufferLength);
+ StringBuffer<UChar> buffer(bufferLength);
status = U_ZERO_ERROR;
- unum_getSymbol(m_numberFormat, symbol, buffer.data(), bufferLength, &status);
+ unum_getSymbol(m_numberFormat, symbol, buffer.characters(), bufferLength, &status);
if (U_FAILURE(status))
return String();
return String::adopt(buffer);
@@ -98,9 +99,9 @@ String LocaleICU::decimalTextAttribute(UNumberFormatTextAttribute tag)
ASSERT(U_SUCCESS(status) || status == U_BUFFER_OVERFLOW_ERROR);
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
return String();
- Vector<UChar> buffer(bufferLength);
+ StringBuffer<UChar> buffer(bufferLength);
status = U_ZERO_ERROR;
- unum_getTextAttribute(m_numberFormat, tag, buffer.data(), bufferLength, &status);
+ unum_getTextAttribute(m_numberFormat, tag, buffer.characters(), bufferLength, &status);
ASSERT(U_SUCCESS(status));
if (U_FAILURE(status))
return String();
@@ -159,9 +160,9 @@ static String getDateFormatPattern(const UDateFormat* dateFormat)
int32_t length = udat_toPattern(dateFormat, TRUE, 0, 0, &status);
if (status != U_BUFFER_OVERFLOW_ERROR || !length)
return emptyString();
- Vector<UChar> buffer(length);
+ StringBuffer<UChar> buffer(length);
status = U_ZERO_ERROR;
- udat_toPattern(dateFormat, TRUE, buffer.data(), length, &status);
+ udat_toPattern(dateFormat, TRUE, buffer.characters(), length, &status);
if (U_FAILURE(status))
return emptyString();
return String::adopt(buffer);
@@ -181,9 +182,9 @@ PassOwnPtr<Vector<String> > LocaleICU::createLabelVector(const UDateFormat* date
int32_t length = udat_getSymbols(dateFormat, type, startIndex + i, 0, 0, &status);
if (status != U_BUFFER_OVERFLOW_ERROR)
return PassOwnPtr<Vector<String> >();
- Vector<UChar> buffer(length);
+ StringBuffer<UChar> buffer(length);
status = U_ZERO_ERROR;
- udat_getSymbols(dateFormat, type, startIndex + i, buffer.data(), length, &status);
+ udat_getSymbols(dateFormat, type, startIndex + i, buffer.characters(), length, &status);
if (U_FAILURE(status))
return PassOwnPtr<Vector<String> >();
labels->append(String::adopt(buffer));
@@ -327,9 +328,9 @@ static String getFormatForSkeleton(const char* locale, const String& skeleton)
skeleton.appendTo(skeletonCharacters);
int32_t length = udatpg_getBestPattern(patternGenerator, skeletonCharacters.data(), skeletonCharacters.size(), 0, 0, &status);
if (status == U_BUFFER_OVERFLOW_ERROR && length) {
- Vector<UChar> buffer(length);
+ StringBuffer<UChar> buffer(length);
status = U_ZERO_ERROR;
- udatpg_getBestPattern(patternGenerator, skeletonCharacters.data(), skeletonCharacters.size(), buffer.data(), length, &status);
+ udatpg_getBestPattern(patternGenerator, skeletonCharacters.data(), skeletonCharacters.size(), buffer.characters(), length, &status);
if (U_SUCCESS(status))
format = String::adopt(buffer);
}
« no previous file with comments | « Source/core/platform/graphics/Color.cpp ('k') | Source/wtf/text/StringBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698