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

Unified Diff: src/ostreams.cc

Issue 859773002: Unobscurified OFStream. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Yet another static_cast for MSVC... Created 5 years, 11 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 | « src/ostreams.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ostreams.cc
diff --git a/src/ostreams.cc b/src/ostreams.cc
index ee0474d2c0882db2ffe81e9e293401fa3c45fed3..1385e7cf315a71c964e22e1d5fdad34e72f8b400 100644
--- a/src/ostreams.cc
+++ b/src/ostreams.cc
@@ -17,7 +17,7 @@ OFStreamBase::OFStreamBase(FILE* f) : f_(f) {}
OFStreamBase::~OFStreamBase() {}
-OFStreamBase::int_type OFStreamBase::sync() {
+int OFStreamBase::sync() {
std::fflush(f_);
return 0;
}
@@ -28,8 +28,15 @@ OFStreamBase::int_type OFStreamBase::overflow(int_type c) {
}
-OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {
+std::streamsize OFStreamBase::xsputn(const char* s, std::streamsize n) {
+ return static_cast<std::streamsize>(
+ std::fwrite(s, 1, static_cast<size_t>(n), f_));
+}
+
+
+OFStream::OFStream(FILE* f) : std::ostream(nullptr), buf_(f) {
DCHECK_NOT_NULL(f);
+ rdbuf(&buf_);
}
« no previous file with comments | « src/ostreams.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698