Merge branch 'master' into json-pointer

This commit is contained in:
miloyip 2015-05-03 21:07:33 +08:00
commit 6fdfc90bb2
2 changed files with 10 additions and 1 deletions

View File

@ -68,7 +68,14 @@ public:
else
return NULL; // standardize to returning NULL.
}
void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) { (void)originalSize; return std::realloc(originalPtr, newSize); }
void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) {
(void)originalSize;
if (newSize == 0) {
std::free(originalPtr);
return NULL;
}
return std::realloc(originalPtr, newSize);
}
static void Free(void *ptr) { std::free(ptr); }
};

View File

@ -146,6 +146,7 @@ TEST(Document, ParseStream_EncodedInputStream) {
StringBuffer bos2;
Writer<StringBuffer> writer(bos2);
reader.Parse(is, writer);
fclose(fp);
EXPECT_EQ(bos.GetSize(), bos2.GetSize());
EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize()));
@ -184,6 +185,7 @@ TEST(Document, ParseStream_AutoUTFInputStream) {
StringBuffer bos2;
Writer<StringBuffer> writer(bos2);
reader.Parse(is, writer);
fclose(fp);
EXPECT_EQ(bos.GetSize(), bos2.GetSize());
EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize()));