From 8a45ee228f2c7df6f00ab487c7abe1e405764948 Mon Sep 17 00:00:00 2001 From: Rene Ladan Date: Tue, 1 Dec 2020 19:12:47 +0000 Subject: [PATCH] Remove graphics/jpeg which has expired in favor of graphics/jpeg-turbo Update qa checks and add a note to UPDATING to help users migrate. Differential Revision: https://reviews.freebsd.org/D27425 --- MOVED | 1 + Mk/Scripts/qa.sh | 2 +- Mk/Uses/jpeg.mk | 2 +- UPDATING | 11 + graphics/Makefile | 1 - graphics/jpeg/Makefile | 59 --- graphics/jpeg/distinfo | 6 - graphics/jpeg/files/patch-djpeg.c | 20 - graphics/jpeg/files/patch-exifautotran | 7 - graphics/jpeg/files/patch-jconfig.cfg | 15 - graphics/jpeg/files/patch-jmorecfg.h | 15 - graphics/jpeg/files/patch-jpegtran.1 | 44 -- graphics/jpeg/files/patch-jpegtran.c | 248 ----------- graphics/jpeg/files/patch-rdjpgcom.c | 202 --------- graphics/jpeg/files/patch-transupp.c | 560 ------------------------- graphics/jpeg/files/patch-transupp.h | 42 -- graphics/jpeg/pkg-descr | 19 - graphics/jpeg/pkg-plist | 31 -- 18 files changed, 14 insertions(+), 1271 deletions(-) delete mode 100644 graphics/jpeg/Makefile delete mode 100644 graphics/jpeg/distinfo delete mode 100644 graphics/jpeg/files/patch-djpeg.c delete mode 100644 graphics/jpeg/files/patch-exifautotran delete mode 100644 graphics/jpeg/files/patch-jconfig.cfg delete mode 100644 graphics/jpeg/files/patch-jmorecfg.h delete mode 100644 graphics/jpeg/files/patch-jpegtran.1 delete mode 100644 graphics/jpeg/files/patch-jpegtran.c delete mode 100644 graphics/jpeg/files/patch-rdjpgcom.c delete mode 100644 graphics/jpeg/files/patch-transupp.c delete mode 100644 graphics/jpeg/files/patch-transupp.h delete mode 100644 graphics/jpeg/pkg-descr delete mode 100644 graphics/jpeg/pkg-plist diff --git a/MOVED b/MOVED index 31c21cd901d8..c531f6fc8f57 100644 --- a/MOVED +++ b/MOVED @@ -15716,3 +15716,4 @@ net/remmina-plugin-vnc|net/remmina|2020-11-24|Moved to remmina flavored version net/remmina-plugin-www|net/remmina|2020-11-24|Moved to remmina flavored version net/remmina-plugin-xdmcp|net/remmina|2020-11-24|Moved to remmina flavored version net/remmina-plugins|net/remmina|2020-11-24|Moved to remmina flavored version +graphics/jpeg|graphics/jpeg-turbo|2020-12-01|Has expired: Outdated and vulnerable, new version breaks API and ABI diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index 2507b472fdc9..8d34d0ccdf02 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -592,7 +592,7 @@ proxydeps_suggest_uses() { elif [ ${pkg} = "converters/libiconv" ]; then warn "you need USES+=iconv, USES+=iconv:wchar_t, or USES+=iconv:translit depending on needs" # jpeg - elif [ ${pkg} = "graphics/jpeg" -o ${pkg} = "graphics/jpeg-turbo" ]; then + elif [ ${pkg} = "graphics/jpeg-turbo" ]; then warn "you need USES+=jpeg" # libarchive elif [ ${pkg} = "archivers/libarchive" ]; then diff --git a/Mk/Uses/jpeg.mk b/Mk/Uses/jpeg.mk index 6fbbe80fe67e..eace3af88983 100644 --- a/Mk/Uses/jpeg.mk +++ b/Mk/Uses/jpeg.mk @@ -8,7 +8,7 @@ # # User defined variables: # JPEG_PORT - jpeg implementation -# Valid values: graphics/jpeg and graphics/jpeg-turbo +# Valid value: graphics/jpeg-turbo # Default value: graphics/jpeg-turbo # # MAINTAINER: portmgr@FreeBSD.org diff --git a/UPDATING b/UPDATING index 2423d0432216..9a3ad327e61e 100644 --- a/UPDATING +++ b/UPDATING @@ -5,6 +5,17 @@ they are unavoidable. You should get into the habit of checking this file for changes each time you update your ports collection, before attempting any port upgrades. +20201130: + AFFECTS: users of graphics/jpeg + AUTHOR: rene@FreeBSD.org + + + The graphics/jpeg port has been removed in favor of graphics/jpeg-turbo. + The former port was vulnerable and used an outdated ABI and API. + + Please check your make configuration for JPEG_PORT and remove it or + set it to "jpeg-turbo" if it is currently set to "jpeg". + 20201128: AFFECTS: users of databases/cego AUTHOR: pi@FreeBSD.org diff --git a/graphics/Makefile b/graphics/Makefile index d2980707f906..148633560642 100644 --- a/graphics/Makefile +++ b/graphics/Makefile @@ -377,7 +377,6 @@ SUBDIR += jp SUBDIR += jp2a SUBDIR += jpatch - SUBDIR += jpeg SUBDIR += jpeg-turbo SUBDIR += jpeg-xl SUBDIR += jpeginfo diff --git a/graphics/jpeg/Makefile b/graphics/jpeg/Makefile deleted file mode 100644 index a9d91ed2aa4a..000000000000 --- a/graphics/jpeg/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# Created by: smace -# $FreeBSD$ - -PORTNAME= jpeg -PORTVERSION= 8 -PORTREVISION= 7 -CATEGORIES= graphics -MASTER_SITES= http://www.ijg.org/files/ \ - http://sylvana.net/jpegcrop/:exif -DISTNAME= jpegsrc.v${DISTVERSION2} -DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \ - jpegexiforient.c:exif exifautotran.txt:exif -DIST_SUBDIR= ${PORTNAME}${DISTVERSION2} -EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} - -MAINTAINER= portmgr@FreeBSD.org -COMMENT= IJG's jpeg compression utilities - -CONFLICTS_INSTALL= jpeg-turbo-[0-9]* -DEPRECATED= Outdated and vulnerable, new version breaks API and ABI -EXPIRATION_DATE= 2020-11-27 - -WRKSRC= ${WRKDIR}/${PORTNAME}-${DISTVERSION2} -DISTVERSION2= 8d -USES= libtool -GNU_CONFIGURE= yes -USE_LDCONFIG= yes -TEST_TARGET= test -TEST_ENV= LD_LIBRARY_PATH=${WRKSRC}/.libs - -ADDITIONAL_HEADER= jinclude.h jpegint.h - -# define J_MAXMEM like "make J_MAXMEM=32" to limit max processing memory to 32Mb -.if defined(J_MAXMEM) -CONFIGURE_ARGS+= --enable-maxmem=${J_MAXMEM} -.endif - -OPTIONS_DEFINE= DOCS - -post-extract: - @${CP} ${DISTDIR}/${DIST_SUBDIR}/jpegexiforient.c ${WRKSRC}/ - @${CP} ${DISTDIR}/${DIST_SUBDIR}/exifautotran.txt ${WRKSRC}/exifautotran - -post-build: - @cd ${WRKSRC} && ${CC} ${CFLAGS} -o jpegexiforient jpegexiforient.c - -post-install: -.for header in ${ADDITIONAL_HEADER} - ${INSTALL_DATA} ${WRKSRC}/${header} ${STAGEDIR}${PREFIX}/include/ -.endfor - ${INSTALL_PROGRAM} ${WRKSRC}/jpegexiforient ${STAGEDIR}${PREFIX}/bin/ - ${INSTALL_SCRIPT} ${WRKSRC}/exifautotran ${STAGEDIR}${PREFIX}/bin/ - -post-install-DOCS-on: - @${MKDIR} ${STAGEDIR}${PREFIX}/share/doc/jpeg - ${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${PREFIX}/share/doc/jpeg/ - ${INSTALL_DATA} ${WRKSRC}/*.txt ${STAGEDIR}${PREFIX}/share/doc/jpeg/ - -.include diff --git a/graphics/jpeg/distinfo b/graphics/jpeg/distinfo deleted file mode 100644 index 3426c16c2ab7..000000000000 --- a/graphics/jpeg/distinfo +++ /dev/null @@ -1,6 +0,0 @@ -SHA256 (jpeg8d/jpegsrc.v8d.tar.gz) = 00029b1473f0f0ea72fbca3230e8cb25797fbb27e58ae2e46bb8bf5a806fe0b3 -SIZE (jpeg8d/jpegsrc.v8d.tar.gz) = 991456 -SHA256 (jpeg8d/jpegexiforient.c) = bac06fcdbc6a5b6adfb5e65d5b90b88bf7d72849e21ab2d33b6900bd99200eec -SIZE (jpeg8d/jpegexiforient.c) = 8531 -SHA256 (jpeg8d/exifautotran.txt) = d1d8302e4a76f83c725d65027ff5dfd788447cc245d387a91f01737e9f245c4c -SIZE (jpeg8d/exifautotran.txt) = 684 diff --git a/graphics/jpeg/files/patch-djpeg.c b/graphics/jpeg/files/patch-djpeg.c deleted file mode 100644 index 224fefe2e850..000000000000 --- a/graphics/jpeg/files/patch-djpeg.c +++ /dev/null @@ -1,20 +0,0 @@ ---- djpeg.c.orig Sat Oct 11 18:29:07 1997 -+++ djpeg.c Mon Apr 24 16:04:13 2000 -@@ -26,6 +26,7 @@ - #include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ - #include "jversion.h" /* for version message */ - -+#include /* to declare setlocal() */ - #include /* to declare isprint() */ - - #ifdef USE_CCOMMAND /* command-line reader for Macintosh */ -@@ -385,6 +386,9 @@ - cinfo->unread_marker - JPEG_APP0, (long) length); - } - -+ if (traceit) { -+ setlocale(LC_ALL, ""); -+ } - while (--length >= 0) { - ch = jpeg_getc(cinfo); - if (traceit) { diff --git a/graphics/jpeg/files/patch-exifautotran b/graphics/jpeg/files/patch-exifautotran deleted file mode 100644 index 418f618019ba..000000000000 --- a/graphics/jpeg/files/patch-exifautotran +++ /dev/null @@ -1,7 +0,0 @@ ---- exifautotran.orig Thu Mar 18 06:25:27 2004 -+++ exifautotran Thu Mar 18 06:28:29 2004 -@@ -1,3 +1,4 @@ -+#!/bin/sh - # exifautotran [list of files] - # - # Transforms Exif files so that Orientation becomes 1 diff --git a/graphics/jpeg/files/patch-jconfig.cfg b/graphics/jpeg/files/patch-jconfig.cfg deleted file mode 100644 index 663cbdbfc212..000000000000 --- a/graphics/jpeg/files/patch-jconfig.cfg +++ /dev/null @@ -1,15 +0,0 @@ ---- jconfig.cfg.orig 2009-06-07 13:12:34.000000000 +0200 -+++ jconfig.cfg 2009-06-30 13:13:11.000000000 +0200 -@@ -7,8 +7,12 @@ - #undef void - #undef const - #undef CHAR_IS_UNSIGNED -+#ifndef HAVE_STDDEF_H - #undef HAVE_STDDEF_H -+#endif -+#ifndef HAVE_STDLIB_H - #undef HAVE_STDLIB_H -+#endif - #undef HAVE_LOCALE_H - #undef NEED_BSD_STRINGS - #undef NEED_SYS_TYPES_H diff --git a/graphics/jpeg/files/patch-jmorecfg.h b/graphics/jpeg/files/patch-jmorecfg.h deleted file mode 100644 index 2d5f214eaf5f..000000000000 --- a/graphics/jpeg/files/patch-jmorecfg.h +++ /dev/null @@ -1,15 +0,0 @@ ---- jmorecfg.h.orig Sun Sep 18 14:53:48 2005 -+++ jmorecfg.h Sun Sep 18 14:54:27 2005 -@@ -187,8 +187,11 @@ - /* a function referenced thru EXTERNs: */ - #define GLOBAL(type) type - /* a reference to a GLOBAL function: */ -+#ifdef __cplusplus -+#define EXTERN(type) extern "C" type -+#else - #define EXTERN(type) extern type -- -+#endif - - /* This macro is used to declare a "method", that is, a function pointer. - * We want to supply prototype parameters if the compiler can cope. diff --git a/graphics/jpeg/files/patch-jpegtran.1 b/graphics/jpeg/files/patch-jpegtran.1 deleted file mode 100644 index 4a5e9d956b47..000000000000 --- a/graphics/jpeg/files/patch-jpegtran.1 +++ /dev/null @@ -1,44 +0,0 @@ ---- jpegtran.1.orig 2009-03-28 19:18:21.000000000 +0100 -+++ jpegtran.1 2009-07-01 09:19:36.000000000 +0200 -@@ -195,6 +195,14 @@ - Copy all extra markers. This setting preserves miscellaneous markers - found in the source file, such as JFIF thumbnails, Exif data, and Photoshop - settings. In some files these extra markers can be sizable. -+See 'EXIF FILES' for special tratement of EXIF markers. -+.TP -+.B \-copy exif -+This setting preserves the EXIF marker, commonly found in JPEG files produced -+by digital cameras, in addition to any comment markers. If there is an EXIF -+marker it is copied and the JFIF marker (incompatible with EXIF) is -+omitted. If there is no EXIF marker a JFIF one is emitted as usual. See 'EXIF -+FILES' for special tratement of EXIF markers. - .IP - The default behavior is - .BR "\-copy comments" . -@@ -223,6 +231,26 @@ - .B \-debug - Same as - .BR \-verbose . -+.SH EXIF FILES -+The EXIF variety of JPEG files, which are often produced by digital cameras, -+are recognized by jpegtran as EXIF files (i.e. not as JFIF, the -+usual variety of JPEG files). If the input file is recognized as EXIF (i.e., -+there is an EXIF marker and no JFIF marker) the '-copy exif' option is -+automatically turned on if '-copy comments', or no '-copy' option, was -+specified. Thus, unless '-copy none' is specified an EXIF file is kept as EXIF -+and not converted to JFIF. -+.PP -+If a geometrical transformation is applied (e.g., rotate, transpose) the EXIF -+width and height fields are set to the width and height of the output -+image. Furthermore, the orientation field is reset to one, meaning tha the -+orientation of the output image is upright (i.e. normal). -+.PP -+Note that an explicitely given '-copy exif' option will output an EXIF file if -+the input is an EXIF file that was saved as JFIF, and that the EXIF marker is -+still present. This option is useful for recovering EXIF files that where -+converted to JFIF by a non EXIF-aware software. Note however, that the data in -+the EXIF marker is not validated, unless a geometrical transformation is -+applied. - .SH EXAMPLES - .LP - This example converts a baseline JPEG file to progressive form: diff --git a/graphics/jpeg/files/patch-jpegtran.c b/graphics/jpeg/files/patch-jpegtran.c deleted file mode 100644 index 6af68e3f9049..000000000000 --- a/graphics/jpeg/files/patch-jpegtran.c +++ /dev/null @@ -1,248 +0,0 @@ ---- jpegtran.c.orig 2010-02-14 15:53:36.000000000 +0100 -+++ jpegtran.c 2010-03-09 16:00:19.000000000 +0100 -@@ -37,6 +37,7 @@ - - static const char * progname; /* program name for error messages */ - static char * outfilename; /* for -outfile switch */ -+static char * dropfilename; /* for -drop switch */ - static char * scaleoption; /* -scale switch */ - static JCOPY_OPTION copyoption; /* -copy switch */ - static jpeg_transform_info transformoption; /* image transformation options */ -@@ -57,6 +58,7 @@ - fprintf(stderr, " -copy none Copy no extra markers from source file\n"); - fprintf(stderr, " -copy comments Copy only comment markers (default)\n"); - fprintf(stderr, " -copy all Copy all extra markers\n"); -+ fprintf(stderr, " -copy exif Copy EXIF marker and omit JFIF if EXIF\n"); - #ifdef ENTROPY_OPT_SUPPORTED - fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); - #endif -@@ -66,6 +68,7 @@ - fprintf(stderr, "Switches for modifying the image:\n"); - #if TRANSFORMS_SUPPORTED - fprintf(stderr, " -crop WxH+X+Y Crop to a rectangular subarea\n"); -+ fprintf(stderr, " -drop +X+Y filename Drop another image\n"); - fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n"); - fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n"); - fprintf(stderr, " -perfect Fail if there is non-transformable edge blocks\n"); -@@ -75,7 +78,8 @@ - #if TRANSFORMS_SUPPORTED - fprintf(stderr, " -transpose Transpose image\n"); - fprintf(stderr, " -transverse Transverse transpose image\n"); -- fprintf(stderr, " -trim Drop non-transformable edge blocks\n"); -+ fprintf(stderr, " -trim Drop non-transformable edge blocks or\n"); -+ fprintf(stderr, " with -drop: Requantize drop file to source file\n"); - #endif - fprintf(stderr, "Switches for advanced users:\n"); - fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); -@@ -116,6 +120,52 @@ - } - - -+LOCAL(void) -+handle_exif (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, -+ JCOPY_OPTION *copyoption) -+/* Adjust the marker writing options to create an EXIF file, instead of JFIF, -+ * if so requested or an EXIF file is detected as input. Must be called after -+ * jpeg_copy_critical_parameters() as that sets the defaults. */ -+{ -+ jpeg_saved_marker_ptr cur_marker, prev_marker; -+ -+ /* Look for an exif marker */ -+ prev_marker = NULL; -+ cur_marker = srcinfo->marker_list; -+ while (cur_marker != NULL) { -+ if (cur_marker->marker == JPEG_APP0+1 && -+ cur_marker->data_length >= 6 && -+ GETJOCTET(cur_marker->data[0]) == 0x45 && -+ GETJOCTET(cur_marker->data[1]) == 0x78 && -+ GETJOCTET(cur_marker->data[2]) == 0x69 && -+ GETJOCTET(cur_marker->data[3]) == 0x66 && -+ GETJOCTET(cur_marker->data[4]) == 0 && -+ GETJOCTET(cur_marker->data[5]) == 0) -+ break; /* found an EXIF marker */ -+ prev_marker = cur_marker; -+ cur_marker = cur_marker->next; -+ } -+ /* If we've found an EXIF marker but not JFIF this is an EXIF file. Unless -+ * explicitely requested, make sure we keep the EXIF marker and do not -+ * emit a JFIF marker (which would come before). EXIF requires that the -+ * first marker be EXIF. */ -+ if (cur_marker != NULL && -+ ((*copyoption != JCOPYOPT_NONE && !srcinfo->saw_JFIF_marker) || -+ (*copyoption == JCOPYOPT_EXIF))) { -+ dstinfo->write_JFIF_header = FALSE; -+ if (*copyoption == JCOPYOPT_COMMENTS) -+ *copyoption = JCOPYOPT_EXIF; -+ } -+ /* If making an EXIF file, make sure that EXIF is first marker */ -+ if (cur_marker != NULL && prev_marker != NULL && -+ *copyoption == JCOPYOPT_EXIF) { -+ prev_marker->next = cur_marker->next; -+ cur_marker->next = srcinfo->marker_list; -+ srcinfo->marker_list = cur_marker; -+ } -+} -+ -+ - LOCAL(int) - parse_switches (j_compress_ptr cinfo, int argc, char **argv, - int last_file_arg_seen, boolean for_real) -@@ -136,6 +186,7 @@ - /* Set up default JPEG parameters. */ - simple_progressive = FALSE; - outfilename = NULL; -+ dropfilename = NULL; - scaleoption = NULL; - copyoption = JCOPYOPT_DEFAULT; - transformoption.transform = JXFORM_NONE; -@@ -179,6 +230,8 @@ - copyoption = JCOPYOPT_COMMENTS; - } else if (keymatch(argv[argn], "all", 1)) { - copyoption = JCOPYOPT_ALL; -+ } else if (keymatch(argv[argn], "exif", 1)) { -+ copyoption = JCOPYOPT_EXIF; - } else - usage(); - -@@ -196,6 +249,26 @@ - select_transform(JXFORM_NONE); /* force an error */ - #endif - -+ } else if (keymatch(arg, "drop", 2)) { -+#if TRANSFORMS_SUPPORTED -+ if (++argn >= argc) /* advance to next argument */ -+ usage(); -+ if (transformoption.crop /* reject multiple crop/drop requests */ || -+ ! jtransform_parse_crop_spec(&transformoption, argv[argn]) || -+ transformoption.crop_width_set != JCROP_UNSET || -+ transformoption.crop_height_set != JCROP_UNSET) { -+ fprintf(stderr, "%s: bogus -drop argument '%s'\n", -+ progname, argv[argn]); -+ exit(EXIT_FAILURE); -+ } -+ if (++argn >= argc) /* advance to next argument */ -+ usage(); -+ dropfilename = argv[argn]; -+ select_transform(JXFORM_DROP); -+#else -+ select_transform(JXFORM_NONE); /* force an error */ -+#endif -+ - } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { - /* Enable debug printouts. */ - /* On first -d, print version identification */ -@@ -204,6 +277,7 @@ - if (! printed_version) { - fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n", - JVERSION, JCOPYRIGHT); -+ fprintf(stderr, "EXIF support v 0.1 added 29-Sep-2003\n"); - printed_version = TRUE; - } - cinfo->err->trace_level++; -@@ -371,6 +445,11 @@ - struct jpeg_decompress_struct srcinfo; - struct jpeg_compress_struct dstinfo; - struct jpeg_error_mgr jsrcerr, jdsterr; -+#if TRANSFORMS_SUPPORTED -+ struct jpeg_decompress_struct dropinfo; -+ struct jpeg_error_mgr jdroperr; -+ FILE * drop_file; -+#endif - #ifdef PROGRESS_REPORT - struct cdjpeg_progress_mgr progress; - #endif -@@ -452,6 +531,21 @@ - fp = read_stdin(); - } - -+#if TRANSFORMS_SUPPORTED -+ /* Open the drop file. */ -+ if (dropfilename != NULL) { -+ if ((drop_file = fopen(dropfilename, READ_BINARY)) == NULL) { -+ fprintf(stderr, "%s: can't open %s for reading\n", progname, dropfilename); -+ exit(EXIT_FAILURE); -+ } -+ dropinfo.err = jpeg_std_error(&jdroperr); -+ jpeg_create_decompress(&dropinfo); -+ jpeg_stdio_src(&dropinfo, drop_file); -+ } else { -+ drop_file = NULL; -+ } -+#endif -+ - #ifdef PROGRESS_REPORT - start_progress_monitor((j_common_ptr) &dstinfo, &progress); - #endif -@@ -471,6 +565,17 @@ - &srcinfo.scale_num, &srcinfo.scale_denom) < 1) - usage(); - -+#if TRANSFORMS_SUPPORTED -+ if (dropfilename != NULL) { -+ (void) jpeg_read_header(&dropinfo, TRUE); -+ transformoption.crop_width = dropinfo.image_width; -+ transformoption.crop_width_set = JCROP_POS; -+ transformoption.crop_height = dropinfo.image_height; -+ transformoption.crop_height_set = JCROP_POS; -+ transformoption.drop_ptr = &dropinfo; -+ } -+#endif -+ - /* Any space needed by a transform option must be requested before - * jpeg_read_coefficients so that memory allocation will be done right. - */ -@@ -486,6 +591,12 @@ - /* Read source file as DCT coefficients */ - src_coef_arrays = jpeg_read_coefficients(&srcinfo); - -+#if TRANSFORMS_SUPPORTED -+ if (dropfilename != NULL) { -+ transformoption.drop_coef_arrays = jpeg_read_coefficients(&dropinfo); -+ } -+#endif -+ - /* Initialize destination compression parameters from source values */ - jpeg_copy_critical_parameters(&srcinfo, &dstinfo); - -@@ -524,6 +635,9 @@ - /* Adjust default compression parameters by re-parsing the options */ - file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE); - -+ /* If we want EXIF, make sure we do not write incompatible markers */ -+ handle_exif(&srcinfo,&dstinfo,©option); -+ - /* Specify data destination for compression */ - jpeg_stdio_dest(&dstinfo, fp); - -@@ -545,16 +659,30 @@ - jpeg_destroy_compress(&dstinfo); - (void) jpeg_finish_decompress(&srcinfo); - jpeg_destroy_decompress(&srcinfo); -- -+#if TRANSFORMS_SUPPORTED -+ if (dropfilename != NULL) { -+ (void) jpeg_finish_decompress(&dropinfo); -+ jpeg_destroy_decompress(&dropinfo); -+ } -+#endif - /* Close output file, if we opened it */ - if (fp != stdout) - fclose(fp); -+#if TRANSFORMS_SUPPORTED -+ if (drop_file != NULL) -+ fclose(drop_file); -+#endif - - #ifdef PROGRESS_REPORT - end_progress_monitor((j_common_ptr) &dstinfo); - #endif - - /* All done. */ -+#if TRANSFORMS_SUPPORTED -+ if (dropfilename != NULL) -+ exit(jsrcerr.num_warnings + jdroperr.num_warnings + jdsterr.num_warnings ? -+ EXIT_WARNING : EXIT_SUCCESS); -+#endif - exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); - return 0; /* suppress no-return-value warnings */ - } diff --git a/graphics/jpeg/files/patch-rdjpgcom.c b/graphics/jpeg/files/patch-rdjpgcom.c deleted file mode 100644 index 964a10223a78..000000000000 --- a/graphics/jpeg/files/patch-rdjpgcom.c +++ /dev/null @@ -1,202 +0,0 @@ ---- rdjpgcom.c.orig 2009-04-03 01:30:13.000000000 +0200 -+++ rdjpgcom.c 2009-06-30 13:49:16.000000000 +0200 -@@ -124,6 +124,7 @@ - #define M_EOI 0xD9 /* End Of Image (end of datastream) */ - #define M_SOS 0xDA /* Start Of Scan (begins compressed data) */ - #define M_APP0 0xE0 /* Application-specific marker, type N */ -+#define M_APP1 0xE1 /* Typically EXIF marker */ - #define M_APP12 0xEC /* (we don't bother to list all 16 APPn's) */ - #define M_COM 0xFE /* COMment */ - -@@ -214,6 +215,175 @@ - } - } - -+/* -+ * Helper routine to skip the given number of bytes. -+ */ -+ -+static void -+skip_n (unsigned int length) -+{ -+ while (length > 0) { -+ (void) read_1_byte(); -+ length--; -+ } -+} -+ -+/* -+ * Parses an APP1 marker looking for EXIF data. If EXIF, the orientation is -+ * reported to stdout. -+ */ -+ -+static void -+process_APP1 (void) -+{ -+ unsigned int length, i; -+ int is_motorola; /* byte order indicator */ -+ unsigned int offset, number_of_tags, tagnum; -+ int orientation; -+ char *ostr; -+ /* This 64K buffer would probably be best if allocated dynamically, but it's -+ * the only one on this program so it's really not that -+ * important. Allocating on the stack is not an option, as 64K might be too -+ * big for some (crippled) platforms. */ -+ static unsigned char exif_data[65536L]; -+ -+ /* Get the marker parameter length count */ -+ length = read_2_bytes(); -+ /* Length includes itself, so must be at least 2 */ -+ if (length < 2) -+ ERREXIT("Erroneous JPEG marker length"); -+ length -= 2; -+ -+ /* We only care if APP1 is really an EXIF marker. Minimum length is 6 for -+ * signature plus 12 for an IFD. */ -+ if (length < 18) { -+ skip_n(length); -+ return; -+ } -+ -+ /* Check for actual EXIF marker */ -+ for (i=0; i < 6; i++) -+ exif_data[i] = (unsigned char) read_1_byte(); -+ length -= 6; -+ if (exif_data[0] != 0x45 || -+ exif_data[1] != 0x78 || -+ exif_data[2] != 0x69 || -+ exif_data[3] != 0x66 || -+ exif_data[4] != 0 || -+ exif_data[5] != 0) { -+ skip_n(length); -+ return; -+ } -+ -+ /* Read all EXIF body */ -+ for (i=0; i < length; i++) -+ exif_data[i] = (unsigned char) read_1_byte(); -+ -+ /* Discover byte order */ -+ if (exif_data[0] == 0x49 && exif_data[1] == 0x49) -+ is_motorola = 0; -+ else if (exif_data[0] == 0x4D && exif_data[1] == 0x4D) -+ is_motorola = 1; -+ else -+ return; -+ -+ /* Check Tag Mark */ -+ if (is_motorola) { -+ if (exif_data[2] != 0) return; -+ if (exif_data[3] != 0x2A) return; -+ } else { -+ if (exif_data[3] != 0) return; -+ if (exif_data[2] != 0x2A) return; -+ } -+ -+ /* Get first IFD offset (offset to IFD0) */ -+ if (is_motorola) { -+ if (exif_data[4] != 0) return; -+ if (exif_data[5] != 0) return; -+ offset = exif_data[6]; -+ offset <<= 8; -+ offset += exif_data[7]; -+ } else { -+ if (exif_data[7] != 0) return; -+ if (exif_data[6] != 0) return; -+ offset = exif_data[5]; -+ offset <<= 8; -+ offset += exif_data[4]; -+ } -+ if (offset > length - 2) return; /* check end of data segment */ -+ -+ /* Get the number of directory entries contained in this IFD */ -+ if (is_motorola) { -+ number_of_tags = exif_data[offset]; -+ number_of_tags <<= 8; -+ number_of_tags += exif_data[offset+1]; -+ } else { -+ number_of_tags = exif_data[offset+1]; -+ number_of_tags <<= 8; -+ number_of_tags += exif_data[offset]; -+ } -+ if (number_of_tags == 0) return; -+ offset += 2; -+ -+ /* Search for Orientation Tag in IFD0 */ -+ for (;;) { -+ if (offset > length - 12) return; /* check end of data segment */ -+ /* Get Tag number */ -+ if (is_motorola) { -+ tagnum = exif_data[offset]; -+ tagnum <<= 8; -+ tagnum += exif_data[offset+1]; -+ } else { -+ tagnum = exif_data[offset+1]; -+ tagnum <<= 8; -+ tagnum += exif_data[offset]; -+ } -+ if (tagnum == 0x0112) break; /* found Orientation Tag */ -+ if (--number_of_tags == 0) return; -+ offset += 12; -+ } -+ -+ /* Get the Orientation value */ -+ if (is_motorola) { -+ if (exif_data[offset+8] != 0) return; -+ orientation = exif_data[offset+9]; -+ } else { -+ if (exif_data[offset+9] != 0) return; -+ orientation = exif_data[offset+8]; -+ } -+ if (orientation == 0 || orientation > 8) return; -+ -+ /* Print the orientation (position of the 0th row - 0th column) */ -+ switch (orientation) { -+ case 1: -+ ostr = "top-left"; -+ break; -+ case 2: -+ ostr = "top-right"; -+ break; -+ case 3: -+ ostr = "bottom-right"; -+ break; -+ case 4: -+ ostr = "bottom-left"; -+ break; -+ case 5: -+ ostr = "left-top"; -+ break; -+ case 6: -+ ostr = "right-top"; -+ break; -+ case 7: -+ ostr = "right-bottom"; -+ break; -+ case 8: -+ ostr = "left-bottom"; -+ break; -+ default: -+ return; -+ } -+ printf("EXIF orientation: %s\n",ostr); -+} - - /* - * Process a COM marker. -@@ -381,6 +551,15 @@ - process_COM(raw); - break; - -+ case M_APP1: -+ /* APP1 is usually the EXIF marker used by digital cameras, attempt to -+ * process it to give some useful info. */ -+ if (verbose) { -+ process_APP1(); -+ } else -+ skip_variable(); -+ break; -+ - case M_APP12: - /* Some digital camera makers put useful textual information into - * APP12 markers, so we print those out too when in -verbose mode. diff --git a/graphics/jpeg/files/patch-transupp.c b/graphics/jpeg/files/patch-transupp.c deleted file mode 100644 index 4be896defcad..000000000000 --- a/graphics/jpeg/files/patch-transupp.c +++ /dev/null @@ -1,560 +0,0 @@ ---- transupp.c.orig 2011-10-26 13:20:05.000000000 +0200 -+++ transupp.c 2012-11-15 21:46:57.000000000 +0100 -@@ -51,6 +51,13 @@ - * guarantee we can touch more than one row at a time. So in that case, - * we have to use a separate destination array. - * -+ * If cropping or trimming is involved, the destination arrays may be smaller -+ * than the source arrays. Note it is not possible to do horizontal flip -+ * in-place when a nonzero Y crop offset is specified, since we'd have to move -+ * data from one block row to another but the virtual array manager doesn't -+ * guarantee we can touch more than one row at a time. So in that case, -+ * we have to use a separate destination array. -+ * - * Some notes about the operating environment of the individual transform - * routines: - * 1. Both the source and destination virtual arrays are allocated from the -@@ -75,6 +82,269 @@ - */ - - -+/* Drop code may be used with or without virtual memory adaptation code. -+ * This code has some dependencies on internal library behavior, so you -+ * may choose to disable it. For example, it doesn't make a difference -+ * if you only use jmemnobs anyway. -+ */ -+#ifndef DROP_REQUEST_FROM_SRC -+#define DROP_REQUEST_FROM_SRC 1 /* 0 disables adaptation */ -+#endif -+ -+ -+#if DROP_REQUEST_FROM_SRC -+/* Force jpeg_read_coefficients to request -+ * the virtual coefficient arrays from -+ * the source decompression object. -+ */ -+METHODDEF(jvirt_barray_ptr) -+drop_request_virt_barray (j_common_ptr cinfo, int pool_id, boolean pre_zero, -+ JDIMENSION blocksperrow, JDIMENSION numrows, -+ JDIMENSION maxaccess) -+{ -+ j_decompress_ptr srcinfo = (j_decompress_ptr) cinfo->client_data; -+ -+ return (*srcinfo->mem->request_virt_barray) -+ ((j_common_ptr) srcinfo, pool_id, pre_zero, -+ blocksperrow, numrows, maxaccess); -+} -+ -+ -+/* Force jpeg_read_coefficients to return -+ * after requesting and before accessing -+ * the virtual coefficient arrays. -+ */ -+METHODDEF(int) -+drop_consume_input (j_decompress_ptr cinfo) -+{ -+ return JPEG_SUSPENDED; -+} -+ -+ -+METHODDEF(void) -+drop_start_input_pass (j_decompress_ptr cinfo) -+{ -+ cinfo->inputctl->consume_input = drop_consume_input; -+} -+ -+ -+LOCAL(void) -+drop_request_from_src (j_decompress_ptr dropinfo, j_decompress_ptr srcinfo) -+{ -+ void *save_client_data; -+ JMETHOD(jvirt_barray_ptr, save_request_virt_barray, -+ (j_common_ptr cinfo, int pool_id, boolean pre_zero, -+ JDIMENSION blocksperrow, JDIMENSION numrows, JDIMENSION maxaccess)); -+ JMETHOD(void, save_start_input_pass, (j_decompress_ptr cinfo)); -+ -+ /* Set custom method pointers, save original pointers */ -+ save_client_data = dropinfo->client_data; -+ dropinfo->client_data = (void *) srcinfo; -+ save_request_virt_barray = dropinfo->mem->request_virt_barray; -+ dropinfo->mem->request_virt_barray = drop_request_virt_barray; -+ save_start_input_pass = dropinfo->inputctl->start_input_pass; -+ dropinfo->inputctl->start_input_pass = drop_start_input_pass; -+ -+ /* Execute only initialization part. -+ * Requested coefficient arrays will be realized later by the srcinfo object. -+ * Next call to the same function will then do the actual data reading. -+ * NB: since we request the coefficient arrays from another object, -+ * the inherent realization call is effectively a no-op. -+ */ -+ (void) jpeg_read_coefficients(dropinfo); -+ -+ /* Reset method pointers */ -+ dropinfo->client_data = save_client_data; -+ dropinfo->mem->request_virt_barray = save_request_virt_barray; -+ dropinfo->inputctl->start_input_pass = save_start_input_pass; -+ /* Do input initialization for first scan now, -+ * which also resets the consume_input method. -+ */ -+ (*save_start_input_pass)(dropinfo); -+} -+#endif /* DROP_REQUEST_FROM_SRC */ -+ -+ -+LOCAL(void) -+dequant_comp (j_decompress_ptr cinfo, jpeg_component_info *compptr, -+ jvirt_barray_ptr coef_array, JQUANT_TBL *qtblptr1) -+{ -+ JDIMENSION blk_x, blk_y; -+ int offset_y, k; -+ JQUANT_TBL *qtblptr; -+ JBLOCKARRAY buffer; -+ JBLOCKROW block; -+ JCOEFPTR ptr; -+ -+ qtblptr = compptr->quant_table; -+ for (blk_y = 0; blk_y < compptr->height_in_blocks; -+ blk_y += compptr->v_samp_factor) { -+ buffer = (*cinfo->mem->access_virt_barray) -+ ((j_common_ptr) cinfo, coef_array, blk_y, -+ (JDIMENSION) compptr->v_samp_factor, TRUE); -+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { -+ block = buffer[offset_y]; -+ for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) { -+ ptr = block[blk_x]; -+ for (k = 0; k < DCTSIZE2; k++) -+ if (qtblptr->quantval[k] != qtblptr1->quantval[k]) -+ ptr[k] *= qtblptr->quantval[k] / qtblptr1->quantval[k]; -+ } -+ } -+ } -+} -+ -+ -+LOCAL(void) -+requant_comp (j_decompress_ptr cinfo, jpeg_component_info *compptr, -+ jvirt_barray_ptr coef_array, JQUANT_TBL *qtblptr1) -+{ -+ JDIMENSION blk_x, blk_y; -+ int offset_y, k; -+ JQUANT_TBL *qtblptr; -+ JBLOCKARRAY buffer; -+ JBLOCKROW block; -+ JCOEFPTR ptr; -+ JCOEF temp, qval; -+ -+ qtblptr = compptr->quant_table; -+ for (blk_y = 0; blk_y < compptr->height_in_blocks; -+ blk_y += compptr->v_samp_factor) { -+ buffer = (*cinfo->mem->access_virt_barray) -+ ((j_common_ptr) cinfo, coef_array, blk_y, -+ (JDIMENSION) compptr->v_samp_factor, TRUE); -+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { -+ block = buffer[offset_y]; -+ for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) { -+ ptr = block[blk_x]; -+ for (k = 0; k < DCTSIZE2; k++) { -+ temp = qtblptr->quantval[k]; -+ qval = qtblptr1->quantval[k]; -+ if (temp != qval) { -+ temp *= ptr[k]; -+ /* The following quantization code is a copy from jcdctmgr.c */ -+#ifdef FAST_DIVIDE -+#define DIVIDE_BY(a,b) a /= b -+#else -+#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 -+#endif -+ if (temp < 0) { -+ temp = -temp; -+ temp += qval>>1; /* for rounding */ -+ DIVIDE_BY(temp, qval); -+ temp = -temp; -+ } else { -+ temp += qval>>1; /* for rounding */ -+ DIVIDE_BY(temp, qval); -+ } -+ ptr[k] = temp; -+ } -+ } -+ } -+ } -+ } -+} -+ -+ -+/* Calculate largest common denominator with Euklid's algorithm. -+ */ -+LOCAL(JCOEF) -+largest_common_denominator(JCOEF a, JCOEF b) -+{ -+ JCOEF c; -+ -+ do { -+ c = a % b; -+ a = b; -+ b = c; -+ } while (c); -+ -+ return a; -+} -+ -+ -+LOCAL(void) -+adjust_quant(j_decompress_ptr srcinfo, jvirt_barray_ptr *src_coef_arrays, -+ j_decompress_ptr dropinfo, jvirt_barray_ptr *drop_coef_arrays, -+ boolean trim, j_compress_ptr dstinfo) -+{ -+ jpeg_component_info *compptr1, *compptr2; -+ JQUANT_TBL *qtblptr1, *qtblptr2, *qtblptr3; -+ int ci, k; -+ -+ for (ci = 0; ci < dstinfo->num_components && -+ ci < dropinfo->num_components; ci++) { -+ compptr1 = srcinfo->comp_info + ci; -+ compptr2 = dropinfo->comp_info + ci; -+ qtblptr1 = compptr1->quant_table; -+ qtblptr2 = compptr2->quant_table; -+ for (k = 0; k < DCTSIZE2; k++) { -+ if (qtblptr1->quantval[k] != qtblptr2->quantval[k]) { -+ if (trim) -+ requant_comp(dropinfo, compptr2, drop_coef_arrays[ci], qtblptr1); -+ else { -+ qtblptr3 = dstinfo->quant_tbl_ptrs[compptr1->quant_tbl_no]; -+ for (k = 0; k < DCTSIZE2; k++) -+ if (qtblptr1->quantval[k] != qtblptr2->quantval[k]) -+ qtblptr3->quantval[k] = largest_common_denominator -+ (qtblptr1->quantval[k], qtblptr2->quantval[k]); -+ dequant_comp(srcinfo, compptr1, src_coef_arrays[ci], qtblptr3); -+ dequant_comp(dropinfo, compptr2, drop_coef_arrays[ci], qtblptr3); -+ } -+ break; -+ } -+ } -+ } -+} -+ -+ -+LOCAL(void) -+do_drop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, -+ JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, -+ jvirt_barray_ptr *src_coef_arrays, -+ j_decompress_ptr dropinfo, jvirt_barray_ptr *drop_coef_arrays, -+ JDIMENSION drop_width, JDIMENSION drop_height) -+/* Drop. If the dropinfo component number is smaller than the destination's, -+ * we fill in the remaining components with zero. This provides the feature -+ * of dropping grayscale into (arbitrarily sampled) color images. -+ */ -+{ -+ JDIMENSION comp_width, comp_height; -+ JDIMENSION blk_y, x_drop_blocks, y_drop_blocks; -+ int ci, offset_y; -+ JBLOCKARRAY src_buffer, dst_buffer; -+ jpeg_component_info *compptr; -+ -+ for (ci = 0; ci < dstinfo->num_components; ci++) { -+ compptr = dstinfo->comp_info + ci; -+ comp_width = drop_width * compptr->h_samp_factor; -+ comp_height = drop_height * compptr->v_samp_factor; -+ x_drop_blocks = x_crop_offset * compptr->h_samp_factor; -+ y_drop_blocks = y_crop_offset * compptr->v_samp_factor; -+ for (blk_y = 0; blk_y < comp_height; blk_y += compptr->v_samp_factor) { -+ dst_buffer = (*srcinfo->mem->access_virt_barray) -+ ((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y + y_drop_blocks, -+ (JDIMENSION) compptr->v_samp_factor, TRUE); -+ if (ci < dropinfo->num_components) { -+ src_buffer = (*srcinfo->mem->access_virt_barray) -+ ((j_common_ptr) srcinfo, drop_coef_arrays[ci], blk_y, -+ (JDIMENSION) compptr->v_samp_factor, FALSE); -+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { -+ jcopy_block_row(src_buffer[offset_y], -+ dst_buffer[offset_y] + x_drop_blocks, -+ comp_width); -+ } -+ } else { -+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { -+ FMEMZERO(dst_buffer[offset_y] + x_drop_blocks, -+ comp_width * SIZEOF(JBLOCK)); -+ } -+ } -+ } -+ } -+} -+ -+ - LOCAL(void) - do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, - JDIMENSION x_crop_offset, JDIMENSION y_crop_offset, -@@ -82,16 +352,21 @@ - jvirt_barray_ptr *dst_coef_arrays) - /* Crop. This is only used when no rotate/flip is requested with the crop. */ - { -+ JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height; - JDIMENSION dst_blk_y, x_crop_blocks, y_crop_blocks; - int ci, offset_y; - JBLOCKARRAY src_buffer, dst_buffer; - jpeg_component_info *compptr; - -+ MCU_cols = srcinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE); -+ MCU_rows = srcinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE); - /* We simply have to copy the right amount of data (the destination's - * image size) starting at the given X and Y offsets in the source. - */ - for (ci = 0; ci < dstinfo->num_components; ci++) { - compptr = dstinfo->comp_info + ci; -+ comp_width = MCU_cols * compptr->h_samp_factor; -+ comp_height = MCU_rows * compptr->v_samp_factor; - x_crop_blocks = x_crop_offset * compptr->h_samp_factor; - y_crop_blocks = y_crop_offset * compptr->v_samp_factor; - for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks; -@@ -99,17 +374,49 @@ - dst_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y, - (JDIMENSION) compptr->v_samp_factor, TRUE); -+ if (dstinfo->image_height > srcinfo->image_height) { -+ if (dst_blk_y < y_crop_blocks || -+ dst_blk_y >= comp_height + y_crop_blocks) { -+ for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { -+ FMEMZERO(dst_buffer[offset_y], -+ compptr->width_in_blocks * SIZEOF(JBLOCK)); -+ } -+ continue; -+ } -+ src_buffer = (*srcinfo->mem->access_virt_barray) -+ ((j_common_ptr) srcinfo, src_coef_arrays[ci], -+ dst_blk_y - y_crop_blocks, -+ (JDIMENSION) compptr->v_samp_factor, FALSE); -+ } else { - src_buffer = (*srcinfo->mem->access_virt_barray) - ((j_common_ptr) srcinfo, src_coef_arrays[ci], - dst_blk_y + y_crop_blocks, - (JDIMENSION) compptr->v_samp_factor, FALSE); -+ } - for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) { -+ if (dstinfo->image_width > srcinfo->image_width) { -+ if (x_crop_blocks > 0) { -+ FMEMZERO(dst_buffer[offset_y], -+ x_crop_blocks * SIZEOF(JBLOCK)); -+ } -+ jcopy_block_row(src_buffer[offset_y], -+ dst_buffer[offset_y] + x_crop_blocks, -+ comp_width); -+ if (compptr->width_in_blocks > comp_width + x_crop_blocks) { -+ FMEMZERO(dst_buffer[offset_y] + -+ comp_width + x_crop_blocks, -+ (compptr->width_in_blocks - -+ comp_width - x_crop_blocks) * SIZEOF(JBLOCK)); -+ } -+ } else { -+ - jcopy_block_row(src_buffer[offset_y] + x_crop_blocks, - dst_buffer[offset_y], - compptr->width_in_blocks); - } - } - } -+ } - } - - -@@ -884,7 +1191,9 @@ - JDIMENSION xoffset, yoffset; - JDIMENSION width_in_iMCUs, height_in_iMCUs; - JDIMENSION width_in_blocks, height_in_blocks; -+ JDIMENSION dtemp; - int ci, h_samp_factor, v_samp_factor; -+ int itemp; - - /* Determine number of components in output image */ - if (info->force_grayscale && -@@ -965,39 +1274,120 @@ - info->crop_xoffset = 0; /* default to +0 */ - if (info->crop_yoffset_set == JCROP_UNSET) - info->crop_yoffset = 0; /* default to +0 */ -- if (info->crop_xoffset >= info->output_width || -- info->crop_yoffset >= info->output_height) -+ if (info->crop_width_set == JCROP_UNSET) { -+ if (info->crop_xoffset >= info->output_width) - ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); -- if (info->crop_width_set == JCROP_UNSET) - info->crop_width = info->output_width - info->crop_xoffset; -- if (info->crop_height_set == JCROP_UNSET) -+ } else { -+ /* Check for crop extension */ -+ if (info->crop_width > info->output_width) { -+ /* Crop extension does not work when transforming! */ -+ if (info->transform != JXFORM_NONE || -+ info->crop_xoffset >= info->crop_width || -+ info->crop_xoffset > info->crop_width - info->output_width) -+ ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); -+ } else { -+ if (info->crop_xoffset >= info->output_width || -+ info->crop_width <= 0 || -+ info->crop_xoffset > info->output_width - info->crop_width) -+ ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); -+ } -+ } -+ if (info->crop_height_set == JCROP_UNSET) { -+ if (info->crop_yoffset >= info->output_height) -+ ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); - info->crop_height = info->output_height - info->crop_yoffset; -- /* Ensure parameters are valid */ -- if (info->crop_width <= 0 || info->crop_width > info->output_width || -- info->crop_height <= 0 || info->crop_height > info->output_height || -- info->crop_xoffset > info->output_width - info->crop_width || -+ } else { -+ /* Check for crop extension */ -+ if (info->crop_height > info->output_height) { -+ /* Crop extension does not work when transforming! */ -+ if (info->transform != JXFORM_NONE || -+ info->crop_yoffset >= info->crop_height || -+ info->crop_yoffset > info->crop_height - info->output_height) -+ ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); -+ } else { -+ if (info->crop_yoffset >= info->output_height || -+ info->crop_height <= 0 || - info->crop_yoffset > info->output_height - info->crop_height) - ERREXIT(srcinfo, JERR_BAD_CROP_SPEC); -+ } -+ } - /* Convert negative crop offsets into regular offsets */ -- if (info->crop_xoffset_set == JCROP_NEG) -+ if (info->crop_xoffset_set == JCROP_NEG) { -+ if (info->crop_width > info->output_width) -+ xoffset = info->crop_width - info->output_width - info->crop_xoffset; -+ else - xoffset = info->output_width - info->crop_width - info->crop_xoffset; -- else -+ } else - xoffset = info->crop_xoffset; -- if (info->crop_yoffset_set == JCROP_NEG) -+ if (info->crop_yoffset_set == JCROP_NEG) { -+ if (info->crop_height > info->output_height) -+ yoffset = info->crop_height - info->output_height - info->crop_yoffset; -+ else - yoffset = info->output_height - info->crop_height - info->crop_yoffset; -- else -+ } else - yoffset = info->crop_yoffset; - /* Now adjust so that upper left corner falls at an iMCU boundary */ -+ if (info->transform == JXFORM_DROP) { -+ /* Ensure the effective drop region will not exceed the requested */ -+ itemp = info->iMCU_sample_width; -+ dtemp = itemp - 1 - ((xoffset + itemp - 1) % itemp); -+ xoffset += dtemp; -+ if (info->crop_width > dtemp) -+ info->drop_width = (info->crop_width - dtemp) / itemp; -+ else -+ info->drop_width = 0; -+ itemp = info->iMCU_sample_height; -+ dtemp = itemp - 1 - ((yoffset + itemp - 1) % itemp); -+ yoffset += dtemp; -+ if (info->crop_height > dtemp) -+ info->drop_height = (info->crop_height - dtemp) / itemp; -+ else -+ info->drop_height = 0; -+ /* Check if sampling factors match for dropping */ -+ if (info->drop_width != 0 && info->drop_height != 0) -+ for (ci = 0; ci < info->num_components && -+ ci < info->drop_ptr->num_components; ci++) { -+ if (info->drop_ptr->comp_info[ci].h_samp_factor * -+ srcinfo->max_h_samp_factor != -+ srcinfo->comp_info[ci].h_samp_factor * -+ info->drop_ptr->max_h_samp_factor) -+ ERREXIT6(srcinfo, JERR_BAD_DROP_SAMPLING, ci, -+ info->drop_ptr->comp_info[ci].h_samp_factor, -+ info->drop_ptr->max_h_samp_factor, -+ srcinfo->comp_info[ci].h_samp_factor, -+ srcinfo->max_h_samp_factor, 'h'); -+ if (info->drop_ptr->comp_info[ci].v_samp_factor * -+ srcinfo->max_v_samp_factor != -+ srcinfo->comp_info[ci].v_samp_factor * -+ info->drop_ptr->max_v_samp_factor) -+ ERREXIT6(srcinfo, JERR_BAD_DROP_SAMPLING, ci, -+ info->drop_ptr->comp_info[ci].v_samp_factor, -+ info->drop_ptr->max_v_samp_factor, -+ srcinfo->comp_info[ci].v_samp_factor, -+ srcinfo->max_v_samp_factor, 'v'); -+ } -+ } else { -+ /* Ensure the effective crop region will cover the requested */ -+ if (info->crop_width > info->output_width) -+ info->output_width = info->crop_width; -+ else { - if (info->crop_width_set == JCROP_FORCE) - info->output_width = info->crop_width; - else - info->output_width = - info->crop_width + (xoffset % info->iMCU_sample_width); -+ } -+ if (info->crop_height > info->output_height) -+ info->output_height = info->crop_height; -+ else { - if (info->crop_height_set == JCROP_FORCE) - info->output_height = info->crop_height; - else - info->output_height = - info->crop_height + (yoffset % info->iMCU_sample_height); -+ } -+ } - /* Save x/y offsets measured in iMCUs */ - info->x_crop_offset = xoffset / info->iMCU_sample_width; - info->y_crop_offset = yoffset / info->iMCU_sample_height; -@@ -1013,7 +1403,9 @@ - transpose_it = FALSE; - switch (info->transform) { - case JXFORM_NONE: -- if (info->x_crop_offset != 0 || info->y_crop_offset != 0) -+ if (info->x_crop_offset != 0 || info->y_crop_offset != 0 || -+ info->output_width > srcinfo->image_width || -+ info->output_height > srcinfo->image_height) - need_workspace = TRUE; - /* No workspace needed if neither cropping nor transforming */ - break; -@@ -1067,6 +1459,11 @@ - need_workspace = TRUE; - transpose_it = TRUE; - break; -+ case JXFORM_DROP: -+#if DROP_REQUEST_FROM_SRC -+ drop_request_from_src(info->drop_ptr, srcinfo); -+#endif -+ break; - } - - /* Allocate workspace if needed. -@@ -1373,6 +1770,11 @@ - case JXFORM_ROT_270: - transpose_critical_parameters(dstinfo); - break; -+ case JXFORM_DROP: -+ if (info->drop_width != 0 && info->drop_height != 0) -+ adjust_quant(srcinfo, src_coef_arrays, -+ info->drop_ptr, info->drop_coef_arrays, -+ info->trim, dstinfo); - default: - break; - } -@@ -1427,7 +1829,9 @@ - */ - switch (info->transform) { - case JXFORM_NONE: -- if (info->x_crop_offset != 0 || info->y_crop_offset != 0) -+ if (info->x_crop_offset != 0 || info->y_crop_offset != 0 || -+ info->output_width > srcinfo->image_width || -+ info->output_height > srcinfo->image_height) - do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); - break; -@@ -1463,6 +1867,12 @@ - do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, - src_coef_arrays, dst_coef_arrays); - break; -+ case JXFORM_DROP: -+ if (info->drop_width != 0 && info->drop_height != 0) -+ do_drop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset, -+ src_coef_arrays, info->drop_ptr, info->drop_coef_arrays, -+ info->drop_width, info->drop_height); -+ break; - } - } - diff --git a/graphics/jpeg/files/patch-transupp.h b/graphics/jpeg/files/patch-transupp.h deleted file mode 100644 index c48d0e057b3a..000000000000 --- a/graphics/jpeg/files/patch-transupp.h +++ /dev/null @@ -1,42 +0,0 @@ ---- transupp.h.orig 2009-09-03 10:54:26.000000000 +0200 -+++ transupp.h 2010-01-13 09:34:06.000000000 +0100 -@@ -101,7 +101,8 @@ - JXFORM_TRANSVERSE, /* transpose across UR-to-LL axis */ - JXFORM_ROT_90, /* 90-degree clockwise rotation */ - JXFORM_ROT_180, /* 180-degree rotation */ -- JXFORM_ROT_270 /* 270-degree clockwise (or 90 ccw) */ -+ JXFORM_ROT_270, /* 270-degree clockwise (or 90 ccw) */ -+ JXFORM_DROP /* drop */ - } JXFORM_CODE; - - /* -@@ -141,6 +142,10 @@ - JDIMENSION crop_yoffset; /* Y offset of selected region */ - JCROP_CODE crop_yoffset_set; /* (negative measures from bottom edge) */ - -+ /* Drop parameters: set by caller for drop request */ -+ j_decompress_ptr drop_ptr; -+ jvirt_barray_ptr * drop_coef_arrays; -+ - /* Internal workspace: caller should not touch these */ - int num_components; /* # of components in workspace */ - jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */ -@@ -148,6 +153,8 @@ - JDIMENSION output_height; - JDIMENSION x_crop_offset; /* destination crop offsets measured in iMCUs */ - JDIMENSION y_crop_offset; -+ JDIMENSION drop_width; /* drop dimensions measured in iMCUs */ -+ JDIMENSION drop_height; - int iMCU_sample_width; /* destination iMCU size */ - int iMCU_sample_height; - } jpeg_transform_info; -@@ -196,7 +203,8 @@ - typedef enum { - JCOPYOPT_NONE, /* copy no optional markers */ - JCOPYOPT_COMMENTS, /* copy only comment (COM) markers */ -- JCOPYOPT_ALL /* copy all optional markers */ -+ JCOPYOPT_ALL, /* copy all optional markers */ -+ JCOPYOPT_EXIF /* copy Exif APP1 marker */ - } JCOPY_OPTION; - - #define JCOPYOPT_DEFAULT JCOPYOPT_COMMENTS /* recommended default */ diff --git a/graphics/jpeg/pkg-descr b/graphics/jpeg/pkg-descr deleted file mode 100644 index 87ab69dfceb5..000000000000 --- a/graphics/jpeg/pkg-descr +++ /dev/null @@ -1,19 +0,0 @@ -The Independent JPEG Group's JPEG software -========================================== - -This distribution contains the eighth public release of the Independent JPEG -Group's free JPEG software. You are welcome to redistribute this software and -to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. - -This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone, -Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson, -Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers, -and other members of the Independent JPEG Group. - -IJG is not affiliated with the official ISO JPEG standards committee. - -Includes EXIF patches from: -http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=106060 -http://sylvana.net/jpegcrop/exifpatch.html - -WWW: http://www.ijg.org/ diff --git a/graphics/jpeg/pkg-plist b/graphics/jpeg/pkg-plist deleted file mode 100644 index 1fb901d13284..000000000000 --- a/graphics/jpeg/pkg-plist +++ /dev/null @@ -1,31 +0,0 @@ -bin/cjpeg -bin/djpeg -bin/exifautotran -bin/jpegexiforient -bin/jpegtran -bin/rdjpgcom -bin/wrjpgcom -include/jconfig.h -include/jerror.h -include/jinclude.h -include/jmorecfg.h -include/jpegint.h -include/jpeglib.h -lib/libjpeg.a -lib/libjpeg.so -lib/libjpeg.so.8 -lib/libjpeg.so.8.4.0 -man/man1/cjpeg.1.gz -man/man1/djpeg.1.gz -man/man1/jpegtran.1.gz -man/man1/rdjpgcom.1.gz -man/man1/wrjpgcom.1.gz -%%PORTDOCS%%%%DOCSDIR%%/README -%%PORTDOCS%%%%DOCSDIR%%/coderules.txt -%%PORTDOCS%%%%DOCSDIR%%/filelist.txt -%%PORTDOCS%%%%DOCSDIR%%/install.txt -%%PORTDOCS%%%%DOCSDIR%%/jconfig.txt -%%PORTDOCS%%%%DOCSDIR%%/libjpeg.txt -%%PORTDOCS%%%%DOCSDIR%%/structure.txt -%%PORTDOCS%%%%DOCSDIR%%/usage.txt -%%PORTDOCS%%%%DOCSDIR%%/wizard.txt