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.
This commit is contained in:
Michael R Sweet 2025-02-21 16:57:01 -05:00
parent aa6a20c042
commit e996898b57
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
2 changed files with 1 additions and 38 deletions

View File

@ -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_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 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 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_pages(pdfio_file_t *pdf);
static bool write_trailer(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; 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); 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. // 'write_pages()' - Write the PDF pages objects.
// //

View File

@ -34,11 +34,6 @@ pdfioObjClose(pdfio_obj_t *obj) // I - Object
// Write what remains for the object... // Write what remains for the object...
if (!obj->offset) 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 // Write the object value
if (!_pdfioObjWriteHeader(obj)) if (!_pdfioObjWriteHeader(obj))
return (false); return (false);