int quoted_length = kSpaceForQuotes;
while (read_cursor < end) {
Char c = *(read_cursor++);
- if (sizeof(Char) > 1u && static_cast<unsigned>(c) >= kQuoteTableLength) {
+ if (static_cast<unsigned>(c) >= kQuoteTableLength) {
quoted_length++;
} else {
quoted_length += JsonQuoteLengths[static_cast<unsigned>(c)];
read_cursor = characters.start();
while (read_cursor < end) {
Char c = *(read_cursor++);
- if (sizeof(Char) > 1u && static_cast<unsigned>(c) >= kQuoteTableLength) {
+ if (static_cast<unsigned>(c) >= kQuoteTableLength) {
*(write_cursor++) = c;
} else {
int len = JsonQuoteLengths[static_cast<unsigned>(c)];
*(write_cursor++) = '"';
while (read_cursor < end) {
SourceChar c = *(read_cursor++);
- if (sizeof(SourceChar) > 1u &&
- static_cast<unsigned>(c) >= kQuoteTableLength) {
+ if (static_cast<unsigned>(c) >= kQuoteTableLength) {
*(write_cursor++) = static_cast<SinkChar>(c);
} else {
int len = JsonQuoteLengths[static_cast<unsigned>(c)];
assertFalse(/[^\u039b-\u039d]/i.test('\u00b5'));
assertFalse(/[\u039b-\u039d]/.test('\u00b5'));
assertTrue(/[^\u039b-\u039d]/.test('\u00b5'));
+
+// Check a regression in QuoteJsonSlow and WriteQuoteJsonString
+for (var testNumber = 0; testNumber < 2; testNumber++) {
+ var testString = "\xdc";
+ var loopLength = testNumber == 0 ? 0 : 20;
+ for (var i = 0; i < loopLength; i++ ) {
+ testString += testString;
+ }
+ var stringified = JSON.stringify({"test" : testString}, null, 0);
+ var stringifiedExpected = '{"test":"' + testString + '"}';
+ assertEquals(stringifiedExpected, stringified);
+}