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

Side by Side Diff: chrome/browser/safe_browsing/prefix_set.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 #include "chrome/browser/safe_browsing/prefix_set.h" 5 #include "chrome/browser/safe_browsing/prefix_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 for (size_t di = index_[ii].second; di < deltas_end; ++di) { 147 for (size_t di = index_[ii].second; di < deltas_end; ++di) {
148 current += deltas_[di]; 148 current += deltas_[di];
149 prefixes->push_back(current); 149 prefixes->push_back(current);
150 } 150 }
151 } 151 }
152 } 152 }
153 153
154 // static 154 // static
155 PrefixSet* PrefixSet::LoadFile(const base::FilePath& filter_name) { 155 PrefixSet* PrefixSet::LoadFile(const base::FilePath& filter_name) {
156 int64 size_64; 156 int64 size_64;
157 if (!file_util::GetFileSize(filter_name, &size_64)) 157 if (!base::GetFileSize(filter_name, &size_64))
158 return NULL; 158 return NULL;
159 using base::MD5Digest; 159 using base::MD5Digest;
160 if (size_64 < static_cast<int64>(sizeof(FileHeader) + sizeof(MD5Digest))) 160 if (size_64 < static_cast<int64>(sizeof(FileHeader) + sizeof(MD5Digest)))
161 return NULL; 161 return NULL;
162 162
163 file_util::ScopedFILE file(file_util::OpenFile(filter_name, "rb")); 163 file_util::ScopedFILE file(file_util::OpenFile(filter_name, "rb"));
164 if (!file.get()) 164 if (!file.get())
165 return NULL; 165 return NULL;
166 166
167 FileHeader header; 167 FileHeader header;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (written != 1) 290 if (written != 1)
291 return false; 291 return false;
292 292
293 // TODO(shess): Can this code check that the close was successful? 293 // TODO(shess): Can this code check that the close was successful?
294 file.reset(); 294 file.reset();
295 295
296 return true; 296 return true;
297 } 297 }
298 298
299 } // namespace safe_browsing 299 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/profiles/file_path_verifier_win.cc ('k') | chrome/browser/safe_browsing/prefix_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698