diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-08-07 09:40:46 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-08-07 09:40:46 +0000 |
commit | 8b7e4f1d418846b3681d1cc941d54451a9f2d9e7 (patch) | |
tree | ca6320b524a4b9c7598beb98a9b4bb6991ce5eb0 /Build | |
parent | b3095594d0adae5c8c7311c0650f9f32814668de (diff) |
potrace 1.15
git-svn-id: svn://tug.org/texlive/trunk@44972 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
25 files changed, 184 insertions, 121 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README index c0aa5152901..3bb3d5f6691 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -52,7 +52,7 @@ pixman 0.34.0 - checked 04feb16 poppler 0.52.0 - checked 17feb17 http://poppler.freedesktop.org/ - used by luatex and xetex -potrace 1.14 - checked 22feb17 +potrace 1.15 - checked 07aug17 http://potrace.sourceforge.net teckit 2.5.7 - checked 27jun17 diff --git a/Build/source/libs/potrace/ChangeLog b/Build/source/libs/potrace/ChangeLog index 737107009e2..dd797385e9d 100644 --- a/Build/source/libs/potrace/ChangeLog +++ b/Build/source/libs/potrace/ChangeLog @@ -1,3 +1,8 @@ +2017-08-07 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + Import potrace-1.15. + * version.ac: Adjust. + 2017-02-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import potrace-1.14. diff --git a/Build/source/libs/potrace/TLpatches/ChangeLog b/Build/source/libs/potrace/TLpatches/ChangeLog index c7f9c49dfce..a508be55f5b 100644 --- a/Build/source/libs/potrace/TLpatches/ChangeLog +++ b/Build/source/libs/potrace/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2017-08-07 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + Import potrace-1.15 source tree from: + http://potrace.sourceforge.net + 2017-02-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp> Import potrace-1.14 source tree from: diff --git a/Build/source/libs/potrace/TLpatches/TL-Changes b/Build/source/libs/potrace/TLpatches/TL-Changes index cba00b3a630..a7876bed3a3 100644 --- a/Build/source/libs/potrace/TLpatches/TL-Changes +++ b/Build/source/libs/potrace/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the potrace-1.14/ tree as obtained from: +Changes applied to the potrace-1.15/ tree as obtained from: http://potrace.sourceforge.net Removed: diff --git a/Build/source/libs/potrace/configure b/Build/source/libs/potrace/configure index 673c59b642e..3d4431e637d 100755 --- a/Build/source/libs/potrace/configure +++ b/Build/source/libs/potrace/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for potrace (TeX Live) 1.14. +# Generated by GNU Autoconf 2.69 for potrace (TeX Live) 1.15. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='potrace (TeX Live)' PACKAGE_TARNAME='potrace--tex-live-' -PACKAGE_VERSION='1.14' -PACKAGE_STRING='potrace (TeX Live) 1.14' +PACKAGE_VERSION='1.15' +PACKAGE_STRING='potrace (TeX Live) 1.15' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1241,7 +1241,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures potrace (TeX Live) 1.14 to adapt to many kinds of systems. +\`configure' configures potrace (TeX Live) 1.15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1308,7 +1308,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of potrace (TeX Live) 1.14:";; + short | recursive ) echo "Configuration of potrace (TeX Live) 1.15:";; esac cat <<\_ACEOF @@ -1405,7 +1405,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -potrace (TeX Live) configure 1.14 +potrace (TeX Live) configure 1.15 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1585,7 +1585,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by potrace (TeX Live) $as_me 1.14, which was +It was created by potrace (TeX Live) $as_me 1.15, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3508,7 +3508,7 @@ fi # Define the identity of the package. PACKAGE='potrace--tex-live-' - VERSION='1.14' + VERSION='1.15' cat >>confdefs.h <<_ACEOF @@ -5582,7 +5582,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by potrace (TeX Live) $as_me 1.14, which was +This file was extended by potrace (TeX Live) $as_me 1.15, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5648,7 +5648,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -potrace (TeX Live) config.status 1.14 +potrace (TeX Live) config.status 1.15 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/potrace/potrace-src/ChangeLog b/Build/source/libs/potrace/potrace-src/ChangeLog index 79b2574698f..2402691f326 100644 --- a/Build/source/libs/potrace/potrace-src/ChangeLog +++ b/Build/source/libs/potrace/potrace-src/ChangeLog @@ -1,5 +1,25 @@ ChangeLog +v1.15 2017/08/05 + (2017/08/05) PS1 - use round() instead of rint() + (2017/08/05) PS1 - portability: set both _POSIX_C_SOURCE and + _NETBSD_SOURCE to enable strdup prototype in string.h, as + _XOPEN_SOURCE=500 doesn't work on macOS, _XOPEN_SOURCE=600 doesn't + work on SunOS, and _POSIX_C_SOURCE alone doesn't work on Minix. + (2017/08/02) PS1 - fixed a potential arithmetic overflow. + (2017/06/17) PS1 - fixed a bug with very large bitmaps. Reported + by Michael Voříšek. + (2017/03/05) PS1 - autoconf: added --enable-local-getopt to avoid + using the system-wide getopt library (it may still end up being + used on GNU systems). + (2017/03/05) PS1 - portability: moved getopt.h to a subdirectory, + to be included only when needed. Reported by Daniel Macks. + (2017/03/05) PS1 - portability: use _XOPEN_SOURCE=600 to fix macOS + warning. + (2017/02/27) PS1 - fixed more buffer overflows (not security + critical), including one reported by Agostino Sarubbo. This also + fixes CVE-2017-12067. + v1.14 2017/02/19 (2017/02/19) PS1 - speed: use clang as default compiler if available, and no longer use -ffloat-store even with gcc. diff --git a/Build/source/libs/potrace/potrace-src/NEWS b/Build/source/libs/potrace/potrace-src/NEWS index de204817fe9..39c44ddc954 100644 --- a/Build/source/libs/potrace/potrace-src/NEWS +++ b/Build/source/libs/potrace/potrace-src/NEWS @@ -1,3 +1,12 @@ +August 5, 2017: Release 1.15 + + This release consists of bugfixes and minor portability improvements. + Some potential buffer overflows and arithmetic overflows were fixed, + including CVE-2017-12067. A bug triggered by very large bitmaps has + been fixed. A new configuration option --enable-local-getopt was + added. Thanks to Agostino Sarubbo, Daniel Macks, and Michael Voříšek + for reporting bugs and suggesting improvements. + February 19, 2017: Release 1.14 This release consists of bugfixes and minor portability improvements. diff --git a/Build/source/libs/potrace/potrace-src/README b/Build/source/libs/potrace/potrace-src/README index 0b062447b5f..491c0c3ca4d 100644 --- a/Build/source/libs/potrace/potrace-src/README +++ b/Build/source/libs/potrace/potrace-src/README @@ -7,16 +7,16 @@ DESCRIPTION Potrace is a tool for tracing a bitmap, which means, transforming a bitmap into a smooth, scalable image. The input is a bitmap (PBM, - PGM, PPM, or BMP), and the default output is one of several vector - file formats. A typical use is to create EPS files from scanned + PGM, PPM, or BMP), and the output is one of several vector file + formats. A typical use is to create SVG or PDF files from scanned data, such as company or university logos, handwritten notes, etc. The resulting image is not "jaggy" like a bitmap, but smooth. It can then be rendered at any resolution. - Potrace can currently produce the following output formats: EPS, - PostScript, PDF, SVG (scalable vector graphics), DXF, GeoJSON, PGM - (for easy antialiasing of pixel-based images), Gimppath, and - XFig. Additional backends might be added in the future. + Potrace can currently produce the following output formats: SVG, PDF, + EPS, PostScript, DXF, GeoJSON, PGM (for easy antialiasing of + pixel-based images), Gimppath, and XFig. Additional backends might be + added in the future. A separate program, mkbitmap, is also provided. This program can act as a pre-processor for Potrace, applying scaling and various filters @@ -40,6 +40,7 @@ COMPILATION --enable-metric use metric units (centimeters) as default --enable-a4 use a4 as the default papersize --enable-dumb-tty use simplified ASCII-only progress bar + --enable-local-getopt avoid using the system-wide getopt library See also ./configure --help. @@ -69,12 +70,12 @@ USAGE -- - end of options; 0 or more input filenames follow Backend selection: -b, --backend <name> - select backend by name - -e, --eps - EPS backend (encapsulated PostScript) (default) - -p, --postscript - PostScript backend - -s, --svg - SVG backend (scalable vector graphics) - -g, --pgm - PGM backend (portable greymap) + -b svg, -s, --svg - SVG backend (scalable vector graphics) -b pdf - PDF backend (portable document format) -b pdfpage - fixed page-size PDF backend + -b eps, -e, --eps - EPS backend (encapsulated PostScript) (default) + -b ps, -p, --postscript - PostScript backend + -b pgm, -g, --pgm - PGM backend (portable greymap) -b dxf - DXF backend (drawing interchange format) -b geojson - GeoJSON backend -b gimppath - Gimppath backend (GNU Gimp) @@ -125,7 +126,7 @@ USAGE Dimensions can have optional units, e.g. 6.5in, 15cm, 100pt. Default is inches (or pixels for pgm, dxf, and gimppath backends). Possible input file formats are: pnm (pbm, pgm, ppm), bmp. - Backends are: eps, postscript, ps, pdf, pdfpage, svg, dxf, geojson, pgm, + Backends are: svg, pdf, pdfpage, eps, postscript, ps, dxf, geojson, pgm, gimppath, xfig. POTRACE LIBRARY (FOR DEVELOPERS) @@ -159,6 +160,9 @@ COPYRIGHT Copyright (C) 2001-2017 Peter Selinger + The use of the name "Potrace" is governed by a separate policy, see + TRADEMARKS below. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at @@ -176,6 +180,34 @@ COPYRIGHT See the file COPYING for details. +TRADEMARKS + + "Potrace" is a trademark of Peter Selinger. + + Policy on using the name "Potrace". If you are planning to modify + Potrace, including making a port of Potrace to another programming + language, please be aware of the following. While the source code of + Potrace is licensed under the GNU General Public License, the name + "Potrace" is my trademark, and may only be used with my permission. + + In practice, I will permit the use of the name "Potrace" in + connection with a port of Potrace to another programming language, + provided that the port complies with the term of the GNU General + Public License and produces the same high quality vectorized output + as the original Potrace. Ports that are buggy or do not produce high + quality output are not permitted to use the name "Potrace". To ensure + compliance with this policy, please run your port by me before making + it public. Also, if you use the "Potrace" name (or any derivative, + such as "MyPotrace"), you must provide a name and email address where + I can reach you. Derivatives of Potrace that are posted anonymously + or where the authors cannot be reached or do not reply to email or + bug reports are not permitted to use the name "Potrace". + + The purpose of this policy is to allow people to port Potrace to as + many programming languages as possible, while also ensuring that all + such ports are of the same high quality that has come to be + associated with the name "Potrace". + GPG KEY The key fingerprint of Peter Selinger's GPG key is: diff --git a/Build/source/libs/potrace/potrace-src/README-WIN b/Build/source/libs/potrace/potrace-src/README-WIN index ff16913c8ee..416b84f87ee 100644 --- a/Build/source/libs/potrace/potrace-src/README-WIN +++ b/Build/source/libs/potrace/potrace-src/README-WIN @@ -10,8 +10,8 @@ man page for general information on usage, how to compile Potrace, etc. -INSTALLATION for Windows 95/98/2000/NT/XP/Vista/7/whatever: -=========================================================== +INSTALLATION for Windows: +========================= Download the file potrace-XXX.win32.zip (or potrace-XXX.win64.zip if you want the 64-bit version). Unpack it with your favorite unzipping @@ -29,10 +29,6 @@ following line to C:\AUTOEXEC.BAT: PATH=%PATH%;C:\DIRECTORY\WHERE\FILES\ARE -Note: as of version 1.6, the Potrace Windows distribution is built -using MinGW and not Cygwin. It is no longer necessary to install a -separate DLL file with Potrace. - RUNNING: ======== @@ -51,15 +47,3 @@ Wildcards can also be used, as in: potrace h:\data\*.* potrace h:/data/*.* - -Earlier versions of Potrace had some problems when wildcards and -backslashes were mixed; these problems seem to have been solved by the -switch from Cygwin to MinGW. - -Another problem that some users have reported is that the generated -".ps" and ".eps" were not executable under Windows (i.e., one could -not simply display these files by typing their name on the MSDOS -Prompt, as should normally be the case if a default application for -PostScript files has been configured). I was never able to replicate -this problem, but I believe that it has also been solved by the switch -to MinGW. diff --git a/Build/source/libs/potrace/potrace-src/config.h.in b/Build/source/libs/potrace/potrace-src/config.h.in index 532dd151ad8..9375fca7207 100644 --- a/Build/source/libs/potrace/potrace-src/config.h.in +++ b/Build/source/libs/potrace/potrace-src/config.h.in @@ -87,6 +87,11 @@ /* Version number of package */ #undef VERSION +/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus @@ -98,3 +103,7 @@ /* Replacement function for strncasecmp */ #undef strncasecmp + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t diff --git a/Build/source/libs/potrace/potrace-src/configure.ac b/Build/source/libs/potrace/potrace-src/configure.ac index dc554ab4d31..354a640d536 100644 --- a/Build/source/libs/potrace/potrace-src/configure.ac +++ b/Build/source/libs/potrace/potrace-src/configure.ac @@ -6,13 +6,13 @@ dnl Process this file with autoconf to produce a configure script. dnl ---------------------------------------------------------------------- dnl Package info -AC_INIT([potrace],[1.14],[selinger at users.sourceforge.net]) +AC_INIT([potrace],[1.15],[selinger at users.sourceforge.net]) AC_CONFIG_SRCDIR(src/trace.c) AM_INIT_AUTOMAKE AC_CONFIG_HEADER(config.h) AC_CONFIG_MACRO_DIR([m4]) -DATE="February 2017" +DATE="August 2017" dnl ---------------------------------------------------------------------- dnl The names of the installed executables are defined here, but @@ -34,7 +34,7 @@ dnl Also add CADD to the CFLAGS at configure time or compile time AC_SUBST(CADD) AC_MSG_CHECKING(what compiler options to use) -AC_MSG_RESULT($CFLAGS $CADD) +AC_MSG_RESULT($CADD $CFLAGS) dnl ---------------------------------------------------------------------- dnl check if --with-libpotrace was given - this must be done @@ -192,6 +192,11 @@ fi AC_CHECK_LIB(m, floor, true, AC_MSG_ERROR([cannot find the m library (-lm)])) dnl ---------------------------------------------------------------------- +dnl Check for types + +AC_TYPE_UINT64_T + +dnl ---------------------------------------------------------------------- dnl Check for library functions. dnl Check for getopt_long @@ -216,8 +221,17 @@ if test "$have_getopt_long" = "yes"; then [AC_MSG_RESULT(maybe (cross-compiling)) have_getopt_long=no]) fi -if test "$have_getopt_long" != "yes"; then + +AC_ARG_ENABLE(local-getopt, + AS_HELP_STRING([--enable-local-getopt],[avoid using the system-wide getopt library])) + +AC_MSG_CHECKING(whether to use local getopt) +if test "$have_getopt_long" != "yes" || test "$enable_local_getopt" = yes; then EXTRA_OBJS="$EXTRA_OBJS getopt.o getopt1.o" + EXTRA_INCLUDES="$EXTRA_INCLUDES -I\$(srcdir)/include/getopt" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) fi AC_CHECK_FUNC(strcasecmp, , @@ -255,6 +269,7 @@ AC_SUBST(DATE) AC_SUBST(POTRACE) AC_SUBST(MKBITMAP) AC_SUBST(EXTRA_OBJS) +AC_SUBST(EXTRA_INCLUDES) AC_SUBST(EXTRA_LIBS) AC_SUBST(AM_CPPFLAGS) AC_SUBST(POTRACELIB_VERSION) diff --git a/Build/source/libs/potrace/potrace-src/src/Makefile.am b/Build/source/libs/potrace/potrace-src/src/Makefile.am index 1f657e08897..e83bfc14fe1 100644 --- a/Build/source/libs/potrace/potrace-src/src/Makefile.am +++ b/Build/source/libs/potrace/potrace-src/src/Makefile.am @@ -32,6 +32,8 @@ potracelib_demo_SOURCES = potracelib_demo.c potracelib_demo_LDADD = libpotrace.la -lm potracelib_demo_DEPENDENCIES = libpotrace.la +AM_CPPFLAGS = @EXTRA_INCLUDES@ + #---------------------------------------------------------------------- # Potrace library: @@ -42,7 +44,7 @@ libsources = curve.c curve.h trace.c trace.h decompose.c \ lib_LTLIBRARIES = $(INSTLIBS) EXTRA_LTLIBRARIES = libpotrace.la libpotrace_la_SOURCES = $(libsources) -libpotrace_la_LDFLAGS = -version-info 0:4:0 -rpath '$(libdir)' \ +libpotrace_la_LDFLAGS = -version-info 0:5:0 -rpath '$(libdir)' \ -export-symbols $(srcdir)/libpotrace-export.sym -no-undefined libpotrace_la_LIBADD = -lm MOSTLYCLEANFILES = libpotrace.la @@ -54,4 +56,4 @@ EXTRA_HEADERS = potracelib.h #---------------------------------------------------------------------- # other stuff to distribute -EXTRA_DIST = getopt.c getopt1.c getopt.h libpotrace-export.sym +EXTRA_DIST = getopt.c getopt1.c include/getopt/getopt.h libpotrace-export.sym diff --git a/Build/source/libs/potrace/potrace-src/src/backend_eps.c b/Build/source/libs/potrace/potrace-src/src/backend_eps.c index 8cfb91ef218..d1f0cf3bec9 100644 --- a/Build/source/libs/potrace/potrace-src/src/backend_eps.c +++ b/Build/source/libs/potrace/potrace-src/src/backend_eps.c @@ -8,7 +8,13 @@ output. Postscript compression is optionally supplied via the functions in flate.c. */ -#define _XOPEN_SOURCE 500 +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L +#endif + +#ifndef _NETBSD_SOURCE +#define _NETBSD_SOURCE 1 +#endif #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/Build/source/libs/potrace/potrace-src/src/bitmap_io.c b/Build/source/libs/potrace/potrace-src/src/bitmap_io.c index 26c532e2b3c..f965b733212 100644 --- a/Build/source/libs/potrace/potrace-src/src/bitmap_io.c +++ b/Build/source/libs/potrace/potrace-src/src/bitmap_io.c @@ -689,11 +689,11 @@ static int bm_readbody_bmp(FILE *f, double threshold, potrace_bitmap_t **bmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; - BM_UPUT(bm, x, y, col[i&1]); + BM_PUT(bm, x, y, col[i&1]); x++; } } else if (c == 0) { @@ -719,7 +719,7 @@ static int bm_readbody_bmp(FILE *f, double threshold, potrace_bitmap_t **bmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; @@ -747,11 +747,11 @@ static int bm_readbody_bmp(FILE *f, double threshold, potrace_bitmap_t **bmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; - BM_UPUT(bm, x, y, COLTABLE(c)); + BM_PUT(bm, x, y, COLTABLE(c)); x++; } } else if (c == 0) { @@ -775,7 +775,7 @@ static int bm_readbody_bmp(FILE *f, double threshold, potrace_bitmap_t **bmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; diff --git a/Build/source/libs/potrace/potrace-src/src/decompose.c b/Build/source/libs/potrace/potrace-src/src/decompose.c index 060a53d28a3..5439ad51f3a 100644 --- a/Build/source/libs/potrace/potrace-src/src/decompose.c +++ b/Build/source/libs/potrace/potrace-src/src/decompose.c @@ -10,6 +10,9 @@ #include <stdlib.h> #include <string.h> #include <limits.h> +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif #include "potracelib.h" #include "curve.h" @@ -199,7 +202,8 @@ static void setbbox_path(bbox_t *bbox, path_t *p) { cannot have length 0). Sign is required for correct interpretation of turnpolicies. */ static path_t *findpath(potrace_bitmap_t *bm, int x0, int y0, int sign, int turnpolicy) { - int x, y, dirx, diry, len, size, area; + int x, y, dirx, diry, len, size; + uint64_t area; int c, d, tmp; point_t *pt, *pt1; path_t *p = NULL; @@ -276,7 +280,7 @@ static path_t *findpath(potrace_bitmap_t *bm, int x0, int y0, int sign, int turn p->priv->pt = pt; p->priv->len = len; - p->area = area; + p->area = area <= INT_MAX ? area : INT_MAX; /* avoid overflow */ p->sign = sign; return p; diff --git a/Build/source/libs/potrace/potrace-src/src/getopt.c b/Build/source/libs/potrace/potrace-src/src/getopt.c index 0c8fdd11bb3..d889c3c8686 100644 --- a/Build/source/libs/potrace/potrace-src/src/getopt.c +++ b/Build/source/libs/potrace/potrace-src/src/getopt.c @@ -41,25 +41,6 @@ #include <stdio.h> -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include <gnu-versions.h> -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -986,7 +967,6 @@ getopt (argc, argv, optstring) 0); } -#endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/Build/source/libs/potrace/potrace-src/src/getopt1.c b/Build/source/libs/potrace/potrace-src/src/getopt1.c index 8ffe0e6ad71..d983d120ac0 100644 --- a/Build/source/libs/potrace/potrace-src/src/getopt1.c +++ b/Build/source/libs/potrace/potrace-src/src/getopt1.c @@ -34,25 +34,6 @@ #include <stdio.h> -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include <gnu-versions.h> -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -91,7 +72,6 @@ getopt_long_only (argc, argv, options, long_options, opt_index) } -#endif /* Not ELIDE_CODE. */ #ifdef TEST diff --git a/Build/source/libs/potrace/potrace-src/src/greymap.c b/Build/source/libs/potrace/potrace-src/src/greymap.c index 785774dd8da..0f97f12056e 100644 --- a/Build/source/libs/potrace/potrace-src/src/greymap.c +++ b/Build/source/libs/potrace/potrace-src/src/greymap.c @@ -845,11 +845,11 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; - GM_UPUT(gm, x, y, col[i&1]); + GM_PUT(gm, x, y, col[i&1]); x++; } } else if (c == 0) { @@ -875,7 +875,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; @@ -903,11 +903,11 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; - GM_UPUT(gm, x, y, COLTABLE(c)); + GM_PUT(gm, x, y, COLTABLE(c)); x++; } } else if (c == 0) { @@ -931,7 +931,7 @@ static int gm_readbody_bmp(FILE *f, greymap_t **gmp) { x=0; y++; } - if (y>=bmpinfo.h) { + if (x>=bmpinfo.w || y>=bmpinfo.h) { break; } realheight = y+1; diff --git a/Build/source/libs/potrace/potrace-src/src/greymap.h b/Build/source/libs/potrace/potrace-src/src/greymap.h index 7471ebf64bb..a1cea516338 100644 --- a/Build/source/libs/potrace/potrace-src/src/greymap.h +++ b/Build/source/libs/potrace/potrace-src/src/greymap.h @@ -41,7 +41,7 @@ typedef struct greymap_s greymap_t; #define GM_INC(gm, x, y, b) (gm_safe(gm, x, y) ? GM_UINC(gm, x, y, b) : 0) #define GM_INV(gm, x, y) (gm_safe(gm, x, y) ? GM_UINV(gm, x, y) : 0) #define GM_PUT(gm, x, y, b) (gm_safe(gm, x, y) ? GM_UPUT(gm, x, y, b) : 0) -#define GM_BGET(gm, x, y) GM_UGET(gm, gm_bound(x, gm->w), gm_bound(y, gm->h)) +#define GM_BGET(gm, x, y) ((gm)->w == 0 || (gm)->h == 0 ? 0 : GM_UGET(gm, gm_bound(x, (gm)->w), gm_bound(y, (gm)->h))) /* modes for cutting off out-of-range values. The following names refer to winding numbers. I.e., make a pixel black if winding diff --git a/Build/source/libs/potrace/potrace-src/src/getopt.h b/Build/source/libs/potrace/potrace-src/src/include/getopt/getopt.h index 20daef6168b..20daef6168b 100644 --- a/Build/source/libs/potrace/potrace-src/src/getopt.h +++ b/Build/source/libs/potrace/potrace-src/src/include/getopt/getopt.h diff --git a/Build/source/libs/potrace/potrace-src/src/main.c b/Build/source/libs/potrace/potrace-src/src/main.c index 1983f97b2c0..1722e69af19 100644 --- a/Build/source/libs/potrace/potrace-src/src/main.c +++ b/Build/source/libs/potrace/potrace-src/src/main.c @@ -2,7 +2,13 @@ This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details. */ -#define _XOPEN_SOURCE 500 +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L +#endif + +#ifndef _NETBSD_SOURCE +#define _NETBSD_SOURCE 1 +#endif #ifdef HAVE_CONFIG_H #include <config.h> @@ -101,12 +107,12 @@ struct backend_s { typedef struct backend_s backend_t; static backend_t backend[] = { + { "svg", ".svg", 0, 0, 0, NULL, page_svg, NULL, 1 }, + { "pdf", ".pdf", 0, 0, 1, init_pdf, page_pdf, term_pdf, 1 }, + { "pdfpage", ".pdf", 1, 0, 1, init_pdf, page_pdfpage, term_pdf, 1 }, { "eps", ".eps", 0, 0, 0, NULL, page_eps, NULL, 1 }, { "postscript", ".ps", 1, 0, 1, init_ps, page_ps, term_ps, 1 }, { "ps", ".ps", 1, 0, 1, init_ps, page_ps, term_ps, 1 }, - { "pdf", ".pdf", 0, 0, 1, init_pdf, page_pdf, term_pdf, 1 }, - { "pdfpage", ".pdf", 1, 0, 1, init_pdf, page_pdfpage, term_pdf, 1 }, - { "svg", ".svg", 0, 0, 0, NULL, page_svg, NULL, 1 }, { "dxf", ".dxf", 0, 1, 0, NULL, page_dxf, NULL, 1 }, { "geojson", ".json",0, 1, 0, NULL, page_geojson, NULL, 1 }, { "pgm", ".pgm", 0, 1, 1, NULL, page_pgm, NULL, 1 }, @@ -203,12 +209,12 @@ static void usage(FILE *f) { fprintf(f, " -- - end of options; 0 or more input filenames follow\n"); fprintf(f, "Backend selection:\n"); fprintf(f, " -b, --backend <name> - select backend by name\n"); - fprintf(f, " -e, --eps - EPS backend (encapsulated PostScript) (default)\n"); - fprintf(f, " -p, --postscript - PostScript backend\n"); - fprintf(f, " -s, --svg - SVG backend (scalable vector graphics)\n"); - fprintf(f, " -g, --pgm - PGM backend (portable greymap)\n"); + fprintf(f, " -b svg, -s, --svg - SVG backend (scalable vector graphics)\n"); fprintf(f, " -b pdf - PDF backend (portable document format)\n"); fprintf(f, " -b pdfpage - fixed page-size PDF backend\n"); + fprintf(f, " -b eps, -e, --eps - EPS backend (encapsulated PostScript) (default)\n"); + fprintf(f, " -b ps, -p, --postscript - PostScript backend\n"); + fprintf(f, " -b pgm, -g, --pgm - PGM backend (portable greymap)\n"); fprintf(f, " -b dxf - DXF backend (drawing interchange format)\n"); fprintf(f, " -b geojson - GeoJSON backend\n"); fprintf(f, " -b gimppath - Gimppath backend (GNU Gimp)\n"); @@ -613,8 +619,8 @@ static void dopts(int ac, char *av[]) { } parse_dimensions(optarg, &p, &dimx, &dimy); if (*p == 0) { - info.paperwidth = (int)rint(double_of_dim(dimx, DEFAULT_DIM)); - info.paperheight = (int)rint(double_of_dim(dimy, DEFAULT_DIM)); + info.paperwidth = (int)round(double_of_dim(dimx, DEFAULT_DIM)); + info.paperheight = (int)round(double_of_dim(dimy, DEFAULT_DIM)); break; } if (matches == 0) { diff --git a/Build/source/libs/potrace/potrace-src/src/mkbitmap.c b/Build/source/libs/potrace/potrace-src/src/mkbitmap.c index 34976591adb..4b1b1a3294d 100644 --- a/Build/source/libs/potrace/potrace-src/src/mkbitmap.c +++ b/Build/source/libs/potrace/potrace-src/src/mkbitmap.c @@ -7,7 +7,13 @@ filter (evening out background gradients), lowpass filter (smoothing foreground details), interpolated scaling, inversion. */ -#define _XOPEN_SOURCE 500 +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 200809L +#endif + +#ifndef _NETBSD_SOURCE +#define _NETBSD_SOURCE 1 +#endif #ifdef HAVE_CONFIG_H #include <config.h> @@ -332,9 +338,9 @@ static void *interpolate_cubic(greymap_t *gm, int s, int bilevel, double c) { v += window[k][i] * poly[l][i]; } if (bilevel) { - BM_UPUT(bm_out, x*s+l, y*s+k, v < c1); + BM_PUT(bm_out, x*s+l, y*s+k, v < c1); } else { - GM_UPUT(gm_out, x*s+l, y*s+k, v); + GM_PUT(gm_out, x*s+l, y*s+k, v); } } } diff --git a/Build/source/libs/potrace/potrace-src/src/potracelib.h b/Build/source/libs/potrace/potrace-src/src/potracelib.h index ed5a245ac4a..003297740af 100644 --- a/Build/source/libs/potrace/potrace-src/src/potracelib.h +++ b/Build/source/libs/potrace/potrace-src/src/potracelib.h @@ -121,7 +121,7 @@ potrace_param_t *potrace_param_default(void); /* free parameter set */ void potrace_param_free(potrace_param_t *p); -/* trace a bitmap*/ +/* trace a bitmap */ potrace_state_t *potrace_trace(const potrace_param_t *param, const potrace_bitmap_t *bm); diff --git a/Build/source/libs/potrace/potrace-src/src/trace.c b/Build/source/libs/potrace/potrace-src/src/trace.c index 5be6dd3ec57..b0b9944ae6a 100644 --- a/Build/source/libs/potrace/potrace-src/src/trace.c +++ b/Build/source/libs/potrace/potrace-src/src/trace.c @@ -282,9 +282,9 @@ static int calc_sums(privpath_t *pp) { y = pp->pt[i].y - pp->y0; pp->sums[i+1].x = pp->sums[i].x + x; pp->sums[i+1].y = pp->sums[i].y + y; - pp->sums[i+1].x2 = pp->sums[i].x2 + x*x; - pp->sums[i+1].xy = pp->sums[i].xy + x*y; - pp->sums[i+1].y2 = pp->sums[i].y2 + y*y; + pp->sums[i+1].x2 = pp->sums[i].x2 + (double)x*x; + pp->sums[i+1].xy = pp->sums[i].xy + (double)x*y; + pp->sums[i+1].y2 = pp->sums[i].y2 + (double)y*y; } return 0; diff --git a/Build/source/libs/potrace/version.ac b/Build/source/libs/potrace/version.ac index 208d968b498..04d0402ee4f 100644 --- a/Build/source/libs/potrace/version.ac +++ b/Build/source/libs/potrace/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current potrace version -m4_define([potrace_version], [1.14]) +m4_define([potrace_version], [1.15]) |