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++); |