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

Unified Diff: content/renderer/date_time_formatter.cc

Issue 12224065: Fix chromium webview build break (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/date_time_formatter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/date_time_formatter.cc
diff --git a/content/renderer/date_time_formatter.cc b/content/renderer/date_time_formatter.cc
index eca5b9773e8bcf2deb35f041d3c4472bd3c00cee..9218f8e905135f182e7fb68b22359ca4702c4676 100644
--- a/content/renderer/date_time_formatter.cc
+++ b/content/renderer/date_time_formatter.cc
@@ -5,6 +5,7 @@
#include "content/renderer/date_time_formatter.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDateTimeChooserParams.h"
#include "third_party/icu/public/i18n/unicode/smpdtfmt.h"
@@ -52,8 +53,6 @@ DateTimeFormatter::DateTimeFormatter(
pattern_ = type_ > 0 && type_ <= ui::TEXT_INPUT_TYPE_MAX ?
&patterns_[type_] : &patterns_[ui::TEXT_INPUT_TYPE_NONE];
- std::string patt;
- pattern_->toUTF8String(patt);
formatted_string_ = FormatString();
}
@@ -107,7 +106,8 @@ const std::string DateTimeFormatter::FormatString() const {
icu::SimpleDateFormat formatter(*pattern_, success);
icu::UnicodeString formattedTime;
formatter.format(time, formattedTime, success);
- formattedTime.toUTF8String(result);
+ result = UTF16ToUTF8(string16(formattedTime.getBuffer(),
Miguel Garcia 2013/02/08 10:09:18 Can you add a comment on why we need to convert to
benm (inactive) 2013/02/08 10:22:08 I guess we can mitigate this perf impact with an i
+ static_cast<size_t>(formattedTime.length())));
if (success <= U_ZERO_ERROR)
return result;
}
@@ -162,7 +162,7 @@ bool DateTimeFormatter::ParseValues() {
UErrorCode success = U_ZERO_ERROR;
icu::UnicodeString icu_value =
- icu::UnicodeString::fromUTF8(formatted_string_);
+ icu::UnicodeString::fromUTF8(formatted_string_.c_str());
if (type_ > 0 && type_ <= ui::TEXT_INPUT_TYPE_MAX) {
const icu::UnicodeString pattern = patterns_[type_];
icu::SimpleDateFormat formatter(pattern, success);
« no previous file with comments | « content/renderer/date_time_formatter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698