From 88b42586366b4962007ce0a340fcd9e8b56db164 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Mon, 12 Oct 2026 14:24:08 +0300 Subject: [PATCH] Fix unexpected page count error --- info.yml | 2 +- recipe.sh | 9 +++++++++ source-files/167.patch | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 source-files/167.patch diff --git a/info.yml b/info.yml index 06c83d6..67d21fa 100644 --- a/info.yml +++ b/info.yml @@ -1,7 +1,7 @@ name: libcupsfilters description: OpenPrinting CUPS Filters library version: 2.2.1 -revision: 1 +revision: 2 url: https://github.com/OpenPrinting/libcupsfilters license: Apache-2.0 WITH LLVM-exception maintainers: diff --git a/recipe.sh b/recipe.sh index 3aae9d9..e54b071 100644 --- a/recipe.sh +++ b/recipe.sh @@ -2,6 +2,15 @@ # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT +# The prepare function is executed in the root of the temp directory +# This function is used for putting downloaded files to the correct location or applying patches +prepare() { + cd "$BPM_SOURCE" + patch -Np1 -i "$BPM_WORKDIR"/167.patch + + autoreconf -fi +} + # The build function is executed in the source directory # This function is used to compile the source code build() { diff --git a/source-files/167.patch b/source-files/167.patch new file mode 100644 index 0000000..e018fe7 --- /dev/null +++ b/source-files/167.patch @@ -0,0 +1,25 @@ +From a9acdb22cc898076bf6c5d9d20474274ed123458 Mon Sep 17 00:00:00 2001 +From: szlt5 <117269245+szlt5@users.noreply.github.com> +Date: Thu, 23 Jul 2026 12:40:12 +0800 +Subject: [PATCH] Fix printing error: pdfio output "Missing Root object." + +--- + cupsfilters/pdf.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/cupsfilters/pdf.c b/cupsfilters/pdf.c +index 1f714b203..3e4386091 100644 +--- a/cupsfilters/pdf.c ++++ b/cupsfilters/pdf.c +@@ -165,6 +165,11 @@ cfPDFPagesFP(FILE *file) // I - File pointer of PDF + fwrite(buffer, 1, bytes_read, temp_fp); + } + ++ // call fflush(temp_fp) to flush the stdio buffer; ++ // otherwise pdfioFileOpen() may not see the complete contents of temp_filename because ++ // some data may still be buffered and not yet written to the file. ++ fflush(temp_fp); ++ + // Open the temp file with pdfio + pdfio_file_t *pdf = pdfioFileOpen(temp_filename, NULL, NULL, NULL, NULL); +