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 "net/base/file_stream_context.h" | 5 #include "net/base/file_stream_context.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 int res = file_.ReadAtCurrentPosNoBestEffort(buf->data(), buf_len); | 96 int res = file_.ReadAtCurrentPosNoBestEffort(buf->data(), buf_len); |
97 if (res == -1) | 97 if (res == -1) |
98 return IOResult::FromOSError(errno); | 98 return IOResult::FromOSError(errno); |
99 | 99 |
100 return IOResult(res, 0); | 100 return IOResult(res, 0); |
101 } | 101 } |
102 | 102 |
103 FileStream::Context::IOResult FileStream::Context::WriteFileImpl( | 103 FileStream::Context::IOResult FileStream::Context::WriteFileImpl( |
104 scoped_refptr<IOBuffer> buf, | 104 scoped_refptr<IOBuffer> buf, |
105 int buf_len) { | 105 int buf_len) { |
106 if (buf_len == 0) | |
jsbell
2015/02/24 18:37:36
Can you explain why we need this special case? Doe
cmumford
2015/02/24 22:40:52
buf refers to a NULL IOBuffer in this case. So ope
jsbell
2015/02/25 00:10:30
Although you took a different approach, it is weir
| |
107 return IOResult(0, 0); | |
106 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); | 108 int res = file_.WriteAtCurrentPosNoBestEffort(buf->data(), buf_len); |
107 if (res == -1) | 109 if (res == -1) |
108 return IOResult::FromOSError(errno); | 110 return IOResult::FromOSError(errno); |
109 | 111 |
110 return IOResult(res, 0); | 112 return IOResult(res, 0); |
111 } | 113 } |
112 | 114 |
113 } // namespace net | 115 } // namespace net |
OLD | NEW |