mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Remove QPDF_Stream::offset
This commit is contained in:
parent
3a86b893f7
commit
6350cf16e6
@ -1534,10 +1534,9 @@ QPDF::readObject(
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
auto stream =
|
||||
QPDF_Stream::create(this, og, object, stream_offset, length);
|
||||
stream->setParsedOffset(stream_offset);
|
||||
object = newIndirect(og, stream);
|
||||
object = newIndirect(
|
||||
og,
|
||||
QPDF_Stream::create(this, og, object, stream_offset, length));
|
||||
} else {
|
||||
input->seek(cur_offset, SEEK_SET);
|
||||
}
|
||||
|
@ -117,7 +117,6 @@ QPDF_Stream::QPDF_Stream(
|
||||
QPDFValue(::ot_stream, "stream"),
|
||||
filter_on_write(true),
|
||||
stream_dict(stream_dict),
|
||||
offset(offset),
|
||||
length(length)
|
||||
{
|
||||
if (!stream_dict.isDictionary()) {
|
||||
@ -126,6 +125,7 @@ QPDF_Stream::QPDF_Stream(
|
||||
}
|
||||
setDescription(
|
||||
qpdf, qpdf->getFilename() + ", stream object " + og.unparse(' '));
|
||||
this->parsed_offset = offset;
|
||||
}
|
||||
|
||||
std::shared_ptr<QPDFObject>
|
||||
@ -325,7 +325,7 @@ QPDF_Stream::isDataModified() const
|
||||
qpdf_offset_t
|
||||
QPDF_Stream::getOffset() const
|
||||
{
|
||||
return this->offset;
|
||||
return this->parsed_offset;
|
||||
}
|
||||
|
||||
size_t
|
||||
@ -357,7 +357,7 @@ QPDF_Stream::getStreamData(qpdf_stream_decode_level_e decode_level)
|
||||
qpdf_e_unsupported,
|
||||
qpdf->getFilename(),
|
||||
"",
|
||||
this->offset,
|
||||
this->parsed_offset,
|
||||
"getStreamData called on unfilterable stream");
|
||||
}
|
||||
QTC::TC("qpdf", "QPDF_Stream getStreamData");
|
||||
@ -373,7 +373,7 @@ QPDF_Stream::getRawStreamData()
|
||||
qpdf_e_unsupported,
|
||||
qpdf->getFilename(),
|
||||
"",
|
||||
this->offset,
|
||||
this->parsed_offset,
|
||||
"error getting raw stream data");
|
||||
}
|
||||
QTC::TC("qpdf", "QPDF_Stream getRawStreamData");
|
||||
@ -618,7 +618,7 @@ QPDF_Stream::pipeStreamData(
|
||||
this->stream_dict.replaceKey(
|
||||
"/Length", QPDFObjectHandle::newInteger(actual_length));
|
||||
}
|
||||
} else if (this->offset == 0) {
|
||||
} else if (this->parsed_offset == 0) {
|
||||
QTC::TC("qpdf", "QPDF_Stream pipe no stream data");
|
||||
throw std::logic_error("pipeStreamData called for stream with no data");
|
||||
} else {
|
||||
@ -626,7 +626,7 @@ QPDF_Stream::pipeStreamData(
|
||||
if (!QPDF::Pipe::pipeStreamData(
|
||||
this->qpdf,
|
||||
og,
|
||||
this->offset,
|
||||
this->parsed_offset,
|
||||
this->length,
|
||||
this->stream_dict,
|
||||
pipeline,
|
||||
@ -716,5 +716,5 @@ QPDF_Stream::replaceDict(QPDFObjectHandle const& new_dict)
|
||||
void
|
||||
QPDF_Stream::warn(std::string const& message)
|
||||
{
|
||||
this->qpdf->warn(qpdf_e_damaged_pdf, "", this->offset, message);
|
||||
this->qpdf->warn(qpdf_e_damaged_pdf, "", this->parsed_offset, message);
|
||||
}
|
||||
|
@ -69,11 +69,8 @@ class QPDFValue
|
||||
}
|
||||
|
||||
protected:
|
||||
QPDFValue() :
|
||||
type_code(::ot_uninitialized),
|
||||
type_name("uninitialized")
|
||||
{
|
||||
}
|
||||
QPDFValue() = default;
|
||||
|
||||
QPDFValue(qpdf_object_type_e type_code, char const* type_name) :
|
||||
type_code(type_code),
|
||||
type_name(type_name)
|
||||
@ -97,13 +94,14 @@ class QPDFValue
|
||||
QPDFValue(QPDFValue const&) = delete;
|
||||
QPDFValue& operator=(QPDFValue const&) = delete;
|
||||
std::string object_description;
|
||||
qpdf_offset_t parsed_offset{-1};
|
||||
const qpdf_object_type_e type_code;
|
||||
char const* type_name;
|
||||
|
||||
const qpdf_object_type_e type_code{::ot_uninitialized};
|
||||
char const* type_name{"uninitialized"};
|
||||
|
||||
protected:
|
||||
QPDF* qpdf{nullptr};
|
||||
QPDFObjGen og;
|
||||
QPDFObjGen og{};
|
||||
qpdf_offset_t parsed_offset{-1};
|
||||
};
|
||||
|
||||
#endif // QPDFVALUE_HH
|
||||
|
@ -103,7 +103,6 @@ class QPDF_Stream: public QPDFValue
|
||||
|
||||
bool filter_on_write;
|
||||
QPDFObjectHandle stream_dict;
|
||||
qpdf_offset_t offset;
|
||||
size_t length;
|
||||
std::shared_ptr<Buffer> stream_data;
|
||||
std::shared_ptr<QPDFObjectHandle::StreamDataProvider> stream_provider;
|
||||
|
Loading…
Reference in New Issue
Block a user