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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « regexp2000/src/ast.cc ('k') | regexp2000/test/cctest/test-regexp.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 case 'o': { 137 case 'o': {
138 ASSERT_EQ(FmtElm::OBJ, current.type_); 138 ASSERT_EQ(FmtElm::OBJ, current.type_);
139 Object* obj = current.data_.u_obj_; 139 Object* obj = current.data_.u_obj_;
140 PrintObject(obj); 140 PrintObject(obj);
141 break; 141 break;
142 } 142 }
143 case 'k': { 143 case 'k': {
144 ASSERT_EQ(FmtElm::INT, current.type_); 144 ASSERT_EQ(FmtElm::INT, current.type_);
145 int value = current.data_.u_int_; 145 int value = current.data_.u_int_;
146 if (0x20 <= value && value <= 0xFF) { 146 if (0x20 <= value && value <= 0x7F) {
147 Put(value); 147 Put(value);
148 } else if (value <= 0xff) {
149 Add("\\x%02x", value);
148 } else { 150 } else {
149 Add("\\x%X", value); 151 Add("\\u%04x", value);
150 } 152 }
151 break; 153 break;
152 } 154 }
153 case 'i': case 'd': case 'u': case 'x': case 'c': case 'p': case 'X': { 155 case 'i': case 'd': case 'u': case 'x': case 'c': case 'p': case 'X': {
154 int value = current.data_.u_int_; 156 int value = current.data_.u_int_;
155 EmbeddedVector<char, 24> formatted; 157 EmbeddedVector<char, 24> formatted;
156 int length = OS::SNPrintF(formatted, temp.start(), value); 158 int length = OS::SNPrintF(formatted, temp.start(), value);
157 Add(Vector<const char>(formatted.start(), length)); 159 Add(Vector<const char>(formatted.start(), length));
158 break; 160 break;
159 } 161 }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 unsigned new_bytes = *bytes * 2; 568 unsigned new_bytes = *bytes * 2;
567 if (new_bytes > size_) { 569 if (new_bytes > size_) {
568 new_bytes = size_; 570 new_bytes = size_;
569 } 571 }
570 *bytes = new_bytes; 572 *bytes = new_bytes;
571 return space_; 573 return space_;
572 } 574 }
573 575
574 576
575 } } // namespace v8::internal 577 } } // namespace v8::internal
OLDNEW
« 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