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

Unified Diff: src/json-stringifier.h

Issue 11232058: Fix Windows build. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index e4eb06e462b3e083f0fe983650deb75c7a0a0d3d..3c49407d5f6a86f2d3a054ddbec6947be82ecae6 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -571,11 +571,15 @@ void BasicJsonStringifier::SerializeStringUnchecked_(const SrcChar* src,
dest += current_index_;
DestChar* dest_start = dest;
+ // Assert that uc16 character is not truncated down to 8 bit.
+ // The <uc16, char> version of this method must not be called.
+ ASSERT(sizeof(*dest) >= sizeof(*src));
Michael Starzinger 2012/10/23 09:36:07 Could we turn that into a STATIC_ASSERT or does si
Yang 2012/10/23 09:39:35 As discussed offline, the <uc16, char> version is
+
*(dest++) = '"';
for (int i = 0; i < length; i++) {
SrcChar c = src[i];
if (DoNotEscape(c)) {
- *(dest++) = c;
+ *(dest++) = static_cast<DestChar>(c);
} else {
const char* chars = &JsonEscapeTable[c * kJsonEscapeTableEntrySize];
while (*chars != '\0') *(dest++) = *(chars++);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698