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

Unified Diff: test/file-stream.h

Issue 658573004: Updating to new OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/external/ots@master
Patch Set: Adding Colored Emoji changes from external/git repo Created 6 years, 2 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
« .gitmodules ('K') | « test/SConstruct ('k') | test/idempotent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/file-stream.h
diff --git a/test/file-stream.h b/test/file-stream.h
old mode 100644
new mode 100755
index d25c9d967c46f4a159d43c54b82dd536b38290eb..44dd4a1e0fb89d40f0d40bdd4090f7a6b7974884
--- a/test/file-stream.h
+++ b/test/file-stream.h
@@ -17,10 +17,12 @@ class FILEStream : public OTSStream {
}
~FILEStream() {
+ if (file_)
+ fclose(file_);
}
bool WriteRaw(const void *data, size_t length) {
- if (::fwrite(data, length, 1, file_) == 1) {
+ if (!file_ || ::fwrite(data, length, 1, file_) == 1) {
position_ += length;
return true;
}
@@ -29,12 +31,12 @@ class FILEStream : public OTSStream {
bool Seek(off_t position) {
#if defined(_WIN32)
- if (!::_fseeki64(file_, position, SEEK_SET)) {
+ if (!file_ || !::_fseeki64(file_, position, SEEK_SET)) {
position_ = position;
return true;
}
#else
- if (!::fseeko(file_, position, SEEK_SET)) {
+ if (!file_ || !::fseeko(file_, position, SEEK_SET)) {
position_ = position;
return true;
}
« .gitmodules ('K') | « test/SConstruct ('k') | test/idempotent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698