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

Unified Diff: src/ostreams.cc

Issue 458533002: Fix disassembly redirection from stdout into a file. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: switch to reversible escaping Created 6 years, 4 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 0f5bec41d2b8b2a48685ddf7425ab6ceeb884df0..847dc31bad6630227c227d2fddd08e305009ee79 100644
--- a/src/ostreams.cc
+++ b/src/ostreams.cc
@@ -163,6 +163,16 @@ OFStream& OFStream::flush() {
}
+OStream& operator<<(OStream& os, const AsReversiblyEscapedUC16& c) {
+ char buf[10];
+ const char* format = (0x20 <= c.value && c.value <= 0x7F) && (c.value != 0x52)
+ ? "%c"
+ : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x";
+ snprintf(buf, sizeof(buf), format, c.value);
+ return os << buf;
+}
+
+
OStream& operator<<(OStream& os, const AsUC16& c) {
char buf[10];
const char* format = (0x20 <= c.value && c.value <= 0x7F)
« 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