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

Side by Side Diff: base/file_util_win.cc

Issue 16950027: Move ComputeDirectorySize to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 6 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 | 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 "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/rand_util.h" 21 #include "base/rand_util.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/threading/thread_restrictions.h" 25 #include "base/threading/thread_restrictions.h"
26 #include "base/time.h" 26 #include "base/time.h"
27 #include "base/win/scoped_handle.h" 27 #include "base/win/scoped_handle.h"
28 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
29 29
30 using base::FilePath; 30 using base::FilePath;
31 using base::g_bug108724_debug;
31 32
32 namespace base { 33 namespace base {
33 34
34 FilePath MakeAbsoluteFilePath(const FilePath& input) { 35 FilePath MakeAbsoluteFilePath(const FilePath& input) {
35 base::ThreadRestrictions::AssertIOAllowed(); 36 base::ThreadRestrictions::AssertIOAllowed();
36 wchar_t file_path[MAX_PATH]; 37 wchar_t file_path[MAX_PATH];
37 if (!_wfullpath(file_path, input.value().c_str(), MAX_PATH)) 38 if (!_wfullpath(file_path, input.value().c_str(), MAX_PATH))
38 return FilePath(); 39 return FilePath();
39 return FilePath(file_path); 40 return FilePath(file_path);
40 } 41 }
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 732
732 // Length of |path| with path separator appended. 733 // Length of |path| with path separator appended.
733 size_t prefix = path.StripTrailingSeparators().value().size() + 1; 734 size_t prefix = path.StripTrailingSeparators().value().size() + 1;
734 // The whole path string must be shorter than MAX_PATH. That is, it must be 735 // The whole path string must be shorter than MAX_PATH. That is, it must be
735 // prefix + component_length < MAX_PATH (or equivalently, <= MAX_PATH - 1). 736 // prefix + component_length < MAX_PATH (or equivalently, <= MAX_PATH - 1).
736 int whole_path_limit = std::max(0, MAX_PATH - 1 - static_cast<int>(prefix)); 737 int whole_path_limit = std::max(0, MAX_PATH - 1 - static_cast<int>(prefix));
737 return std::min(whole_path_limit, static_cast<int>(max_length)); 738 return std::min(whole_path_limit, static_cast<int>(max_length));
738 } 739 }
739 740
740 } // namespace file_util 741 } // namespace file_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698