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

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

Issue 1542323002: Switch to standard integer types in base/i18n/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: header Created 5 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
« no previous file with comments | « base/i18n/char_iterator.h ('k') | base/i18n/file_util_icu_unittest.cc » ('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 // 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 <stdint.h>
10
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/i18n/icu_string_conversions.h" 12 #include "base/i18n/icu_string_conversions.h"
11 #include "base/i18n/string_compare.h" 13 #include "base/i18n/string_compare.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
15 #include "base/strings/string_util.h" 18 #include "base/strings/string_util.h"
16 #include "base/strings/sys_string_conversions.h" 19 #include "base/strings/sys_string_conversions.h"
17 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
18 #include "build/build_config.h" 21 #include "build/build_config.h"
19 #include "third_party/icu/source/common/unicode/uniset.h" 22 #include "third_party/icu/source/common/unicode/uniset.h"
20 #include "third_party/icu/source/i18n/unicode/coll.h" 23 #include "third_party/icu/source/i18n/unicode/coll.h"
21 24
22 namespace base { 25 namespace base {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name, 106 void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
104 char replace_char) { 107 char replace_char) {
105 IllegalCharacters* illegal = IllegalCharacters::GetInstance(); 108 IllegalCharacters* illegal = IllegalCharacters::GetInstance();
106 109
107 DCHECK(!(illegal->DisallowedEverywhere(replace_char))); 110 DCHECK(!(illegal->DisallowedEverywhere(replace_char)));
108 DCHECK(!(illegal->DisallowedLeadingOrTrailing(replace_char))); 111 DCHECK(!(illegal->DisallowedLeadingOrTrailing(replace_char)));
109 112
110 int cursor = 0; // The ICU macros expect an int. 113 int cursor = 0; // The ICU macros expect an int.
111 while (cursor < static_cast<int>(file_name->size())) { 114 while (cursor < static_cast<int>(file_name->size())) {
112 int char_begin = cursor; 115 int char_begin = cursor;
113 uint32 code_point; 116 uint32_t code_point;
114 #if defined(OS_MACOSX) 117 #if defined(OS_MACOSX)
115 // Mac uses UTF-8 encoding for filenames. 118 // Mac uses UTF-8 encoding for filenames.
116 U8_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()), 119 U8_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()),
117 code_point); 120 code_point);
118 #elif defined(OS_WIN) 121 #elif defined(OS_WIN)
119 // Windows uses UTF-16 encoding for filenames. 122 // Windows uses UTF-16 encoding for filenames.
120 U16_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()), 123 U16_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()),
121 code_point); 124 code_point);
122 #elif defined(OS_POSIX) 125 #elif defined(OS_POSIX)
123 // Linux doesn't actually define an encoding. It basically allows anything 126 // Linux doesn't actually define an encoding. It basically allows anything
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (ConvertToUtf8AndNormalize(file_name->BaseName().value(), 175 if (ConvertToUtf8AndNormalize(file_name->BaseName().value(),
173 kCodepageUTF8, 176 kCodepageUTF8,
174 &normalized_str)) { 177 &normalized_str)) {
175 *file_name = file_name->DirName().Append(FilePath(normalized_str)); 178 *file_name = file_name->DirName().Append(FilePath(normalized_str));
176 } 179 }
177 #endif 180 #endif
178 } 181 }
179 182
180 } // namespace i18n 183 } // namespace i18n
181 } // namespace base 184 } // namespace base
OLDNEW
« no previous file with comments | « base/i18n/char_iterator.h ('k') | base/i18n/file_util_icu_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698