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

Side by Side Diff: src/ostreams.cc

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 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 | « src/ostreams.h ('k') | src/property.h » ('j') | 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "src/ostreams.h" 7 #include "src/ostreams.h"
8 8
9 #if V8_OS_WIN 9 #if V8_OS_WIN
10 #define snprintf sprintf_s 10 #define snprintf sprintf_s
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (f_) fwrite(s, n, 1, f_); 151 if (f_) fwrite(s, n, 1, f_);
152 return *this; 152 return *this;
153 } 153 }
154 154
155 155
156 OFStream& OFStream::flush() { 156 OFStream& OFStream::flush() {
157 if (f_) fflush(f_); 157 if (f_) fflush(f_);
158 return *this; 158 return *this;
159 } 159 }
160 160
161
162 OStream& operator<<(OStream& os, const AsUC16& c) {
163 char buf[10];
164 const char* format = (0x20 <= c.value && c.value <= 0x7F)
165 ? "%c"
166 : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
167 snprintf(buf, sizeof(buf), format, c.value);
168 return os << buf;
169 }
161 } } // namespace v8::internal 170 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ostreams.h ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698