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

Unified Diff: regexp2000/src/string-stream.cc

Issue 11407: * Changed meaning of "%k" format to always output fixed-width ASCII-only representations. (Closed)
Patch Set: Created 12 years, 1 month 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 | « regexp2000/src/ast.cc ('k') | regexp2000/test/cctest/test-regexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: regexp2000/src/string-stream.cc
diff --git a/regexp2000/src/string-stream.cc b/regexp2000/src/string-stream.cc
index 55cb223b1422067a50e97db010ee609142161350..f311e20bdeb69d1da6815a99745da7face22d89a 100644
--- a/regexp2000/src/string-stream.cc
+++ b/regexp2000/src/string-stream.cc
@@ -143,10 +143,12 @@ void StringStream::Add(Vector<const char> format, Vector<FmtElm> elms) {
case 'k': {
ASSERT_EQ(FmtElm::INT, current.type_);
int value = current.data_.u_int_;
- if (0x20 <= value && value <= 0xFF) {
+ if (0x20 <= value && value <= 0x7F) {
Put(value);
+ } else if (value <= 0xff) {
+ Add("\\x%02x", value);
} else {
- Add("\\x%X", value);
+ Add("\\u%04x", value);
}
break;
}
« no previous file with comments | « regexp2000/src/ast.cc ('k') | regexp2000/test/cctest/test-regexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698