diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-02-11 18:21:26 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-02-11 18:21:26 +0000 |
commit | 617e89e9e893f9aac53be7153af24ae8052b1a28 (patch) | |
tree | a7a06dc3f7dbc85f533a06a4bc4c1c8d060daf54 | |
parent | 1aa659a9290fae89fec82c4ccf360c1edab37bd6 (diff) |
Fix compile error in MemBlockStream.
Fix test/common memory leak checks now that MemBlockStream allocates another
block.
-rw-r--r-- | lib/common/MemBlockStream.cpp | 2 | ||||
-rw-r--r-- | lib/common/MemBlockStream.h | 2 | ||||
-rw-r--r-- | test/common/testcommon.cpp | 16 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/common/MemBlockStream.cpp b/lib/common/MemBlockStream.cpp index f6b7d07b..90c0eaf6 100644 --- a/lib/common/MemBlockStream.cpp +++ b/lib/common/MemBlockStream.cpp @@ -63,7 +63,7 @@ MemBlockStream::MemBlockStream(const std::string& rMessage) { mTempBuffer.Write(rMessage.c_str(), rMessage.size()); mTempBuffer.SetForReading(); - mpBuffer = mTempBuffer.GetBuffer(); + mpBuffer = (const char *)(mTempBuffer.GetBuffer()); mBytesInBuffer = rMessage.size(); ASSERT(mpBuffer != 0); ASSERT(mBytesInBuffer >= 0); diff --git a/lib/common/MemBlockStream.h b/lib/common/MemBlockStream.h index f02e57ba..98398121 100644 --- a/lib/common/MemBlockStream.h +++ b/lib/common/MemBlockStream.h @@ -10,10 +10,10 @@ #ifndef MEMBLOCKSTREAM__H #define MEMBLOCKSTREAM__H +#include "CollectInBufferStream.h" #include "IOStream.h" class StreamableMemBlock; -class CollectInBufferStream; // -------------------------------------------------------------------------- // diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp index f47a0dba..2f97b4e0 100644 --- a/test/common/testcommon.cpp +++ b/test/common/testcommon.cpp @@ -273,21 +273,21 @@ int test(int argc, const char *argv[]) { Timers::Cleanup(); - TEST_THAT(memleakfinder_numleaks() == 0); + TEST_EQUAL(0, memleakfinder_numleaks()); void *block = ::malloc(12); - TEST_THAT(memleakfinder_numleaks() == 1); + TEST_EQUAL(1, memleakfinder_numleaks()); void *b2 = ::realloc(block, 128*1024); - TEST_THAT(memleakfinder_numleaks() == 1); + TEST_EQUAL(1, memleakfinder_numleaks()); ::free(b2); - TEST_THAT(memleakfinder_numleaks() == 0); + TEST_EQUAL(0, memleakfinder_numleaks()); char *test = new char[1024]; - TEST_THAT(memleakfinder_numleaks() == 1); + TEST_EQUAL(1, memleakfinder_numleaks()); MemBlockStream *s = new MemBlockStream(test,12); - TEST_THAT(memleakfinder_numleaks() == 2); + TEST_EQUAL(3, memleakfinder_numleaks()); delete s; - TEST_THAT(memleakfinder_numleaks() == 1); + TEST_EQUAL(1, memleakfinder_numleaks()); delete [] test; - TEST_THAT(memleakfinder_numleaks() == 0); + TEST_EQUAL(0, memleakfinder_numleaks()); Timers::Init(); } |