Allow passing in strings of length zero to FileWrapper::Write without closing the file.
BUG=webrtc:5253 Review URL: https://codereview.webrtc.org/1714503003 Cr-Commit-Position: refs/heads/master@{#12132}
This commit is contained in:
parent
d4f6ea70b5
commit
6b1968ea70
@ -243,13 +243,12 @@ bool FileWrapperImpl::Write(const void* buf, size_t length) {
|
||||
}
|
||||
|
||||
size_t num_bytes = fwrite(buf, 1, length, id_);
|
||||
if (num_bytes > 0) {
|
||||
size_in_bytes_ += num_bytes;
|
||||
return true;
|
||||
size_in_bytes_ += num_bytes;
|
||||
if (num_bytes != length) {
|
||||
CloseFileImpl();
|
||||
return false;
|
||||
}
|
||||
|
||||
CloseFileImpl();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int FileWrapperImpl::CloseFileImpl() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user