diff options
Diffstat (limited to 'chromium/base/files/file.h')
-rw-r--r-- | chromium/base/files/file.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chromium/base/files/file.h b/chromium/base/files/file.h index cc157a49e97..d61c9f43b7b 100644 --- a/chromium/base/files/file.h +++ b/chromium/base/files/file.h @@ -10,10 +10,10 @@ #include <string> #include "base/base_export.h" +#include "base/containers/span.h" #include "base/files/file_path.h" #include "base/files/file_tracing.h" #include "base/files/platform_file.h" -#include "base/files/scoped_file.h" #include "base/macros.h" #include "base/time/time.h" #include "build/build_config.h" @@ -201,6 +201,14 @@ class BASE_EXPORT File { // (relative to the start) or -1 in case of error. int64_t Seek(Whence whence, int64_t offset); + // Simplified versions of Read() and friends (see below) that check the int + // return value and just return a boolean. They return true if and only if + // the function read in / wrote out exactly |size| bytes of data. + bool ReadAndCheck(int64_t offset, span<uint8_t> data); + bool ReadAtCurrentPosAndCheck(span<uint8_t> data); + bool WriteAndCheck(int64_t offset, span<const uint8_t> data); + bool WriteAtCurrentPosAndCheck(span<const uint8_t> data); + // Reads the given number of bytes (or until EOF is reached) starting with the // given offset. Returns the number of bytes read, or -1 on error. Note that // this function makes a best effort to read all data on all platforms, so it |