OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/file_util.h" | 5 #include "base/file_util.h" |
6 | 6 |
7 #include <dirent.h> | 7 #include <dirent.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <fnmatch.h> | 10 #include <fnmatch.h> |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "base/file_path.h" | 25 #include "base/file_path.h" |
26 #include "base/lock.h" | 26 #include "base/lock.h" |
27 #include "base/logging.h" | 27 #include "base/logging.h" |
28 #include "base/scoped_ptr.h" | 28 #include "base/scoped_ptr.h" |
29 #include "base/singleton.h" | 29 #include "base/singleton.h" |
30 #include "base/string_util.h" | 30 #include "base/string_util.h" |
31 #include "base/sys_string_conversions.h" | 31 #include "base/sys_string_conversions.h" |
32 #include "base/time.h" | 32 #include "base/time.h" |
33 #include "unicode/coll.h" | 33 #include "unicode/coll.h" |
34 | 34 |
| 35 |
35 namespace { | 36 namespace { |
36 | 37 |
37 class LocaleAwareComparator { | 38 class LocaleAwareComparator { |
38 public: | 39 public: |
39 LocaleAwareComparator() { | 40 LocaleAwareComparator() { |
40 UErrorCode error_code = U_ZERO_ERROR; | 41 UErrorCode error_code = U_ZERO_ERROR; |
41 // Use the default collator. The default locale should have been properly | 42 // Use the default collator. The default locale should have been properly |
42 // set by the time this constructor is called. | 43 // set by the time this constructor is called. |
43 collator_.reset(icu::Collator::createInstance(error_code)); | 44 collator_.reset(icu::Collator::createInstance(error_code)); |
44 DCHECK(U_SUCCESS(error_code)); | 45 DCHECK(U_SUCCESS(error_code)); |
(...skipping 30 matching lines...) Expand all Loading... |
75 Lock lock_; | 76 Lock lock_; |
76 friend struct DefaultSingletonTraits<LocaleAwareComparator>; | 77 friend struct DefaultSingletonTraits<LocaleAwareComparator>; |
77 | 78 |
78 DISALLOW_COPY_AND_ASSIGN(LocaleAwareComparator); | 79 DISALLOW_COPY_AND_ASSIGN(LocaleAwareComparator); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace | 82 } // namespace |
82 | 83 |
83 namespace file_util { | 84 namespace file_util { |
84 | 85 |
85 #if defined(OS_FREEBSD) | 86 #if defined(OS_FREEBSD) || defined(SUPPORT_MACOSX_10_4) |
86 typedef struct stat stat_wrapper_t; | 87 typedef struct stat stat_wrapper_t; |
87 static int CallStat(const char *path, stat_wrapper_t *sb) { | 88 static int CallStat(const char *path, stat_wrapper_t *sb) { |
88 return stat(path, sb); | 89 return stat(path, sb); |
89 } | 90 } |
90 #else | 91 #else |
91 typedef struct stat64 stat_wrapper_t; | 92 typedef struct stat64 stat_wrapper_t; |
92 static int CallStat(const char *path, stat_wrapper_t *sb) { | 93 static int CallStat(const char *path, stat_wrapper_t *sb) { |
93 return stat64(path, sb); | 94 return stat64(path, sb); |
94 } | 95 } |
95 #endif | 96 #endif |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 munmap(data_, length_); | 735 munmap(data_, length_); |
735 if (file_ != -1) | 736 if (file_ != -1) |
736 close(file_); | 737 close(file_); |
737 | 738 |
738 data_ = NULL; | 739 data_ = NULL; |
739 length_ = 0; | 740 length_ = 0; |
740 file_ = -1; | 741 file_ = -1; |
741 } | 742 } |
742 | 743 |
743 } // namespace file_util | 744 } // namespace file_util |
OLD | NEW |