Commit 9044a24097565c1a8eb542ae0eabb2539b3cc62b

Authored by Jay Berkenbilt
1 parent f727bc94

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.
ChangeLog
1 2022-02-04 Jay Berkenbilt <ejb@ql.org> 1 2022-02-04 Jay Berkenbilt <ejb@ql.org>
2 2
  3 + * PointerHolder: deprecate getPointer() and getRefcount(). If you
  4 + don't want to disable deprecation warnings in general but are not
  5 + ready to tackle this change yet, you can define
  6 + NO_POINTERHOLDER_DEPRECATION to suppress those.
  7 +
3 * PointerHolder: add a get() method and a use_count() method for 8 * PointerHolder: add a get() method and a use_count() method for
4 compatibility with std::shared_ptr. In qpdf 11, qpdf's APIs will 9 compatibility with std::shared_ptr. In qpdf 11, qpdf's APIs will
5 switch to using std::shared_ptr instead of PointerHolder, though 10 switch to using std::shared_ptr instead of PointerHolder, though
fuzz/standalone_fuzz_target_runner.cc
@@ -12,7 +12,7 @@ int main(int argc, char **argv) @@ -12,7 +12,7 @@ int main(int argc, char **argv)
12 size_t size = 0; 12 size_t size = 0;
13 QUtil::read_file_into_memory(argv[i], file_buf, size); 13 QUtil::read_file_into_memory(argv[i], file_buf, size);
14 LLVMFuzzerTestOneInput( 14 LLVMFuzzerTestOneInput(
15 - reinterpret_cast<unsigned char*>(file_buf.getPointer()), size); 15 + reinterpret_cast<unsigned char*>(file_buf.get()), size);
16 std::cout << argv[i] << " successful" << std::endl; 16 std::cout << argv[i] << " successful" << std::endl;
17 } 17 }
18 return 0; 18 return 0;
include/qpdf/PointerHolder.hh
@@ -135,14 +135,23 @@ class PointerHolder @@ -135,14 +135,23 @@ class PointerHolder
135 135
136 // NOTE: The pointer returned by getPointer turns into a pumpkin 136 // NOTE: The pointer returned by getPointer turns into a pumpkin
137 // when the last PointerHolder that contains it disappears. 137 // when the last PointerHolder that contains it disappears.
  138 +#ifndef NO_POINTERHOLDER_DEPRECATION
  139 + [[deprecated("use PointerHolder<T>::get() instead of getPointer()")]]
  140 +#endif
138 T* getPointer() 141 T* getPointer()
139 { 142 {
140 return this->data->pointer; 143 return this->data->pointer;
141 } 144 }
  145 +#ifndef NO_POINTERHOLDER_DEPRECATION
  146 + [[deprecated("use PointerHolder<T>::get() instead of getPointer()")]]
  147 +#endif
142 T const* getPointer() const 148 T const* getPointer() const
143 { 149 {
144 return this->data->pointer; 150 return this->data->pointer;
145 } 151 }
  152 +#ifndef NO_POINTERHOLDER_DEPRECATION
  153 + [[deprecated("use use_count() instead of getRefcount()")]]
  154 +#endif
