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> |
11 #include <libgen.h> | 11 #include <libgen.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
13 #include <string.h> | 13 #include <string.h> |
14 #include <sys/errno.h> | 14 #include <sys/errno.h> |
15 #include <sys/mman.h> | 15 #include <sys/mman.h> |
16 #include <sys/stat.h> | 16 #include <sys/stat.h> |
17 #include <sys/types.h> | 17 #include <sys/types.h> |
18 #include <time.h> | 18 #include <time.h> |
19 #include <unistd.h> | 19 #include <unistd.h> |
20 | 20 |
| 21 #if defined(OS_MACOSX) |
| 22 #include <AvailabilityMacros.h> |
| 23 #endif |
| 24 |
21 #include <fstream> | 25 #include <fstream> |
22 | 26 |
23 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
24 #include "base/eintr_wrapper.h" | 28 #include "base/eintr_wrapper.h" |
25 #include "base/file_path.h" | 29 #include "base/file_path.h" |
26 #include "base/lock.h" | 30 #include "base/lock.h" |
27 #include "base/logging.h" | 31 #include "base/logging.h" |
28 #include "base/scoped_ptr.h" | 32 #include "base/scoped_ptr.h" |
29 #include "base/singleton.h" | 33 #include "base/singleton.h" |
30 #include "base/string_util.h" | 34 #include "base/string_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 Lock lock_; | 80 Lock lock_; |
77 friend struct DefaultSingletonTraits<LocaleAwareComparator>; | 81 friend struct DefaultSingletonTraits<LocaleAwareComparator>; |
78 | 82 |
79 DISALLOW_COPY_AND_ASSIGN(LocaleAwareComparator); | 83 DISALLOW_COPY_AND_ASSIGN(LocaleAwareComparator); |
80 }; | 84 }; |
81 | 85 |
82 } // namespace | 86 } // namespace |
83 | 87 |
84 namespace file_util { | 88 namespace file_util { |
85 | 89 |
86 #if defined(OS_FREEBSD) || defined(SUPPORT_MACOSX_10_4) | 90 #if defined(OS_FREEBSD) || \ |
| 91 (defined(OS_MACOSX) && \ |
| 92 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) |
87 typedef struct stat stat_wrapper_t; | 93 typedef struct stat stat_wrapper_t; |
88 static int CallStat(const char *path, stat_wrapper_t *sb) { | 94 static int CallStat(const char *path, stat_wrapper_t *sb) { |
89 return stat(path, sb); | 95 return stat(path, sb); |
90 } | 96 } |
91 #else | 97 #else |
92 typedef struct stat64 stat_wrapper_t; | 98 typedef struct stat64 stat_wrapper_t; |
93 static int CallStat(const char *path, stat_wrapper_t *sb) { | 99 static int CallStat(const char *path, stat_wrapper_t *sb) { |
94 return stat64(path, sb); | 100 return stat64(path, sb); |
95 } | 101 } |
96 #endif | 102 #endif |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 munmap(data_, length_); | 744 munmap(data_, length_); |
739 if (file_ != -1) | 745 if (file_ != -1) |
740 close(file_); | 746 close(file_); |
741 | 747 |
742 data_ = NULL; | 748 data_ = NULL; |
743 length_ = 0; | 749 length_ = 0; |
744 file_ = -1; | 750 file_ = -1; |
745 } | 751 } |
746 | 752 |
747 } // namespace file_util | 753 } // namespace file_util |
OLD | NEW |