Commit d1af509964b2a7491a7e900af02cd3366dfb35c1

Authored by m-holger
1 parent 41228e0d

Refactor: simplify `Stream` handling in `QPDF_objects` and `QPDF_json`

libqpdf/QPDF_json.cc
@@ -884,7 +884,7 @@ QPDF::writeJSON( @@ -884,7 +884,7 @@ QPDF::writeJSON(
884 } else { 884 } else {
885 jw << "\n },\n \"" << key; 885 jw << "\n },\n \"" << key;
886 } 886 }
887 - if (auto stream = obj.as_stream()) { 887 + if (Stream stream = obj) {
888 jw << "\": {\n \"stream\": "; 888 jw << "\": {\n \"stream\": ";
889 if (json_stream_data == qpdf_sj_file) { 889 if (json_stream_data == qpdf_sj_file) {
890 writeJSONStreamFile( 890 writeJSONStreamFile(
libqpdf/QPDF_objects.cc
@@ -1634,7 +1634,7 @@ Objects::resolveObjectsInStream(int obj_stream_number) @@ -1634,7 +1634,7 @@ Objects::resolveObjectsInStream(int obj_stream_number)
1634 } 1634 }
1635 m->resolved_object_streams.insert(obj_stream_number); 1635 m->resolved_object_streams.insert(obj_stream_number);
1636 // Force resolution of object stream 1636 // Force resolution of object stream
1637 - auto obj_stream = qpdf.getObject(obj_stream_number, 0).as_stream(); 1637 + Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
1638 if (!obj_stream) { 1638 if (!obj_stream) {
1639 throw qpdf.damagedPDF( 1639 throw qpdf.damagedPDF(
1640 "object " + std::to_string(obj_stream_number) + " 0", 1640 "object " + std::to_string(obj_stream_number) + " 0",