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

Side by Side Diff: base/string16.cc

Issue 7741018: Remove some unneeded reinterpret_casts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/threading/thread_local.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) 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/string16.h" 5 #include "base/string16.h"
6 6
7 #if defined(WCHAR_T_IS_UTF16) 7 #if defined(WCHAR_T_IS_UTF16)
8 8
9 #error This file should not be used on 2-byte wchar_t systems 9 #error This file should not be used on 2-byte wchar_t systems
10 // If this winds up being needed on 2-byte wchar_t systems, either the 10 // If this winds up being needed on 2-byte wchar_t systems, either the
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 while (n-- > 0) { 44 while (n-- > 0) {
45 if (*s == c) { 45 if (*s == c) {
46 return s; 46 return s;
47 } 47 }
48 ++s; 48 ++s;
49 } 49 }
50 return 0; 50 return 0;
51 } 51 }
52 52
53 char16* c16memmove(char16* s1, const char16* s2, size_t n) { 53 char16* c16memmove(char16* s1, const char16* s2, size_t n) {
54 return reinterpret_cast<char16*>(memmove(s1, s2, n * sizeof(char16))); 54 return static_cast<char16*>(memmove(s1, s2, n * sizeof(char16)));
55 } 55 }
56 56
57 char16* c16memcpy(char16* s1, const char16* s2, size_t n) { 57 char16* c16memcpy(char16* s1, const char16* s2, size_t n) {
58 return reinterpret_cast<char16*>(memcpy(s1, s2, n * sizeof(char16))); 58 return static_cast<char16*>(memcpy(s1, s2, n * sizeof(char16)));
59 } 59 }
60 60
61 char16* c16memset(char16* s, char16 c, size_t n) { 61 char16* c16memset(char16* s, char16 c, size_t n) {
62 char16 *s_orig = s; 62 char16 *s_orig = s;
63 while (n-- > 0) { 63 while (n-- > 0) {
64 *s = c; 64 *s = c;
65 ++s; 65 ++s;
66 } 66 }
67 return s_orig; 67 return s_orig;
68 } 68 }
69 69
70 } // namespace base 70 } // namespace base
71 71
72 template class std::basic_string<char16, base::string16_char_traits>; 72 template class std::basic_string<char16, base::string16_char_traits>;
73 73
74 namespace base { 74 namespace base {
75 std::ostream& operator<<(std::ostream& out, const string16& str) { 75 std::ostream& operator<<(std::ostream& out, const string16& str) {
76 return out << UTF16ToUTF8(str); 76 return out << UTF16ToUTF8(str);
77 } 77 }
78 } 78 }
79 79
80 #endif // WCHAR_T_IS_UTF32 80 #endif // WCHAR_T_IS_UTF32
OLDNEW
« no previous file with comments | « no previous file | base/threading/thread_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698