diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-02-04 16:10:19 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-02-04 19:12:37 +0100 |
commit | 9044a24097565c1a8eb542ae0eabb2539b3cc62b (patch) | |
tree | 0cc501c50bdacab8b58197623b7a17304bfff48f /libtests | |
parent | f727bc94432905d79af23cf0aef14854965da2cd (diff) | |
download | qpdf-9044a24097565c1a8eb542ae0eabb2539b3cc62b.tar.zst |
PointerHolder: deprecate getPointer() and getRefcount()
Use get() and use_count() instead. Add #define
NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these
only.
This commit also removes all deprecated PointerHolder API calls from
qpdf's code except in PointerHolder's test suite, which must continue
to test the deprecated APIs.
Diffstat (limited to 'libtests')
-rw-r--r-- | libtests/input_source.cc | 2 | ||||
-rw-r--r-- | libtests/json_parse.cc | 2 | ||||
-rw-r--r-- | libtests/pointer_holder.cc | 1 | ||||
-rw-r--r-- | libtests/qutil.cc | 8 |
4 files changed, 7 insertions, 6 deletions
diff --git a/libtests/input_source.cc b/libtests/input_source.cc index 82d96a45..5a69f295 100644 --- a/libtests/input_source.cc +++ b/libtests/input_source.cc @@ -66,7 +66,7 @@ int main() // of the next match memcpy(b + 2037, "potato potato salad ", 20); PointerHolder<InputSource> is = - new BufferInputSource("test buffer input source", b1.getPointer()); + 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 f0491723..a2f004f5 100644 --- a/libtests/json_parse.cc +++ b/libtests/json_parse.cc @@ -15,7 +15,7 @@ int main(int argc, char* argv[]) PointerHolder<char> buf; size_t size; QUtil::read_file_into_memory(filename, buf, size); - std::string s(buf.getPointer(), size); + std::string s(buf.get(), size); std::cout << JSON::parse(s).unparse() << std::endl; } catch (std::exception& e) diff --git a/libtests/pointer_holder.cc b/libtests/pointer_holder.cc index 913449e4..cad299b4 100644 --- a/libtests/pointer_holder.cc +++ b/libtests/pointer_holder.cc @@ -1,3 +1,4 @@ +#define NO_POINTERHOLDER_DEPRECATION // we need to test the deprecated API #include <qpdf/PointerHolder.hh> #include <iostream> diff --git a/libtests/qutil.cc b/libtests/qutil.cc index f59b564d..a74ae4fe 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -528,7 +528,7 @@ void read_from_file_test() size_t size = 0; QUtil::read_file_into_memory("other-file", buf, size); std::cout << "read " << size << " bytes" << std::endl; - char const* p = buf.getPointer(); + char const* p = buf.get(); assert(size == 24652); assert(memcmp(p, "This file is used for qutil testing.", 36) == 0); assert(p[59] == static_cast<char>(13)); @@ -609,11 +609,11 @@ void rename_delete_test() fprintf(f1, "one"); fclose(f1); QUtil::read_file_into_memory("old\xcf\x80", buf, size); - assert(memcmp(buf.getPointer(), "one", 3) == 0); + assert(memcmp(buf.get(), "one", 3) == 0); std::cout << "rename file" << std::endl;; QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp"); QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size); - assert(memcmp(buf.getPointer(), "one", 3) == 0); + assert(memcmp(buf.get(), "one", 3) == 0); assert_no_file("old\xcf\x80"); std::cout << "create file" << std::endl;; f1 = QUtil::safe_fopen("old\xcf\x80", "w"); @@ -622,7 +622,7 @@ void rename_delete_test() std::cout << "rename over existing" << std::endl;; QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp"); QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size); - assert(memcmp(buf.getPointer(), "two", 3) == 0); + assert(memcmp(buf.get(), "two", 3) == 0); assert_no_file("old\xcf\x80"); std::cout << "delete file" << std::endl;; QUtil::remove_file("old\xcf\x80.~tmp"); |