From a37b56a06d42ed1e726ea86f529b295b2e6ea22a Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Thu, 1 Sep 2011 23:04:07 +0000 Subject: Base: Change ReadPlatformFile to perform a best effort read of the requested data, and add another function (ReadPlatformFileNoBestEffort) that just forwards the call to the OS. Now ReadPlatformFile and WritePlatformFile behave the same way. BUG=none TEST=base_unittests Review URL: http://codereview.chromium.org/7821013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99264 0039d316-1c4b-4281-b951-d872f2087c98 --- base/platform_file.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'base/platform_file.h') diff --git a/base/platform_file.h b/base/platform_file.h index cf3716c..2bfd181 100644 --- a/base/platform_file.h +++ b/base/platform_file.h @@ -117,10 +117,19 @@ BASE_EXPORT PlatformFile CreatePlatformFile(const FilePath& name, BASE_EXPORT bool ClosePlatformFile(PlatformFile file); // 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. +// 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 is +// not intended for stream oriented files but instead for cases when the normal +// expectation is that actually |size| bytes are read unless there is an error. BASE_EXPORT int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size); +// Reads the given number of bytes (or until EOF is reached) starting with the +// given offset, but does not make any effort to read all data on all platforms. +// Returns the number of bytes read, or -1 on error. +BASE_EXPORT int ReadPlatformFileNoBestEffort(PlatformFile file, int64 offset, + char* data, int size); + // Writes the given buffer into the file at the given offset, overwritting any // data that was previously there. Returns the number of bytes written, or -1 // on error. Note that this function makes a best effort to write all data on -- cgit v1.1