Commit 6fdfc90b authored by miloyip's avatar miloyip

Merge branch 'master' into json-pointer

parents bfd47a70 ae61b797
...@@ -68,7 +68,14 @@ public: ...@@ -68,7 +68,14 @@ public:
else else
return NULL; // standardize to returning NULL. 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); } static void Free(void *ptr) { std::free(ptr); }
}; };
......
...@@ -146,6 +146,7 @@ TEST(Document, ParseStream_EncodedInputStream) { ...@@ -146,6 +146,7 @@ TEST(Document, ParseStream_EncodedInputStream) {
StringBuffer bos2; StringBuffer bos2;
Writer<StringBuffer> writer(bos2); Writer<StringBuffer> writer(bos2);
reader.Parse(is, writer); reader.Parse(is, writer);
fclose(fp);
EXPECT_EQ(bos.GetSize(), bos2.GetSize()); EXPECT_EQ(bos.GetSize(), bos2.GetSize());
EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize())); EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize()));
...@@ -184,6 +185,7 @@ TEST(Document, ParseStream_AutoUTFInputStream) { ...@@ -184,6 +185,7 @@ TEST(Document, ParseStream_AutoUTFInputStream) {
StringBuffer bos2; StringBuffer bos2;
Writer<StringBuffer> writer(bos2); Writer<StringBuffer> writer(bos2);
reader.Parse(is, writer); reader.Parse(is, writer);
fclose(fp);
EXPECT_EQ(bos.GetSize(), bos2.GetSize()); EXPECT_EQ(bos.GetSize(), bos2.GetSize());
EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize())); EXPECT_EQ(0, memcmp(bos.GetString(), bos2.GetString(), bos2.GetSize()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment