From e996898b57f8df2776010ead26a041171ff26c2c Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 21 Feb 2025 16:57:01 -0500 Subject: [PATCH] Back out object stream changes, as they would require much more significant reworking of the "write value" private API that I don't want to do right now. --- pdfio-file.c | 34 +--------------------------------- pdfio-object.c | 5 ----- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/pdfio-file.c b/pdfio-file.c index 15d43eb..7af5617 100644 --- a/pdfio-file.c +++ b/pdfio-file.c @@ -26,7 +26,6 @@ static bool load_obj_stream(pdfio_obj_t *obj); static bool load_pages(pdfio_file_t *pdf, pdfio_obj_t *obj, size_t depth); static bool load_xref(pdfio_file_t *pdf, off_t xref_offset, pdfio_password_cb_t password_cb, void *password_data); static bool repair_xref(pdfio_file_t *pdf, pdfio_password_cb_t password_cb, void *password_data); -static bool write_obj_streams(pdfio_file_t *pdf); static bool write_pages(pdfio_file_t *pdf); static bool write_trailer(pdfio_file_t *pdf); @@ -122,7 +121,7 @@ pdfioFileClose(pdfio_file_t *pdf) // I - PDF file { ret = false; - if (pdfioObjClose(pdf->info_obj) && write_pages(pdf) && write_obj_streams(pdf) && pdfioObjClose(pdf->root_obj) && write_trailer(pdf)) + if (pdfioObjClose(pdf->info_obj) && write_pages(pdf) && pdfioObjClose(pdf->root_obj) && write_trailer(pdf)) ret = _pdfioFileFlush(pdf); } @@ -2344,37 +2343,6 @@ repair_xref( } -// -// 'write_obj_streams()' - Write object streams... -// - -static bool // O - `true` on success, `false` on error -write_obj_streams(pdfio_file_t *pdf) // I - PDF file -{ - size_t i; // Looping var - pdfio_obj_t *obj; // Current object - - - // Object streams are part of PDF 1.5 and later... - if (strcmp(pdf->version, "1.5") < 0) - return (true); - - // Loop through the file objects and write any to an object stream... - for (i = 0; i < pdf->num_objs; i ++) - { - obj = pdf->objs[i]; - - if (obj->offset > 0) - continue; - - if (!_pdfioObjWriteHeader(obj) || !_pdfioFilePuts(pdf, "endobj\n")) - return (false); - } - - return (true); -} - - // // 'write_pages()' - Write the PDF pages objects. // diff --git a/pdfio-object.c b/pdfio-object.c index ed8e731..3829026 100644 --- a/pdfio-object.c +++ b/pdfio-object.c @@ -34,11 +34,6 @@ pdfioObjClose(pdfio_obj_t *obj) // I - Object // Write what remains for the object... if (!obj->offset) { - // If we are writing a PDF 1.5 or later object, put all value-only objects - // in object streams... - if (obj != obj->pdf->encrypt_obj && obj != obj->pdf->info_obj && obj != obj->pdf->root_obj && strcmp(obj->pdf->version, "1.5") >= 0) - return (true); - // Write the object value if (!_pdfioObjWriteHeader(obj)) return (false);