| OLD | NEW |
| 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 #include "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 | 1256 |
| 1257 return HFSFastUnicodeCompare(hfs1, hfs2); | 1257 return HFSFastUnicodeCompare(hfs1, hfs2); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 #else // << WIN. MACOSX | other (POSIX) >> | 1260 #else // << WIN. MACOSX | other (POSIX) >> |
| 1261 | 1261 |
| 1262 // Generic (POSIX) implementation of file string comparison. | 1262 // Generic (POSIX) implementation of file string comparison. |
| 1263 // TODO(rolandsteiner) check if this is sufficient/correct. | 1263 // TODO(rolandsteiner) check if this is sufficient/correct. |
| 1264 int FilePath::CompareIgnoreCase(StringPieceType string1, | 1264 int FilePath::CompareIgnoreCase(StringPieceType string1, |
| 1265 StringPieceType string2) { | 1265 StringPieceType string2) { |
| 1266 int comparison = strcasecmp(string1.data(), string2.data()); | 1266 return CompareCaseInsensitiveASCII(string1, string2); |
| 1267 if (comparison < 0) | |
| 1268 return -1; | |
| 1269 if (comparison > 0) | |
| 1270 return 1; | |
| 1271 return 0; | |
| 1272 } | 1267 } |
| 1273 | 1268 |
| 1274 #endif // OS versions of CompareIgnoreCase() | 1269 #endif // OS versions of CompareIgnoreCase() |
| 1275 | 1270 |
| 1276 | 1271 |
| 1277 void FilePath::StripTrailingSeparatorsInternal() { | 1272 void FilePath::StripTrailingSeparatorsInternal() { |
| 1278 // If there is no drive letter, start will be 1, which will prevent stripping | 1273 // If there is no drive letter, start will be 1, which will prevent stripping |
| 1279 // the leading separator if there is only one separator. If there is a drive | 1274 // the leading separator if there is only one separator. If there is a drive |
| 1280 // letter, start will be set appropriately to prevent stripping the first | 1275 // letter, start will be set appropriately to prevent stripping the first |
| 1281 // separator following the drive letter, if a separator immediately follows | 1276 // separator following the drive letter, if a separator immediately follows |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 #endif | 1309 #endif |
| 1315 } | 1310 } |
| 1316 | 1311 |
| 1317 #if defined(OS_ANDROID) | 1312 #if defined(OS_ANDROID) |
| 1318 bool FilePath::IsContentUri() const { | 1313 bool FilePath::IsContentUri() const { |
| 1319 return StartsWithASCII(path_, "content://", false /*case_sensitive*/); | 1314 return StartsWithASCII(path_, "content://", false /*case_sensitive*/); |
| 1320 } | 1315 } |
| 1321 #endif | 1316 #endif |
| 1322 | 1317 |
| 1323 } // namespace base | 1318 } // namespace base |
| OLD | NEW |