Commit 89f19b709916ed26d7499761140549a02c36d3f5
1 parent
31092dc6
Performance: remove Members indirection for QPDFObjectHandle
Showing
3 changed files
with
124 additions
and
167 deletions
ChangeLog
| 1 | +2020-04-02 Jay Berkenbilt <ejb@ql.org> | ||
| 2 | + | ||
| 3 | + * Remove Members class indirection for QPDFObjectHandle. Those are | ||
| 4 | + copied and assigned too often, and that change caused a very | ||
| 5 | + substantial performance hit. | ||
| 6 | + | ||
| 1 | 2020-03-31 Jay Berkenbilt <ejb@ql.org> | 7 | 2020-03-31 Jay Berkenbilt <ejb@ql.org> |
| 2 | 8 | ||
| 3 | * When detecting unreferenced images during page splitting, if any | 9 | * When detecting unreferenced images during page splitting, if any |
include/qpdf/QPDFObjectHandle.hh
| @@ -251,10 +251,10 @@ class QPDFObjectHandle | @@ -251,10 +251,10 @@ class QPDFObjectHandle | ||
| 251 | QPDF_DLL | 251 | QPDF_DLL |
| 252 | QPDFObjectHandle(); | 252 | QPDFObjectHandle(); |
| 253 | QPDF_DLL | 253 | QPDF_DLL |
| 254 | - QPDFObjectHandle(QPDFObjectHandle const&); | 254 | + QPDFObjectHandle(QPDFObjectHandle const&) = default; |
| 255 | QPDF_DLL | 255 | QPDF_DLL |
| 256 | QPDFObjectHandle& | 256 | QPDFObjectHandle& |
| 257 | - operator=(QPDFObjectHandle const&); | 257 | + operator=(QPDFObjectHandle const&) = default; |
| 258 | QPDF_DLL | 258 | QPDF_DLL |
| 259 | bool isInitialized() const; | 259 | bool isInitialized() const; |
| 260 | 260 | ||
| @@ -957,7 +957,7 @@ class QPDFObjectHandle | @@ -957,7 +957,7 @@ class QPDFObjectHandle | ||
| 957 | static PointerHolder<QPDFObject> getObject(QPDFObjectHandle& o) | 957 | static PointerHolder<QPDFObject> getObject(QPDFObjectHandle& o) |
| 958 | { | 958 | { |
| 959 | o.dereference(); | 959 | o.dereference(); |
| 960 | - return o.m->obj; | 960 | + return o.obj; |
| 961 | } | 961 | } |
| 962 | }; | 962 | }; |
| 963 | friend class ObjAccessor; | 963 | friend class ObjAccessor; |
| @@ -1077,29 +1077,16 @@ class QPDFObjectHandle | @@ -1077,29 +1077,16 @@ class QPDFObjectHandle | ||
| 1077 | std::string const& description, std::string& all_description); | 1077 | std::string const& description, std::string& all_description); |
| 1078 | static void warn(QPDF*, QPDFExc const&); | 1078 | static void warn(QPDF*, QPDFExc const&); |
| 1079 | 1079 | ||
| 1080 | - class Members | ||
| 1081 | - { | ||
| 1082 | - friend class ObjAccessor; | ||
| 1083 | - friend class QPDFObjectHandle; | ||
| 1084 | - | ||
| 1085 | - public: | ||
| 1086 | - QPDF_DLL | ||
| 1087 | - ~Members(); | 1080 | + bool initialized; |
| 1088 | 1081 | ||
| 1089 | - private: | ||
| 1090 | - Members(); | ||
| 1091 | - Members(QPDF* qpdf, int objid, int generation); | ||
| 1092 | - Members(QPDFObject* data); | ||
| 1093 | - | ||
| 1094 | - bool initialized; | ||
| 1095 | - | ||
| 1096 | - QPDF* qpdf; | ||
| 1097 | - int objid; // 0 for direct object | ||
| 1098 | - int generation; | ||
| 1099 | - PointerHolder<QPDFObject> obj; | ||
| 1100 | - bool reserved; | ||
| 1101 | - }; | ||
| 1102 | - PointerHolder<Members> m; | 1082 | + // Moving members of QPDFObjectHandle into a smart pointer incurs |
| 1083 | + // a substantial performance penalty since QPDFObjectHandle | ||
| 1084 | + // objects are copied around so frequently. | ||
| 1085 | + QPDF* qpdf; | ||
| 1086 | + int objid; // 0 for direct object | ||
| 1087 | + int generation; | ||
| 1088 | + PointerHolder<QPDFObject> obj; | ||
| 1089 | + bool reserved; | ||
| 1103 | }; | 1090 | }; |
| 1104 | 1091 | ||
| 1105 | #endif // QPDFOBJECTHANDLE_HH | 1092 | #endif // QPDFOBJECTHANDLE_HH |
libqpdf/QPDFObjectHandle.cc
| @@ -135,11 +135,7 @@ QPDFObjectHandle::ParserCallbacks::terminateParsing() | @@ -135,11 +135,7 @@ QPDFObjectHandle::ParserCallbacks::terminateParsing() | ||
| 135 | throw TerminateParsing(); | 135 | throw TerminateParsing(); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | -QPDFObjectHandle::Members::~Members() | ||
| 139 | -{ | ||
| 140 | -} | ||
| 141 | - | ||
| 142 | -QPDFObjectHandle::Members::Members() : | 138 | +QPDFObjectHandle::QPDFObjectHandle() : |
| 143 | initialized(false), | 139 | initialized(false), |
| 144 | qpdf(0), | 140 | qpdf(0), |
| 145 | objid(0), | 141 | objid(0), |
| @@ -148,7 +144,7 @@ QPDFObjectHandle::Members::Members() : | @@ -148,7 +144,7 @@ QPDFObjectHandle::Members::Members() : | ||
| 148 | { | 144 | { |
| 149 | } | 145 | } |
| 150 | 146 | ||
| 151 | -QPDFObjectHandle::Members::Members(QPDF* qpdf, int objid, int generation) : | 147 | +QPDFObjectHandle::QPDFObjectHandle(QPDF* qpdf, int objid, int generation) : |
| 152 | initialized(true), | 148 | initialized(true), |
| 153 | qpdf(qpdf), | 149 | qpdf(qpdf), |
| 154 | objid(objid), | 150 | objid(objid), |
| @@ -157,7 +153,7 @@ QPDFObjectHandle::Members::Members(QPDF* qpdf, int objid, int generation) : | @@ -157,7 +153,7 @@ QPDFObjectHandle::Members::Members(QPDF* qpdf, int objid, int generation) : | ||
| 157 | { | 153 | { |
| 158 | } | 154 | } |
| 159 | 155 | ||
| 160 | -QPDFObjectHandle::Members::Members(QPDFObject* data) : | 156 | +QPDFObjectHandle::QPDFObjectHandle(QPDFObject* data) : |
| 161 | initialized(true), | 157 | initialized(true), |
| 162 | qpdf(0), | 158 | qpdf(0), |
| 163 | objid(0), | 159 | objid(0), |
| @@ -167,38 +163,6 @@ QPDFObjectHandle::Members::Members(QPDFObject* data) : | @@ -167,38 +163,6 @@ QPDFObjectHandle::Members::Members(QPDFObject* data) : | ||
| 167 | { | 163 | { |
| 168 | } | 164 | } |
| 169 | 165 | ||
| 170 | - | ||
| 171 | -QPDFObjectHandle::QPDFObjectHandle() : | ||
| 172 | - m(new Members) | ||
| 173 | -{ | ||
| 174 | -} | ||
| 175 | - | ||
| 176 | -QPDFObjectHandle::QPDFObjectHandle(QPDFObjectHandle const& rhs) : | ||
| 177 | - m(new Members) | ||
| 178 | -{ | ||
| 179 | - *m = *rhs.m; | ||
| 180 | -} | ||
| 181 | - | ||
| 182 | -QPDFObjectHandle& | ||
| 183 | -QPDFObjectHandle::operator=(QPDFObjectHandle const& rhs) | ||
| 184 | -{ | ||
| 185 | - if (this != &rhs) | ||
| 186 | - { | ||
| 187 | - *m = *rhs.m; | ||
| 188 | - } | ||
| 189 | - return *this; | ||
| 190 | -} | ||
| 191 | - | ||
| 192 | -QPDFObjectHandle::QPDFObjectHandle(QPDF* qpdf, int objid, int generation) : | ||
| 193 | - m(new Members(qpdf, objid, generation)) | ||
| 194 | -{ | ||
| 195 | -} | ||
| 196 | - | ||
| 197 | -QPDFObjectHandle::QPDFObjectHandle(QPDFObject* data) : | ||
| 198 | - m(new Members(data)) | ||
| 199 | -{ | ||
| 200 | -} | ||
| 201 | - | ||
| 202 | void | 166 | void |
| 203 | QPDFObjectHandle::releaseResolved() | 167 | QPDFObjectHandle::releaseResolved() |
| 204 | { | 168 | { |
| @@ -208,14 +172,14 @@ QPDFObjectHandle::releaseResolved() | @@ -208,14 +172,14 @@ QPDFObjectHandle::releaseResolved() | ||
| 208 | // destruction. See comments in QPDF::~QPDF(). | 172 | // destruction. See comments in QPDF::~QPDF(). |
| 209 | if (isIndirect()) | 173 | if (isIndirect()) |
| 210 | { | 174 | { |
| 211 | - if (this->m->obj.getPointer()) | 175 | + if (this->obj.getPointer()) |
| 212 | { | 176 | { |
| 213 | - this->m->obj = 0; | 177 | + this->obj = 0; |
| 214 | } | 178 | } |
| 215 | } | 179 | } |
| 216 | else | 180 | else |
| 217 | { | 181 | { |
| 218 | - QPDFObject::ObjAccessor::releaseResolved(this->m->obj.getPointer()); | 182 | + QPDFObject::ObjAccessor::releaseResolved(this->obj.getPointer()); |
| 219 | } | 183 | } |
| 220 | } | 184 | } |
| 221 | 185 | ||
| @@ -234,16 +198,16 @@ QPDFObjectHandle::setObjectDescriptionFromInput( | @@ -234,16 +198,16 @@ QPDFObjectHandle::setObjectDescriptionFromInput( | ||
| 234 | bool | 198 | bool |
| 235 | QPDFObjectHandle::isInitialized() const | 199 | QPDFObjectHandle::isInitialized() const |
| 236 | { | 200 | { |
| 237 | - return this->m->initialized; | 201 | + return this->initialized; |
| 238 | } | 202 | } |
| 239 | 203 | ||
| 240 | QPDFObject::object_type_e | 204 | QPDFObject::object_type_e |
| 241 | QPDFObjectHandle::getTypeCode() | 205 | QPDFObjectHandle::getTypeCode() |
| 242 | { | 206 | { |
| 243 | - if (this->m->initialized) | 207 | + if (this->initialized) |
| 244 | { | 208 | { |
| 245 | dereference(); | 209 | dereference(); |
| 246 | - return this->m->obj->getTypeCode(); | 210 | + return this->obj->getTypeCode(); |
| 247 | } | 211 | } |
| 248 | else | 212 | else |
| 249 | { | 213 | { |
| @@ -254,10 +218,10 @@ QPDFObjectHandle::getTypeCode() | @@ -254,10 +218,10 @@ QPDFObjectHandle::getTypeCode() | ||
| 254 | char const* | 218 | char const* |
| 255 | QPDFObjectHandle::getTypeName() | 219 | QPDFObjectHandle::getTypeName() |
| 256 | { | 220 | { |
| 257 | - if (this->m->initialized) | 221 | + if (this->initialized) |
| 258 | { | 222 | { |
| 259 | dereference(); | 223 | dereference(); |
| 260 | - return this->m->obj->getTypeName(); | 224 | + return this->obj->getTypeName(); |
| 261 | } | 225 | } |
| 262 | else | 226 | else |
| 263 | { | 227 | { |
| @@ -283,35 +247,35 @@ bool | @@ -283,35 +247,35 @@ bool | ||
| 283 | QPDFObjectHandle::isBool() | 247 | QPDFObjectHandle::isBool() |
| 284 | { | 248 | { |
| 285 | dereference(); | 249 | dereference(); |
| 286 | - return QPDFObjectTypeAccessor<QPDF_Bool>::check(m->obj.getPointer()); | 250 | + return QPDFObjectTypeAccessor<QPDF_Bool>::check(obj.getPointer()); |
| 287 | } | 251 | } |
| 288 | 252 | ||
| 289 | bool | 253 | bool |
| 290 | QPDFObjectHandle::isDirectNull() const | 254 | QPDFObjectHandle::isDirectNull() const |
| 291 | { | 255 | { |
| 292 | - return (this->m->initialized && (this->m->objid == 0) && | ||
| 293 | - QPDFObjectTypeAccessor<QPDF_Null>::check(m->obj.getPointer())); | 256 | + return (this->initialized && (this->objid == 0) && |
| 257 | + QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer())); | ||
| 294 | } | 258 | } |
| 295 | 259 | ||
| 296 | bool | 260 | bool |
| 297 | QPDFObjectHandle::isNull() | 261 | QPDFObjectHandle::isNull() |
| 298 | { | 262 | { |
| 299 | dereference(); | 263 | dereference(); |
| 300 | - return QPDFObjectTypeAccessor<QPDF_Null>::check(m->obj.getPointer()); | 264 | + return QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer()); |
| 301 | } | 265 | } |
| 302 | 266 | ||
| 303 | bool | 267 | bool |
| 304 | QPDFObjectHandle::isInteger() | 268 | QPDFObjectHandle::isInteger() |
| 305 | { | 269 | { |
| 306 | dereference(); | 270 | dereference(); |
| 307 | - return QPDFObjectTypeAccessor<QPDF_Integer>::check(m->obj.getPointer()); | 271 | + return QPDFObjectTypeAccessor<QPDF_Integer>::check(obj.getPointer()); |
| 308 | } | 272 | } |
| 309 | 273 | ||
| 310 | bool | 274 | bool |
| 311 | QPDFObjectHandle::isReal() | 275 | QPDFObjectHandle::isReal() |
| 312 | { | 276 | { |
| 313 | dereference(); | 277 | dereference(); |
| 314 | - return QPDFObjectTypeAccessor<QPDF_Real>::check(m->obj.getPointer()); | 278 | + return QPDFObjectTypeAccessor<QPDF_Real>::check(obj.getPointer()); |
| 315 | } | 279 | } |
| 316 | 280 | ||
| 317 | bool | 281 | bool |
| @@ -344,49 +308,49 @@ bool | @@ -344,49 +308,49 @@ bool | ||
| 344 | QPDFObjectHandle::isName() | 308 | QPDFObjectHandle::isName() |
| 345 | { | 309 | { |
| 346 | dereference(); | 310 | dereference(); |
| 347 | - return QPDFObjectTypeAccessor<QPDF_Name>::check(m->obj.getPointer()); | 311 | + return QPDFObjectTypeAccessor<QPDF_Name>::check(obj.getPointer()); |
| 348 | } | 312 | } |
| 349 | 313 | ||
| 350 | bool | 314 | bool |
| 351 | QPDFObjectHandle::isString() | 315 | QPDFObjectHandle::isString() |
| 352 | { | 316 | { |
| 353 | dereference(); | 317 | dereference(); |
| 354 | - return QPDFObjectTypeAccessor<QPDF_String>::check(m->obj.getPointer()); | 318 | + return QPDFObjectTypeAccessor<QPDF_String>::check(obj.getPointer()); |
| 355 | } | 319 | } |
| 356 | 320 | ||
| 357 | bool | 321 | bool |
| 358 | QPDFObjectHandle::isOperator() | 322 | QPDFObjectHandle::isOperator() |
| 359 | { | 323 | { |
| 360 | dereference(); | 324 | dereference(); |
| 361 | - return QPDFObjectTypeAccessor<QPDF_Operator>::check(m->obj.getPointer()); | 325 | + return QPDFObjectTypeAccessor<QPDF_Operator>::check(obj.getPointer()); |
| 362 | } | 326 | } |
| 363 | 327 | ||
| 364 | bool | 328 | bool |
| 365 | QPDFObjectHandle::isInlineImage() | 329 | QPDFObjectHandle::isInlineImage() |
| 366 | { | 330 | { |
| 367 | dereference(); | 331 | dereference(); |
| 368 | - return QPDFObjectTypeAccessor<QPDF_InlineImage>::check(m->obj.getPointer()); | 332 | + return QPDFObjectTypeAccessor<QPDF_InlineImage>::check(obj.getPointer()); |
| 369 | } | 333 | } |
| 370 | 334 | ||
| 371 | bool | 335 | bool |
| 372 | QPDFObjectHandle::isArray() | 336 | QPDFObjectHandle::isArray() |
| 373 | { | 337 | { |
| 374 | dereference(); | 338 | dereference(); |
| 375 | - return QPDFObjectTypeAccessor<QPDF_Array>::check(m->obj.getPointer()); | 339 | + return QPDFObjectTypeAccessor<QPDF_Array>::check(obj.getPointer()); |
| 376 | } | 340 | } |
| 377 | 341 | ||
| 378 | bool | 342 | bool |
| 379 | QPDFObjectHandle::isDictionary() | 343 | QPDFObjectHandle::isDictionary() |
| 380 | { | 344 | { |
| 381 | dereference(); | 345 | dereference(); |
| 382 | - return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(m->obj.getPointer()); | 346 | + return QPDFObjectTypeAccessor<QPDF_Dictionary>::check(obj.getPointer()); |
| 383 | } | 347 | } |
| 384 | 348 | ||
| 385 | bool | 349 | bool |
| 386 | QPDFObjectHandle::isStream() | 350 | QPDFObjectHandle::isStream() |
| 387 | { | 351 | { |
| 388 | dereference(); | 352 | dereference(); |
| 389 | - return QPDFObjectTypeAccessor<QPDF_Stream>::check(m->obj.getPointer()); | 353 | + return QPDFObjectTypeAccessor<QPDF_Stream>::check(obj.getPointer()); |
| 390 | } | 354 | } |
| 391 | 355 | ||
| 392 | bool | 356 | bool |
| @@ -394,14 +358,14 @@ QPDFObjectHandle::isReserved() | @@ -394,14 +358,14 @@ QPDFObjectHandle::isReserved() | ||
| 394 | { | 358 | { |
| 395 | // dereference will clear reserved if this has been replaced | 359 | // dereference will clear reserved if this has been replaced |
| 396 | dereference(); | 360 | dereference(); |
| 397 | - return this->m->reserved; | 361 | + return this->reserved; |
| 398 | } | 362 | } |
| 399 | 363 | ||
| 400 | bool | 364 | bool |
| 401 | QPDFObjectHandle::isIndirect() | 365 | QPDFObjectHandle::isIndirect() |
| 402 | { | 366 | { |
| 403 | assertInitialized(); | 367 | assertInitialized(); |
| 404 | - return (this->m->objid != 0); | 368 | + return (this->objid != 0); |
| 405 | } | 369 | } |
| 406 | 370 | ||
| 407 | bool | 371 | bool |
| @@ -418,7 +382,7 @@ QPDFObjectHandle::getBoolValue() | @@ -418,7 +382,7 @@ QPDFObjectHandle::getBoolValue() | ||
| 418 | { | 382 | { |
| 419 | if (isBool()) | 383 | if (isBool()) |
| 420 | { | 384 | { |
| 421 | - return dynamic_cast<QPDF_Bool*>(m->obj.getPointer())->getVal(); | 385 | + return dynamic_cast<QPDF_Bool*>(obj.getPointer())->getVal(); |
| 422 | } | 386 | } |
| 423 | else | 387 | else |
| 424 | { | 388 | { |
| @@ -435,7 +399,7 @@ QPDFObjectHandle::getIntValue() | @@ -435,7 +399,7 @@ QPDFObjectHandle::getIntValue() | ||
| 435 | { | 399 | { |
| 436 | if (isInteger()) | 400 | if (isInteger()) |
| 437 | { | 401 | { |
| 438 | - return dynamic_cast<QPDF_Integer*>(m->obj.getPointer())->getVal(); | 402 | + return dynamic_cast<QPDF_Integer*>(obj.getPointer())->getVal(); |
| 439 | } | 403 | } |
| 440 | else | 404 | else |
| 441 | { | 405 | { |
| @@ -528,7 +492,7 @@ QPDFObjectHandle::getRealValue() | @@ -528,7 +492,7 @@ QPDFObjectHandle::getRealValue() | ||
| 528 | { | 492 | { |
| 529 | if (isReal()) | 493 | if (isReal()) |
| 530 | { | 494 | { |
| 531 | - return dynamic_cast<QPDF_Real*>(m->obj.getPointer())->getVal(); | 495 | + return dynamic_cast<QPDF_Real*>(obj.getPointer())->getVal(); |
| 532 | } | 496 | } |
| 533 | else | 497 | else |
| 534 | { | 498 | { |
| @@ -545,7 +509,7 @@ QPDFObjectHandle::getName() | @@ -545,7 +509,7 @@ QPDFObjectHandle::getName() | ||
| 545 | { | 509 | { |
| 546 | if (isName()) | 510 | if (isName()) |
| 547 | { | 511 | { |
| 548 | - return dynamic_cast<QPDF_Name*>(m->obj.getPointer())->getName(); | 512 | + return dynamic_cast<QPDF_Name*>(obj.getPointer())->getName(); |
| 549 | } | 513 | } |
| 550 | else | 514 | else |
| 551 | { | 515 | { |
| @@ -562,7 +526,7 @@ QPDFObjectHandle::getStringValue() | @@ -562,7 +526,7 @@ QPDFObjectHandle::getStringValue() | ||
| 562 | { | 526 | { |
| 563 | if (isString()) | 527 | if (isString()) |
| 564 | { | 528 | { |
| 565 | - return dynamic_cast<QPDF_String*>(m->obj.getPointer())->getVal(); | 529 | + return dynamic_cast<QPDF_String*>(obj.getPointer())->getVal(); |
| 566 | } | 530 | } |
| 567 | else | 531 | else |
| 568 | { | 532 | { |
| @@ -577,7 +541,7 @@ QPDFObjectHandle::getUTF8Value() | @@ -577,7 +541,7 @@ QPDFObjectHandle::getUTF8Value() | ||
| 577 | { | 541 | { |
| 578 | if (isString()) | 542 | if (isString()) |
| 579 | { | 543 | { |
| 580 | - return dynamic_cast<QPDF_String*>(m->obj.getPointer())->getUTF8Val(); | 544 | + return dynamic_cast<QPDF_String*>(obj.getPointer())->getUTF8Val(); |
| 581 | } | 545 | } |
| 582 | else | 546 | else |
| 583 | { | 547 | { |
| @@ -594,7 +558,7 @@ QPDFObjectHandle::getOperatorValue() | @@ -594,7 +558,7 @@ QPDFObjectHandle::getOperatorValue() | ||
| 594 | { | 558 | { |
| 595 | if (isOperator()) | 559 | if (isOperator()) |
| 596 | { | 560 | { |
| 597 | - return dynamic_cast<QPDF_Operator*>(m->obj.getPointer())->getVal(); | 561 | + return dynamic_cast<QPDF_Operator*>(obj.getPointer())->getVal(); |
| 598 | } | 562 | } |
| 599 | else | 563 | else |
| 600 | { | 564 | { |
| @@ -609,7 +573,7 @@ QPDFObjectHandle::getInlineImageValue() | @@ -609,7 +573,7 @@ QPDFObjectHandle::getInlineImageValue() | ||
| 609 | { | 573 | { |
| 610 | if (isInlineImage()) | 574 | if (isInlineImage()) |
| 611 | { | 575 | { |
| 612 | - return dynamic_cast<QPDF_InlineImage*>(m->obj.getPointer())->getVal(); | 576 | + return dynamic_cast<QPDF_InlineImage*>(obj.getPointer())->getVal(); |
| 613 | } | 577 | } |
| 614 | else | 578 | else |
| 615 | { | 579 | { |
| @@ -626,7 +590,7 @@ QPDFObjectHandle::getArrayNItems() | @@ -626,7 +590,7 @@ QPDFObjectHandle::getArrayNItems() | ||
| 626 | { | 590 | { |
| 627 | if (isArray()) | 591 | if (isArray()) |
| 628 | { | 592 | { |
| 629 | - return dynamic_cast<QPDF_Array*>(m->obj.getPointer())->getNItems(); | 593 | + return dynamic_cast<QPDF_Array*>(obj.getPointer())->getNItems(); |
| 630 | } | 594 | } |
| 631 | else | 595 | else |
| 632 | { | 596 | { |
| @@ -642,7 +606,7 @@ QPDFObjectHandle::getArrayItem(int n) | @@ -642,7 +606,7 @@ QPDFObjectHandle::getArrayItem(int n) | ||
| 642 | QPDFObjectHandle result; | 606 | QPDFObjectHandle result; |
| 643 | if (isArray() && (n < getArrayNItems()) && (n >= 0)) | 607 | if (isArray() && (n < getArrayNItems()) && (n >= 0)) |
| 644 | { | 608 | { |
| 645 | - result = dynamic_cast<QPDF_Array*>(m->obj.getPointer())->getItem(n); | 609 | + result = dynamic_cast<QPDF_Array*>(obj.getPointer())->getItem(n); |
| 646 | } | 610 | } |
| 647 | else | 611 | else |
| 648 | { | 612 | { |
| @@ -659,7 +623,7 @@ QPDFObjectHandle::getArrayItem(int n) | @@ -659,7 +623,7 @@ QPDFObjectHandle::getArrayItem(int n) | ||
| 659 | } | 623 | } |
| 660 | QPDF* context = 0; | 624 | QPDF* context = 0; |
| 661 | std::string description; | 625 | std::string description; |
| 662 | - if (this->m->obj->getDescription(context, description)) | 626 | + if (this->obj->getDescription(context, description)) |
| 663 | { | 627 | { |
| 664 | result.setObjectDescription( | 628 | result.setObjectDescription( |
| 665 | context, | 629 | context, |
| @@ -755,7 +719,7 @@ QPDFObjectHandle::getArrayAsVector() | @@ -755,7 +719,7 @@ QPDFObjectHandle::getArrayAsVector() | ||
| 755 | std::vector<QPDFObjectHandle> result; | 719 | std::vector<QPDFObjectHandle> result; |
| 756 | if (isArray()) | 720 | if (isArray()) |
| 757 | { | 721 | { |
| 758 | - dynamic_cast<QPDF_Array*>(m->obj.getPointer())->getAsVector(result); | 722 | + dynamic_cast<QPDF_Array*>(obj.getPointer())->getAsVector(result); |
| 759 | } | 723 | } |
| 760 | else | 724 | else |
| 761 | { | 725 | { |
| @@ -772,7 +736,7 @@ QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item) | @@ -772,7 +736,7 @@ QPDFObjectHandle::setArrayItem(int n, QPDFObjectHandle const& item) | ||
| 772 | { | 736 | { |
| 773 | if (isArray()) | 737 | if (isArray()) |
| 774 | { | 738 | { |
| 775 | - dynamic_cast<QPDF_Array*>(m->obj.getPointer())->setItem(n, item); | 739 | + dynamic_cast<QPDF_Array*>(obj.getPointer())->setItem(n, item); |
| 776 | } | 740 | } |
| 777 | else | 741 | else |
| 778 | { | 742 | { |
| @@ -786,7 +750,7 @@ QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items) | @@ -786,7 +750,7 @@ QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items) | ||
| 786 | { | 750 | { |
| 787 | if (isArray()) | 751 | if (isArray()) |
| 788 | { | 752 | { |
| 789 | - dynamic_cast<QPDF_Array*>(m->obj.getPointer())->setFromVector(items); | 753 | + dynamic_cast<QPDF_Array*>(obj.getPointer())->setFromVector(items); |
| 790 | } | 754 | } |
| 791 | else | 755 | else |
| 792 | { | 756 | { |
| @@ -800,7 +764,7 @@ QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const& item) | @@ -800,7 +764,7 @@ QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const& item) | ||
| 800 | { | 764 | { |
| 801 | if (isArray()) | 765 | if (isArray()) |
| 802 | { | 766 | { |
| 803 | - dynamic_cast<QPDF_Array*>(m->obj.getPointer())->insertItem(at, item); | 767 | + dynamic_cast<QPDF_Array*>(obj.getPointer())->insertItem(at, item); |
| 804 | } | 768 | } |
| 805 | else | 769 | else |
| 806 | { | 770 | { |
| @@ -814,7 +778,7 @@ QPDFObjectHandle::appendItem(QPDFObjectHandle const& item) | @@ -814,7 +778,7 @@ QPDFObjectHandle::appendItem(QPDFObjectHandle const& item) | ||
| 814 | { | 778 | { |
| 815 | if (isArray()) | 779 | if (isArray()) |
| 816 | { | 780 | { |
| 817 | - dynamic_cast<QPDF_Array*>(m->obj.getPointer())->appendItem(item); | 781 | + dynamic_cast<QPDF_Array*>(obj.getPointer())->appendItem(item); |
| 818 | } | 782 | } |
| 819 | else | 783 | else |
| 820 | { | 784 | { |
| @@ -828,7 +792,7 @@ QPDFObjectHandle::eraseItem(int at) | @@ -828,7 +792,7 @@ QPDFObjectHandle::eraseItem(int at) | ||
| 828 | { | 792 | { |
| 829 | if (isArray() && (at < getArrayNItems()) && (at >= 0)) | 793 | if (isArray() && (at < getArrayNItems()) && (at >= 0)) |
| 830 | { | 794 | { |
| 831 | - dynamic_cast<QPDF_Array*>(m->obj.getPointer())->eraseItem(at); | 795 | + dynamic_cast<QPDF_Array*>(obj.getPointer())->eraseItem(at); |
| 832 | } | 796 | } |
| 833 | else | 797 | else |
| 834 | { | 798 | { |
| @@ -852,7 +816,7 @@ QPDFObjectHandle::hasKey(std::string const& key) | @@ -852,7 +816,7 @@ QPDFObjectHandle::hasKey(std::string const& key) | ||
| 852 | { | 816 | { |
| 853 | if (isDictionary()) | 817 | if (isDictionary()) |
| 854 | { | 818 | { |
| 855 | - return dynamic_cast<QPDF_Dictionary*>(m->obj.getPointer())->hasKey(key); | 819 | + return dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->hasKey(key); |
| 856 | } | 820 | } |
| 857 | else | 821 | else |
| 858 | { | 822 | { |
| @@ -870,7 +834,7 @@ QPDFObjectHandle::getKey(std::string const& key) | @@ -870,7 +834,7 @@ QPDFObjectHandle::getKey(std::string const& key) | ||
| 870 | if (isDictionary()) | 834 | if (isDictionary()) |
| 871 | { | 835 | { |
| 872 | result = dynamic_cast<QPDF_Dictionary*>( | 836 | result = dynamic_cast<QPDF_Dictionary*>( |
| 873 | - m->obj.getPointer())->getKey(key); | 837 | + obj.getPointer())->getKey(key); |
| 874 | } | 838 | } |
| 875 | else | 839 | else |
| 876 | { | 840 | { |
| @@ -880,7 +844,7 @@ QPDFObjectHandle::getKey(std::string const& key) | @@ -880,7 +844,7 @@ QPDFObjectHandle::getKey(std::string const& key) | ||
| 880 | result = newNull(); | 844 | result = newNull(); |
| 881 | QPDF* qpdf = 0; | 845 | QPDF* qpdf = 0; |
| 882 | std::string description; | 846 | std::string description; |
| 883 | - if (this->m->obj->getDescription(qpdf, description)) | 847 | + if (this->obj->getDescription(qpdf, description)) |
| 884 | { | 848 | { |
| 885 | result.setObjectDescription( | 849 | result.setObjectDescription( |
| 886 | qpdf, | 850 | qpdf, |
| @@ -898,7 +862,7 @@ QPDFObjectHandle::getKeys() | @@ -898,7 +862,7 @@ QPDFObjectHandle::getKeys() | ||
| 898 | std::set<std::string> result; | 862 | std::set<std::string> result; |
| 899 | if (isDictionary()) | 863 | if (isDictionary()) |
| 900 | { | 864 | { |
| 901 | - result = dynamic_cast<QPDF_Dictionary*>(m->obj.getPointer())->getKeys(); | 865 | + result = dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->getKeys(); |
| 902 | } | 866 | } |
| 903 | else | 867 | else |
| 904 | { | 868 | { |
| @@ -915,7 +879,7 @@ QPDFObjectHandle::getDictAsMap() | @@ -915,7 +879,7 @@ QPDFObjectHandle::getDictAsMap() | ||
| 915 | if (isDictionary()) | 879 | if (isDictionary()) |
| 916 | { | 880 | { |
| 917 | result = dynamic_cast<QPDF_Dictionary*>( | 881 | result = dynamic_cast<QPDF_Dictionary*>( |
| 918 | - m->obj.getPointer())->getAsMap(); | 882 | + obj.getPointer())->getAsMap(); |
| 919 | } | 883 | } |
| 920 | else | 884 | else |
| 921 | { | 885 | { |
| @@ -1082,7 +1046,7 @@ QPDF* | @@ -1082,7 +1046,7 @@ QPDF* | ||
| 1082 | QPDFObjectHandle::getOwningQPDF() | 1046 | QPDFObjectHandle::getOwningQPDF() |
| 1083 | { | 1047 | { |
| 1084 | // Will be null for direct objects | 1048 | // Will be null for direct objects |
| 1085 | - return this->m->qpdf; | 1049 | + return this->qpdf; |
| 1086 | } | 1050 | } |
| 1087 | 1051 | ||
| 1088 | // Dictionary mutators | 1052 | // Dictionary mutators |
| @@ -1094,7 +1058,7 @@ QPDFObjectHandle::replaceKey(std::string const& key, | @@ -1094,7 +1058,7 @@ QPDFObjectHandle::replaceKey(std::string const& key, | ||
| 1094 | if (isDictionary()) | 1058 | if (isDictionary()) |
| 1095 | { | 1059 | { |
| 1096 | dynamic_cast<QPDF_Dictionary*>( | 1060 | dynamic_cast<QPDF_Dictionary*>( |
| 1097 | - m->obj.getPointer())->replaceKey(key, value); | 1061 | + obj.getPointer())->replaceKey(key, value); |
| 1098 | } | 1062 | } |
| 1099 | else | 1063 | else |
| 1100 | { | 1064 | { |
| @@ -1108,7 +1072,7 @@ QPDFObjectHandle::removeKey(std::string const& key) | @@ -1108,7 +1072,7 @@ QPDFObjectHandle::removeKey(std::string const& key) | ||
| 1108 | { | 1072 | { |
| 1109 | if (isDictionary()) | 1073 | if (isDictionary()) |
| 1110 | { | 1074 | { |
| 1111 | - dynamic_cast<QPDF_Dictionary*>(m->obj.getPointer())->removeKey(key); | 1075 | + dynamic_cast<QPDF_Dictionary*>(obj.getPointer())->removeKey(key); |
| 1112 | } | 1076 | } |
| 1113 | else | 1077 | else |
| 1114 | { | 1078 | { |
| @@ -1124,7 +1088,7 @@ QPDFObjectHandle::replaceOrRemoveKey(std::string const& key, | @@ -1124,7 +1088,7 @@ QPDFObjectHandle::replaceOrRemoveKey(std::string const& key, | ||
| 1124 | if (isDictionary()) | 1088 | if (isDictionary()) |
| 1125 | { | 1089 | { |
| 1126 | dynamic_cast<QPDF_Dictionary*>( | 1090 | dynamic_cast<QPDF_Dictionary*>( |
| 1127 | - m->obj.getPointer())->replaceOrRemoveKey(key, value); | 1091 | + obj.getPointer())->replaceOrRemoveKey(key, value); |
| 1128 | } | 1092 | } |
| 1129 | else | 1093 | else |
| 1130 | { | 1094 | { |
| @@ -1138,21 +1102,21 @@ QPDFObjectHandle | @@ -1138,21 +1102,21 @@ QPDFObjectHandle | ||
| 1138 | QPDFObjectHandle::getDict() | 1102 | QPDFObjectHandle::getDict() |
| 1139 | { | 1103 | { |
| 1140 | assertStream(); | 1104 | assertStream(); |
| 1141 | - return dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->getDict(); | 1105 | + return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getDict(); |
| 1142 | } | 1106 | } |
| 1143 | 1107 | ||
| 1144 | bool | 1108 | bool |
| 1145 | QPDFObjectHandle::isDataModified() | 1109 | QPDFObjectHandle::isDataModified() |
| 1146 | { | 1110 | { |
| 1147 | assertStream(); | 1111 | assertStream(); |
| 1148 | - return dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->isDataModified(); | 1112 | + return dynamic_cast<QPDF_Stream*>(obj.getPointer())->isDataModified(); |
| 1149 | } | 1113 | } |
| 1150 | 1114 | ||
| 1151 | void | 1115 | void |
| 1152 | QPDFObjectHandle::replaceDict(QPDFObjectHandle new_dict) | 1116 | QPDFObjectHandle::replaceDict(QPDFObjectHandle new_dict) |
| 1153 | { | 1117 | { |
| 1154 | assertStream(); | 1118 | assertStream(); |
| 1155 | - dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->replaceDict(new_dict); | 1119 | + dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceDict(new_dict); |
| 1156 | } | 1120 | } |
| 1157 | 1121 | ||
| 1158 | PointerHolder<Buffer> | 1122 | PointerHolder<Buffer> |
| @@ -1160,14 +1124,14 @@ QPDFObjectHandle::getStreamData(qpdf_stream_decode_level_e level) | @@ -1160,14 +1124,14 @@ QPDFObjectHandle::getStreamData(qpdf_stream_decode_level_e level) | ||
| 1160 | { | 1124 | { |
| 1161 | assertStream(); | 1125 | assertStream(); |
| 1162 | return dynamic_cast<QPDF_Stream*>( | 1126 | return dynamic_cast<QPDF_Stream*>( |
| 1163 | - m->obj.getPointer())->getStreamData(level); | 1127 | + obj.getPointer())->getStreamData(level); |
| 1164 | } | 1128 | } |
| 1165 | 1129 | ||
| 1166 | PointerHolder<Buffer> | 1130 | PointerHolder<Buffer> |
| 1167 | QPDFObjectHandle::getRawStreamData() | 1131 | QPDFObjectHandle::getRawStreamData() |
| 1168 | { | 1132 | { |
| 1169 | assertStream(); | 1133 | assertStream(); |
| 1170 | - return dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->getRawStreamData(); | 1134 | + return dynamic_cast<QPDF_Stream*>(obj.getPointer())->getRawStreamData(); |
| 1171 | } | 1135 | } |
| 1172 | 1136 | ||
| 1173 | bool | 1137 | bool |
| @@ -1177,7 +1141,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, | @@ -1177,7 +1141,7 @@ QPDFObjectHandle::pipeStreamData(Pipeline* p, | ||
| 1177 | bool suppress_warnings, bool will_retry) | 1141 | bool suppress_warnings, bool will_retry) |
| 1178 | { | 1142 | { |
| 1179 | assertStream(); | 1143 | assertStream(); |
| 1180 | - return dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->pipeStreamData( | 1144 | + return dynamic_cast<QPDF_Stream*>(obj.getPointer())->pipeStreamData( |
| 1181 | p, encode_flags, decode_level, suppress_warnings, will_retry); | 1145 | p, encode_flags, decode_level, suppress_warnings, will_retry); |
| 1182 | } | 1146 | } |
| 1183 | 1147 | ||
| @@ -1208,7 +1172,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<Buffer> data, | @@ -1208,7 +1172,7 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<Buffer> data, | ||
| 1208 | QPDFObjectHandle const& decode_parms) | 1172 | QPDFObjectHandle const& decode_parms) |
| 1209 | { | 1173 | { |
| 1210 | assertStream(); | 1174 | assertStream(); |
| 1211 | - dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->replaceStreamData( | 1175 | + dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( |
| 1212 | data, filter, decode_parms); | 1176 | data, filter, decode_parms); |
| 1213 | } | 1177 | } |
| 1214 | 1178 | ||
| @@ -1221,7 +1185,7 @@ QPDFObjectHandle::replaceStreamData(std::string const& data, | @@ -1221,7 +1185,7 @@ QPDFObjectHandle::replaceStreamData(std::string const& data, | ||
| 1221 | PointerHolder<Buffer> b = new Buffer(data.length()); | 1185 | PointerHolder<Buffer> b = new Buffer(data.length()); |
| 1222 | unsigned char* bp = b->getBuffer(); | 1186 | unsigned char* bp = b->getBuffer(); |
| 1223 | memcpy(bp, data.c_str(), data.length()); | 1187 | memcpy(bp, data.c_str(), data.length()); |
| 1224 | - dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->replaceStreamData( | 1188 | + dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( |
| 1225 | b, filter, decode_parms); | 1189 | b, filter, decode_parms); |
| 1226 | } | 1190 | } |
| 1227 | 1191 | ||
| @@ -1231,26 +1195,26 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<StreamDataProvider> provider, | @@ -1231,26 +1195,26 @@ QPDFObjectHandle::replaceStreamData(PointerHolder<StreamDataProvider> provider, | ||
| 1231 | QPDFObjectHandle const& decode_parms) | 1195 | QPDFObjectHandle const& decode_parms) |
| 1232 | { | 1196 | { |
| 1233 | assertStream(); | 1197 | assertStream(); |
| 1234 | - dynamic_cast<QPDF_Stream*>(m->obj.getPointer())->replaceStreamData( | 1198 | + dynamic_cast<QPDF_Stream*>(obj.getPointer())->replaceStreamData( |
| 1235 | provider, filter, decode_parms); | 1199 | provider, filter, decode_parms); |
| 1236 | } | 1200 | } |
| 1237 | 1201 | ||
| 1238 | QPDFObjGen | 1202 | QPDFObjGen |
| 1239 | QPDFObjectHandle::getObjGen() const | 1203 | QPDFObjectHandle::getObjGen() const |
| 1240 | { | 1204 | { |
| 1241 | - return QPDFObjGen(this->m->objid, this->m->generation); | 1205 | + return QPDFObjGen(this->objid, this->generation); |
| 1242 | } | 1206 | } |
| 1243 | 1207 | ||
| 1244 | int | 1208 | int |
| 1245 | QPDFObjectHandle::getObjectID() const | 1209 | QPDFObjectHandle::getObjectID() const |
| 1246 | { | 1210 | { |
| 1247 | - return this->m->objid; | 1211 | + return this->objid; |
| 1248 | } | 1212 | } |
| 1249 | 1213 | ||
| 1250 | int | 1214 | int |
| 1251 | QPDFObjectHandle::getGeneration() const | 1215 | QPDFObjectHandle::getGeneration() const |
| 1252 | { | 1216 | { |
| 1253 | - return this->m->generation; | 1217 | + return this->generation; |
| 1254 | } | 1218 | } |
| 1255 | 1219 | ||
| 1256 | std::map<std::string, QPDFObjectHandle> | 1220 | std::map<std::string, QPDFObjectHandle> |
| @@ -1352,8 +1316,8 @@ std::vector<QPDFObjectHandle> | @@ -1352,8 +1316,8 @@ std::vector<QPDFObjectHandle> | ||
| 1352 | QPDFObjectHandle::getPageContents() | 1316 | QPDFObjectHandle::getPageContents() |
| 1353 | { | 1317 | { |
| 1354 | std::string description = "page object " + | 1318 | std::string description = "page object " + |
| 1355 | - QUtil::int_to_string(this->m->objid) + " " + | ||
| 1356 | - QUtil::int_to_string(this->m->generation); | 1319 | + QUtil::int_to_string(this->objid) + " " + |
| 1320 | + QUtil::int_to_string(this->generation); | ||
| 1357 | std::string all_description; | 1321 | std::string all_description; |
| 1358 | return this->getKey("/Contents").arrayOrStreamToStreamArray( | 1322 | return this->getKey("/Contents").arrayOrStreamToStreamArray( |
| 1359 | description, all_description); | 1323 | description, all_description); |
| @@ -1480,8 +1444,8 @@ QPDFObjectHandle::unparse() | @@ -1480,8 +1444,8 @@ QPDFObjectHandle::unparse() | ||
| 1480 | std::string result; | 1444 | std::string result; |
| 1481 | if (this->isIndirect()) | 1445 | if (this->isIndirect()) |
| 1482 | { | 1446 | { |
| 1483 | - result = QUtil::int_to_string(this->m->objid) + " " + | ||
| 1484 | - QUtil::int_to_string(this->m->generation) + " R"; | 1447 | + result = QUtil::int_to_string(this->objid) + " " + |
| 1448 | + QUtil::int_to_string(this->generation) + " R"; | ||
| 1485 | } | 1449 | } |
| 1486 | else | 1450 | else |
| 1487 | { | 1451 | { |
| @@ -1493,13 +1457,13 @@ QPDFObjectHandle::unparse() | @@ -1493,13 +1457,13 @@ QPDFObjectHandle::unparse() | ||
| 1493 | std::string | 1457 | std::string |
| 1494 | QPDFObjectHandle::unparseResolved() | 1458 | QPDFObjectHandle::unparseResolved() |
| 1495 | { | 1459 | { |
| 1496 | - if (this->m->reserved) | 1460 | + if (this->reserved) |
| 1497 | { | 1461 | { |
| 1498 | throw std::logic_error( | 1462 | throw std::logic_error( |
| 1499 | "QPDFObjectHandle: attempting to unparse a reserved object"); | 1463 | "QPDFObjectHandle: attempting to unparse a reserved object"); |
| 1500 | } | 1464 | } |
| 1501 | dereference(); | 1465 | dereference(); |
| 1502 | - return this->m->obj->unparse(); | 1466 | + return this->obj->unparse(); |
| 1503 | } | 1467 | } |
| 1504 | 1468 | ||
| 1505 | std::string | 1469 | std::string |
| @@ -1508,7 +1472,7 @@ QPDFObjectHandle::unparseBinary() | @@ -1508,7 +1472,7 @@ QPDFObjectHandle::unparseBinary() | ||
| 1508 | if (this->isString()) | 1472 | if (this->isString()) |
| 1509 | { | 1473 | { |
| 1510 | return dynamic_cast<QPDF_String*>( | 1474 | return dynamic_cast<QPDF_String*>( |
| 1511 | - this->m->obj.getPointer())->unparse(true); | 1475 | + this->obj.getPointer())->unparse(true); |
| 1512 | } | 1476 | } |
| 1513 | else | 1477 | else |
| 1514 | { | 1478 | { |
| @@ -1525,13 +1489,13 @@ QPDFObjectHandle::getJSON(bool dereference_indirect) | @@ -1525,13 +1489,13 @@ QPDFObjectHandle::getJSON(bool dereference_indirect) | ||
| 1525 | } | 1489 | } |
| 1526 | else | 1490 | else |
| 1527 | { | 1491 | { |
| 1528 | - if (this->m->reserved) | 1492 | + if (this->reserved) |
| 1529 | { | 1493 | { |
| 1530 | throw std::logic_error( | 1494 | throw std::logic_error( |
| 1531 | "QPDFObjectHandle: attempting to unparse a reserved object"); | 1495 | "QPDFObjectHandle: attempting to unparse a reserved object"); |
| 1532 | } | 1496 | } |
| 1533 | dereference(); | 1497 | dereference(); |
| 1534 | - return this->m->obj->getJSON(); | 1498 | + return this->obj->getJSON(); |
| 1535 | } | 1499 | } |
| 1536 | } | 1500 | } |
| 1537 | 1501 | ||
| @@ -1577,8 +1541,8 @@ void | @@ -1577,8 +1541,8 @@ void | ||
| 1577 | QPDFObjectHandle::pipePageContents(Pipeline* p) | 1541 | QPDFObjectHandle::pipePageContents(Pipeline* p) |
| 1578 | { | 1542 | { |
| 1579 | std::string description = "page object " + | 1543 | std::string description = "page object " + |
| 1580 | - QUtil::int_to_string(this->m->objid) + " " + | ||
| 1581 | - QUtil::int_to_string(this->m->generation); | 1544 | + QUtil::int_to_string(this->objid) + " " + |
| 1545 | + QUtil::int_to_string(this->generation); | ||
| 1582 | std::string all_description; | 1546 | std::string all_description; |
| 1583 | this->getKey("/Contents").pipeContentStreams( | 1547 | this->getKey("/Contents").pipeContentStreams( |
| 1584 | p, description, all_description); | 1548 | p, description, all_description); |
| @@ -1613,8 +1577,8 @@ void | @@ -1613,8 +1577,8 @@ void | ||
| 1613 | QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) | 1577 | QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) |
| 1614 | { | 1578 | { |
| 1615 | std::string description = "page object " + | 1579 | std::string description = "page object " + |
| 1616 | - QUtil::int_to_string(this->m->objid) + " " + | ||
| 1617 | - QUtil::int_to_string(this->m->generation); | 1580 | + QUtil::int_to_string(this->objid) + " " + |
| 1581 | + QUtil::int_to_string(this->generation); | ||
| 1618 | this->getKey("/Contents").parseContentStream_internal( | 1582 | this->getKey("/Contents").parseContentStream_internal( |
| 1619 | description, callbacks); | 1583 | description, callbacks); |
| 1620 | } | 1584 | } |
| @@ -1623,8 +1587,8 @@ void | @@ -1623,8 +1587,8 @@ void | ||
| 1623 | QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) | 1587 | QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) |
| 1624 | { | 1588 | { |
| 1625 | std::string description = "token filter for page object " + | 1589 | std::string description = "token filter for page object " + |
| 1626 | - QUtil::int_to_string(this->m->objid) + " " + | ||
| 1627 | - QUtil::int_to_string(this->m->generation); | 1590 | + QUtil::int_to_string(this->objid) + " " + |
| 1591 | + QUtil::int_to_string(this->generation); | ||
| 1628 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); | 1592 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); |
| 1629 | this->pipePageContents(&token_pipeline); | 1593 | this->pipePageContents(&token_pipeline); |
| 1630 | } | 1594 | } |
| @@ -1633,8 +1597,8 @@ void | @@ -1633,8 +1597,8 @@ void | ||
| 1633 | QPDFObjectHandle::filterAsContents(TokenFilter* filter, Pipeline* next) | 1597 | QPDFObjectHandle::filterAsContents(TokenFilter* filter, Pipeline* next) |
| 1634 | { | 1598 | { |
| 1635 | std::string description = "token filter for object " + | 1599 | std::string description = "token filter for object " + |
| 1636 | - QUtil::int_to_string(this->m->objid) + " " + | ||
| 1637 | - QUtil::int_to_string(this->m->generation); | 1600 | + QUtil::int_to_string(this->objid) + " " + |
| 1601 | + QUtil::int_to_string(this->generation); | ||
| 1638 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); | 1602 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); |
| 1639 | this->pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized); | 1603 | this->pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized); |
| 1640 | } | 1604 | } |
| @@ -1745,7 +1709,7 @@ QPDFObjectHandle::addTokenFilter(PointerHolder<TokenFilter> filter) | @@ -1745,7 +1709,7 @@ QPDFObjectHandle::addTokenFilter(PointerHolder<TokenFilter> filter) | ||
| 1745 | { | 1709 | { |
| 1746 | assertStream(); | 1710 | assertStream(); |
| 1747 | return dynamic_cast<QPDF_Stream*>( | 1711 | return dynamic_cast<QPDF_Stream*>( |
| 1748 | - m->obj.getPointer())->addTokenFilter(filter); | 1712 | + obj.getPointer())->addTokenFilter(filter); |
| 1749 | } | 1713 | } |
| 1750 | 1714 | ||
| 1751 | QPDFObjectHandle | 1715 | QPDFObjectHandle |
| @@ -2258,15 +2222,15 @@ qpdf_offset_t | @@ -2258,15 +2222,15 @@ qpdf_offset_t | ||
| 2258 | QPDFObjectHandle::getParsedOffset() | 2222 | QPDFObjectHandle::getParsedOffset() |
| 2259 | { | 2223 | { |
| 2260 | dereference(); | 2224 | dereference(); |
| 2261 | - return this->m->obj->getParsedOffset(); | 2225 | + return this->obj->getParsedOffset(); |
| 2262 | } | 2226 | } |
| 2263 | 2227 | ||
| 2264 | void | 2228 | void |
| 2265 | QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset) | 2229 | QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset) |
| 2266 | { | 2230 | { |
| 2267 | - if (this->m->obj.getPointer()) | 2231 | + if (this->obj.getPointer()) |
| 2268 | { | 2232 | { |
| 2269 | - this->m->obj->setParsedOffset(offset); | 2233 | + this->obj->setParsedOffset(offset); |
| 2270 | } | 2234 | } |
| 2271 | } | 2235 | } |
| 2272 | 2236 | ||
| @@ -2438,7 +2402,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf) | @@ -2438,7 +2402,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf) | ||
| 2438 | new QPDF_Stream(qpdf, 0, 0, stream_dict, 0, 0))); | 2402 | new QPDF_Stream(qpdf, 0, 0, stream_dict, 0, 0))); |
| 2439 | result.dereference(); | 2403 | result.dereference(); |
| 2440 | QPDF_Stream* stream = | 2404 | QPDF_Stream* stream = |
| 2441 | - dynamic_cast<QPDF_Stream*>(result.m->obj.getPointer()); | 2405 | + dynamic_cast<QPDF_Stream*>(result.obj.getPointer()); |
| 2442 | stream->setObjGen(result.getObjectID(), result.getGeneration()); | 2406 | stream->setObjGen(result.getObjectID(), result.getGeneration()); |
| 2443 | return result; | 2407 | return result; |
| 2444 | } | 2408 | } |
| @@ -2469,8 +2433,8 @@ QPDFObjectHandle::newReserved(QPDF* qpdf) | @@ -2469,8 +2433,8 @@ QPDFObjectHandle::newReserved(QPDF* qpdf) | ||
| 2469 | QPDFObjectHandle reserved = qpdf->makeIndirectObject( | 2433 | QPDFObjectHandle reserved = qpdf->makeIndirectObject( |
| 2470 | QPDFObjectHandle(new QPDF_Reserved())); | 2434 | QPDFObjectHandle(new QPDF_Reserved())); |
| 2471 | QPDFObjectHandle result = | 2435 | QPDFObjectHandle result = |
| 2472 | - newIndirect(qpdf, reserved.m->objid, reserved.m->generation); | ||
| 2473 | - result.m->reserved = true; | 2436 | + newIndirect(qpdf, reserved.objid, reserved.generation); |
| 2437 | + result.reserved = true; | ||
| 2474 | return result; | 2438 | return result; |
| 2475 | } | 2439 | } |
| 2476 | 2440 | ||
| @@ -2478,18 +2442,18 @@ void | @@ -2478,18 +2442,18 @@ void | ||
| 2478 | QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf, | 2442 | QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf, |
| 2479 | std::string const& object_description) | 2443 | std::string const& object_description) |
| 2480 | { | 2444 | { |
| 2481 | - if (isInitialized() && this->m->obj.getPointer()) | 2445 | + if (isInitialized() && this->obj.getPointer()) |
| 2482 | { | 2446 | { |
| 2483 | - this->m->obj->setDescription(owning_qpdf, object_description); | 2447 | + this->obj->setDescription(owning_qpdf, object_description); |
| 2484 | } | 2448 | } |
| 2485 | } | 2449 | } |
| 2486 | 2450 | ||
| 2487 | bool | 2451 | bool |
| 2488 | QPDFObjectHandle::hasObjectDescription() | 2452 | QPDFObjectHandle::hasObjectDescription() |
| 2489 | { | 2453 | { |
| 2490 | - if (isInitialized() && this->m->obj.getPointer()) | 2454 | + if (isInitialized() && this->obj.getPointer()) |
| 2491 | { | 2455 | { |
| 2492 | - return this->m->obj->hasDescription(); | 2456 | + return this->obj->hasDescription(); |
| 2493 | } | 2457 | } |
| 2494 | return false; | 2458 | return false; |
| 2495 | } | 2459 | } |
| @@ -2511,7 +2475,7 @@ QPDFObjectHandle::shallowCopy() | @@ -2511,7 +2475,7 @@ QPDFObjectHandle::shallowCopy() | ||
| 2511 | { | 2475 | { |
| 2512 | QTC::TC("qpdf", "QPDFObjectHandle shallow copy array"); | 2476 | QTC::TC("qpdf", "QPDFObjectHandle shallow copy array"); |
| 2513 | // No newArray for shallow copying the sparse array | 2477 | // No newArray for shallow copying the sparse array |
| 2514 | - QPDF_Array* arr = dynamic_cast<QPDF_Array*>(m->obj.getPointer()); | 2478 | + QPDF_Array* arr = dynamic_cast<QPDF_Array*>(obj.getPointer()); |
| 2515 | new_obj = QPDFObjectHandle( | 2479 | new_obj = QPDFObjectHandle( |
| 2516 | new QPDF_Array(arr->getElementsForShallowCopy())); | 2480 | new QPDF_Array(arr->getElementsForShallowCopy())); |
| 2517 | } | 2481 | } |
| @@ -2544,7 +2508,7 @@ QPDFObjectHandle::copyObject(std::set<QPDFObjGen>& visited, | @@ -2544,7 +2508,7 @@ QPDFObjectHandle::copyObject(std::set<QPDFObjGen>& visited, | ||
| 2544 | "attempt to make a stream into a direct object"); | 2508 | "attempt to make a stream into a direct object"); |
| 2545 | } | 2509 | } |
| 2546 | 2510 | ||
| 2547 | - QPDFObjGen cur_og(this->m->objid, this->m->generation); | 2511 | + QPDFObjGen cur_og(this->objid, this->generation); |
| 2548 | if (cur_og.getObj() != 0) | 2512 | if (cur_og.getObj() != 0) |
| 2549 | { | 2513 | { |
| 2550 | if (visited.count(cur_og)) | 2514 | if (visited.count(cur_og)) |
| @@ -2565,9 +2529,9 @@ QPDFObjectHandle::copyObject(std::set<QPDFObjGen>& visited, | @@ -2565,9 +2529,9 @@ QPDFObjectHandle::copyObject(std::set<QPDFObjGen>& visited, | ||
| 2565 | } | 2529 | } |
| 2566 | 2530 | ||
| 2567 | dereference(); | 2531 | dereference(); |
| 2568 | - this->m->qpdf = 0; | ||
| 2569 | - this->m->objid = 0; | ||
| 2570 | - this->m->generation = 0; | 2532 | + this->qpdf = 0; |
| 2533 | + this->objid = 0; | ||
| 2534 | + this->generation = 0; | ||
| 2571 | 2535 | ||
| 2572 | PointerHolder<QPDFObject> new_obj; | 2536 | PointerHolder<QPDFObject> new_obj; |
| 2573 | 2537 | ||
| @@ -2638,7 +2602,7 @@ QPDFObjectHandle::copyObject(std::set<QPDFObjGen>& visited, | @@ -2638,7 +2602,7 @@ QPDFObjectHandle::copyObject(std::set<QPDFObjGen>& visited, | ||
| 2638 | "unknown object type"); | 2602 | "unknown object type"); |
| 2639 | } | 2603 | } |
| 2640 | 2604 | ||
| 2641 | - this->m->obj = new_obj; | 2605 | + this->obj = new_obj; |
| 2642 | 2606 | ||
| 2643 | if (cur_og.getObj()) | 2607 | if (cur_og.getObj()) |
| 2644 | { | 2608 | { |
| @@ -2656,7 +2620,7 @@ QPDFObjectHandle::makeDirect() | @@ -2656,7 +2620,7 @@ QPDFObjectHandle::makeDirect() | ||
| 2656 | void | 2620 | void |
| 2657 | QPDFObjectHandle::assertInitialized() const | 2621 | QPDFObjectHandle::assertInitialized() const |
| 2658 | { | 2622 | { |
| 2659 | - if (! this->m->initialized) | 2623 | + if (! this->initialized) |
| 2660 | { | 2624 | { |
| 2661 | throw std::logic_error("operation attempted on uninitialized " | 2625 | throw std::logic_error("operation attempted on uninitialized " |
| 2662 | "QPDFObjectHandle"); | 2626 | "QPDFObjectHandle"); |
| @@ -2669,7 +2633,7 @@ QPDFObjectHandle::typeWarning(char const* expected_type, | @@ -2669,7 +2633,7 @@ QPDFObjectHandle::typeWarning(char const* expected_type, | ||
| 2669 | { | 2633 | { |
| 2670 | QPDF* context = 0; | 2634 | QPDF* context = 0; |
| 2671 | std::string description; | 2635 | std::string description; |
| 2672 | - if (this->m->obj->getDescription(context, description)) | 2636 | + if (this->obj->getDescription(context, description)) |
| 2673 | { | 2637 | { |
| 2674 | warn(context, | 2638 | warn(context, |
| 2675 | QPDFExc( | 2639 | QPDFExc( |
| @@ -2691,7 +2655,7 @@ QPDFObjectHandle::warnIfPossible(std::string const& warning, | @@ -2691,7 +2655,7 @@ QPDFObjectHandle::warnIfPossible(std::string const& warning, | ||
| 2691 | { | 2655 | { |
| 2692 | QPDF* context = 0; | 2656 | QPDF* context = 0; |
| 2693 | std::string description; | 2657 | std::string description; |
| 2694 | - if (this->m->obj->getDescription(context, description)) | 2658 | + if (this->obj->getDescription(context, description)) |
| 2695 | { | 2659 | { |
| 2696 | warn(context, | 2660 | warn(context, |
| 2697 | QPDFExc( | 2661 | QPDFExc( |
| @@ -2863,15 +2827,15 @@ QPDFObjectHandle::assertPageObject() | @@ -2863,15 +2827,15 @@ QPDFObjectHandle::assertPageObject() | ||
| 2863 | void | 2827 | void |
| 2864 | QPDFObjectHandle::dereference() | 2828 | QPDFObjectHandle::dereference() |
| 2865 | { | 2829 | { |
| 2866 | - if (this->m->obj.getPointer() == 0) | 2830 | + if (this->obj.getPointer() == 0) |
| 2867 | { | 2831 | { |
| 2868 | PointerHolder<QPDFObject> obj = QPDF::Resolver::resolve( | 2832 | PointerHolder<QPDFObject> obj = QPDF::Resolver::resolve( |
| 2869 | - this->m->qpdf, this->m->objid, this->m->generation); | 2833 | + this->qpdf, this->objid, this->generation); |
| 2870 | if (obj.getPointer() == 0) | 2834 | if (obj.getPointer() == 0) |
| 2871 | { | 2835 | { |
| 2872 | // QPDF::resolve never returns an uninitialized object, but | 2836 | // QPDF::resolve never returns an uninitialized object, but |
| 2873 | // check just in case. | 2837 | // check just in case. |
| 2874 | - this->m->obj = new QPDF_Null(); | 2838 | + this->obj = new QPDF_Null(); |
| 2875 | } | 2839 | } |
| 2876 | else if (dynamic_cast<QPDF_Reserved*>(obj.getPointer())) | 2840 | else if (dynamic_cast<QPDF_Reserved*>(obj.getPointer())) |
| 2877 | { | 2841 | { |
| @@ -2879,8 +2843,8 @@ QPDFObjectHandle::dereference() | @@ -2879,8 +2843,8 @@ QPDFObjectHandle::dereference() | ||
| 2879 | } | 2843 | } |
| 2880 | else | 2844 | else |
| 2881 | { | 2845 | { |
| 2882 | - this->m->reserved = false; | ||
| 2883 | - this->m->obj = obj; | 2846 | + this->reserved = false; |
| 2847 | + this->obj = obj; | ||
| 2884 | } | 2848 | } |
| 2885 | } | 2849 | } |
| 2886 | } | 2850 | } |