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

Side by Side Diff: src/ostreams.cc

Issue 616293002: Fix ostream flushing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 "src/ostreams.h" 5 #include "src/ostreams.h"
6 6
7 #if V8_OS_WIN 7 #if V8_OS_WIN
8 #define snprintf sprintf_s 8 #define snprintf sprintf_s
9 #endif 9 #endif
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 OFStreamBase::OFStreamBase(FILE* f) : f_(f) {} 14 OFStreamBase::OFStreamBase(FILE* f) : f_(f) {}
15 15
16 16
17 OFStreamBase::~OFStreamBase() {} 17 OFStreamBase::~OFStreamBase() {}
18 18
19 19
20 OFStreamBase::int_type OFStreamBase::sync() { return 0; } 20 OFStreamBase::int_type OFStreamBase::sync() {
21 std::fflush(f_);
22 return 0;
23 }
21 24
22 25
23 OFStreamBase::int_type OFStreamBase::overflow(int_type c) { 26 OFStreamBase::int_type OFStreamBase::overflow(int_type c) {
24 return (c != EOF) ? std::fputc(c, f_) : c; 27 return (c != EOF) ? std::fputc(c, f_) : c;
25 } 28 }
26 29
27 30
28 OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {} 31 OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {}
29 32
30 33
(...skipping 22 matching lines...) Expand all
53 return PrintUC16(os, c.value, IsOK); 56 return PrintUC16(os, c.value, IsOK);
54 } 57 }
55 58
56 59
57 std::ostream& operator<<(std::ostream& os, const AsUC16& c) { 60 std::ostream& operator<<(std::ostream& os, const AsUC16& c) {
58 return PrintUC16(os, c.value, IsPrint); 61 return PrintUC16(os, c.value, IsPrint);
59 } 62 }
60 63
61 } // namespace internal 64 } // namespace internal
62 } // namespace v8 65 } // namespace v8
OLDNEW
« 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