[jbig2-cvs] rev 231 - trunk
giles@ghostscript.com
giles@ghostscript.com
Wed, 2 Apr 2003 08:12:17 -0800
Author: giles
Date: 2003-04-02 08:12:17 -0800 (Wed, 02 Apr 2003)
New Revision: 231
Modified:
trunk/jbig2dec.c
Log:
Try to set the output format based on the extension given in -o if any.
Also fixes a bug where the format was undefined with -o. (yay valgrind!)
Modified: trunk/jbig2dec.c
==============================================================================
--- trunk/jbig2dec.c (original)
+++ trunk/jbig2dec.c Wed Apr 2 08:12:17 2003
@@ -368,7 +368,8 @@
params.verbose = 1;
params.hash = 0;
params.output_file = NULL;
-
+ params.output_format = jbig2dec_format_none;
+
filearg = parse_options(argc, argv, ¶ms);
if (params.hash) hash_init(¶ms);
@@ -467,8 +468,13 @@
params.output_file = make_output_filename(argv[filearg], ".pbm");
params.output_format = jbig2dec_format_pbm;
#endif
+ } else {
+ int len = strlen(params.output_file);
+ if ((len >= 3) && (params.output_format == jbig2dec_format_none))
+ /* try to set the output type by the given extension */
+ set_output_format(¶ms, params.output_file + len - 3);
}
-
+
/* retrieve and write out all the completed pages */
while ((image = jbig2_page_out(ctx)) != NULL) {
write_page_image(¶ms, image);