ext/yajl/yajl_encode.c in yajl-ruby-0.8.2 vs ext/yajl/yajl_encode.c in yajl-ruby-0.8.3
- old
+ new
@@ -87,11 +87,11 @@
}
break;
}
if (escaped != NULL) {
print(ctx, (const char *) (str + beg), end - beg);
- print(ctx, escaped, strlen(escaped));
+ print(ctx, escaped, (unsigned int)strlen(escaped));
beg = ++end;
} else {
++end;
}
}
@@ -177,15 +177,22 @@
}
}
Utf32toUtf8(codepoint, utf8Buf);
unescaped = utf8Buf;
+
+ if (codepoint == 0) {
+ yajl_buf_append(buf, unescaped, 1);
+ beg = ++end;
+ continue;
+ }
+
break;
}
default:
assert("this should never happen" == NULL);
}
- yajl_buf_append(buf, unescaped, strlen(unescaped));
+ yajl_buf_append(buf, unescaped, (unsigned int)strlen(unescaped));
beg = ++end;
} else {
end++;
}
}