OLD | NEW |
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 Loading... |
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 |
OLD | NEW |