diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-07 20:20:11 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-07 20:20:11 +0000 |
commit | 2897bccb0244e4c279fc638ecac59a600394dcb9 (patch) | |
tree | 3c241a8a84c8fb8c08ce1a40a744b84a4fcc7ce4 /net | |
parent | 8e512c108c2d539e3cc4ba39ad46ec9bf51fa000 (diff) | |
download | chromium_src-2897bccb0244e4c279fc638ecac59a600394dcb9.zip chromium_src-2897bccb0244e4c279fc638ecac59a600394dcb9.tar.gz chromium_src-2897bccb0244e4c279fc638ecac59a600394dcb9.tar.bz2 |
Disk cache: Use platform_file functions for POSIX.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7824027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/file_posix.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index a80ae6c..b767c17 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -202,19 +202,24 @@ bool File::IsValid() const { bool File::Read(void* buffer, size_t buffer_len, size_t offset) { DCHECK(init_); - if (buffer_len > ULONG_MAX || offset > LONG_MAX) + if (buffer_len > static_cast<size_t>(kint32max) || + offset > static_cast<size_t>(kint32max)) return false; - int ret = pread(platform_file_, buffer, buffer_len, offset); + int ret = base::ReadPlatformFile(platform_file_, offset, + static_cast<char*>(buffer), buffer_len); return (static_cast<size_t>(ret) == buffer_len); } bool File::Write(const void* buffer, size_t buffer_len, size_t offset) { DCHECK(init_); - if (buffer_len > ULONG_MAX || offset > ULONG_MAX) + if (buffer_len > static_cast<size_t>(kint32max) || + offset > static_cast<size_t>(kint32max)) return false; - int ret = pwrite(platform_file_, buffer, buffer_len, offset); + int ret = base::WritePlatformFile(platform_file_, offset, + static_cast<const char*>(buffer), + buffer_len); return (static_cast<size_t>(ret) == buffer_len); } @@ -256,7 +261,7 @@ bool File::SetLength(size_t length) { if (length > ULONG_MAX) return false; - return 0 == ftruncate(platform_file_, length); + return base::TruncatePlatformFile(platform_file_, length); } size_t File::GetLength() { @@ -277,7 +282,7 @@ void File::WaitForPendingIO(int* num_pending_io) { File::~File() { if (IsValid()) - close(platform_file_); + base::ClosePlatformFile(platform_file_); } bool File::AsyncWrite(const void* buffer, size_t buffer_len, size_t offset, |