Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: webrtc/system_wrappers/source/file_impl.cc

Issue 1714503003: Allow passing in strings of length zero to FileWrapper::Write without closing the file. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Nit Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/system_wrappers/source/file_impl.cc
diff --git a/webrtc/system_wrappers/source/file_impl.cc b/webrtc/system_wrappers/source/file_impl.cc
index 0ee0deab6c1061edb3f475d44a3ff9b7e6f7f51d..e033c0eb7347f86227d0114e24b74fcf4502dd45 100644
--- a/webrtc/system_wrappers/source/file_impl.cc
+++ b/webrtc/system_wrappers/source/file_impl.cc
@@ -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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698