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

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

Issue 495002: Changes to base/ from a combination of FreeBSD and OpenBSD patches. (Closed)
Patch Set: minor tweaks Created 11 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
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 // File utilities that use the ICU library go in this file. 5 // File utilities that use the ICU library go in this file.
6 6
7 #include "base/i18n/file_util_icu.h" 7 #include "base/i18n/file_util_icu.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 int char_begin = cursor; 139 int char_begin = cursor;
140 uint32 code_point; 140 uint32 code_point;
141 #if defined(OS_MACOSX) 141 #if defined(OS_MACOSX)
142 // Mac uses UTF-8 encoding for filenames. 142 // Mac uses UTF-8 encoding for filenames.
143 U8_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()), 143 U8_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()),
144 code_point); 144 code_point);
145 #elif defined(OS_WIN) 145 #elif defined(OS_WIN)
146 // Windows uses UTF-16 encoding for filenames. 146 // Windows uses UTF-16 encoding for filenames.
147 U16_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()), 147 U16_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()),
148 code_point); 148 code_point);
149 #elif defined(OS_LINUX) 149 #elif defined(OS_POSIX)
150 // Linux doesn't actually define an encoding. It basically allows anything 150 // Linux doesn't actually define an encoding. It basically allows anything
151 // except for a few special ASCII characters. 151 // except for a few special ASCII characters.
152 unsigned char cur_char = static_cast<unsigned char>((*file_name)[cursor++]); 152 unsigned char cur_char = static_cast<unsigned char>((*file_name)[cursor++]);
153 if (cur_char >= 0x80) 153 if (cur_char >= 0x80)
154 continue; 154 continue;
155 code_point = cur_char; 155 code_point = cur_char;
156 #else 156 #else
157 NOTREACHED(); 157 NOTREACHED();
158 #endif 158 #endif
159 159
(...skipping 21 matching lines...) Expand all
181 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16? 181 // TODO(yuzo): Perhaps we should define SysNativeMBToUTF16?
182 return Singleton<LocaleAwareComparator>()->Compare( 182 return Singleton<LocaleAwareComparator>()->Compare(
183 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())), 183 WideToUTF16(base::SysNativeMBToWide(a.value().c_str())),
184 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0; 184 WideToUTF16(base::SysNativeMBToWide(b.value().c_str()))) < 0;
185 #else 185 #else
186 #error Not implemented on your system 186 #error Not implemented on your system
187 #endif 187 #endif
188 } 188 }
189 189
190 } // namespace 190 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698