diff --git a/TODO b/TODO index df978c10..7609b02e 100644 --- a/TODO +++ b/TODO @@ -481,12 +481,10 @@ Comments appear in the code prefixed by "ABI" * Search for ABI to find items not listed here. * Switch default --json to latest -* See PointerHolder to std::shared_ptr above. * See where anonymous namespaces can be used to keep things private to a source file. Search for `(class|struct)` in **/*.cc. * See if we can use constructor delegation instead of init() in classes with overloaded constructors. -* Merge two versions of QPDFObjectHandle::makeDirect per comment * After removing legacy QPDFNameTreeObjectHelper and QPDFNumberTreeObjectHelper constructors, NNTreeImpl can switch to having a QPDF reference and assume that the reference is always diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index bc65ee80..bc0096b7 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -619,13 +619,8 @@ class QPDF QPDF_DLL void optimize( std::map const& object_stream_data, - bool allow_changes = true); - // ABI: make function optional and merge overloaded versions - QPDF_DLL - void optimize( - std::map const& object_stream_data, - bool allow_changes, - std::function skip_stream_parameters); + bool allow_changes = true, + std::function skip_stream_parameters = nullptr); // Traverse page tree return all /Page objects. It also detects // and resolves cases in which the same /Page object is diff --git a/include/qpdf/QPDFMatrix.hh b/include/qpdf/QPDFMatrix.hh index f0516dbd..3dc26a7c 100644 --- a/include/qpdf/QPDFMatrix.hh +++ b/include/qpdf/QPDFMatrix.hh @@ -74,9 +74,6 @@ class QPDFMatrix // and take the first and second rows of the result as xp and yp. QPDF_DLL void transform(double x, double y, double& xp, double& yp) const; - // ABI: delete non-const version - QPDF_DLL - void transform(double x, double y, double& xp, double& yp); // Transform a rectangle by creating a new rectangle that tightly // bounds the polygon resulting from transforming the four @@ -84,10 +81,6 @@ class QPDFMatrix QPDF_DLL QPDFObjectHandle::Rectangle transformRectangle(QPDFObjectHandle::Rectangle r) const; - // ABI: delete non-const version - QPDF_DLL - QPDFObjectHandle::Rectangle - transformRectangle(QPDFObjectHandle::Rectangle r); // operator== tests for exact equality, not considering deltas for // floating point. diff --git a/include/qpdf/QPDFNameTreeObjectHelper.hh b/include/qpdf/QPDFNameTreeObjectHelper.hh index 2060579b..11d7b5a2 100644 --- a/include/qpdf/QPDFNameTreeObjectHelper.hh +++ b/include/qpdf/QPDFNameTreeObjectHelper.hh @@ -61,7 +61,6 @@ class QPDFNameTreeObjectHelper: public QPDFObjectHelper QPDF_DLL static QPDFNameTreeObjectHelper newEmpty(QPDF&, bool auto_repair = true); - // ABI: = default QPDF_DLL virtual ~QPDFNameTreeObjectHelper(); diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index b8b95f47..a09fd954 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -530,12 +530,8 @@ class QPDFObjectHandle QPDF_DLL static QPDFObjectHandle newReal(std::string const& value); QPDF_DLL - static QPDFObjectHandle newReal(double value, int decimal_places = 0); - // ABI: combine with other newReal by adding trim_trailing_zeroes - // above as an optional parameter with a default of true. - QPDF_DLL - static QPDFObjectHandle - newReal(double value, int decimal_places, bool trim_trailing_zeroes); + static QPDFObjectHandle newReal( + double value, int decimal_places = 0, bool trim_trailing_zeroes = true); // Note about name objects: qpdf's internal representation of a // PDF name is a sequence of bytes, excluding the NUL character, // and starting with a slash. Name objects as represented in the @@ -933,11 +929,8 @@ class QPDFObjectHandle QPDF_DLL void mergeResources( QPDFObjectHandle other, - std::map>* conflicts); - // ABI: eliminate version without conflicts and make conflicts - // default to nullptr. - QPDF_DLL - void mergeResources(QPDFObjectHandle other); + std::map>* conflicts = + nullptr); // Get all resource names from a resource dictionary. If this // object is a dictionary, this method returns a set of all the @@ -964,12 +957,7 @@ class QPDFObjectHandle std::string getUniqueResourceName( std::string const& prefix, int& min_suffix, - std::set* resource_names); - // ABI: remove this version and make resource_names default to - // nullptr. - QPDF_DLL - std::string - getUniqueResourceName(std::string const& prefix, int& min_suffix); + std::set* resource_names = nullptr); // Return the QPDF object that owns an indirect object. Returns // null for a direct object. @@ -1024,12 +1012,7 @@ class QPDFObjectHandle // to the original QPDF object after this call completes // successfully. QPDF_DLL - void makeDirect(bool allow_streams); - // Zero-arg version is equivalent to makeDirect(false). - // ABI: delete zero-arg version of makeDirect, and make - // allow_streams default to false. - QPDF_DLL - void makeDirect(); + void makeDirect(bool allow_streams = false); // Mutator methods for array objects QPDF_DLL diff --git a/include/qpdf/QPDFPageObjectHelper.hh b/include/qpdf/QPDFPageObjectHelper.hh index 7431a9b3..f35e4cf4 100644 --- a/include/qpdf/QPDFPageObjectHelper.hh +++ b/include/qpdf/QPDFPageObjectHelper.hh @@ -132,10 +132,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // this behavior. Prior to qpdf 10.1, form XObjects were ignored, // but this was considered a bug. QPDF_DLL - void externalizeInlineImages(size_t min_size, bool shallow); - // ABI: make shallow optional (default false) and merge - QPDF_DLL - void externalizeInlineImages(size_t min_size = 0); + void externalizeInlineImages(size_t min_size = 0, bool shallow = false); // Return the annotations in the page's "/Annots" list, if any. If // only_subtype is non-empty, only include annotations of the @@ -344,10 +341,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // rotated. If not, one will be created inside the function, which // is less efficient. QPDF_DLL - void flattenRotation(); - // ABI: merge versions and make afdh default to nullptr - QPDF_DLL - void flattenRotation(QPDFAcroFormDocumentHelper* afdh); + void flattenRotation(QPDFAcroFormDocumentHelper* afdh = nullptr); // Copy annotations from another page into this page. The other // page may be from the same QPDF or from a different QPDF. Each diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index ce2f797f..2d0b7b56 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -51,13 +51,8 @@ namespace QUtil std::string uint_to_string_base(unsigned long long, int base, int length = 0); QPDF_DLL - std::string double_to_string(double, int decimal_places = 0); - // ABI: combine with other double_to_string by adding - // trim_trailing_zeroes above as an optional parameter with a - // default of true. - QPDF_DLL - std::string - double_to_string(double, int decimal_places, bool trim_trailing_zeroes); + std::string double_to_string( + double, int decimal_places = 0, bool trim_trailing_zeroes = true); // These string to number methods throw std::runtime_error on // underflow/overflow. diff --git a/libqpdf/QPDFMatrix.cc b/libqpdf/QPDFMatrix.cc index 75049130..9fb24888 100644 --- a/libqpdf/QPDFMatrix.cc +++ b/libqpdf/QPDFMatrix.cc @@ -109,12 +109,6 @@ QPDFMatrix::rotatex90(int angle) } } -void -QPDFMatrix::transform(double x, double y, double& xp, double& yp) -{ - const_cast(this)->transform(x, y, xp, yp); -} - void QPDFMatrix::transform(double x, double y, double& xp, double& yp) const { @@ -122,12 +116,6 @@ QPDFMatrix::transform(double x, double y, double& xp, double& yp) const yp = (this->b * x) + (this->d * y) + this->f; } -QPDFObjectHandle::Rectangle -QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) -{ - return const_cast(this)->transformRectangle(r); -} - QPDFObjectHandle::Rectangle QPDFMatrix::transformRectangle(QPDFObjectHandle::Rectangle r) const { diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index d6fe8b9e..59b4942d 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1094,12 +1094,6 @@ QPDFObjectHandle::makeResourcesIndirect(QPDF& owning_qpdf) } } -void -QPDFObjectHandle::mergeResources(QPDFObjectHandle other) -{ - mergeResources(other, nullptr); -} - void QPDFObjectHandle::mergeResources( QPDFObjectHandle other, @@ -1224,13 +1218,6 @@ QPDFObjectHandle::getResourceNames() return result; } -std::string -QPDFObjectHandle::getUniqueResourceName( - std::string const& prefix, int& min_suffix) -{ - return getUniqueResourceName(prefix, min_suffix, nullptr); -} - std::string QPDFObjectHandle::getUniqueResourceName( std::string const& prefix, int& min_suffix, std::set* namesp) @@ -2539,12 +2526,6 @@ QPDFObjectHandle::newReal(std::string const& value) return QPDFObjectHandle(new QPDF_Real(value)); } -QPDFObjectHandle -QPDFObjectHandle::newReal(double value, int decimal_places) -{ - return QPDFObjectHandle(new QPDF_Real(value, decimal_places, true)); -} - QPDFObjectHandle QPDFObjectHandle::newReal( double value, int decimal_places, bool trim_trailing_zeroes) @@ -2915,12 +2896,6 @@ QPDFObjectHandle::copyStream() return result; } -void -QPDFObjectHandle::makeDirect() -{ - makeDirect(false); -} - void QPDFObjectHandle::makeDirect(bool allow_streams) { diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index 4706cb27..5ad67dea 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -410,12 +410,6 @@ QPDFPageObjectHelper::getFormXObjects() return result; } -void -QPDFPageObjectHelper::externalizeInlineImages(size_t min_size) -{ - externalizeInlineImages(min_size, false); -} - void QPDFPageObjectHelper::externalizeInlineImages(size_t min_size, bool shallow) { @@ -929,12 +923,6 @@ QPDFPageObjectHelper::placeFormXObject( return ("q\n" + cm.unparse() + " cm\n" + name + " Do\n" + "Q\n"); } -void -QPDFPageObjectHelper::flattenRotation() -{ - flattenRotation(nullptr); -} - void QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh) { diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index 3d262b03..c76e255d 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -52,12 +52,6 @@ QPDF::ObjUser::operator<(ObjUser const& rhs) const return false; } -void -QPDF::optimize(std::map const& object_stream_data, bool allow_changes) -{ - optimize(object_stream_data, allow_changes, nullptr); -} - void QPDF::optimize( std::map const& object_stream_data, diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index 711065df..6b9acb6d 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -326,12 +326,6 @@ QUtil::uint_to_string_base(unsigned long long num, int base, int length) return int_to_string_base_internal(num, base, length); } -std::string -QUtil::double_to_string(double num, int decimal_places) -{ - return double_to_string(num, decimal_places, true); -} - std::string QUtil::double_to_string( double num, int decimal_places, bool trim_trailing_zeroes)