diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-02-19 01:37:38 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-02-19 01:38:49 +0100 |
commit | 0f97e98203dfa78cf3273005f215d2d026390e5c (patch) | |
tree | c02b7969653620375d2482ce614e72414cd82bc7 /include | |
parent | 088fabd9b9affe14c006e1354892f80c7bbbeebe (diff) | |
download | qpdf-0f97e98203dfa78cf3273005f215d2d026390e5c.tar.zst |
Handle linearization warnings as proper warning (fixes #851)
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/Constants.h | 17 | ||||
-rw-r--r-- | include/qpdf/QPDF.hh | 11 |
2 files changed, 14 insertions, 14 deletions
diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h index 84bd190b..e3626ead 100644 --- a/include/qpdf/Constants.h +++ b/include/qpdf/Constants.h @@ -83,14 +83,15 @@ enum qpdf_exit_code_e { enum qpdf_error_code_e { qpdf_e_success = 0, - qpdf_e_internal, /* logic/programming error -- indicates bug */ - qpdf_e_system, /* I/O error, memory error, etc. */ - qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */ - qpdf_e_password, /* incorrect password for encrypted file */ - qpdf_e_damaged_pdf, /* syntax errors or other damage in PDF */ - qpdf_e_pages, /* erroneous or unsupported pages structure */ - qpdf_e_object, /* type/bounds errors accessing objects */ - qpdf_e_json, /* error in qpdf JSON */ + qpdf_e_internal, /* logic/programming error -- indicates bug */ + qpdf_e_system, /* I/O error, memory error, etc. */ + qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */ + qpdf_e_password, /* incorrect password for encrypted file */ + qpdf_e_damaged_pdf, /* syntax errors or other damage in PDF */ + qpdf_e_pages, /* erroneous or unsupported pages structure */ + qpdf_e_object, /* type/bounds errors accessing objects */ + qpdf_e_json, /* error in qpdf JSON */ + qpdf_e_linearization, /* linearization warning */ }; /* Object Types */ diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 7fe02f0b..3f998b9c 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -32,6 +32,7 @@ #include <memory> #include <stdio.h> #include <string> +#include <string_view> #include <vector> #include <qpdf/Buffer.hh> @@ -1565,6 +1566,7 @@ class QPDF void readLinearizationData(); bool checkLinearizationInternal(); void dumpLinearizationDataInternal(); + void linearizationWarning(std::string_view); QPDFObjectHandle readHintStream(Pipeline&, qpdf_offset_t offset, size_t length); void readHPageOffset(BitStream); @@ -1574,18 +1576,14 @@ class QPDF qpdf_offset_t getLinearizationOffset(QPDFObjGen const&); QPDFObjectHandle getUncompressedObject( QPDFObjectHandle&, std::map<int, int> const& object_stream_data); - int lengthNextN(int first_object, int n, std::list<std::string>& errors); + int lengthNextN(int first_object, int n); void checkHPageOffset( - std::list<std::string>& errors, - std::list<std::string>& warnings, std::vector<QPDFObjectHandle> const& pages, std::map<int, int>& idx_to_obj); void checkHSharedObject( - std::list<std::string>& warnings, - std::list<std::string>& errors, std::vector<QPDFObjectHandle> const& pages, std::map<int, int>& idx_to_obj); - void checkHOutlines(std::list<std::string>& warnings); + void checkHOutlines(); void dumpHPageOffset(); void dumpHSharedObject(); void dumpHGeneric(HGeneric&); @@ -1728,6 +1726,7 @@ class QPDF // Linearization data qpdf_offset_t first_xref_item_offset{0}; // actual value from file bool uncompressed_after_compressed{false}; + bool linearization_warnings{false}; // Linearization parameter dictionary and hint table data: may be // read from file or computed prior to writing a linearized file |