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

Side by Side Diff: base/i18n/icu_string_conversions.cc

Issue 109863003: Use StringPiece for UTF string conversions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « base/android/jni_string.cc ('k') | base/strings/utf_string_conversions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/i18n/icu_string_conversions.h" 5 #include "base/i18n/icu_string_conversions.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 size_t max_length = utf16.length() + 1; 278 size_t max_length = utf16.length() + 1;
279 string16 normalized_utf16; 279 string16 normalized_utf16;
280 scoped_ptr<char16[]> buffer(new char16[max_length]); 280 scoped_ptr<char16[]> buffer(new char16[max_length]);
281 int actual_length = unorm_normalize( 281 int actual_length = unorm_normalize(
282 utf16.c_str(), utf16.length(), UNORM_NFC, 0, 282 utf16.c_str(), utf16.length(), UNORM_NFC, 0,
283 buffer.get(), static_cast<int>(max_length), &status); 283 buffer.get(), static_cast<int>(max_length), &status);
284 if (!U_SUCCESS(status)) 284 if (!U_SUCCESS(status))
285 return false; 285 return false;
286 normalized_utf16.assign(buffer.get(), actual_length); 286 normalized_utf16.assign(buffer.get(), actual_length);
287 287
288 return UTF16ToUTF8(normalized_utf16.data(), 288 return UTF16ToUTF8(normalized_utf16, result);
289 normalized_utf16.length(), result);
290 } 289 }
291 290
292 } // namespace base 291 } // namespace base
OLDNEW
« no previous file with comments | « base/android/jni_string.cc ('k') | base/strings/utf_string_conversions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698