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

Unified Diff: base/utf_string_conversions.cc

Issue 380007: Clean up recent string conversion function changes, part 1: Remove unnecessar... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | « base/utf_string_conversions.h ('k') | base/utf_string_conversions_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/utf_string_conversions.cc
===================================================================
--- base/utf_string_conversions.cc (revision 31509)
+++ base/utf_string_conversions.cc (working copy)
@@ -221,22 +221,16 @@
// UTF-8 <-> Wide --------------------------------------------------------------
-bool WideToUTF8AndAdjustOffset(const wchar_t* src,
- size_t src_len,
- std::string* output,
- size_t* offset_for_adjustment) {
+bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output) {
PrepareForUTF8Output(src, src_len, output);
- return ConvertUnicode<wchar_t, std::string>(src, src_len, output,
- offset_for_adjustment);
+ return ConvertUnicode<wchar_t, std::string>(src, src_len, output, NULL);
}
-std::string WideToUTF8AndAdjustOffset(const std::wstring& wide,
- size_t* offset_for_adjustment) {
+std::string WideToUTF8(const std::wstring& wide) {
std::string ret;
// Ignore the success flag of this call, it will do the best it can for
// invalid input, which is what we want here.
- WideToUTF8AndAdjustOffset(wide.data(), wide.length(), &ret,
- offset_for_adjustment);
+ WideToUTF8(wide.data(), wide.length(), &ret);
return ret;
}
@@ -262,20 +256,12 @@
#if defined(WCHAR_T_IS_UTF16)
// When wide == UTF-16, then conversions are a NOP.
-bool WideToUTF16AndAdjustOffset(const wchar_t* src,
- size_t src_len,
- string16* output,
- size_t* offset_for_adjustment) {
+bool WideToUTF16(const wchar_t* src, size_t src_len, string16* output) {
output->assign(src, src_len);
- if (offset_for_adjustment && (*offset_for_adjustment >= src_len))
- *offset_for_adjustment = string16::npos;
return true;
}
-string16 WideToUTF16AndAdjustOffset(const std::wstring& wide,
- size_t* offset_for_adjustment) {
- if (offset_for_adjustment && (*offset_for_adjustment >= wide.length()))
- *offset_for_adjustment = string16::npos;
+string16 WideToUTF16(const std::wstring& wide) {
return wide;
}
@@ -298,23 +284,17 @@
#elif defined(WCHAR_T_IS_UTF32)
-bool WideToUTF16AndAdjustOffset(const wchar_t* src,
- size_t src_len,
- string16* output,
- size_t* offset_for_adjustment) {
+bool WideToUTF16(const wchar_t* src, size_t src_len, string16* output) {
output->clear();
// Assume that normally we won't have any non-BMP characters so the counts
// will be the same.
output->reserve(src_len);
- return ConvertUnicode<wchar_t, string16>(src, src_len, output,
- offset_for_adjustment);
+ return ConvertUnicode<wchar_t, string16>(src, src_len, output, NULL);
}
-string16 WideToUTF16AndAdjustOffset(const std::wstring& wide,
- size_t* offset_for_adjustment) {
+string16 WideToUTF16(const std::wstring& wide) {
string16 ret;
- WideToUTF16AndAdjustOffset(wide.data(), wide.length(), &ret,
- offset_for_adjustment);
+ WideToUTF16(wide.data(), wide.length(), &ret);
return ret;
}
« no previous file with comments | « base/utf_string_conversions.h ('k') | base/utf_string_conversions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698