Commit 2a7d2b63c2a7284d1b1179eefbf64f5dd29aa510
1 parent
dd359663
Make ABI-breaking changes that don't modify API at all
* Merge overloaded functions by adding default values * Remove non-const methods that are identical to const methods
Showing
12 changed files
with
12 additions
and
116 deletions
TODO
| ... | ... | @@ -481,12 +481,10 @@ Comments appear in the code prefixed by "ABI" |
| 481 | 481 | |
| 482 | 482 | * Search for ABI to find items not listed here. |
| 483 | 483 | * Switch default --json to latest |
| 484 | -* See PointerHolder to std::shared_ptr above. | |
| 485 | 484 | * See where anonymous namespaces can be used to keep things private to |
| 486 | 485 | a source file. Search for `(class|struct)` in **/*.cc. |
| 487 | 486 | * See if we can use constructor delegation instead of init() in |
| 488 | 487 | classes with overloaded constructors. |
| 489 | -* Merge two versions of QPDFObjectHandle::makeDirect per comment | |
| 490 | 488 | * After removing legacy QPDFNameTreeObjectHelper and |
| 491 | 489 | QPDFNumberTreeObjectHelper constructors, NNTreeImpl can switch to |
| 492 | 490 | having a QPDF reference and assume that the reference is always | ... | ... |
include/qpdf/QPDF.hh
| ... | ... | @@ -619,13 +619,8 @@ class QPDF |
| 619 | 619 | QPDF_DLL |
| 620 | 620 | void optimize( |
| 621 | 621 | std::map<int, int> const& object_stream_data, |
| 622 | - bool allow_changes = true); | |
| 623 | - // ABI: make function optional and merge overloaded versions | |
| 624 | - QPDF_DLL | |
| 625 | - void optimize( | |
| 626 | - std::map<int, int> const& object_stream_data, | |
| 627 | - bool allow_changes, | |
| 628 | - std::function<int(QPDFObjectHandle&)> skip_stream_parameters); | |
| 622 | + bool allow_changes = true, | |
| 623 | + std::function<int(QPDFObjectHandle&)> skip_stream_parameters = nullptr); | |
| 629 | 624 | |
| 630 | 625 | // Traverse page tree return all /Page objects. It also detects |
| 631 | 626 | // and resolves cases in which the same /Page object is | ... | ... |
include/qpdf/QPDFMatrix.hh
| ... | ... | @@ -74,9 +74,6 @@ class QPDFMatrix |
| 74 | 74 | // and take the first and second rows of the result as xp and yp. |
| 75 | 75 | QPDF_DLL |
| 76 | 76 | void transform(double x, double y, double& xp, double& yp) const; |
| 77 | - // ABI: delete non-const version | |
| 78 | - QPDF_DLL | |
| 79 | - void transform(double x, double y, double& xp, double& yp); | |
| 80 | 77 | |
| 81 | 78 | // Transform a rectangle by creating a new rectangle that tightly |
| 82 | 79 | // bounds the polygon resulting from transforming the four |
| ... | ... | @@ -84,10 +81,6 @@ class QPDFMatrix |
| 84 | 81 | QPDF_DLL |
| 85 | 82 | QPDFObjectHandle::Rectangle |
| 86 | 83 | transformRectangle(QPDFObjectHandle::Rectangle r) const; |
| 87 | - // ABI: delete non-const version | |
| 88 | - QPDF_DLL | |
| 89 | - QPDFObjectHandle::Rectangle | |
| 90 | - transformRectangle(QPDFObjectHandle::Rectangle r); | |
| 91 | 84 | |
| 92 | 85 | // operator== tests for exact equality, not considering deltas for |
| 93 | 86 | // floating point. | ... | ... |
include/qpdf/QPDFNameTreeObjectHelper.hh
include/qpdf/QPDFObjectHandle.hh
| ... | ... | @@ -530,12 +530,8 @@ class QPDFObjectHandle |
| 530 | 530 | QPDF_DLL |
| 531 | 531 | static QPDFObjectHandle newReal(std::string const& value); |
| 532 | 532 | QPDF_DLL |
| 533 | - static QPDFObjectHandle newReal(double value, int decimal_places = 0); | |
| 534 | - // ABI: combine with other newReal by adding trim_trailing_zeroes | |
| 535 | - // above as an optional parameter with a default of true. | |
| 536 | - QPDF_DLL | |
| 537 | - static QPDFObjectHandle | |
| 538 | - newReal(double value, int decimal_places, bool trim_trailing_zeroes); | |
| 533 | + static QPDFObjectHandle newReal( | |
| 534 | + double value, int decimal_places = 0, bool trim_trailing_zeroes = true); | |
| 539 | 535 | // Note about name objects: qpdf's internal representation of a |
| 540 | 536 | // PDF name is a sequence of bytes, excluding the NUL character, |
| 541 | 537 | // and starting with a slash. Name objects as represented in the |
| ... | ... | @@ -933,11 +929,8 @@ class QPDFObjectHandle |
| 933 | 929 | QPDF_DLL |
| 934 | 930 | void mergeResources( |
| 935 | 931 | QPDFObjectHandle other, |
| 936 | - std::map<std::string, std::map<std::string, std::string>>* conflicts); | |
| 937 | - // ABI: eliminate version without conflicts and make conflicts | |
| 938 | - // default to nullptr. | |
| 939 | - QPDF_DLL | |
| 940 | - void mergeResources(QPDFObjectHandle other); | |
| 932 | + std::map<std::string, std::map<std::string, std::string>>* conflicts = | |
| 933 | + nullptr); | |
| 941 | 934 | |
| 942 | 935 | // Get all resource names from a resource dictionary. If this |
| 943 | 936 | // object is a dictionary, this method returns a set of all the |
| ... | ... | @@ -964,12 +957,7 @@ class QPDFObjectHandle |
| 964 | 957 | std::string getUniqueResourceName( |
| 965 | 958 | std::string const& prefix, |
| 966 | 959 | int& min_suffix, |
| 967 | - std::set<std::string>* resource_names); | |
| 968 | - // ABI: remove this version and make resource_names default to | |
| 969 | - // nullptr. | |
| 970 | - QPDF_DLL | |
| 971 | - std::string | |
| 972 | - getUniqueResourceName(std::string const& prefix, int& min_suffix); | |
| 960 | + std::set<std::string>* resource_names = nullptr); | |
| 973 | 961 | |
| 974 | 962 | // Return the QPDF object that owns an indirect object. Returns |
| 975 | 963 | // null for a direct object. |
| ... | ... | @@ -1024,12 +1012,7 @@ class QPDFObjectHandle |
| 1024 | 1012 | // to the original QPDF object after this call completes |
| 1025 | 1013 | // successfully. |
| 1026 | 1014 | QPDF_DLL |
| 1027 | - void makeDirect(bool allow_streams); | |
| 1028 | - // Zero-arg version is equivalent to makeDirect(false). | |
| 1029 | - // ABI: delete zero-arg version of makeDirect, and make | |
| 1030 | - // allow_streams default to false. | |
| 1031 | - QPDF_DLL | |
| 1032 | - void makeDirect(); | |
| 1015 | + void makeDirect(bool allow_streams = false); | |
| 1033 | 1016 | |
| 1034 | 1017 | // Mutator methods for array objects |
| 1035 | 1018 | QPDF_DLL | ... | ... |
include/qpdf/QPDFPageObjectHelper.hh
| ... | ... | @@ -132,10 +132,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper |
| 132 | 132 | // this behavior. Prior to qpdf 10.1, form XObjects were ignored, |
| 133 | 133 | // but this was considered a bug. |
| 134 | 134 | QPDF_DLL |
| 135 | - void externalizeInlineImages(size_t min_size, bool shallow); | |
| 136 | - // ABI: make shallow optional (default false) and merge | |
| 137 | - QPDF_DLL | |
| 138 | - void externalizeInlineImages(size_t min_size = 0); | |
| 135 | + void externalizeInlineImages(size_t min_size = 0, bool shallow = false); | |
| 139 | 136 | |
| 140 | 137 | // Return the annotations in the page's "/Annots" list, if any. If |
| 141 | 138 | // only_subtype is non-empty, only include annotations of the |
| ... | ... | @@ -344,10 +341,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper |
| 344 | 341 | // rotated. If not, one will be created inside the function, which |
| 345 | 342 | // is less efficient. |
| 346 | 343 | QPDF_DLL |
| 347 | - void flattenRotation(); | |
| 348 | - // ABI: merge versions and make afdh default to nullptr | |
| 349 | - QPDF_DLL | |
| 350 | - void flattenRotation(QPDFAcroFormDocumentHelper* afdh); | |
| 344 | + void flattenRotation(QPDFAcroFormDocumentHelper* afdh = nullptr); | |
| 351 | 345 | |
| 352 | 346 | // Copy annotations from another page into this page. The other |
| 353 | 347 | // page may be from the same QPDF or from a different QPDF. Each | ... | ... |
include/qpdf/QUtil.hh
| ... | ... | @@ -51,13 +51,8 @@ namespace QUtil |
| 51 | 51 | std::string |
| 52 | 52 | uint_to_string_base(unsigned long long, int base, int length = 0); |
| 53 | 53 | QPDF_DLL |
| 54 | - std::string double_to_string(double, int decimal_places = 0); | |
| 55 | - // ABI: combine with other double_to_string by adding | |
| 56 | - // trim_trailing_zeroes above as an optional parameter with a | |
| 57 | - // default of true. | |
| 58 | - QPDF_DLL | |
| 59 | - std::string | |
| 60 | - double_to_string(double, int decimal_places, bool trim_trailing_zeroes); | |
| 54 | + std::string double_to_string( | |
| 55 | + double, int decimal_places = 0, bool trim_trailing_zeroes = true); | |
| 61 | 56 | |
| 62 | 57 | // These string to number methods throw std::runtime_error on |
| 63 | 58 | // underflow/overflow. | ... | ... |
libqpdf/QPDFMatrix.cc
| ... | ... | @@ -110,12 +110,6 @@ QPDFMatrix::rotatex90(int angle) |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | void |
| 113 | -QPDFMatrix::transform(double x, double y, double& xp, double& yp) | |
| 114 | -{ | |
| 115 | - const_cast<QPDFMatrix const*>(this)->transform(x, y, xp, yp); | |
| 116 | -} | |
| 117 | - | |
| 118 | -void | |
| 119 | 113 | QPDFMatrix::transform(double x, double y, double& xp, double& yp) const |
| 120 | 114 | { |
| 121 | 115 | xp = (this->a * x) + (this->c * y) + this->e; |
| ... | ... | @@ -123,12 +117,6 @@ QPDFMatrix::transform(double x, double y, double& xp, double& yp) const |
| 123 | 117 | } |
| 124 | 118 | |
| 125 | 119 | QPDFObjectHandle::Rectangle |
| 126 | -QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) | |
| 127 | -{ | |
| 128 | - return const_cast<QPDFMatrix const*>(this)->transformRectangle(r); | |
| 129 | -} | |
| 130 | - | |
| 131 | -QPDFObjectHandle::Rectangle | |
| 132 | 120 | QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const |
| 133 | 121 | { |
| 134 | 122 | std::vector<double> tx(4); | ... | ... |
libqpdf/QPDFObjectHandle.cc
| ... | ... | @@ -1095,12 +1095,6 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF& owning_qpdf) |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| 1097 | 1097 | void |
| 1098 | -QPDFObjectHandle::mergeResources(QPDFObjectHandle other) | |
| 1099 | -{ | |
| 1100 | - mergeResources(other, nullptr); | |
| 1101 | -} | |
| 1102 | - | |
| 1103 | -void | |
| 1104 | 1098 | QPDFObjectHandle::mergeResources( |
| 1105 | 1099 | QPDFObjectHandle other, |
| 1106 | 1100 | std::map<std::string, std::map<std::string, std::string>>* conflicts) |
| ... | ... | @@ -1226,13 +1220,6 @@ QPDFObjectHandle::getResourceNames() |
| 1226 | 1220 | |
| 1227 | 1221 | std::string |
| 1228 | 1222 | QPDFObjectHandle::getUniqueResourceName( |
| 1229 | - std::string const& prefix, int& min_suffix) | |
| 1230 | -{ | |
| 1231 | - return getUniqueResourceName(prefix, min_suffix, nullptr); | |
| 1232 | -} | |
| 1233 | - | |
| 1234 | -std::string | |
| 1235 | -QPDFObjectHandle::getUniqueResourceName( | |
| 1236 | 1223 | std::string const& prefix, int& min_suffix, std::set<std::string>* namesp) |
| 1237 | 1224 | |
| 1238 | 1225 | { |
| ... | ... | @@ -2540,12 +2527,6 @@ QPDFObjectHandle::newReal(std::string const& value) |
| 2540 | 2527 | } |
| 2541 | 2528 | |
| 2542 | 2529 | QPDFObjectHandle |
| 2543 | -QPDFObjectHandle::newReal(double value, int decimal_places) | |
| 2544 | -{ | |
| 2545 | - return QPDFObjectHandle(new QPDF_Real(value, decimal_places, true)); | |
| 2546 | -} | |
| 2547 | - | |
| 2548 | -QPDFObjectHandle | |
| 2549 | 2530 | QPDFObjectHandle::newReal( |
| 2550 | 2531 | double value, int decimal_places, bool trim_trailing_zeroes) |
| 2551 | 2532 | { |
| ... | ... | @@ -2916,12 +2897,6 @@ QPDFObjectHandle::copyStream() |
| 2916 | 2897 | } |
| 2917 | 2898 | |
| 2918 | 2899 | void |
| 2919 | -QPDFObjectHandle::makeDirect() | |
| 2920 | -{ | |
| 2921 | - makeDirect(false); | |
| 2922 | -} | |
| 2923 | - | |
| 2924 | -void | |
| 2925 | 2900 | QPDFObjectHandle::makeDirect(bool allow_streams) |
| 2926 | 2901 | { |
| 2927 | 2902 | std::set<QPDFObjGen> visited; | ... | ... |
libqpdf/QPDFPageObjectHelper.cc
| ... | ... | @@ -411,12 +411,6 @@ QPDFPageObjectHelper::getFormXObjects() |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | void |
| 414 | -QPDFPageObjectHelper::externalizeInlineImages(size_t min_size) | |
| 415 | -{ | |
| 416 | - externalizeInlineImages(min_size, false); | |
| 417 | -} | |
| 418 | - | |
| 419 | -void | |
| 420 | 414 | QPDFPageObjectHelper::externalizeInlineImages(size_t min_size, bool shallow) |
| 421 | 415 | { |
| 422 | 416 | if (shallow) { |
| ... | ... | @@ -930,12 +924,6 @@ QPDFPageObjectHelper::placeFormXObject( |
| 930 | 924 | } |
| 931 | 925 | |
| 932 | 926 | void |
| 933 | -QPDFPageObjectHelper::flattenRotation() | |
| 934 | -{ | |
| 935 | - flattenRotation(nullptr); | |
| 936 | -} | |
| 937 | - | |
| 938 | -void | |
| 939 | 927 | QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh) |
| 940 | 928 | { |
| 941 | 929 | QPDF* qpdf = this->oh.getOwningQPDF(); | ... | ... |
libqpdf/QPDF_optimization.cc
| ... | ... | @@ -53,12 +53,6 @@ QPDF::ObjUser::operator<(ObjUser const& rhs) const |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | void |
| 56 | -QPDF::optimize(std::map<int, int> const& object_stream_data, bool allow_changes) | |
| 57 | -{ | |
| 58 | - optimize(object_stream_data, allow_changes, nullptr); | |
| 59 | -} | |
| 60 | - | |
| 61 | -void | |
| 62 | 56 | QPDF::optimize( |
| 63 | 57 | std::map<int, int> const& object_stream_data, |
| 64 | 58 | bool allow_changes, | ... | ... |
libqpdf/QUtil.cc
| ... | ... | @@ -327,12 +327,6 @@ QUtil::uint_to_string_base(unsigned long long num, int base, int length) |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | std::string |
| 330 | -QUtil::double_to_string(double num, int decimal_places) | |
| 331 | -{ | |
| 332 | - return double_to_string(num, decimal_places, true); | |
| 333 | -} | |
| 334 | - | |
| 335 | -std::string | |
| 336 | 330 | QUtil::double_to_string( |
| 337 | 331 | double num, int decimal_places, bool trim_trailing_zeroes) |
| 338 | 332 | { | ... | ... |