* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2013 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010-2011, 2013-2017, D. R. Commander.
+ * Copyright (C) 2010-2011, 2013-2017, 2020, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
#endif
fprintf(stderr, "Switches for advanced users:\n");
#ifdef DCT_ISLOW_SUPPORTED
- fprintf(stderr, " -dct int Use integer DCT method%s\n",
+ fprintf(stderr, " -dct int Use accurate integer DCT method%s\n",
(JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : ""));
#endif
#ifdef DCT_IFAST_SUPPORTED
- fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n",
+ fprintf(stderr, " -dct fast Use less accurate integer DCT method [legacy feature]%s\n",
(JDCT_DEFAULT == JDCT_IFAST ? " (default)" : ""));
#endif
#ifdef DCT_FLOAT_SUPPORTED
- fprintf(stderr, " -dct float Use floating-point DCT method%s\n",
+ fprintf(stderr, " -dct float Use floating-point DCT method [legacy feature]%s\n",
(JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : ""));
#endif
fprintf(stderr, " -dither fs Use F-S dithering (default)\n");
FILE *input_file;
FILE *output_file;
unsigned char *inbuffer = NULL;
+#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
unsigned long insize = 0;
+#endif
JDIMENSION num_scanlines;
/* On Mac, fetch a command line. */
dest_mgr->buffer_height);
(*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
}
- jpeg_skip_scanlines(&cinfo, skip_end - skip_start + 1);
+ if ((tmp = jpeg_skip_scanlines(&cinfo, skip_end - skip_start + 1)) !=
+ skip_end - skip_start + 1) {
+ fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
+ progname, tmp, skip_end - skip_start + 1);
+ exit(EXIT_FAILURE);
+ }
while (cinfo.output_scanline < cinfo.output_height) {
num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
dest_mgr->buffer_height);
cinfo.output_height = tmp;
/* Process data */
- jpeg_skip_scanlines(&cinfo, crop_y);
+ if ((tmp = jpeg_skip_scanlines(&cinfo, crop_y)) != crop_y) {
+ fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
+ progname, tmp, crop_y);
+ exit(EXIT_FAILURE);
+ }
while (cinfo.output_scanline < crop_y + crop_height) {
num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer,
dest_mgr->buffer_height);
(*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines);
}
- jpeg_skip_scanlines(&cinfo, cinfo.output_height - crop_y - crop_height);
+ if ((tmp =
+ jpeg_skip_scanlines(&cinfo,
+ cinfo.output_height - crop_y - crop_height)) !=
+ cinfo.output_height - crop_y - crop_height) {
+ fprintf(stderr, "%s: jpeg_skip_scanlines() returned %d rather than %d\n",
+ progname, tmp, cinfo.output_height - crop_y - crop_height);
+ exit(EXIT_FAILURE);
+ }
/* Normal full-image decompress */
} else {
end_progress_monitor((j_common_ptr)&cinfo);
#endif
- if (memsrc && inbuffer != NULL)
+ if (memsrc)
free(inbuffer);
/* All done. */