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

Side by Side Diff: base/strings/utf_string_conversion_utils.cc

Issue 1997153002: libchrome: Several upstreamable fixes from libchrome Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Addressed feedback Created 4 years, 7 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 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/strings/utf_string_conversion_utils.h" 5 #include "base/strings/utf_string_conversion_utils.h"
6 6
7 #include "base/third_party/icu/icu_utf.h" 7 #include "base/third_party/icu/icu_utf.h"
8 8
9 namespace base { 9 namespace base {
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } else { 48 } else {
49 // Not a surrogate, just one 16-bit word. 49 // Not a surrogate, just one 16-bit word.
50 *code_point = src[*char_index]; 50 *code_point = src[*char_index];
51 } 51 }
52 52
53 return IsValidCodepoint(*code_point); 53 return IsValidCodepoint(*code_point);
54 } 54 }
55 55
56 #if defined(WCHAR_T_IS_UTF32) 56 #if defined(WCHAR_T_IS_UTF32)
57 bool ReadUnicodeCharacter(const wchar_t* src, 57 bool ReadUnicodeCharacter(const wchar_t* src,
58 int32_t src_len, 58 int32_t /*src_len*/,
59 int32_t* char_index, 59 int32_t* char_index,
60 uint32_t* code_point) { 60 uint32_t* code_point) {
61 // Conversion is easy since the source is 32-bit. 61 // Conversion is easy since the source is 32-bit.
62 *code_point = src[*char_index]; 62 *code_point = src[*char_index];
63 63
64 // Validate the value. 64 // Validate the value.
65 return IsValidCodepoint(*code_point); 65 return IsValidCodepoint(*code_point);
66 } 66 }
67 #endif // defined(WCHAR_T_IS_UTF32) 67 #endif // defined(WCHAR_T_IS_UTF32)
68 68
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // character. 139 // character.
140 output->reserve(src_len / 2); 140 output->reserve(src_len / 2);
141 } 141 }
142 } 142 }
143 143
144 // Instantiate versions we know callers will need. 144 // Instantiate versions we know callers will need.
145 template void PrepareForUTF16Or32Output(const char*, size_t, std::wstring*); 145 template void PrepareForUTF16Or32Output(const char*, size_t, std::wstring*);
146 template void PrepareForUTF16Or32Output(const char*, size_t, string16*); 146 template void PrepareForUTF16Or32Output(const char*, size_t, string16*);
147 147
148 } // namespace base 148 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698