diff options
Diffstat (limited to 'libtests')
-rw-r--r-- | libtests/input_source.cc | 12 | ||||
-rw-r--r-- | libtests/json_parse.cc | 2 | ||||
-rw-r--r-- | libtests/qutil.cc | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/libtests/input_source.cc b/libtests/input_source.cc index cb62daea..a32428be 100644 --- a/libtests/input_source.cc +++ b/libtests/input_source.cc @@ -5,11 +5,11 @@ #include <cstring> #include <iostream> -static PointerHolder<Buffer> +static std::shared_ptr<Buffer> get_buffer() { size_t size = 3172; - PointerHolder<Buffer> b(new Buffer(size)); + std::shared_ptr<Buffer> b(new Buffer(size)); unsigned char* p = b->getBuffer(); for (size_t i = 0; i < size; ++i) { p[i] = static_cast<unsigned char>(i & 0xff); @@ -20,7 +20,7 @@ get_buffer() class Finder: public InputSource::Finder { public: - Finder(PointerHolder<InputSource> is, std::string const& after) : + Finder(std::shared_ptr<InputSource> is, std::string const& after) : is(is), after(after) { @@ -31,7 +31,7 @@ class Finder: public InputSource::Finder virtual bool check(); private: - PointerHolder<InputSource> is; + std::shared_ptr<InputSource> is; std::string after; }; @@ -57,14 +57,14 @@ check(char const* description, bool expected, bool actual) int main() { - PointerHolder<Buffer> b1 = get_buffer(); + std::shared_ptr<Buffer> b1 = get_buffer(); unsigned char* b = b1->getBuffer(); // Straddle block boundaries memcpy(b + 1022, "potato", 6); // Overlap so that the first check() would advance past the start // of the next match memcpy(b + 2037, "potato potato salad ", 20); - auto is = PointerHolder<InputSource>( + auto is = std::shared_ptr<InputSource>( new BufferInputSource("test buffer input source", b1.get())); Finder f1(is, "salad"); check("find potato salad", true, is->findFirst("potato", 0, 0, f1)); diff --git a/libtests/json_parse.cc b/libtests/json_parse.cc index 13d29b65..77692eab 100644 --- a/libtests/json_parse.cc +++ b/libtests/json_parse.cc @@ -11,7 +11,7 @@ main(int argc, char* argv[]) } char const* filename = argv[1]; try { - PointerHolder<char> buf; + std::shared_ptr<char> buf; size_t size; QUtil::read_file_into_memory(filename, buf, size); std::string s(buf.get(), size); diff --git a/libtests/qutil.cc b/libtests/qutil.cc index fea9fca1..dda49898 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -529,7 +529,7 @@ read_from_file_test() fclose(fp); } - PointerHolder<char> buf; + std::shared_ptr<char> buf; size_t size = 0; QUtil::read_file_into_memory("other-file", buf, size); std::cout << "read " << size << " bytes" << std::endl; @@ -595,7 +595,7 @@ assert_no_file(char const* filename) void rename_delete_test() { - PointerHolder<char> buf; + std::shared_ptr<char> buf; size_t size = 0; try { |