| OLD | NEW |
| 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/files/file_util.h" | 5 #include "base/files/file_util.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #endif | 9 #endif |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 #endif // !defined(OS_NACL_NONSFI) | 125 #endif // !defined(OS_NACL_NONSFI) |
| 126 | 126 |
| 127 bool ReadFileToStringWithMaxSize(const FilePath& path, | 127 bool ReadFileToStringWithMaxSize(const FilePath& path, |
| 128 std::string* contents, | 128 std::string* contents, |
| 129 size_t max_size) { | 129 size_t max_size) { |
| 130 if (contents) | 130 if (contents) |
| 131 contents->clear(); | 131 contents->clear(); |
| 132 if (path.ReferencesParent()) | 132 if (path.ReferencesParent()) |
| 133 return false; | 133 return false; |
| 134 FILE* file = OpenFile(path, "rb"); | 134 FILE* file = OpenFile(path, "rb" FONE); |
| 135 if (!file) { | 135 if (!file) { |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 const size_t kBufferSize = 1 << 16; | 139 const size_t kBufferSize = 1 << 16; |
| 140 std::unique_ptr<char[]> buf(new char[kBufferSize]); | 140 std::unique_ptr<char[]> buf(new char[kBufferSize]); |
| 141 size_t len; | 141 size_t len; |
| 142 size_t size = 0; | 142 size_t size = 0; |
| 143 bool read_status = true; | 143 bool read_status = true; |
| 144 | 144 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { | 254 (!have_suffix || !PathExists(FilePath(new_path.value() + suffix)))) { |
| 255 return count; | 255 return count; |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 return -1; | 259 return -1; |
| 260 } | 260 } |
| 261 #endif // !defined(OS_NACL_NONSFI) | 261 #endif // !defined(OS_NACL_NONSFI) |
| 262 | 262 |
| 263 } // namespace base | 263 } // namespace base |
| OLD | NEW |