-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
while testing the prediction filter I found 2 small problems/bugs in
utils/pdf-filter.c:
1.) Calling ./pdf-filter with "--lzwenc --lzw-earlychange" the
earlychange arg is ignored. Because of the getopt_long loop design args
will only have an effect if named before the FILTER. Most simple fix
would be to make call convention [FILTER_ARGS FILTER]
instead of [FILTER FILTER_ARGS] (in the patch below)
But maybe it is more comfortable with some extra variables, so we can
call in any order. I can send a patch/merge directive for this too.
2.) Calling ./pdf-filter with stdin and (input length % BUF_SIZE == 0)
will run into a libgnupdf ASSERT, because fread returns 0 if stdin is
empty and puts this into pdf_stm_write call. (additional if added)
Patch to fix both problems is attached.
Regards,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk4UNuAACgkQ5sLITM1qIaILcACeIKwuo5lzmwD2SpNJGsF/nUta
xywAn2Ox8WWPzedMWKgfEEOYiyTS8VtT
=s9eB
-----END PGP SIGNATURE-----
=== modified file 'utils/pdf-filter.c'
--- utils/pdf-filter.c 2011-06-24 16:18:43 +0000
+++ utils/pdf-filter.c 2011-07-06 10:15:07 +0000
@@ -152,7 +152,7 @@
PDF_UTILS_COPYRIGHT_DOC ("pdf-filter");
char *pdf_filter_help_msg = "\
-Usage: pdf_filter [[OPTIONS] [FILTER FILTER_ARGS]...]\n\
+Usage: pdf_filter [[OPTIONS] [FILTER_ARGS FILTER]...]\n\
Filter the standard input with the specified PDF standard filters and \n\
write the result in the standard output.\n\
\n\
@@ -347,14 +347,17 @@
}
written_bytes = 0;
- if (!pdf_stm_write (stm, buf, read_bytes, &written_bytes, &error) &&
- error)
+ if (read_bytes)
{
- pdf_error (pdf_error_get_status (error),
- stderr,
- "writing to stream: %s",
- pdf_error_get_message (error));
- exit (EXIT_FAILURE);
+ if (!pdf_stm_write (stm, buf, read_bytes, &written_bytes,
&error) &&
+ error)
+ {
+ pdf_error (pdf_error_get_status (error),
+ stderr,
+ "writing to stream: %s",
+ pdf_error_get_message (error));
+ exit (EXIT_FAILURE);
+ }
}
}
while (read_bytes == BUF_SIZE);