Control: reassign -1 libpoppler-glib8 0.63.0-2 Control: notforwarded -1 Control: affects -1 + ruby-poppler Control: retitle -1 poppler-glib always returns 0 length for PopplerInputStream
original bug report: https://bugs.debian.org/896596 previous forwarded: https://github.com/ruby-gnome2/ruby-gnome2/issues/1159 below comments and patch by Kouhei Sutou <k...@cozmixng.org>. > Poppler adds getLength() check at > https://cgit.freedesktop.org/poppler/poppler/commit/?id=a59f61641fcb36859b625749afb4561557e419f6 > for https://bugs.freedesktop.org/show_bug.cgi?id=103552 . > But PopplerInputStream created by poppler-glib always returns 0 for > getLength(): > https://cgit.freedesktop.org/poppler/poppler/tree/glib/poppler-document.cc#n301 > I think that poppler-glib computes length in > poppler_document_new_from_stream() > and specifies the length to PopplerInputStream. --- > We'll be able to compute length by g_seekable_seek(0, G_SEEK_END) and > g_seekable_tell(). --- > Ah, we can just use the length passed by argument: ``` diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index b343eb90..504042cd 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -298,7 +298,7 @@ poppler_document_new_from_stream (GInputStream *stream, } if (stream_is_memory_buffer_or_local_file(stream)) { - str = new PopplerInputStream(stream, cancellable, 0, gFalse, 0, Object(objNull)); + str = new PopplerInputStream(stream, cancellable, 0, gFalse, length, Object(objNull)); } else { CachedFile *cachedFile = new CachedFile(new PopplerCachedFileLoader(stream, cancellable, length), new GooString()); str = new CachedFileStream(cachedFile, 0, gFalse, cachedFile->getLength(), Object(objNull)); ``` -- Regards, dai GPG Fingerprint = 0B29 D88E 42E6 B765 B8D8 EA50 7839 619D D439 668E
signature.asc
Description: PGP signature