diff --git a/Makefile.am b/Makefile.am index e231e51..3ac5a60 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,11 +1,11 @@ ## Process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = foreign check-news +AUTOMAKE_OPTIONS = foreign SUBDIRS = src man_MANS = gifsicle.1 @OTHERMANS@ -EXTRA_DIST = COPYING README.md gifsicle.spec \ +EXTRA_DIST = COPYING README.md NEWS.md \ include/lcdf/clp.h include/lcdf/inttypes.h \ include/lcdfgif/gif.h include/lcdfgif/gifx.h \ gifsicle.1 gifview.1 gifdiff.1 logo.gif logo1.gif \ @@ -34,33 +34,8 @@ srclinks: versionize: perl -pi -e "s/^\\.ds V.*/.ds V $(VERSION)/;" $(top_srcdir)/gifsicle.1 $(top_srcdir)/gifview.1 $(top_srcdir)/gifdiff.1 - perl -pi -e "s/^Version:(\s+).*/Version:"'$$'"{1}$(VERSION)/; s/$(PACKAGE)-[\w.]+\.tar\.gz/$(PACKAGE)-$(VERSION).tar.gz/;" $(top_srcdir)/gifsicle.spec perl -pi -e "s/gifsicle [\d.]+/gifsicle $(VERSION)/; s/VERSION \"[\w.]+/VERSION \"$(VERSION)/;" $(top_srcdir)/src/win32cfg.h -rpm: dist - buildarch=`rpm --showrc | awk '/^build arch/ { print $$4; }'` ; \ - mkdir -p /tmp/rpm-gfs/SOURCES /tmp/rpm-gfs/RPMS/$$buildarch \ - /tmp/rpm-gfs/BUILD ; \ - echo 'include: /usr/lib/rpm/rpmrc' > /tmp/rpm-gfs/rc ; \ - echo 'macrofiles: /usr/lib/rpm/macros:/tmp/rpm-gfs/macros' >> /tmp/rpm-gfs/rc ; \ - echo '%_topdir /tmp/rpm-gfs' > /tmp/rpm-gfs/macros ; \ - cp logo1.gif $(PACKAGE)-$(VERSION).tar.gz /tmp/rpm-gfs/SOURCES ; \ - rpmbuild --rcfile /tmp/rpm-gfs/rc -bb gifsicle.spec ; \ - cp /tmp/rpm-gfs/RPMS/$$buildarch/*.rpm . - rm -rf /tmp/rpm-gfs - -rpm-ungif: dist - buildarch=`rpm --showrc | awk '/^build arch/ { print $$4; }'` ; \ - mkdir -p /tmp/rpm-ugfs/SOURCES /tmp/rpm-ugfs/RPMS/$$buildarch \ - /tmp/rpm-ugfs/BUILD ; \ - echo 'include: /usr/lib/rpm/rpmrc' > /tmp/rpm-ugfs/rc ; \ - echo 'macrofiles: /usr/lib/rpm/macros:/tmp/rpm-ugfs/macros' >> /tmp/rpm-ugfs/rc ; \ - echo '%_topdir /tmp/rpm-ugfs' > /tmp/rpm-ugfs/macros ; \ - cp logo1.gif $(PACKAGE)-$(VERSION).tar.gz /tmp/rpm-ugfs/SOURCES ; \ - GIFSICLE_UNGIF=yes rpmbuild --rcfile /tmp/rpm-ugfs/rc -bb gifsicle.spec ; \ - cp /tmp/rpm-ugfs/RPMS/$$buildarch/*.rpm `echo /tmp/rpm-ugfs/RPMS/$$buildarch/*.rpm | sed 's/.*gifsicle/ungifsicle/'` - rm -rf /tmp/rpm-ugfs - dist-ungif: dist $(AMTAR) xzf gifsicle-$(VERSION).tar.gz @rm gifsicle-$(VERSION)/src/gifwrite.c diff --git a/NEWS b/NEWS.md similarity index 70% rename from NEWS rename to NEWS.md index a5f608e..3dce325 100644 --- a/NEWS +++ b/NEWS.md @@ -1,6 +1,17 @@ Gifsicle NEWS - -Version 1.89 +============= + +## Version 1.91 – 5.Jan.2018 + +* Several security bug fixes with malicious GIFs. + + +## Version 1.90 – 14.Aug.2017 + +* Kill a use-after-free error reported by @junxzm1990. + + +## Version 1.89 - 11.Jul.2017 * Add SIMD support for resizing. When enabled this improves resize performance enormously for complex resize methods. @@ -8,20 +19,23 @@ Version 1.89 * Add thread support for resizing. `-j[NTHREADS]` tells gifsicle to use up to NTHREADS threads to resize an input image. There are several caveats---multiple threads can be only used on unoptimized images. - Thanks to Github user `wilkesybear`. + Thanks to Github user @wilkesybear. + +* Quashed several crashes and undefined behaviors. Thanks to Github users + including @pornel, @strazzere, and @b0b0505. * Minor bug fixes. - -Version 1.88 1.Jul.2015 + +## Version 1.88 - 1.Jul.2015 * Fix bug where long comments were read incorrectly. Reported by kazarny. * Add --no-ignore-errors option. - -Version 1.87 9.Dec.2014 + +## Version 1.87 - 9.Dec.2014 * Always optimize as if the background is transparent. This fixes some rare bugs reported by Lars Dieckow. @@ -29,13 +43,13 @@ Version 1.87 9.Dec.2014 * Fix --crop issue with must-be-preserved frames that are out of the crop window. - -Version 1.86 14.Oct.2014 + +## Version 1.86 - 14.Oct.2014 * Further fix --rotate + --crop. - -Version 1.85 14.Oct.2014 + +## Version 1.85 - 14.Oct.2014 * Greatly improve optimization time for images with many colors. @@ -44,52 +58,52 @@ Version 1.85 14.Oct.2014 * Fix bug in interaction of --resize and --rotate reported by Michał Ziemba. - -Version 1.84 29.Jun.2014 + +## Version 1.84 - 29.Jun.2014 * Correct optimizer bug that affected GIFs with 65535 or more total colors. Reported by Jernej Simončič. - -Version 1.83 21.Apr.2014 + +## Version 1.83 - 21.Apr.2014 * Correct bug in custom gamma values reported by Kornel Lesiński. * Update Windows build. - -Version 1.82 27.Mar.2014 + +## Version 1.82 - 27.Mar.2014 * Correct bug in `mix` sampling method reported by Bryan Stillwell. - -Version 1.81 24.Mar.2014 + +## Version 1.81 - 24.Mar.2014 * Correct bug in `mix` sampling method reported by Bryan Stillwell. - -Version 1.80 18.Mar.2014 + +## Version 1.80 - 18.Mar.2014 * Bug fixes and improved error messages. - -Version 1.79 17.Mar.2014 + +## Version 1.79 - 17.Mar.2014 * Major improvements in image scaling. Work sponsored by Tumblr via Mike Hurwitz. -** Add new resize sampling methods `mix`, `box`, `catrom`, `mitchell`, - `lanczos2`, and `lanczos3`, selectable by `--resize-method`. The - `catrom` filter often gives good results; the slightly faster `mix` - method (a bilinear interpolator) is now the default. These new - sampling methods consider all of the image's input colors when - shrinking the image, producing better, less noisy output for most - images. + * Add new resize sampling methods `mix`, `box`, `catrom`, `mitchell`, + `lanczos2`, and `lanczos3`, selectable by `--resize-method`. The + `catrom` filter often gives good results; the slightly faster `mix` + method (a bilinear interpolator) is now the default. These new + sampling methods consider all of the image's input colors when + shrinking the image, producing better, less noisy output for most + images. -** Add `--resize-colors`, which allows Gifsicle to enlarge the palette - when resizing images. This is particularly important when shrinking - images with small colormaps---e.g., shrinking a black-and-white - image should probably introduce shades of gray. + * Add `--resize-colors`, which allows Gifsicle to enlarge the palette + when resizing images. This is particularly important when shrinking + images with small colormaps---e.g., shrinking a black-and-white + image should probably introduce shades of gray. * Support extensions such as XMP4 in which extension packet boundaries matter. Reported by `ata4`. @@ -97,14 +111,14 @@ Version 1.79 17.Mar.2014 * Many bug fixes, especially to cropping. Thanks to Tumblr and to Bryan Stillwell, Tal Lev-Ami, "Marco," and others. - -Version 1.78 9.Dec.2013 + +## Version 1.78 - 9.Dec.2013 * Correct an optimization bug introduced in 1.76. Reported by Tom Roostan. - -Version 1.77 26.Nov.2013 + +## Version 1.77 - 26.Nov.2013 * Major improvements to color selection (important when reducing colormap size). Use gamma-corrected colors in selection and @@ -126,14 +140,14 @@ Version 1.77 26.Nov.2013 * gifview: Add `--fallback-delay` option, to specify a fallback delay for frames with delay 0. Thanks to Sung Pae. - -Version 1.76 20.Nov.2013 + +## Version 1.76 - 20.Nov.2013 * Fix `-O2` crashes introduced with `--resize` improvements. Reported by Bryan Stillwell. - -Version 1.75 18.Nov.2013 + +## Version 1.75 - 18.Nov.2013 * Improve `--careful` (fewer crashes). Reported by Bryan Stillwell. @@ -142,30 +156,30 @@ Version 1.75 18.Nov.2013 * Greatly improve `--dither` speed. - -Version 1.74 16.Nov.2013 + +## Version 1.74 - 16.Nov.2013 * Improve `--resize` behavior: avoid animation artifacts due to different rounding decisions. Also speed it up. Reported by Bryan Stillwell. - -Version 1.73 15.Nov.2013 + +## Version 1.73 - 15.Nov.2013 * Fix bug where `-O2` would refuse to optimize some images with local color tables, claiming that "more than 256 colors were required". What was really required is previous disposal. Reported by Bryan Stillwell. - -Version 1.72 9.Nov.2013 + +## Version 1.72 - 9.Nov.2013 * Fix crash bugs on some combinations of `--crop` and `--resize` (prevalent on images whose first frame didn't cover the whole logical screen). Reported by Bryan Stillwell. - -Version 1.71 15.Jun.2013 + +## Version 1.71 - 15.Jun.2013 * Avoid rounding errors in `--resize`. Reported by Paul Kane. @@ -175,19 +189,19 @@ Version 1.71 15.Jun.2013 * Frame selections also apply in batch mode. Reported by LOU Yu Hong Leo. - -Version 1.70 31.Jan.2013 + +## Version 1.70 - 31.Jan.2013 * Fix `--crop` bug introduced in version 1.68, visible in images containing local color tables. Bug reported by Alberto Nannini. - -Version 1.69 31.Jan.2013 + +## Version 1.69 - 31.Jan.2013 * Minor bug fix release. - -Version 1.68 24.Nov.2012 + +## Version 1.68 - 24.Nov.2012 * gifsicle: Alberto Nannini reported some images that are optimized beyond what Gifsicle can do. In fact, Gifsicle's GIF writer was @@ -201,21 +215,21 @@ Version 1.68 24.Nov.2012 these images. The optimizer that produced the images must be doing something pretty clever. (Is it SuperGIF?) - -Version 1.67 5.May.2012 + +## Version 1.67 - 5.May.2012 * gifsicle: Frame specifications like "#2-0" are allowed; they insert frames in reverse order. Feature request from Leon Arnott. * gifview: Add --min-delay option. - -Version 1.66 2.Apr.2012 + +## Version 1.66 - 2.Apr.2012 * gifsicle: Add -Okeep-empty for Gerald Johanson. - -Version 1.65 2.Apr.2012 + +## Version 1.65 - 2.Apr.2012 * gifsicle: Several users (Kornel Lesiński and others) reported "bugs" with Gifsicle-optimized images and Mac programs like Safari. The bug is in @@ -224,26 +238,26 @@ Version 1.65 2.Apr.2012 * Improve -O3 a bit (although for some images, the new -O3 is bigger than the old). - -Version 1.64 22.Nov.2011 + +## Version 1.64 - 22.Nov.2011 * gifsicle: Add --resize-fit options. Tom Glenne request. - -Version 1.63 17.Jul.2011 + +## Version 1.63 - 17.Jul.2011 * gifsicle: Avoid crash on frame selections where frames are repeated. Werner Lemberg report. - -Version 1.62 4.Apr.2011 + +## Version 1.62 - 4.Apr.2011 * gifsicle: -O3 optimization level tries even harder, so that now gifsicle -O3 should never produce larger results than gifsicle-1.60 -O2. Jernej Simončič report. - -Version 1.61 25.Feb.2011 + +## Version 1.61 - 25.Feb.2011 * gifsicle: Add new -O3 optimization level, which applies several transparency heuristics and picks the one with the best result. David @@ -258,172 +272,172 @@ Version 1.61 25.Feb.2011 * gifsicle/gifdiff: Correct occasionally odd error messages. - -Version 1.60 12.Apr.2010 + +## Version 1.60 - 12.Apr.2010 * GIF reading library: Correct error that could corrupt the reading of certain large images. Reported by Jernej Simončič. - -Version 1.59 11.Mar.2010 + +## Version 1.59 - 11.Mar.2010 * gifsicle -O2: Optimize away entirely-transparent frames when possible. Requested by Gerald Johanson. - -Version 1.58 14.Jan.2010 + +## Version 1.58 - 14.Jan.2010 * gifsicle: Fix optimizer bug reported by Dion Mendel. - -Version 1.57 11.Nov.2009 + +## Version 1.57 - 11.Nov.2009 * gifsicle: Don't throw away totally-cropped frames with 0 delay, since most browsers treat 0-delay frames as 100ms-delay frames. Reported by Calle Kabo. - -Version 1.56 18.Oct.2009 + +## Version 1.56 - 18.Oct.2009 * gifsicle: Fix --crop-transparency for animated images; previous versions could lose frames. Problem reported by Daniel v. Dombrowski. * gifview: Make --disposal=background behavior look like Firefox. - -Version 1.55 3.Apr.2009 + +## Version 1.55 - 3.Apr.2009 * gifsicle: Another optimize fix for --disposal previous. Reported by Gerald Johanson. - -Version 1.54 3.Apr.2009 + +## Version 1.54 - 3.Apr.2009 * gifsicle, gifview: Fix several serious bugs with --disposal previous that could affect optimized, unoptimized, and displayed images. Reported by Gerald Johanson. - -Version 1.53 19.Mar.2009 + +## Version 1.53 - 19.Mar.2009 * gifsicle: Frames in an unoptimized image will use disposal "none" when possible. This leads to fewer surprises later. - -Version 1.52 18.May.2008 + +## Version 1.52 - 18.May.2008 * gifsicle: Fix bug introduced in 1.51: --crop-transparent works. Reported by dgdd wanadoo fr. - -Version 1.51 12.May.2008 -* gifsicle: '--crop' preserves the logical screen when it can. Reported by +## Version 1.51 - 12.May.2008 + +* gifsicle: `--crop` preserves the logical screen when it can. Reported by Petio Tonev. - -Version 1.50 7.May.2008 + +## Version 1.50 - 7.May.2008 * gifsicle, gifview: Refuse to read GIFs from the terminal. Requested by Robert Riebisch. - -Version 1.49 2.May.2008 + +## Version 1.49 - 2.May.2008 * Just some Makefile updates requested by Robert Riebisch. - -Version 1.48 16.Mar.2007 -* gifsicle: Avoid crash in '--crop-transparency' when an image's first +## Version 1.48 - 16.Mar.2007 + +* gifsicle: Avoid crash in `--crop-transparency` when an image's first frame is totally transparent. Reported by Gerald Johanson. - -Version 1.47 10.Mar.2007 -* gifsicle: Improve '--nextfile' behavior. +## Version 1.47 - 10.Mar.2007 + +* gifsicle: Improve `--nextfile` behavior. + - -Version 1.46 9.Jan.2007 +## Version 1.46 - 9.Jan.2007 -* gifsicle: Add '--nextfile' option, useful for scripts. Problem reported +* gifsicle: Add `--nextfile` option, useful for scripts. Problem reported by Jason Young. - -Version 1.45 30.Dec.2006 + +## Version 1.45 - 30.Dec.2006 * Do not compile gifview by default when X is not available. -* gifview: Add '--title' option, based on patch supplied by Andres Tello +* gifview: Add `--title` option, based on patch supplied by Andres Tello Abrego. - -Version 1.44 3.Oct.2005 + +## Version 1.44 - 3.Oct.2005 * gifview: Enforce a minimum delay of 0.002 sec. Requested by Dale Wiles. - -Version 1.43 8.Sep.2005 + +## Version 1.43 - 8.Sep.2005 * '-I -b', and other similar combinations, causes a fatal error rather than putting information in an unexpected file. Reported by Michiel de Bondt. - -Version 1.42 8.Jan.2005 + +## Version 1.42 - 8.Jan.2005 * Improve manual page. - -Version 1.41 19.Aug.2004 + +## Version 1.41 - 19.Aug.2004 * Fix problems with 64-bit machines. Thanks to Dan Stahlke for pointing out the problem and providing a patch. - -Version 1.40 28.Aug.2003 -* Fix longstanding bug where '--disposal=previous' was mistakenly - equivalent to '--disposal=asis'. +## Version 1.40 - 28.Aug.2003 + +* Fix longstanding bug where `--disposal=previous` was mistakenly + equivalent to `--disposal=asis`. * Include Makefile.bcc, from Stephen Schnipsel. - -Version 1.39 11.Jul.2003 + +## Version 1.39 - 11.Jul.2003 * Fix Makefile.w32 (oops). - -Version 1.38 26.Jun.2003 + +## Version 1.38 - 26.Jun.2003 * Include Makefile.w32 (oops). - -Version 1.37 11.Feb.2003 -* Fix bug where combining `--rotate-X' and `-O' options would cause a +## Version 1.37 - 11.Feb.2003 + +* Fix bug where combining `--rotate-X` and `-O` options would cause a segmentation fault. Reported by Dan Lasley . * Rearrange source tree. - -Version 1.36 17.Nov.2002 + +## Version 1.36 - 17.Nov.2002 * Fix subscript-out-of-range error in main.c reported by Andrea Suatoni. - -Version 1.35 14.Aug.2002 -* Fixed bug where `--crop' could cause a segmentation fault, present since +## Version 1.35 - 14.Aug.2002 + +* Fixed bug where `--crop` could cause a segmentation fault, present since 1.32 or 1.33. Reported by Tom Schumm . - -Version 1.34 13.Aug.2002 -* Fixed bug where combining `--crop' and `-O' options could corrupt output. +## Version 1.34 - 13.Aug.2002 + +* Fixed bug where combining `--crop` and `-O` options could corrupt output. Reported by Tom Schumm . - -Version 1.33 1.Aug.2002 + +## Version 1.33 - 1.Aug.2002 * Be more careful about time while animating. In particular, prepare frames before they are needed, so that they can be displayed exactly when @@ -431,21 +445,21 @@ Version 1.33 1.Aug.2002 * More warning fixes. - -Version 1.32 5.Jul.2002 -* Add `--multifile' option handling concatenated GIF files. This is useful - for scripts. For example, `gifsicle --multifile -' will merge all GIF +## Version 1.32 - 5.Jul.2002 + +* Add `--multifile` option handling concatenated GIF files. This is useful + for scripts. For example, `gifsicle --multifile -` will merge all GIF files written to its standard input into a single animation. * More fixes for spurious background warnings. - -Version 1.31 17.Jun.2002 -* Changed behavior of `--crop X,Y+WIDTHxHEIGHT' option when WIDTH or HEIGHT +## Version 1.31 - 17.Jun.2002 + +* Changed behavior of `--crop X,Y+WIDTHxHEIGHT` option when WIDTH or HEIGHT is negative. Previously, zero or negative WIDTH and HEIGHT referred to - the image's entire width or height. Thus, the option `--crop 10,0+0x0' + the image's entire width or height. Thus, the option `--crop 10,0+0x0` would always lead to an error, because the crop left position (10) plus the crop width (the image width) was 10 pixels beyond the image edge. The new behavior measures zero or negative WIDTH and HEIGHT relative to the @@ -454,108 +468,108 @@ Version 1.31 17.Jun.2002 * Changed background behavior. Hopefully the only user-visible effect will be fewer spurious warnings. -* Fixed a bug that could corrupt output when optimizing images with `-O2' +* Fixed a bug that could corrupt output when optimizing images with `-O2` that had more than 256 colors. - -Version 1.30 27.Jul.2001 + +## Version 1.30 - 27.Jul.2001 * Fixed bug in ungif code: Writing a large ungif could corrupt memory, leading eventually to bad output. This bug has been present since Gifsicle could write ungifs! Bad files and assistance provided by Jeff Brown . - -Version 1.29 22.May.2001 + +## Version 1.29 - 22.May.2001 * Fixed an optimization bug that could produce bad images. Again, reported by Dale Wiles . It turns out that 1.26 was a bad release! I've reconstructed and run some regression tests; hopefully Dale and I have exhausted the bug stream. - -Version 1.28 13.May.2001 -* `--colors' option still didn't work; it produced bad images. Again, +## Version 1.28 - 13.May.2001 + +* `--colors` option still didn't work; it produced bad images. Again, thanks to Dale Wiles for reporting the bug. -* Added explicit `--conserve-memory' option. +* Added explicit `--conserve-memory` option. + - -Version 1.27 10.May.2001 +## Version 1.27 - 10.May.2001 -* Fixed `--colors' option, which caused segmentation faults. Thanks to Dale +* Fixed `--colors` option, which caused segmentation faults. Thanks to Dale Wiles for reporting the bug. - -Version 1.26 22.Apr.2001 -* Added `--crop-transparency' option, which crops any transparent edges off +## Version 1.26 - 22.Apr.2001 + +* Added `--crop-transparency` option, which crops any transparent edges off the image. Requested by Gre7g Luterman . * Try to conserve memory in gifsicle when working with huge images (> 20 megabytes of uncompressed data). May make gifsicle slower if you actually had enough memory to deal with the uncompressed data. - -Version 1.25 13.Feb.2001 + +## Version 1.25 - 13.Feb.2001 * Fixed gifview bug: If every frame in an animation had a small or zero delay, then gifview would previously enter a infinite loop and become noninteractive. Reported by Franc,ois Petitjean . - -Version 1.24 11.Feb.2001 -* Delete `unoptimized_pixmaps' array when deleting a viewer in gifview. +## Version 1.24 - 11.Feb.2001 + +* Delete `unoptimized_pixmaps` array when deleting a viewer in gifview. Reported by Franc,ois Petitjean . -* Added `--resize-width' and `--resize-height' options. +* Added `--resize-width` and `--resize-height` options. * Why is it that Frenchmen are always telling me to delete the Clp_Parser immediately before calling exit()? Don't they realize that exit() frees application memory just as well as free()? Are things different in France? More French, perhaps? - -Version 1.23 12.Dec.2000 + +## Version 1.23 - 12.Dec.2000 * In Houston on a layover because of stupid Continental Airlines: allow GIFs without terminators. Problem reported by Matt Olech . - -Version 1.22 23.Nov.2000 + +## Version 1.22 - 23.Nov.2000 * Handle time more carefully when displaying animations. Should result in more precise timings. Problem reported by Iris Baye . - -Version 1.21 9.Sep.2000 -* Fixed `--careful -O2', which could create bad GIFs when there were bad +## Version 1.21 - 9.Sep.2000 + +* Fixed `--careful -O2`, which could create bad GIFs when there were bad interactions with transparency. Bug reported by Manfred Schwarb . - -Version 1.20 23.Jun.2000 -* Added `--careful' option, because some bad GIF implementations (Java, +## Version 1.20 - 23.Jun.2000 + +* Added `--careful` option, because some bad GIF implementations (Java, Internet Explorer) don't support Gifsicle's super-optimized, but legal, GIFs. Problem reported by Andrea Beiser . * Gifdiff will work on very large images (better memory usage). - -Version 1.19 25.Apr.2000 -* Fixed memory corruption bug: `gifsicle --use-colormap=FILE.gif' would +## Version 1.19 - 25.Apr.2000 + +* Fixed memory corruption bug: `gifsicle --use-colormap=FILE.gif` would formerly cause a segmentation fault. Bug reported by Alan Watts . - -Version 1.18 3.Apr.2000 + +## Version 1.18 - 3.Apr.2000 * Gifview now uses X server memory more parsimoniously. This should make it more robust, and nicer to the X server, on large animations. Requested by @@ -565,29 +579,29 @@ Version 1.18 3.Apr.2000 * Gifview treats frame selection more sensibly. A frame selection just tells it which frame to start on. -* Added a message to the manual page warning people to quote the `#' +* Added a message to the manual page warning people to quote the `#` character in frame selections. The interactive bash shell, for example, interprets it as a comment. - -Version 1.17 15.Mar.2000 -* Added `--resize _xH' and `--resize Wx_'. Requested by Edwin Piekart +## Version 1.17 - 15.Mar.2000 + +* Added `--resize _xH` and `--resize Wx_`. Requested by Edwin Piekart . -* Changed behavior of `--no-logical-screen'. Now gifsicle will include all +* Changed behavior of `--no-logical-screen`. Now gifsicle will include all visible GIFs when calculating the size of the logical screen. * Got rid of spurious redundant-option warnings. - -Version 1.16.1 10.Sep.1999 + +## Version 1.16.1 - 10.Sep.1999 * Gifview can put a GIF (or an animated GIF) on the root window; use - `gifview -w root'. Requested by Roland Blais . + `gifview -w root`. Requested by Roland Blais . + - -Version 1.16 31.Aug.1999 +## Version 1.16 - 31.Aug.1999 * Optimization improvement: More colormap manipulation. Version 1.16 produces smaller GIFs than 1.15 in the large majority of cases (but not @@ -596,8 +610,8 @@ Version 1.16 31.Aug.1999 * Fixed memory corruption bug in quantization. Found and fixed by Steven Marthouse . - -Version 1.15 20.Aug.1999 + +## Version 1.15 - 20.Aug.1999 * Bug fix: no more assertion failures when combining images that require local colormaps. @@ -611,44 +625,44 @@ Version 1.15 20.Aug.1999 improvements" in 1.14, two bugs introduced! * Bug fix: Exploding the standard input results in files named - `#stdin#.NNN', as the documentation claims, not `.NNN'. + `#stdin#.NNN`, as the documentation claims, not `.NNN`. * Optimization improvement: the optimizer reorders colormaps in a slightly smarter way, which can result in smaller compression. -* If a position option like `-p 0,5' is followed by a multi-frame GIF +* If a position option like `-p 0,5` is followed by a multi-frame GIF (without frame specifications), then the position option places the animation as a whole, not each of its individual frames. * An unrecognized nonnumeric frame specification is now treated as a file - name, so you can say `gifsicle #stdin#.000', for example. + name, so you can say `gifsicle #stdin#.000`, for example. * Gifview improvements: Now even images with local color tables can be "unoptimized" or animated. -* `--replace' now preserves the replaced frame's disposal as well as its +* `--replace` now preserves the replaced frame's disposal as well as its delay. -* `gifsicle -I -' reports "" as the input file name. +* `gifsicle -I -` reports "" as the input file name. + - -Version 1.14.2 16.Aug.1999 +## Version 1.14.2 - 16.Aug.1999 * Fixed memory bug in Gif_DeleteImage (I freed a block of memory, then accessed it). I am a moron!! This bug affected Version 1.14.1 only. - -Version 1.14.1 9.Aug.1999 + +## Version 1.14.1 - 9.Aug.1999 * Fixed configuration bug: you couldn't compile gifsicle from a different directory (it told you to try --enable-ungif). -* Steven Marthouse helped fix `Makefile.w32' to +* Steven Marthouse helped fix `Makefile.w32` to enable wildcards in filenames under Windows. Requested by Mark Olesen . - -Version 1.14 2.Aug.1999 + +## Version 1.14 - 2.Aug.1999 * Switched to an adaptive tree strategy for LZW GIF compression, which is faster than the old hashing strategy. This method is the brainchild of @@ -662,38 +676,38 @@ Version 1.14 2.Aug.1999 * Speed improvements in optimization and colormap quantization. -* Added `--no-warnings' (`-w') option to inhibit warning messages. +* Added `--no-warnings` (`-w`) option to inhibit warning messages. Suggested by Andrea Beiser . -* `--info' output can now be sent to a file with `-o', just as with any +* `--info` output can now be sent to a file with `-o`, just as with any other kind of output. * More specific error messages on invalid GIFs. - -Version 1.13 16.Jun.1999 + +## Version 1.13 - 16.Jun.1999 * Added optional support for run-length-encoded GIFs to avoid patent problems. Run-length encoding idea based on code by Hutchinson Avenue Software Corporation found in Thomas Boutell's gd library . -* `gifsicle --explode' now generates filenames of the form `file.000 .. - file.100' rather than `file.0 .. file.100', so you can use shell globbing - like `file.*' and automatically get the right order. +* `gifsicle --explode` now generates filenames of the form `file.000 .. + file.100` rather than `file.0 .. file.100`, so you can use shell globbing + like `file.*` and automatically get the right order. -* Added `--background' option to gifview, so you can set the color used for +* Added `--background` option to gifview, so you can set the color used for transparent pixels. Suggested by Art Blair . * Gifdiff is built by default on Unix. - -Version 1.12 25.Mar.1999 -* Added `--window' option to gifview, which lets it display a GIF in an +## Version 1.12 - 25.Mar.1999 + +* Added `--window` option to gifview, which lets it display a GIF in an arbitrary X window. Thanks to Larry Smith for patches. -* Added `--install-colormap' to gifview. Suggested by Yair Lenga +* Added `--install-colormap` to gifview. Suggested by Yair Lenga . * Gifsicle now exits with status 1 if there were any errors, status 0 @@ -701,52 +715,52 @@ Version 1.12 25.Mar.1999 or nothing was successfully output. The new behavior seems more useful. Problem reported by David Kelly . - -Version 1.11.2 10.Mar.1999 -* `gifsicle -U' will now unoptimize 1-image GIFs as well as animations. +## Version 1.11.2 - 10.Mar.1999 + +* `gifsicle -U` will now unoptimize 1-image GIFs as well as animations. + - -Version 1.11.1 24.Jan.1999 +## Version 1.11.1 - 24.Jan.1999 * Fixed core dump on corrupted GIF files (in particular, bad extensions). Problem reported by tenthumbs . - -Version 1.11 22.Jan.1999 -* Added `--scale XFACTORxYFACTOR' to complement `--resize'. +## Version 1.11 - 22.Jan.1999 -* Made `--resize' work better on animations (no more off-by-one errors). +* Added `--scale XFACTORxYFACTOR` to complement `--resize`. -* Fixed bug in `--use-colormap': If transparency was added to the new +* Made `--resize` work better on animations (no more off-by-one errors). + +* Fixed bug in `--use-colormap`: If transparency was added to the new colormap, the transparent color index could later be used (incorrectly) as a real image color. This was particularly common if the image was dithered. -* `--dither' now tries to mitigate "jumping dither" animation artifacts +* `--dither` now tries to mitigate "jumping dither" animation artifacts (where adjacent frames in an animation have different dithering patterns, so the animation shifts). It does an OK job. -* Improvements to `--color-method=blend-diversity'. +* Improvements to `--color-method=blend-diversity`. + - -Version 1.10 6.Jan.1999 +## Version 1.10 - 6.Jan.1999 * Gifview is built by default. * No other changes from 1.10b1: Emil said it worked on Windows. - -Version 1.10b1 31.Dec.1998 -* The two malloc packages that come with Gifsicle don't #define `malloc' or - `realloc'; they #define `xmalloc' and `xrealloc'. +## Version 1.10b1 - 31.Dec.1998 + +* The two malloc packages that come with Gifsicle don't #define `malloc` or + `realloc`; they #define `xmalloc` and `xrealloc`. * Changes to Windows port from Emil Mikulic . - -Version 1.9.2 28.Dec.1998 + +## Version 1.9.2 - 28.Dec.1998 * Gifsicle compiles out of the box on Windows! Port maintained by Emil Mikulic . @@ -756,8 +770,8 @@ Version 1.9.2 28.Dec.1998 * Some CLP improvements. - -Version 1.9.1 16.Dec.1998 + +## Version 1.9.1 - 16.Dec.1998 * If a reduced-colormap image needs a special transparent color, gifsicle will now try to keep the same transparent color value as the input GIF. @@ -771,14 +785,14 @@ Version 1.9.1 16.Dec.1998 size 64, say, and get one of size 128 (because gifsicle added a slot for transparency). - -Version 1.9 14.Dec.1998 -* `--no-background' is now the same as `--background=0' (set the background - to pixel 0) instead of `--same-background'. +## Version 1.9 - 14.Dec.1998 + +* `--no-background` is now the same as `--background=0` (set the background + to pixel 0) instead of `--same-background`. + - -Version 1.9b3 10.Dec.1998 +## Version 1.9b3 - 10.Dec.1998 * Fixed a serious bug in merge.c introduced in 1.8: Merging several images with global colormaps could corrupt the output colors. @@ -791,8 +805,8 @@ Version 1.9b3 10.Dec.1998 * Fixed an optimizer bug which could result in incorrect animations: background disposal was not handled correctly. -* The optimizer now generates `--disposal=none' instead of - `--disposal=asis' in certain situations, which can result in smaller +* The optimizer now generates `--disposal=none` instead of + `--disposal=asis` in certain situations, which can result in smaller animations. Suggestion by Markus F.X.J. Oberhumer . @@ -800,20 +814,20 @@ Version 1.9b3 10.Dec.1998 by Patrick J. Naughton , whose code is distributed with XV. - -Version 1.9b2 9.Dec.1998 -* Fixed `--logical-screen' and `--no-logical-screen', which had no effect +## Version 1.9b2 - 9.Dec.1998 + +* Fixed `--logical-screen` and `--no-logical-screen`, which had no effect in 1.9b1. In a stunning turn of events, this problem was reported by Markus F.X.J. Oberhumer . - -Version 1.9b1 5.Dec.1998 -* Added `--resize WxH' option, prompted by code from Christian Kumpf +## Version 1.9b1 - 5.Dec.1998 + +* Added `--resize WxH` option, prompted by code from Christian Kumpf . -* Made `--change-color PIXELINDEX color' work, and `--change-color color +* Made `--change-color PIXELINDEX color` work, and `--change-color color PIXELINDEX' illegal. * Many behavior fixes relating to background and transparency. Gifsicle @@ -827,7 +841,7 @@ Version 1.9b1 5.Dec.1998 * Better error messages are now given on redundant, ambiguous, or useless command-line options. -* Options that affect GIFs on output (such as `--output', `--optimize') now +* Options that affect GIFs on output (such as `--output`, `--optimize`) now behave more like other options: you should put them before the files they affect. (You may still put them at the end of the argument list if they should affect the last output file.) This should only affect people who @@ -835,118 +849,118 @@ Version 1.9b1 5.Dec.1998 * Gifsicle will not write a GIF to stdout if it's connected to a terminal. - -Version 1.8 3.Dec.1998 + +## Version 1.8 - 3.Dec.1998 * Fixed strange behavior when changing transparency: a new black entry was added to the colormap in almost all situations. Problem reported by Markus F.X.J. Oberhumer . -* Fixed `--transform-colormap' bug: commands like "thing 2" (ending in an +* Fixed `--transform-colormap` bug: commands like "thing 2" (ending in an integer) will work now. * Small fixes (in a gifsicle pipeline, error messages won't be interleaved). - -Version 1.7.1 2.Dec.1998 -* Added configuration check for `strerror'. Problem reported by Mario +## Version 1.7.1 - 2.Dec.1998 + +* Added configuration check for `strerror`. Problem reported by Mario Gallotta . -* Added colormap canonicalization: If you pipe a GIF through `gifsicle -O' - or `-O2', the output colormaps will be arranged in a predictable order. +* Added colormap canonicalization: If you pipe a GIF through `gifsicle -O` + or `-O2`, the output colormaps will be arranged in a predictable order. Feature suggested by Markus F.X.J. Oberhumer . - -Version 1.7 28.Nov.1998 -* Added `--use-colormap=gray' and `--use-colormap=bw'. Idea and some code +## Version 1.7 - 28.Nov.1998 + +* Added `--use-colormap=gray` and `--use-colormap=bw`. Idea and some code thanks to Christian Kumpf . -* Added `--transform-colormap', which allows you to plug programs into +* Added `--transform-colormap`, which allows you to plug programs into gifsicle that arbitrarily change GIF files' colormaps. -* All `--change-color' options now happen simultaneously, so you can safely - swap two colors with `--change-color C1 C2 --change-color C2 C1'. +* All `--change-color` options now happen simultaneously, so you can safely + swap two colors with `--change-color C1 C2 --change-color C2 C1`. * Colormap modifications are slightly more powerful (they don't reserve a color for transparency if they don't need one, and if a subset of the modified colormap is used, only that subset is output). -* Fixed `--use-colormap' bug: the last color in a used colormap would be +* Fixed `--use-colormap` bug: the last color in a used colormap would be ignored (it was reserved for transparency). Symptom: if you put a partially transparent image into the Web-safe palette, the result would never contain white. * When changing to a grayscale colormap, gifsicle now uses luminance difference to find the closest color. This gives better results for - `--use-colormap=gray' and the like. + `--use-colormap=gray` and the like. * Added Introduction and Concept Index sections to the gifsicle manpage. * The gifsicle package now uses automake. - -Version 1.6 23.Nov.1998 + +## Version 1.6 - 23.Nov.1998 * A frame extracted from the middle of an animation will now have the animation's screen size rather than 640x480. Problem reported by Mr. Moose . - -Version 1.5 27.Sep.1998 -* `--help' now prints on stdout, as according to the GNU standards. +## Version 1.5 - 27.Sep.1998 + +* `--help` now prints on stdout, as according to the GNU standards. * Changes to support Win32 port thanks to Emil Mikulic . -* Makefiles: Added `make uninstall' target, enabled `./configure's +* Makefiles: Added `make uninstall` target, enabled `./configure`'s program name transformations, made VPATH builds possible. - -Version 1.4.1 16.Sep.1998 -* Fixed `--unoptimize' bug: a frame's transparency could disappear under rare +## Version 1.4.1 - 16.Sep.1998 + +* Fixed `--unoptimize` bug: a frame's transparency could disappear under rare circumstances. Bug reported by Rodney Brown - -Version 1.4 12.Sep.1998 -* Added `--extension' and `--app-extension'. +## Version 1.4 - 12.Sep.1998 - -Version 1.3.4 7.Sep.1998 +* Added `--extension` and `--app-extension`. + + +## Version 1.3.4 - 7.Sep.1998 * More configuration changes. -* Fixed bug in gifview `--geometry' option processing: `--geometry -0-0' +* Fixed bug in gifview `--geometry` option processing: `--geometry -0-0` wasn't recognized. - -Version 1.3.2 5.Sep.1998 + +## Version 1.3.2 - 5.Sep.1998 * Fixed configuration bugs reported by Alexander Mai (OS/2 build didn't work). - -Version 1.3.1 4.Sep.1998 + +## Version 1.3.1 - 4.Sep.1998 * Fixed configuration bug: int32_t could be improperly redefined. Reported by Anne "Idiot" Dudfield and Dax Kelson . - -Version 1.3 3.Sep.1998 -* Added `--flip-*' and `--rotate-*' options. +## Version 1.3 - 3.Sep.1998 + +* Added `--flip-*` and `--rotate-*` options. * Fixed rare bug in GIF writing code: the last pixel in a frame could previously become corrupted. - -Version 1.3b1 2.Aug.1998 + +## Version 1.3b1 - 2.Aug.1998 * Optimization has been completely overhauled. All optimization functions are in a separate file, optimize.c. Some bugs have been caught. @@ -968,38 +982,38 @@ Version 1.3b1 2.Aug.1998 - Bug fix: Images relying on background disposal are optimized correctly. - - `-O2' never does worse than `-O1'. + - `-O2` never does worse than `-O1`. - - Made the `-O2' heuristic better. Some other small changes and + - Made the `-O2` heuristic better. Some other small changes and improvements here and there. - The optimizer has been pretty extensively tested using gifdiff. * New program: gifdiff compares two GIFs for identical appearance. It is - not built unless you give the `--enable-gifdiff' option to `./configure'. + not built unless you give the `--enable-gifdiff` option to `./configure`. It's probably not useful unless you're testing a GIF optimizer. * Robustness fixes in GIF library. - -Version 1.2.1 8.Jun.1998 -* `--info' now sends information to standard output. `--info --info' still +## Version 1.2.1 - 8.Jun.1998 + +* `--info` now sends information to standard output. `--info --info` still sends information to standard error. -* `--transparent' didn't work. It does now. +* `--transparent` didn't work. It does now. -* Added `--background' option. Fixed background processing so that an input +* Added `--background` option. Fixed background processing so that an input background is reflected in the output GIF. * Re-fixed small bug with the interaction between per-frame options and frame selections. - -Version 1.2 28.May.1998 -* Fixed small bug with the interaction between per-frame options (`--name', - `--comment') and frame selections. +## Version 1.2 - 28.May.1998 + +* Fixed small bug with the interaction between per-frame options (`--name`, + `--comment`) and frame selections. * Fixed bad bug in merge: If a global colormap from the source needed to be dumped into a local colormap in the destination, the pixel map was wrong, @@ -1013,76 +1027,76 @@ Version 1.2 28.May.1998 * Fixed bugs in gifread.c that corrupted memory when uncompressing some bad images. -* Added debugging malloc library (`./configure --enable-dmalloc' to use it). +* Added debugging malloc library (`./configure --enable-dmalloc` to use it). -* Added `--no-delay' and `--no-disposal' options, which should have been there +* Added `--no-delay` and `--no-disposal` options, which should have been there all along. -* `--crop' will not generate an image with 0 width or height, even if a +* `--crop` will not generate an image with 0 width or height, even if a frame is cropped out of existence. * Other performance improvements. - -Version 1.2b6 25.May.1998 + +## Version 1.2b6 - 25.May.1998 * License clarification in README. -* GIF comments are now printed out more carefully in `--info': binary +* GIF comments are now printed out more carefully in `--info`: binary characters appear as backslash escapes. (Literal backslashes are printed - as `\\'.) + as `\\`.) -* New `--extension-info/--xinfo' option. +* New `--extension-info/--xinfo` option. -* Removed spurious warning about local colormaps when a `--colors' option +* Removed spurious warning about local colormaps when a `--colors` option is in effect. * Replacing a named frame with another image now keeps the name by default. -* Many changes to gifview. Added `--animate', `--display', `--geometry', - `--name', `--help' options, keystrokes, multiple GIFs on the command +* Many changes to gifview. Added `--animate`, `--display`, `--geometry`, + `--name`, `--help` options, keystrokes, multiple GIFs on the command line, and a manual page. - -Version 1.2b5 12.May.1998 + +## Version 1.2b5 - 12.May.1998 * Longstanding bug fix in gifunopt.c: an interlaced replacement frame caused strange behavior when later optimizing, as the underlying data wasn't deinterlaced. -* Further improvements in optimizer; specifically, `-O2' works better now +* Further improvements in optimizer; specifically, `-O2` works better now -- it uses actual image data to look for an unused pixel value when there's no transparency specified. - -Version 1.2b4 12.May.1998 -* Improved `--optimize's performance on images where successive frames had +## Version 1.2b4 - 12.May.1998 + +* Improved `--optimize`'s performance on images where successive frames had different transparent color indexes. - -Version 1.2b3 11.May.1998 -* Fixed bugs in `--unoptimize': it would try to unoptimize images with +## Version 1.2b3 - 11.May.1998 + +* Fixed bugs in `--unoptimize`: it would try to unoptimize images with local color tables and some transparency manipulations could cause a silent failure (example: 2 colors; frame 0 = [*11], frame 1 = [*0*], where * is a transparent pixel. Unoptimized, frame 1 should contain [*01] -- but this can't be expressed with only 2 colors.) -* Greatly improved `--optimize's performance on some images by changing the - way frames were switched to `--disposal=background'. Problem noticed by +* Greatly improved `--optimize`'s performance on some images by changing the + way frames were switched to `--disposal=background`. Problem noticed by David Hedbor * Documentation improvements. * Unrecognized extensions are now passed through without change. The - `--no-extensions' option (currently undocumented) removes all + `--no-extensions` option (currently undocumented) removes all unrecognized extensions. * Bug fix in gifview: frame selections now prevent display of entire GIF. - -Version 1.2b2 9.May.1998 + +## Version 1.2b2 - 9.May.1998 * Fixed bad dumb bug in gif.h: lack of parens around macro argument @@ -1091,55 +1105,54 @@ Version 1.2b2 9.May.1998 * Some optimizations to Floyd-Steinberg code - -Version 1.2b1 8.May.1998 -* Added colormap options: `--colors', `--color-method', `--dither', and - `--use-colormap'. All this code is in quantize.c. +## Version 1.2b1 - 8.May.1998 + +* Added colormap options: `--colors`, `--color-method`, `--dither`, and + `--use-colormap`. All this code is in quantize.c. + +* Renamed `--color-change` to `--change-color`. + -* Renamed `--color-change' to `--change-color'. +## Version 1.1.2 - -Version 1.1.2 +* Added `--color-change` option. -* Added `--color-change' option. +* Added negative frame numbers. `#-N` no longer means `#0-N`; it means the + `N`th frame from the end (where `#-1` is the last frame). You can use + negative frame numbers in ranges as well (e.g., `#-5--1`). -* Added negative frame numbers. `#-N' no longer means `#0-N'; it means the - `N'th frame from the end (where `#-1' is the last frame). You can use - negative frame numbers in ranges as well (e.g., `#-5--1'). - -Version 1.1.1 22.Nov.1997 +## Version 1.1.1 - 22.Nov.1997 -* Fixed bug in CLP which segmentation-faulted on `-' arguments. +* Fixed bug in CLP which segmentation-faulted on `-` arguments. - -Version 1.1 20.Nov.1997 -* Added `--crop' option. +## Version 1.1 - 20.Nov.1997 + +* Added `--crop` option. * Changed usage behavior on bad command lines. - -Version 1.0 21.Jun.1997 -* Added `--output/-o' option to specify output filename. +## Version 1.0 - 21.Jun.1997 + +* Added `--output/-o` option to specify output filename. * Slight behavior change: Now, if you replace a frame (say frame #2), its delay value will be preserved in the replacement frame, unless you give an explicit delay. (Before, the replacement frame's delay would be used, which was probably 0.) - -Version 0.91 15.Jun.1997 -* Bug fix: `--optimize' didn't handle the bottom row of an image's changed +## Version 0.91 - 15.Jun.1997 + +* Bug fix: `--optimize` didn't handle the bottom row of an image's changed area correctly. This could lead to incorrect animations. Specific change: merge.c line 744: was y < fbt, now y <= fbt. -* Added `-S' as synonym for `--logical-screen'. +* Added `-S` as synonym for `--logical-screen`. - -Version 0.9 12.Jun.1997 +## Version 0.9 - 12.Jun.1997 * First public release. diff --git a/README.md b/README.md index 1bafaf4..3e12d36 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ The Gifsicle package comes with NO WARRANTY, express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. -See `NEWS` in this directory for changes in recent versions. The Gifsicle home -page is: +See `NEWS.md` in this directory for changes in recent versions. The Gifsicle +home page is: http://www.lcdf.org/gifsicle/ @@ -85,32 +85,10 @@ Eddie Kohler, ekohler@gmail.com http://www.read.seas.harvard.edu/~kohler/ -The GIF Patents and UnGIFs --------------------------- - -Patents formerly restricted use of the Lempel-Ziv-Welch compression -algorithm used in GIFs. As of October 1, 2006, it is believed (by the -Software Freedom Law Center and the Free Software Foundation, among -others) that there are no significant patent claims interfering with -employment of the GIF format. For that reason, Gifsicle is completely -free software. - -Nonetheless, Gifsicle can be configured to write run-length-encoded -GIFs, rather than LZW-compressed GIFs, avoiding these obsolete -patents. This idea was first implemented independently by Toshio -Kuratomi and Hutchison Avenue Software -Corporation (http://www.hasc.com/, ). Turn this on by -giving `./configure` the `--enable-ungif` switch. Now that the patents -have expired there is no good reason to turn on this switch, which can -make GIFs a factor of 2 larger or more. If your copy of Gifsicle says -`(ungif)` when you run `gifsicle --version`, it is writing -run-length-encoded GIFs. - - Copyright/License ----------------- -© 1997-2014 Eddie Kohler and contributors +© 1997-2018 Eddie Kohler and contributors IF YOU PLAN TO USE GIFSICLE ONLY TO CREATE OR MODIFY GIF IMAGES, DON'T WORRY ABOUT THE REST OF THIS SECTION. Anyone can use Gifsicle however diff --git a/configure.ac b/configure.ac index ca0f6a4..1e198ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([gifsicle], [1.88]) +AC_INIT([gifsicle], [1.91]) AC_CONFIG_SRCDIR([src/gifsicle.h]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE @@ -205,7 +205,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( a[0] = a[1] = a[2] = a[3] = (float) rand(); a = __builtin_shufflevector(a, a, 3, 2, 1, 0); printf("%f\n", a[0]);]])], - [AC_DEFINE([HAVE___BUILTIN_SHUFFLEVECTOR], 1, [Define to 1 if you have the `__builtin_shufflevector' function.])]) + [AC_DEFINE([HAVE___BUILTIN_SHUFFLEVECTOR], 1, [Define to 1 if you have the `__builtin_shufflevector' function.]) + ac_cv___builtin_shufflevector=yes], [ac_cv___builtin_shufflevector=no]) +AC_MSG_RESULT([$ac_cv___builtin_shufflevector]) AC_ARG_ENABLE([simd], [AS_HELP_STRING([--disable-simd], [do not use SIMD instructions])], diff --git a/gifdiff.1 b/gifdiff.1 index 894613d..59864db 100644 --- a/gifdiff.1 +++ b/gifdiff.1 @@ -1,5 +1,5 @@ .\" -*- mode: nroff -*- -.ds V 1.88 +.ds V 1.91 .ds E " \-\- .if t .ds E \(em .de Op @@ -19,7 +19,7 @@ .RE .PP .. -.TH GIFDIFF 1 "31 August 1998" "Version \*V" +.TH GIFDIFF 1 "11 July 2017" "Version \*V" .SH NAME gifdiff \- compares GIF images .SH SYNOPSIS diff --git a/gifsicle.1 b/gifsicle.1 index 7f67726..c6ba169 100644 --- a/gifsicle.1 +++ b/gifsicle.1 @@ -1,5 +1,5 @@ .\" -*- mode: nroff -*- -.ds V 1.88 +.ds V 1.91 .ds E " \-\- .if t .ds E \(em .de Op @@ -43,7 +43,7 @@ .fi .RE .. -.TH GIFSICLE 1 "5 May 2012" "Version \*V" +.TH GIFSICLE 1 "11 July 2017" "Version \*V" .SH NAME gifsicle \- manipulates GIF images and animations .SH SYNOPSIS diff --git a/gifsicle.spec b/gifsicle.spec deleted file mode 100644 index 02f283d..0000000 --- a/gifsicle.spec +++ /dev/null @@ -1,59 +0,0 @@ -Summary: GIF image and animation manipulator - -Name: gifsicle -Version: 1.88 -Release: 1 -Source: http://www.lcdf.org/gifsicle/gifsicle-1.88.tar.gz - -Icon: logo1.gif -URL: http://www.lcdf.org/gifsicle/ - -Group: Applications/Graphics -Vendor: Little Cambridgeport Design Factory -Packager: Eddie Kohler -License: GPL - -BuildRoot: /tmp/gifsicle-build - -%description -Gifsicle manipulates GIF image files on the -command line. It supports merging several GIFs -into a GIF animation; exploding an animation into -its component frames; changing individual frames -in an animation; turning interlacing on and off; -adding transparency; adding delays, disposals, and -looping to animations; adding or removing -comments; optimizing animations for space; and -changing images' colormaps, among other things. - -The gifsicle package contains two other programs: -gifview, a lightweight GIF viewer for X, can show -animations as slideshows or in real time, and -gifdiff compares two GIFs for identical visual -appearance. - -%prep -%setup - -%build -%configure -make - -%install -[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install - -%clean -[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT - -%post - -%files -%attr(-,root,root) %doc NEWS README -%attr(0755,root,root) %{_bindir}/gifsicle -%attr(0755,root,root) %{_bindir}/gifdiff -%attr(0755,root,root) %{_bindir}/gifview -%attr(0644,root,root) %{_mandir}/man1/gifsicle.1* -%attr(0644,root,root) %{_mandir}/man1/gifdiff.1* -%attr(0644,root,root) %{_mandir}/man1/gifview.1* diff --git a/gifview.1 b/gifview.1 index 5af0b23..bc5ca1b 100644 --- a/gifview.1 +++ b/gifview.1 @@ -1,5 +1,5 @@ .\" -*- mode: nroff -*- -.ds V 1.88 +.ds V 1.91 .ds E " \-\- .if t .ds E \(em .de Op @@ -25,7 +25,7 @@ .RE .PP .. -.TH GIFVIEW 1 "5 May 2012" "Version \*V" +.TH GIFVIEW 1 "11 July 2017" "Version \*V" .SH NAME gifview \- displays GIF images and animations on the X window system .SH SYNOPSIS diff --git a/include/lcdf/clp.h b/include/lcdf/clp.h index 37b7519..5aceb8a 100644 --- a/include/lcdf/clp.h +++ b/include/lcdf/clp.h @@ -8,7 +8,7 @@ extern "C" { /* clp.h - Public interface to CLP. * This file is part of CLP, the command line parser package. * - * Copyright (c) 1997-2014 Eddie Kohler, ekohler@gmail.com + * Copyright (c) 1997-2017 Eddie Kohler, ekohler@gmail.com * * CLP is free software. It is distributed under the GNU General Public * License, Version 2, or, alternatively and at your discretion, under the diff --git a/include/lcdfgif/gif.h b/include/lcdfgif/gif.h index 4f8561b..24930f1 100644 --- a/include/lcdfgif/gif.h +++ b/include/lcdfgif/gif.h @@ -1,5 +1,5 @@ /* gif.h - Interface to the LCDF GIF library. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2017 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The GIF library is free software. It is distributed under the GNU General @@ -54,8 +54,8 @@ struct Gif_Stream { Gif_Extension* end_extension_list; unsigned errors; + uint32_t user_flags; - int userflags; const char* landmark; int refcount; }; @@ -82,34 +82,33 @@ int Gif_FullUnoptimize(Gif_Stream *, int flags); /** GIF_IMAGE **/ struct Gif_Image { - uint16_t width; - uint16_t height; - uint8_t **img; /* img[y][x] == image byte (x,y) */ uint8_t *image_data; + uint16_t width; + uint16_t height; uint16_t left; uint16_t top; uint16_t delay; uint8_t disposal; uint8_t interlace; - Gif_Colormap *local; short transparent; /* -1 means no transparent index */ + Gif_Colormap *local; - uint16_t user_flags; - - char *identifier; + char* identifier; Gif_Comment* comment; Gif_Extension* extension_list; void (*free_image_data)(void *); uint32_t compressed_len; - uint8_t *compressed; + uint32_t compressed_errors; + uint8_t* compressed; void (*free_compressed)(void *); - void *user_data; + uint32_t user_flags; + void* user_data; void (*free_user_data)(void *); int refcount; @@ -181,7 +180,7 @@ typedef struct { struct Gif_Colormap { int ncol; int capacity; - uint32_t userflags; + uint32_t user_flags; int refcount; Gif_Color *col; }; diff --git a/include/lcdfgif/gifx.h b/include/lcdfgif/gifx.h index bd46f0e..a2c9771 100644 --- a/include/lcdfgif/gifx.h +++ b/include/lcdfgif/gifx.h @@ -6,7 +6,7 @@ extern "C" { #endif /* gifx.h - Functions to turn GIFs in memory into X Pixmaps. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2017 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software*. It is distributed under the GNU diff --git a/src/clp.c b/src/clp.c index d0eb4a4..e3db72c 100644 --- a/src/clp.c +++ b/src/clp.c @@ -2,7 +2,7 @@ /* clp.c - Complete source code for CLP. * This file is part of CLP, the command line parser package. * - * Copyright (c) 1997-2014 Eddie Kohler, ekohler@gmail.com + * Copyright (c) 1997-2018 Eddie Kohler, ekohler@gmail.com * * CLP is free software. It is distributed under the GNU General Public * License, Version 2, or, alternatively and at your discretion, under the diff --git a/src/gifdiff.c b/src/gifdiff.c index 317c5df..ade1e1e 100644 --- a/src/gifdiff.c +++ b/src/gifdiff.c @@ -1,5 +1,5 @@ /* gifdiff.c - Gifdiff compares GIF images for identical appearance. - Copyright (C) 1998-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1998-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifdiff, in the gifsicle package. Gifdiff is free software. It is distributed under the GNU Public License, @@ -248,12 +248,6 @@ compare(Gif_Stream *s1, Gif_Stream *s2) Gif_CalculateScreenSize(s1, 0); Gif_CalculateScreenSize(s2, 0); - if (s1->nimages != s2->nimages - && (s1->nimages == 0 || s2->nimages == 0)) { - different("frame counts differ: <#%d >#%d", s1->nimages, s2->nimages); - return DIFFERENT; - } - if (s1->screen_width != s2->screen_width || s1->screen_height != s2->screen_height) { different("screen sizes differ: <%dx%d >%dx%d", s1->screen_width, @@ -268,6 +262,14 @@ compare(Gif_Stream *s1, Gif_Stream *s2) return DIFFERENT; } + if (s1->nimages == 0 || s2->nimages == 0) { + if (s1->nimages != s2->nimages) { + different("frame counts differ: <#%d >#%d", s1->nimages, s2->nimages); + return DIFFERENT; + } else + return SAME; + } + /* Create arrays for the image data */ screen_width = s1->screen_width; screen_height = s1->screen_height; @@ -558,7 +560,7 @@ main(int argc, char *argv[]) case VERSION_OPT: printf("gifdiff (LCDF Gifsicle) %s\n", VERSION); - printf("Copyright (C) 1998-2014 Eddie Kohler\n\ + printf("Copyright (C) 1998-2018 Eddie Kohler\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty, not even for merchantability or fitness for a\n\ particular purpose.\n"); diff --git a/src/giffunc.c b/src/giffunc.c index 50578f3..83759f8 100644 --- a/src/giffunc.c +++ b/src/giffunc.c @@ -1,5 +1,5 @@ /* giffunc.c - General functions for the GIF library. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software. It is distributed under the GNU @@ -33,7 +33,7 @@ Gif_NewStream(void) gfs->end_comment = 0; gfs->end_extension_list = 0; gfs->errors = 0; - gfs->userflags = 0; + gfs->user_flags = 0; gfs->refcount = 0; gfs->landmark = 0; return gfs; @@ -61,6 +61,7 @@ Gif_NewImage(void) gfi->extension_list = 0; gfi->free_image_data = Gif_Free; gfi->compressed_len = 0; + gfi->compressed_errors = 0; gfi->compressed = 0; gfi->free_compressed = 0; gfi->user_data = 0; @@ -80,7 +81,7 @@ Gif_NewColormap(void) gfcm->capacity = 0; gfcm->col = 0; gfcm->refcount = 0; - gfcm->userflags = 0; + gfcm->user_flags = 0; return gfcm; } @@ -99,7 +100,7 @@ Gif_NewFullColormap(int count, int capacity) gfcm->capacity = capacity; gfcm->col = Gif_NewArray(Gif_Color, capacity); gfcm->refcount = 0; - gfcm->userflags = 0; + gfcm->user_flags = 0; if (!gfcm->col) { Gif_Delete(gfcm); return 0; @@ -225,7 +226,7 @@ Gif_RemoveImage(Gif_Stream *gfs, int inum) int Gif_ImageColorBound(const Gif_Image* gfi) { - if (gfi->compressed) + if (gfi->compressed && gfi->compressed[0] > 0 && gfi->compressed[0] < 8) return 1 << gfi->compressed[0]; else return 256; @@ -457,6 +458,7 @@ Gif_CopyImage(Gif_Image *src) memcpy(dest->compressed, src->compressed, src->compressed_len); } dest->compressed_len = src->compressed_len; + dest->compressed_errors = src->compressed_errors; } return dest; @@ -703,6 +705,7 @@ Gif_ReleaseCompressedImage(Gif_Image *gfi) (*gfi->free_compressed)(gfi->compressed); gfi->compressed = 0; gfi->compressed_len = 0; + gfi->compressed_errors = 0; gfi->free_compressed = 0; } diff --git a/src/gifread.c b/src/gifread.c index d2021ee..38172f3 100644 --- a/src/gifread.c +++ b/src/gifread.c @@ -1,5 +1,5 @@ /* gifread.c - Functions to read GIFs. - Copyright (C) 1997-2015 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software. It is distributed under the GNU @@ -373,6 +373,7 @@ read_image_data(Gif_Context *gfc, Gif_Reader *grr) sprintf(buf, "missing %ld %s of image data", delta, delta == 1 ? "pixel" : "pixels"); gif_read_error(gfc, 1, buf); + memset(&gfc->image[gfc->decodepos], 0, delta); } else if (delta < -1) { /* One pixel of superfluous data is OK; that could be the code == next_code case. */ @@ -448,6 +449,7 @@ read_compressed_image(Gif_Image *gfi, Gif_Reader *grr, int read_flags) grr->pos = grr->length; gfi->compressed_len = grr->pos - image_pos; + gfi->compressed_errors = 0; if (read_flags & GIF_READ_CONST_RECORD) { gfi->compressed = (uint8_t*) &grr->v[image_pos]; gfi->free_compressed = 0; @@ -487,8 +489,9 @@ read_compressed_image(Gif_Image *gfi, Gif_Reader *grr, int read_flags) } comp[comp_len++] = 0; - gfi->compressed = comp; gfi->compressed_len = comp_len; + gfi->compressed_errors = 0; + gfi->compressed = comp; gfi->free_compressed = Gif_Free; } @@ -499,13 +502,16 @@ read_compressed_image(Gif_Image *gfi, Gif_Reader *grr, int read_flags) static int uncompress_image(Gif_Context *gfc, Gif_Image *gfi, Gif_Reader *grr) { + int old_nerrors; if (!Gif_CreateUncompressedImage(gfi, gfi->interlace)) return 0; gfc->width = gfi->width; gfc->height = gfi->height; gfc->image = gfi->image_data; gfc->maximage = gfi->image_data + (unsigned) gfi->width * (unsigned) gfi->height; + old_nerrors = gfc->errors[1]; read_image_data(gfc, grr); + gfi->compressed_errors = gfc->errors[1] - old_nerrors; return 1; } @@ -821,6 +827,7 @@ read_gif(Gif_Reader *grr, int read_flags, goto done; else if (!read_image(grr, &gfc, gfi, read_flags)) { Gif_RemoveImage(gfs, gfs->nimages - 1); + gfi = 0; goto done; } @@ -893,6 +900,7 @@ read_gif(Gif_Reader *grr, int read_flags, Gif_DeleteArray(gfc.suffix); Gif_DeleteArray(gfc.length); gfc.gfi = 0; + last_name = 0; if (gfs) gfs->errors = gfc.errors[1]; diff --git a/src/gifsicle.c b/src/gifsicle.c index 317071a..a5c8954 100644 --- a/src/gifsicle.c +++ b/src/gifsicle.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* gifsicle.c - gifsicle's main loop. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -1064,13 +1064,13 @@ output_information(const char *outfile) } for (i = 0; i < frames->count; i++) - FRAME(frames, i).stream->userflags = 97; + FRAME(frames, i).stream->user_flags = 97; for (i = 0; i < frames->count; i++) - if (FRAME(frames, i).stream->userflags == 97) { + if (FRAME(frames, i).stream->user_flags == 97) { fr = &FRAME(frames, i); gfs = fr->stream; - gfs->userflags = 0; + gfs->user_flags = 0; stream_info(f, gfs, fr->input_filename, fr->info_flags); for (j = i; j < frames->count; j++) if (FRAME(frames, j).stream == gfs) { @@ -2125,7 +2125,7 @@ main(int argc, char *argv[]) #else printf("LCDF Gifsicle %s\n", VERSION); #endif - printf("Copyright (C) 1997-2014 Eddie Kohler and Kornel Lesinski\n\ + printf("Copyright (C) 1997-2018 Eddie Kohler and Kornel Lesinski\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty, not even for merchantability or fitness for a\n\ particular purpose.\n"); diff --git a/src/gifsicle.h b/src/gifsicle.h index ecb573f..97d9975 100644 --- a/src/gifsicle.h +++ b/src/gifsicle.h @@ -1,5 +1,5 @@ /* gifsicle.h - Function declarations for gifsicle. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2017 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, diff --git a/src/gifunopt.c b/src/gifunopt.c index 2cbdf7e..ae57fb8 100644 --- a/src/gifunopt.c +++ b/src/gifunopt.c @@ -1,5 +1,5 @@ /* gifunopt.c - Unoptimization function for the GIF library. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software. It is distributed under the GNU diff --git a/src/gifview.c b/src/gifview.c index e125c50..b054801 100644 --- a/src/gifview.c +++ b/src/gifview.c @@ -1,5 +1,5 @@ /* gifview.c - gifview's main loop. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifview, in the gifsicle package. Gifview is free software. It is distributed under the GNU Public License, @@ -1356,7 +1356,7 @@ main(int argc, char *argv[]) case VERSION_OPT: printf("gifview (LCDF Gifsicle) %s\n", VERSION); - printf("Copyright (C) 1997-2014 Eddie Kohler\n\ + printf("Copyright (C) 1997-2018 Eddie Kohler\n\ This is free software; see the source for copying conditions.\n\ There is NO warranty, not even for merchantability or fitness for a\n\ particular purpose.\n"); diff --git a/src/gifwrite.c b/src/gifwrite.c index 6f8f4ab..9bcfcd6 100644 --- a/src/gifwrite.c +++ b/src/gifwrite.c @@ -1,6 +1,6 @@ /* -*- mode: c; c-basic-offset: 2 -*- */ /* gifwrite.c - Functions to write GIFs. - Copyright (C) 1997-2015 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software. It is distributed under the GNU @@ -736,8 +736,9 @@ save_compression_result(Gif_Image *gfi, Gif_Writer *grr, int ok) if (gfi->compressed) (*gfi->free_compressed)((void *) gfi->compressed); if (ok) { - gfi->compressed = grr->v; gfi->compressed_len = grr->pos; + gfi->compressed_errors = 0; + gfi->compressed = grr->v; gfi->free_compressed = Gif_Free; grr->v = 0; grr->cap = 0; diff --git a/src/gifx.c b/src/gifx.c index fb192dd..83e3a57 100644 --- a/src/gifx.c +++ b/src/gifx.c @@ -1,5 +1,5 @@ /* gifx.c - Functions to turn GIFs in memory into X Pixmaps. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software. It is distributed under the GNU diff --git a/src/kcolor.h b/src/kcolor.h index 57e61b2..2955d2d 100644 --- a/src/kcolor.h +++ b/src/kcolor.h @@ -1,5 +1,5 @@ /* kcolor.h - Color-oriented function declarations for gifsicle. - Copyright (C) 2013-2015 Eddie Kohler, ekohler@gmail.com + Copyright (C) 2013-2017 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -107,8 +107,11 @@ static inline Gif_Color kc_togfcg(const kcolor* x) { /* return the squared Euclidean distance between `*x` and `*y` */ static inline uint32_t kc_distance(const kcolor* x, const kcolor* y) { - int32_t d0 = x->a[0] - y->a[0], d1 = x->a[1] - y->a[1], - d2 = x->a[2] - y->a[2]; + /* It’s OK to use unsigned multiplication for this: the low 32 bits + are the same either way. Unsigned avoids undefined behavior. */ + uint32_t d0 = x->a[0] - y->a[0]; + uint32_t d1 = x->a[1] - y->a[1]; + uint32_t d2 = x->a[2] - y->a[2]; return d0 * d0 + d1 * d1 + d2 * d2; } @@ -120,7 +123,6 @@ static inline int kc_luminance(const kcolor* x) { /* set `*x` to the grayscale version of `*x`, transformed by luminance */ static inline void kc_luminance_transform(kcolor* x) { /* For grayscale colormaps, use distance in luminance space instead of - distance in RGB space. The weights for the R,G,B components in luminance space are 0.2126,0.7152,0.0722. (That's ITU primaries, which are compatible with sRGB; NTSC recommended our previous values, diff --git a/src/merge.c b/src/merge.c index 47486b7..f86acd3 100644 --- a/src/merge.c +++ b/src/merge.c @@ -1,5 +1,5 @@ /* merge.c - Functions which actually combine and manipulate GIF image data. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -115,7 +115,7 @@ merge_colormap_if_possible(Gif_Colormap *dest, Gif_Colormap *src) Gif_Color *srccol; Gif_Color *destcol = dest->col; int ndestcol = dest->ncol; - int dest_userflags = dest->userflags; + int dest_user_flags = dest->user_flags; int i, x; int trivial_map = 1; @@ -174,7 +174,7 @@ merge_colormap_if_possible(Gif_Colormap *dest, Gif_Colormap *src) /* success! save new number of colors */ dest->ncol = ndestcol; - dest->userflags = dest_userflags; + dest->user_flags = dest_user_flags; return 1; /* failure: a local colormap is required */ @@ -358,7 +358,8 @@ merge_image(Gif_Stream *dest, Gif_Stream *src, Gif_Image *srci, desti->height = srci->height; desti->local = localcm; - if (trivial_map && same_compressed_ok && srci->compressed) { + if (trivial_map && same_compressed_ok && srci->compressed + && !srci->compressed_errors) { desti->compressed_len = srci->compressed_len; desti->compressed = Gif_NewArray(uint8_t, srci->compressed_len); desti->free_compressed = Gif_Free; diff --git a/src/optimize.c b/src/optimize.c index fec92c4..1907a09 100644 --- a/src/optimize.c +++ b/src/optimize.c @@ -1,5 +1,5 @@ /* optimize.c - Functions to optimize animated GIFs. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, diff --git a/src/opttemplate.c b/src/opttemplate.c index 1f96c41..adb2e69 100644 --- a/src/opttemplate.c +++ b/src/opttemplate.c @@ -1,5 +1,5 @@ /* opttemplate.c - Functions to optimize animated GIFs. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -146,8 +146,9 @@ X(apply_frame)(palindex_type *dst, Gif_Stream* gfs, Gif_Image* gfi, for (i = 0; i < colormap->ncol; i++) map[i] = colormap->col[i].pixel; /* out-of-bounds colors map to 0, for the sake of argument */ + y = colormap->ncol ? colormap->col[0].pixel : 0; for (i = colormap->ncol; i < 256; i++) - map[i] = colormap->col[0].pixel; + map[i] = y; if (gfi->transparent >= 0 && gfi->transparent < 256) map[gfi->transparent] = TRANSP; else @@ -856,7 +857,7 @@ X(transp_frame_data)(Gif_Stream *gfs, Gif_Image *gfi, uint8_t *map, static void X(create_new_image_data)(Gif_Stream *gfs, int optimize_flags) { - Gif_Image cur_unopt_gfi; /* placehoder; maintains pre-optimization + Gif_Image cur_unopt_gfi; /* placeholder; maintains pre-optimization image size so we can apply background disposal */ unsigned screen_size = (unsigned) screen_width * (unsigned) screen_height; diff --git a/src/quantize.c b/src/quantize.c index 524a4c4..ad5d73f 100644 --- a/src/quantize.c +++ b/src/quantize.c @@ -1,5 +1,5 @@ /* quantize.c - Histograms and quantization for gifsicle. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -1001,7 +1001,7 @@ int kd3_closest_transformed(kd3_tree* kd3, const kcolor* k, } else { int delta = k->a[stackpos % 3] - p->pivot; if (state[stackpos] == 1 - && (unsigned) (delta * delta) < mindist) { + && (unsigned) delta * (unsigned) delta < mindist) { if (delta < 0) stack[stackpos + 1] = p + p->offset; else diff --git a/src/support.c b/src/support.c index 5cadd5f..76a7368 100644 --- a/src/support.c +++ b/src/support.c @@ -1,5 +1,5 @@ /* support.c - Support functions for gifsicle. - Copyright (C) 1997-2014 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -1407,7 +1407,7 @@ analyze_crop(int nmerger, Gt_Crop* crop, int compress_immediately) } found_right: - if (compress_immediately > 0) + if (compress_immediately > 0 && srci->compressed) Gif_ReleaseUncompressedImage(srci); } @@ -1508,14 +1508,14 @@ merge_frame_interval(Gt_Frameset *fset, int f1, int f2, /* merge stream-specific info and clear colormaps */ for (i = 0; i < nmerger; i++) - merger[i]->stream->userflags = 1; + merger[i]->stream->user_flags = 1; for (i = 0; i < nmerger; i++) { - if (merger[i]->stream->userflags) { + if (merger[i]->stream->user_flags) { Gif_Stream *src = merger[i]->stream; Gif_CalculateScreenSize(src, 0); /* merge_stream() unmarks the global colormap */ merge_stream(dest, src, merger[i]->no_comments); - src->userflags = 0; + src->user_flags = 0; } if (merger[i]->image->local) unmark_colors_2(merger[i]->image->local); diff --git a/src/ungifwrt.c b/src/ungifwrt.c index efcedd5..a7eeea3 100644 --- a/src/ungifwrt.c +++ b/src/ungifwrt.c @@ -2,7 +2,7 @@ /* ungifwrt.c - Functions to write unGIFs -- GIFs with run-length compression, not LZW compression. Idea due to Hutchinson Avenue Software Corporation . - Copyright (C) 1997-2015 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of the LCDF GIF library. The LCDF GIF library is free software. It is distributed under the GNU @@ -438,8 +438,9 @@ save_compression_result(Gif_Image *gfi, Gif_Writer *grr, int ok) if (gfi->compressed) (*gfi->free_compressed)((void *) gfi->compressed); if (ok) { - gfi->compressed = grr->v; gfi->compressed_len = grr->pos; + gfi->compressed_errors = 0; + gfi->compressed = grr->v; gfi->free_compressed = Gif_Free; grr->v = 0; grr->cap = 0; diff --git a/src/win32cfg.h b/src/win32cfg.h index b939554..0043acc 100644 --- a/src/win32cfg.h +++ b/src/win32cfg.h @@ -77,7 +77,7 @@ #define PACKAGE_NAME "gifsicle" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "gifsicle 1.88" +#define PACKAGE_STRING "gifsicle 1.91" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "gifsicle" @@ -86,7 +86,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.88" +#define PACKAGE_VERSION "1.91" /* Pathname separator character ('/' on Unix). */ #define PATHNAME_SEPARATOR '\\' @@ -111,7 +111,7 @@ #define STDC_HEADERS 1 /* Version number of package */ -#define VERSION "1.88 (Windows)" +#define VERSION "1.91 (Windows)" /* Define if X is not available. */ #define X_DISPLAY_MISSING 1 diff --git a/src/xform.c b/src/xform.c index 39518eb..0a8fe2e 100644 --- a/src/xform.c +++ b/src/xform.c @@ -1,5 +1,5 @@ /* xform.c - Image transformation functions for gifsicle. - Copyright (C) 1997-2015 Eddie Kohler, ekohler@gmail.com + Copyright (C) 1997-2018 Eddie Kohler, ekohler@gmail.com This file is part of gifsicle. Gifsicle is free software. It is distributed under the GNU Public License, @@ -253,7 +253,7 @@ crop_image(Gif_Image* gfi, Gt_Frame* fr, int preserve_total_crop) fr->left_offset = fr->crop->left_offset; fr->top_offset = fr->crop->top_offset; - if (c.w > 0 && c.h > 0) { + if (c.w > 0 && c.h > 0 && gfi->img) { uint8_t** old_img = gfi->img; gfi->img = Gif_NewArray(uint8_t *, c.h + 1); for (j = 0; j < c.h; j++) diff --git a/test/testie b/test/testie index 20e92d5..a5f7f33 100755 --- a/test/testie +++ b/test/testie @@ -4,6 +4,7 @@ use IO::Handle; use Errno; use POSIX ":sys_wait_h"; use MIME::Base64; +use Time::HiRes qw(gettimeofday); no locale; use bytes; require 5.006; @@ -202,6 +203,7 @@ package Testie; my %_special_filerefs = ('stdin' => 1, 'stdout' => 2, 'stderr' => 2); %_variables = (); +$timeout = 45; sub _get ($;$) { my($tt, $acrossfiles) = @_; @@ -702,14 +704,18 @@ EOD; } my($scriptarr, $linenoarr) = ($tt->{$script_type}, $tt->{$script_type . "_lineno"}); + my($last_unfinished) = 0; foreach my $i (0..$#{$tt->{$script_type}}) { my($ln, $text) = ($linenoarr->[$i], $scriptarr->[$i]); - $t .= "echo >&2; echo testie_lineno:$ln >&2\n" if !$::expand_mode; + if (!$::expand_mode && !$last_unfinished) { + $t .= "echo >&2; echo testie_lineno:$ln >&2\n"; + } my(@c, @d); _shell_split(@c, "", @d, $text, 0); die if @c != 1; chomp $c[0]; next if $c[0] =~ /^\s*$/s; + $last_unfinished = ($c[0] =~ /(?:\&\&|\|\||\|)\s*\z/); $c[0] =~ s,^(\s*)\./,$1../, if !$::expand_mode; $t .= $c[0] . "\n"; } @@ -747,8 +753,10 @@ sub output_error ($$$$) { my($failure_text); if (!defined($failure)) { $failure_text = "undefined error"; + } elsif ($failure eq "timeout") { + $failure_text = "timed out after $Testie::timeout sec"; } elsif ($failure == 1) { - $failure_text = "failure"; + $failure_text = "failure"; } else { $failure_text = "error $failure"; } @@ -1048,8 +1056,27 @@ sub _shell ($$$$$) { exec $SHELL, "-e", $scriptfn; } else { $running_pid = $child_pid; - waitpid($child_pid, 0); # assume it succeeds - my($result) = $?; + my($result) = undef; + if ($Testie::timeout > 0) { + my($before) = Time::HiRes::time(); + my($delta) = 10; + do { + Time::HiRes::usleep($delta); + $result = $? if waitpid($child_pid, WNOHANG) > 0; + $delta = ($delta < 150000 ? $delta * 2 : 300000); + } while (!defined($result) && Time::HiRes::time() < $before + $Testie::timeout); + if (!defined($result)) { + if (open(X, ">>", out_script_fn_to_fn($stderr))) { + print X "testie_failure:timeout\n"; + close X; + } + $result = 124; + } + $result = 124 if !defined($result); + } else { + waitpid($child_pid, 0); + } + $result = $? if !defined($result); # sleep for 1 millisecond to give remaining background jobs a chance # to die select(undef, undef, undef, 0.001); @@ -1419,6 +1446,7 @@ Options: --preserve-temporaries Preserve temporary files. -e, --expand Expand test files into current directory. -p, --path DIR Prepend DIR to PATH. + -t, --timeout T Set timeout to T [45 sec]. -v, --version Print version information and exit. --help Print this message and exit. @@ -1438,6 +1466,7 @@ EOD; sub print_version () { print <<'EOD;'; Testie 1.3 +Copyright (c) 2002-2016 Eddie Kohler Copyright (c) 2002-2003 International Computer Science Institute Copyright (c) 2004-2007 Regents of the University of California Copyright (c) 2008-2010 Meraki, Inc. @@ -1543,6 +1572,13 @@ while (@ARGV) { push @show, ["*", 1]; } elsif (argcmp($_, '--show-all-raw', 9)) { push @show, ["*", 0]; + } elsif (/^-t$/ || argcmp($_, '--timeout', 1)) { + usage if @ARGV == 0; + $Testie::timeout = shift @ARGV; + } elsif (/^-t(.+)$/) { + $Testie::timeout = $1; + } elsif (argcmp($_, '--timeout', 1, $arg)) { + $Testie::timeout = $arg; } elsif (/^-j$/ || argcmp($_, "--jobs", 1)) { usage if @ARGV == 0 || $ARGV[0] !~ /\A\d+\z/; $jobs = shift @ARGV;