| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |