diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-21 15:05:54 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-21 15:43:45 +0200 |
commit | c56a9ca7f6484925627aa1da374a236949c07cb2 (patch) | |
tree | 9c40a6b0d6f8214b345a38b6a33e0debb8a4102c /libqpdf/QPDF_json.cc | |
parent | 47c093c48b7ac3eb97c33b8edfafdf89685cffc7 (diff) | |
download | qpdf-c56a9ca7f6484925627aa1da374a236949c07cb2.tar.zst |
JSON: Fix large file support
Diffstat (limited to 'libqpdf/QPDF_json.cc')
-rw-r--r-- | libqpdf/QPDF_json.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc index 26257f99..a9368648 100644 --- a/libqpdf/QPDF_json.cc +++ b/libqpdf/QPDF_json.cc @@ -197,14 +197,14 @@ QPDF::test_json_validators() } static std::function<void(Pipeline*)> -provide_data(std::shared_ptr<InputSource> is, size_t start, size_t end) +provide_data(std::shared_ptr<InputSource> is, qpdf_offset_t start, qpdf_offset_t end) { return [is, start, end](Pipeline* p) { Pl_Base64 decode("base64-decode", p, Pl_Base64::a_decode); p = &decode; - size_t bytes = end - start; + size_t bytes = QIntC::to_size(end - start); char buf[8192]; - is->seek(QIntC::to_offset(start), SEEK_SET); + is->seek(start, SEEK_SET); size_t len = 0; while ((len = is->read(buf, std::min(bytes, sizeof(buf)))) > 0) { p->write(buf, len); @@ -241,14 +241,14 @@ QPDF::JSONReactor::JSONReactor( } void -QPDF::JSONReactor::error(size_t offset, std::string const& msg) +QPDF::JSONReactor::error(qpdf_offset_t offset, std::string const& msg) { this->errors = true; std::string object = this->cur_object; if (is->getName() != pdf.getFilename()) { object += " from " + is->getName(); } - this->pdf.warn(qpdf_e_json, object, QIntC::to_offset(offset), msg); + this->pdf.warn(qpdf_e_json, object, offset, msg); } bool @@ -616,7 +616,7 @@ QPDF::JSONReactor::setObjectDescription(QPDFObjectHandle& oh, JSON const& value) if (!this->cur_object.empty()) { description += ", " + this->cur_object; } - description += " at offset " + QUtil::uint_to_string(value.getStart()); + description += " at offset " + QUtil::int_to_string(value.getStart()); oh.setObjectDescription(&this->pdf, description); } |