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 | 248 | // R3 encryption parameters are used, and to 1.5 when object |
| 249 | 249 | // streams are used. |
| 250 | 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 | 253 | // Force the PDF version of the output file to be a given version. |
| 256 | 254 | // Use of this function may create PDF files that will not work |
| ... | ... | @@ -268,9 +266,7 @@ class QPDFWriter |
| 268 | 266 | // Additionally, forcing to a version below 1.5 will disable |
| 269 | 267 | // object streams. |
| 270 | 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 | 271 | // Provide additional text to insert in the PDF file somewhere |
| 276 | 272 | // near the beginning of the file. This can be used to add |
| ... | ... | @@ -483,10 +479,9 @@ class QPDFWriter |
| 483 | 479 | void writeTrailer(trailer_e which, int size, |
| 484 | 480 | bool xref_stream, qpdf_offset_t prev, |
| 485 | 481 | int linearization_pass); |
| 486 | - void unparseObject(QPDFObjectHandle object, int level, int flags); | |
| 487 | 482 | void unparseObject(QPDFObjectHandle object, int level, int flags, |
| 488 | 483 | // for stream dictionaries |
| 489 | - size_t stream_length, bool compress); | |
| 484 | + size_t stream_length = 0, bool compress = false); | |
| 490 | 485 | void unparseChild(QPDFObjectHandle child, int level, int flags); |
| 491 | 486 | void initializeSpecialStreams(); |
| 492 | 487 | void preserveObjectStreams(); | ... | ... |
libqpdf/QPDFWriter.cc
| ... | ... | @@ -232,12 +232,6 @@ QPDFWriter::setNewlineBeforeEndstream(bool val) |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | void |
| 235 | -QPDFWriter::setMinimumPDFVersion(std::string const& version) | |
| 236 | -{ | |
| 237 | - setMinimumPDFVersion(version, 0); | |
| 238 | -} | |
| 239 | - | |
| 240 | -void | |
| 241 | 235 | QPDFWriter::setMinimumPDFVersion(std::string const& version, |
| 242 | 236 | int extension_level) |
| 243 | 237 | { |
| ... | ... | @@ -286,12 +280,6 @@ QPDFWriter::setMinimumPDFVersion(std::string const& version, |
| 286 | 280 | } |
| 287 | 281 | |
| 288 | 282 | void |
| 289 | -QPDFWriter::forcePDFVersion(std::string const& version) | |
| 290 | -{ | |
| 291 | - forcePDFVersion(version, 0); | |
| 292 | -} | |
| 293 | - | |
| 294 | -void | |
| 295 | 283 | QPDFWriter::forcePDFVersion(std::string const& version, |
| 296 | 284 | int extension_level) |
| 297 | 285 | { |
| ... | ... | @@ -1434,12 +1422,6 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream, |
| 1434 | 1422 | } |
| 1435 | 1423 | |
| 1436 | 1424 | void |
| 1437 | -QPDFWriter::unparseObject(QPDFObjectHandle object, int level, int flags) | |
| 1438 | -{ | |
| 1439 | - unparseObject(object, level, flags, 0, false); | |
| 1440 | -} | |
| 1441 | - | |
| 1442 | -void | |
| 1443 | 1425 | QPDFWriter::unparseObject(QPDFObjectHandle object, int level, |
| 1444 | 1426 | int flags, size_t stream_length, |
| 1445 | 1427 | bool compress) |
| ... | ... | @@ -2811,6 +2793,9 @@ QPDFWriter::writeHintStream(int hint_id) |
| 2811 | 2793 | qpdf_offset_t |
| 2812 | 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 | 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 | 2843 | QPDFWriter::writeXRefStream(int objid, int max_id, qpdf_offset_t max_offset, |
| 2859 | 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 | 2849 | return writeXRefStream(objid, max_id, max_offset, |
| 2862 | 2850 | which, first, last, size, 0, 0, 0, 0, false, 0); |
| 2863 | 2851 | } | ... | ... |