| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 std::fflush(f_); | 21 std::fflush(f_); |
| 22 return 0; | 22 return 0; |
| 23 } | 23 } |
| 24 | 24 |
| 25 | 25 |
| 26 OFStreamBase::int_type OFStreamBase::overflow(int_type c) { | 26 OFStreamBase::int_type OFStreamBase::overflow(int_type c) { |
| 27 return (c != EOF) ? std::fputc(c, f_) : c; | 27 return (c != EOF) ? std::fputc(c, f_) : c; |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) {} | 31 OFStream::OFStream(FILE* f) : OFStreamBase(f), std::ostream(this) { |
| 32 DCHECK_NOT_NULL(f); |
| 33 } |
| 32 | 34 |
| 33 | 35 |
| 34 OFStream::~OFStream() {} | 36 OFStream::~OFStream() {} |
| 35 | 37 |
| 36 | 38 |
| 37 namespace { | 39 namespace { |
| 38 | 40 |
| 39 // Locale-independent predicates. | 41 // Locale-independent predicates. |
| 40 bool IsPrint(uint16_t c) { return 0x20 <= c && c <= 0x7e; } | 42 bool IsPrint(uint16_t c) { return 0x20 <= c && c <= 0x7e; } |
| 41 bool IsSpace(uint16_t c) { return (0x9 <= c && c <= 0xd) || c == 0x20; } | 43 bool IsSpace(uint16_t c) { return (0x9 <= c && c <= 0xd) || c == 0x20; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 return PrintUC16(os, c.value, IsOK); | 58 return PrintUC16(os, c.value, IsOK); |
| 57 } | 59 } |
| 58 | 60 |
| 59 | 61 |
| 60 std::ostream& operator<<(std::ostream& os, const AsUC16& c) { | 62 std::ostream& operator<<(std::ostream& os, const AsUC16& c) { |
| 61 return PrintUC16(os, c.value, IsPrint); | 63 return PrintUC16(os, c.value, IsPrint); |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace internal | 66 } // namespace internal |
| 65 } // namespace v8 | 67 } // namespace v8 |
| OLD | NEW |