Commit 658b5bb3be49d2666b91d35671de71c1cf0a5853
1 parent
46304bef
QPDFWriter: clean up overloaded functions
In a small number of cases, it makes sense to replace an overloaded function with a function that takes a default argument. We can do this now because we've already broken binary compatibility since the last release.
Showing
3 changed files
with
9 additions
and
33 deletions
TODO
include/qpdf/QPDFWriter.hh
| @@ -248,9 +248,7 @@ class QPDFWriter | @@ -248,9 +248,7 @@ class QPDFWriter | ||
| 248 | // R3 encryption parameters are used, and to 1.5 when object | 248 | // R3 encryption parameters are used, and to 1.5 when object |
| 249 | // streams are used. | 249 | // streams are used. |
| 250 | QPDF_DLL | 250 | QPDF_DLL |
| 251 | - void setMinimumPDFVersion(std::string const&); | ||
| 252 | - QPDF_DLL | ||
| 253 | - void setMinimumPDFVersion(std::string const&, int extension_level); | 251 | + void setMinimumPDFVersion(std::string const&, int extension_level = 0); |
| 254 | 252 | ||
| 255 | // Force the PDF version of the output file to be a given version. | 253 | // Force the PDF version of the output file to be a given version. |
| 256 | // Use of this function may create PDF files that will not work | 254 | // Use of this function may create PDF files that will not work |
| @@ -268,9 +266,7 @@ class QPDFWriter | @@ -268,9 +266,7 @@ class QPDFWriter | ||
| 268 | // Additionally, forcing to a version below 1.5 will disable | 266 | // Additionally, forcing to a version below 1.5 will disable |
| 269 | // object streams. | 267 | // object streams. |
| 270 | QPDF_DLL | 268 | QPDF_DLL |
| 271 | - void forcePDFVersion(std::string const&); | ||
| 272 | - QPDF_DLL | ||
| 273 | - void forcePDFVersion(std::string const&, int extension_level); | 269 | + void forcePDFVersion(std::string const&, int extension_level = 0); |
| 274 | 270 | ||
| 275 | // Provide additional text to insert in the PDF file somewhere | 271 | // Provide additional text to insert in the PDF file somewhere |
| 276 | // near the beginning of the file. This can be used to add | 272 | // near the beginning of the file. This can be used to add |
| @@ -483,10 +479,9 @@ class QPDFWriter | @@ -483,10 +479,9 @@ class QPDFWriter | ||
| 483 | void writeTrailer(trailer_e which, int size, | 479 | void writeTrailer(trailer_e which, int size, |
| 484 | bool xref_stream, qpdf_offset_t prev, | 480 | bool xref_stream, qpdf_offset_t prev, |
| 485 | int linearization_pass); | 481 | int linearization_pass); |
| 486 | - void unparseObject(QPDFObjectHandle object, int level, int flags); | ||
| 487 | void unparseObject(QPDFObjectHandle object, int level, int flags, | 482 | void unparseObject(QPDFObjectHandle object, int level, int flags, |
| 488 | // for stream dictionaries | 483 | // for stream dictionaries |
| 489 | - size_t stream_length, bool compress); | 484 | + size_t stream_length = 0, bool compress = false); |
| 490 | void unparseChild(QPDFObjectHandle child, int level, int flags); | 485 | void unparseChild(QPDFObjectHandle child, int level, int flags); |
| 491 | void initializeSpecialStreams(); | 486 | void initializeSpecialStreams(); |
| 492 | void preserveObjectStreams(); | 487 | void preserveObjectStreams(); |
libqpdf/QPDFWriter.cc
| @@ -232,12 +232,6 @@ QPDFWriter::setNewlineBeforeEndstream(bool val) | @@ -232,12 +232,6 @@ QPDFWriter::setNewlineBeforeEndstream(bool val) | ||
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | void | 234 | void |
| 235 | -QPDFWriter::setMinimumPDFVersion(std::string const& version) | ||
| 236 | -{ | ||
| 237 | - setMinimumPDFVersion(version, 0); | ||
| 238 | -} | ||
| 239 | - | ||
| 240 | -void | ||
| 241 | QPDFWriter::setMinimumPDFVersion(std::string const& version, | 235 | QPDFWriter::setMinimumPDFVersion(std::string const& version, |
| 242 | int extension_level) | 236 | int extension_level) |
| 243 | { | 237 | { |
| @@ -286,12 +280,6 @@ QPDFWriter::setMinimumPDFVersion(std::string const& version, | @@ -286,12 +280,6 @@ QPDFWriter::setMinimumPDFVersion(std::string const& version, | ||
| 286 | } | 280 | } |
| 287 | 281 | ||
| 288 | void | 282 | void |
| 289 | -QPDFWriter::forcePDFVersion(std::string const& version) | ||
| 290 | -{ | ||
| 291 | - forcePDFVersion(version, 0); | ||
| 292 | -} | ||
| 293 | - | ||
| 294 | -void | ||
| 295 | QPDFWriter::forcePDFVersion(std::string const& version, | 283 | QPDFWriter::forcePDFVersion(std::string const& version, |
| 296 | int extension_level) | 284 | int extension_level) |
| 297 | { | 285 | { |
| @@ -1434,12 +1422,6 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream, | @@ -1434,12 +1422,6 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream, | ||
| 1434 | } | 1422 | } |
| 1435 | 1423 | ||
| 1436 | void | 1424 | void |
| 1437 | -QPDFWriter::unparseObject(QPDFObjectHandle object, int level, int flags) | ||
| 1438 | -{ | ||
| 1439 | - unparseObject(object, level, flags, 0, false); | ||
| 1440 | -} | ||
| 1441 | - | ||
| 1442 | -void | ||
| 1443 | QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | 1425 | QPDFWriter::unparseObject(QPDFObjectHandle object, int level, |
| 1444 | int flags, size_t stream_length, | 1426 | int flags, size_t stream_length, |
| 1445 | bool compress) | 1427 | bool compress) |
| @@ -2811,6 +2793,9 @@ QPDFWriter::writeHintStream(int hint_id) | @@ -2811,6 +2793,9 @@ QPDFWriter::writeHintStream(int hint_id) | ||
| 2811 | qpdf_offset_t | 2793 | qpdf_offset_t |
| 2812 | QPDFWriter::writeXRefTable(trailer_e which, int first, int last, int size) | 2794 | QPDFWriter::writeXRefTable(trailer_e which, int first, int last, int size) |
| 2813 | { | 2795 | { |
| 2796 | + // There are too many extra arguments to replace overloaded | ||
| 2797 | + // function with defaults in the header file...too much risk of | ||
| 2798 | + // leaving something off. | ||
| 2814 | return writeXRefTable(which, first, last, size, 0, false, 0, 0, 0, 0); | 2799 | return writeXRefTable(which, first, last, size, 0, false, 0, 0, 0, 0); |
| 2815 | } | 2800 | } |
| 2816 | 2801 | ||
| @@ -2858,6 +2843,9 @@ qpdf_offset_t | @@ -2858,6 +2843,9 @@ qpdf_offset_t | ||
| 2858 | QPDFWriter::writeXRefStream(int objid, int max_id, qpdf_offset_t max_offset, | 2843 | QPDFWriter::writeXRefStream(int objid, int max_id, qpdf_offset_t max_offset, |
| 2859 | trailer_e which, int first, int last, int size) | 2844 | trailer_e which, int first, int last, int size) |
| 2860 | { | 2845 | { |
| 2846 | + // There are too many extra arguments to replace overloaded | ||
| 2847 | + // function with defaults in the header file...too much risk of | ||
| 2848 | + // leaving something off. | ||
| 2861 | return writeXRefStream(objid, max_id, max_offset, | 2849 | return writeXRefStream(objid, max_id, max_offset, |
| 2862 | which, first, last, size, 0, 0, 0, 0, false, 0); | 2850 | which, first, last, size, 0, 0, 0, 0, false, 0); |
| 2863 | } | 2851 | } |