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

Side by Side Diff: base/files/file_util.h

Issue 1719983005: base: Stop overloading ReadFileToString() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix errors Created 4 years, 10 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
« no previous file with comments | « android_webview/browser/aw_metrics_service_client.cc ('k') | base/files/file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file contains utility functions for dealing with the local 5 // This file contains utility functions for dealing with the local
6 // filesystem. 6 // filesystem.
7 7
8 #ifndef BASE_FILES_FILE_UTIL_H_ 8 #ifndef BASE_FILES_FILE_UTIL_H_
9 #define BASE_FILES_FILE_UTIL_H_ 9 #define BASE_FILES_FILE_UTIL_H_
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 // Reads the file at |path| into |contents| and returns true on success and 148 // Reads the file at |path| into |contents| and returns true on success and
149 // false on error. For security reasons, a |path| containing path traversal 149 // false on error. For security reasons, a |path| containing path traversal
150 // components ('..') is treated as a read error and |contents| is set to empty. 150 // components ('..') is treated as a read error and |contents| is set to empty.
151 // In case of I/O error, |contents| holds the data that could be read from the 151 // In case of I/O error, |contents| holds the data that could be read from the
152 // file before the error occurred. When the file size exceeds |max_size|, the 152 // file before the error occurred. When the file size exceeds |max_size|, the
153 // function returns false with |contents| holding the file truncated to 153 // function returns false with |contents| holding the file truncated to
154 // |max_size|. 154 // |max_size|.
155 // |contents| may be NULL, in which case this function is useful for its side 155 // |contents| may be NULL, in which case this function is useful for its side
156 // effect of priming the disk cache (could be used for unit tests). 156 // effect of priming the disk cache (could be used for unit tests).
157 BASE_EXPORT bool ReadFileToString(const FilePath& path, 157 BASE_EXPORT bool ReadFileToStringWithMaxSize(const FilePath& path,
158 std::string* contents, 158 std::string* contents,
159 size_t max_size); 159 size_t max_size);
160 160
161 #if defined(OS_POSIX) 161 #if defined(OS_POSIX)
162 162
163 // Read exactly |bytes| bytes from file descriptor |fd|, storing the result 163 // Read exactly |bytes| bytes from file descriptor |fd|, storing the result
164 // in |buffer|. This function is protected against EINTR and partial reads. 164 // in |buffer|. This function is protected against EINTR and partial reads.
165 // Returns true iff |bytes| bytes have been successfully read from |fd|. 165 // Returns true iff |bytes| bytes have been successfully read from |fd|.
166 BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes); 166 BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes);
167 167
168 // Creates a symbolic link at |symlink| pointing to |target|. Returns 168 // Creates a symbolic link at |symlink| pointing to |target|. Returns
169 // false on failure. 169 // false on failure.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // This function simulates Move(), but unlike Move() it works across volumes. 432 // This function simulates Move(), but unlike Move() it works across volumes.
433 // This function is not transactional. 433 // This function is not transactional.
434 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, 434 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
435 const FilePath& to_path); 435 const FilePath& to_path);
436 #endif // defined(OS_WIN) 436 #endif // defined(OS_WIN)
437 437
438 } // namespace internal 438 } // namespace internal
439 } // namespace base 439 } // namespace base
440 440
441 #endif // BASE_FILES_FILE_UTIL_H_ 441 #endif // BASE_FILES_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « android_webview/browser/aw_metrics_service_client.cc ('k') | base/files/file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698