Chromium Code Reviews| Index: base/file_util.h |
| diff --git a/base/file_util.h b/base/file_util.h |
| index f8418318a6a7ecd92255e6d708624b7f1ae6bcf7..2b4487aaab00035b34ace7d175c88f5fbdf2d6cd 100644 |
| --- a/base/file_util.h |
| +++ b/base/file_util.h |
| @@ -137,6 +137,18 @@ BASE_EXPORT bool TextContentsEqual(const FilePath& filename1, |
| // Useful for unit tests. |
| BASE_EXPORT bool ReadFileToString(const FilePath& path, std::string* contents); |
| +// Read the file at |path| into |contents|, returning true on success. |
| +// This function has an additional check on the maximum size of the file. |
| +// When the file size is greater than |max_size|, the function reads |max_size| |
| +// bytes into |contents| and returns false. |
| +// This function fails if the |path| contains path traversal components ('..'). |
| +// |contents| may be NULL, in which case this function is useful for its |
| +// side effect of priming the disk cache. |
| +// Useful for unit tests. |
|
Andrew T Wilson (Slow)
2014/02/17 14:38:22
Not sure what "Useful for unit tests" means - perh
kaliamoorthi
2014/02/18 11:50:50
Done.
|
| +BASE_EXPORT bool ReadFileToString(const FilePath& path, |
| + std::string* contents, |
| + size_t max_size); |
| + |
| #if defined(OS_POSIX) |
| // Read exactly |bytes| bytes from file descriptor |fd|, storing the result |