146 int getRefcount() const 155 int getRefcount() const
147 { 156 {
148 return this->data->refcount; 157 return this->data->refcount;
libqpdf/ClosedFileInputSource.cc
@@ -24,7 +24,7 @@ ClosedFileInputSource::~ClosedFileInputSource() @@ -24,7 +24,7 @@ ClosedFileInputSource::~ClosedFileInputSource()
24 void 24 void
25 ClosedFileInputSource::before() 25 ClosedFileInputSource::before()
26 { 26 {
27 - if (0 == this->m->fis.getPointer()) 27 + if (0 == this->m->fis.get())
28 { 28 {
29 this->m->fis = new FileInputSource(); 29 this->m->fis = new FileInputSource();
30 this->m->fis->setFilename(this->m->filename.c_str()); 30 this->m->fis->setFilename(this->m->filename.c_str());
@@ -81,7 +81,7 @@ void @@ -81,7 +81,7 @@ void
81 ClosedFileInputSource::rewind() 81 ClosedFileInputSource::rewind()
82 { 82 {
83 this->m->offset = 0; 83 this->m->offset = 0;
84 - if (this->m->fis.getPointer()) 84 + if (this->m->fis.get())
85 { 85 {
86 this->m->fis->rewind(); 86 this->m->fis->rewind();
87 } 87 }
@@ -109,7 +109,7 @@ void @@ -109,7 +109,7 @@ void
109 ClosedFileInputSource::stayOpen(bool val) 109 ClosedFileInputSource::stayOpen(bool val)
110 { 110 {
111 this->m->stay_open = val; 111 this->m->stay_open = val;
112 - if ((! val) && this->m->fis.getPointer()) 112 + if ((! val) && this->m->fis.get())
113 { 113 {
114 after(); 114 after();
115 } 115 }
libqpdf/JSON.cc
@@ -154,7 +154,7 @@ std::string JSON::JSON_null::unparse(size_t) const @@ -154,7 +154,7 @@ std::string JSON::JSON_null::unparse(size_t) const
154 std::string 154 std::string
155 JSON::unparse() const 155 JSON::unparse() const
156 { 156 {
157 - if (0 == this->m->value.getPointer()) 157 + if (0 == this->m->value.get())
158 { 158 {
159 return "null"; 159 return "null";
160 } 160 }
@@ -219,13 +219,13 @@ JSON @@ -219,13 +219,13 @@ JSON
219 JSON::addDictionaryMember(std::string const& key, JSON const& val) 219 JSON::addDictionaryMember(std::string const& key, JSON const& val)
220 { 220 {
221 JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>( 221 JSON_dictionary* obj = dynamic_cast<JSON_dictionary*>(
222 - this->m->value.getPointer()); 222 + this->m->value.get());
223 if (0 == obj) 223 if (0 == obj)
224 { 224 {
225 throw std::runtime_error( 225 throw std::runtime_error(
226 "JSON::addDictionaryMember called on non-dictionary"); 226 "JSON::addDictionaryMember called on non-dictionary");
227 } 227 }
228 - if (val.m->value.getPointer()) 228 + if (val.m->value.get())
229 { 229 {
230 obj->members[encode_string(key)] = val.m->value; 230 obj->members[encode_string(key)] = val.m->value;
231 } 231 }
@@ -246,12 +246,12 @@ JSON @@ -246,12 +246,12 @@ JSON
246 JSON::addArrayElement(JSON const& val) 246 JSON::addArrayElement(JSON const& val)
247 { 247 {
248 JSON_array* arr = dynamic_cast<JSON_array*>( 248 JSON_array* arr = dynamic_cast<JSON_array*>(
249 - this->m->value.getPointer()); 249 + this->m->value.get());
250 if (0 == arr) 250 if (0 == arr)
251 { 251 {
252 throw std::runtime_error("JSON::addArrayElement called on non-array"); 252 throw std::runtime_error("JSON::addArrayElement called on non-array");
253 } 253 }
254 - if (val.m->value.getPointer()) 254 + if (val.m->value.get())
255 { 255 {
256 arr->elements.push_back(val.m->value); 256 arr->elements.push_back(val.m->value);
257 } 257 }
@@ -302,20 +302,20 @@ bool @@ -302,20 +302,20 @@ bool
302 JSON::isArray() const 302 JSON::isArray() const
303 { 303 {
304 return nullptr != dynamic_cast<JSON_array const*>( 304 return nullptr != dynamic_cast<JSON_array const*>(
305 - this->m->value.getPointer()); 305 + this->m->value.get());
306 } 306 }
307 307
308 bool 308 bool
309 JSON::isDictionary() const 309 JSON::isDictionary() const
310 { 310 {
311 return nullptr != dynamic_cast<JSON_dictionary const*>( 311 return nullptr != dynamic_cast<JSON_dictionary const*>(
312 - this->m->value.getPointer()); 312 + this->m->value.get());
313 } 313 }
314 314
315 bool 315 bool
316 JSON::getString(std::string& utf8) const 316 JSON::getString(std::string& utf8) const
317 { 317 {
318 - auto v = dynamic_cast<JSON_string const*>(this->m->value.getPointer()); 318 + auto v = dynamic_cast<JSON_string const*>(this->m->value.get());
319 if (v == nullptr) 319 if (v == nullptr)
320 { 320 {
321 return false; 321 return false;
@@ -327,7 +327,7 @@ JSON::getString(std::string&amp; utf8) const @@ -327,7 +327,7 @@ JSON::getString(std::string&amp; utf8) const
327 bool 327 bool
328 JSON::getNumber(std::string& value) const 328 JSON::getNumber(std::string& value) const
329 { 329 {
330 - auto v = dynamic_cast<JSON_number const*>(this->m->value.getPointer()); 330 + auto v = dynamic_cast<JSON_number const*>(this->m->value.get());
331 if (v == nullptr) 331 if (v == nullptr)
332 { 332 {
333 return false; 333 return false;
@@ -339,7 +339,7 @@ JSON::getNumber(std::string&amp; value) const @@ -339,7 +339,7 @@ JSON::getNumber(std::string&amp; value) const
339 bool 339 bool
340 JSON::getBool(bool& value) const 340 JSON::getBool(bool& value) const
341 { 341 {
342 - auto v = dynamic_cast<JSON_bool const*>(this->m->value.getPointer()); 342 + auto v = dynamic_cast<JSON_bool const*>(this->m->value.get());
343 if (v == nullptr) 343 if (v == nullptr)
344 { 344 {
345 return false; 345 return false;
@@ -351,7 +351,7 @@ JSON::getBool(bool&amp; value) const @@ -351,7 +351,7 @@ JSON::getBool(bool&amp; value) const
351 bool 351 bool
352 JSON::isNull() const 352 JSON::isNull() const
353 { 353 {
354 - if (dynamic_cast<JSON_null const*>(this->m->value.getPointer())) 354 + if (dynamic_cast<JSON_null const*>(this->m->value.get()))
355 { 355 {
356 return true; 356 return true;
357 } 357 }
@@ -362,7 +362,7 @@ bool @@ -362,7 +362,7 @@ bool
362 JSON::forEachDictItem( 362 JSON::forEachDictItem(
363 std::function<void(std::string const& key, JSON value)> fn) const 363 std::function<void(std::string const& key, JSON value)> fn) const
364 { 364 {
365 - auto v = dynamic_cast<JSON_dictionary const*>(this->m->value.getPointer()); 365 + auto v = dynamic_cast<JSON_dictionary const*>(this->m->value.get());
366 if (v == nullptr) 366 if (v == nullptr)
367 { 367 {
368 return false; 368 return false;
@@ -377,7 +377,7 @@ JSON::forEachDictItem( @@ -377,7 +377,7 @@ JSON::forEachDictItem(
377 bool 377 bool
378 JSON::forEachArrayItem(std::function<void(JSON value)> fn) const 378 JSON::forEachArrayItem(std::function<void(JSON value)> fn) const
379 { 379 {
380 - auto v = dynamic_cast<JSON_array const*>(this->m->value.getPointer()); 380 + auto v = dynamic_cast<JSON_array const*>(this->m->value.get());
381 if (v == nullptr) 381 if (v == nullptr)
382 { 382 {
383 return false; 383 return false;
@@ -392,8 +392,8 @@ JSON::forEachArrayItem(std::function&lt;void(JSON value)&gt; fn) const @@ -392,8 +392,8 @@ JSON::forEachArrayItem(std::function&lt;void(JSON value)&gt; fn) const
392 bool 392 bool
393 JSON::checkSchema(JSON schema, std::list<std::string>& errors) 393 JSON::checkSchema(JSON schema, std::list<std::string>& errors)
394 { 394 {
395 - return checkSchemaInternal(this->m->value.getPointer(),  
396 - schema.m->value.getPointer(), 395 + return checkSchemaInternal(this->m->value.get(),
  396 + schema.m->value.get(),
397 0, errors, ""); 397 0, errors, "");
398 } 398 }
399 399
@@ -401,8 +401,8 @@ bool @@ -401,8 +401,8 @@ bool
401 JSON::checkSchema(JSON schema, unsigned long flags, 401 JSON::checkSchema(JSON schema, unsigned long flags,
402 std::list<std::string>& errors) 402 std::list<std::string>& errors)
403 { 403 {
404 - return checkSchemaInternal(this->m->value.getPointer(),  
405 - schema.m->value.getPointer(), 404 + return checkSchemaInternal(this->m->value.get(),
  405 + schema.m->value.get(),
406 flags, errors, ""); 406 flags, errors, "");
407 } 407 }
408 408
@@ -452,12 +452,12 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v, @@ -452,12 +452,12 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v,
452 452
453 if (sch_dict && (! pattern_key.empty())) 453 if (sch_dict && (! pattern_key.empty()))
454 { 454 {
455 - auto pattern_schema = sch_dict->members[pattern_key].getPointer(); 455 + auto pattern_schema = sch_dict->members[pattern_key].get();
456 for (auto const& iter: this_dict->members) 456 for (auto const& iter: this_dict->members)
457 { 457 {
458 std::string const& key = iter.first; 458 std::string const& key = iter.first;
459 checkSchemaInternal( 459 checkSchemaInternal(
460 - this_dict->members[key].getPointer(), pattern_schema, 460 + this_dict->members[key].get(), pattern_schema,
461 flags, errors, prefix + "." + key); 461 flags, errors, prefix + "." + key);
462 } 462 }
463 } 463 }
@@ -469,8 +469,8 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v, @@ -469,8 +469,8 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v,
469 if (this_dict->members.count(key)) 469 if (this_dict->members.count(key))
470 { 470 {
471 checkSchemaInternal( 471 checkSchemaInternal(
472 - this_dict->members[key].getPointer(),  
473 - iter.second.getPointer(), 472 + this_dict->members[key].get(),
  473 + iter.second.get(),
474 flags, errors, prefix + "." + key); 474 flags, errors, prefix + "." + key);
475 } 475 }
476 else 476 else
@@ -523,8 +523,8 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v, @@ -523,8 +523,8 @@ JSON::checkSchemaInternal(JSON_value* this_v, JSON_value* sch_v,
523 iter != this_arr->elements.end(); ++iter, ++i) 523 iter != this_arr->elements.end(); ++iter, ++i)
524 { 524 {
525 checkSchemaInternal( 525 checkSchemaInternal(
526 - (*iter).getPointer(),  
527 - sch_arr->elements.at(0).getPointer(), 526 + (*iter).get(),
  527 + sch_arr->elements.at(0).get(),
528 flags, errors, prefix + "." + QUtil::int_to_string(i)); 528 flags, errors, prefix + "." + QUtil::int_to_string(i));
529 } 529 }
530 } 530 }
@@ -1067,7 +1067,7 @@ JSONParser::handleToken() @@ -1067,7 +1067,7 @@ JSONParser::handleToken()
1067 break; 1067 break;
1068 } 1068 }
1069 1069
1070 - if ((item.getPointer() == nullptr) == (delimiter == '() == nullptr) == (delimiter == '\0'))')) 1070 + if ((item.get() == nullptr) == (delimiter == '() == nullptr) == (delimiter == '\0'))'))
1071 { 1071 {
1072 throw std::logic_error( 1072 throw std::logic_error(
1073 "JSONParser::handleToken: logic error: exactly one of item" 1073 "JSONParser::handleToken: logic error: exactly one of item"
@@ -1076,7 +1076,7 @@ JSONParser::handleToken() @@ -1076,7 +1076,7 @@ JSONParser::handleToken()
1076 1076
1077 // See whether what we have is allowed at this point. 1077 // See whether what we have is allowed at this point.
1078 1078
1079 - if (item.getPointer()) 1079 + if (item.get())
1080 { 1080 {
1081 switch (parser_state) 1081 switch (parser_state)
1082 { 1082 {
@@ -1213,7 +1213,7 @@ JSONParser::handleToken() @@ -1213,7 +1213,7 @@ JSONParser::handleToken()
1213 throw std::logic_error( 1213 throw std::logic_error(
1214 "JSONParser::handleToken: unexpected delimiter in transition"); 1214 "JSONParser::handleToken: unexpected delimiter in transition");
1215 } 1215 }
1216 - else if (item.getPointer()) 1216 + else if (item.get())
1217 { 1217 {
1218 PointerHolder<JSON> tos; 1218 PointerHolder<JSON> tos;
1219 if (! stack.empty()) 1219 if (! stack.empty())
@@ -1259,7 +1259,7 @@ JSONParser::handleToken() @@ -1259,7 +1259,7 @@ JSONParser::handleToken()
1259 } 1259 }
1260 1260
1261 // Prepare for next token 1261 // Prepare for next token
1262 - if (item.getPointer()) 1262 + if (item.get())
1263 { 1263 {
1264 if (item->isDictionary()) 1264 if (item->isDictionary())
1265 { 1265 {
libqpdf/Pl_Buffer.cc
@@ -28,7 +28,7 @@ Pl_Buffer::~Pl_Buffer() @@ -28,7 +28,7 @@ Pl_Buffer::~Pl_Buffer()
28 void 28 void
29 Pl_Buffer::write(unsigned char* buf, size_t len) 29 Pl_Buffer::write(unsigned char* buf, size_t len)
30 { 30 {
31 - if (this->m->data.getPointer() == 0) 31 + if (this->m->data.get() == 0)
32 { 32 {
33 this->m->data = new Buffer(len); 33 this->m->data = new Buffer(len);
34 } 34 }
libqpdf/Pl_DCT.cc
@@ -285,7 +285,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b) @@ -285,7 +285,7 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
285 static int const BUF_SIZE = 65536; 285 static int const BUF_SIZE = 65536;
286 PointerHolder<unsigned char> outbuffer_ph( 286 PointerHolder<unsigned char> outbuffer_ph(
287 true, new unsigned char[BUF_SIZE]); 287 true, new unsigned char[BUF_SIZE]);
288 - unsigned char* outbuffer = outbuffer_ph.getPointer(); 288 + unsigned char* outbuffer = outbuffer_ph.get();
289 jpeg_pipeline_dest(cinfo, outbuffer, BUF_SIZE, this->getNext()); 289 jpeg_pipeline_dest(cinfo, outbuffer, BUF_SIZE, this->getNext());
290 290
291 cinfo->image_width = this->m->image_width; 291 cinfo->image_width = this->m->image_width;
libqpdf/Pl_Flate.cc
@@ -37,7 +37,7 @@ Pl_Flate::Members::Members(size_t out_bufsize, @@ -37,7 +37,7 @@ Pl_Flate::Members::Members(size_t out_bufsize,
37 zstream.opaque = 0; 37 zstream.opaque = 0;
38 zstream.next_in = 0; 38 zstream.next_in = 0;
39 zstream.avail_in = 0; 39 zstream.avail_in = 0;
40 - zstream.next_out = this->outbuf.getPointer(); 40 + zstream.next_out = this->outbuf.get();
41 zstream.avail_out = QIntC::to_uint(out_bufsize); 41 zstream.avail_out = QIntC::to_uint(out_bufsize);
42 } 42 }
43 43
@@ -89,7 +89,7 @@ Pl_Flate::warn(char const* msg, int code) @@ -89,7 +89,7 @@ Pl_Flate::warn(char const* msg, int code)
89 void 89 void
90 Pl_Flate::write(unsigned char* data, size_t len) 90 Pl_Flate::write(unsigned char* data, size_t len)
91 { 91 {
92 - if (this->m->outbuf.getPointer() == 0) 92 + if (this->m->outbuf.get() == 0)
93 { 93 {
94 throw std::logic_error( 94 throw std::logic_error(
95 this->identifier + 95 this->identifier +
@@ -208,8 +208,8 @@ Pl_Flate::handleData(unsigned char* data, size_t len, int flush) @@ -208,8 +208,8 @@ Pl_Flate::handleData(unsigned char* data, size_t len, int flush)
208 QIntC::to_ulong(this->m->out_bufsize - zstream.avail_out); 208 QIntC::to_ulong(this->m->out_bufsize - zstream.avail_out);
209 if (ready > 0) 209 if (ready > 0)
210 { 210 {
211 - this->getNext()->write(this->m->outbuf.getPointer(), ready);  
212 - zstream.next_out = this->m->outbuf.getPointer(); 211 + this->getNext()->write(this->m->outbuf.get(), ready);
  212 + zstream.next_out = this->m->outbuf.get();
213 zstream.avail_out = QIntC::to_uint(this->m->out_bufsize); 213 zstream.avail_out = QIntC::to_uint(this->m->out_bufsize);
214 } 214 }
215 } 215 }
@@ -227,7 +227,7 @@ Pl_Flate::finish() @@ -227,7 +227,7 @@ Pl_Flate::finish()
227 { 227 {
228 try 228 try
229 { 229 {
230 - if (this->m->outbuf.getPointer()) 230 + if (this->m->outbuf.get())
231 { 231 {
232 if (this->m->initialized) 232 if (this->m->initialized)
233 { 233 {
libqpdf/Pl_PNGFilter.cc
@@ -49,10 +49,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next, @@ -49,10 +49,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next,
49 true, new unsigned char[this->bytes_per_row + 1]); 49 true, new unsigned char[this->bytes_per_row + 1]);
50 this->buf2 = PointerHolder<unsigned char>( 50 this->buf2 = PointerHolder<unsigned char>(
51 true, new unsigned char[this->bytes_per_row + 1]); 51 true, new unsigned char[this->bytes_per_row + 1]);
52 - memset(this->buf1.getPointer(), 0, this->bytes_per_row + 1);  
53 - memset(this->buf2.getPointer(), 0, this->bytes_per_row + 1);  
54 - this->cur_row = this->buf1.getPointer();  
55 - this->prev_row = this->buf2.getPointer(); 52 + memset(this->buf1.get(), 0, this->bytes_per_row + 1);
  53 + memset(this->buf2.get(), 0, this->bytes_per_row + 1);
  54 + this->cur_row = this->buf1.get();
  55 + this->prev_row = this->buf2.get();
56 56
57 // number of bytes per incoming row 57 // number of bytes per incoming row
58 this->incoming = (action == a_encode ? 58 this->incoming = (action == a_encode ?
@@ -81,7 +81,7 @@ Pl_PNGFilter::write(unsigned char* data, size_t len) @@ -81,7 +81,7 @@ Pl_PNGFilter::write(unsigned char* data, size_t len)
81 // Swap rows 81 // Swap rows
82 unsigned char* t = this->prev_row; 82 unsigned char* t = this->prev_row;
83 this->prev_row = this->cur_row; 83 this->prev_row = this->cur_row;
84 - this->cur_row = t ? t : this->buf2.getPointer(); 84 + this->cur_row = t ? t : this->buf2.get();
85 memset(this->cur_row, 0, this->bytes_per_row + 1); 85 memset(this->cur_row, 0, this->bytes_per_row + 1);
86 left = this->incoming; 86 left = this->incoming;
87 this->pos = 0; 87 this->pos = 0;
@@ -269,7 +269,7 @@ Pl_PNGFilter::finish() @@ -269,7 +269,7 @@ Pl_PNGFilter::finish()
269 processRow(); 269 processRow();
270 } 270 }
271 this->prev_row = 0; 271 this->prev_row = 0;
272 - this->cur_row = buf1.getPointer(); 272 + this->cur_row = buf1.get();
273 this->pos = 0; 273 this->pos = 0;
274 memset(this->cur_row, 0, this->bytes_per_row + 1); 274 memset(this->cur_row, 0, this->bytes_per_row + 1);
275 275
libqpdf/Pl_RC4.cc
@@ -19,7 +19,7 @@ Pl_RC4::~Pl_RC4() @@ -19,7 +19,7 @@ Pl_RC4::~Pl_RC4()
19 void 19 void
20 Pl_RC4::write(unsigned char* data, size_t len) 20 Pl_RC4::write(unsigned char* data, size_t len)
21 { 21 {
22 - if (this->outbuf.getPointer() == 0) 22 + if (this->outbuf.get() == 0)
23 { 23 {
24 throw std::logic_error( 24 throw std::logic_error(
25 this->identifier + 25 this->identifier +
@@ -35,9 +35,9 @@ Pl_RC4::write(unsigned char* data, size_t len) @@ -35,9 +35,9 @@ Pl_RC4::write(unsigned char* data, size_t len)
35 (bytes_left < this->out_bufsize ? bytes_left : out_bufsize); 35 (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
36 bytes_left -= bytes; 36 bytes_left -= bytes;
37 // lgtm[cpp/weak-cryptographic-algorithm] 37 // lgtm[cpp/weak-cryptographic-algorithm]
38 - rc4.process(p, bytes, outbuf.getPointer()); 38 + rc4.process(p, bytes, outbuf.get());
39 p += bytes; 39 p += bytes;
40 - getNext()->write(outbuf.getPointer(), bytes); 40 + getNext()->write(outbuf.get(), bytes);
41 } 41 }
42 } 42 }
43 43
libqpdf/Pl_TIFFPredictor.cc
@@ -39,7 +39,7 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(char const* identifier, Pipeline* next, @@ -39,7 +39,7 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(char const* identifier, Pipeline* next,
39 this->bytes_per_row = bpr & UINT_MAX; 39 this->bytes_per_row = bpr & UINT_MAX;
40 this->cur_row = PointerHolder<unsigned char>( 40 this->cur_row = PointerHolder<unsigned char>(
41 true, new unsigned char[this->bytes_per_row]); 41 true, new unsigned char[this->bytes_per_row]);
42 - memset(this->cur_row.getPointer(), 0, this->bytes_per_row); 42 + memset(this->cur_row.get(), 0, this->bytes_per_row);
43 } 43 }
44 44
45 Pl_TIFFPredictor::~Pl_TIFFPredictor() 45 Pl_TIFFPredictor::~Pl_TIFFPredictor()
@@ -54,20 +54,20 @@ Pl_TIFFPredictor::write(unsigned char* data, size_t len) @@ -54,20 +54,20 @@ Pl_TIFFPredictor::write(unsigned char* data, size_t len)
54 while (len >= left) 54 while (len >= left)
55 { 55 {
56 // finish off current row 56 // finish off current row
57 - memcpy(this->cur_row.getPointer() + this->pos, data + offset, left); 57 + memcpy(this->cur_row.get() + this->pos, data + offset, left);
58 offset += left; 58 offset += left;
59 len -= left; 59 len -= left;
60 60
61 processRow(); 61 processRow();
62 62
63 // Prepare for next row 63 // Prepare for next row
64 - memset(this->cur_row.getPointer(), 0, this->bytes_per_row); 64 + memset(this->cur_row.get(), 0, this->bytes_per_row);
65 left = this->bytes_per_row; 65 left = this->bytes_per_row;
66 this->pos = 0; 66 this->pos = 0;
67 } 67 }
68 if (len) 68 if (len)
69 { 69 {
70 - memcpy(this->cur_row.getPointer() + this->pos, data + offset, len); 70 + memcpy(this->cur_row.get() + this->pos, data + offset, len);
71 } 71 }
72 this->pos += len; 72 this->pos += len;
73 } 73 }
@@ -78,7 +78,7 @@ Pl_TIFFPredictor::processRow() @@ -78,7 +78,7 @@ Pl_TIFFPredictor::processRow()
78 QTC::TC("libtests", "Pl_TIFFPredictor processRow", 78 QTC::TC("libtests", "Pl_TIFFPredictor processRow",
79 (action == a_decode ? 0 : 1)); 79 (action == a_decode ? 0 : 1));
80 BitWriter bw(this->getNext()); 80 BitWriter bw(this->getNext());
81 - BitStream in(this->cur_row.getPointer(), this->bytes_per_row); 81 + BitStream in(this->cur_row.get(), this->bytes_per_row);
82 std::vector<long long> prev; 82 std::vector<long long> prev;
83 for (unsigned int i = 0; i < this->samples_per_pixel; ++i) 83 for (unsigned int i = 0; i < this->samples_per_pixel; ++i)
84 { 84 {
@@ -117,6 +117,6 @@ Pl_TIFFPredictor::finish() @@ -117,6 +117,6 @@ Pl_TIFFPredictor::finish()
117 processRow(); 117 processRow();
118 } 118 }
119 this->pos = 0; 119 this->pos = 0;
120 - memset(this->cur_row.getPointer(), 0, this->bytes_per_row); 120 + memset(this->cur_row.get(), 0, this->bytes_per_row);
121 getNext()->finish(); 121 getNext()->finish();
122 } 122 }
libqpdf/QPDF.cc
@@ -126,7 +126,7 @@ QPDF::CopiedStreamDataProvider::provideStreamData( @@ -126,7 +126,7 @@ QPDF::CopiedStreamDataProvider::provideStreamData(
126 PointerHolder<ForeignStreamData> foreign_data = 126 PointerHolder<ForeignStreamData> foreign_data =
127 this->foreign_stream_data[QPDFObjGen(objid, generation)]; 127 this->foreign_stream_data[QPDFObjGen(objid, generation)];
128 bool result = false; 128 bool result = false;
129 - if (foreign_data.getPointer()) 129 + if (foreign_data.get())
130 { 130 {
131 result = destination_qpdf.pipeForeignStreamData( 131 result = destination_qpdf.pipeForeignStreamData(
132 foreign_data, pipeline, suppress_warnings, will_retry); 132 foreign_data, pipeline, suppress_warnings, will_retry);
@@ -256,7 +256,7 @@ QPDF::~QPDF() @@ -256,7 +256,7 @@ QPDF::~QPDF()
256 iter != this->m->obj_cache.end(); ++iter) 256 iter != this->m->obj_cache.end(); ++iter)
257 { 257 {
258 QPDFObject::ObjAccessor::releaseResolved( 258 QPDFObject::ObjAccessor::releaseResolved(
259 - (*iter).second.object.getPointer()); 259 + (*iter).second.object.get());
260 } 260 }
261 } 261 }
262 262
@@ -1507,7 +1507,7 @@ QPDF::fixDanglingReferences(bool force) @@ -1507,7 +1507,7 @@ QPDF::fixDanglingReferences(bool force)
1507 { 1507 {
1508 QPDF_Array* arr = 1508 QPDF_Array* arr =
1509 dynamic_cast<QPDF_Array*>( 1509 dynamic_cast<QPDF_Array*>(
1510 - QPDFObjectHandle::ObjAccessor::getObject(obj).getPointer()); 1510 + QPDFObjectHandle::ObjAccessor::getObject(obj).get());
1511 arr->addExplicitElementsToList(to_check); 1511 arr->addExplicitElementsToList(to_check);
1512 } 1512 }
1513 for (std::list<QPDFObjectHandle>::iterator iter = to_check.begin(); 1513 for (std::list<QPDFObjectHandle>::iterator iter = to_check.begin();
@@ -1604,7 +1604,7 @@ QPDF::readObject(PointerHolder&lt;InputSource&gt; input, @@ -1604,7 +1604,7 @@ QPDF::readObject(PointerHolder&lt;InputSource&gt; input,
1604 if (this->m->encp->encrypted && (! in_object_stream)) 1604 if (this->m->encp->encrypted && (! in_object_stream))
1605 { 1605 {
1606 decrypter_ph = new StringDecrypter(this, objid, generation); 1606 decrypter_ph = new StringDecrypter(this, objid, generation);
1607 - decrypter = decrypter_ph.getPointer(); 1607 + decrypter = decrypter_ph.get();
1608 } 1608 }
1609 QPDFObjectHandle object = QPDFObjectHandle::parse( 1609 QPDFObjectHandle object = QPDFObjectHandle::parse(
1610 input, this->m->last_object_description, 1610 input, this->m->last_object_description,
@@ -2080,7 +2080,7 @@ QPDF::objectChanged(QPDFObjGen const&amp; og, PointerHolder&lt;QPDFObject&gt;&amp; oph) @@ -2080,7 +2080,7 @@ QPDF::objectChanged(QPDFObjGen const&amp; og, PointerHolder&lt;QPDFObject&gt;&amp; oph)
2080 { 2080 {
2081 return true; 2081 return true;
2082 } 2082 }
2083 - return (c->second.object.getPointer() != oph.getPointer()); 2083 + return (c->second.object.get() != oph.get());
2084 } 2084 }
2085 2085
2086 PointerHolder<QPDFObject> 2086 PointerHolder<QPDFObject>
@@ -2230,7 +2230,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number) @@ -2230,7 +2230,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2230 PointerHolder<InputSource> input = new BufferInputSource( 2230 PointerHolder<InputSource> input = new BufferInputSource(
2231 this->m->file->getName() + 2231 this->m->file->getName() +
2232 " object stream " + QUtil::int_to_string(obj_stream_number), 2232 " object stream " + QUtil::int_to_string(obj_stream_number),
2233 - bp.getPointer()); 2233 + bp.get());
2234 2234
2235 for (int i = 0; i < n; ++i) 2235 for (int i = 0; i < n; ++i)
2236 { 2236 {
@@ -2640,7 +2640,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) @@ -2640,7 +2640,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
2640 QPDF_Stream* stream = 2640 QPDF_Stream* stream =
2641 dynamic_cast<QPDF_Stream*>( 2641 dynamic_cast<QPDF_Stream*>(
2642 QPDFObjectHandle::ObjAccessor::getObject( 2642 QPDFObjectHandle::ObjAccessor::getObject(
2643 - foreign).getPointer()); 2643 + foreign).get());
2644 if (! stream) 2644 if (! stream)
2645 { 2645 {
2646 throw std::logic_error("unable to retrieve underlying" 2646 throw std::logic_error("unable to retrieve underlying"
@@ -2649,7 +2649,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) @@ -2649,7 +2649,7 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
2649 PointerHolder<Buffer> stream_buffer = 2649 PointerHolder<Buffer> stream_buffer =
2650 stream->getStreamDataBuffer(); 2650 stream->getStreamDataBuffer();
2651 if ((foreign_stream_qpdf->m->immediate_copy_from) && 2651 if ((foreign_stream_qpdf->m->immediate_copy_from) &&
2652 - (stream_buffer.getPointer() == 0)) 2652 + (stream_buffer.get() == 0))
2653 { 2653 {
2654 // Pull the stream data into a buffer before attempting 2654 // Pull the stream data into a buffer before attempting
2655 // the copy operation. Do it on the source stream so that 2655 // the copy operation. Do it on the source stream so that
@@ -2663,14 +2663,14 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) @@ -2663,14 +2663,14 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
2663 } 2663 }
2664 PointerHolder<QPDFObjectHandle::StreamDataProvider> stream_provider = 2664 PointerHolder<QPDFObjectHandle::StreamDataProvider> stream_provider =
2665 stream->getStreamDataProvider(); 2665 stream->getStreamDataProvider();
2666 - if (stream_buffer.getPointer()) 2666 + if (stream_buffer.get())
2667 { 2667 {
2668 QTC::TC("qpdf", "QPDF copy foreign stream with buffer"); 2668 QTC::TC("qpdf", "QPDF copy foreign stream with buffer");
2669 result.replaceStreamData(stream_buffer, 2669 result.replaceStreamData(stream_buffer,
2670 dict.getKey("/Filter"), 2670 dict.getKey("/Filter"),
2671 dict.getKey("/DecodeParms")); 2671 dict.getKey("/DecodeParms"));
2672 } 2672 }
2673 - else if (stream_provider.getPointer()) 2673 + else if (stream_provider.get())
2674 { 2674 {
2675 // In this case, the remote stream's QPDF must stay in scope. 2675 // In this case, the remote stream's QPDF must stay in scope.
2676 QTC::TC("qpdf", "QPDF copy foreign stream with provider"); 2676 QTC::TC("qpdf", "QPDF copy foreign stream with provider");
libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -903,7 +903,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( @@ -903,7 +903,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
903 else if ((from_qpdf != &this->qpdf) && (! from_afdh)) 903 else if ((from_qpdf != &this->qpdf) && (! from_afdh))
904 { 904 {
905 afdhph = new QPDFAcroFormDocumentHelper(*from_qpdf); 905 afdhph = new QPDFAcroFormDocumentHelper(*from_qpdf);
906 - from_afdh = afdhph.getPointer(); 906 + from_afdh = afdhph.get();
907 } 907 }
908 bool foreign = (from_qpdf != &this->qpdf); 908 bool foreign = (from_qpdf != &this->qpdf);
909 909
libqpdf/QPDFJob_config.cc
@@ -756,7 +756,7 @@ QPDFJob::Config::jobJsonFile(std::string const&amp; parameter) @@ -756,7 +756,7 @@ QPDFJob::Config::jobJsonFile(std::string const&amp; parameter)
756 QUtil::read_file_into_memory(parameter.c_str(), file_buf, size); 756 QUtil::read_file_into_memory(parameter.c_str(), file_buf, size);
757 try 757 try
758 { 758 {
759 - o.initializeFromJson(std::string(file_buf.getPointer(), size), true); 759 + o.initializeFromJson(std::string(file_buf.get(), size), true);
760 } 760 }
761 catch (std::exception& e) 761 catch (std::exception& e)
762 { 762 {
libqpdf/QPDFObjectHandle.cc
@@ -241,14 +241,14 @@ QPDFObjectHandle::releaseResolved() @@ -241,14 +241,14 @@ QPDFObjectHandle::releaseResolved()
241 // destruction. See comments in QPDF::~QPDF(). 241 // destruction. See comments in QPDF::~QPDF().
242 if (isIndirect()) 242 if (isIndirect())
243 { 243 {
244 - if (this->obj.getPointer()) 244 + if (this->obj.get())
245 { 245 {
246 this->obj = 0; 246 this->obj = 0;
247 } 247 }
248 } 248 }
249 else 249 else
250 { 250 {
251 - QPDFObject::ObjAccessor::releaseResolved(this->obj.getPointer()); 251 + QPDFObject::ObjAccessor::releaseResolved(this->obj.get());
252 } 252 }
253 } 253 }
254 254
@@ -320,7 +320,7 @@ QPDFObjectHandle::isBool() @@ -320,7 +320,7 @@ QPDFObjectHandle::isBool()
320 return false; 320 return false;
321 } 321 }
322 dereference(); 322 dereference();
323 - return QPDFObjectTypeAccessor<QPDF_Bool>::check(obj.getPointer()); 323 + return QPDFObjectTypeAccessor<QPDF_Bool>::check(obj.get());
324 } 324 }
325 325
326 bool 326 bool
@@ -329,7 +329,7 @@ QPDFObjectHandle::isDirectNull() const @@ -329,7 +329,7 @@ QPDFObjectHandle::isDirectNull() const
329 // Don't call dereference() -- this is a const method, and we know 329 // Don't call dereference() -- this is a const method, and we know
330 // objid == 0, so there's nothing to resolve. 330 // objid == 0, so there's nothing to resolve.
331 return (this->initialized && (this->objid == 0) && 331 return (this->initialized && (this->objid == 0) &&
332 - QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer())); 332 + QPDFObjectTypeAccessor<QPDF_Null>::check(obj.get()));
333 } 333 }
334 334
335 bool 335 bool
@@ -340,7 +340,7 @@ QPDFObjectHandle::isNull() @@ -340,7 +340,7 @@ QPDFObjectHandle::isNull()
340 return false; 340 return false;
341 } 341 }
342 dereference(); 342 dereference();
343 - return QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer()); 343 + return QPDFObjectTypeAccessor<QPDF_Null>::check(obj.get());
344 } 344 }
345 345
346 bool 346 bool
@@ -351,7 +351,7 @@ QPDFObjectHandle::isInteger() @@ -351,7 +351,7 @@ QPDFObjectHandle::isInteger()
351 return false; 351 return false;
352 } 352 }
353 dereference(); 353 dereference();
354 - return QPDFObjectTypeAccessor<QPDF_Integer>::check(obj.getPointer()); 354 + return QPDFObjectTypeAccessor<QPDF_Integer>::check(obj.get());
355 } 355 }
356 356
357 bool 357 bool
@@ -362,7 +362,7 @@ QPDFObjectHandle::isReal() @@ -362,7 +362,7 @@ QPDFObjectHandle::isReal()
362 return false; 362 return false;
363 } 363 }
364 dereference(); 364 dereference();
365 - return QPDFObjectTypeAccessor<QPDF_Real>::check(obj.getPointer()); 365 + return QPDFObjectTypeAccessor<QPDF_Real>::check(obj.get());
366 } 366 }
367 367
368 bool 368 bool
@@ -399,7 +399,7 @@ QPDFObjectHandle::isName() @@ -399,7 +399,7 @@ QPDFObjectHandle::isName()
399 return false; 399 return false;
400 } 400 }
401 dereference(); 401 dereference();
402 - return QPDFObjectTypeAccessor<QPDF_Name>::check(obj.getPointer()); 402 + return QPDFObjectTypeAccessor<QPDF_Name>::check(obj.get());
403 } 403 }
404 404
405 bool 405 bool
@@ -410,7 +410,7 @@ QPDFObjectHandle::isString() @@ -410,7 +410,7 @@ QPDFObjectHandle::isString()
410 return false; 410 return false;
411 } 411 }
412 dereference(); 412 dereference();
413 - return QPDFObjectTypeAccessor<QPDF_String>::check(obj.getPointer()); 413 + return QPDFObjectTypeAccessor<QPDF_String>::check(obj.get());
414 } 414 }
415 415
416 bool 416 bool
@@ -421,7 +421,7 @@ QPDFObjectHandle::isOperator() @@ -421,7 +421,7 @@ QPDFObjectHandle::isOperator()
421 return false; 421 return false;
422 } 422 }
423 dereference(); 423 dereference();
424 - return QPDFObjectTypeAccessor<QPDF_Operator>::check(obj.getPointer()); 424 + return QPDFObjectTypeAccessor<QPDF_Operator>::check(obj.get());
425 } 425 }
426 426
427 bool 427 bool
@@ -432,7 +432,7 @@ QPDFObjectHandle::isInlineImage() @@ -432,7 +432,7 @@ QPDFObjectHandle::isInlineImage()
432 return false; 432 return false;
433 } 433 }
434 dereference(); 434 dereference();
435 - return QPDFObjectTypeAccessor<QPDF_InlineImage>::check(obj.getPointer()); 435 + return QPDFObjectTypeAccessor<QPDF_InlineImage>::check(obj.get());
436 } 436 }
437 437
438 bool 438 bool
@@ -443,7 +443,7 @@ QPDFObjectHandle::isArray() @@ -443,7 +443,7 @@ QPDFObjectHandle::isArray()
443 return false; 443 return false;
444 } 444 }
445 dereference(); 445 dereference();
446 - return QPDFObjectTypeAccessor<QPDF_Array>::check(obj.getPointer()); 446 + return QPDFObjectTypeAccessor<QPDF_Array>::check(obj.get());
447 } 447 }
448 448
449 bool 449 bool
@@ -454,7 +454,7 @@ QPDFObjectHandle::isDictionary() @@ -454,7 +454,7 @@ QPDFObjectHandle::isDictionary()
454 return false; 454 return false;
455 } 455 }
456 dereference(); 456 dereference();
457 - return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(obj.getPointer()); 457 + return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(obj.get());
458 } 458 }
459 459
460 bool 460 bool
@@ -465,7 +465,7 @@ QPDFObjectHandle::isStream() @@ -465,7 +465,7 @@ QPDFObjectHandle::isStream()
465 return false; 465 return false;
466 } 466 }
467 dereference(); 467 dereference();
468 - return QPDFObjectTypeAccessor<QPDF_Stream>::check(obj.getPointer()); 468 + return QPDFObjectTypeAccessor<QPDF_Stream>::check(obj.get());
469 } 469 }
470 470
471 bool 471 bool
@@ -526,7 +526,7 @@ QPDFObjectHandle::getBoolValue() @@ -526,7 +526,7 @@ QPDFObjectHandle::getBoolValue()
526 { 526 {
527 if (isBool()) 527 if (isBool())
528 { 528 {
529 - return dynamic_cast<QPDF_Bool*>(obj.getPointer())->getVal(); 529 + return dynamic_cast<QPDF_Bool*>(obj.get())->getVal();
530 } 530 }
531 else 531 else
532 { 532 {
@@ -543,7 +543,7 @@ QPDFObjectHandle::getIntValue() @@ -543,7 +543,7 @@ QPDFObjectHandle::getIntValue()
543 { 543 {
544 if (isInteger()) 544 if (isInteger())
545 { 545 {
546 - return dynamic_cast<QPDF_Integer*>(obj.getPointer())->getVal(); 546 + return dynamic_cast<QPDF_Integer*>(obj.get())->getVal();
547 } 547 }
548 else 548 else
549 { 549 {
@@ -636,7 +636,7 @@ QPDFObjectHandle::getRealValue() @@ -636,7 +636,7 @@ QPDFObjectHandle::getRealValue()
636 { 636 {
637 if (isReal()) 637 if (isReal())
638 { 638 {
639 - return dynamic_cast<QPDF_Real*>(obj.getPointer())->getVal(); 639 + return dynamic_cast<QPDF_Real*>(obj.get())->getVal();
640 } 640 }
641 else 641 else
642 { 642 {
@@ -653,7 +653,7 @@ QPDFObjectHandle::getName() @@ -653,7 +653,7 @@ QPDFObjectHandle::getName()
653 { 653 {
654 if (isName()) 654 if (isName())
655 { 655 {
656 - return dynamic_cast<QPDF_Name*>(obj.getPointer())->getName(); 656 + return dynamic_cast<QPDF_Name*>(obj.get())->getName();
657 } 657 }
658 else 658 else
659 { 659 {
@@ -670,7 +670,7 @@ QPDFObjectHandle::getStringValue() @@ -670,7 +670,7 @@ QPDFObjectHandle::getStringValue()
670 { 670 {
671 if (isString()) 671 if (isString())
672 { 672 {
673 - return dynamic_cast<QPDF_String*>(obj.getPointer())->getVal(); 673 + return dynamic_cast<QPDF_String*>(obj.get())->getVal();
674 } 674 }
675 else 675 else
676 { 676 {
@@ -685,7 +685,7 @@ QPDFObjectHandle::getUTF8Value() @@ -685,7 +685,7 @@ QPDFObjectHandle::getUTF8Value()
685 { 685 {
686 if (isString()) 686 if (isString())
687 { 687 {
688 - return dynamic_cast<QPDF_String*>(obj.getPointer())->getUTF8Val(); 688 + return dynamic_cast<QPDF_String*>(obj.get())->getUTF8Val();
689 } 689 }
690 else 690 else
691 { 691 {
@@ -702,7 +702,7 @@ QPDFObjectHandle::getOperatorValue() @@ -702,7 +702,7 @@ QPDFObjectHandle::getOperatorValue()
702 { 702 {
703 if (isOperator()) 703 if (isOperator())
704 { 704 {
705 - return dynamic_cast<QPDF_Operator*>(obj.getPointer())->getVal(); 705 + return dynamic_cast<QPDF_Operator*>(obj.get())->getVal();
706 } 706 }
707 else 707 else
708 { 708 {
@@ -717,7 +717,7 @@ QPDFObjectHandle::getInlineImageValue() @@ -717,7 +717,7 @@ QPDFObjectHandle::getInlineImageValue()
717 { 717 {
718 if (isInlineImage()) 718 if (isInlineImage())
719 { 719 {
720 - return dynamic_cast<QPDF_InlineImage*>(obj.getPointer())->getVal(); 720 + return dynamic_cast<QPDF_InlineImage*>(obj.get())->getVal();
721 } 721 }
722 else 722 else
723 { 723 {
@@ -740,7 +740,7 @@ QPDFObjectHandle::getArrayNItems() @@ -740,7 +740,7 @@ QPDFObjectHandle::getArrayNItems()
740 { 740 {
741 if (isArray()) 741 if (isArray())
742 { 742 {
743 - return dynamic_cast<QPDF_Array*>(obj.getPointer())->getNItems(); 743 + return dynamic_cast<QPDF_Array*>(obj.get())->getNItems();
744 } 744 }
745 else 745 else
746 { 746 {
@@ -756,7 +756,7 @@ QPDFObjectHandle::getArrayItem(int n) @@ -756,7 +756,7 @@ QPDFObjectHandle::getArrayItem(int n)
756 QPDFObjectHandle result; 756 QPDFObjectHandle result;
757 if (isArray() && (n < getArrayNItems()) && (n >= 0)) 757 if (isArray() && (n < getArrayNItems()) && (n >= 0))
758 { 758 {
759 - result = dynamic_cast<QPDF_Array*>(obj.getPointer())->getItem(n); 759 + result = dynamic_cast<QPDF_Array*>(obj.get())->getItem(n);
760 } 760 }
761 else 761 else
762 { 762 {
@@ -869,7 +869,7 @@ QPDFObjectHandle::getArrayAsVector() @@ -869,7 +869,7 @@ QPDFObjectHandle::getArrayAsVector()
869 std::vector<QPDFObjectHandle> result; 869 std::vector<QPDFObjectHandle> result;
870 if (isArray()) 870 if (isArray())
871 { 871 {
872 - dynamic_cast<QPDF_Array*>(obj.getPointer())->getAsVector(result); 872 + dynamic_cast<QPDF_Array*>(obj.get())->getAsVector(result);
873 } 873 }
874 else 874 else
875 { 875 {
@@ -887,7 +887,7 @@ QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const&amp; item) @@ -887,7 +887,7 @@ QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const&amp; item)
887 if (isArray()) 887 if (isArray())
888 { 888 {
889 checkOwnership(item); 889 checkOwnership(item);
890 - dynamic_cast<QPDF_Array*>(obj.getPointer())->setItem(n, item); 890 + dynamic_cast<QPDF_Array*>(obj.get())->setItem(n, item);
891 } 891 }
892 else 892 else
893 { 893 {
@@ -905,7 +905,7 @@ QPDFObjectHandle::setArrayFromVector(std::vector&lt;QPDFObjectHandle&gt; const&amp; items) @@ -905,7 +905,7 @@ QPDFObjectHandle::setArrayFromVector(std::vector&lt;QPDFObjectHandle&gt; const&amp; items)
905 { 905 {
906 checkOwnership(item); 906 checkOwnership(item);
907 } 907 }
908 - dynamic_cast<QPDF_Array*>(obj.getPointer())->setFromVector(items); 908 + dynamic_cast<QPDF_Array*>(obj.get())->setFromVector(items);
909 } 909 }
910 else 910 else
911 { 911 {
@@ -919,7 +919,7 @@ QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const&amp; item) @@ -919,7 +919,7 @@ QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const&amp; item)
919 { 919 {
920 if (isArray()) 920 if (isArray())
921 { 921 {
922 - dynamic_cast<QPDF_Array*>(obj.getPointer())->insertItem(at, item); 922 + dynamic_cast<QPDF_Array*>(obj.get())->insertItem(at, item);
923 } 923 }
924 else 924 else
925 { 925 {
@@ -934,7 +934,7 @@ QPDFObjectHandle::appendItem(QPDFObjectHandle const&amp; item) @@ -934,7 +934,7 @@ QPDFObjectHandle::appendItem(QPDFObjectHandle const&amp; item)
934 if (isArray()) 934 if (isArray())
935 { 935 {
936 checkOwnership(item); 936 checkOwnership(item);
937 - dynamic_cast<QPDF_Array*>(obj.getPointer())->appendItem(item); 937 + dynamic_cast<QPDF_Array*>(obj.get())->appendItem(item);
938 } 938 }
939 else 939 else
940 { 940 {
@@ -948,7 +948,7 @@ QPDFObjectHandle::eraseItem(int at) @@ -948,7 +948,7 @@ QPDFObjectHandle::eraseItem(int at)
948 { 948 {
949 if (isArray() && (at < getArrayNItems()) && (at >= 0)) 949 if (isArray() && (at < getArrayNItems()) && (at >= 0))
950 { 950 {
951 - dynamic_cast<QPDF_Array*>(obj.getPointer())->eraseItem(at); 951 + dynamic_cast<QPDF_Array*>(obj.get())->eraseItem(at);
952 } 952 }
953 else 953 else
954 { 954 {
@@ -978,7 +978,7 @@ QPDFObjectHandle::hasKey(std::string const&amp; key) @@ -978,7 +978,7 @@ QPDFObjectHandle::hasKey(std::string const&amp; key)
978 { 978 {
979 if (isDictionary()) 979 if (isDictionary())
980 { 980 {
981 - return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->hasKey(key); 981 + return dynamic_cast<QPDF_Dictionary*>(obj.get())->hasKey(key);
982 } 982 }
983 else 983 else
984 { 984 {
@@ -996,7 +996,7 @@ QPDFObjectHandle::getKey(std::string const&amp; key) @@ -996,7 +996,7 @@ QPDFObjectHandle::getKey(std::string const&amp; key)
996 if (isDictionary()) 996 if (isDictionary())
997 { 997 {
998 result = dynamic_cast<QPDF_Dictionary*>( 998 result = dynamic_cast<QPDF_Dictionary*>(
999 - obj.getPointer())->getKey(key); 999 + obj.get())->getKey(key);
1000 } 1000 }
1001 else 1001 else
1002 { 1002 {
@@ -1024,7 +1024,7 @@ QPDFObjectHandle::getKeys() @@ -1024,7 +1024,7 @@ QPDFObjectHandle::getKeys()
1024 std::set<std::string> result; 1024 std::set<std::string> result;
1025 if (isDictionary()) 1025 if (isDictionary())
1026 { 1026 {
1027 - result = dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getKeys(); 1027 + result = dynamic_cast<QPDF_Dictionary*>(obj.get())->getKeys();
1028 } 1028 }
1029 else 1029 else
1030 { 1030 {
@@ -1041,7 +1041,7 @@ QPDFObjectHandle::getDictAsMap() @@ -1041,7 +1041,7 @@ QPDFObjectHandle::getDictAsMap()
1041 if (isDictionary()) 1041 if (isDictionary())
1042 { 1042 {
1043 result = dynamic_cast<QPDF_Dictionary*>( 1043 result = dynamic_cast<QPDF_Dictionary*>(
1044 - obj.getPointer())->getAsMap(); 1044 + obj.get())->getAsMap();
1045 } 1045 }
1046 else 1046 else
1047 { 1047 {
@@ -1311,7 +1311,7 @@ QPDFObjectHandle::replaceKey(std::string const&amp; key, @@ -1311,7 +1311,7 @@ QPDFObjectHandle::replaceKey(std::string const&amp; key,
1311 { 1311 {
1312 checkOwnership(value); 1312 checkOwnership(value);
1313 dynamic_cast<QPDF_Dictionary*>( 1313 dynamic_cast<QPDF_Dictionary*>(
1314 - obj.getPointer())->replaceKey(key, value); 1314 + obj.get())->replaceKey(key, value);
1315 } 1315 }
1316 else 1316 else
1317 { 1317 {
@@ -1325,7 +1325,7 @@ QPDFObjectHandle::removeKey(std::string const&amp; key) @@ -1325,7 +1325,7 @@ QPDFObjectHandle::removeKey(std::string const&amp; key)
1325 { 1325 {
1326 if (isDictionary()) 1326 if (isDictionary())
1327 { 1327 {
1328 - dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->removeKey(key); 1328 + dynamic_cast<QPDF_Dictionary*>(obj.get())->removeKey(key);
1329 } 1329 }
1330 else 1330 else
1331 { 1331 {
@@ -1342,7 +1342,7 @@ QPDFObjectHandle::replaceOrRemoveKey(std::string const&amp; key, @@ -1342,7 +1342,7 @@ QPDFObjectHandle::replaceOrRemoveKey(std::string const&amp; key,
1342 { 1342 {
1343 checkOwnership(value); 1343 checkOwnership(value);
1344 dynamic_cast<QPDF_Dictionary*>( 1344 dynamic_cast<QPDF_Dictionary*>(
1345 - obj.getPointer())->replaceOrRemoveKey(key, value); 1345 + obj.get())->replaceOrRemoveKey(key, value);
1346 } 1346 }
1347 else 1347 else
1348 { 1348 {
@@ -1356,35 +1356,35 @@ QPDFObjectHandle @@ -1356,35 +1356,35 @@ QPDFObjectHandle
1356 QPDFObjectHandle::getDict() 1356 QPDFObjectHandle::getDict()
1357 { 1357 {
1358 assertStream(); 1358 assertStream();
1359 - return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getDict(); 1359 + return dynamic_cast<QPDF_Stream*>(obj.get())->getDict();
1360 } 1360 }
1361 1361
1362 void 1362 void
1363 QPDFObjectHandle::setFilterOnWrite(bool val) 1363 QPDFObjectHandle::setFilterOnWrite(bool val)
1364 { 1364 {
1365 assertStream(); 1365 assertStream();
1366 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->setFilterOnWrite(val); 1366 + dynamic_cast<QPDF_Stream*>(obj.get())->setFilterOnWrite(val);
1367 } 1367 }
1368 1368
1369 bool 1369 bool
1370 QPDFObjectHandle::getFilterOnWrite() 1370 QPDFObjectHandle::getFilterOnWrite()
1371 { 1371 {
1372 assertStream(); 1372 assertStream();
1373 - return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getFilterOnWrite(); 1373 + return dynamic_cast<QPDF_Stream*>(obj.get())->getFilterOnWrite();
1374 } 1374 }
1375 1375
1376 bool 1376 bool
1377 QPDFObjectHandle::isDataModified() 1377 QPDFObjectHandle::isDataModified()
1378 { 1378 {
1379 assertStream(); 1379 assertStream();
1380 - return dynamic_cast<QPDF_Stream*>(obj.getPointer())->isDataModified(); 1380 + return dynamic_cast<QPDF_Stream*>(obj.get())->isDataModified();
1381 } 1381 }
1382 1382
1383 void 1383 void
1384 QPDFObjectHandle::replaceDict(QPDFObjectHandle new_dict) 1384 QPDFObjectHandle::replaceDict(QPDFObjectHandle new_dict)
1385 { 1385 {
1386 assertStream(); 1386 assertStream();
1387 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceDict(new_dict); 1387 + dynamic_cast<QPDF_Stream*>(obj.get())->replaceDict(new_dict);
1388 } 1388 }
1389 1389
1390 PointerHolder<Buffer> 1390 PointerHolder<Buffer>
@@ -1392,14 +1392,14 @@ QPDFObjectHandle::getStreamData(qpdf_stream_decode_level_e level) @@ -1392,14 +1392,14 @@ QPDFObjectHandle::getStreamData(qpdf_stream_decode_level_e level)
1392 { 1392 {
1393 assertStream(); 1393 assertStream();
1394 return dynamic_cast<QPDF_Stream*>( 1394 return dynamic_cast<QPDF_Stream*>(
1395 - obj.getPointer())->getStreamData(level); 1395 + obj.get())->getStreamData(level);
1396 } 1396 }
1397 1397
1398 PointerHolder<Buffer> 1398 PointerHolder<Buffer>
1399 QPDFObjectHandle::getRawStreamData() 1399 QPDFObjectHandle::getRawStreamData()
1400 { 1400 {
1401 assertStream(); 1401 assertStream();
1402 - return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getRawStreamData(); 1402 + return dynamic_cast<QPDF_Stream*>(obj.get())->getRawStreamData();
1403 } 1403 }
1404 1404
1405 bool 1405 bool
@@ -1409,7 +1409,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, bool* filtering_attempted, @@ -1409,7 +1409,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, bool* filtering_attempted,
1409 bool suppress_warnings, bool will_retry) 1409 bool suppress_warnings, bool will_retry)
1410 { 1410 {
1411 assertStream(); 1411 assertStream();
1412 - return dynamic_cast<QPDF_Stream*>(obj.getPointer())->pipeStreamData( 1412 + return dynamic_cast<QPDF_Stream*>(obj.get())->pipeStreamData(
1413 p, filtering_attempted, encode_flags, decode_level, 1413 p, filtering_attempted, encode_flags, decode_level,
1414 suppress_warnings, will_retry); 1414 suppress_warnings, will_retry);
1415 } 1415 }
@@ -1422,7 +1422,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, @@ -1422,7 +1422,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p,
1422 { 1422 {
1423 assertStream(); 1423 assertStream();
1424 bool filtering_attempted; 1424 bool filtering_attempted;
1425 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->pipeStreamData( 1425 + dynamic_cast<QPDF_Stream*>(obj.get())->pipeStreamData(
1426 p, &filtering_attempted, encode_flags, decode_level, 1426 p, &filtering_attempted, encode_flags, decode_level,
1427 suppress_warnings, will_retry); 1427 suppress_warnings, will_retry);
1428 return filtering_attempted; 1428 return filtering_attempted;
@@ -1455,7 +1455,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder&lt;Buffer&gt; data, @@ -1455,7 +1455,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder&lt;Buffer&gt; data,
1455 QPDFObjectHandle const& decode_parms) 1455 QPDFObjectHandle const& decode_parms)
1456 { 1456 {
1457 assertStream(); 1457 assertStream();
1458 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( 1458 + dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
1459 data, filter, decode_parms); 1459 data, filter, decode_parms);
1460 } 1460 }
1461 1461
@@ -1468,7 +1468,7 @@ QPDFObjectHandle::replaceStreamData(std::string const&amp; data, @@ -1468,7 +1468,7 @@ QPDFObjectHandle::replaceStreamData(std::string const&amp; data,
1468 PointerHolder<Buffer> b = new Buffer(data.length()); 1468 PointerHolder<Buffer> b = new Buffer(data.length());
1469 unsigned char* bp = b->getBuffer(); 1469 unsigned char* bp = b->getBuffer();
1470 memcpy(bp, data.c_str(), data.length()); 1470 memcpy(bp, data.c_str(), data.length());
1471 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( 1471 + dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
1472 b, filter, decode_parms); 1472 b, filter, decode_parms);
1473 } 1473 }
1474 1474
@@ -1478,7 +1478,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder&lt;StreamDataProvider&gt; provider, @@ -1478,7 +1478,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder&lt;StreamDataProvider&gt; provider,
1478 QPDFObjectHandle const& decode_parms) 1478 QPDFObjectHandle const& decode_parms)
1479 { 1479 {
1480 assertStream(); 1480 assertStream();
1481 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( 1481 + dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
1482 provider, filter, decode_parms); 1482 provider, filter, decode_parms);
1483 } 1483 }
1484 1484
@@ -1522,7 +1522,7 @@ QPDFObjectHandle::replaceStreamData(std::function&lt;void(Pipeline*)&gt; provider, @@ -1522,7 +1522,7 @@ QPDFObjectHandle::replaceStreamData(std::function&lt;void(Pipeline*)&gt; provider,
1522 { 1522 {
1523 assertStream(); 1523 assertStream();
1524 PointerHolder<StreamDataProvider> sdp = new FunctionProvider(provider); 1524 PointerHolder<StreamDataProvider> sdp = new FunctionProvider(provider);
1525 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( 1525 + dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
1526 sdp, filter, decode_parms); 1526 sdp, filter, decode_parms);
1527 } 1527 }
1528 1528
@@ -1534,7 +1534,7 @@ QPDFObjectHandle::replaceStreamData( @@ -1534,7 +1534,7 @@ QPDFObjectHandle::replaceStreamData(
1534 { 1534 {
1535 assertStream(); 1535 assertStream();
1536 PointerHolder<StreamDataProvider> sdp = new FunctionProvider(provider); 1536 PointerHolder<StreamDataProvider> sdp = new FunctionProvider(provider);
1537 - dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( 1537 + dynamic_cast<QPDF_Stream*>(obj.get())->replaceStreamData(
1538 sdp, filter, decode_parms); 1538 sdp, filter, decode_parms);
1539 } 1539 }
1540 1540
@@ -1787,7 +1787,7 @@ QPDFObjectHandle::unparseBinary() @@ -1787,7 +1787,7 @@ QPDFObjectHandle::unparseBinary()
1787 if (this->isString()) 1787 if (this->isString())
1788 { 1788 {
1789 return dynamic_cast<QPDF_String*>( 1789 return dynamic_cast<QPDF_String*>(
1790 - this->obj.getPointer())->unparse(true); 1790 + this->obj.get())->unparse(true);
1791 } 1791 }
1792 else 1792 else
1793 { 1793 {
@@ -1988,7 +1988,7 @@ QPDFObjectHandle::parseContentStream_data( @@ -1988,7 +1988,7 @@ QPDFObjectHandle::parseContentStream_data(
1988 { 1988 {
1989 size_t stream_length = stream_data->getSize(); 1989 size_t stream_length = stream_data->getSize();
1990 PointerHolder<InputSource> input = 1990 PointerHolder<InputSource> input =
1991 - new BufferInputSource(description, stream_data.getPointer()); 1991 + new BufferInputSource(description, stream_data.get());
1992 QPDFTokenizer tokenizer; 1992 QPDFTokenizer tokenizer;
1993 tokenizer.allowEOF(); 1993 tokenizer.allowEOF();
1994 bool empty = false; 1994 bool empty = false;
@@ -2055,7 +2055,7 @@ QPDFObjectHandle::addTokenFilter(PointerHolder&lt;TokenFilter&gt; filter) @@ -2055,7 +2055,7 @@ QPDFObjectHandle::addTokenFilter(PointerHolder&lt;TokenFilter&gt; filter)
2055 { 2055 {
2056 assertStream(); 2056 assertStream();
2057 return dynamic_cast<QPDF_Stream*>( 2057 return dynamic_cast<QPDF_Stream*>(
2058 - obj.getPointer())->addTokenFilter(filter); 2058 + obj.get())->addTokenFilter(filter);
2059 } 2059 }
2060 2060
2061 QPDFObjectHandle 2061 QPDFObjectHandle
@@ -2575,7 +2575,7 @@ QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset) @@ -2575,7 +2575,7 @@ QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
2575 { 2575 {
2576 // This is called during parsing on newly created direct objects, 2576 // This is called during parsing on newly created direct objects,
2577 // so we can't call dereference() here. 2577 // so we can't call dereference() here.
2578 - if (this->obj.getPointer()) 2578 + if (this->obj.get())
2579 { 2579 {
2580 this->obj->setParsedOffset(offset); 2580 this->obj->setParsedOffset(offset);
2581 } 2581 }
@@ -2777,7 +2777,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf) @@ -2777,7 +2777,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf)
2777 new QPDF_Stream(qpdf, 0, 0, stream_dict, 0, 0))); 2777 new QPDF_Stream(qpdf, 0, 0, stream_dict, 0, 0)));
2778 result.dereference(); 2778 result.dereference();
2779 QPDF_Stream* stream = 2779 QPDF_Stream* stream =
2780 - dynamic_cast<QPDF_Stream*>(result.obj.getPointer()); 2780 + dynamic_cast<QPDF_Stream*>(result.obj.get());
2781 stream->setObjGen(result.getObjectID(), result.getGeneration()); 2781 stream->setObjGen(result.getObjectID(), result.getGeneration());
2782 return result; 2782 return result;
2783 } 2783 }
@@ -2819,7 +2819,7 @@ QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf, @@ -2819,7 +2819,7 @@ QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf,
2819 { 2819 {
2820 // This is called during parsing on newly created direct objects, 2820 // This is called during parsing on newly created direct objects,
2821 // so we can't call dereference() here. 2821 // so we can't call dereference() here.
2822 - if (isInitialized() && this->obj.getPointer()) 2822 + if (isInitialized() && this->obj.get())
2823 { 2823 {
2824 this->obj->setDescription(owning_qpdf, object_description); 2824 this->obj->setDescription(owning_qpdf, object_description);
2825 } 2825 }
@@ -2831,7 +2831,7 @@ QPDFObjectHandle::hasObjectDescription() @@ -2831,7 +2831,7 @@ QPDFObjectHandle::hasObjectDescription()
2831 if (isInitialized()) 2831 if (isInitialized())
2832 { 2832 {
2833 dereference(); 2833 dereference();
2834 - if (this->obj.getPointer()) 2834 + if (this->obj.get())
2835 { 2835 {
2836 return this->obj->hasDescription(); 2836 return this->obj->hasDescription();
2837 } 2837 }
@@ -2872,7 +2872,7 @@ QPDFObjectHandle::shallowCopyInternal(QPDFObjectHandle&amp; new_obj, @@ -2872,7 +2872,7 @@ QPDFObjectHandle::shallowCopyInternal(QPDFObjectHandle&amp; new_obj,
2872 { 2872 {
2873 QTC::TC("qpdf", "QPDFObjectHandle shallow copy array"); 2873 QTC::TC("qpdf", "QPDFObjectHandle shallow copy array");
2874 // No newArray for shallow copying the sparse array 2874 // No newArray for shallow copying the sparse array
2875 - QPDF_Array* arr = dynamic_cast<QPDF_Array*>(obj.getPointer()); 2875 + QPDF_Array* arr = dynamic_cast<QPDF_Array*>(obj.get());
2876 new_obj = QPDFObjectHandle( 2876 new_obj = QPDFObjectHandle(
2877 new QPDF_Array(arr->getElementsForShallowCopy())); 2877 new QPDF_Array(arr->getElementsForShallowCopy()));
2878 } 2878 }
@@ -3309,23 +3309,23 @@ QPDFObjectHandle::dereference() @@ -3309,23 +3309,23 @@ QPDFObjectHandle::dereference()
3309 throw std::logic_error( 3309 throw std::logic_error(
3310 "attempted to dereference an uninitialized QPDFObjectHandle"); 3310 "attempted to dereference an uninitialized QPDFObjectHandle");
3311 } 3311 }
3312 - if (this->obj.getPointer() && this->objid && 3312 + if (this->obj.get() && this->objid &&
3313 QPDF::Resolver::objectChanged( 3313 QPDF::Resolver::objectChanged(
3314 this->qpdf, QPDFObjGen(this->objid, this->generation), this->obj)) 3314 this->qpdf, QPDFObjGen(this->objid, this->generation), this->obj))
3315 { 3315 {
3316 this->obj = nullptr; 3316 this->obj = nullptr;
3317 } 3317 }
3318 - if (this->obj.getPointer() == 0) 3318 + if (this->obj.get() == 0)
3319 { 3319 {
3320 PointerHolder<QPDFObject> obj = QPDF::Resolver::resolve( 3320 PointerHolder<QPDFObject> obj = QPDF::Resolver::resolve(
3321 this->qpdf, this->objid, this->generation); 3321 this->qpdf, this->objid, this->generation);
3322 - if (obj.getPointer() == 0) 3322 + if (obj.get() == 0)
3323 { 3323 {
3324 // QPDF::resolve never returns an uninitialized object, but 3324 // QPDF::resolve never returns an uninitialized object, but
3325 // check just in case. 3325 // check just in case.
3326 this->obj = new QPDF_Null(); 3326 this->obj = new QPDF_Null();
3327 } 3327 }
3328 - else if (dynamic_cast<QPDF_Reserved*>(obj.getPointer())) 3328 + else if (dynamic_cast<QPDF_Reserved*>(obj.get()))
3329 { 3329 {
3330 // Do not resolve 3330 // Do not resolve
3331 } 3331 }
libqpdf/QPDFOutlineDocumentHelper.cc
@@ -104,7 +104,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) @@ -104,7 +104,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
104 } 104 }
105 else if (name.isString()) 105 else if (name.isString())
106 { 106 {
107 - if (0 == this->m->names_dest.getPointer()) 107 + if (0 == this->m->names_dest.get())
108 { 108 {
109 QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names"); 109 QPDFObjectHandle names = this->qpdf.getRoot().getKey("/Names");
110 if (names.isDictionary()) 110 if (names.isDictionary())
@@ -117,7 +117,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) @@ -117,7 +117,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
117 } 117 }
118 } 118 }
119 } 119 }
120 - if (this->m->names_dest.getPointer()) 120 + if (this->m->names_dest.get())
121 { 121 {
122 if (this->m->names_dest->findObject(name.getUTF8Value(), result)) 122 if (this->m->names_dest->findObject(name.getUTF8Value(), result))
123 { 123 {
libqpdf/QPDFPageLabelDocumentHelper.cc
@@ -24,7 +24,7 @@ QPDFPageLabelDocumentHelper::QPDFPageLabelDocumentHelper(QPDF&amp; qpdf) : @@ -24,7 +24,7 @@ QPDFPageLabelDocumentHelper::QPDFPageLabelDocumentHelper(QPDF&amp; qpdf) :
24 bool 24 bool
25 QPDFPageLabelDocumentHelper::hasPageLabels() 25 QPDFPageLabelDocumentHelper::hasPageLabels()
26 { 26 {
27 - return 0 != this->m->labels.getPointer(); 27 + return 0 != this->m->labels.get();
28 } 28 }
29 29
30 QPDFObjectHandle 30 QPDFObjectHandle
libqpdf/QPDFPageObjectHelper.cc
@@ -1222,7 +1222,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh) @@ -1222,7 +1222,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh)
1222 if (! afdh) 1222 if (! afdh)
1223 { 1223 {
1224 afdhph = new QPDFAcroFormDocumentHelper(*qpdf); 1224 afdhph = new QPDFAcroFormDocumentHelper(*qpdf);
1225 - afdh = afdhph.getPointer(); 1225 + afdh = afdhph.get();
1226 } 1226 }
1227 afdh->transformAnnotations( 1227 afdh->transformAnnotations(
1228 annots, new_annots, new_fields, old_fields, cm); 1228 annots, new_annots, new_fields, old_fields, cm);
@@ -1270,7 +1270,7 @@ QPDFPageObjectHelper::copyAnnotations( @@ -1270,7 +1270,7 @@ QPDFPageObjectHelper::copyAnnotations(
1270 if (! afdh) 1270 if (! afdh)
1271 { 1271 {
1272 afdhph = new QPDFAcroFormDocumentHelper(*this_qpdf); 1272 afdhph = new QPDFAcroFormDocumentHelper(*this_qpdf);
1273 - afdh = afdhph.getPointer(); 1273 + afdh = afdhph.get();
1274 } 1274 }
1275 if (this_qpdf == from_qpdf) 1275 if (this_qpdf == from_qpdf)
1276 { 1276 {
@@ -1288,7 +1288,7 @@ QPDFPageObjectHelper::copyAnnotations( @@ -1288,7 +1288,7 @@ QPDFPageObjectHelper::copyAnnotations(
1288 else 1288 else
1289 { 1289 {
1290 from_afdhph = new QPDFAcroFormDocumentHelper(*from_qpdf); 1290 from_afdhph = new QPDFAcroFormDocumentHelper(*from_qpdf);
1291 - from_afdh = from_afdhph.getPointer(); 1291 + from_afdh = from_afdhph.get();
1292 } 1292 }
1293 1293
1294 afdh->transformAnnotations( 1294 afdh->transformAnnotations(
libqpdf/QPDFTokenizer.cc
@@ -652,7 +652,7 @@ QPDFTokenizer::expectInlineImage(PointerHolder&lt;InputSource&gt; input) @@ -652,7 +652,7 @@ QPDFTokenizer::expectInlineImage(PointerHolder&lt;InputSource&gt; input)
652 void 652 void
653 QPDFTokenizer::findEI(PointerHolder<InputSource> input) 653 QPDFTokenizer::findEI(PointerHolder<InputSource> input)
654 { 654 {
655 - if (! input.getPointer()) 655 + if (! input.get())
656 { 656 {
657 return; 657 return;
658 } 658 }
libqpdf/QPDFWriter.cc
@@ -3581,7 +3581,7 @@ QPDFWriter::indicateProgress(bool decrement, bool finished) @@ -3581,7 +3581,7 @@ QPDFWriter::indicateProgress(bool decrement, bool finished)
3581 3581
3582 ++this->m->events_seen; 3582 ++this->m->events_seen;
3583 3583
3584 - if (! this->m->progress_reporter.getPointer()) 3584 + if (! this->m->progress_reporter.get())
3585 { 3585 {
3586 return; 3586 return;
3587 } 3587 }
libqpdf/QPDF_Stream.cc
@@ -479,7 +479,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, @@ -479,7 +479,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
479 { 479 {
480 normalizer = new ContentNormalizer(); 480 normalizer = new ContentNormalizer();
481 pipeline = new Pl_QPDFTokenizer( 481 pipeline = new Pl_QPDFTokenizer(
482 - "normalizer", normalizer.getPointer(), pipeline); 482 + "normalizer", normalizer.get(), pipeline);
483 to_delete.push_back(pipeline); 483 to_delete.push_back(pipeline);
484 } 484 }
485 485
@@ -489,7 +489,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, @@ -489,7 +489,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
489 iter != this->token_filters.rend(); ++iter) 489 iter != this->token_filters.rend(); ++iter)
490 { 490 {
491 pipeline = new Pl_QPDFTokenizer( 491 pipeline = new Pl_QPDFTokenizer(
492 - "token filter", (*iter).getPointer(), pipeline); 492 + "token filter", (*iter).get(), pipeline);
493 to_delete.push_back(pipeline); 493 to_delete.push_back(pipeline);
494 } 494 }
495 495
@@ -512,14 +512,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, @@ -512,14 +512,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
512 } 512 }
513 } 513 }
514 514
515 - if (this->stream_data.getPointer()) 515 + if (this->stream_data.get())
516 { 516 {
517 QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data"); 517 QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
518 pipeline->write(this->stream_data->getBuffer(), 518 pipeline->write(this->stream_data->getBuffer(),
519 this->stream_data->getSize()); 519 this->stream_data->getSize());
520 pipeline->finish(); 520 pipeline->finish();
521 } 521 }
522 - else if (this->stream_provider.getPointer()) 522 + else if (this->stream_provider.get())
523 { 523 {
524 Pl_Count count("stream provider count", pipeline); 524 Pl_Count count("stream provider count", pipeline);
525 if (this->stream_provider->supportsRetry()) 525 if (this->stream_provider->supportsRetry())
@@ -590,7 +590,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, @@ -590,7 +590,7 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
590 590
591 if (filter && 591 if (filter &&
592 (! suppress_warnings) && 592 (! suppress_warnings) &&
593 - normalizer.getPointer() && 593 + normalizer.get() &&
594 normalizer->anyBadTokens()) 594 normalizer->anyBadTokens())
595 { 595 {
596 warn(QPDFExc(qpdf_e_damaged_pdf, qpdf->getFilename(), 596 warn(QPDFExc(qpdf_e_damaged_pdf, qpdf->getFilename(),
libqpdf/QPDF_encryption.cc
@@ -206,7 +206,7 @@ iterate_rc4(unsigned char* data, size_t data_len, @@ -206,7 +206,7 @@ iterate_rc4(unsigned char* data, size_t data_len,
206 { 206 {
207 PointerHolder<unsigned char> key_ph = PointerHolder<unsigned char>( 207 PointerHolder<unsigned char> key_ph = PointerHolder<unsigned char>(
208 true, new unsigned char[QIntC::to_size(key_len)]); 208 true, new unsigned char[QIntC::to_size(key_len)]);
209 - unsigned char* key = key_ph.getPointer(); 209 + unsigned char* key = key_ph.get();
210 for (int i = 0; i < iterations; ++i) 210 for (int i = 0; i < iterations; ++i)
211 { 211 {
212 int const xor_value = (reverse ? iterations - 1 - i : i); 212 int const xor_value = (reverse ? iterations - 1 - i : i);
libqpdf/QPDF_linearization.cc
@@ -314,7 +314,7 @@ QPDF::readLinearizationData() @@ -314,7 +314,7 @@ QPDF::readLinearizationData()
314 QPDFObjectHandle HO = H0.getKey("/O"); // outline 314 QPDFObjectHandle HO = H0.getKey("/O"); // outline
315 315
316 PointerHolder<Buffer> hbp = pb.getBuffer(); 316 PointerHolder<Buffer> hbp = pb.getBuffer();
317 - Buffer* hb = hbp.getPointer(); 317 + Buffer* hb = hbp.get();
318 unsigned char const* h_buf = hb->getBuffer(); 318 unsigned char const* h_buf = hb->getBuffer();
319 size_t h_size = hb->getSize(); 319 size_t h_size = hb->getSize();
320 320
libqpdf/QUtil.cc
@@ -470,7 +470,7 @@ win_convert_filename(char const* filename) @@ -470,7 +470,7 @@ win_convert_filename(char const* filename)
470 size_t len = u16.length(); 470 size_t len = u16.length();
471 size_t wlen = (len / 2) - 1; 471 size_t wlen = (len / 2) - 1;
472 PointerHolder<wchar_t> wfilenamep(true, new wchar_t[wlen + 1]); 472 PointerHolder<wchar_t> wfilenamep(true, new wchar_t[wlen + 1]);
473 - wchar_t* wfilename = wfilenamep.getPointer(); 473 + wchar_t* wfilename = wfilenamep.get();
474 wfilename[wlen] = 0; 474 wfilename[wlen] = 0;
475 for (unsigned int i = 2; i < len; i += 2) 475 for (unsigned int i = 2; i < len; i += 2)
476 { 476 {
@@ -489,9 +489,9 @@ QUtil::safe_fopen(char const* filename, char const* mode) @@ -489,9 +489,9 @@ QUtil::safe_fopen(char const* filename, char const* mode)
489 FILE* f = 0; 489 FILE* f = 0;
490 #ifdef _WIN32 490 #ifdef _WIN32
491 PointerHolder<wchar_t> wfilenamep = win_convert_filename(filename); 491 PointerHolder<wchar_t> wfilenamep = win_convert_filename(filename);
492 - wchar_t* wfilename = wfilenamep.getPointer(); 492 + wchar_t* wfilename = wfilenamep.get();
493 PointerHolder<wchar_t> wmodep(true, new wchar_t[strlen(mode) + 1]); 493 PointerHolder<wchar_t> wmodep(true, new wchar_t[strlen(mode) + 1]);
494 - wchar_t* wmode = wmodep.getPointer(); 494 + wchar_t* wmode = wmodep.get();
495 wmode[strlen(mode)] = 0; 495 wmode[strlen(mode)] = 0;
496 for (size_t i = 0; i < strlen(mode); ++i) 496 for (size_t i = 0; i < strlen(mode); ++i)
497 { 497 {
@@ -633,7 +633,7 @@ QUtil::remove_file(char const* path) @@ -633,7 +633,7 @@ QUtil::remove_file(char const* path)
633 { 633 {
634 #ifdef _WIN32 634 #ifdef _WIN32
635 PointerHolder<wchar_t> wpath = win_convert_filename(path); 635 PointerHolder<wchar_t> wpath = win_convert_filename(path);
636 - os_wrapper(std::string("remove ") + path, _wunlink(wpath.getPointer())); 636 + os_wrapper(std::string("remove ") + path, _wunlink(wpath.get()));
637 #else 637 #else
638 os_wrapper(std::string("remove ") + path, unlink(path)); 638 os_wrapper(std::string("remove ") + path, unlink(path));
639 #endif 639 #endif
@@ -654,7 +654,7 @@ QUtil::rename_file(char const* oldname, char const* newname) @@ -654,7 +654,7 @@ QUtil::rename_file(char const* oldname, char const* newname)
654 PointerHolder<wchar_t> wold = win_convert_filename(oldname); 654 PointerHolder<wchar_t> wold = win_convert_filename(oldname);
655 PointerHolder<wchar_t> wnew = win_convert_filename(newname); 655 PointerHolder<wchar_t> wnew = win_convert_filename(newname);
656 os_wrapper(std::string("rename ") + oldname + " " + newname, 656 os_wrapper(std::string("rename ") + oldname + " " + newname,
657 - _wrename(wold.getPointer(), wnew.getPointer())); 657 + _wrename(wold.get(), wnew.get()));
658 #else 658 #else
659 os_wrapper(std::string("rename ") + oldname + " " + newname, 659 os_wrapper(std::string("rename ") + oldname + " " + newname,
660 rename(oldname, newname)); 660 rename(oldname, newname));
@@ -867,8 +867,8 @@ QUtil::get_env(std::string const&amp; var, std::string* value) @@ -867,8 +867,8 @@ QUtil::get_env(std::string const&amp; var, std::string* value)
867 if (value) 867 if (value)
868 { 868 {
869 PointerHolder<char> t = PointerHolder<char>(true, new char[len + 1]); 869 PointerHolder<char> t = PointerHolder<char>(true, new char[len + 1]);
870 - ::GetEnvironmentVariable(var.c_str(), t.getPointer(), len);  
871 - *value = t.getPointer(); 870 + ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  871 + *value = t.get();
872 } 872 }
873 873
874 return true; 874 return true;
@@ -1261,7 +1261,7 @@ QUtil::read_file_into_memory( @@ -1261,7 +1261,7 @@ QUtil::read_file_into_memory(
1261 size = QIntC::to_size(QUtil::tell(f)); 1261 size = QIntC::to_size(QUtil::tell(f));
1262 fseek(f, 0, SEEK_SET); 1262 fseek(f, 0, SEEK_SET);
1263 file_buf = PointerHolder<char>(true, new char[size]); 1263 file_buf = PointerHolder<char>(true, new char[size]);
1264 - char* buf_p = file_buf.getPointer(); 1264 + char* buf_p = file_buf.get();
1265 size_t bytes_read = 0; 1265 size_t bytes_read = 0;
1266 size_t len = 0; 1266 size_t len = 0;
1267 while ((len = fread(buf_p + bytes_read, 1, size - bytes_read, f)) > 0) 1267 while ((len = fread(buf_p + bytes_read, 1, size - bytes_read, f)) > 0)
libqpdf/qpdf-c.cc
@@ -175,7 +175,7 @@ void qpdf_cleanup(qpdf_data* qpdf) @@ -175,7 +175,7 @@ void qpdf_cleanup(qpdf_data* qpdf)
175 { 175 {
176 QTC::TC("qpdf", "qpdf-c called qpdf_cleanup"); 176 QTC::TC("qpdf", "qpdf-c called qpdf_cleanup");
177 qpdf_oh_release_all(*qpdf); 177 qpdf_oh_release_all(*qpdf);
178 - if ((*qpdf)->error.getPointer()) 178 + if ((*qpdf)->error.get())
179 { 179 {
180 QTC::TC("qpdf", "qpdf-c cleanup warned about unhandled error"); 180 QTC::TC("qpdf", "qpdf-c cleanup warned about unhandled error");
181 std::cerr << "WARNING: application did not handle error: " 181 std::cerr << "WARNING: application did not handle error: "
@@ -216,12 +216,12 @@ QPDF_BOOL qpdf_more_warnings(qpdf_data qpdf) @@ -216,12 +216,12 @@ QPDF_BOOL qpdf_more_warnings(qpdf_data qpdf)
216 QPDF_BOOL qpdf_has_error(qpdf_data qpdf) 216 QPDF_BOOL qpdf_has_error(qpdf_data qpdf)
217 { 217 {
218 QTC::TC("qpdf", "qpdf-c called qpdf_has_error"); 218 QTC::TC("qpdf", "qpdf-c called qpdf_has_error");
219 - return (qpdf->error.getPointer() ? QPDF_TRUE : QPDF_FALSE); 219 + return (qpdf->error.get() ? QPDF_TRUE : QPDF_FALSE);
220 } 220 }
221 221
222 qpdf_error qpdf_get_error(qpdf_data qpdf) 222 qpdf_error qpdf_get_error(qpdf_data qpdf)
223 { 223 {
224 - if (qpdf->error.getPointer()) 224 + if (qpdf->error.get())
225 { 225 {
226 qpdf->tmp_error.exc = qpdf->error; 226 qpdf->tmp_error.exc = qpdf->error;
227 qpdf->error = 0; 227 qpdf->error = 0;
@@ -498,11 +498,11 @@ QPDF_BOOL qpdf_allow_modify_all(qpdf_data qpdf) @@ -498,11 +498,11 @@ QPDF_BOOL qpdf_allow_modify_all(qpdf_data qpdf)
498 498
499 static void qpdf_init_write_internal(qpdf_data qpdf) 499 static void qpdf_init_write_internal(qpdf_data qpdf)
500 { 500 {
501 - if (qpdf->qpdf_writer.getPointer()) 501 + if (qpdf->qpdf_writer.get())
502 { 502 {
503 QTC::TC("qpdf", "qpdf-c called qpdf_init_write multiple times"); 503 QTC::TC("qpdf", "qpdf-c called qpdf_init_write multiple times");
504 qpdf->qpdf_writer = 0; 504 qpdf->qpdf_writer = 0;
505 - if (qpdf->output_buffer.getPointer()) 505 + if (qpdf->output_buffer.get())
506 { 506 {
507 qpdf->output_buffer = 0; 507 qpdf->output_buffer = 0;
508 qpdf->write_memory = false; 508 qpdf->write_memory = false;
@@ -541,7 +541,7 @@ size_t qpdf_get_buffer_length(qpdf_data qpdf) @@ -541,7 +541,7 @@ size_t qpdf_get_buffer_length(qpdf_data qpdf)
541 { 541 {
542 qpdf_get_buffer_internal(qpdf); 542 qpdf_get_buffer_internal(qpdf);
543 size_t result = 0; 543 size_t result = 0;
544 - if (qpdf->output_buffer.getPointer()) 544 + if (qpdf->output_buffer.get())
545 { 545 {
546 result = qpdf->output_buffer->getSize(); 546 result = qpdf->output_buffer->getSize();
547 } 547 }
@@ -552,7 +552,7 @@ unsigned char const* qpdf_get_buffer(qpdf_data qpdf) @@ -552,7 +552,7 @@ unsigned char const* qpdf_get_buffer(qpdf_data qpdf)
552 { 552 {
553 unsigned char const* result = 0; 553 unsigned char const* result = 0;
554 qpdf_get_buffer_internal(qpdf); 554 qpdf_get_buffer_internal(qpdf);
555 - if (qpdf->output_buffer.getPointer()) 555 + if (qpdf->output_buffer.get())
556 { 556 {
557 result = qpdf->output_buffer->getBuffer(); 557 result = qpdf->output_buffer->getBuffer();
558 } 558 }
@@ -978,7 +978,7 @@ static RET do_with_oh( @@ -978,7 +978,7 @@ static RET do_with_oh(
978 qpdf, fallback, [fn, oh](qpdf_data q) { 978 qpdf, fallback, [fn, oh](qpdf_data q) {
979 auto i = q->oh_cache.find(oh); 979 auto i = q->oh_cache.find(oh);
980 bool result = ((i != q->oh_cache.end()) && 980 bool result = ((i != q->oh_cache.end()) &&
981 - (i->second).getPointer()); 981 + (i->second).get());
982 if (! result) 982 if (! result)
983 { 983 {
984 QTC::TC("qpdf", "qpdf-c invalid object handle"); 984 QTC::TC("qpdf", "qpdf-c invalid object handle");
@@ -1506,7 +1506,7 @@ qpdf_oh qpdf_oh_new_stream(qpdf_data qpdf) @@ -1506,7 +1506,7 @@ qpdf_oh qpdf_oh_new_stream(qpdf_data qpdf)
1506 { 1506 {
1507 QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_stream"); 1507 QTC::TC("qpdf", "qpdf-c called qpdf_oh_new_stream");
1508 return new_object( 1508 return new_object(
1509 - qpdf, QPDFObjectHandle::newStream(qpdf->qpdf.getPointer())); 1509 + qpdf, QPDFObjectHandle::newStream(qpdf->qpdf.get()));
1510 } 1510 }
1511 1511
1512 void qpdf_oh_make_direct(qpdf_data qpdf, qpdf_oh oh) 1512 void qpdf_oh_make_direct(qpdf_data qpdf, qpdf_oh oh)
libtests/input_source.cc
@@ -66,7 +66,7 @@ int main() @@ -66,7 +66,7 @@ int main()
66 // of the next match 66 // of the next match
67 memcpy(b + 2037, "potato potato salad ", 20); 67 memcpy(b + 2037, "potato potato salad ", 20);
68 PointerHolder<InputSource> is = 68 PointerHolder<InputSource> is =
69 - new BufferInputSource("test buffer input source", b1.getPointer()); 69 + new BufferInputSource("test buffer input source", b1.get());
70 Finder f1(is, "salad"); 70 Finder f1(is, "salad");
71 check("find potato salad", true, 71 check("find potato salad", true,
72 is->findFirst("potato", 0, 0, f1)); 72 is->findFirst("potato", 0, 0, f1));
libtests/json_parse.cc
@@ -15,7 +15,7 @@ int main(int argc, char* argv[]) @@ -15,7 +15,7 @@ int main(int argc, char* argv[])
15 PointerHolder<char> buf; 15 PointerHolder<char> buf;
16 size_t size; 16 size_t size;
17 QUtil::read_file_into_memory(filename, buf, size); 17 QUtil::read_file_into_memory(filename, buf, size);
18 - std::string s(buf.getPointer(), size); 18 + std::string s(buf.get(), size);
19 std::cout << JSON::parse(s).unparse() << std::endl; 19 std::cout << JSON::parse(s).unparse() << std::endl;
20 } 20 }
21 catch (std::exception& e) 21 catch (std::exception& e)
libtests/pointer_holder.cc
  1 +#define NO_POINTERHOLDER_DEPRECATION // we need to test the deprecated API
1 #include <qpdf/PointerHolder.hh> 2 #include <qpdf/PointerHolder.hh>
2 3
3 #include <iostream> 4 #include <iostream>
libtests/qutil.cc
@@ -528,7 +528,7 @@ void read_from_file_test() @@ -528,7 +528,7 @@ void read_from_file_test()
528 size_t size = 0; 528 size_t size = 0;
529 QUtil::read_file_into_memory("other-file", buf, size); 529 QUtil::read_file_into_memory("other-file", buf, size);
530 std::cout << "read " << size << " bytes" << std::endl; 530 std::cout << "read " << size << " bytes" << std::endl;
531 - char const* p = buf.getPointer(); 531 + char const* p = buf.get();
532 assert(size == 24652); 532 assert(size == 24652);
533 assert(memcmp(p, "This file is used for qutil testing.", 36) == 0); 533 assert(memcmp(p, "This file is used for qutil testing.", 36) == 0);
534 assert(p[59] == static_cast<char>(13)); 534 assert(p[59] == static_cast<char>(13));
@@ -609,11 +609,11 @@ void rename_delete_test() @@ -609,11 +609,11 @@ void rename_delete_test()
609 fprintf(f1, "one"); 609 fprintf(f1, "one");
610 fclose(f1); 610 fclose(f1);
611 QUtil::read_file_into_memory("old\xcf\x80", buf, size); 611 QUtil::read_file_into_memory("old\xcf\x80", buf, size);
612 - assert(memcmp(buf.getPointer(), "one", 3) == 0); 612 + assert(memcmp(buf.get(), "one", 3) == 0);
613 std::cout << "rename file" << std::endl;; 613 std::cout << "rename file" << std::endl;;
614 QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp"); 614 QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp");
615 QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size); 615 QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size);
616 - assert(memcmp(buf.getPointer(), "one", 3) == 0); 616 + assert(memcmp(buf.get(), "one", 3) == 0);
617 assert_no_file("old\xcf\x80"); 617 assert_no_file("old\xcf\x80");
618 std::cout << "create file" << std::endl;; 618 std::cout << "create file" << std::endl;;
619 f1 = QUtil::safe_fopen("old\xcf\x80", "w"); 619 f1 = QUtil::safe_fopen("old\xcf\x80", "w");
@@ -622,7 +622,7 @@ void rename_delete_test() @@ -622,7 +622,7 @@ void rename_delete_test()
622 std::cout << "rename over existing" << std::endl;; 622 std::cout << "rename over existing" << std::endl;;
623 QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp"); 623 QUtil::rename_file("old\xcf\x80", "old\xcf\x80.~tmp");
624 QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size); 624 QUtil::read_file_into_memory("old\xcf\x80.~tmp", buf, size);
625 - assert(memcmp(buf.getPointer(), "two", 3) == 0); 625 + assert(memcmp(buf.get(), "two", 3) == 0);
626 assert_no_file("old\xcf\x80"); 626 assert_no_file("old\xcf\x80");
627 std::cout << "delete file" << std::endl;; 627 std::cout << "delete file" << std::endl;;
628 QUtil::remove_file("old\xcf\x80.~tmp"); 628 QUtil::remove_file("old\xcf\x80.~tmp");
qpdf/test_driver.cc
@@ -295,7 +295,7 @@ static void test_0_1(QPDF&amp; pdf, char const* arg2) @@ -295,7 +295,7 @@ static void test_0_1(QPDF&amp; pdf, char const* arg2)
295 std::cout.flush(); 295 std::cout.flush();
296 QUtil::binary_stdout(); 296 QUtil::binary_stdout();
297 PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("raw", stdout); 297 PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("raw", stdout);
298 - qtest.pipeStreamData(out.getPointer(), 0, qpdf_dl_none); 298 + qtest.pipeStreamData(out.get(), 0, qpdf_dl_none);
299 299
300 std::cout << std::endl << "Uncompressed stream data:" << std::endl; 300 std::cout << std::endl << "Uncompressed stream data:" << std::endl;
301 if (qtest.pipeStreamData(0, 0, qpdf_dl_all)) 301 if (qtest.pipeStreamData(0, 0, qpdf_dl_all))
@@ -303,7 +303,7 @@ static void test_0_1(QPDF&amp; pdf, char const* arg2) @@ -303,7 +303,7 @@ static void test_0_1(QPDF&amp; pdf, char const* arg2)
303 std::cout.flush(); 303 std::cout.flush();
304 QUtil::binary_stdout(); 304 QUtil::binary_stdout();
305 out = new Pl_StdioFile("filtered", stdout); 305 out = new Pl_StdioFile("filtered", stdout);
306 - qtest.pipeStreamData(out.getPointer(), 0, qpdf_dl_all); 306 + qtest.pipeStreamData(out.get(), 0, qpdf_dl_all);
307 std::cout << std::endl << "End of stream data" << std::endl; 307 std::cout << std::endl << "End of stream data" << std::endl;
308 } 308 }
309 else 309 else
@@ -344,7 +344,7 @@ static void test_2(QPDF&amp; pdf, char const* arg2) @@ -344,7 +344,7 @@ static void test_2(QPDF&amp; pdf, char const* arg2)
344 QPDFObjectHandle contents = page.getKey("/Contents"); 344 QPDFObjectHandle contents = page.getKey("/Contents");
345 QUtil::binary_stdout(); 345 QUtil::binary_stdout();
346 PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("filtered", stdout); 346 PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("filtered", stdout);
347 - contents.pipeStreamData(out.getPointer(), 0, qpdf_dl_generalized); 347 + contents.pipeStreamData(out.get(), 0, qpdf_dl_generalized);
348 } 348 }
349 349
350 static void test_3(QPDF& pdf, char const* arg2) 350 static void test_3(QPDF& pdf, char const* arg2)
@@ -358,7 +358,7 @@ static void test_3(QPDF&amp; pdf, char const* arg2) @@ -358,7 +358,7 @@ static void test_3(QPDF&amp; pdf, char const* arg2)
358 QUtil::binary_stdout(); 358 QUtil::binary_stdout();
359 PointerHolder<Pl_StdioFile> out = 359 PointerHolder<Pl_StdioFile> out =
360 new Pl_StdioFile("tokenized stream", stdout); 360 new Pl_StdioFile("tokenized stream", stdout);
361 - stream.pipeStreamData(out.getPointer(), 361 + stream.pipeStreamData(out.get(),
362 qpdf_ef_normalize, qpdf_dl_generalized); 362 qpdf_ef_normalize, qpdf_dl_generalized);
363 } 363 }
364 } 364 }
@@ -3154,7 +3154,7 @@ static void test_83(QPDF&amp; pdf, char const* arg2) @@ -3154,7 +3154,7 @@ static void test_83(QPDF&amp; pdf, char const* arg2)
3154 try 3154 try
3155 { 3155 {
3156 std::cout << "calling initializeFromJson" << std::endl; 3156 std::cout << "calling initializeFromJson" << std::endl;
3157 - j.initializeFromJson(std::string(file_buf.getPointer(), size)); 3157 + j.initializeFromJson(std::string(file_buf.get(), size));
3158 std::cout << "called initializeFromJson" << std::endl; 3158 std::cout << "called initializeFromJson" << std::endl;
3159 } 3159 }
3160 catch (QPDFUsage& e) 3160 catch (QPDFUsage& e)
@@ -3278,7 +3278,7 @@ void runtest(int n, char const* filename1, char const* arg2) @@ -3278,7 +3278,7 @@ void runtest(int n, char const* filename1, char const* arg2)
3278 std::string filename(std::string(filename1) + ".obfuscated"); 3278 std::string filename(std::string(filename1) + ".obfuscated");
3279 size_t size = 0; 3279 size_t size = 0;
3280 QUtil::read_file_into_memory(filename.c_str(), file_buf, size); 3280 QUtil::read_file_into_memory(filename.c_str(), file_buf, size);
3281 - char* p = file_buf.getPointer(); 3281 + char* p = file_buf.get();
3282 for (size_t i = 0; i < size; ++i) 3282 for (size_t i = 0; i < size; ++i)
3283 { 3283 {
3284 p[i] = static_cast<char>(p[i] ^ 0xcc); 3284 p[i] = static_cast<char>(p[i] ^ 0xcc);
@@ -3309,7 +3309,7 @@ void runtest(int n, char const* filename1, char const* arg2) @@ -3309,7 +3309,7 @@ void runtest(int n, char const* filename1, char const* arg2)
3309 QTC::TC("qpdf", "exercise processMemoryFile"); 3309 QTC::TC("qpdf", "exercise processMemoryFile");
3310 size_t size = 0; 3310 size_t size = 0;
3311 QUtil::read_file_into_memory(filename1, file_buf, size); 3311 QUtil::read_file_into_memory(filename1, file_buf, size);
3312 - pdf.processMemoryFile(filename1, file_buf.getPointer(), size); 3312 + pdf.processMemoryFile(filename1, file_buf.get(), size);
3313 } 3313 }
3314 3314
3315 std::map<int, void (*)(QPDF&, char const*)> test_functions = { 3315 std::map<int, void (*)(QPDF&, char const*)> test_functions = {
qpdf/test_tokenizer.cc
@@ -222,7 +222,7 @@ static void process(char const* filename, bool include_ignorable, @@ -222,7 +222,7 @@ static void process(char const* filename, bool include_ignorable,
222 (*iter).pipeContents(&plb); 222 (*iter).pipeContents(&plb);
223 PointerHolder<Buffer> content_data = plb.getBuffer(); 223 PointerHolder<Buffer> content_data = plb.getBuffer();
224 BufferInputSource* bis = new BufferInputSource( 224 BufferInputSource* bis = new BufferInputSource(
225 - "content data", content_data.getPointer()); 225 + "content data", content_data.get());
226 is = bis; 226 is = bis;
227 dump_tokens(is, "PAGE " + QUtil::int_to_string(pageno), 227 dump_tokens(is, "PAGE " + QUtil::int_to_string(pageno),
228 max_len, include_ignorable, false, true); 228 max_len, include_ignorable, false, true);
@@ -240,7 +240,7 @@ static void process(char const* filename, bool include_ignorable, @@ -240,7 +240,7 @@ static void process(char const* filename, bool include_ignorable,
240 PointerHolder<Buffer> b = 240 PointerHolder<Buffer> b =
241 (*iter).getStreamData(qpdf_dl_specialized); 241 (*iter).getStreamData(qpdf_dl_specialized);
242 BufferInputSource* bis = new BufferInputSource( 242 BufferInputSource* bis = new BufferInputSource(
243 - "object stream data", b.getPointer()); 243 + "object stream data", b.get());
244 is = bis; 244 is = bis;
245 dump_tokens(is, "OBJECT STREAM " + 245 dump_tokens(is, "OBJECT STREAM " +
246 QUtil::int_to_string((*iter).getObjectID()), 246 QUtil::int_to_string((*iter).getObjectID()),
zlib-flate/zlib-flate.cc
@@ -77,7 +77,7 @@ int main(int argc, char* argv[]) @@ -77,7 +77,7 @@ int main(int argc, char* argv[])
77 QUtil::binary_stdin(); 77 QUtil::binary_stdin();
78 PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("stdout", stdout); 78 PointerHolder<Pl_StdioFile> out = new Pl_StdioFile("stdout", stdout);
79 PointerHolder<Pl_Flate> flate = 79 PointerHolder<Pl_Flate> flate =
80 - new Pl_Flate("flate", out.getPointer(), action); 80 + new Pl_Flate("flate", out.get(), action);
81 bool warn = false; 81 bool warn = false;
82 flate->setWarnCallback([&warn](char const* msg, int code) { 82 flate->setWarnCallback([&warn](char const* msg, int code) {
83 warn = true; 83 warn = true;