Chromium Code Reviews| Index: services/files/file_impl.cc |
| diff --git a/services/files/file_impl.cc b/services/files/file_impl.cc |
| index 4c1ca4a91b983ce6612a99c34c924aa2595cd2b8..db391241b71aaf7f5e1c64b73763866d4617bf80 100644 |
| --- a/services/files/file_impl.cc |
| +++ b/services/files/file_impl.cc |
| @@ -63,6 +63,7 @@ void FileImpl::Read(uint32_t num_bytes_to_read, |
| int64_t offset, |
| Whence whence, |
| const ReadCallback& callback) { |
| + Error error; |
| if (!file_fd_.is_valid()) { |
| callback.Run(ERROR_CLOSED, Array<uint8_t>()); |
| return; |
| @@ -71,11 +72,11 @@ void FileImpl::Read(uint32_t num_bytes_to_read, |
| callback.Run(ERROR_OUT_OF_RANGE, Array<uint8_t>()); |
| return; |
| } |
| - if (Error error = IsOffsetValid(offset)) { |
| + if ((error = IsOffsetValid(offset)) != ERROR_OK) { |
|
viettrungluu
2015/09/22 22:04:58
Ditto.
johngro
2015/09/22 22:24:12
Done.
|
| callback.Run(error, Array<uint8_t>()); |
| return; |
| } |
| - if (Error error = IsWhenceValid(whence)) { |
| + if ((error = IsWhenceValid(whence)) != ERROR_OK) { |
| callback.Run(error, Array<uint8_t>()); |
| return; |
| } |
| @@ -112,6 +113,7 @@ void FileImpl::Write(Array<uint8_t> bytes_to_write, |
| int64_t offset, |
| Whence whence, |
| const WriteCallback& callback) { |
| + Error error; |
| DCHECK(!bytes_to_write.is_null()); |
| if (!file_fd_.is_valid()) { |
| @@ -125,11 +127,11 @@ void FileImpl::Write(Array<uint8_t> bytes_to_write, |
| callback.Run(ERROR_OUT_OF_RANGE, 0); |
| return; |
| } |
| - if (Error error = IsOffsetValid(offset)) { |
| + if ((error = IsOffsetValid(offset)) != ERROR_OK) { |
| callback.Run(error, 0); |
| return; |
| } |
| - if (Error error = IsWhenceValid(whence)) { |
| + if ((error = IsWhenceValid(whence)) != ERROR_OK) { |
| callback.Run(error, 0); |
| return; |
| } |
| @@ -168,15 +170,16 @@ void FileImpl::ReadToStream(ScopedDataPipeProducerHandle source, |
| Whence whence, |
| int64_t num_bytes_to_read, |
| const ReadToStreamCallback& callback) { |
| + Error error; |
| if (!file_fd_.is_valid()) { |
| callback.Run(ERROR_CLOSED); |
| return; |
| } |
| - if (Error error = IsOffsetValid(offset)) { |
| + if ((error = IsOffsetValid(offset)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| - if (Error error = IsWhenceValid(whence)) { |
| + if ((error = IsWhenceValid(whence)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| @@ -190,15 +193,16 @@ void FileImpl::WriteFromStream(ScopedDataPipeConsumerHandle sink, |
| int64_t offset, |
| Whence whence, |
| const WriteFromStreamCallback& callback) { |
| + Error error; |
| if (!file_fd_.is_valid()) { |
| callback.Run(ERROR_CLOSED); |
| return; |
| } |
| - if (Error error = IsOffsetValid(offset)) { |
| + if ((error = IsOffsetValid(offset)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| - if (Error error = IsWhenceValid(whence)) { |
| + if ((error = IsWhenceValid(whence)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |
| @@ -215,15 +219,16 @@ void FileImpl::Tell(const TellCallback& callback) { |
| void FileImpl::Seek(int64_t offset, |
| Whence whence, |
| const SeekCallback& callback) { |
| + Error error; |
| if (!file_fd_.is_valid()) { |
| callback.Run(ERROR_CLOSED, 0); |
| return; |
| } |
| - if (Error error = IsOffsetValid(offset)) { |
| + if ((error = IsOffsetValid(offset)) != ERROR_OK) { |
| callback.Run(error, 0); |
| return; |
| } |
| - if (Error error = IsWhenceValid(whence)) { |
| + if ((error = IsWhenceValid(whence)) != ERROR_OK) { |
| callback.Run(error, 0); |
| return; |
| } |
| @@ -247,6 +252,7 @@ void FileImpl::Stat(const StatCallback& callback) { |
| } |
| void FileImpl::Truncate(int64_t size, const TruncateCallback& callback) { |
| + Error error; |
| if (!file_fd_.is_valid()) { |
| callback.Run(ERROR_CLOSED); |
| return; |
| @@ -255,7 +261,7 @@ void FileImpl::Truncate(int64_t size, const TruncateCallback& callback) { |
| callback.Run(ERROR_INVALID_ARGUMENT); |
| return; |
| } |
| - if (Error error = IsOffsetValid(size)) { |
| + if ((error = IsOffsetValid(size)) != ERROR_OK) { |
| callback.Run(error); |
| return; |
| } |