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

Side by Side Diff: net/disk_cache/simple/simple_util.cc

Issue 1255073002: clang/win: Fix most -Wunused-function warnings in Chromium code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac Created 5 years, 5 months 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/disk_cache/simple/simple_util.h" 5 #include "net/disk_cache/simple/simple_util.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
13 #include "base/sha1.h" 13 #include "base/sha1.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/threading/thread_restrictions.h" 16 #include "base/threading/thread_restrictions.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "net/disk_cache/simple/simple_entry_format.h" 18 #include "net/disk_cache/simple/simple_entry_format.h"
19 19
20 namespace { 20 namespace {
21 21
22 // Size of the uint64 hash_key number in Hex format in a string. 22 // Size of the uint64 hash_key number in Hex format in a string.
23 const size_t kEntryHashKeyAsHexStringSize = 2 * sizeof(uint64); 23 const size_t kEntryHashKeyAsHexStringSize = 2 * sizeof(uint64);
24 24
25 #if defined(OS_POSIX)
25 // TODO(clamy, gavinp): this should go in base 26 // TODO(clamy, gavinp): this should go in base
26 bool GetNanoSecsFromStat(const struct stat& st, 27 bool GetNanoSecsFromStat(const struct stat& st,
27 time_t* out_sec, 28 time_t* out_sec,
28 long* out_nsec) { 29 long* out_nsec) {
29 #if defined(OS_ANDROID) 30 #if defined(OS_ANDROID)
30 *out_sec = st.st_mtime; 31 *out_sec = st.st_mtime;
31 *out_nsec = st.st_mtime_nsec; 32 *out_nsec = st.st_mtime_nsec;
32 return true; 33 return true;
33 #elif defined(OS_LINUX) 34 #elif defined(OS_LINUX)
34 *out_sec = st.st_mtim.tv_sec; 35 *out_sec = st.st_mtim.tv_sec;
35 *out_nsec = st.st_mtim.tv_nsec; 36 *out_nsec = st.st_mtim.tv_nsec;
36 return true; 37 return true;
37 #elif defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_BSD) 38 #elif defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_BSD)
38 *out_sec = st.st_mtimespec.tv_sec; 39 *out_sec = st.st_mtimespec.tv_sec;
39 *out_nsec = st.st_mtimespec.tv_nsec; 40 *out_nsec = st.st_mtimespec.tv_nsec;
40 return true; 41 return true;
41 #else 42 #else
42 return false; 43 return false;
43 #endif 44 #endif
44 } 45 }
46 #endif // defined(OS_POSIX)
45 47
46 } // namespace 48 } // namespace
47 49
48 namespace disk_cache { 50 namespace disk_cache {
49 51
50 namespace simple_util { 52 namespace simple_util {
51 53
52 std::string ConvertEntryHashKeyToHexString(uint64 hash_key) { 54 std::string ConvertEntryHashKeyToHexString(uint64 hash_key) {
53 const std::string hash_key_str = base::StringPrintf("%016" PRIx64, hash_key); 55 const std::string hash_key_str = base::StringPrintf("%016" PRIx64, hash_key);
54 DCHECK_EQ(kEntryHashKeyAsHexStringSize, hash_key_str.size()); 56 DCHECK_EQ(kEntryHashKeyAsHexStringSize, hash_key_str.size());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 base::File::Info file_info; 132 base::File::Info file_info;
131 if (!base::GetFileInfo(path, &file_info)) 133 if (!base::GetFileInfo(path, &file_info))
132 return false; 134 return false;
133 *out_mtime = file_info.last_modified; 135 *out_mtime = file_info.last_modified;
134 return true; 136 return true;
135 } 137 }
136 138
137 } // namespace simple_backend 139 } // namespace simple_backend
138 140
139 } // namespace disk_cache 141 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698