diff -Nru lcms2-2.8/aclocal.m4 lcms2-2.9/aclocal.m4 --- lcms2-2.8/aclocal.m4 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/aclocal.m4 2017-11-21 08:22:45.000000000 +0000 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- +# generated automatically by aclocal 1.15 -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2013 Free Software Foundation, Inc. +# Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -32,10 +32,10 @@ # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' +[am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], +m4_if([$1], [1.15], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,14 +51,14 @@ # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl +[AM_AUTOMAKE_VERSION([1.15])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -103,15 +103,14 @@ # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -142,7 +141,7 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -333,7 +332,7 @@ # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -409,7 +408,7 @@ # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -499,8 +498,8 @@ # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl @@ -573,7 +572,11 @@ END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi -fi]) +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further @@ -602,7 +605,7 @@ done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -613,7 +616,7 @@ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -623,7 +626,7 @@ fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -645,7 +648,7 @@ # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -680,7 +683,7 @@ # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -730,7 +733,7 @@ # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -769,7 +772,7 @@ # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -798,7 +801,7 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Copyright (C) 1999-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -845,7 +848,7 @@ # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -864,7 +867,7 @@ # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -945,7 +948,7 @@ rm -f conftest.file ]) -# Copyright (C) 2009-2013 Free Software Foundation, Inc. +# Copyright (C) 2009-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1005,7 +1008,7 @@ _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2013 Free Software Foundation, Inc. +# Copyright (C) 2001-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1033,7 +1036,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# Copyright (C) 2006-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1052,7 +1055,7 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2013 Free Software Foundation, Inc. +# Copyright (C) 2004-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1184,6 +1187,11 @@ ]) # _AM_PROG_TAR m4_include([m4/acx_pthread.m4]) +m4_include([m4/ax_append_compile_flags.m4]) +m4_include([m4/ax_append_flag.m4]) +m4_include([m4/ax_check_compile_flag.m4]) +m4_include([m4/ax_gcc_func_attribute.m4]) +m4_include([m4/ax_require_defined.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) diff -Nru lcms2-2.8/AUTHORS lcms2-2.9/AUTHORS --- lcms2-2.8/AUTHORS 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/AUTHORS 2017-11-20 20:59:38.000000000 +0000 @@ -37,6 +37,7 @@ Thomas Weber (Debian) Mark Allen Noel Carboni +Sergei Trofimovic Special Thanks -------------- diff -Nru lcms2-2.8/ChangeLog lcms2-2.9/ChangeLog --- lcms2-2.8/ChangeLog 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/ChangeLog 2017-11-20 20:59:38.000000000 +0000 @@ -1,17 +1,27 @@ ----------------------- +2.9 Maintenance release +----------------------- +Several fixes related with security, and therefore not detailed here. +C++ compiles now without warnings +Added OSX and clang in travis +Added a travis-ci test matrix for many compilers and OS. Thanks to Thomas Weber (debian) for this great improvement. +testbed can now work with dynamic versions of library +Fixed wrong planar formatters regarding linestride interpretation + +----------------------- 2.8 Featured release ----------------------- Changed ChangeLog direction Fixed many typos in comments, thanks to Stefan Weil for doing that. -Fixed localization bug, added a new test case crayons.icc thnaks to Richard Hughes for providing the profile. +Fixed localization bug, added a new test case crayons.icc thanks to Richard Hughes for providing the profile. Fixed a bug in optimizer that made some formats (i.e, bits planar) unavailable Fixed misalignment problems on Alpha. The compiler does not align strings, and accessing begin of string as a uint16 makes code to fail. Added some extra checks to the tools and examples. -Fix a bug that prevented to read luminance tag +Fixed a bug that prevented to read luminance tag BIG amount of functionality contributed/Sponsored by Alien Skin Software: TransformStride, copyAlpha, performance plug-ins. Fixes some warnings as well. -added an extra _ to _stdcall to make it more portable +Added an extra _ to _stdcall to make it more portable Fixed a bug in transicc for named color profiles Fixed several compiler warnings Added support for Visual Studio 2015 @@ -32,7 +42,7 @@ Move unused var suppresor before the `return` statements. Remove dead code. Add missing comma in CGATS parser -utils/jpgicc/iccjpeg.c: Fix check if unsigned variable 'total_length'… … +utils/jpgicc/iccjpeg.c: Fix check if unsigned variable 'total_length'… … Some maintenance fixes Remove unused vcproj files Added a function to retrieve the iohandler of a given profile object @@ -91,7 +101,7 @@ -------------------- Added a check for maximum input channels -Fixed an unitialized read on PatchLUT +Fixed an uninitialized read on PatchLUT Fixed a bug in XYZ floating point PCS added half float variants (ABGR and so) Added formatter resolution after xform optimization plugin diff -Nru lcms2-2.8/configure lcms2-2.9/configure --- lcms2-2.8/configure 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/configure 2017-11-21 08:22:47.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for lcms2 2.8. +# Generated by GNU Autoconf 2.69 for lcms2 2.9. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='lcms2' PACKAGE_TARNAME='lcms2' -PACKAGE_VERSION='2.8' -PACKAGE_STRING='lcms2 2.8' +PACKAGE_VERSION='2.9' +PACKAGE_STRING='lcms2 2.9' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -760,6 +760,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -848,6 +849,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1100,6 +1102,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1237,7 +1248,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1350,7 +1361,7 @@ # 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 lcms2 2.8 to adapt to many kinds of systems. +\`configure' configures lcms2 2.9 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1390,6 +1401,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1420,7 +1432,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lcms2 2.8:";; + short | recursive ) echo "Configuration of lcms2 2.9:";; esac cat <<\_ACEOF @@ -1535,7 +1547,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lcms2 configure 2.8 +lcms2 configure 2.9 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2021,7 +2033,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lcms2 $as_me 2.8, which was +It was created by lcms2 $as_me 2.9, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2501,7 +2513,7 @@ -am__api_version='1.14' +am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2673,8 +2685,8 @@ ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -2693,7 +2705,7 @@ $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -2987,7 +2999,7 @@ # Define the identity of the package. PACKAGE='lcms2' - VERSION='2.8' + VERSION='2.9' # Some tools Automake needs. @@ -3012,8 +3024,8 @@ # mkdir_p='$(MKDIR_P)' -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' @@ -3072,6 +3084,7 @@ fi + # Check for programs DEPDIR="${am__leading_dot}deps" @@ -15887,6 +15900,139 @@ +# Check if the C compiler supports the "visibility" function attribute +# If supported, defines HAVE_FUNC_ATTRIBUTE_VISIBILITY + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility))" >&5 +$as_echo_n "checking for __attribute__((visibility))... " >&6; } +if ${ax_cv_have_func_attribute_visibility+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + int foo_def( void ) __attribute__((visibility("default"))); + int foo_hid( void ) __attribute__((visibility("hidden"))); + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if test -s conftest.err; then : + ax_cv_have_func_attribute_visibility=no +else + ax_cv_have_func_attribute_visibility=yes +fi +else + ax_cv_have_func_attribute_visibility=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_func_attribute_visibility" >&5 +$as_echo "$ax_cv_have_func_attribute_visibility" >&6; } + + if test yes = $ax_cv_have_func_attribute_visibility; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_FUNC_ATTRIBUTE_VISIBILITY 1 +_ACEOF + +fi + + + + +# Check if the compiler supports "-fvisibility=hidden" and if yes, add it to CFLAGS +# This means that symbols that are not marked explicitly for export (CMSAPI) +# will not be reachable in the shared library. + + + + +for flag in "-fvisibility=hidden"; do + as_CACHEVAR=`$as_echo "ax_cv_check_cflags__$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS $flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : + +if ${CFLAGS+:} false; then : + + case " $CFLAGS " in #( + *" $flag "*) : + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS already contains \$flag"; } >&5 + (: CFLAGS already contains $flag) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } ;; #( + *) : + + as_fn_append CFLAGS " $flag" + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + ;; +esac + +else + + CFLAGS=$flag + { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS\""; } >&5 + (: CFLAGS="$CFLAGS") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + +fi + +else + : +fi + +done + + # If words are stored with the most significant byte first (like # Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 @@ -18074,7 +18220,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lcms2 $as_me 2.8, which was +This file was extended by lcms2 $as_me 2.9, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18131,7 +18277,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -lcms2 config.status 2.8 +lcms2 config.status 2.9 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru lcms2-2.8/configure.ac lcms2-2.9/configure.ac --- lcms2-2.8/configure.ac 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/configure.ac 2017-11-20 20:59:38.000000000 +0000 @@ -7,7 +7,7 @@ # # Set the package name and version # -AC_INIT(lcms2,2.8) +AC_INIT(lcms2,2.9) # Specify directory where m4 macros may be found. AC_CONFIG_MACRO_DIR([m4]) @@ -83,6 +83,15 @@ AC_C_INLINE AC_SUBST(inline) +# Check if the C compiler supports the "visibility" function attribute +# If supported, defines HAVE_FUNC_ATTRIBUTE_VISIBILITY +AX_GCC_FUNC_ATTRIBUTE(visibility) + +# Check if the compiler supports "-fvisibility=hidden" and if yes, add it to CFLAGS +# This means that symbols that are not marked explicitly for export (CMSAPI) +# will not be reachable in the shared library. +AX_APPEND_COMPILE_FLAGS(["-fvisibility=hidden"]) + # If words are stored with the most significant byte first (like # Motorola and SPARC CPUs), define `WORDS_BIGENDIAN'. AC_C_BIGENDIAN diff -Nru lcms2-2.8/debian/changelog lcms2-2.9/debian/changelog --- lcms2-2.8/debian/changelog 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/changelog 2017-12-17 14:52:01.000000000 +0000 @@ -1,8 +1,26 @@ +lcms2 (2.9-1) unstable; urgency=medium + + * New upstream version 2.9: + - Drop patch fix-CVE-2016-10165 (applied upstream) + - Drop patch lcms2-fix-strFrom16-byte-order.patch (applied upstream) + - Update patch dont-write-uninitialized-memory-for-color-strings.patch + - Update patch prepare-for-libtoolizing.patch + - Update symbols file for 2.9 version. + The 2.9 release no longer exports private symbols. + - Update doc-base files for new 2.9 upstream version + * Remove build-depends on dh-autoreconf. + We depend on debhelper >= 10, so this is automatically enabled + Thanks to lintian + * Bump standards version from 3.9.8 to 4.1.2: + - Use httpS in the "Format" field of debian/copyright. (policy 4.0.0) + + -- Thomas Weber Sun, 17 Dec 2017 15:52:01 +0100 + lcms2 (2.8-4) unstable; urgency=medium * New patch: debian/patches/fix-CVE-2016-10165.patch. Fix for CVE-2016-10165. (Closes: #852627) - Thanks to Salvatore Bonaccorso + Thanks to Salvatore Bonaccorso -- Thomas Weber Thu, 26 Jan 2017 11:04:13 +0100 diff -Nru lcms2-2.8/debian/control lcms2-2.9/debian/control --- lcms2-2.8/debian/control 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/control 2017-12-17 14:52:01.000000000 +0000 @@ -2,8 +2,8 @@ Section: libs Priority: optional Maintainer: Thomas Weber -Build-Depends: debhelper (>= 10), dpkg-dev (>= 1.16.0), dh-autoreconf, libjpeg-dev, libtiff-dev, zlib1g-dev -Standards-Version: 3.9.8 +Build-Depends: debhelper (>= 10), dpkg-dev (>= 1.16.0), libjpeg-dev, libtiff-dev, zlib1g-dev +Standards-Version: 4.1.2 Homepage: http://www.littlecms.com/ Vcs-Git: https://anonscm.debian.org/git/collab-maint/lcms2.git Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/lcms2.git diff -Nru lcms2-2.8/debian/copyright lcms2-2.9/debian/copyright --- lcms2-2.8/debian/copyright 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/copyright 2017-12-17 14:52:01.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Little CMS Source: http://www.littlecms.com/ diff -Nru lcms2-2.8/debian/liblcms2-2.symbols lcms2-2.9/debian/liblcms2-2.symbols --- lcms2-2.8/debian/liblcms2-2.symbols 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/liblcms2-2.symbols 2017-12-17 14:52:01.000000000 +0000 @@ -1,38 +1,12 @@ liblcms2.so.2 liblcms2-2 #MINVER# _cms15Fixed16toDouble@Base 2.2+git20110628 _cms8Fixed8toDouble@Base 2.2+git20110628 - _cmsAdaptationMatrix@Base 2.2+git20110628 - _cmsAdaptationStateChunk@Base 2.6 _cmsAdjustEndianess16@Base 2.2+git20110628 _cmsAdjustEndianess32@Base 2.2+git20110628 _cmsAdjustEndianess64@Base 2.2+git20110628 - _cmsAlarmCodesChunk@Base 2.6 - _cmsAllocAdaptationStateChunk@Base 2.6 - _cmsAllocAlarmCodesChunk@Base 2.6 - _cmsAllocCurvesPluginChunk@Base 2.6 - _cmsAllocFormattersPluginChunk@Base 2.6 - _cmsAllocIntentsPluginChunk@Base 2.6 - _cmsAllocInterpPluginChunk@Base 2.6 - _cmsAllocLogErrorChunk@Base 2.6 - _cmsAllocMPETypePluginChunk@Base 2.6 - _cmsAllocMemPluginChunk@Base 2.6 - _cmsAllocMutexPluginChunk@Base 2.6 - _cmsAllocOptimizationPluginChunk@Base 2.6 - _cmsAllocTagPluginChunk@Base 2.6 - _cmsAllocTagTypePluginChunk@Base 2.6 - _cmsAllocTransformPluginChunk@Base 2.6 - _cmsBuildKToneCurve@Base 2.2+git20110628 - _cmsBuildRGB2XYZtransferMatrix@Base 2.2+git20110628 _cmsCalloc@Base 2.2+git20110628 - _cmsChain2Lab@Base 2.2+git20110628 - _cmsCompileProfileSequence@Base 2.2+git20110628 _cmsComputeInterpParams@Base 2.2+git20110628 - _cmsComputeInterpParamsEx@Base 2.2+git20110628 - _cmsContextGetClientChunk@Base 2.6 - _cmsCreateGamutCheckPipeline@Base 2.2+git20110628 _cmsCreateMutex@Base 2.6 - _cmsCreateSubAlloc@Base 2.2+git20110628 - _cmsCurvesPluginChunk@Base 2.6 _cmsDecodeDateTimeNumber@Base 2.2+git20110628 _cmsDefaultICCintents@Base 2.2+git20110628 _cmsDestroyMutex@Base 2.6 @@ -40,58 +14,34 @@ _cmsDoubleTo8Fixed8@Base 2.2+git20110628 _cmsDupMem@Base 2.2+git20110628 _cmsEncodeDateTimeNumber@Base 2.2+git20110628 - _cmsEndPointsBySpace@Base 2.2+git20110628 _cmsFloat2Half@Base 2.4 - _cmsFormatterIs8bit@Base 2.2+git20110628 - _cmsFormatterIsFloat@Base 2.2+git20110628 - _cmsFormattersPluginChunk@Base 2.6 _cmsFree@Base 2.2+git20110628 _cmsFreeInterpParams@Base 2.2+git20110628 - _cmsGetContext@Base 2.6 _cmsGetFormatter@Base 2.2+git20110628 - _cmsGetTagDescriptor@Base 2.2+git20110628 - _cmsGetTagTrueType@Base 2.2+git20110628 - _cmsGetTagTypeHandler@Base 2.2+git20110628 _cmsGetTransformFormatters16@Base 2.4 _cmsGetTransformFormattersFloat@Base 2.4 _cmsGetTransformUserData@Base 2.4 _cmsHalf2Float@Base 2.4 - _cmsHandleExtraChannels@Base 2.8 _cmsICCcolorSpace@Base 2.2+git20110628 _cmsIOPrintf@Base 2.2+git20110628 - _cmsInstallAllocFunctions@Base 2.6 - _cmsIntentsPluginChunk@Base 2.6 - _cmsInterpPluginChunk@Base 2.6 _cmsLCMScolorSpace@Base 2.2+git20110628 - _cmsLinkProfiles@Base 2.2+git20110628 _cmsLockMutex@Base 2.6 - _cmsLogErrorChunk@Base 2.6 _cmsMAT3eval@Base 2.2+git20110628 _cmsMAT3identity@Base 2.2+git20110628 _cmsMAT3inverse@Base 2.2+git20110628 _cmsMAT3isIdentity@Base 2.2+git20110628 _cmsMAT3per@Base 2.2+git20110628 _cmsMAT3solve@Base 2.2+git20110628 - _cmsMPETypePluginChunk@Base 2.6 _cmsMalloc@Base 2.2+git20110628 _cmsMallocZero@Base 2.2+git20110628 - _cmsMemPluginChunk@Base 2.6 - _cmsMutexPluginChunk@Base 2.6 - _cmsOptimizationPluginChunk@Base 2.6 - _cmsOptimizePipeline@Base 2.2+git20110628 _cmsPipelineSetOptimizationParameters@Base 2.2+git20110628 - _cmsPluginMalloc@Base 2.2+git20110628 _cmsQuantizeVal@Base 2.2+git20110628 _cmsRead15Fixed16Number@Base 2.2+git20110628 _cmsReadAlignment@Base 2.2+git20110628 - _cmsReadCHAD@Base 2.2+git20110628 _cmsReadDevicelinkLUT@Base 2.2+git20110628 _cmsReadFloat32Number@Base 2.2+git20110628 - _cmsReadHeader@Base 2.2+git20110628 _cmsReadInputLUT@Base 2.2+git20110628 - _cmsReadMediaWhitePoint@Base 2.2+git20110628 _cmsReadOutputLUT@Base 2.2+git20110628 - _cmsReadProfileSequence@Base 2.2+git20110628 _cmsReadTypeBase@Base 2.2+git20110628 _cmsReadUInt16Array@Base 2.2+git20110628 _cmsReadUInt16Number@Base 2.2+git20110628 @@ -100,44 +50,15 @@ _cmsReadUInt8Number@Base 2.2+git20110628 _cmsReadXYZNumber@Base 2.2+git20110628 _cmsRealloc@Base 2.2+git20110628 - _cmsReasonableGridpointsByColorspace@Base 2.2+git20110628 - _cmsRegisterFormattersPlugin@Base 2.2+git20110628 - _cmsRegisterInterpPlugin@Base 2.2+git20110628 - _cmsRegisterMemHandlerPlugin@Base 2.2+git20110628 - _cmsRegisterMultiProcessElementPlugin@Base 2.2+git20110628 - _cmsRegisterMutexPlugin@Base 2.6 - _cmsRegisterOptimizationPlugin@Base 2.2+git20110628 - _cmsRegisterParametricCurvesPlugin@Base 2.2+git20110628 - _cmsRegisterRenderingIntentPlugin@Base 2.2+git20110628 - _cmsRegisterTagPlugin@Base 2.2+git20110628 - _cmsRegisterTagTypePlugin@Base 2.2+git20110628 - _cmsRegisterTransformPlugin@Base 2.4 - _cmsSearchTag@Base 2.2+git20110628 - _cmsSetInterpolationRoutine@Base 2.2+git20110628 _cmsSetTransformUserData@Base 2.4 _cmsStageAllocIdentityCLut@Base 2.2+git20110628 _cmsStageAllocIdentityCurves@Base 2.2+git20110628 _cmsStageAllocLab2XYZ@Base 2.2+git20110628 - _cmsStageAllocLabPrelin@Base 2.2+git20110628 _cmsStageAllocLabV2ToV4@Base 2.2+git20110628 - _cmsStageAllocLabV2ToV4curves@Base 2.2+git20110628 _cmsStageAllocLabV4ToV2@Base 2.2+git20110628 _cmsStageAllocNamedColor@Base 2.2+git20110628 _cmsStageAllocPlaceholder@Base 2.2+git20110628 _cmsStageAllocXYZ2Lab@Base 2.2+git20110628 - _cmsStageClipNegatives@Base 2.7 - _cmsStageGetPtrToCurveSet@Base 2.2+git20110628 - _cmsStageNormalizeFromLabFloat@Base 2.4 - _cmsStageNormalizeFromXyzFloat@Base 2.4 - _cmsStageNormalizeToLabFloat@Base 2.4 - _cmsStageNormalizeToXyzFloat@Base 2.4 - _cmsSubAlloc@Base 2.2+git20110628 - _cmsSubAllocDestroy@Base 2.2+git20110628 - _cmsSubAllocDup@Base 2.6 - _cmsTagPluginChunk@Base 2.6 - _cmsTagSignature2String@Base 2.2+git20110628 - _cmsTagTypePluginChunk@Base 2.6 - _cmsTransformPluginChunk@Base 2.6 _cmsUnlockMutex@Base 2.6 _cmsVEC3cross@Base 2.2+git20110628 _cmsVEC3distance@Base 2.2+git20110628 @@ -148,8 +69,6 @@ _cmsWrite15Fixed16Number@Base 2.2+git20110628 _cmsWriteAlignment@Base 2.2+git20110628 _cmsWriteFloat32Number@Base 2.2+git20110628 - _cmsWriteHeader@Base 2.2+git20110628 - _cmsWriteProfileSequence@Base 2.2+git20110628 _cmsWriteTypeBase@Base 2.2+git20110628 _cmsWriteUInt16Array@Base 2.2+git20110628 _cmsWriteUInt16Number@Base 2.2+git20110628 @@ -437,5 +356,3 @@ cmsfilelength@Base 2.2+git20110628 cmsstrcasecmp@Base 2.2+git20110628 cmsxyY2XYZ@Base 2.2+git20110628 - from16toDBL@Base 2.8 - from16toFLT@Base 2.8 diff -Nru lcms2-2.8/debian/liblcms2-dev.doc-base.lcms-api lcms2-2.9/debian/liblcms2-dev.doc-base.lcms-api --- lcms2-2.8/debian/liblcms2-dev.doc-base.lcms-api 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/liblcms2-dev.doc-base.lcms-api 2017-12-17 14:52:01.000000000 +0000 @@ -1,8 +1,8 @@ Document: lcms-api -Title: LittleCMS2.8 API Documentation +Title: LittleCMS2.9 API Documentation Author: Marti Maria Saguer Abstract: Description of the LittleCMS API Section: Programming/C Format: PDF -Files: /usr/share/doc/liblcms2-dev/LittleCMS2.8*API.pdf.gz +Files: /usr/share/doc/liblcms2-dev/LittleCMS2.9*API.pdf.gz diff -Nru lcms2-2.8/debian/liblcms2-dev.doc-base.lcms-plugin lcms2-2.9/debian/liblcms2-dev.doc-base.lcms-plugin --- lcms2-2.8/debian/liblcms2-dev.doc-base.lcms-plugin 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/liblcms2-dev.doc-base.lcms-plugin 2017-12-17 14:52:01.000000000 +0000 @@ -5,4 +5,4 @@ Section: Programming/C Format: PDF -Files: /usr/share/doc/liblcms2-dev/LittleCMS2.8*Plugin*API.pdf.gz +Files: /usr/share/doc/liblcms2-dev/LittleCMS2.9*Plugin*API.pdf.gz diff -Nru lcms2-2.8/debian/liblcms2-dev.doc-base.lcms-tutorial lcms2-2.9/debian/liblcms2-dev.doc-base.lcms-tutorial --- lcms2-2.8/debian/liblcms2-dev.doc-base.lcms-tutorial 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/liblcms2-dev.doc-base.lcms-tutorial 2017-12-17 14:52:01.000000000 +0000 @@ -5,4 +5,4 @@ Section: Programming/C Format: PDF -Files: /usr/share/doc/liblcms2-dev/LittleCMS2.8*tutorial.pdf.gz +Files: /usr/share/doc/liblcms2-dev/LittleCMS2.9*tutorial.pdf.gz diff -Nru lcms2-2.8/debian/patches/dont-write-uninitialized-memory-for-color-strings.patch lcms2-2.9/debian/patches/dont-write-uninitialized-memory-for-color-strings.patch --- lcms2-2.8/debian/patches/dont-write-uninitialized-memory-for-color-strings.patch 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/patches/dont-write-uninitialized-memory-for-color-strings.patch 2017-12-17 14:52:01.000000000 +0000 @@ -11,32 +11,23 @@ Forwarded: https://github.com/mm2/Little-CMS/issues/70 --- a/src/cmstypes.c +++ b/src/cmstypes.c -@@ -3018,6 +3018,8 @@ - char root[33]; - cmsUInt16Number PCS[3]; - -+ // Ensure we don't write uninitialized memory. -+ memset(root, 0, 33); - if (!cmsNamedColorInfo(NamedColorList, i, root, NULL, NULL, PCS, NULL)) return 0; - root[32] = 0; - -@@ -3143,6 +3145,10 @@ +@@ -3174,6 +3174,10 @@ if (!_cmsWriteUInt32Number(io, nColors)) return FALSE; if (!_cmsWriteUInt32Number(io, NamedColorList ->ColorantCount)) return FALSE; + // Ensure we don't write unitialized memory. -+ memset(prefix, 0, 32); -+ memset(suffix, 0, 32); ++ memset(prefix, 0, sizeof(prefix)); ++ memset(suffix, 0, sizeof(suffix)); + strncpy(prefix, (const char*) NamedColorList->Prefix, 32); strncpy(suffix, (const char*) NamedColorList->Suffix, 32); -@@ -3157,6 +3163,8 @@ +@@ -3188,6 +3192,8 @@ cmsUInt16Number Colorant[cmsMAXCHANNELS]; - char Root[33]; + char Root[cmsMAX_PATH]; + // Ensure we don't write unitialized memory. -+ memset(Root, 0, 33); ++ memset(Root, 0, sizeof(Root)); if (!cmsNamedColorInfo(NamedColorList, i, Root, NULL, NULL, PCS, Colorant)) return 0; Root[32] = 0; if (!io ->Write(io, 32 , Root)) return FALSE; diff -Nru lcms2-2.8/debian/patches/fix-CVE-2016-10165.patch lcms2-2.9/debian/patches/fix-CVE-2016-10165.patch --- lcms2-2.8/debian/patches/fix-CVE-2016-10165.patch 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/patches/fix-CVE-2016-10165.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -Description: Fix for CVE-2016-10165 - Fixes an out-of-bounds read in Type_MLU_Read() -Origin: https://github.com/mm2/Little-CMS/commit/5ca71a7bc18b6897ab21d815d15e218e204581e2 -Author: Marti -Applied-upstream: https://github.com/mm2/Little-CMS/commit/5ca71a7bc18b6897ab21d815d15e218e204581e2 -Forwarded: not-needed -Bug-Debian: https://bugs.debian.org/852627 ---- a/src/cmstypes.c -+++ b/src/cmstypes.c -@@ -1460,6 +1460,7 @@ - - // Check for overflow - if (Offset < (SizeOfHeader + 8)) goto Error; -+ if ((Offset + Len) > SizeOfTag + 8) goto Error; - - // True begin of the string - BeginOfThisString = Offset - SizeOfHeader - 8; diff -Nru lcms2-2.8/debian/patches/lcms2-fix-strFrom16-byte-order.patch lcms2-2.9/debian/patches/lcms2-fix-strFrom16-byte-order.patch --- lcms2-2.8/debian/patches/lcms2-fix-strFrom16-byte-order.patch 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/patches/lcms2-fix-strFrom16-byte-order.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -Description: Fix endianness regression from 2.7 to 2.8 -Author: HW42 -Bug: https://github.com/mm2/Little-CMS/issues/110 -Bug-Debian: https://bugs.debian.org/847595 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ ---- a/src/cmsnamed.c -+++ b/src/cmsnamed.c -@@ -192,18 +192,10 @@ - static - void strFrom16(char str[3], cmsUInt16Number n) - { -- // Assiming this would be aligned -- union { -- -- cmsUInt16Number n; -- char str[2]; -- -- } c; -- -- c.n = n; // Always big endian in this case -- -- str[0] = c.str[0]; str[1] = c.str[1]; str[2] = 0; -- -+ // n is always big endian, see strTo16. -+ str[0] = (n >> 8) & 0xff; -+ str[1] = n & 0xff; -+ str[2] = 0; - } - - // Add an ASCII entry. Do not add any \0 termination (ICC1v43_2010-12.pdf page 61) diff -Nru lcms2-2.8/debian/patches/prepare-for-libtoolizing.patch lcms2-2.9/debian/patches/prepare-for-libtoolizing.patch --- lcms2-2.8/debian/patches/prepare-for-libtoolizing.patch 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/patches/prepare-for-libtoolizing.patch 2017-12-17 14:52:01.000000000 +0000 @@ -11,7 +11,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/configure.ac +++ b/configure.ac -@@ -355,6 +355,15 @@ +@@ -364,6 +364,15 @@ TIFFICC_DEPLIBS=`echo $TIFFICC_DEPLIBS | sed -e 's/ */ /g'` AC_SUBST(TIFFICC_DEPLIBS) @@ -27,17 +27,6 @@ LIBS='' # ---- a/testbed/Makefile.am -+++ b/testbed/Makefile.am -@@ -11,7 +11,7 @@ - - # CFLAGS = --pedantic -Wall -std=c99 -O2 - --testcms_LDADD = $(top_builddir)/src/liblcms2.la -+testcms_LDADD = $(top_builddir)/src/liblcms2.la @TESTBED_DEPLIBS@ - testcms_LDFLAGS = @LDFLAGS@ - testcms_SOURCES = testcms2.c testplugin.c zoo_icc.c testcms2.h - --- a/utils/transicc/Makefile.am +++ b/utils/transicc/Makefile.am @@ -11,7 +11,7 @@ diff -Nru lcms2-2.8/debian/patches/series lcms2-2.9/debian/patches/series --- lcms2-2.8/debian/patches/series 2017-01-26 10:04:13.000000000 +0000 +++ lcms2-2.9/debian/patches/series 2017-12-17 14:52:01.000000000 +0000 @@ -1,4 +1,2 @@ prepare-for-libtoolizing.patch dont-write-uninitialized-memory-for-color-strings.patch -lcms2-fix-strFrom16-byte-order.patch -fix-CVE-2016-10165.patch Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/doc/LittleCMS2.8 API.pdf and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/doc/LittleCMS2.8 API.pdf differ Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/doc/LittleCMS2.8 Plugin API.pdf and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/doc/LittleCMS2.8 Plugin API.pdf differ Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/doc/LittleCMS2.8 tutorial.pdf and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/doc/LittleCMS2.8 tutorial.pdf differ Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/doc/LittleCMS2.9 API.pdf and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/doc/LittleCMS2.9 API.pdf differ Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/doc/LittleCMS2.9 Plugin API.pdf and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/doc/LittleCMS2.9 Plugin API.pdf differ Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/doc/LittleCMS2.9 tutorial.pdf and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/doc/LittleCMS2.9 tutorial.pdf differ diff -Nru lcms2-2.8/.gitignore lcms2-2.9/.gitignore --- lcms2-2.8/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/.gitignore 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,47 @@ +.autotools +.cproject +.project +.settings +*.o +*.Plo +*.a +*.so.* +*.la +*.lai +*.lo +*.Po +*.pc +*.so +*.lib +Thumbs.db +*.obj +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* +.vs/ +#Nuget packages folder +packages/ +/config.status +/utils/common/.dirstamp +/testbed/.libs/lt-testcms +/testbed/.libs/testcms +/testbed/testcms diff -Nru lcms2-2.8/include/lcms2.h lcms2-2.9/include/lcms2.h --- lcms2-2.8/include/lcms2.h 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/include/lcms2.h 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ // //--------------------------------------------------------------------------------- // -// Version 2.8 +// Version 2.9rc3 // #ifndef _lcms2_H @@ -49,7 +49,7 @@ // #define CMS_USE_CPP_API // Uncomment this line if you need strict CGATS syntax. Makes CGATS files to -// require "KEYWORD" on undefined identifiers, keep it comented out unless needed +// require "KEYWORD" on undefined identifiers, keep it commented out unless needed // #define CMS_STRICT_CGATS 1 // Uncomment to get rid of the tables for "half" float support @@ -58,6 +58,9 @@ // Uncomment to get rid of pthreads/windows dependency // #define CMS_NO_PTHREADS 1 +// Uncomment this for special windows mutex initialization (see lcms2_internal.h) +// #define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT + // ********** End of configuration toggles ****************************** // Needed for streams @@ -75,7 +78,7 @@ #endif // Version/release -#define LCMS_VERSION 2080 +#define LCMS_VERSION 2090 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED @@ -225,16 +228,21 @@ # define CMSAPI __declspec(dllexport) # else # define CMSAPI __declspec(dllimport) -# endif +# endif # endif # else -# define CMSEXPORT -# define CMSAPI +# define CMSEXPORT +# define CMSAPI # endif -#else -# define CMSEXPORT -# define CMSAPI -#endif +#else // not Windows +# ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY +# define CMSEXPORT +# define CMSAPI __attribute__((visibility("default"))) +# else +# define CMSEXPORT +# define CMSAPI +# endif +#endif // CMS_IS_WINDOWS_ #ifdef HasTHREADS # if HasTHREADS == 1 @@ -255,9 +263,9 @@ #endif // D50 XYZ normalized to Y=1.0 -#define cmsD50X 0.9642 -#define cmsD50Y 1.0 -#define cmsD50Z 0.8249 +#define cmsD50X 0.9642 +#define cmsD50Y 1.0 +#define cmsD50Z 0.8249 // V4 perceptual black #define cmsPERCEPTUAL_BLACK_X 0.00336 @@ -265,8 +273,8 @@ #define cmsPERCEPTUAL_BLACK_Z 0.00287 // Definitions in ICC spec -#define cmsMagicNumber 0x61637370 // 'acsp' -#define lcmsSignature 0x6c636d73 // 'lcms' +#define cmsMagicNumber 0x61637370 // 'acsp' +#define lcmsSignature 0x6c636d73 // 'lcms' // Base ICC type definitions @@ -1125,7 +1133,7 @@ cmsCIEXYZ whitePoint; cmsFloat64Number Yb; cmsFloat64Number La; - int surround; + cmsUInt32Number surround; cmsFloat64Number D_value; } cmsViewingConditions; @@ -1153,16 +1161,16 @@ // The internal representation is none of your business. typedef struct _cms_curve_struct cmsToneCurve; -CMSAPI cmsToneCurve* CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsInt32Number nSegments, const cmsCurveSegment Segments[]); +CMSAPI cmsToneCurve* CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, cmsUInt32Number nSegments, const cmsCurveSegment Segments[]); CMSAPI cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]); CMSAPI cmsToneCurve* CMSEXPORT cmsBuildGamma(cmsContext ContextID, cmsFloat64Number Gamma); -CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsInt32Number nEntries, const cmsUInt16Number values[]); +CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number values[]); CMSAPI cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurveFloat(cmsContext ContextID, cmsUInt32Number nEntries, const cmsFloat32Number values[]); CMSAPI void CMSEXPORT cmsFreeToneCurve(cmsToneCurve* Curve); CMSAPI void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]); CMSAPI cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* Src); CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurve(const cmsToneCurve* InGamma); -CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsInt32Number nResultSamples, const cmsToneCurve* InGamma); +CMSAPI cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InGamma); CMSAPI cmsToneCurve* CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, const cmsToneCurve* X, const cmsToneCurve* Y, cmsUInt32Number nPoints); CMSAPI cmsBool CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda); CMSAPI cmsFloat32Number CMSEXPORT cmsEvalToneCurveFloat(const cmsToneCurve* Curve, cmsFloat32Number v); @@ -1207,7 +1215,7 @@ // Where to place/locate the stages in the pipeline chain typedef enum { cmsAT_BEGIN, cmsAT_END } cmsStageLoc; -CMSAPI int CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage* mpe); +CMSAPI cmsBool CMSEXPORT cmsPipelineInsertStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage* mpe); CMSAPI void CMSEXPORT cmsPipelineUnlinkStage(cmsPipeline* lut, cmsStageLoc loc, cmsStage** mpe); // This function is quite useful to analyze the structure of a Pipeline and retrieve the Stage elements @@ -1430,7 +1438,7 @@ CMSAPI cmsTagSignature CMSEXPORT cmsTagLinkedTo(cmsHPROFILE hProfile, cmsTagSignature sig); // Read and write raw data -CMSAPI cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize); +CMSAPI cmsUInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* Buffer, cmsUInt32Number BufferSize); CMSAPI cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size); // Access header data @@ -1521,7 +1529,7 @@ CMSAPI cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile); -// Profile high level funtions ------------------------------------------------------------------------------------------ +// Profile high level functions ------------------------------------------------------------------------------------------ CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFile(const char *ICCProfile, const char *sAccess); CMSAPI cmsHPROFILE CMSEXPORT cmsOpenProfileFromFileTHR(cmsContext ContextID, const char *ICCProfile, const char *sAccess); @@ -1581,21 +1589,21 @@ CMSAPI cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfile(void); CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID, - int nLUTPoints, + cmsUInt32Number nLUTPoints, cmsFloat64Number Bright, cmsFloat64Number Contrast, cmsFloat64Number Hue, cmsFloat64Number Saturation, - int TempSrc, - int TempDest); + cmsUInt32Number TempSrc, + cmsUInt32Number TempDest); -CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(int nLUTPoints, +CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(cmsUInt32Number nLUTPoints, cmsFloat64Number Bright, cmsFloat64Number Contrast, cmsFloat64Number Hue, cmsFloat64Number Saturation, - int TempSrc, - int TempDest); + cmsUInt32Number TempSrc, + cmsUInt32Number TempDest); CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfileTHR(cmsContext ContextID); CMSAPI cmsHPROFILE CMSEXPORT cmsCreateNULLProfile(void); @@ -1637,7 +1645,7 @@ #define cmsFLAGS_BLACKPOINTCOMPENSATION 0x2000 #define cmsFLAGS_NOWHITEONWHITEFIXUP 0x0004 // Don't fix scum dot #define cmsFLAGS_HIGHRESPRECALC 0x0400 // Use more memory to give better accurancy -#define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resouces +#define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resources // For devicelink creation #define cmsFLAGS_8BITS_DEVICELINK 0x0008 // Create 8 bits devicelinks @@ -1807,7 +1815,7 @@ // Persistence CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromFile(cmsContext ContextID, const char* cFileName); -CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, void *Ptr, cmsUInt32Number len); +CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, const void *Ptr, cmsUInt32Number len); // CMSAPI cmsHANDLE CMSEXPORT cmsIT8LoadFromIOhandler(cmsContext ContextID, cmsIOHANDLER* io); CMSAPI cmsBool CMSEXPORT cmsIT8SaveToFile(cmsHANDLE hIT8, const char* cFileName); diff -Nru lcms2-2.8/include/lcms2_plugin.h lcms2-2.9/include/lcms2_plugin.h --- lcms2-2.8/include/lcms2_plugin.h 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/include/lcms2_plugin.h 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -318,7 +318,7 @@ // Parametric curves. A negative type means same function but analytically inverted. Max. number of params is 10 -// Evaluator callback for user-suplied parametric curves. May implement more than one type +// Evaluator callback for user-supplied parametric curves. May implement more than one type typedef cmsFloat64Number (* cmsParametricCurveEvaluator)(cmsInt32Number Type, const cmsFloat64Number Params[10], cmsFloat64Number R); // Plug-in may implement an arbitrary number of parametric curves @@ -428,7 +428,7 @@ cmsUInt32Number nSupportedTypes; // In how many types this tag can come (MAX_TYPES_IN_LCMS_PLUGIN maximum) cmsTagTypeSignature SupportedTypes[MAX_TYPES_IN_LCMS_PLUGIN]; - // For writting + // For writing cmsTagTypeSignature (* DecideType)(cmsFloat64Number ICCVersion, const void *Data); } cmsTagDescriptor; diff -Nru lcms2-2.8/include/Makefile.in lcms2-2.9/include/Makefile.in --- lcms2-2.8/include/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/include/Makefile.in 2017-11-21 08:22:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,17 @@ # Based on a work by Bob Friesenhahn VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -83,15 +93,20 @@ build_triplet = @build@ host_triplet = @host@ subdir = include -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(include_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -162,6 +177,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -294,6 +310,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -319,7 +336,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -566,6 +582,8 @@ ps ps-am tags tags-am uninstall uninstall-am \ uninstall-includeHEADERS +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcms2-2.8/lcms2.pc.in lcms2-2.9/lcms2.pc.in --- lcms2-2.8/lcms2.pc.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/lcms2.pc.in 2017-11-20 20:59:38.000000000 +0000 @@ -7,5 +7,5 @@ Description: LCMS Color Management Library Version: @VERSION@ Libs: -L${libdir} -llcms2 -Libs.private: @LIB_MATH@ +Libs.private: @LIB_MATH@ @LIB_THREAD@ Cflags: -I${includedir} diff -Nru lcms2-2.8/m4/ax_append_compile_flags.m4 lcms2-2.9/m4/ax_append_compile_flags.m4 --- lcms2-2.8/m4/ax_append_compile_flags.m4 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/m4/ax_append_compile_flags.m4 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,67 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the compiler works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. During the check the flag is always added to the +# current language's flags. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and +# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with +# AX_APPEND_LINK_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_APPEND_COMPILE_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) +done +])dnl AX_APPEND_COMPILE_FLAGS diff -Nru lcms2-2.8/m4/ax_append_flag.m4 lcms2-2.9/m4/ax_append_flag.m4 --- lcms2-2.8/m4/ax_append_flag.m4 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/m4/ax_append_flag.m4 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,71 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AC_DEFUN([AX_APPEND_FLAG], +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff -Nru lcms2-2.8/m4/ax_check_compile_flag.m4 lcms2-2.9/m4/ax_check_compile_flag.m4 --- lcms2-2.8/m4/ax_check_compile_flag.m4 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/m4/ax_check_compile_flag.m4 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,74 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# 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 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 4 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff -Nru lcms2-2.8/m4/ax_gcc_func_attribute.m4 lcms2-2.9/m4/ax_gcc_func_attribute.m4 --- lcms2-2.8/m4/ax_gcc_func_attribute.m4 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/m4/ax_gcc_func_attribute.m4 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,221 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. +# +# The macro caches its result in the ax_cv_have_func_attribute_ +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# flatten +# format +# format_arg +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsuppored function attributes will be tested with a prototype returning +# an int and not accepting any arguments and the result of the check might +# be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 3 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff -Nru lcms2-2.8/m4/ax_require_defined.m4 lcms2-2.9/m4/ax_require_defined.m4 --- lcms2-2.8/m4/ax_require_defined.m4 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/m4/ax_require_defined.m4 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,37 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_REQUIRE_DEFINED(MACRO) +# +# DESCRIPTION +# +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have +# been defined and thus are available for use. This avoids random issues +# where a macro isn't expanded. Instead the configure script emits a +# non-fatal: +# +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found +# +# It's like AC_REQUIRE except it doesn't expand the required macro. +# +# Here's an example: +# +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +# +# LICENSE +# +# Copyright (c) 2014 Mike Frysinger +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) +])dnl AX_REQUIRE_DEFINED diff -Nru lcms2-2.8/m4/libtool.m4 lcms2-2.9/m4/libtool.m4 --- lcms2-2.8/m4/libtool.m4 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/m4/libtool.m4 2017-11-20 20:59:38.000000000 +0000 @@ -641,7 +641,7 @@ Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." +gives unlimited permission to copy, distribute and modify it." while test $[#] != 0 do diff -Nru lcms2-2.8/Makefile.in lcms2-2.9/Makefile.in --- lcms2-2.8/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Makefile.in 2017-11-21 08:22:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,17 @@ # VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -83,18 +93,20 @@ build_triplet = @build@ host_triplet = @host@ subdir = . -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/configure $(am__configure_deps) \ - $(srcdir)/lcms2.pc.in AUTHORS COPYING ChangeLog INSTALL \ - compile config.guess config.sub depcomp install-sh missing \ - ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d @@ -185,6 +197,9 @@ CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/lcms2.pc.in AUTHORS \ + COPYING ChangeLog INSTALL compile config.guess config.sub \ + depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -358,6 +373,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -399,7 +415,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -638,15 +653,15 @@ $(am__post_remove_distdir) dist-tarZ: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) @@ -681,17 +696,17 @@ esac chmod -R a-w $(distdir) chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_inst + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build \ - && ../configure \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=.. --prefix="$$dc_install_base" \ + --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ @@ -873,6 +888,8 @@ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-local uninstall-pkgconfigDATA +.PRECIOUS: Makefile + # Make sure get rid of VC stuff... clean-local: diff -Nru lcms2-2.8/Projects/BorlandC_5.5/lcmsdll.lk lcms2-2.9/Projects/BorlandC_5.5/lcmsdll.lk --- lcms2-2.8/Projects/BorlandC_5.5/lcmsdll.lk 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/BorlandC_5.5/lcmsdll.lk 2017-11-20 20:59:38.000000000 +0000 @@ -1,4 +1,5 @@ /x/aa/c/Tpd C0D32.OBJ+ +cmsalpha.obj+ cmscam02.obj+ cmscgats.obj+ cmscnvrt.obj+ diff -Nru lcms2-2.8/Projects/VC2010/lcms2.rc lcms2-2.9/Projects/VC2010/lcms2.rc --- lcms2-2.8/Projects/VC2010/lcms2.rc 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2010/lcms2.rc 2017-11-20 20:59:38.000000000 +0000 @@ -45,12 +45,12 @@ BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.8.0.0" + VALUE "FileVersion", "2.9.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2015" + VALUE "LegalCopyright", "Copyright © Marti Maria 2017" VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.8.0.0" + VALUE "ProductVersion", "2.9.0.0" END END BLOCK "VarFileInfo" diff -Nru lcms2-2.8/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcxproj lcms2-2.9/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcxproj --- lcms2-2.8/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcxproj 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2012/lcms2_DLL/lcms2_DLL.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -206,6 +206,7 @@ + diff -Nru lcms2-2.8/Projects/VC2012/lcms2.rc lcms2-2.9/Projects/VC2012/lcms2.rc --- lcms2-2.8/Projects/VC2012/lcms2.rc 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2012/lcms2.rc 2017-11-20 20:59:38.000000000 +0000 @@ -27,8 +27,8 @@ // 1 VERSIONINFO - FILEVERSION 2,8,0,0 - PRODUCTVERSION 2,8,0,0 + FILEVERSION 2,9,0,0 + PRODUCTVERSION 2,9,0,0 FILEFLAGSMASK 0x0L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.8.0.0" + VALUE "FileVersion", "2.9.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2015" + VALUE "LegalCopyright", "Copyright © Marti Maria 2017" VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.8.0.0" + VALUE "ProductVersion", "2.9.0.0" END END BLOCK "VarFileInfo" diff -Nru lcms2-2.8/Projects/VC2012/lcms2_static/lcms2_static.vcxproj lcms2-2.9/Projects/VC2012/lcms2_static/lcms2_static.vcxproj --- lcms2-2.8/Projects/VC2012/lcms2_static/lcms2_static.vcxproj 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2012/lcms2_static/lcms2_static.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -168,6 +168,7 @@ + diff -Nru lcms2-2.8/Projects/VC2013/lcms2.rc lcms2-2.9/Projects/VC2013/lcms2.rc --- lcms2-2.8/Projects/VC2013/lcms2.rc 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2013/lcms2.rc 2017-11-20 20:59:38.000000000 +0000 @@ -27,8 +27,8 @@ // 1 VERSIONINFO - FILEVERSION 2,8,0,0 - PRODUCTVERSION 2,8,0,0 + FILEVERSION 2,9,0,0 + PRODUCTVERSION 2,9,0,0 FILEFLAGSMASK 0x0L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.8.0.0" + VALUE "FileVersion", "2.9.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2015" + VALUE "LegalCopyright", "Copyright © Marti Maria 2017" VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.8.0.0" + VALUE "ProductVersion", "2.9.0.0" END END BLOCK "VarFileInfo" diff -Nru lcms2-2.8/Projects/VC2015/lcms2.rc lcms2-2.9/Projects/VC2015/lcms2.rc --- lcms2-2.8/Projects/VC2015/lcms2.rc 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2015/lcms2.rc 2017-11-20 20:59:38.000000000 +0000 @@ -27,8 +27,8 @@ // 1 VERSIONINFO - FILEVERSION 2,8,0,0 - PRODUCTVERSION 2,8,0,0 + FILEVERSION 2,9,0,0 + PRODUCTVERSION 2,9,0,0 FILEFLAGSMASK 0x0L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN VALUE "CompanyName", "Marti Maria" VALUE "FileDescription", "lcms color engine" - VALUE "FileVersion", "2.8.0.0" + VALUE "FileVersion", "2.9.0.0" VALUE "InternalName", "lcms" - VALUE "LegalCopyright", "Copyright © Marti Maria 2016" + VALUE "LegalCopyright", "Copyright © Marti Maria 2017" VALUE "OriginalFilename", "lcms2.dll" VALUE "ProductName", "LittleCMS color engine" - VALUE "ProductVersion", "2.8.0.0" + VALUE "ProductVersion", "2.9.0.0" END END BLOCK "VarFileInfo" diff -Nru lcms2-2.8/Projects/VC2015/tifficc/tifficc.vcxproj lcms2-2.9/Projects/VC2015/tifficc/tifficc.vcxproj --- lcms2-2.8/Projects/VC2015/tifficc/tifficc.vcxproj 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/Projects/VC2015/tifficc/tifficc.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -89,14 +89,14 @@ - $(IncludePath);C:\tiff-4.0.2\libtiff - $(IncludePath);C:\tiff-4.0.2\libtiff - $(LibraryPath);C:\tiff-4.0.2\libtiff - $(LibraryPath);C:\tiff-4.0.2\libtiff - $(IncludePath);C:\tiff-4.0.2\libtiff - $(IncludePath);C:\tiff-4.0.2\libtiff - $(LibraryPath);C:\tiff-4.0.2\libtiff - $(LibraryPath);C:\tiff-4.0.2\libtiff + $(IncludePath);C:\code\tiff-4.0.3\libtiff + $(IncludePath);C:\code\tiff-4.0.3\libtiff + $(LibraryPath);C:\code\tiff-4.0.3\libtiff + $(LibraryPath);C:\code\tiff-4.0.3\libtiff + $(IncludePath);C:\code\tiff-4.0.3\libtiff + $(IncludePath);C:\code\tiff-4.0.3\libtiff + $(LibraryPath);C:\code\tiff-4.0.3\libtiff + $(LibraryPath);C:\code\tiff-4.0.3\libtiff diff -Nru lcms2-2.8/Projects/VC2017/jpegicc/jpegicc.vcxproj lcms2-2.9/Projects/VC2017/jpegicc/jpegicc.vcxproj --- lcms2-2.8/Projects/VC2017/jpegicc/jpegicc.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/jpegicc/jpegicc.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,214 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {62812507-F926-4968-96A9-17678460AD90} + jpegicc + Win32Proj + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)\ + $(Configuration)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)\ + $(Configuration)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + $(IncludePath);;C:\code\jpeg-9a + $(IncludePath);;C:\code\jpeg-9a + $(LibraryPath);;C:\code\jpeg-9a + $(LibraryPath);;C:\code\jpeg-9a + $(IncludePath);;C:\code\jpeg-9a + $(IncludePath);;C:\code\jpeg-9a + $(LibraryPath);;C:\code\jpeg-9a + $(LibraryPath);;C:\code\jpeg-9a + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + true + + + libjpeg.lib;%(AdditionalDependencies) + true + Console + MachineX86 + false + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + + + libjpeg.lib;%(AdditionalDependencies) + true + Console + false + + + + + Full + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + Speed + true + true + true + true + + + libjpeg.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + false + + + true + + + + + Full + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + Speed + true + true + true + + + libjpeg.lib;%(AdditionalDependencies) + true + Console + true + true + false + + + + + + + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/jpegicc/jpegicc.vcxproj.filters lcms2-2.9/Projects/VC2017/jpegicc/jpegicc.vcxproj.filters --- lcms2-2.8/Projects/VC2017/jpegicc/jpegicc.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/jpegicc/jpegicc.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj lcms2-2.9/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj --- lcms2-2.8/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,251 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {8C51BE48-ADB8-4089-A9EC-F6BF993A0548} + lcms2_DLL + Win32Proj + 8.1 + + + + DynamicLibrary + Unicode + true + v141 + + + DynamicLibrary + Unicode + true + v141 + + + DynamicLibrary + Unicode + v141 + + + DynamicLibrary + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + lcms2 + + + lcms2 + + + lcms2 + + + lcms2 + + + + Disabled + ../../../include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + true + false + + + ..\..\..\src\lcms2.def + true + Windows + MachineX86 + + + + + Disabled + ../../../include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + true + false + + + + + true + Windows + $(OutDir)$(TargetName)$(TargetExt) + + + + + Full + true + Speed + true + true + true + ../../../include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level4 + true + OnlyExplicitInline + true + + + ..\..\..\src\lcms2.def + true + Windows + true + true + MachineX86 + + + true + + + + + Full + true + Speed + true + true + true + ../../../include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;CMS_DLL_BUILD;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level4 + true + OnlyExplicitInline + true + + + + + true + Windows + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj.filters lcms2-2.9/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj.filters --- lcms2-2.8/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/lcms2_DLL/lcms2_DLL.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,121 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Source Files + + + Resource Files + + + + + Resource Files + + + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/lcms2.rc lcms2-2.9/Projects/VC2017/lcms2.rc --- lcms2-2.8/Projects/VC2017/lcms2.rc 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/lcms2.rc 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,104 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Spanish (Spain, International Sort) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN) +LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +1 VERSIONINFO + FILEVERSION 2,9,0,0 + PRODUCTVERSION 2,9,0,0 + FILEFLAGSMASK 0x0L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "Marti Maria" + VALUE "FileDescription", "lcms color engine" + VALUE "FileVersion", "2.9.0.0" + VALUE "InternalName", "lcms" + VALUE "LegalCopyright", "Copyright © Marti Maria 2017" + VALUE "OriginalFilename", "lcms2.dll" + VALUE "ProductName", "LittleCMS color engine" + VALUE "ProductVersion", "2.9.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Spanish (Spain, International Sort) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/Projects/VC2017/lcms2.sln and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/Projects/VC2017/lcms2.sln differ diff -Nru lcms2-2.8/Projects/VC2017/lcms2_static/lcms2_static.vcxproj lcms2-2.9/Projects/VC2017/lcms2_static/lcms2_static.vcxproj --- lcms2-2.8/Projects/VC2017/lcms2_static/lcms2_static.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/lcms2_static/lcms2_static.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,208 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {71DEDE59-3F1E-486B-A899-4283000F76B5} + lcms2_static + Win32Proj + 8.1 + + + + StaticLibrary + Unicode + true + v141 + + + StaticLibrary + Unicode + true + v141 + + + StaticLibrary + Unicode + v141 + + + StaticLibrary + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\Lib\MS\ + ..\..\..\Lib\MS\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + ..\..\..\Lib\MS\ + ..\..\..\Lib\MS\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + ../../../include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + + + Level4 + EditAndContinue + + + true + MultiThreadedDebugDLL + + + + + Disabled + ../../../include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level4 + ProgramDatabase + + + true + Default + + + + + MaxSpeed + true + ../../../include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + Speed + true + false + OnlyExplicitInline + false + true + Precise + false + false + true + + + true + + + + + MaxSpeed + true + ../../../include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level4 + ProgramDatabase + Speed + true + true + OnlyExplicitInline + false + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/lcms2_static/lcms2_static.vcxproj.filters lcms2-2.9/Projects/VC2017/lcms2_static/lcms2_static.vcxproj.filters --- lcms2-2.8/Projects/VC2017/lcms2_static/lcms2_static.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/lcms2_static/lcms2_static.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,108 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/linkicc/linkicc.vcxproj lcms2-2.9/Projects/VC2017/linkicc/linkicc.vcxproj --- lcms2-2.8/Projects/VC2017/linkicc/linkicc.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/linkicc/linkicc.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,192 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {FBFBE1DC-DB84-4BA1-9552-B4780F457849} + linkicc + Win32Proj + 8.1 + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDLL + + + Level4 + EditAndContinue + true + + + true + Console + MachineX86 + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level4 + ProgramDatabase + true + + + true + Console + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + true + + + true + Console + true + true + MachineX86 + + + true + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + + + true + Console + true + true + + + + + + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/linkicc/linkicc.vcxproj.filters lcms2-2.9/Projects/VC2017/linkicc/linkicc.vcxproj.filters --- lcms2-2.8/Projects/VC2017/linkicc/linkicc.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/linkicc/linkicc.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,28 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/psicc/psicc.vcxproj lcms2-2.9/Projects/VC2017/psicc/psicc.vcxproj --- lcms2-2.8/Projects/VC2017/psicc/psicc.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/psicc/psicc.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,192 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {EF6A8851-65FE-46F5-B9EF-14F0B671F693} + psicc + Win32Proj + 8.1 + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + true + + + true + Console + MachineX86 + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + + + true + Console + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level4 + ProgramDatabase + true + true + + + true + Console + true + true + MachineX86 + + + true + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level4 + ProgramDatabase + true + + + true + Console + true + true + + + + + + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/psicc/psicc.vcxproj.filters lcms2-2.9/Projects/VC2017/psicc/psicc.vcxproj.filters --- lcms2-2.8/Projects/VC2017/psicc/psicc.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/psicc/psicc.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,28 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/resource.h lcms2-2.9/Projects/VC2017/resource.h --- lcms2-2.8/Projects/VC2017/resource.h 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/resource.h 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by lcms2.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff -Nru lcms2-2.8/Projects/VC2017/testbed/testbed.vcxproj lcms2-2.9/Projects/VC2017/testbed/testbed.vcxproj --- lcms2-2.8/Projects/VC2017/testbed/testbed.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/testbed/testbed.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,208 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {928A3A2B-46EF-4279-959C-513B3652FF0E} + testbed + Win32Proj + 8.1 + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\testbed\ + ..\..\..\testbed\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + ..\..\..\testbed\ + ..\..\..\testbed\ + + + + Disabled + ../../../include;../../../src;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + true + + + true + Console + MachineX86 + false + + + + + Disabled + ../../../include;../../../src;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level3 + ProgramDatabase + true + + + true + Console + false + + + + + Full + true + Speed + true + false + ../../../include;../../../src;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + false + true + NotSet + + + Level3 + ProgramDatabase + Cdecl + true + true + + + true + Console + true + true + MachineX86 + false + + + true + + + + + Full + true + Speed + true + true + ../../../include;../../../src;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + false + true + NotSet + + + Level3 + ProgramDatabase + Cdecl + true + + + true + Console + true + true + false + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/testbed/testbed.vcxproj.filters lcms2-2.9/Projects/VC2017/testbed/testbed.vcxproj.filters --- lcms2-2.8/Projects/VC2017/testbed/testbed.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/testbed/testbed.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,28 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/tiffdiff/tiffdiff.vcxproj lcms2-2.9/Projects/VC2017/tiffdiff/tiffdiff.vcxproj --- lcms2-2.8/Projects/VC2017/tiffdiff/tiffdiff.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/tiffdiff/tiffdiff.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,210 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {75B91835-CCD7-48BE-A606-A9C997D5DBEE} + tiffdiff + Win32Proj + 8.1 + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath) + C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath) + C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath) + C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath) + C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath) + C:\jpeg-8d;c:\tiff-4.0.2\libtiff;$(IncludePath) + C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath) + C:\jpeg-8d;C:\tiff-4.0.2\libtiff;$(LibraryPath) + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + MachineX86 + false + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + + Level4 + ProgramDatabase + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + false + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + $(OutDir)$(TargetName)$(TargetExt) + false + + + true + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + true + true + $(OutDir)$(TargetName)$(TargetExt) + false + + + + + + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/tiffdiff/tiffdiff.vcxproj.filters lcms2-2.9/Projects/VC2017/tiffdiff/tiffdiff.vcxproj.filters --- lcms2-2.8/Projects/VC2017/tiffdiff/tiffdiff.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/tiffdiff/tiffdiff.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,28 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/tifficc/tifficc.vcxproj lcms2-2.9/Projects/VC2017/tifficc/tifficc.vcxproj --- lcms2-2.8/Projects/VC2017/tifficc/tifficc.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/tifficc/tifficc.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,211 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2256DE16-ED92-4A6F-9C54-F65BB61E64A2} + tifficc + Win32Proj + 8.1 + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + $(IncludePath);C:\tiff-4.0.2\libtiff + $(IncludePath);C:\tiff-4.0.2\libtiff + $(LibraryPath);C:\tiff-4.0.2\libtiff + $(LibraryPath);C:\tiff-4.0.2\libtiff + $(IncludePath);C:\tiff-4.0.2\libtiff + $(IncludePath);C:\tiff-4.0.2\libtiff + $(LibraryPath);C:\tiff-4.0.2\libtiff + $(LibraryPath);C:\tiff-4.0.2\libtiff + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + MachineX86 + false + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + false + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + true + true + MachineX86 + false + + + true + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + + + libtiff.lib;%(AdditionalDependencies) + true + Console + true + true + false + + + + + + + + + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/tifficc/tifficc.vcxproj.filters lcms2-2.9/Projects/VC2017/tifficc/tifficc.vcxproj.filters --- lcms2-2.8/Projects/VC2017/tifficc/tifficc.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/tifficc/tifficc.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,33 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/transicc/transicc.vcxproj lcms2-2.9/Projects/VC2017/transicc/transicc.vcxproj --- lcms2-2.8/Projects/VC2017/transicc/transicc.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/transicc/transicc.vcxproj 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,196 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {9EE22D66-C849-474C-9ED5-C3E141DAB160} + transicc + Win32Proj + + + + Application + Unicode + true + v141 + + + Application + Unicode + true + v141 + + + Application + Unicode + v141 + + + Application + Unicode + v141 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21006.1 + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + true + true + ..\..\..\bin\ + ..\..\..\bin\ + $(Configuration)_$(Platform)\ + $(Configuration)_$(Platform)\ + false + false + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + true + + + true + Console + MachineX86 + + + + + Disabled + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + ProgramDatabase + true + + + true + Console + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level4 + ProgramDatabase + true + true + + + true + Console + true + true + MachineX86 + + + true + + + + + MaxSpeed + true + ../../../include;../../../utils/common;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + + + Level4 + ProgramDatabase + true + + + true + Console + true + true + + + + + false + + + + + + + + + + {71dede59-3f1e-486b-a899-4283000f76b5} + false + + + + + + \ No newline at end of file diff -Nru lcms2-2.8/Projects/VC2017/transicc/transicc.vcxproj.filters lcms2-2.9/Projects/VC2017/transicc/transicc.vcxproj.filters --- lcms2-2.8/Projects/VC2017/transicc/transicc.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ lcms2-2.9/Projects/VC2017/transicc/transicc.vcxproj.filters 2017-11-20 20:59:38.000000000 +0000 @@ -0,0 +1,33 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + \ No newline at end of file diff -Nru lcms2-2.8/src/cmsalpha.c lcms2-2.9/src/cmsalpha.c --- lcms2-2.8/src/cmsalpha.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsalpha.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -26,7 +26,6 @@ #include "lcms2_internal.h" - // Alpha copy ------------------------------------------------------------------------------------------------------------------ // Floor to byte, taking care of saturation @@ -42,16 +41,16 @@ // Return the size in bytes of a given formatter static -int trueBytesSize(cmsUInt32Number Format) +cmsUInt32Number trueBytesSize(cmsUInt32Number Format) { - int fmt_bytes = T_BYTES(Format); + cmsUInt32Number fmt_bytes = T_BYTES(Format); - // For double, the T_BYTES field returns zero - if (fmt_bytes == 0) - return sizeof(double); - - // Otherwise, it is already correct for all formats - return fmt_bytes; + // For double, the T_BYTES field returns zero + if (fmt_bytes == 0) + return sizeof(double); + + // Otherwise, it is already correct for all formats + return fmt_bytes; } @@ -90,8 +89,13 @@ static void from8toHLF(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT cmsFloat32Number n = (*(cmsUInt8Number*)src) / 255.0f; *(cmsUInt16Number*)dst = _cmsFloat2Half(n); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } // From 16 @@ -122,8 +126,13 @@ static void from16toHLF(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT cmsFloat32Number n = (*(cmsUInt16Number*)src) / 65535.0f; *(cmsUInt16Number*)dst = _cmsFloat2Half(n); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } // From Float @@ -158,8 +167,13 @@ static void fromFLTtoHLF(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT cmsFloat32Number n = *(cmsFloat32Number*)src; *(cmsUInt16Number*)dst = _cmsFloat2Half(n); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } @@ -168,27 +182,48 @@ static void fromHLFto8(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src); *(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif + } static void fromHLFto16(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src); *(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } static void fromHLFtoFLT(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT *(cmsFloat32Number*)dst = _cmsHalf2Float(*(cmsUInt16Number*)src); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } static void fromHLFtoDBL(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT *(cmsFloat64Number*)dst = (cmsFloat64Number)_cmsHalf2Float(*(cmsUInt16Number*)src); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } // From double @@ -216,8 +251,13 @@ static void fromDBLtoHLF(void* dst, const void* src) { +#ifndef CMS_NO_HALF_SUPPORT cmsFloat32Number n = (cmsFloat32Number) *(cmsFloat64Number*)src; *(cmsUInt16Number*)dst = _cmsFloat2Half(n); +#else + cmsUNUSED_PARAMETER(dst); + cmsUNUSED_PARAMETER(src); +#endif } static @@ -231,21 +271,22 @@ static int FormatterPos(cmsUInt32Number frm) { - int b = T_BYTES(frm); - - if (b == 0 && T_FLOAT(frm)) - return 4; // DBL - if (b == 2 && T_FLOAT(frm)) - return 2; // HLF - if (b == 4 && T_FLOAT(frm)) - return 3; // FLT - if (b == 2 && !T_FLOAT(frm)) - return 1; // 16 - if (b == 1 && !T_FLOAT(frm)) - return 0; // 8 + cmsUInt32Number b = T_BYTES(frm); - return -1; // not recognized + if (b == 0 && T_FLOAT(frm)) + return 4; // DBL +#ifndef CMS_NO_HALF_SUPPORT + if (b == 2 && T_FLOAT(frm)) + return 2; // HLF +#endif + if (b == 4 && T_FLOAT(frm)) + return 3; // FLT + if (b == 2 && !T_FLOAT(frm)) + return 1; // 16 + if (b == 1 && !T_FLOAT(frm)) + return 0; // 8 + return -1; // not recognized } // Obtains a alpha-to-alpha funmction formatter @@ -281,12 +322,12 @@ cmsUInt32Number ComponentPointerIncrements[]) { cmsUInt32Number channels[cmsMAXCHANNELS]; - int extra = T_EXTRA(Format); - int nchannels = T_CHANNELS(Format); - int total_chans = nchannels + extra; - int i; - int channelSize = trueBytesSize(Format); - int pixelSize = channelSize * total_chans; + cmsUInt32Number extra = T_EXTRA(Format); + cmsUInt32Number nchannels = T_CHANNELS(Format); + cmsUInt32Number total_chans = nchannels + extra; + cmsUInt32Number i; + cmsUInt32Number channelSize = trueBytesSize(Format); + cmsUInt32Number pixelSize = channelSize * total_chans; // Sanity check if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS) @@ -339,11 +380,11 @@ cmsUInt32Number ComponentPointerIncrements[]) { cmsUInt32Number channels[cmsMAXCHANNELS]; - int extra = T_EXTRA(Format); - int nchannels = T_CHANNELS(Format); - int total_chans = nchannels + extra; - int i; - int channelSize = trueBytesSize(Format); + cmsUInt32Number extra = T_EXTRA(Format); + cmsUInt32Number nchannels = T_CHANNELS(Format); + cmsUInt32Number total_chans = nchannels + extra; + cmsUInt32Number i; + cmsUInt32Number channelSize = trueBytesSize(Format); // Sanity check if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS) diff -Nru lcms2-2.8/src/cmscam02.c lcms2-2.9/src/cmscam02.c --- lcms2-2.8/src/cmscam02.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmscam02.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/src/cmscgats.c lcms2-2.9/src/cmscgats.c --- lcms2-2.8/src/cmscgats.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmscgats.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -147,23 +147,24 @@ SUBALLOCATOR Allocator; // String suballocator -- just to keep it fast // Parser state machine - SYMBOL sy; // Current symbol - int ch; // Current character + SYMBOL sy; // Current symbol + int ch; // Current character + + cmsInt32Number inum; // integer value + cmsFloat64Number dnum; // real value - int inum; // integer value - cmsFloat64Number dnum; // real value char id[MAXID]; // identifier char str[MAXSTR]; // string // Allowed keywords & datasets. They have visibility on whole stream - KEYVALUE* ValidKeywords; - KEYVALUE* ValidSampleID; + KEYVALUE* ValidKeywords; + KEYVALUE* ValidSampleID; char* Source; // Points to loc. being parsed - int lineno; // line counter for error reporting + cmsInt32Number lineno; // line counter for error reporting FILECTX* FileStack[MAXINCLUDE]; // Stack of files being parsed - int IncludeSP; // Include Stack Pointer + cmsInt32Number IncludeSP; // Include Stack Pointer char* MemoryBlock; // The stream if holded in memory @@ -236,65 +237,64 @@ {"PROD_DATE", WRITE_STRINGIFY}, // Identifies year and month of production of the target in the form yyyy:mm. {"SERIAL", WRITE_STRINGIFY}, // Uniquely identifies individual physical target. - {"MATERIAL", WRITE_STRINGIFY}, // Identifies the material on which the target was produced using a code - // uniquely identifying th e material. This is intend ed to be used for IT8.7 - // physical targets only (i.e . IT8.7/1 a nd IT8.7/2). - - {"INSTRUMENTATION", WRITE_STRINGIFY}, // Used to report the specific instrumentation used (manufacturer and - // model number) to generate the data reported. This data will often - // provide more information about the particular data collected than an - // extensive list of specific details. This is particularly important for - // spectral data or data derived from spectrophotometry. - - {"MEASUREMENT_SOURCE", WRITE_STRINGIFY}, // Illumination used for spectral measurements. This data helps provide - // a guide to the potential for issues of paper fluorescence, etc. - - {"PRINT_CONDITIONS", WRITE_STRINGIFY}, // Used to define the characteristics of the printed sheet being reported. - // Where standard conditions have been defined (e.g., SWOP at nominal) - // named conditions may suffice. Otherwise, detailed information is - // needed. - - {"SAMPLE_BACKING", WRITE_STRINGIFY}, // Identifies the backing material used behind the sample during - // measurement. Allowed values are “black”, “white”, or {"na". - - {"CHISQ_DOF", WRITE_STRINGIFY}, // Degrees of freedom associated with the Chi squared statistic - - // below properties are new in recent specs: + {"MATERIAL", WRITE_STRINGIFY}, // Identifies the material on which the target was produced using a code + // uniquely identifying th e material. This is intend ed to be used for IT8.7 + // physical targets only (i.e . IT8.7/1 a nd IT8.7/2). + + {"INSTRUMENTATION", WRITE_STRINGIFY}, // Used to report the specific instrumentation used (manufacturer and + // model number) to generate the data reported. This data will often + // provide more information about the particular data collected than an + // extensive list of specific details. This is particularly important for + // spectral data or data derived from spectrophotometry. + + {"MEASUREMENT_SOURCE", WRITE_STRINGIFY}, // Illumination used for spectral measurements. This data helps provide + // a guide to the potential for issues of paper fluorescence, etc. + + {"PRINT_CONDITIONS", WRITE_STRINGIFY}, // Used to define the characteristics of the printed sheet being reported. + // Where standard conditions have been defined (e.g., SWOP at nominal) + // named conditions may suffice. Otherwise, detailed information is + // needed. + + {"SAMPLE_BACKING", WRITE_STRINGIFY}, // Identifies the backing material used behind the sample during + // measurement. Allowed values are “black”, “white”, or {"na". + + {"CHISQ_DOF", WRITE_STRINGIFY}, // Degrees of freedom associated with the Chi squared statistic + // below properties are new in recent specs: {"MEASUREMENT_GEOMETRY", WRITE_STRINGIFY}, // The type of measurement, either reflection or transmission, should be indicated - // along with details of the geometry and the aperture size and shape. For example, - // for transmission measurements it is important to identify 0/diffuse, diffuse/0, - // opal or integrating sphere, etc. For reflection it is important to identify 0/45, - // 45/0, sphere (specular included or excluded), etc. - - {"FILTER", WRITE_STRINGIFY}, // Identifies the use of physical filter(s) during measurement. Typically used to - // denote the use of filters such as none, D65, Red, Green or Blue. - - {"POLARIZATION", WRITE_STRINGIFY}, // Identifies the use of a physical polarization filter during measurement. Allowed - // values are {"yes”, “white”, “none” or “na”. - - {"WEIGHTING_FUNCTION", WRITE_PAIR}, // Indicates such functions as: the CIE standard observer functions used in the - // calculation of various data parameters (2 degree and 10 degree), CIE standard - // illuminant functions used in the calculation of various data parameters (e.g., D50, - // D65, etc.), density status response, etc. If used there shall be at least one - // name-value pair following the WEIGHTING_FUNCTION tag/keyword. The first attribute - // in the set shall be {"name" and shall identify the particular parameter used. - // The second shall be {"value" and shall provide the value associated with that name. - // For ASCII data, a string containing the Name and Value attribute pairs shall follow - // the weighting function keyword. A semi-colon separates attribute pairs from each - // other and within the attribute the name and value are separated by a comma. - - {"COMPUTATIONAL_PARAMETER", WRITE_PAIR}, // Parameter that is used in computing a value from measured data. Name is the name - // of the calculation, parameter is the name of the parameter used in the calculation - // and value is the value of the parameter. - - {"TARGET_TYPE", WRITE_STRINGIFY}, // The type of target being measured, e.g. IT8.7/1, IT8.7/3, user defined, etc. - - {"COLORANT", WRITE_STRINGIFY}, // Identifies the colorant(s) used in creating the target. - - {"TABLE_DESCRIPTOR", WRITE_STRINGIFY}, // Describes the purpose or contents of a data table. - - {"TABLE_NAME", WRITE_STRINGIFY} // Provides a short name for a data table. + // along with details of the geometry and the aperture size and shape. For example, + // for transmission measurements it is important to identify 0/diffuse, diffuse/0, + // opal or integrating sphere, etc. For reflection it is important to identify 0/45, + // 45/0, sphere (specular included or excluded), etc. + + {"FILTER", WRITE_STRINGIFY}, // Identifies the use of physical filter(s) during measurement. Typically used to + // denote the use of filters such as none, D65, Red, Green or Blue. + + {"POLARIZATION", WRITE_STRINGIFY}, // Identifies the use of a physical polarization filter during measurement. Allowed + // values are {"yes”, “white”, “none” or “na”. + + {"WEIGHTING_FUNCTION", WRITE_PAIR}, // Indicates such functions as: the CIE standard observer functions used in the + // calculation of various data parameters (2 degree and 10 degree), CIE standard + // illuminant functions used in the calculation of various data parameters (e.g., D50, + // D65, etc.), density status response, etc. If used there shall be at least one + // name-value pair following the WEIGHTING_FUNCTION tag/keyword. The first attribute + // in the set shall be {"name" and shall identify the particular parameter used. + // The second shall be {"value" and shall provide the value associated with that name. + // For ASCII data, a string containing the Name and Value attribute pairs shall follow + // the weighting function keyword. A semi-colon separates attribute pairs from each + // other and within the attribute the name and value are separated by a comma. + + {"COMPUTATIONAL_PARAMETER", WRITE_PAIR}, // Parameter that is used in computing a value from measured data. Name is the name + // of the calculation, parameter is the name of the parameter used in the calculation + // and value is the value of the parameter. + + {"TARGET_TYPE", WRITE_STRINGIFY}, // The type of target being measured, e.g. IT8.7/1, IT8.7/3, user defined, etc. + + {"COLORANT", WRITE_STRINGIFY}, // Identifies the colorant(s) used in creating the target. + + {"TABLE_DESCRIPTOR", WRITE_STRINGIFY}, // Describes the purpose or contents of a data table. + + {"TABLE_NAME", WRITE_STRINGIFY} // Provides a short name for a data table. }; #define NUMPREDEFINEDPROPS (sizeof(PredefinedProperties)/sizeof(PROPERTY)) @@ -535,13 +535,13 @@ // Reads a Real number, tries to follow from integer number static -void ReadReal(cmsIT8* it8, int inum) +void ReadReal(cmsIT8* it8, cmsInt32Number inum) { - it8->dnum = (cmsFloat64Number) inum; + it8->dnum = (cmsFloat64Number)inum; while (isdigit(it8->ch)) { - it8->dnum = it8->dnum * 10.0 + (it8->ch - '0'); + it8->dnum = (cmsFloat64Number)it8->dnum * 10.0 + (cmsFloat64Number)(it8->ch - '0'); NextCh(it8); } @@ -554,7 +554,7 @@ while (isdigit(it8->ch)) { - frac = frac * 10.0 + (it8->ch - '0'); + frac = frac * 10.0 + (cmsFloat64Number)(it8->ch - '0'); prec++; NextCh(it8); } @@ -565,8 +565,8 @@ // Exponent, example 34.00E+20 if (toupper(it8->ch) == 'E') { - int e; - int sgn; + cmsInt32Number e; + cmsInt32Number sgn; NextCh(it8); sgn = 1; @@ -581,17 +581,19 @@ NextCh(it8); } - e = 0; - while (isdigit(it8->ch)) { + e = 0; + while (isdigit(it8->ch)) { - if ((cmsFloat64Number) e * 10L < INT_MAX) - e = e * 10 + (it8->ch - '0'); + cmsInt32Number digit = (it8->ch - '0'); - NextCh(it8); - } + if ((cmsFloat64Number)e * 10.0 + (cmsFloat64Number)digit < (cmsFloat64Number)+2147483647.0) + e = e * 10 + digit; + + NextCh(it8); + } - e = sgn*e; - it8 -> dnum = it8 -> dnum * xpow10(e); + e = sgn*e; + it8->dnum = it8->dnum * xpow10(e); } } @@ -609,12 +611,12 @@ if (*Buffer == '-' || *Buffer == '+') { - sign = (*Buffer == '-') ? -1 : 1; - Buffer++; + sign = (*Buffer == '-') ? -1 : 1; + Buffer++; } - while (*Buffer && isdigit((int) *Buffer)) { + while (*Buffer && isdigit((int)*Buffer)) { dnum = dnum * 10.0 + (*Buffer - '0'); if (*Buffer) Buffer++; @@ -623,11 +625,11 @@ if (*Buffer == '.') { cmsFloat64Number frac = 0.0; // fraction - int prec = 0; // precission + int prec = 0; // precision if (*Buffer) Buffer++; - while (*Buffer && isdigit((int) *Buffer)) { + while (*Buffer && isdigit((int)*Buffer)) { frac = frac * 10.0 + (*Buffer - '0'); prec++; @@ -658,17 +660,19 @@ if (*Buffer) Buffer++; } - e = 0; - while (*Buffer && isdigit((int) *Buffer)) { + e = 0; + while (*Buffer && isdigit((int)*Buffer)) { - if ((cmsFloat64Number) e * 10L < INT_MAX) - e = e * 10 + (*Buffer - '0'); + cmsInt32Number digit = (*Buffer - '0'); - if (*Buffer) Buffer++; - } + if ((cmsFloat64Number)e * 10.0 + digit < (cmsFloat64Number)+2147483647.0) + e = e * 10 + digit; - e = sgn*e; - dnum = dnum * xpow10(e); + if (*Buffer) Buffer++; + } + + e = sgn*e; + dnum = dnum * xpow10(e); } return sign * dnum; @@ -737,7 +741,7 @@ if (it8->ch >= 'A' && it8->ch <= 'F') j = it8->ch -'A'+10; else j = it8->ch - '0'; - if ((long) it8->inum * 16L > (long) INT_MAX) + if ((cmsFloat64Number) it8->inum * 16.0 + (cmsFloat64Number) j > (cmsFloat64Number)+2147483647.0) { SynError(it8, "Invalid hexadecimal number"); return; @@ -758,7 +762,7 @@ { j = it8->ch - '0'; - if ((long) it8->inum * 2L > (long) INT_MAX) + if ((cmsFloat64Number) it8->inum * 2.0 + j > (cmsFloat64Number)+2147483647.0) { SynError(it8, "Invalid binary number"); return; @@ -774,14 +778,16 @@ while (isdigit(it8->ch)) { - if ((long) it8->inum * 10L > (long) INT_MAX) { + cmsInt32Number digit = (it8->ch - '0'); + + if ((cmsFloat64Number) it8->inum * 10.0 + (cmsFloat64Number) digit > (cmsFloat64Number) +2147483647.0) { ReadReal(it8, it8->inum); it8->sy = SDNUM; it8->dnum *= sign; return; } - it8->inum = it8->inum * 10 + (it8->ch - '0'); + it8->inum = it8->inum * 10 + digit; NextCh(it8); } @@ -871,7 +877,7 @@ k = 0; NextCh(it8); - while (k < MAXSTR && it8->ch != sng) { + while (k < (MAXSTR-1) && it8->ch != sng) { if (it8->ch == '\n'|| it8->ch == '\r') k = MAXSTR+1; else { @@ -1486,8 +1492,8 @@ cmsBool CMSEXPORT cmsIT8SetDataFormat(cmsHANDLE h, int n, const char *Sample) { - cmsIT8* it8 = (cmsIT8*) h; - return SetDataFormat(it8, n, Sample); + cmsIT8* it8 = (cmsIT8*)h; + return SetDataFormat(it8, n, Sample); } static @@ -1512,8 +1518,8 @@ char* GetData(cmsIT8* it8, int nSet, int nField) { TABLE* t = GetTable(it8); - int nSamples = t -> nSamples; - int nPatches = t -> nPatches; + int nSamples = t -> nSamples; + int nPatches = t -> nPatches; if (nSet >= nPatches || nField >= nSamples) return NULL; @@ -1944,67 +1950,67 @@ case SIDENT: - strncpy(VarName, it8->id, MAXID-1); - VarName[MAXID-1] = 0; + strncpy(VarName, it8->id, MAXID - 1); + VarName[MAXID - 1] = 0; - if (!IsAvailableOnList(it8-> ValidKeywords, VarName, NULL, &Key)) { + if (!IsAvailableOnList(it8->ValidKeywords, VarName, NULL, &Key)) { #ifdef CMS_STRICT_CGATS - return SynError(it8, "Undefined keyword '%s'", VarName); + return SynError(it8, "Undefined keyword '%s'", VarName); #else - Key = AddAvailableProperty(it8, VarName, WRITE_UNCOOKED); - if (Key == NULL) return FALSE; + Key = AddAvailableProperty(it8, VarName, WRITE_UNCOOKED); + if (Key == NULL) return FALSE; #endif - } + } - InSymbol(it8); - if (!GetVal(it8, Buffer, MAXSTR-1, "Property data expected")) return FALSE; + InSymbol(it8); + if (!GetVal(it8, Buffer, MAXSTR - 1, "Property data expected")) return FALSE; - if(Key->WriteAs != WRITE_PAIR) { - AddToList(it8, &GetTable(it8)->HeaderList, VarName, NULL, Buffer, - (it8->sy == SSTRING) ? WRITE_STRINGIFY : WRITE_UNCOOKED); - } - else { - const char *Subkey; - char *Nextkey; - if (it8->sy != SSTRING) - return SynError(it8, "Invalid value '%s' for property '%s'.", Buffer, VarName); - - // chop the string as a list of "subkey, value" pairs, using ';' as a separator - for (Subkey = Buffer; Subkey != NULL; Subkey = Nextkey) - { - char *Value, *temp; - - // identify token pair boundary - Nextkey = (char*) strchr(Subkey, ';'); - if(Nextkey) - *Nextkey++ = '\0'; - - // for each pair, split the subkey and the value - Value = (char*) strrchr(Subkey, ','); - if(Value == NULL) - return SynError(it8, "Invalid value for property '%s'.", VarName); - - // gobble the spaces before the coma, and the coma itself - temp = Value++; - do *temp-- = '\0'; while(temp >= Subkey && *temp == ' '); - - // gobble any space at the right - temp = Value + strlen(Value) - 1; - while(*temp == ' ') *temp-- = '\0'; - - // trim the strings from the left - Subkey += strspn(Subkey, " "); - Value += strspn(Value, " "); - - if(Subkey[0] == 0 || Value[0] == 0) - return SynError(it8, "Invalid value for property '%s'.", VarName); - AddToList(it8, &GetTable(it8)->HeaderList, VarName, Subkey, Value, WRITE_PAIR); - } + if (Key->WriteAs != WRITE_PAIR) { + AddToList(it8, &GetTable(it8)->HeaderList, VarName, NULL, Buffer, + (it8->sy == SSTRING) ? WRITE_STRINGIFY : WRITE_UNCOOKED); + } + else { + const char *Subkey; + char *Nextkey; + if (it8->sy != SSTRING) + return SynError(it8, "Invalid value '%s' for property '%s'.", Buffer, VarName); + + // chop the string as a list of "subkey, value" pairs, using ';' as a separator + for (Subkey = Buffer; Subkey != NULL; Subkey = Nextkey) + { + char *Value, *temp; + + // identify token pair boundary + Nextkey = (char*)strchr(Subkey, ';'); + if (Nextkey) + *Nextkey++ = '\0'; + + // for each pair, split the subkey and the value + Value = (char*)strrchr(Subkey, ','); + if (Value == NULL) + return SynError(it8, "Invalid value for property '%s'.", VarName); + + // gobble the spaces before the coma, and the coma itself + temp = Value++; + do *temp-- = '\0'; while (temp >= Subkey && *temp == ' '); + + // gobble any space at the right + temp = Value + strlen(Value) - 1; + while (*temp == ' ') *temp-- = '\0'; + + // trim the strings from the left + Subkey += strspn(Subkey, " "); + Value += strspn(Value, " "); + + if (Subkey[0] == 0 || Value[0] == 0) + return SynError(it8, "Invalid value for property '%s'.", VarName); + AddToList(it8, &GetTable(it8)->HeaderList, VarName, Subkey, Value, WRITE_PAIR); } + } - InSymbol(it8); - break; + InSymbol(it8); + break; case SEOLN: break; @@ -2024,14 +2030,17 @@ static void ReadType(cmsIT8* it8, char* SheetTypePtr) { + cmsInt32Number cnt = 0; + // First line is a very special case. while (isseparator(it8->ch)) NextCh(it8); - while (it8->ch != '\r' && it8 ->ch != '\n' && it8->ch != '\t' && it8 -> ch != -1) { + while (it8->ch != '\r' && it8 ->ch != '\n' && it8->ch != '\t' && it8 -> ch != 0) { - *SheetTypePtr++= (char) it8 ->ch; + if (cnt++ < MAXSTR) + *SheetTypePtr++= (char) it8 ->ch; NextCh(it8); } @@ -2224,10 +2233,10 @@ // that should be something like some printable characters plus a \n // returns 0 if this is not like a CGATS, or an integer otherwise. This integer is the number of words in first line? static -int IsMyBlock(cmsUInt8Number* Buffer, int n) +int IsMyBlock(const cmsUInt8Number* Buffer, cmsUInt32Number n) { int words = 1, space = 0, quot = 0; - int i; + cmsUInt32Number i; if (n < 10) return 0; // Too small @@ -2288,7 +2297,7 @@ // ---------------------------------------------------------- Exported routines -cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, void *Ptr, cmsUInt32Number len) +cmsHANDLE CMSEXPORT cmsIT8LoadFromMem(cmsContext ContextID, const void *Ptr, cmsUInt32Number len) { cmsHANDLE hIT8; cmsIT8* it8; @@ -2297,7 +2306,7 @@ _cmsAssert(Ptr != NULL); _cmsAssert(len != 0); - type = IsMyBlock((cmsUInt8Number*)Ptr, len); + type = IsMyBlock((const cmsUInt8Number*)Ptr, len); if (type == 0) return NULL; hIT8 = cmsIT8Alloc(ContextID); @@ -2715,7 +2724,7 @@ { const char* cLabelFld; char Type[256], Label[256]; - int nTable; + cmsUInt32Number nTable; _cmsAssert(hIT8 != NULL); @@ -2728,7 +2737,7 @@ cLabelFld = cmsIT8GetData(hIT8, cSet, cField); if (!cLabelFld) return -1; - if (sscanf(cLabelFld, "%255s %d %255s", Label, &nTable, Type) != 3) + if (sscanf(cLabelFld, "%255s %u %255s", Label, &nTable, Type) != 3) return -1; if (ExpectedType != NULL && *ExpectedType == 0) diff -Nru lcms2-2.8/src/cmscnvrt.c lcms2-2.9/src/cmscnvrt.c --- lcms2-2.8/src/cmscnvrt.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmscnvrt.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -363,11 +363,12 @@ // Compute the conversion layer static -cmsBool ComputeConversion(int i, cmsHPROFILE hProfiles[], - cmsUInt32Number Intent, - cmsBool BPC, - cmsFloat64Number AdaptationState, - cmsMAT3* m, cmsVEC3* off) +cmsBool ComputeConversion(cmsUInt32Number i, + cmsHPROFILE hProfiles[], + cmsUInt32Number Intent, + cmsBool BPC, + cmsFloat64Number AdaptationState, + cmsMAT3* m, cmsVEC3* off) { int k; @@ -679,7 +680,7 @@ // Translate black-preserving intents to ICC ones static -int TranslateNonICCIntents(int Intent) +cmsUInt32Number TranslateNonICCIntents(cmsUInt32Number Intent) { switch (Intent) { case INTENT_PRESERVE_K_ONLY_PERCEPTUAL: diff -Nru lcms2-2.8/src/cmserr.c lcms2-2.9/src/cmserr.c --- lcms2-2.8/src/cmserr.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmserr.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -54,9 +54,11 @@ long int p , n; p = ftell(f); // register current file position + if (p == -1L) + return -1L; if (fseek(f, 0, SEEK_END) != 0) { - return -1; + return -1L; } n = ftell(f); @@ -86,7 +88,7 @@ // ********************************************************************************* // This is the default memory allocation function. It does a very coarse -// check of amout of memory, just to prevent exploits +// check of amount of memory, just to prevent exploits static void* _cmsMallocDefaultFn(cmsContext ContextID, cmsUInt32Number size) { @@ -193,7 +195,7 @@ } else { - // To reset it, we use the default allocators, which cannot be overriden + // To reset it, we use the default allocators, which cannot be overridden ctx ->chunks[MemPlugin] = &ctx ->DefaultMemoryManager; } } diff -Nru lcms2-2.8/src/cmsgamma.c lcms2-2.9/src/cmsgamma.c --- lcms2-2.8/src/cmsgamma.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsgamma.c 2017-11-20 20:59:38.000000000 +0000 @@ -44,10 +44,11 @@ // The list of supported parametric curves typedef struct _cmsParametricCurvesCollection_st { - int nFunctions; // Number of supported functions in this chunk - int FunctionTypes[MAX_TYPES_IN_LCMS_PLUGIN]; // The identification types - int ParameterCount[MAX_TYPES_IN_LCMS_PLUGIN]; // Number of parameters for each function - cmsParametricCurveEvaluator Evaluator; // The evaluator + cmsUInt32Number nFunctions; // Number of supported functions in this chunk + cmsInt32Number FunctionTypes[MAX_TYPES_IN_LCMS_PLUGIN]; // The identification types + cmsUInt32Number ParameterCount[MAX_TYPES_IN_LCMS_PLUGIN]; // Number of parameters for each function + + cmsParametricCurveEvaluator Evaluator; // The evaluator struct _cmsParametricCurvesCollection_st* Next; // Next in list @@ -165,7 +166,7 @@ { int i; - for (i=0; i < c ->nFunctions; i++) + for (i=0; i < (int) c ->nFunctions; i++) if (abs(Type) == c ->FunctionTypes[i]) return i; return -1; @@ -209,20 +210,20 @@ // no optimation curve is computed. nSegments may also be zero in the inverse case, where only the // optimization curve is given. Both features simultaneously is an error static -cmsToneCurve* AllocateToneCurveStruct(cmsContext ContextID, cmsInt32Number nEntries, - cmsInt32Number nSegments, const cmsCurveSegment* Segments, +cmsToneCurve* AllocateToneCurveStruct(cmsContext ContextID, cmsUInt32Number nEntries, + cmsUInt32Number nSegments, const cmsCurveSegment* Segments, const cmsUInt16Number* Values) { cmsToneCurve* p; - int i; + cmsUInt32Number i; // We allow huge tables, which are then restricted for smoothing operations - if (nEntries > 65530 || nEntries < 0) { + if (nEntries > 65530) { cmsSignalError(ContextID, cmsERROR_RANGE, "Couldn't create tone curve of more than 65530 entries"); return NULL; } - if (nEntries <= 0 && nSegments <= 0) { + if (nEntries == 0 && nSegments == 0) { cmsSignalError(ContextID, cmsERROR_RANGE, "Couldn't create tone curve with zero segments and no table"); return NULL; } @@ -232,7 +233,7 @@ if (!p) return NULL; // In this case, there are no segments - if (nSegments <= 0) { + if (nSegments == 0) { p ->Segments = NULL; p ->Evals = NULL; } @@ -248,7 +249,7 @@ // This 16-bit table contains a limited precision representation of the whole curve and is kept for // increasing xput on certain operations. - if (nEntries <= 0) { + if (nEntries == 0) { p ->Table16 = NULL; } else { @@ -274,7 +275,7 @@ p ->SegInterp = (cmsInterpParams**) _cmsCalloc(ContextID, nSegments, sizeof(cmsInterpParams*)); if (p ->SegInterp == NULL) goto Error; - for (i=0; i< nSegments; i++) { + for (i=0; i < nSegments; i++) { // Type 0 is a special marker for table-based curves if (Segments[i].Type == 0) @@ -330,7 +331,7 @@ // Type 1 Reversed: X = Y ^1/gamma case -1: - if (R < 0) { + if (R < 0) { if (fabs(Params[0] - 1.0) < MATRIX_DET_TOLERANCE) Val = R; @@ -338,80 +339,123 @@ Val = 0; } else - Val = pow(R, 1/Params[0]); + { + if (fabs(Params[0]) < MATRIX_DET_TOLERANCE) + Val = PLUS_INF; + else + Val = pow(R, 1 / Params[0]); + } break; // CIE 122-1966 // Y = (aX + b)^Gamma | X >= -b/a // Y = 0 | else case 2: - disc = -Params[2] / Params[1]; + { - if (R >= disc ) { + if (fabs(Params[1]) < MATRIX_DET_TOLERANCE) + { + Val = 0; + } + else + { + disc = -Params[2] / Params[1]; - e = Params[1]*R + Params[2]; + if (R >= disc) { - if (e > 0) - Val = pow(e, Params[0]); + e = Params[1] * R + Params[2]; + + if (e > 0) + Val = pow(e, Params[0]); + else + Val = 0; + } else Val = 0; } - else - Val = 0; - break; + } + break; // Type 2 Reversed // X = (Y ^1/g - b) / a case -2: - if (R < 0) + { + if (fabs(Params[0]) < MATRIX_DET_TOLERANCE || + fabs(Params[1]) < MATRIX_DET_TOLERANCE) + { Val = 0; + } else - Val = (pow(R, 1.0/Params[0]) - Params[2]) / Params[1]; - - if (Val < 0) - Val = 0; - break; + { + if (R < 0) + Val = 0; + else + Val = (pow(R, 1.0 / Params[0]) - Params[2]) / Params[1]; + + if (Val < 0) + Val = 0; + } + } + break; // IEC 61966-3 // Y = (aX + b)^Gamma | X <= -b/a // Y = c | else case 3: - disc = -Params[2] / Params[1]; - if (disc < 0) - disc = 0; - - if (R >= disc) { - - e = Params[1]*R + Params[2]; - - if (e > 0) - Val = pow(e, Params[0]) + Params[3]; - else - Val = 0; + { + if (fabs(Params[1]) < MATRIX_DET_TOLERANCE) + { + Val = 0; } else - Val = Params[3]; - break; + { + disc = -Params[2] / Params[1]; + if (disc < 0) + disc = 0; + + if (R >= disc) { + + e = Params[1] * R + Params[2]; + + if (e > 0) + Val = pow(e, Params[0]) + Params[3]; + else + Val = 0; + } + else + Val = Params[3]; + } + } + break; // Type 3 reversed // X=((Y-c)^1/g - b)/a | (Y>=c) // X=-b/a | (Y= Params[3]) { + { + if (fabs(Params[1]) < MATRIX_DET_TOLERANCE) + { + Val = 0; + } + else + { + if (R >= Params[3]) { - e = R - Params[3]; + e = R - Params[3]; - if (e > 0) - Val = (pow(e, 1/Params[0]) - Params[2]) / Params[1]; - else - Val = 0; - } - else { - Val = -Params[2] / Params[1]; + if (e > 0) + Val = (pow(e, 1 / Params[0]) - Params[2]) / Params[1]; + else + Val = 0; + } + else { + Val = -Params[2] / Params[1]; + } } - break; + } + break; // IEC 61966-2.1 (sRGB) @@ -435,20 +479,31 @@ // X=((Y^1/g-b)/a) | Y >= (ad+b)^g // X=Y/c | Y< (ad+b)^g case -4: - e = Params[1] * Params[4] + Params[2]; - if (e < 0) - disc = 0; + { + if (fabs(Params[0]) < MATRIX_DET_TOLERANCE || + fabs(Params[1]) < MATRIX_DET_TOLERANCE || + fabs(Params[3]) < MATRIX_DET_TOLERANCE) + { + Val = 0; + } else - disc = pow(e, Params[0]); + { + e = Params[1] * Params[4] + Params[2]; + if (e < 0) + disc = 0; + else + disc = pow(e, Params[0]); - if (R >= disc) { + if (R >= disc) { - Val = (pow(R, 1.0/Params[0]) - Params[2]) / Params[1]; - } - else { - Val = R / Params[3]; + Val = (pow(R, 1.0 / Params[0]) - Params[2]) / Params[1]; + } + else { + Val = R / Params[3]; + } } - break; + } + break; // Y = (aX + b)^Gamma + e | X >= d @@ -472,20 +527,29 @@ // X=((Y-e)1/g-b)/a | Y >=(ad+b)^g+e), cd+f // X=(Y-f)/c | else case -5: - - disc = Params[3] * Params[4] + Params[6]; - if (R >= disc) { - - e = R - Params[5]; - if (e < 0) - Val = 0; - else - Val = (pow(e, 1.0/Params[0]) - Params[2]) / Params[1]; + { + if (fabs(Params[1]) < MATRIX_DET_TOLERANCE || + fabs(Params[3]) < MATRIX_DET_TOLERANCE) + { + Val = 0; } - else { - Val = (R - Params[6]) / Params[3]; + else + { + disc = Params[3] * Params[4] + Params[6]; + if (R >= disc) { + + e = R - Params[5]; + if (e < 0) + Val = 0; + else + Val = (pow(e, 1.0 / Params[0]) - Params[2]) / Params[1]; + } + else { + Val = (R - Params[6]) / Params[3]; + } } - break; + } + break; // Types 6,7,8 comes from segmented curves as described in ICCSpecRevision_02_11_06_Float.pdf @@ -503,12 +567,21 @@ // ((Y - c) ^1/Gamma - b) / a case -6: - e = R - Params[3]; - if (e < 0) + { + if (fabs(Params[1]) < MATRIX_DET_TOLERANCE) + { Val = 0; + } else - Val = (pow(e, 1.0/Params[0]) - Params[2]) / Params[1]; - break; + { + e = R - Params[3]; + if (e < 0) + Val = 0; + else + Val = (pow(e, 1.0 / Params[0]) - Params[2]) / Params[1]; + } + } + break; // Y = a * log (b * X^Gamma + c) + d @@ -525,8 +598,19 @@ // pow(10, (Y-d) / a) = b * X ^Gamma + c // pow((pow(10, (Y-d) / a) - c) / b, 1/g) = X case -7: - Val = pow((pow(10.0, (R-Params[4]) / Params[1]) - Params[3]) / Params[2], 1.0 / Params[0]); - break; + { + if (fabs(Params[0]) < MATRIX_DET_TOLERANCE || + fabs(Params[1]) < MATRIX_DET_TOLERANCE || + fabs(Params[2]) < MATRIX_DET_TOLERANCE) + { + Val = 0; + } + else + { + Val = pow((pow(10.0, (R - Params[4]) / Params[1]) - Params[3]) / Params[2], 1.0 / Params[0]); + } + } + break; //Y = a * b^(c*X+d) + e @@ -542,12 +626,25 @@ disc = R - Params[4]; if (disc < 0) Val = 0; else - Val = (log(disc / Params[0]) / log(Params[1]) - Params[3]) / Params[2]; + { + if (fabs(Params[0]) < MATRIX_DET_TOLERANCE || + fabs(Params[2]) < MATRIX_DET_TOLERANCE) + { + Val = 0; + } + else + { + Val = (log(disc / Params[0]) / log(Params[1]) - Params[3]) / Params[2]; + } + } break; // S-Shaped: (1 - (1-x)^1/g)^1/g case 108: - Val = pow(1.0 - pow(1 - R, 1/Params[0]), 1/Params[0]); + if (fabs(Params[0]) < MATRIX_DET_TOLERANCE) + Val = 0; + else + Val = pow(1.0 - pow(1 - R, 1/Params[0]), 1/Params[0]); break; // y = (1 - (1-x)^1/g)^1/g @@ -567,33 +664,45 @@ return Val; } -// Evaluate a segmented function for a single value. Return -1 if no valid segment found . +// Evaluate a segmented function for a single value. Return -Inf if no valid segment found . // If fn type is 0, perform an interpolation on the table static cmsFloat64Number EvalSegmentedFn(const cmsToneCurve *g, cmsFloat64Number R) { int i; + cmsFloat32Number Out32; + cmsFloat64Number Out; - for (i = g ->nSegments-1; i >= 0 ; --i) { + for (i = (int) g->nSegments - 1; i >= 0; --i) { // Check for domain - if ((R > g ->Segments[i].x0) && (R <= g ->Segments[i].x1)) { + if ((R > g->Segments[i].x0) && (R <= g->Segments[i].x1)) { // Type == 0 means segment is sampled - if (g ->Segments[i].Type == 0) { + if (g->Segments[i].Type == 0) { - cmsFloat32Number R1 = (cmsFloat32Number) (R - g ->Segments[i].x0) / (g ->Segments[i].x1 - g ->Segments[i].x0); - cmsFloat32Number Out; + cmsFloat32Number R1 = (cmsFloat32Number)(R - g->Segments[i].x0) / (g->Segments[i].x1 - g->Segments[i].x0); // Setup the table (TODO: clean that) - g ->SegInterp[i]-> Table = g ->Segments[i].SampledPoints; + g->SegInterp[i]->Table = g->Segments[i].SampledPoints; - g ->SegInterp[i] -> Interpolation.LerpFloat(&R1, &Out, g ->SegInterp[i]); + g->SegInterp[i]->Interpolation.LerpFloat(&R1, &Out32, g->SegInterp[i]); + Out = (cmsFloat64Number) Out32; - return Out; } + else { + Out = g->Evals[i](g->Segments[i].Type, g->Segments[i].Params, R); + } + + if (isinf(Out)) + return PLUS_INF; else - return g ->Evals[i](g->Segments[i].Type, g ->Segments[i].Params, R); + { + if (isinf(-Out)) + return MINUS_INF; + } + + return Out; } } @@ -616,13 +725,13 @@ // Create an empty gamma curve, by using tables. This specifies only the limited-precision part, and leaves the // floating point description empty. -cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsInt32Number nEntries, const cmsUInt16Number Values[]) +cmsToneCurve* CMSEXPORT cmsBuildTabulatedToneCurve16(cmsContext ContextID, cmsUInt32Number nEntries, const cmsUInt16Number Values[]) { return AllocateToneCurveStruct(ContextID, nEntries, 0, NULL, Values); } static -int EntriesByGamma(cmsFloat64Number Gamma) +cmsUInt32Number EntriesByGamma(cmsFloat64Number Gamma) { if (fabs(Gamma - 1.0) < 0.001) return 2; return 4096; @@ -631,12 +740,12 @@ // Create a segmented gamma, fill the table cmsToneCurve* CMSEXPORT cmsBuildSegmentedToneCurve(cmsContext ContextID, - cmsInt32Number nSegments, const cmsCurveSegment Segments[]) + cmsUInt32Number nSegments, const cmsCurveSegment Segments[]) { - int i; + cmsUInt32Number i; cmsFloat64Number R, Val; cmsToneCurve* g; - int nGridPoints = 4096; + cmsUInt32Number nGridPoints = 4096; _cmsAssert(Segments != NULL); @@ -651,7 +760,7 @@ // Once we have the floating point version, we can approximate a 16 bit table of 4096 entries // for performance reasons. This table would normally not be used except on 8/16 bits transforms. - for (i=0; i < nGridPoints; i++) { + for (i = 0; i < nGridPoints; i++) { R = (cmsFloat64Number) i / (nGridPoints-1); @@ -864,7 +973,7 @@ if (LutTable[0] < LutTable[p ->Domain[0]]) { // Table is overall ascending - for (i=p->Domain[0]-1; i >=0; --i) { + for (i = (int) p->Domain[0] - 1; i >= 0; --i) { y0 = LutTable[i]; y1 = LutTable[i+1]; @@ -899,7 +1008,7 @@ } // Reverse a gamma table -cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsInt32Number nResultSamples, const cmsToneCurve* InCurve) +cmsToneCurve* CMSEXPORT cmsReverseToneCurveEx(cmsUInt32Number nResultSamples, const cmsToneCurve* InCurve) { cmsToneCurve *out; cmsFloat64Number a = 0, b = 0, y, x1, y1, x2, y2; @@ -928,7 +1037,7 @@ Ascending = !cmsIsToneCurveDescending(InCurve); // Iterate across Y axis - for (i=0; i < nResultSamples; i++) { + for (i=0; i < (int) nResultSamples; i++) { y = (cmsFloat64Number) i * 65535.0 / (nResultSamples - 1); @@ -983,7 +1092,8 @@ // Output: smoothed vector (z): vector from 1 to m. static -cmsBool smooth2(cmsContext ContextID, cmsFloat32Number w[], cmsFloat32Number y[], cmsFloat32Number z[], cmsFloat32Number lambda, int m) +cmsBool smooth2(cmsContext ContextID, cmsFloat32Number w[], cmsFloat32Number y[], + cmsFloat32Number z[], cmsFloat32Number lambda, int m) { int i, i1, i2; cmsFloat32Number *c, *d, *e; @@ -1042,73 +1152,121 @@ // Smooths a curve sampled at regular intervals. cmsBool CMSEXPORT cmsSmoothToneCurve(cmsToneCurve* Tab, cmsFloat64Number lambda) { - cmsFloat32Number w[MAX_NODES_IN_CURVE], y[MAX_NODES_IN_CURVE], z[MAX_NODES_IN_CURVE]; - int i, nItems, Zeros, Poles; - - if (Tab == NULL) return FALSE; + cmsBool SuccessStatus = TRUE; + cmsFloat32Number *w, *y, *z; + cmsUInt32Number i, nItems, Zeros, Poles; - if (cmsIsToneCurveLinear(Tab)) return TRUE; // Nothing to do - - nItems = Tab -> nEntries; - - if (nItems >= MAX_NODES_IN_CURVE) { - cmsSignalError(Tab ->InterpParams->ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: too many points."); - return FALSE; - } - - memset(w, 0, nItems * sizeof(cmsFloat32Number)); - memset(y, 0, nItems * sizeof(cmsFloat32Number)); - memset(z, 0, nItems * sizeof(cmsFloat32Number)); - - for (i=0; i < nItems; i++) + if (Tab != NULL && Tab->InterpParams != NULL) { - y[i+1] = (cmsFloat32Number) Tab -> Table16[i]; - w[i+1] = 1.0; - } + cmsContext ContextID = Tab->InterpParams->ContextID; - if (!smooth2(Tab ->InterpParams->ContextID, w, y, z, (cmsFloat32Number) lambda, nItems)) return FALSE; + if (!cmsIsToneCurveLinear(Tab)) // Only non-linear curves need smoothing + { + nItems = Tab->nEntries; + if (nItems < MAX_NODES_IN_CURVE) + { + // Allocate one more item than needed + w = (cmsFloat32Number *)_cmsCalloc(ContextID, nItems + 1, sizeof(cmsFloat32Number)); + y = (cmsFloat32Number *)_cmsCalloc(ContextID, nItems + 1, sizeof(cmsFloat32Number)); + z = (cmsFloat32Number *)_cmsCalloc(ContextID, nItems + 1, sizeof(cmsFloat32Number)); + + if (w != NULL && y != NULL && z != NULL) // Ensure no memory allocation failure + { + memset(w, 0, (nItems + 1) * sizeof(cmsFloat32Number)); + memset(y, 0, (nItems + 1) * sizeof(cmsFloat32Number)); + memset(z, 0, (nItems + 1) * sizeof(cmsFloat32Number)); + + for (i = 0; i < nItems; i++) + { + y[i + 1] = (cmsFloat32Number)Tab->Table16[i]; + w[i + 1] = 1.0; + } + + if (smooth2(ContextID, w, y, z, (cmsFloat32Number)lambda, (int)nItems)) + { + // Do some reality - checking... + + Zeros = Poles = 0; + for (i = nItems; i > 1; --i) + { + if (z[i] == 0.) Zeros++; + if (z[i] >= 65535.) Poles++; + if (z[i] < z[i - 1]) + { + cmsSignalError(ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Non-Monotonic."); + SuccessStatus = FALSE; + break; + } + } + + if (SuccessStatus && Zeros > (nItems / 3)) + { + cmsSignalError(ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Degenerated, mostly zeros."); + SuccessStatus = FALSE; + } + + if (SuccessStatus && Poles > (nItems / 3)) + { + cmsSignalError(ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Degenerated, mostly poles."); + SuccessStatus = FALSE; + } + + if (SuccessStatus) // Seems ok + { + for (i = 0; i < nItems; i++) + { + // Clamp to cmsUInt16Number + Tab->Table16[i] = _cmsQuickSaturateWord(z[i + 1]); + } + } + } + else // Could not smooth + { + cmsSignalError(ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Function smooth2 failed."); + SuccessStatus = FALSE; + } + } + else // One or more buffers could not be allocated + { + cmsSignalError(ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Could not allocate memory."); + SuccessStatus = FALSE; + } - // Do some reality - checking... - Zeros = Poles = 0; - for (i=nItems; i > 1; --i) { + if (z != NULL) + _cmsFree(ContextID, z); - if (z[i] == 0.) Zeros++; - if (z[i] >= 65535.) Poles++; - if (z[i] < z[i-1]) { - cmsSignalError(Tab ->InterpParams->ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Non-Monotonic."); - return FALSE; - } - } + if (y != NULL) + _cmsFree(ContextID, y); - if (Zeros > (nItems / 3)) { - cmsSignalError(Tab ->InterpParams->ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Degenerated, mostly zeros."); - return FALSE; - } - if (Poles > (nItems / 3)) { - cmsSignalError(Tab ->InterpParams->ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Degenerated, mostly poles."); - return FALSE; + if (w != NULL) + _cmsFree(ContextID, w); + } + else // too many items in the table + { + cmsSignalError(ContextID, cmsERROR_RANGE, "cmsSmoothToneCurve: Too many points."); + SuccessStatus = FALSE; + } + } } - - // Seems ok - for (i=0; i < nItems; i++) { - - // Clamp to cmsUInt16Number - Tab -> Table16[i] = _cmsQuickSaturateWord(z[i+1]); + else // Tab parameter or Tab->InterpParams is NULL + { + // Can't signal an error here since the ContextID is not known at this point + SuccessStatus = FALSE; } - return TRUE; + return SuccessStatus; } // Is a table linear? Do not use parametric since we cannot guarantee some weird parameters resulting // in a linear table. This way assures it is linear in 12 bits, which should be enought in most cases. cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve) { - cmsUInt32Number i; + int i; int diff; _cmsAssert(Curve != NULL); - for (i=0; i < Curve ->nEntries; i++) { + for (i=0; i < (int) Curve ->nEntries; i++) { diff = abs((int) Curve->Table16[i] - (int) _cmsQuantizeVal(i, Curve ->nEntries)); if (diff > 0x0f) @@ -1121,7 +1279,7 @@ // Same, but for monotonicity cmsBool CMSEXPORT cmsIsToneCurveMonotonic(const cmsToneCurve* t) { - int n; + cmsUInt32Number n; int i, last; cmsBool lDescending; @@ -1138,7 +1296,7 @@ last = t ->Table16[0]; - for (i = 1; i < n; i++) { + for (i = 1; i < (int) n; i++) { if (t ->Table16[i] - last > 2) // We allow some ripple return FALSE; @@ -1151,7 +1309,7 @@ last = t ->Table16[n-1]; - for (i = n-2; i >= 0; --i) { + for (i = (int) n - 2; i >= 0; --i) { if (t ->Table16[i] - last > 2) return FALSE; diff -Nru lcms2-2.8/src/cmsgmt.c lcms2-2.9/src/cmsgmt.c --- lcms2-2.8/src/cmsgmt.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsgmt.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -297,7 +297,7 @@ cmsStage* CLUT; cmsUInt32Number dwFormat; GAMUTCHAIN Chain; - int nChannels, nGridpoints; + cmsUInt32Number nChannels, nGridpoints; cmsColorSpaceSignature ColorSpace; cmsUInt32Number i; cmsHPROFILE ProfileList[256]; diff -Nru lcms2-2.8/src/cmshalf.c lcms2-2.9/src/cmshalf.c --- lcms2-2.8/src/cmshalf.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmshalf.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -503,7 +503,7 @@ 0x18, 0x18, 0x18, 0x18, 0x0d }; -cmsFloat32Number _cmsHalf2Float(cmsUInt16Number h) +cmsFloat32Number CMSEXPORT _cmsHalf2Float(cmsUInt16Number h) { union { cmsFloat32Number flt; @@ -516,7 +516,7 @@ return out.flt; } -cmsUInt16Number _cmsFloat2Half(cmsFloat32Number flt) +cmsUInt16Number CMSEXPORT _cmsFloat2Half(cmsFloat32Number flt) { union { cmsFloat32Number flt; diff -Nru lcms2-2.8/src/cmsintrp.c lcms2-2.9/src/cmsintrp.c --- lcms2-2.8/src/cmsintrp.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsintrp.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -29,6 +29,13 @@ // This module incorporates several interpolation routines, for 1 to 8 channels on input and // up to 65535 channels on output. The user may change those by using the interpolation plug-in +// Some people may want to compile as C++ with all warnings on, in this case make compiler silent +#ifdef _MSC_VER +# if (_MSC_VER >= 1400) +# pragma warning( disable : 4365 ) +# endif +#endif + // Interpolation routines by default static cmsInterpFunction DefaultInterpolatorsFactory(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags); @@ -102,12 +109,12 @@ // This function precalculates as many parameters as possible to speed up the interpolation. cmsInterpParams* _cmsComputeInterpParamsEx(cmsContext ContextID, const cmsUInt32Number nSamples[], - int InputChan, int OutputChan, + cmsUInt32Number InputChan, cmsUInt32Number OutputChan, const void *Table, cmsUInt32Number dwFlags) { cmsInterpParams* p; - int i; + cmsUInt32Number i; // Check for maximum inputs if (InputChan > MAX_INPUT_DIMENSIONS) { @@ -151,7 +158,8 @@ // This one is a wrapper on the anterior, but assuming all directions have same number of nodes -cmsInterpParams* _cmsComputeInterpParams(cmsContext ContextID, int nSamples, int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags) +cmsInterpParams* CMSEXPORT _cmsComputeInterpParams(cmsContext ContextID, cmsUInt32Number nSamples, + cmsUInt32Number InputChan, cmsUInt32Number OutputChan, const void* Table, cmsUInt32Number dwFlags) { int i; cmsUInt32Number Samples[MAX_INPUT_DIMENSIONS]; @@ -166,7 +174,7 @@ // Free all associated memory -void _cmsFreeInterpParams(cmsInterpParams* p) +void CMSEXPORT _cmsFreeInterpParams(cmsInterpParams* p) { if (p != NULL) _cmsFree(p ->ContextID, p); } @@ -215,7 +223,7 @@ // To prevent out of bounds indexing cmsINLINE cmsFloat32Number fclamp(cmsFloat32Number v) { - return v < 0.0f ? 0.0f : (v > 1.0f ? 1.0f : v); + return ((v < 1.0e-9f) || isnan(v)) ? 0.0f : (v > 1.0f ? 1.0f : v); } // Floating-point version of 1D interpolation @@ -352,10 +360,10 @@ y0 = (int) _cmsQuickFloor(py); fy = py - (cmsFloat32Number) y0; X0 = p -> opta[1] * x0; - X1 = X0 + (Input[0] >= 1.0 ? 0 : p->opta[1]); + X1 = X0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[1]); Y0 = p -> opta[0] * y0; - Y1 = Y0 + (Input[1] >= 1.0 ? 0 : p->opta[0]); + Y1 = Y0 + (fclamp(Input[1]) >= 1.0 ? 0 : p->opta[0]); for (OutChan = 0; OutChan < TotalOut; OutChan++) { @@ -464,18 +472,18 @@ py = fclamp(Input[1]) * p->Domain[1]; pz = fclamp(Input[2]) * p->Domain[2]; - x0 = (int) _cmsQuickFloor(px); fx = px - (cmsFloat32Number) x0; - y0 = (int) _cmsQuickFloor(py); fy = py - (cmsFloat32Number) y0; - z0 = (int) _cmsQuickFloor(pz); fz = pz - (cmsFloat32Number) z0; + x0 = (int) floor(px); fx = px - (cmsFloat32Number) x0; // We need full floor funcionality here + y0 = (int) floor(py); fy = py - (cmsFloat32Number) y0; + z0 = (int) floor(pz); fz = pz - (cmsFloat32Number) z0; X0 = p -> opta[2] * x0; - X1 = X0 + (Input[0] >= 1.0 ? 0 : p->opta[2]); + X1 = X0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[2]); Y0 = p -> opta[1] * y0; - Y1 = Y0 + (Input[1] >= 1.0 ? 0 : p->opta[1]); + Y1 = Y0 + (fclamp(Input[1]) >= 1.0 ? 0 : p->opta[1]); Z0 = p -> opta[0] * z0; - Z1 = Z0 + (Input[2] >= 1.0 ? 0 : p->opta[0]); + Z1 = Z0 + (fclamp(Input[2]) >= 1.0 ? 0 : p->opta[0]); for (OutChan = 0; OutChan < TotalOut; OutChan++) { @@ -608,19 +616,19 @@ py = fclamp(Input[1]) * p->Domain[1]; pz = fclamp(Input[2]) * p->Domain[2]; - x0 = (int) _cmsQuickFloor(px); rx = (px - (cmsFloat32Number) x0); - y0 = (int) _cmsQuickFloor(py); ry = (py - (cmsFloat32Number) y0); - z0 = (int) _cmsQuickFloor(pz); rz = (pz - (cmsFloat32Number) z0); + x0 = (int) floor(px); rx = (px - (cmsFloat32Number) x0); // We need full floor functionality here + y0 = (int) floor(py); ry = (py - (cmsFloat32Number) y0); + z0 = (int) floor(pz); rz = (pz - (cmsFloat32Number) z0); X0 = p -> opta[2] * x0; - X1 = X0 + (Input[0] >= 1.0 ? 0 : p->opta[2]); + X1 = X0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[2]); Y0 = p -> opta[1] * y0; - Y1 = Y0 + (Input[1] >= 1.0 ? 0 : p->opta[1]); + Y1 = Y0 + (fclamp(Input[1]) >= 1.0 ? 0 : p->opta[1]); Z0 = p -> opta[0] * z0; - Z1 = Z0 + (Input[2] >= 1.0 ? 0 : p->opta[0]); + Z1 = Z0 + (fclamp(Input[2]) >= 1.0 ? 0 : p->opta[0]); for (OutChan=0; OutChan < TotalOut; OutChan++) { @@ -923,13 +931,13 @@ c3 = DENS(X0, Y0, Z1) - c0; } - else { + else { c1 = c2 = c3 = 0; } Rest = c1 * rx + c2 * ry + c3 * rz; - Tmp1[OutChan] = (cmsUInt16Number) ( c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); + Tmp1[OutChan] = (cmsUInt16Number)(c0 + ROUND_FIXED_TO_INT(_cmsToFixedDomain(Rest))); } @@ -1028,7 +1036,7 @@ rest = pk - (cmsFloat32Number) k0; K0 = p -> opta[3] * k0; - K1 = K0 + (Input[0] >= 1.0 ? 0 : p->opta[3]); + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[3]); p1 = *p; memmove(&p1.Domain[0], &p ->Domain[1], 3*sizeof(cmsUInt32Number)); @@ -1115,7 +1123,7 @@ rest = pk - (cmsFloat32Number) k0; K0 = p -> opta[4] * k0; - K1 = K0 + (Input[0] >= 1.0 ? 0 : p->opta[4]); + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[4]); p1 = *p; memmove(&p1.Domain[0], &p ->Domain[1], 4*sizeof(cmsUInt32Number)); @@ -1202,7 +1210,7 @@ rest = pk - (cmsFloat32Number) k0; K0 = p -> opta[5] * k0; - K1 = K0 + (Input[0] >= 1.0 ? 0 : p->opta[5]); + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[5]); p1 = *p; memmove(&p1.Domain[0], &p ->Domain[1], 5*sizeof(cmsUInt32Number)); @@ -1287,7 +1295,7 @@ rest = pk - (cmsFloat32Number) k0; K0 = p -> opta[6] * k0; - K1 = K0 + (Input[0] >= 1.0 ? 0 : p->opta[6]); + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[6]); p1 = *p; memmove(&p1.Domain[0], &p ->Domain[1], 6*sizeof(cmsUInt32Number)); @@ -1372,7 +1380,7 @@ rest = pk - (cmsFloat32Number) k0; K0 = p -> opta[7] * k0; - K1 = K0 + (Input[0] >= 1.0 ? 0 : p->opta[7]); + K1 = K0 + (fclamp(Input[0]) >= 1.0 ? 0 : p->opta[7]); p1 = *p; memmove(&p1.Domain[0], &p ->Domain[1], 7*sizeof(cmsUInt32Number)); diff -Nru lcms2-2.8/src/cmsio0.c lcms2-2.9/src/cmsio0.c --- lcms2-2.8/src/cmsio0.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsio0.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -337,21 +337,27 @@ return TRUE; } -// Returns file pointer position +// Returns file pointer position or 0 on error, which is also a valid position. static cmsUInt32Number FileTell(cmsIOHANDLER* iohandler) { - return (cmsUInt32Number) ftell((FILE*)iohandler ->stream); + long t = ftell((FILE*)iohandler ->stream); + if (t == -1L) { + cmsSignalError(iohandler->ContextID, cmsERROR_FILE, "Tell error; probably corrupted file"); + return 0; + } + + return (cmsUInt32Number)t; } // Writes data to stream, also keeps used space for further reference. Returns TRUE on success, FALSE on error static cmsBool FileWrite(cmsIOHANDLER* iohandler, cmsUInt32Number size, const void* Buffer) { - if (size == 0) return TRUE; // We allow to write 0 bytes, but nothing is written + if (size == 0) return TRUE; // We allow to write 0 bytes, but nothing is written - iohandler->UsedSpace += size; - return (fwrite(Buffer, size, 1, (FILE*) iohandler->stream) == 1); + iohandler->UsedSpace += size; + return (fwrite(Buffer, size, 1, (FILE*)iohandler->stream) == 1); } // Closes the file @@ -519,7 +525,7 @@ _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; if (Icc == NULL) return -1; - return Icc->TagCount; + return (cmsInt32Number) Icc->TagCount; } // Return the tag signature of a given tag number @@ -537,9 +543,9 @@ static int SearchOneTag(_cmsICCPROFILE* Profile, cmsTagSignature sig) { - cmsUInt32Number i; + int i; - for (i=0; i < Profile -> TagCount; i++) { + for (i=0; i < (int) Profile -> TagCount; i++) { if (sig == Profile -> TagNames[i]) return i; @@ -633,7 +639,7 @@ return FALSE; } - *NewPos = Icc ->TagCount; + *NewPos = (int) Icc ->TagCount; Icc -> TagCount++; } @@ -664,10 +670,10 @@ cmsUInt8Number temp2; if (*pByte > 0x09) *pByte = (cmsUInt8Number) 0x09; - temp1 = *(pByte+1) & 0xf0; - temp2 = *(pByte+1) & 0x0f; - if (temp1 > 0x90) temp1 = 0x90; - if (temp2 > 0x09) temp2 = 0x09; + temp1 = (cmsUInt8Number) (*(pByte+1) & 0xf0); + temp2 = (cmsUInt8Number) (*(pByte+1) & 0x0f); + if (temp1 > 0x90U) temp1 = 0x90U; + if (temp2 > 0x09U) temp2 = 0x09U; *(pByte+1) = (cmsUInt8Number)(temp1 | temp2); *(pByte+2) = (cmsUInt8Number)0; *(pByte+3) = (cmsUInt8Number)0; @@ -775,7 +781,7 @@ cmsICCHeader Header; cmsUInt32Number i; cmsTagEntry Tag; - cmsInt32Number Count = 0; + cmsUInt32Number Count; Header.size = _cmsAdjustEndianess32(UsedSpace); Header.cmmId = _cmsAdjustEndianess32(lcmsSignature); @@ -806,9 +812,9 @@ Header.renderingIntent = _cmsAdjustEndianess32(Icc -> RenderingIntent); // Illuminant is always D50 - Header.illuminant.X = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(cmsD50_XYZ()->X)); - Header.illuminant.Y = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(cmsD50_XYZ()->Y)); - Header.illuminant.Z = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(cmsD50_XYZ()->Z)); + Header.illuminant.X = (cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(cmsD50_XYZ()->X)); + Header.illuminant.Y = (cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(cmsD50_XYZ()->Y)); + Header.illuminant.Z = (cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(cmsD50_XYZ()->Z)); // Created by LittleCMS (that's me!) Header.creator = _cmsAdjustEndianess32(lcmsSignature); @@ -824,6 +830,7 @@ // Saves Tag directory // Get true count + Count = 0; for (i=0; i < Icc -> TagCount; i++) { if (Icc ->TagNames[i] != (cmsTagSignature) 0) Count++; @@ -836,9 +843,9 @@ if (Icc ->TagNames[i] == (cmsTagSignature) 0) continue; // It is just a placeholder - Tag.sig = (cmsTagSignature) _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagNames[i]); - Tag.offset = _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagOffsets[i]); - Tag.size = _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagSizes[i]); + Tag.sig = (cmsTagSignature) _cmsAdjustEndianess32((cmsUInt32Number) Icc -> TagNames[i]); + Tag.offset = _cmsAdjustEndianess32((cmsUInt32Number) Icc -> TagOffsets[i]); + Tag.size = _cmsAdjustEndianess32((cmsUInt32Number) Icc -> TagSizes[i]); if (!Icc ->IOhandler -> Write(Icc-> IOhandler, sizeof(cmsTagEntry), &Tag)) return FALSE; } @@ -1147,7 +1154,7 @@ NewIcc = (_cmsICCPROFILE*) hEmpty; // Ok, in this case const void* is casted to void* just because open IO handler - // shares read and writting modes. Don't abuse this feature! + // shares read and writing modes. Don't abuse this feature! NewIcc ->IOhandler = cmsOpenIOhandlerFromMem(ContextID, (void*) MemPtr, dwSize, "r"); if (NewIcc ->IOhandler == NULL) goto Error; @@ -1437,7 +1444,7 @@ // Was open in write mode? if (Icc ->IsWrite) { - Icc ->IsWrite = FALSE; // Assure no further writting + Icc ->IsWrite = FALSE; // Assure no further writing rc &= cmsSaveProfileToFile(hProfile, Icc ->IOhandler->PhysicalFile); } @@ -1514,6 +1521,17 @@ // If the element is already in memory, return the pointer if (Icc -> TagPtrs[n]) { + if (Icc->TagTypeHandlers[n] == NULL) goto Error; + + // Sanity check + BaseType = Icc->TagTypeHandlers[n]->Signature; + if (BaseType == 0) goto Error; + + TagDescriptor = _cmsGetTagDescriptor(Icc->ContextID, sig); + if (TagDescriptor == NULL) goto Error; + + if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; + if (Icc ->TagSaveAsRaw[n]) goto Error; // We don't support read raw tags as cooked _cmsUnlockMutex(Icc->ContextID, Icc ->UsrMutex); @@ -1524,6 +1542,8 @@ Offset = Icc -> TagOffsets[n]; TagSize = Icc -> TagSizes[n]; + if (TagSize < 8) goto Error; + // Seek to its location if (!io -> Seek(io, Offset)) goto Error; @@ -1546,8 +1566,8 @@ if (BaseType == 0) goto Error; if (!IsTypeSupported(TagDescriptor, BaseType)) goto Error; - - TagSize -= 8; // Alredy read by the type base logic + + TagSize -= 8; // Alredy read by the type base logic // Get type handler TypeHandler = _cmsGetTagTypeHandler(Icc ->ContextID, BaseType); @@ -1736,7 +1756,7 @@ // raw data written does not exactly correspond with the raw data proposed to cmsWriteRaw data, but this approach allows // to write a tag as raw data and the read it as handled. -cmsInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* data, cmsUInt32Number BufferSize) +cmsUInt32Number CMSEXPORT cmsReadRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, void* data, cmsUInt32Number BufferSize) { _cmsICCPROFILE* Icc = (_cmsICCPROFILE*) hProfile; void *Object; @@ -1854,7 +1874,7 @@ } // Similar to the anterior. This function allows to write directly to the ICC profile any data, without -// checking anything. As a rule, mixing Raw with cooked doesn't work, so writting a tag as raw and then reading +// checking anything. As a rule, mixing Raw with cooked doesn't work, so writing a tag as raw and then reading // it as cooked without serializing does result into an error. If that is what you want, you will need to dump // the profile to memry or disk and then reopen it. cmsBool CMSEXPORT cmsWriteRawTag(cmsHPROFILE hProfile, cmsTagSignature sig, const void* data, cmsUInt32Number Size) diff -Nru lcms2-2.8/src/cmsio1.c lcms2-2.9/src/cmsio1.c --- lcms2-2.8/src/cmsio1.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsio1.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -306,8 +306,8 @@ // Read and create a BRAND NEW MPE LUT from a given profile. All stuff dependent of version, etc // is adjusted here in order to create a LUT that takes care of all those details. -// We add intent = -1 as a way to read matrix shaper always, no matter of other LUT -cmsPipeline* _cmsReadInputLUT(cmsHPROFILE hProfile, int Intent) +// We add intent = 0xffffffff as a way to read matrix shaper always, no matter of other LUT +cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent) { cmsTagTypeSignature OriginalType; cmsTagSignature tag16; @@ -337,8 +337,8 @@ } // This is an attempt to reuse this function to retrieve the matrix-shaper as pipeline no - // matter other LUT are present and have precedence. Intent = -1 means just this. - if (Intent >= INTENT_PERCEPTUAL && Intent <= INTENT_ABSOLUTE_COLORIMETRIC) { + // matter other LUT are present and have precedence. Intent = 0xffffffff can be used for that. + if (Intent <= INTENT_ABSOLUTE_COLORIMETRIC) { tag16 = Device2PCS16[Intent]; tagFloat = Device2PCSFloat[Intent]; @@ -582,7 +582,7 @@ } // Create an output MPE LUT from agiven profile. Version mismatches are handled here -cmsPipeline* _cmsReadOutputLUT(cmsHPROFILE hProfile, int Intent) +cmsPipeline* CMSEXPORT _cmsReadOutputLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent) { cmsTagTypeSignature OriginalType; cmsTagSignature tag16; @@ -590,7 +590,7 @@ cmsContext ContextID = cmsGetProfileContextID(hProfile); - if (Intent >= INTENT_PERCEPTUAL && Intent <= INTENT_ABSOLUTE_COLORIMETRIC) { + if (Intent <= INTENT_ABSOLUTE_COLORIMETRIC) { tag16 = PCS2Device16[Intent]; tagFloat = PCS2DeviceFloat[Intent]; @@ -666,8 +666,8 @@ static cmsPipeline* _cmsReadFloatDevicelinkTag(cmsHPROFILE hProfile, cmsTagSignature tagFloat) { - cmsContext ContextID = cmsGetProfileContextID(hProfile); - cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); + cmsContext ContextID = cmsGetProfileContextID(hProfile); + cmsPipeline* Lut = cmsPipelineDup((cmsPipeline*)cmsReadTag(hProfile, tagFloat)); cmsColorSpaceSignature PCS = cmsGetPCS(hProfile); cmsColorSpaceSignature spc = cmsGetColorSpace(hProfile); @@ -685,17 +685,17 @@ goto Error; } - if (PCS == cmsSigLabData) + if (PCS == cmsSigLabData) + { + if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID))) + goto Error; + } + else + if (PCS == cmsSigXYZData) { - if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromLabFloat(ContextID))) + if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID))) goto Error; } - else - if (PCS == cmsSigXYZData) - { - if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageNormalizeFromXyzFloat(ContextID))) - goto Error; - } return Lut; Error: @@ -705,7 +705,7 @@ // This one includes abstract profiles as well. Matrix-shaper cannot be obtained on that device class. The // tag name here may default to AToB0 -cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent) +cmsPipeline* CMSEXPORT _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent) { cmsPipeline* Lut; cmsTagTypeSignature OriginalType; @@ -714,7 +714,7 @@ cmsContext ContextID = cmsGetProfileContextID(hProfile); - if (Intent < INTENT_PERCEPTUAL || Intent > INTENT_ABSOLUTE_COLORIMETRIC) + if (Intent > INTENT_ABSOLUTE_COLORIMETRIC) return NULL; tag16 = Device2PCS16[Intent]; diff -Nru lcms2-2.8/src/cmslut.c lcms2-2.9/src/cmslut.c --- lcms2-2.8/src/cmslut.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmslut.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -124,8 +124,8 @@ mpe = Lut ->Elements; for (i=0; i < n; i++) { - // Get asked type - Type = (cmsStageSignature)va_arg(args, cmsStageSignature); + // Get asked type. cmsStageSignature is promoted to int by compiler + Type = (cmsStageSignature)va_arg(args, int); if (mpe ->Type != Type) { va_end(args); // Mismatch. We are done. @@ -292,7 +292,7 @@ // Create a bunch of identity curves -cmsStage* _cmsStageAllocIdentityCurves(cmsContext ContextID, int nChannels) +cmsStage* CMSEXPORT _cmsStageAllocIdentityCurves(cmsContext ContextID, cmsUInt32Number nChannels) { cmsStage* mpe = cmsStageAllocToneCurves(ContextID, nChannels, NULL); @@ -414,13 +414,13 @@ if (Offset != NULL) { - NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Cols, sizeof(cmsFloat64Number)); + NewElem ->Offset = (cmsFloat64Number*) _cmsCalloc(ContextID, Rows, sizeof(cmsFloat64Number)); if (NewElem->Offset == NULL) { MatrixElemTypeFree(NewMPE); return NULL; } - for (i=0; i < Cols; i++) { + for (i=0; i < Rows; i++) { NewElem ->Offset[i] = Offset[i]; } @@ -712,7 +712,7 @@ } // Creates an MPE that just copies input to output -cmsStage* _cmsStageAllocIdentityCLut(cmsContext ContextID, int nChan) +cmsStage* CMSEXPORT _cmsStageAllocIdentityCLut(cmsContext ContextID, cmsUInt32Number nChan) { cmsUInt32Number Dimensions[MAX_INPUT_DIMENSIONS]; cmsStage* mpe ; @@ -736,7 +736,7 @@ // Quantize a value 0 <= i < MaxSamples to 0..0xffff -cmsUInt16Number _cmsQuantizeVal(cmsFloat64Number i, int MaxSamples) +cmsUInt16Number CMSEXPORT _cmsQuantizeVal(cmsFloat64Number i, cmsUInt32Number MaxSamples) { cmsFloat64Number x; @@ -749,8 +749,9 @@ // function on knots. returns TRUE if all ok, FALSE otherwise. cmsBool CMSEXPORT cmsStageSampleCLut16bit(cmsStage* mpe, cmsSAMPLER16 Sampler, void * Cargo, cmsUInt32Number dwFlags) { - int i, t, nTotalPoints, index, rest; - int nInputs, nOutputs; + int i, t, index, rest; + cmsUInt32Number nTotalPoints; + cmsUInt32Number nInputs, nOutputs; cmsUInt32Number* nSamples; cmsUInt16Number In[MAX_INPUT_DIMENSIONS+1], Out[MAX_STAGE_CHANNELS]; _cmsStageCLutData* clut; @@ -770,14 +771,17 @@ if (nInputs > MAX_INPUT_DIMENSIONS) return FALSE; if (nOutputs >= MAX_STAGE_CHANNELS) return FALSE; + memset(In, 0, sizeof(In)); + memset(Out, 0, sizeof(Out)); + nTotalPoints = CubeSize(nSamples, nInputs); if (nTotalPoints == 0) return FALSE; index = 0; - for (i = 0; i < nTotalPoints; i++) { + for (i = 0; i < (int) nTotalPoints; i++) { rest = i; - for (t = nInputs-1; t >=0; --t) { + for (t = (int)nInputs - 1; t >= 0; --t) { cmsUInt32Number Colorant = rest % nSamples[t]; @@ -787,7 +791,7 @@ } if (clut ->Tab.T != NULL) { - for (t=0; t < nOutputs; t++) + for (t = 0; t < (int)nOutputs; t++) Out[t] = clut->Tab.T[index + t]; } @@ -797,7 +801,7 @@ if (!(dwFlags & SAMPLER_INSPECT)) { if (clut ->Tab.T != NULL) { - for (t=0; t < nOutputs; t++) + for (t=0; t < (int) nOutputs; t++) clut->Tab.T[index + t] = Out[t]; } } @@ -808,11 +812,12 @@ return TRUE; } -// Same as anterior, but for floting point +// Same as anterior, but for floating point cmsBool CMSEXPORT cmsStageSampleCLutFloat(cmsStage* mpe, cmsSAMPLERFLOAT Sampler, void * Cargo, cmsUInt32Number dwFlags) { - int i, t, nTotalPoints, index, rest; - int nInputs, nOutputs; + int i, t, index, rest; + cmsUInt32Number nTotalPoints; + cmsUInt32Number nInputs, nOutputs; cmsUInt32Number* nSamples; cmsFloat32Number In[MAX_INPUT_DIMENSIONS+1], Out[MAX_STAGE_CHANNELS]; _cmsStageCLutData* clut = (_cmsStageCLutData*) mpe->Data; @@ -830,10 +835,10 @@ if (nTotalPoints == 0) return FALSE; index = 0; - for (i = 0; i < nTotalPoints; i++) { + for (i = 0; i < (int)nTotalPoints; i++) { rest = i; - for (t = nInputs-1; t >=0; --t) { + for (t = (int) nInputs-1; t >=0; --t) { cmsUInt32Number Colorant = rest % nSamples[t]; @@ -843,7 +848,7 @@ } if (clut ->Tab.TFloat != NULL) { - for (t=0; t < nOutputs; t++) + for (t=0; t < (int) nOutputs; t++) Out[t] = clut->Tab.TFloat[index + t]; } @@ -853,7 +858,7 @@ if (!(dwFlags & SAMPLER_INSPECT)) { if (clut ->Tab.TFloat != NULL) { - for (t=0; t < nOutputs; t++) + for (t=0; t < (int) nOutputs; t++) clut->Tab.TFloat[index + t] = Out[t]; } } @@ -871,7 +876,8 @@ cmsBool CMSEXPORT cmsSliceSpace16(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[], cmsSAMPLER16 Sampler, void * Cargo) { - int i, t, nTotalPoints, rest; + int i, t, rest; + cmsUInt32Number nTotalPoints; cmsUInt16Number In[cmsMAXCHANNELS]; if (nInputs >= cmsMAXCHANNELS) return FALSE; @@ -879,10 +885,10 @@ nTotalPoints = CubeSize(clutPoints, nInputs); if (nTotalPoints == 0) return FALSE; - for (i = 0; i < nTotalPoints; i++) { + for (i = 0; i < (int) nTotalPoints; i++) { rest = i; - for (t = nInputs-1; t >=0; --t) { + for (t = (int) nInputs-1; t >=0; --t) { cmsUInt32Number Colorant = rest % clutPoints[t]; @@ -901,7 +907,8 @@ cmsInt32Number CMSEXPORT cmsSliceSpaceFloat(cmsUInt32Number nInputs, const cmsUInt32Number clutPoints[], cmsSAMPLERFLOAT Sampler, void * Cargo) { - int i, t, nTotalPoints, rest; + int i, t, rest; + cmsUInt32Number nTotalPoints; cmsFloat32Number In[cmsMAXCHANNELS]; if (nInputs >= cmsMAXCHANNELS) return FALSE; @@ -909,10 +916,10 @@ nTotalPoints = CubeSize(clutPoints, nInputs); if (nTotalPoints == 0) return FALSE; - for (i = 0; i < nTotalPoints; i++) { + for (i = 0; i < (int) nTotalPoints; i++) { rest = i; - for (t = nInputs-1; t >=0; --t) { + for (t = (int) nInputs-1; t >=0; --t) { cmsUInt32Number Colorant = rest % clutPoints[t]; @@ -962,7 +969,7 @@ // No dup or free routines needed, as the structure has no pointers in it. -cmsStage* _cmsStageAllocLab2XYZ(cmsContext ContextID) +cmsStage* CMSEXPORT _cmsStageAllocLab2XYZ(cmsContext ContextID) { return _cmsStageAllocPlaceholder(ContextID, cmsSigLab2XYZElemType, 3, 3, EvaluateLab2XYZ, NULL, NULL, NULL); } @@ -992,7 +999,7 @@ return NULL; } - // We need to map * (0xffff / 0xff00), thats same as (257 / 256) + // We need to map * (0xffff / 0xff00), that's same as (257 / 256) // So we can use 258-entry tables to do the trick (i / 257) * (255 * 257) * (257 / 256); for (i=0; i < 257; i++) { @@ -1013,7 +1020,7 @@ // ******************************************************************************** // Matrix-based conversion, which is more accurate, but slower and cannot properly be saved in devicelink profiles -cmsStage* _cmsStageAllocLabV2ToV4(cmsContext ContextID) +cmsStage* CMSEXPORT _cmsStageAllocLabV2ToV4(cmsContext ContextID) { static const cmsFloat64Number V2ToV4[] = { 65535.0/65280.0, 0, 0, 0, 65535.0/65280.0, 0, @@ -1029,7 +1036,7 @@ // Reverse direction -cmsStage* _cmsStageAllocLabV4ToV2(cmsContext ContextID) +cmsStage* CMSEXPORT _cmsStageAllocLabV4ToV2(cmsContext ContextID) { static const cmsFloat64Number V4ToV2[] = { 65280.0/65535.0, 0, 0, 0, 65280.0/65535.0, 0, @@ -1137,7 +1144,7 @@ } } -cmsStage* _cmsStageClipNegatives(cmsContext ContextID, int nChannels) +cmsStage* _cmsStageClipNegatives(cmsContext ContextID, cmsUInt32Number nChannels) { return _cmsStageAllocPlaceholder(ContextID, cmsSigClipNegativesElemType, nChannels, nChannels, Clipper, NULL, NULL, NULL); @@ -1172,7 +1179,7 @@ cmsUNUSED_PARAMETER(mpe); } -cmsStage* _cmsStageAllocXYZ2Lab(cmsContext ContextID) +cmsStage* CMSEXPORT _cmsStageAllocXYZ2Lab(cmsContext ContextID) { return _cmsStageAllocPlaceholder(ContextID, cmsSigXYZ2LabElemType, 3, 3, EvaluateXYZ2Lab, NULL, NULL, NULL); @@ -1271,23 +1278,42 @@ // *********************************************************************************************************** // This function sets up the channel count - static -void BlessLUT(cmsPipeline* lut) +cmsBool BlessLUT(cmsPipeline* lut) { - // We can set the input/ouput channels only if we have elements. + // We can set the input/output channels only if we have elements. if (lut ->Elements != NULL) { - cmsStage *First, *Last; + cmsStage* prev; + cmsStage* next; + cmsStage* First; + cmsStage* Last; First = cmsPipelineGetPtrToFirstStage(lut); Last = cmsPipelineGetPtrToLastStage(lut); - if (First != NULL)lut ->InputChannels = First ->InputChannels; - if (Last != NULL) lut ->OutputChannels = Last ->OutputChannels; + if (First == NULL || Last == NULL) return FALSE; + + lut->InputChannels = First->InputChannels; + lut->OutputChannels = Last->OutputChannels; + + // Check chain consistency + prev = First; + next = prev->Next; + + while (next != NULL) + { + if (next->InputChannels != prev->OutputChannels) + return FALSE; + + next = next->Next; + prev = prev->Next; } } + return TRUE; +} + // Default to evaluate the LUT on 16 bit-basis. Precision is retained. static @@ -1339,21 +1365,18 @@ } - - // LUT Creation & Destruction - cmsPipeline* CMSEXPORT cmsPipelineAlloc(cmsContext ContextID, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels) { cmsPipeline* NewLUT; + // A value of zero in channels is allowed as placeholder if (InputChannels >= cmsMAXCHANNELS || OutputChannels >= cmsMAXCHANNELS) return NULL; NewLUT = (cmsPipeline*) _cmsMallocZero(ContextID, sizeof(cmsPipeline)); if (NewLUT == NULL) return NULL; - NewLUT -> InputChannels = InputChannels; NewLUT -> OutputChannels = OutputChannels; @@ -1364,7 +1387,11 @@ NewLUT ->Data = NewLUT; NewLUT ->ContextID = ContextID; - BlessLUT(NewLUT); + if (!BlessLUT(NewLUT)) + { + _cmsFree(ContextID, NewLUT); + return NULL; + } return NewLUT; } @@ -1471,7 +1498,12 @@ NewLUT ->SaveAs8Bits = lut ->SaveAs8Bits; - BlessLUT(NewLUT); + if (!BlessLUT(NewLUT)) + { + _cmsFree(lut->ContextID, NewLUT); + return NULL; + } + return NewLUT; } @@ -1508,8 +1540,7 @@ return FALSE; } - BlessLUT(lut); - return TRUE; + return BlessLUT(lut); } // Unlink an element and return the pointer to it @@ -1564,6 +1595,7 @@ else cmsStageFree(Unlinked); + // May fail, but we ignore it BlessLUT(lut); } @@ -1590,8 +1622,7 @@ return FALSE; } - BlessLUT(l1); - return TRUE; + return BlessLUT(l1); } diff -Nru lcms2-2.8/src/cmsmd5.c lcms2-2.9/src/cmsmd5.c --- lcms2-2.8/src/cmsmd5.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsmd5.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/src/cmsmtrx.c lcms2-2.9/src/cmsmtrx.c --- lcms2-2.8/src/cmsmtrx.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsmtrx.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/src/cmsnamed.c lcms2-2.9/src/cmsnamed.c --- lcms2-2.8/src/cmsnamed.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsnamed.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -127,7 +127,7 @@ for (i=0; i < mlu ->UsedEntries; i++) { if (mlu ->Entries[i].Country == CountryCode && - mlu ->Entries[i].Language == LanguageCode) return i; + mlu ->Entries[i].Language == LanguageCode) return (int) i; } // Not found @@ -178,31 +178,24 @@ return TRUE; } -// Convert from a 3-char code to a cmsUInt16Number. It is done inthis way because some +// Convert from a 3-char code to a cmsUInt16Number. It is done in this way because some // compilers don't properly align beginning of strings static cmsUInt16Number strTo16(const char str[3]) -{ - cmsUInt16Number n = ((cmsUInt16Number) str[0] << 8) | str[1]; +{ + const cmsUInt8Number* ptr8 = (const cmsUInt8Number*)str; + cmsUInt16Number n = (cmsUInt16Number)(((cmsUInt16Number)ptr8[0] << 8) | ptr8[1]); - return n; // Always big endian in this case + return n; } static void strFrom16(char str[3], cmsUInt16Number n) { - // Assiming this would be aligned - union { - - cmsUInt16Number n; - char str[2]; - - } c; - - c.n = n; // Always big endian in this case - - str[0] = c.str[0]; str[1] = c.str[1]; str[2] = 0; + str[0] = (char)(n >> 8); + str[1] = (char)n; + str[2] = (char)0; } @@ -325,7 +318,7 @@ cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode) { cmsUInt32Number i; - cmsInt32Number Best = -1; + int Best = -1; _cmsMLUentry* v; if (mlu == NULL) return NULL; @@ -338,7 +331,7 @@ if (v -> Language == LanguageCode) { - if (Best == -1) Best = i; + if (Best == -1) Best = (int) i; if (v -> Country == CountryCode) { @@ -517,7 +510,11 @@ size = v ->Allocated * 2; // Keep a maximum color lists can grow, 100K entries seems reasonable - if (size > 1024*100) return FALSE; + if (size > 1024 * 100) { + _cmsFree(v->ContextID, (void*) v->List); + v->List = NULL; + return FALSE; + } NewPtr = (_cmsNAMEDCOLOR*) _cmsRealloc(v ->ContextID, v ->List, size * sizeof(_cmsNAMEDCOLOR)); if (NewPtr == NULL) @@ -539,8 +536,11 @@ v ->nColors = 0; v ->ContextID = ContextID; - while (v -> Allocated < n){ - if (!GrowNamedColorList(v)) return NULL; + while (v -> Allocated < n) { + if (!GrowNamedColorList(v)) { + _cmsFree(ContextID, (void*) v); + return NULL; + } } strncpy(v ->Prefix, Prefix, sizeof(v ->Prefix)-1); @@ -597,10 +597,10 @@ } for (i=0; i < NamedColorList ->ColorantCount; i++) - NamedColorList ->List[NamedColorList ->nColors].DeviceColorant[i] = Colorant == NULL? 0 : Colorant[i]; + NamedColorList ->List[NamedColorList ->nColors].DeviceColorant[i] = Colorant == NULL ? (cmsUInt16Number)0 : Colorant[i]; for (i=0; i < 3; i++) - NamedColorList ->List[NamedColorList ->nColors].PCS[i] = PCS == NULL ? 0 : PCS[i]; + NamedColorList ->List[NamedColorList ->nColors].PCS[i] = PCS == NULL ? (cmsUInt16Number) 0 : PCS[i]; if (Name != NULL) { @@ -635,6 +635,7 @@ if (nColor >= cmsNamedColorCount(NamedColorList)) return FALSE; + // strcpy instead of strncpy because many apps are using small buffers if (Name) strcpy(Name, NamedColorList->List[nColor].Name); if (Prefix) strcpy(Prefix, NamedColorList->Prefix); if (Suffix) strcpy(Suffix, NamedColorList->Suffix); @@ -652,13 +653,14 @@ // Search for a given color name (no prefix or suffix) cmsInt32Number CMSEXPORT cmsNamedColorIndex(const cmsNAMEDCOLORLIST* NamedColorList, const char* Name) { - int i, n; + cmsUInt32Number i; + cmsUInt32Number n; if (NamedColorList == NULL) return -1; n = cmsNamedColorCount(NamedColorList); for (i=0; i < n; i++) { if (cmsstrcasecmp(Name, NamedColorList->List[i].Name) == 0) - return i; + return (cmsInt32Number) i; } return -1; @@ -687,7 +689,8 @@ cmsUInt16Number index = (cmsUInt16Number) _cmsQuickSaturateWord(In[0] * 65535.0); if (index >= NamedColorList-> nColors) { - cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, "Color %d out of range; ignored", index); + cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, "Color %d out of range", index); + Out[0] = Out[1] = Out[2] = 0.0f; } else { @@ -706,7 +709,10 @@ cmsUInt32Number j; if (index >= NamedColorList-> nColors) { - cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, "Color %d out of range; ignored", index); + cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, "Color %d out of range", index); + for (j = 0; j < NamedColorList->ColorantCount; j++) + Out[j] = 0.0f; + } else { for (j=0; j < NamedColorList ->ColorantCount; j++) @@ -716,7 +722,7 @@ // Named color lookup element -cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS) +cmsStage* CMSEXPORT _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS) { return _cmsStageAllocPlaceholder(NamedColorList ->ContextID, cmsSigNamedColorElemType, diff -Nru lcms2-2.8/src/cmsopt.c lcms2-2.9/src/cmsopt.c --- lcms2-2.8/src/cmsopt.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsopt.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -49,8 +49,8 @@ cmsContext ContextID; // Number of channels - int nInputs; - int nOutputs; + cmsUInt32Number nInputs; + cmsUInt32Number nOutputs; _cmsInterpFn16 EvalCurveIn16[MAX_INPUT_DIMENSIONS]; // The maximum number of input channels is known in advance cmsInterpParams* ParamsCurveIn16[MAX_INPUT_DIMENSIONS]; @@ -94,8 +94,8 @@ cmsContext ContextID; - int nCurves; // Number of curves - int nElements; // Elements in curves + cmsUInt32Number nCurves; // Number of curves + cmsUInt32Number nElements; // Elements in curves cmsUInt16Number** Curves; // Points to a dynamically allocated array } Curves16Data; @@ -216,7 +216,7 @@ // Multiply both matrices to get the result _cmsMAT3per(&res, (cmsMAT3*)m2->Double, (cmsMAT3*)m1->Double); - // Get the next in chain afer the matrices + // Get the next in chain after the matrices chain = (*pt2)->Next; // Remove both matrices @@ -305,7 +305,7 @@ Prelin16Data* p16 = (Prelin16Data*) D; cmsUInt16Number StageABC[MAX_INPUT_DIMENSIONS]; cmsUInt16Number StageDEF[cmsMAXCHANNELS]; - int i; + cmsUInt32Number i; for (i=0; i < p16 ->nInputs; i++) { @@ -350,15 +350,15 @@ static Prelin16Data* PrelinOpt16alloc(cmsContext ContextID, const cmsInterpParams* ColorMap, - int nInputs, cmsToneCurve** In, - int nOutputs, cmsToneCurve** Out ) + cmsUInt32Number nInputs, cmsToneCurve** In, + cmsUInt32Number nOutputs, cmsToneCurve** Out ) { - int i; + cmsUInt32Number i; Prelin16Data* p16 = (Prelin16Data*)_cmsMallocZero(ContextID, sizeof(Prelin16Data)); if (p16 == NULL) return NULL; p16 ->nInputs = nInputs; - p16 -> nOutputs = nOutputs; + p16 ->nOutputs = nOutputs; for (i=0; i < nInputs; i++) { @@ -406,7 +406,7 @@ // Sampler implemented by another LUT. This is a clean way to precalculate the devicelink 3D CLUT for // almost any transform. We use floating point precision and then convert from floating point to 16 bits. static -int XFormSampler16(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) +cmsInt32Number XFormSampler16(register const cmsUInt16Number In[], register cmsUInt16Number Out[], register void* Cargo) { cmsPipeline* Lut = (cmsPipeline*) Cargo; cmsFloat32Number InFloat[cmsMAXCHANNELS], OutFloat[cmsMAXCHANNELS]; @@ -453,7 +453,7 @@ // is to fix scum dot on broken profiles/transforms. Works on 1, 3 and 4 channels static cmsBool PatchLUT(cmsStage* CLUT, cmsUInt16Number At[], cmsUInt16Number Value[], - int nChannelsOut, int nChannelsIn) + cmsUInt32Number nChannelsOut, cmsUInt32Number nChannelsIn) { _cmsStageCLutData* Grid = (_cmsStageCLutData*) CLUT ->Data; cmsInterpParams* p16 = Grid ->Params; @@ -483,10 +483,10 @@ ((pz - z0) != 0) || ((pw - w0) != 0)) return FALSE; // Not on exact node - index = p16 -> opta[3] * x0 + - p16 -> opta[2] * y0 + - p16 -> opta[1] * z0 + - p16 -> opta[0] * w0; + index = (int) p16 -> opta[3] * x0 + + (int) p16 -> opta[2] * y0 + + (int) p16 -> opta[1] * z0 + + (int) p16 -> opta[0] * w0; } else if (nChannelsIn == 3) { @@ -503,9 +503,9 @@ ((py - y0) != 0) || ((pz - z0) != 0)) return FALSE; // Not on exact node - index = p16 -> opta[2] * x0 + - p16 -> opta[1] * y0 + - p16 -> opta[0] * z0; + index = (int) p16 -> opta[2] * x0 + + (int) p16 -> opta[1] * y0 + + (int) p16 -> opta[0] * z0; } else if (nChannelsIn == 1) { @@ -516,24 +516,24 @@ if (((px - x0) != 0)) return FALSE; // Not on exact node - index = p16 -> opta[0] * x0; + index = (int) p16 -> opta[0] * x0; } else { cmsSignalError(CLUT->ContextID, cmsERROR_INTERNAL, "(internal) %d Channels are not supported on PatchLUT", nChannelsIn); return FALSE; } - for (i=0; i < nChannelsOut; i++) - Grid -> Tab.T[index + i] = Value[i]; + for (i = 0; i < (int) nChannelsOut; i++) + Grid->Tab.T[index + i] = Value[i]; return TRUE; } // Auxiliary, to see if two values are equal or very different static -cmsBool WhitesAreEqual(int n, cmsUInt16Number White1[], cmsUInt16Number White2[] ) +cmsBool WhitesAreEqual(cmsUInt32Number n, cmsUInt16Number White1[], cmsUInt16Number White2[] ) { - int i; + cmsUInt32Number i; for (i=0; i < n; i++) { @@ -635,7 +635,7 @@ cmsStage* mpe; cmsStage* CLUT; cmsStage *KeepPreLin = NULL, *KeepPostLin = NULL; - int nGridPoints; + cmsUInt32Number nGridPoints; cmsColorSpaceSignature ColorSpace, OutputColorSpace; cmsStage *NewPreLin = NULL; cmsStage *NewPostLin = NULL; @@ -647,8 +647,13 @@ // This is a loosy optimization! does not apply in floating-point cases if (_cmsFormatterIsFloat(*InputFormat) || _cmsFormatterIsFloat(*OutputFormat)) return FALSE; - ColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*InputFormat)); - OutputColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*OutputFormat)); + ColorSpace = _cmsICCcolorSpace((int) T_COLORSPACE(*InputFormat)); + OutputColorSpace = _cmsICCcolorSpace((int) T_COLORSPACE(*OutputFormat)); + + // Color space must be specified + if (ColorSpace == (cmsColorSpaceSignature)0 || + OutputColorSpace == (cmsColorSpaceSignature)0) return FALSE; + nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags); // For empty LUTs, 2 points are enough @@ -686,7 +691,7 @@ goto Error; // Remove prelinearization. Since we have duplicated the curve - // in destination LUT, the sampling shoud be applied after this stage. + // in destination LUT, the sampling should be applied after this stage. cmsPipelineUnlinkStage(Src, cmsAT_BEGIN, &KeepPreLin); } } @@ -694,7 +699,7 @@ // Allocate the CLUT CLUT = cmsStageAllocCLut16bit(Src ->ContextID, nGridPoints, Src ->InputChannels, Src->OutputChannels, NULL); - if (CLUT == NULL) return FALSE; + if (CLUT == NULL) goto Error; // Add the CLUT to the destination LUT if (!cmsPipelineInsertStage(Dest, cmsAT_END, CLUT)) { @@ -718,14 +723,14 @@ if (!cmsPipelineInsertStage(Dest, cmsAT_END, NewPostLin)) goto Error; - // In destination LUT, the sampling shoud be applied after this stage. + // In destination LUT, the sampling should be applied after this stage. cmsPipelineUnlinkStage(Src, cmsAT_END, &KeepPostLin); } } } // Now its time to do the sampling. We have to ignore pre/post linearization - // The source LUT whithout pre/post curves is passed as parameter. + // The source LUT without pre/post curves is passed as parameter. if (!cmsStageSampleCLut16bit(CLUT, XFormSampler16, (void*) Src, 0)) { Error: // Ops, something went wrong, Restore stages @@ -805,7 +810,7 @@ { int BeginVal, EndVal; int AtBegin = (int) floor((cmsFloat64Number) g ->nEntries * 0.02 + 0.5); // Cutoff at 2% - int AtEnd = g ->nEntries - AtBegin - 1; // And 98% + int AtEnd = (int) g ->nEntries - AtBegin - 1; // And 98% cmsFloat64Number Val, Slope, beta; int i; @@ -866,9 +871,9 @@ // Move to 0..1.0 in fixed domain - v1 = _cmsToFixedDomain(Input[0] * p -> Domain[0]); - v2 = _cmsToFixedDomain(Input[1] * p -> Domain[1]); - v3 = _cmsToFixedDomain(Input[2] * p -> Domain[2]); + v1 = _cmsToFixedDomain((int) (Input[0] * p -> Domain[0])); + v2 = _cmsToFixedDomain((int) (Input[1] * p -> Domain[1])); + v3 = _cmsToFixedDomain((int) (Input[2] * p -> Domain[2])); // Store the precalculated table of nodes p8 ->X0[i] = (p->opta[2] * FIXED_TO_INT(v1)); @@ -913,27 +918,27 @@ cmsS15Fixed16Number rx, ry, rz; cmsS15Fixed16Number c0, c1, c2, c3, Rest; int OutChan; - register cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; + register cmsS15Fixed16Number X0, X1, Y0, Y1, Z0, Z1; Prelin8Data* p8 = (Prelin8Data*) D; register const cmsInterpParams* p = p8 ->p; - int TotalOut = p -> nOutputs; + int TotalOut = (int) p -> nOutputs; const cmsUInt16Number* LutTable = (const cmsUInt16Number*) p->Table; - r = Input[0] >> 8; - g = Input[1] >> 8; - b = Input[2] >> 8; - - X0 = X1 = p8->X0[r]; - Y0 = Y1 = p8->Y0[g]; - Z0 = Z1 = p8->Z0[b]; + r = (cmsUInt8Number) (Input[0] >> 8); + g = (cmsUInt8Number) (Input[1] >> 8); + b = (cmsUInt8Number) (Input[2] >> 8); + + X0 = X1 = (cmsS15Fixed16Number) p8->X0[r]; + Y0 = Y1 = (cmsS15Fixed16Number) p8->Y0[g]; + Z0 = Z1 = (cmsS15Fixed16Number) p8->Z0[b]; rx = p8 ->rx[r]; ry = p8 ->ry[g]; rz = p8 ->rz[b]; - X1 = X0 + ((rx == 0) ? 0 : p ->opta[2]); - Y1 = Y0 + ((ry == 0) ? 0 : p ->opta[1]); - Z1 = Z0 + ((rz == 0) ? 0 : p ->opta[0]); + X1 = X0 + (cmsS15Fixed16Number)((rx == 0) ? 0 : p ->opta[2]); + Y1 = Y0 + (cmsS15Fixed16Number)((ry == 0) ? 0 : p ->opta[1]); + Z1 = Z0 + (cmsS15Fixed16Number)((rz == 0) ? 0 : p ->opta[0]); // These are the 6 Tetrahedral @@ -986,9 +991,8 @@ c1 = c2 = c3 = 0; } - Rest = c1 * rx + c2 * ry + c3 * rz + 0x8001; - Output[OutChan] = (cmsUInt16Number)c0 + ((Rest + (Rest>>16))>>16); + Output[OutChan] = (cmsUInt16Number) (c0 + ((Rest + (Rest >> 16)) >> 16)); } } @@ -1000,8 +1004,8 @@ static cmsBool IsDegenerated(const cmsToneCurve* g) { - int i, Zeros = 0, Poles = 0; - int nEntries = g ->nEntries; + cmsUInt32Number i, Zeros = 0, Poles = 0; + cmsUInt32Number nEntries = g ->nEntries; for (i=0; i < nEntries; i++) { @@ -1023,7 +1027,7 @@ cmsBool OptimizeByComputingLinearization(cmsPipeline** Lut, cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags) { cmsPipeline* OriginalLut; - int nGridPoints; + cmsUInt32Number nGridPoints; cmsToneCurve *Trans[cmsMAXCHANNELS], *TransReverse[cmsMAXCHANNELS]; cmsUInt32Number t, i; cmsFloat32Number v, In[cmsMAXCHANNELS], Out[cmsMAXCHANNELS]; @@ -1061,8 +1065,13 @@ if (cmsStageType(mpe) == cmsSigNamedColorElemType) return FALSE; } - ColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*InputFormat)); - OutputColorSpace = _cmsICCcolorSpace(T_COLORSPACE(*OutputFormat)); + ColorSpace = _cmsICCcolorSpace((int) T_COLORSPACE(*InputFormat)); + OutputColorSpace = _cmsICCcolorSpace((int) T_COLORSPACE(*OutputFormat)); + + // Color space must be specified + if (ColorSpace == (cmsColorSpaceSignature)0 || + OutputColorSpace == (cmsColorSpaceSignature)0) return FALSE; + nGridPoints = _cmsReasonableGridpointsByColorspace(ColorSpace, *dwFlags); // Empty gamma containers @@ -1231,6 +1240,7 @@ return FALSE; cmsUNUSED_PARAMETER(Intent); + cmsUNUSED_PARAMETER(lIsLinear); } @@ -1240,7 +1250,7 @@ void CurvesFree(cmsContext ContextID, void* ptr) { Curves16Data* Data = (Curves16Data*) ptr; - int i; + cmsUInt32Number i; for (i=0; i < Data -> nCurves; i++) { @@ -1255,7 +1265,7 @@ void* CurvesDup(cmsContext ContextID, const void* ptr) { Curves16Data* Data = (Curves16Data*)_cmsDupMem(ContextID, ptr, sizeof(Curves16Data)); - int i; + cmsUInt32Number i; if (Data == NULL) return NULL; @@ -1270,9 +1280,9 @@ // Precomputes tables for 8-bit on input devicelink. static -Curves16Data* CurvesAlloc(cmsContext ContextID, int nCurves, int nElements, cmsToneCurve** G) +Curves16Data* CurvesAlloc(cmsContext ContextID, cmsUInt32Number nCurves, cmsUInt32Number nElements, cmsToneCurve** G) { - int i, j; + cmsUInt32Number i, j; Curves16Data* c16; c16 = (Curves16Data*)_cmsMallocZero(ContextID, sizeof(Curves16Data)); @@ -1282,7 +1292,10 @@ c16 ->nElements = nElements; c16->Curves = (cmsUInt16Number**) _cmsCalloc(ContextID, nCurves, sizeof(cmsUInt16Number*)); - if (c16 ->Curves == NULL) return NULL; + if (c16->Curves == NULL) { + _cmsFree(ContextID, c16); + return NULL; + } for (i=0; i < nCurves; i++) { @@ -1298,7 +1311,7 @@ return NULL; } - if (nElements == 256) { + if (nElements == 256U) { for (j=0; j < nElements; j++) { @@ -1322,8 +1335,8 @@ register const void* D) { Curves16Data* Data = (Curves16Data*) D; - cmsUInt8Number x; - int i; + int x; + cmsUInt32Number i; for (i=0; i < Data ->nCurves; i++) { @@ -1339,7 +1352,7 @@ register const void* D) { Curves16Data* Data = (Curves16Data*) D; - int i; + cmsUInt32Number i; for (i=0; i < Data ->nCurves; i++) { Out[i] = Data -> Curves[i][In[i]]; @@ -1454,6 +1467,7 @@ // LUT optimizes to nothing. Set the identity LUT cmsStageFree(ObtainedCurves); + ObtainedCurves = NULL; if (!cmsPipelineInsertStage(Dest, cmsAT_BEGIN, cmsStageAllocIdentity(Dest ->ContextID, Src ->InputChannels))) goto Error; @@ -1518,9 +1532,9 @@ // In this case (and only in this case!) we can use this simplification since // In[] is assured to come from a 8 bit number. (a << 8 | a) - ri = In[0] & 0xFF; - gi = In[1] & 0xFF; - bi = In[2] & 0xFF; + ri = In[0] & 0xFFU; + gi = In[1] & 0xFFU; + bi = In[2] & 0xFFU; // Across first shaper, which also converts to 1.14 fixed point r = p->Shaper1R[ri]; @@ -1533,9 +1547,9 @@ l3 = (p->Mat[2][0] * r + p->Mat[2][1] * g + p->Mat[2][2] * b + p->Off[2] + 0x2000) >> 14; // Now we have to clip to 0..1.0 range - ri = (l1 < 0) ? 0 : ((l1 > 16384) ? 16384 : l1); - gi = (l2 < 0) ? 0 : ((l2 > 16384) ? 16384 : l2); - bi = (l3 < 0) ? 0 : ((l3 > 16384) ? 16384 : l3); + ri = (l1 < 0) ? 0 : ((l1 > 16384) ? 16384U : (cmsUInt32Number) l1); + gi = (l2 < 0) ? 0 : ((l2 > 16384) ? 16384U : (cmsUInt32Number) l2); + bi = (l3 < 0) ? 0 : ((l3 > 16384) ? 16384U : (cmsUInt32Number) l3); // And across second shaper, Out[0] = p->Shaper2R[ri]; @@ -1556,7 +1570,10 @@ R = (cmsFloat32Number) (i / 255.0); y = cmsEvalToneCurveFloat(Curve, R); - Table[i] = DOUBLE_TO_1FIXED14(y); + if (y < 131072.0) + Table[i] = DOUBLE_TO_1FIXED14(y); + else + Table[i] = 0x7fffffff; } } @@ -1572,6 +1589,12 @@ R = (cmsFloat32Number) (i / 16384.0); Val = cmsEvalToneCurveFloat(Curve, R); // Val comes 0..1.0 + if (Val < 0) + Val = 0; + + if (Val > 1.0) + Val = 1.0; + if (Is8BitsOutput) { // If 8 bits output, we can optimize further by computing the / 257 part. @@ -1610,7 +1633,7 @@ FillSecondShaper(p ->Shaper2G, Curve2[1], Is8Bits); FillSecondShaper(p ->Shaper2B, Curve2[2], Is8Bits); - // Convert matrix to nFixed14. Note that those values may take more than 16 bits as + // Convert matrix to nFixed14. Note that those values may take more than 16 bits for (i=0; i < 3; i++) { for (j=0; j < 3; j++) { p ->Mat[i][j] = DOUBLE_TO_1FIXED14(Mat->v[i].n[j]); @@ -1872,7 +1895,7 @@ // The entry point for LUT optimization cmsBool _cmsOptimizePipeline(cmsContext ContextID, cmsPipeline** PtrLut, - int Intent, + cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags) diff -Nru lcms2-2.8/src/cmspack.c lcms2-2.9/src/cmspack.c --- lcms2-2.8/src/cmspack.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmspack.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -97,21 +97,21 @@ register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsUInt16Number v; - int i; + cmsUInt32Number i; if (ExtraFirst) { accum += Extra; } for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = FROM_8_TO_16(*accum); v = Reverse ? REVERSE_FLAVOR_16(v) : v; @@ -144,11 +144,11 @@ register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int i; + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number i; cmsUInt8Number* Init = accum; if (DoSwap ^ SwapFirst) { @@ -157,7 +157,7 @@ for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; cmsUInt16Number v = FROM_8_TO_16(*accum); wIn[index] = Reverse ? REVERSE_FLAVOR_16(v) : v; @@ -474,14 +474,14 @@ register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int SwapEndian = T_ENDIAN16(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int i; + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number SwapEndian = T_ENDIAN16(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number i; if (ExtraFirst) { accum += Extra * sizeof(cmsUInt16Number); @@ -489,7 +489,7 @@ for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; cmsUInt16Number v = *(cmsUInt16Number*) accum; if (SwapEndian) @@ -523,20 +523,20 @@ register cmsUInt8Number* accum, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap= T_DOSWAP(info ->InputFormat); - int Reverse= T_FLAVOR(info ->InputFormat); - int SwapEndian = T_ENDIAN16(info -> InputFormat); - int i; + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap= T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse= T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapEndian = T_ENDIAN16(info -> InputFormat); + cmsUInt32Number i; cmsUInt8Number* Init = accum; if (DoSwap) { - accum += T_EXTRA(info -> InputFormat) * Stride * sizeof(cmsUInt16Number); + accum += T_EXTRA(info -> InputFormat) * Stride; } for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; cmsUInt16Number v = *(cmsUInt16Number*) accum; if (SwapEndian) @@ -544,7 +544,7 @@ wIn[index] = Reverse ? REVERSE_FLAVOR_16(v) : v; - accum += Stride * sizeof(cmsUInt16Number); + accum += Stride; } return (Init + sizeof(cmsUInt16Number)); @@ -772,13 +772,18 @@ { if (T_PLANAR(info -> InputFormat)) { - cmsFloat64Number* Pt = (cmsFloat64Number*) accum; - cmsCIELab Lab; - - Lab.L = Pt[0]; - Lab.a = Pt[Stride]; - Lab.b = Pt[Stride*2]; + cmsUInt8Number* pos_L; + cmsUInt8Number* pos_a; + cmsUInt8Number* pos_b; + + pos_L = accum; + pos_a = accum + Stride; + pos_b = accum + Stride * 2; + + Lab.L = *(cmsFloat64Number*) pos_L; + Lab.a = *(cmsFloat64Number*) pos_a; + Lab.b = *(cmsFloat64Number*) pos_b; cmsFloat2LabEncoded(wIn, &Lab); return accum + sizeof(cmsFloat64Number); @@ -803,12 +808,17 @@ if (T_PLANAR(info -> InputFormat)) { - cmsFloat32Number* Pt = (cmsFloat32Number*) accum; - - - Lab.L = Pt[0]; - Lab.a = Pt[Stride]; - Lab.b = Pt[Stride*2]; + cmsUInt8Number* pos_L; + cmsUInt8Number* pos_a; + cmsUInt8Number* pos_b; + + pos_L = accum; + pos_a = accum + Stride; + pos_b = accum + Stride * 2; + + Lab.L = *(cmsFloat32Number*)pos_L; + Lab.a = *(cmsFloat32Number*)pos_a; + Lab.b = *(cmsFloat32Number*)pos_b; cmsFloat2LabEncoded(wIn, &Lab); return accum + sizeof(cmsFloat32Number); @@ -834,12 +844,19 @@ { if (T_PLANAR(info -> InputFormat)) { - cmsFloat64Number* Pt = (cmsFloat64Number*) accum; cmsCIEXYZ XYZ; + cmsUInt8Number* pos_X; + cmsUInt8Number* pos_Y; + cmsUInt8Number* pos_Z; + + pos_X = accum; + pos_Y = accum + Stride; + pos_Z = accum + Stride * 2; + + XYZ.X = *(cmsFloat64Number*)pos_X; + XYZ.Y = *(cmsFloat64Number*)pos_Y; + XYZ.Z = *(cmsFloat64Number*)pos_Z; - XYZ.X = Pt[0]; - XYZ.Y = Pt[Stride]; - XYZ.Z = Pt[Stride*2]; cmsFloat2XYZEncoded(wIn, &XYZ); return accum + sizeof(cmsFloat64Number); @@ -863,12 +880,19 @@ { if (T_PLANAR(info -> InputFormat)) { - cmsFloat32Number* Pt = (cmsFloat32Number*) accum; cmsCIEXYZ XYZ; + cmsUInt8Number* pos_X; + cmsUInt8Number* pos_Y; + cmsUInt8Number* pos_Z; + + pos_X = accum; + pos_Y = accum + Stride; + pos_Z = accum + Stride * 2; + + XYZ.X = *(cmsFloat32Number*)pos_X; + XYZ.Y = *(cmsFloat32Number*)pos_Y; + XYZ.Z = *(cmsFloat32Number*)pos_Z; - XYZ.X = Pt[0]; - XYZ.Y = Pt[Stride]; - XYZ.Z = Pt[Stride*2]; cmsFloat2XYZEncoded(wIn, &XYZ); return accum + sizeof(cmsFloat32Number); @@ -913,6 +937,20 @@ } } +// Return the size in bytes of a given formatter +static +cmsUInt32Number PixelSize(cmsUInt32Number Format) +{ + cmsUInt32Number fmt_bytes = T_BYTES(Format); + + // For double, the T_BYTES field is zero + if (fmt_bytes == 0) + return sizeof(cmsUInt64Number); + + // Otherwise, it is already correct for all formats + return fmt_bytes; +} + // Inks does come in percentage, remaining cases are between 0..1.0, again to 16 bits static cmsUInt8Number* UnrollDoubleTo16(register _cmsTRANSFORM* info, @@ -921,25 +959,27 @@ register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); cmsFloat64Number v; cmsUInt16Number vi; - int i, start = 0; - cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + cmsUInt32Number i, start = 0; + cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + Stride /= PixelSize(info->InputFormat); + if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) v = (cmsFloat32Number) ((cmsFloat64Number*) accum)[(i + start) * Stride]; @@ -977,25 +1017,26 @@ register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); cmsFloat32Number v; cmsUInt16Number vi; - int i, start = 0; - cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + cmsUInt32Number i, start = 0; + cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 655.35 : 65535.0; + Stride /= PixelSize(info->InputFormat); if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[(i + start) * Stride]; @@ -1054,24 +1095,25 @@ cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); cmsFloat32Number v; - int i, start = 0; + cmsUInt32Number i, start = 0; cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F; + Stride /= PixelSize(info->InputFormat); if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) v = (cmsFloat32Number) ((cmsFloat32Number*) accum)[(i + start) * Stride]; @@ -1106,24 +1148,25 @@ cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); cmsFloat64Number v; - int i, start = 0; + cmsUInt32Number i, start = 0; cmsFloat64Number maximum = IsInkSpace(info ->InputFormat) ? 100.0 : 1.0; + Stride /= PixelSize(info->InputFormat); if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) v = (cmsFloat64Number) ((cmsFloat64Number*) accum)[(i + start) * Stride]; @@ -1162,7 +1205,9 @@ if (T_PLANAR(info -> InputFormat)) { - wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 + Stride /= PixelSize(info->InputFormat); + + wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 wIn[1] = (cmsFloat32Number) ((Pt[Stride] + 128) / 255.0); // form -128..+127 to 0..1 wIn[2] = (cmsFloat32Number) ((Pt[Stride*2] + 128) / 255.0); @@ -1190,6 +1235,8 @@ if (T_PLANAR(info -> InputFormat)) { + Stride /= PixelSize(info->InputFormat); + wIn[0] = (cmsFloat32Number) (Pt[0] / 100.0); // from 0..100 to 0..1 wIn[1] = (cmsFloat32Number) ((Pt[Stride] + 128) / 255.0); // form -128..+127 to 0..1 wIn[2] = (cmsFloat32Number) ((Pt[Stride*2] + 128) / 255.0); @@ -1220,6 +1267,8 @@ if (T_PLANAR(info -> InputFormat)) { + Stride /= PixelSize(info->InputFormat); + wIn[0] = (cmsFloat32Number) (Pt[0] / MAX_ENCODEABLE_XYZ); wIn[1] = (cmsFloat32Number) (Pt[Stride] / MAX_ENCODEABLE_XYZ); wIn[2] = (cmsFloat32Number) (Pt[Stride*2] / MAX_ENCODEABLE_XYZ); @@ -1247,6 +1296,8 @@ if (T_PLANAR(info -> InputFormat)) { + Stride /= PixelSize(info->InputFormat); + wIn[0] = (cmsFloat32Number) (Pt[0] / MAX_ENCODEABLE_XYZ); wIn[1] = (cmsFloat32Number) (Pt[Stride] / MAX_ENCODEABLE_XYZ); wIn[2] = (cmsFloat32Number) (Pt[Stride*2] / MAX_ENCODEABLE_XYZ); @@ -1277,15 +1328,15 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse = T_FLAVOR(info ->OutputFormat); - int Extra = T_EXTRA(info -> OutputFormat); - int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsUInt8Number* swap1; cmsUInt8Number v = 0; - int i; + cmsUInt32Number i; swap1 = output; @@ -1295,7 +1346,7 @@ for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = FROM_16_TO_8(wOut[index]); @@ -1329,16 +1380,16 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int SwapEndian = T_ENDIAN16(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse = T_FLAVOR(info ->OutputFormat); - int Extra = T_EXTRA(info -> OutputFormat); - int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); + cmsUInt32Number SwapEndian = T_ENDIAN16(info -> OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsUInt16Number* swap1; cmsUInt16Number v = 0; - int i; + cmsUInt32Number i; swap1 = (cmsUInt16Number*) output; @@ -1348,7 +1399,7 @@ for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = wOut[index]; @@ -1386,11 +1437,11 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int SwapFirst = T_SWAPFIRST(info ->OutputFormat); - int Reverse = T_FLAVOR(info ->OutputFormat); - int i; + cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info ->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); + cmsUInt32Number i; cmsUInt8Number* Init = output; @@ -1401,7 +1452,7 @@ for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; cmsUInt8Number v = FROM_16_TO_8(wOut[index]); *(cmsUInt8Number*) output = (cmsUInt8Number) (Reverse ? REVERSE_FLAVOR_8(v) : v); @@ -1420,21 +1471,21 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse= T_FLAVOR(info ->OutputFormat); - int SwapEndian = T_ENDIAN16(info -> OutputFormat); - int i; + cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); + cmsUInt32Number SwapEndian = T_ENDIAN16(info -> OutputFormat); + cmsUInt32Number i; cmsUInt8Number* Init = output; cmsUInt16Number v; if (DoSwap) { - output += T_EXTRA(info -> OutputFormat) * Stride * sizeof(cmsUInt16Number); + output += T_EXTRA(info -> OutputFormat) * Stride; } for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = wOut[index]; @@ -1445,7 +1496,7 @@ v = REVERSE_FLAVOR_16(v); *(cmsUInt16Number*) output = v; - output += (Stride * sizeof(cmsUInt16Number)); + output += Stride; } return (Init + sizeof(cmsUInt16Number)); @@ -1794,9 +1845,9 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - *output++ = (wOut[0] & 0xFF); - *output++ = (wOut[1] & 0xFF); - *output++ = (wOut[2] & 0xFF); + *output++ = (wOut[0] & 0xFFU); + *output++ = (wOut[1] & 0xFFU); + *output++ = (wOut[2] & 0xFFU); return output; @@ -1826,9 +1877,9 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - *output++ = (wOut[2] & 0xFF); - *output++ = (wOut[1] & 0xFF); - *output++ = (wOut[0] & 0xFF); + *output++ = (wOut[2] & 0xFFU); + *output++ = (wOut[1] & 0xFFU); + *output++ = (wOut[0] & 0xFFU); return output; @@ -1917,9 +1968,9 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - *output++ = (wOut[0] & 0xFF); - *output++ = (wOut[1] & 0xFF); - *output++ = (wOut[2] & 0xFF); + *output++ = (wOut[0] & 0xFFU); + *output++ = (wOut[1] & 0xFFU); + *output++ = (wOut[2] & 0xFFU); output++; return output; @@ -1953,9 +2004,9 @@ register cmsUInt32Number Stride) { output++; - *output++ = (wOut[0] & 0xFF); - *output++ = (wOut[1] & 0xFF); - *output++ = (wOut[2] & 0xFF); + *output++ = (wOut[0] & 0xFFU); + *output++ = (wOut[1] & 0xFFU); + *output++ = (wOut[2] & 0xFFU); return output; @@ -1987,9 +2038,9 @@ register cmsUInt32Number Stride) { output++; - *output++ = (wOut[2] & 0xFF); - *output++ = (wOut[1] & 0xFF); - *output++ = (wOut[0] & 0xFF); + *output++ = (wOut[2] & 0xFFU); + *output++ = (wOut[1] & 0xFFU); + *output++ = (wOut[0] & 0xFFU); return output; @@ -2021,9 +2072,9 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - *output++ = (wOut[2] & 0xFF); - *output++ = (wOut[1] & 0xFF); - *output++ = (wOut[0] & 0xFF); + *output++ = (wOut[2] & 0xFFU); + *output++ = (wOut[1] & 0xFFU); + *output++ = (wOut[0] & 0xFFU); output++; return output; @@ -2297,6 +2348,8 @@ cmsFloat32Number* Out = (cmsFloat32Number*) output; + Stride /= PixelSize(info->OutputFormat); + Out[0] = (cmsFloat32Number)Lab.L; Out[Stride] = (cmsFloat32Number)Lab.a; Out[Stride*2] = (cmsFloat32Number)Lab.b; @@ -2325,6 +2378,8 @@ cmsFloat64Number* Out = (cmsFloat64Number*) output; cmsXYZEncoded2Float(&XYZ, wOut); + Stride /= PixelSize(Info->OutputFormat); + Out[0] = XYZ.X; Out[Stride] = XYZ.Y; Out[Stride*2] = XYZ.Z; @@ -2352,6 +2407,8 @@ cmsFloat32Number* Out = (cmsFloat32Number*) output; cmsXYZEncoded2Float(&XYZ, wOut); + Stride /= PixelSize(Info->OutputFormat); + Out[0] = (cmsFloat32Number) XYZ.X; Out[Stride] = (cmsFloat32Number) XYZ.Y; Out[Stride*2] = (cmsFloat32Number) XYZ.Z; @@ -2379,24 +2436,26 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> OutputFormat); - int DoSwap = T_DOSWAP(info ->OutputFormat); - int Reverse = T_FLAVOR(info ->OutputFormat); - int Extra = T_EXTRA(info -> OutputFormat); - int SwapFirst = T_SWAPFIRST(info -> OutputFormat); - int Planar = T_PLANAR(info -> OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info -> OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> OutputFormat); + cmsUInt32Number Planar = T_PLANAR(info -> OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsFloat64Number maximum = IsInkSpace(info ->OutputFormat) ? 655.35 : 65535.0; cmsFloat64Number v = 0; cmsFloat64Number* swap1 = (cmsFloat64Number*) output; - int i, start = 0; + cmsUInt32Number i, start = 0; + + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = (cmsFloat64Number) wOut[index] / maximum; @@ -2430,24 +2489,26 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info->OutputFormat); - int DoSwap = T_DOSWAP(info->OutputFormat); - int Reverse = T_FLAVOR(info->OutputFormat); - int Extra = T_EXTRA(info->OutputFormat); - int SwapFirst = T_SWAPFIRST(info->OutputFormat); - int Planar = T_PLANAR(info->OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Planar = T_PLANAR(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsFloat64Number maximum = IsInkSpace(info->OutputFormat) ? 655.35 : 65535.0; cmsFloat64Number v = 0; cmsFloat32Number* swap1 = (cmsFloat32Number*)output; - int i, start = 0; + cmsUInt32Number i, start = 0; + + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i = 0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = (cmsFloat64Number)wOut[index] / maximum; @@ -2483,24 +2544,26 @@ cmsUInt8Number* output, cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info->OutputFormat); - int DoSwap = T_DOSWAP(info->OutputFormat); - int Reverse = T_FLAVOR(info->OutputFormat); - int Extra = T_EXTRA(info->OutputFormat); - int SwapFirst = T_SWAPFIRST(info->OutputFormat); - int Planar = T_PLANAR(info->OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Planar = T_PLANAR(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsFloat64Number maximum = IsInkSpace(info->OutputFormat) ? 100.0 : 1.0; cmsFloat32Number* swap1 = (cmsFloat32Number*)output; cmsFloat64Number v = 0; - int i, start = 0; + cmsUInt32Number i, start = 0; + + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i = 0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = wOut[index] * maximum; @@ -2532,24 +2595,26 @@ cmsUInt8Number* output, cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info->OutputFormat); - int DoSwap = T_DOSWAP(info->OutputFormat); - int Reverse = T_FLAVOR(info->OutputFormat); - int Extra = T_EXTRA(info->OutputFormat); - int SwapFirst = T_SWAPFIRST(info->OutputFormat); - int Planar = T_PLANAR(info->OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Planar = T_PLANAR(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsFloat64Number maximum = IsInkSpace(info->OutputFormat) ? 100.0 : 1.0; cmsFloat64Number v = 0; cmsFloat64Number* swap1 = (cmsFloat64Number*)output; - int i, start = 0; + cmsUInt32Number i, start = 0; + + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i = 0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = wOut[index] * maximum; @@ -2590,6 +2655,8 @@ if (T_PLANAR(Info -> OutputFormat)) { + Stride /= PixelSize(Info->OutputFormat); + Out[0] = (cmsFloat32Number) (wOut[0] * 100.0); Out[Stride] = (cmsFloat32Number) (wOut[1] * 255.0 - 128.0); Out[Stride*2] = (cmsFloat32Number) (wOut[2] * 255.0 - 128.0); @@ -2618,6 +2685,8 @@ if (T_PLANAR(Info -> OutputFormat)) { + Stride /= PixelSize(Info->OutputFormat); + Out[0] = (cmsFloat64Number) (wOut[0] * 100.0); Out[Stride] = (cmsFloat64Number) (wOut[1] * 255.0 - 128.0); Out[Stride*2] = (cmsFloat64Number) (wOut[2] * 255.0 - 128.0); @@ -2647,6 +2716,8 @@ if (T_PLANAR(Info -> OutputFormat)) { + Stride /= PixelSize(Info->OutputFormat); + Out[0] = (cmsFloat32Number) (wOut[0] * MAX_ENCODEABLE_XYZ); Out[Stride] = (cmsFloat32Number) (wOut[1] * MAX_ENCODEABLE_XYZ); Out[Stride*2] = (cmsFloat32Number) (wOut[2] * MAX_ENCODEABLE_XYZ); @@ -2675,6 +2746,8 @@ if (T_PLANAR(Info -> OutputFormat)) { + Stride /= PixelSize(Info->OutputFormat); + Out[0] = (cmsFloat64Number) (wOut[0] * MAX_ENCODEABLE_XYZ); Out[Stride] = (cmsFloat64Number) (wOut[1] * MAX_ENCODEABLE_XYZ); Out[Stride*2] = (cmsFloat64Number) (wOut[2] * MAX_ENCODEABLE_XYZ); @@ -2706,24 +2779,26 @@ register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); cmsFloat32Number v; - int i, start = 0; + cmsUInt32Number i, start = 0; cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 655.35F : 65535.0F; + Stride /= PixelSize(info->OutputFormat); + if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) v = _cmsHalf2Float ( ((cmsUInt16Number*) accum)[(i + start) * Stride] ); @@ -2758,24 +2833,25 @@ cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info -> InputFormat); - int DoSwap = T_DOSWAP(info ->InputFormat); - int Reverse = T_FLAVOR(info ->InputFormat); - int SwapFirst = T_SWAPFIRST(info -> InputFormat); - int Extra = T_EXTRA(info -> InputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; - int Planar = T_PLANAR(info -> InputFormat); + cmsUInt32Number nChan = T_CHANNELS(info -> InputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info ->InputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info ->InputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info -> InputFormat); + cmsUInt32Number Extra = T_EXTRA(info -> InputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number Planar = T_PLANAR(info -> InputFormat); cmsFloat32Number v; - int i, start = 0; + cmsUInt32Number i, start = 0; cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F; + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i=0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; if (Planar) v = _cmsHalf2Float ( ((cmsUInt16Number*) accum)[(i + start) * Stride] ); @@ -2808,24 +2884,26 @@ register cmsUInt8Number* output, register cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info->OutputFormat); - int DoSwap = T_DOSWAP(info->OutputFormat); - int Reverse = T_FLAVOR(info->OutputFormat); - int Extra = T_EXTRA(info->OutputFormat); - int SwapFirst = T_SWAPFIRST(info->OutputFormat); - int Planar = T_PLANAR(info->OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Planar = T_PLANAR(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsFloat32Number maximum = IsInkSpace(info->OutputFormat) ? 655.35F : 65535.0F; cmsFloat32Number v = 0; cmsUInt16Number* swap1 = (cmsUInt16Number*)output; - int i, start = 0; + cmsUInt32Number i, start = 0; + + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i = 0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = (cmsFloat32Number)wOut[index] / maximum; @@ -2859,24 +2937,26 @@ cmsUInt8Number* output, cmsUInt32Number Stride) { - int nChan = T_CHANNELS(info->OutputFormat); - int DoSwap = T_DOSWAP(info->OutputFormat); - int Reverse = T_FLAVOR(info->OutputFormat); - int Extra = T_EXTRA(info->OutputFormat); - int SwapFirst = T_SWAPFIRST(info->OutputFormat); - int Planar = T_PLANAR(info->OutputFormat); - int ExtraFirst = DoSwap ^ SwapFirst; + cmsUInt32Number nChan = T_CHANNELS(info->OutputFormat); + cmsUInt32Number DoSwap = T_DOSWAP(info->OutputFormat); + cmsUInt32Number Reverse = T_FLAVOR(info->OutputFormat); + cmsUInt32Number Extra = T_EXTRA(info->OutputFormat); + cmsUInt32Number SwapFirst = T_SWAPFIRST(info->OutputFormat); + cmsUInt32Number Planar = T_PLANAR(info->OutputFormat); + cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst; cmsFloat32Number maximum = IsInkSpace(info->OutputFormat) ? 100.0F : 1.0F; cmsUInt16Number* swap1 = (cmsUInt16Number*)output; cmsFloat32Number v = 0; - int i, start = 0; + cmsUInt32Number i, start = 0; + + Stride /= PixelSize(info->OutputFormat); if (ExtraFirst) start = Extra; for (i = 0; i < nChan; i++) { - int index = DoSwap ? (nChan - i - 1) : i; + cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i; v = wOut[index] * maximum; @@ -2907,7 +2987,7 @@ // ---------------------------------------------------------------------------------------------------------------- -static cmsFormatters16 InputFormatters16[] = { +static const cmsFormatters16 InputFormatters16[] = { // Type Mask Function // ---------------------------- ------------------------------------ ---------------------------- @@ -2978,7 +3058,7 @@ -static cmsFormattersFloat InputFormattersFloat[] = { +static const cmsFormattersFloat InputFormattersFloat[] = { // Type Mask Function // ---------------------------- ------------------------------------ ---------------------------- @@ -3011,7 +3091,7 @@ case CMS_PACK_FLAGS_16BITS: { for (i=0; i < sizeof(InputFormatters16) / sizeof(cmsFormatters16); i++) { - cmsFormatters16* f = InputFormatters16 + i; + const cmsFormatters16* f = InputFormatters16 + i; if ((dwInput & ~f ->Mask) == f ->Type) { fr.Fmt16 = f ->Frm; @@ -3023,7 +3103,7 @@ case CMS_PACK_FLAGS_FLOAT: { for (i=0; i < sizeof(InputFormattersFloat) / sizeof(cmsFormattersFloat); i++) { - cmsFormattersFloat* f = InputFormattersFloat + i; + const cmsFormattersFloat* f = InputFormattersFloat + i; if ((dwInput & ~f ->Mask) == f ->Type) { fr.FmtFloat = f ->Frm; @@ -3041,7 +3121,7 @@ return fr; } -static cmsFormatters16 OutputFormatters16[] = { +static const cmsFormatters16 OutputFormatters16[] = { // Type Mask Function // ---------------------------- ------------------------------------ ---------------------------- @@ -3129,7 +3209,7 @@ }; -static cmsFormattersFloat OutputFormattersFloat[] = { +static const cmsFormattersFloat OutputFormattersFloat[] = { // Type Mask Function // ---------------------------- --------------------------------------------------- ---------------------------- { TYPE_Lab_FLT, ANYPLANAR|ANYEXTRA, PackLabFloatFromFloat}, @@ -3147,8 +3227,6 @@ ANYFLAVOR|ANYSWAPFIRST|ANYSWAP|ANYEXTRA|ANYCHANNELS|ANYSPACE, PackHalfFromFloat }, #endif - - }; @@ -3168,7 +3246,7 @@ case CMS_PACK_FLAGS_16BITS: { for (i=0; i < sizeof(OutputFormatters16) / sizeof(cmsFormatters16); i++) { - cmsFormatters16* f = OutputFormatters16 + i; + const cmsFormatters16* f = OutputFormatters16 + i; if ((dwInput & ~f ->Mask) == f ->Type) { fr.Fmt16 = f ->Frm; @@ -3181,7 +3259,7 @@ case CMS_PACK_FLAGS_FLOAT: { for (i=0; i < sizeof(OutputFormattersFloat) / sizeof(cmsFormattersFloat); i++) { - cmsFormattersFloat* f = OutputFormattersFloat + i; + const cmsFormattersFloat* f = OutputFormattersFloat + i; if ((dwInput & ~f ->Mask) == f ->Type) { fr.FmtFloat = f ->Frm; @@ -3290,10 +3368,10 @@ return TRUE; } -cmsFormatter _cmsGetFormatter(cmsContext ContextID, - cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8 - cmsFormatterDirection Dir, - cmsUInt32Number dwFlags) +cmsFormatter CMSEXPORT _cmsGetFormatter(cmsContext ContextID, + cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8 + cmsFormatterDirection Dir, + cmsUInt32Number dwFlags) { _cmsFormattersPluginChunkType* ctx = ( _cmsFormattersPluginChunkType*) _cmsContextGetClientChunk(ContextID, FormattersPlugin); cmsFormattersFactoryList* f; @@ -3321,7 +3399,7 @@ // Return whatever given formatter refers to 8 bits cmsBool _cmsFormatterIs8bit(cmsUInt32Number Type) { - int Bytes = T_BYTES(Type); + cmsUInt32Number Bytes = T_BYTES(Type); return (Bytes == 1); } @@ -3331,9 +3409,9 @@ { cmsColorSpaceSignature ColorSpace = cmsGetColorSpace(hProfile); - cmsUInt32Number ColorSpaceBits = _cmsLCMScolorSpace(ColorSpace); + cmsUInt32Number ColorSpaceBits = (cmsUInt32Number) _cmsLCMScolorSpace(ColorSpace); cmsUInt32Number nOutputChans = cmsChannelsOf(ColorSpace); - cmsUInt32Number Float = lIsFloat ? 1 : 0; + cmsUInt32Number Float = lIsFloat ? 1U : 0; // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); @@ -3343,10 +3421,11 @@ cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsUInt32Number nBytes, cmsBool lIsFloat) { - cmsColorSpaceSignature ColorSpace = cmsGetPCS(hProfile); - int ColorSpaceBits = _cmsLCMScolorSpace(ColorSpace); - cmsUInt32Number nOutputChans = cmsChannelsOf(ColorSpace); - cmsUInt32Number Float = lIsFloat ? 1 : 0; + cmsColorSpaceSignature ColorSpace = cmsGetPCS(hProfile); + + cmsUInt32Number ColorSpaceBits = (cmsUInt32Number) _cmsLCMScolorSpace(ColorSpace); + cmsUInt32Number nOutputChans = cmsChannelsOf(ColorSpace); + cmsUInt32Number Float = lIsFloat ? 1U : 0; // Create a fake formatter for result return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans); diff -Nru lcms2-2.8/src/cmspcs.c lcms2-2.9/src/cmspcs.c --- lcms2-2.8/src/cmspcs.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmspcs.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -656,9 +656,9 @@ // This function returns a number of gridpoints to be used as LUT table. It assumes same number // of gripdpoints in all dimensions. Flags may override the choice. -int _cmsReasonableGridpointsByColorspace(cmsColorSpaceSignature Colorspace, cmsUInt32Number dwFlags) +cmsUInt32Number _cmsReasonableGridpointsByColorspace(cmsColorSpaceSignature Colorspace, cmsUInt32Number dwFlags) { - int nChannels; + cmsUInt32Number nChannels; // Already specified? if (dwFlags & 0x00FF0000) { @@ -802,7 +802,7 @@ case PT_MCH14: return cmsSigMCHEData; case PT_MCH15: return cmsSigMCHFData; - default: return (cmsColorSpaceSignature) (-1); + default: return (cmsColorSpaceSignature) 0; } } @@ -869,7 +869,7 @@ case cmsSigMCHFData: case cmsSig15colorData:return PT_MCH15; - default: return (cmsColorSpaceSignature) (-1); + default: return (cmsColorSpaceSignature) 0; } } diff -Nru lcms2-2.8/src/cmsplugin.c lcms2-2.9/src/cmsplugin.c --- lcms2-2.8/src/cmsplugin.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsplugin.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -172,14 +172,28 @@ _cmsAssert(io != NULL); - if (io -> Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1) - return FALSE; + if (io->Read(io, &tmp, sizeof(cmsUInt32Number), 1) != 1) + return FALSE; if (n != NULL) { tmp = _cmsAdjustEndianess32(tmp); - *n = *(cmsFloat32Number*) (void*) &tmp; + *n = *(cmsFloat32Number*)(void*)&tmp; + + // Safeguard which covers against absurd values + if (*n > 1E+20 || *n < -1E+20) return FALSE; + + #if defined(_MSC_VER) && _MSC_VER < 1800 + return TRUE; + #elif defined (__BORLANDC__) + return TRUE; + #else + + // fpclassify() required by C99 (only provided by MSVC >= 1800, VS2013 onwards) + return ((fpclassify(*n) == FP_ZERO) || (fpclassify(*n) == FP_NORMAL)); + #endif } + return TRUE; } @@ -193,7 +207,11 @@ if (io -> Read(io, &tmp, sizeof(cmsUInt64Number), 1) != 1) return FALSE; - if (n != NULL) _cmsAdjustEndianess64(n, &tmp); + if (n != NULL) { + + _cmsAdjustEndianess64(n, &tmp); + } + return TRUE; } @@ -208,7 +226,7 @@ return FALSE; if (n != NULL) { - *n = _cms15Fixed16toDouble(_cmsAdjustEndianess32(tmp)); + *n = _cms15Fixed16toDouble((cmsS15Fixed16Number) _cmsAdjustEndianess32(tmp)); } return TRUE; @@ -225,9 +243,9 @@ if (XYZ != NULL) { - XYZ->X = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.X)); - XYZ->Y = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.Y)); - XYZ->Z = _cms15Fixed16toDouble(_cmsAdjustEndianess32(xyz.Z)); + XYZ->X = _cms15Fixed16toDouble((cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) xyz.X)); + XYZ->Y = _cms15Fixed16toDouble((cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) xyz.Y)); + XYZ->Z = _cms15Fixed16toDouble((cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) xyz.Z)); } return TRUE; } @@ -316,7 +334,7 @@ _cmsAssert(io != NULL); - tmp = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(n)); + tmp = _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(n)); if (io -> Write(io, sizeof(cmsUInt32Number), &tmp) != 1) return FALSE; @@ -330,9 +348,9 @@ _cmsAssert(io != NULL); _cmsAssert(XYZ != NULL); - xyz.X = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(XYZ->X)); - xyz.Y = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(XYZ->Y)); - xyz.Z = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(XYZ->Z)); + xyz.X = (cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(XYZ->X)); + xyz.Y = (cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(XYZ->Y)); + xyz.Z = (cmsS15Fixed16Number) _cmsAdjustEndianess32((cmsUInt32Number) _cmsDoubleTo15Fixed16(XYZ->Z)); return io -> Write(io, sizeof(cmsEncodedXYZNumber), &xyz); } @@ -490,7 +508,7 @@ return FALSE; // Truncated, which is a fatal error for us } - rc = io ->Write(io, len, Buffer); + rc = io ->Write(io, (cmsUInt32Number) len, Buffer); va_end(args); @@ -750,6 +768,30 @@ struct _cmsContext_struct* ctx; struct _cmsContext_struct fakeContext; + // See the comments regarding locking in lcms2_internal.h + // for an explanation of why we need the following code. +#ifdef CMS_IS_WINDOWS_ +#ifndef CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT + { + static HANDLE _cmsWindowsInitMutex = NULL; + static volatile HANDLE* mutex = &_cmsWindowsInitMutex; + + if (*mutex == NULL) + { + HANDLE p = CreateMutex(NULL, FALSE, NULL); + if (p && InterlockedCompareExchangePointer((void **)mutex, (void*)p, NULL) != NULL) + CloseHandle(p); + } + if (*mutex == NULL || WaitForSingleObject(*mutex, INFINITE) == WAIT_FAILED) + return NULL; + if (((void **)&_cmsContextPoolHeadMutex)[0] == NULL) + InitializeCriticalSection(&_cmsContextPoolHeadMutex); + if (*mutex == NULL || !ReleaseMutex(*mutex)) + return NULL; + } +#endif +#endif + _cmsInstallAllocFunctions(_cmsFindMemoryPlugin(Plugin), &fakeContext.DefaultMemoryManager); fakeContext.chunks[UserPtr] = UserData; @@ -776,7 +818,7 @@ ctx ->chunks[MemPlugin] = &ctx->DefaultMemoryManager; // Now we can allocate the pool by using default memory manager - ctx ->MemPool = _cmsCreateSubAlloc(ctx, 22 * sizeof(void*)); // default size about 32 pointers + ctx ->MemPool = _cmsCreateSubAlloc(ctx, 22 * sizeof(void*)); // default size about 22 pointers if (ctx ->MemPool == NULL) { cmsDeleteContext(ctx); diff -Nru lcms2-2.8/src/cmsps2.c lcms2-2.9/src/cmsps2.c --- lcms2-2.8/src/cmsps2.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsps2.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -400,7 +400,7 @@ // Does write the intent static -void EmitIntent(cmsIOHANDLER* m, int RenderingIntent) +void EmitIntent(cmsIOHANDLER* m, cmsUInt32Number RenderingIntent) { const char *intent; @@ -534,7 +534,7 @@ // Compare gamma table static -cmsBool GammaTableEquals(cmsUInt16Number* g1, cmsUInt16Number* g2, int nEntries) +cmsBool GammaTableEquals(cmsUInt16Number* g1, cmsUInt16Number* g2, cmsUInt32Number nEntries) { return memcmp(g1, g2, nEntries* sizeof(cmsUInt16Number)) == 0; } @@ -543,9 +543,9 @@ // Does write a set of gamma curves static -void EmitNGamma(cmsIOHANDLER* m, int n, cmsToneCurve* g[]) +void EmitNGamma(cmsIOHANDLER* m, cmsUInt32Number n, cmsToneCurve* g[]) { - int i; + cmsUInt32Number i; for( i=0; i < n; i++ ) { @@ -768,7 +768,7 @@ static -int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, int Intent, cmsCIEXYZ* BlackPoint) +int EmitCIEBasedDEF(cmsIOHANDLER* m, cmsPipeline* Pipeline, cmsUInt32Number Intent, cmsCIEXYZ* BlackPoint) { const char* PreMaj; const char* PostMaj; @@ -828,14 +828,14 @@ // Generates a curve from a gray profile static - cmsToneCurve* ExtractGray2Y(cmsContext ContextID, cmsHPROFILE hProfile, int Intent) +cmsToneCurve* ExtractGray2Y(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt32Number Intent) { cmsToneCurve* Out = cmsBuildTabulatedToneCurve16(ContextID, 256, NULL); cmsHPROFILE hXYZ = cmsCreateXYZProfile(); cmsHTRANSFORM xform = cmsCreateTransformTHR(ContextID, hProfile, TYPE_GRAY_8, hXYZ, TYPE_XYZ_DBL, Intent, cmsFLAGS_NOOPTIMIZE); int i; - if (Out != NULL) { + if (Out != NULL && xform != NULL) { for (i=0; i < 256; i++) { cmsUInt8Number Gray = (cmsUInt8Number) i; @@ -847,8 +847,8 @@ } } - cmsDeleteTransform(xform); - cmsCloseProfile(hXYZ); + if (xform) cmsDeleteTransform(xform); + if (hXYZ) cmsCloseProfile(hXYZ); return Out; } @@ -858,7 +858,7 @@ // a more perceptually uniform space... I do choose Lab. static -int WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, int Intent, cmsUInt32Number dwFlags) +int WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags) { cmsHPROFILE hLab; cmsHTRANSFORM xform; @@ -943,7 +943,6 @@ // Does create CSA based on matrix-shaper. Allowed types are gray and RGB based - static int WriteInputMatrixShaper(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsStage* Matrix, cmsStage* Shaper) { @@ -969,17 +968,17 @@ memmove(&Mat, GetPtrToMatrix(Matrix), sizeof(Mat)); - for (i=0; i < 3; i++) - for (j=0; j < 3; j++) + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) Mat.v[i].n[j] *= MAX_ENCODEABLE_XYZ; - rc = EmitCIEBasedABC(m, (cmsFloat64Number *) &Mat, - _cmsStageGetPtrToCurveSet(Shaper), - &BlackPointAdaptedToD50); + rc = EmitCIEBasedABC(m, (cmsFloat64Number *)&Mat, + _cmsStageGetPtrToCurveSet(Shaper), + &BlackPointAdaptedToD50); } - else { + else { - cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Profile is not suitable for CSA. Unsupported colorspace."); + cmsSignalError(m->ContextID, cmsERROR_COLORSPACE_CHECK, "Profile is not suitable for CSA. Unsupported colorspace."); return 0; } @@ -992,12 +991,12 @@ // This is a HP extension, and it works in Lab instead of XYZ static -int WriteNamedColorCSA(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, int Intent) +int WriteNamedColorCSA(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, cmsUInt32Number Intent) { cmsHTRANSFORM xform; cmsHPROFILE hLab; - int i, nColors; - char ColorName[32]; + cmsUInt32Number i, nColors; + char ColorName[cmsMAX_PATH]; cmsNAMEDCOLORLIST* NamedColorList; hLab = cmsCreateLab4ProfileTHR(m ->ContextID, NULL); @@ -1275,20 +1274,20 @@ // 8 bits. static -int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, int Intent, cmsUInt32Number dwFlags) +int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags) { cmsHPROFILE hLab; cmsHTRANSFORM xform; - int i, nChannels; + cmsUInt32Number i, nChannels; cmsUInt32Number OutputFormat; _cmsTRANSFORM* v; cmsPipeline* DeviceLink; cmsHPROFILE Profiles[3]; cmsCIEXYZ BlackPointAdaptedToD50; - cmsBool lDoBPC = (dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION); - cmsBool lFixWhite = !(dwFlags & cmsFLAGS_NOWHITEONWHITEFIXUP); + cmsBool lDoBPC = (cmsBool) (dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION); + cmsBool lFixWhite = (cmsBool) !(dwFlags & cmsFLAGS_NOWHITEONWHITEFIXUP); cmsUInt32Number InFrm = TYPE_Lab_16; - int RelativeEncodingIntent; + cmsUInt32Number RelativeEncodingIntent; cmsColorSpaceSignature ColorSpace; @@ -1384,10 +1383,10 @@ // Builds a ASCII string containing colorant list in 0..1.0 range static -void BuildColorantList(char *Colorant, int nColorant, cmsUInt16Number Out[]) +void BuildColorantList(char *Colorant, cmsUInt32Number nColorant, cmsUInt16Number Out[]) { char Buff[32]; - int j; + cmsUInt32Number j; Colorant[0] = 0; if (nColorant > cmsMAXCHANNELS) @@ -1409,12 +1408,12 @@ // This is a HP extension. static -int WriteNamedColorCRD(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, int Intent, cmsUInt32Number dwFlags) +int WriteNamedColorCRD(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, cmsUInt32Number Intent, cmsUInt32Number dwFlags) { cmsHTRANSFORM xform; - int i, nColors, nColorant; + cmsUInt32Number i, nColors, nColorant; cmsUInt32Number OutputFormat; - char ColorName[32]; + char ColorName[cmsMAX_PATH]; char Colorant[128]; cmsNAMEDCOLORLIST* NamedColorList; diff -Nru lcms2-2.8/src/cmssamp.c lcms2-2.9/src/cmssamp.c --- lcms2-2.8/src/cmssamp.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmssamp.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/src/cmssm.c lcms2-2.9/src/cmssm.c --- lcms2-2.8/src/cmssm.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmssm.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/src/cmstypes.c lcms2-2.9/src/cmstypes.c --- lcms2-2.8/src/cmstypes.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmstypes.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -60,6 +60,11 @@ // Helper macro to define a MPE handler. Callbacks do have a fixed naming convention #define TYPE_MPE_HANDLER(t, x) { (t), READ_FN(x), WRITE_FN(x), GenericMPEdup, GenericMPEfree, NULL, 0 } +// Infinites +#define MINUS_INF (-1E22F) +#define PLUS_INF (+1E22F) + + // Register a new type handler. This routine is shared between normal types and MPE. LinkedList points to the optional list head static cmsBool RegisterTypesPlugin(cmsContext id, cmsPluginBase* Data, _cmsMemoryClient pos) @@ -173,6 +178,13 @@ { cmsUInt32Number i; cmsUInt32Number *ElementOffsets = NULL, *ElementSizes = NULL; + cmsUInt32Number currentPosition; + + currentPosition = io->Tell(io); + + // Verify there is enough space left to read at least two cmsUInt32Number items for Count items. + if (((io->ReportedSize - currentPosition) / (2 * sizeof(cmsUInt32Number))) < Count) + return FALSE; // Let's take the offsets to each element ElementOffsets = (cmsUInt32Number *) _cmsCalloc(io ->ContextID, Count, sizeof(cmsUInt32Number)); @@ -232,7 +244,7 @@ // Keep starting position of curve offsets DirectoryPos = io ->Tell(io); - + // Write a fake directory to be filled latter on for (i=0; i < Count; i++) { @@ -395,8 +407,8 @@ static cmsBool SaveOneChromaticity(cmsFloat64Number x, cmsFloat64Number y, cmsIOHANDLER* io) { - if (!_cmsWriteUInt32Number(io, _cmsDoubleTo15Fixed16(x))) return FALSE; - if (!_cmsWriteUInt32Number(io, _cmsDoubleTo15Fixed16(y))) return FALSE; + if (!_cmsWriteUInt32Number(io, (cmsUInt32Number) _cmsDoubleTo15Fixed16(x))) return FALSE; + if (!_cmsWriteUInt32Number(io, (cmsUInt32Number) _cmsDoubleTo15Fixed16(y))) return FALSE; return TRUE; } @@ -955,7 +967,7 @@ cmsBool rc = FALSE; char Filler[68]; - // Used below for writting zeroes + // Used below for writing zeroes memset(Filler, 0, sizeof(Filler)); // Get the len of string @@ -1117,7 +1129,10 @@ NewGamma = cmsBuildTabulatedToneCurve16(self ->ContextID, Count, NULL); if (!NewGamma) return NULL; - if (!_cmsReadUInt16Array(io, Count, NewGamma -> Table16)) return NULL; + if (!_cmsReadUInt16Array(io, Count, NewGamma -> Table16)) { + cmsFreeToneCurve(NewGamma); + return NULL; + } *nItems = 1; return NewGamma; @@ -1177,7 +1192,7 @@ // ******************************************************************************** -// Decide which curve type to use on writting +// Decide which curve type to use on writing static cmsTagTypeSignature DecideCurveType(cmsFloat64Number ICCVersion, const void *Data) { @@ -1459,7 +1474,8 @@ if (!_cmsReadUInt32Number(io, &Offset)) goto Error; // Check for overflow - if (Offset < (SizeOfHeader + 8)) goto Error; + if (Offset < (SizeOfHeader + 8)) goto Error; + if (((Offset + Len) < Len) || ((Offset + Len) > SizeOfTag + 8)) goto Error; // True begin of the string BeginOfThisString = Offset - SizeOfHeader - 8; @@ -1569,7 +1585,7 @@ // Type cmsSigLut8Type // ******************************************************************************** -// Decide which LUT type to use on writting +// Decide which LUT type to use on writing static cmsTagTypeSignature DecideLUTtypeA2B(cmsFloat64Number ICCVersion, const void *Data) { @@ -1618,10 +1634,10 @@ // Read 8 bit tables as gamma functions static -cmsBool Read8bitTables(cmsContext ContextID, cmsIOHANDLER* io, cmsPipeline* lut, int nChannels) +cmsBool Read8bitTables(cmsContext ContextID, cmsIOHANDLER* io, cmsPipeline* lut, cmsUInt32Number nChannels) { cmsUInt8Number* Temp = NULL; - int i, j; + cmsUInt32Number i, j; cmsToneCurve* Tables[cmsMAXCHANNELS]; if (nChannels > cmsMAXCHANNELS) return FALSE; @@ -1754,8 +1770,8 @@ if (!_cmsReadUInt8Number(io, NULL)) goto Error; // Do some checking - if (InputChannels > cmsMAXCHANNELS) goto Error; - if (OutputChannels > cmsMAXCHANNELS) goto Error; + if (InputChannels == 0 || InputChannels > cmsMAXCHANNELS) goto Error; + if (OutputChannels == 0 || OutputChannels > cmsMAXCHANNELS) goto Error; // Allocates an empty Pipeline NewLUT = cmsPipelineAlloc(self ->ContextID, InputChannels, OutputChannels); @@ -1812,8 +1828,10 @@ _cmsFree(self ->ContextID, Temp); Temp = NULL; - if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, cmsStageAllocCLut16bit(self ->ContextID, CLUTpoints, InputChannels, OutputChannels, T))) + if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, cmsStageAllocCLut16bit(self ->ContextID, CLUTpoints, InputChannels, OutputChannels, T))) { + _cmsFree(self ->ContextID, T); goto Error; + } _cmsFree(self ->ContextID, T); } @@ -1842,7 +1860,7 @@ _cmsStageToneCurvesData* PreMPE = NULL, *PostMPE = NULL; _cmsStageMatrixData* MatMPE = NULL; _cmsStageCLutData* clut = NULL; - int clutPoints; + cmsUInt32Number clutPoints; // Disassemble the LUT into components. mpe = NewLUT -> Elements; @@ -1962,9 +1980,10 @@ // Read 16 bit tables as gamma functions static -cmsBool Read16bitTables(cmsContext ContextID, cmsIOHANDLER* io, cmsPipeline* lut, int nChannels, int nEntries) +cmsBool Read16bitTables(cmsContext ContextID, cmsIOHANDLER* io, cmsPipeline* lut, + cmsUInt32Number nChannels, cmsUInt32Number nEntries) { - int i; + cmsUInt32Number i; cmsToneCurve* Tables[cmsMAXCHANNELS]; // Maybe an empty table? (this is a lcms extension) @@ -2006,10 +2025,10 @@ static cmsBool Write16bitTables(cmsContext ContextID, cmsIOHANDLER* io, _cmsStageToneCurvesData* Tables) { - int j; + cmsUInt32Number j; cmsUInt32Number i; cmsUInt16Number val; - int nEntries; + cmsUInt32Number nEntries; _cmsAssert(Tables != NULL); @@ -2047,8 +2066,8 @@ if (!_cmsReadUInt8Number(io, NULL)) return NULL; // Do some checking - if (InputChannels > cmsMAXCHANNELS) goto Error; - if (OutputChannels > cmsMAXCHANNELS) goto Error; + if (InputChannels == 0 || InputChannels > cmsMAXCHANNELS) goto Error; + if (OutputChannels == 0 || OutputChannels > cmsMAXCHANNELS) goto Error; // Allocates an empty LUT NewLUT = cmsPipelineAlloc(self ->ContextID, InputChannels, OutputChannels); @@ -2130,7 +2149,7 @@ _cmsStageToneCurvesData* PreMPE = NULL, *PostMPE = NULL; _cmsStageMatrixData* MatMPE = NULL; _cmsStageCLutData* clut = NULL; - int i, InputChannels, OutputChannels, clutPoints; + cmsUInt32Number i, InputChannels, OutputChannels, clutPoints; // Disassemble the LUT into components. mpe = NewLUT -> Elements; @@ -2316,7 +2335,8 @@ // V4 stuff. Read CLUT part for LutAtoB and LutBtoA static -cmsStage* ReadCLUT(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number Offset, int InputChannels, int OutputChannels) +cmsStage* ReadCLUT(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, + cmsUInt32Number Offset, cmsUInt32Number InputChannels, cmsUInt32Number OutputChannels) { cmsUInt8Number gridPoints8[cmsMAXCHANNELS]; // Number of grid points in each dimension. cmsUInt32Number GridPoints[cmsMAXCHANNELS], i; @@ -2352,7 +2372,10 @@ for (i=0; i < Data ->nEntries; i++) { - if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) return NULL; + if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) { + cmsStageFree(CLUT); + return NULL; + } Data ->Tab.T[i] = FROM_8_TO_16(v); } @@ -2482,7 +2505,10 @@ if (!_cmsReadUInt32Number(io, &offsetC)) return NULL; if (!_cmsReadUInt32Number(io, &offsetA)) return NULL; - // Allocates an empty LUT + if (inputChan == 0 || inputChan >= cmsMAXCHANNELS) return NULL; + if (outputChan == 0 || outputChan >= cmsMAXCHANNELS) return NULL; + + // Allocates an empty LUT NewLUT = cmsPipelineAlloc(self ->ContextID, inputChan, outputChan); if (NewLUT == NULL) return NULL; @@ -2664,7 +2690,7 @@ cmsBool Type_LUTA2B_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsPipeline* Lut = (cmsPipeline*) Ptr; - int inputChan, outputChan; + cmsUInt32Number inputChan, outputChan; cmsStage *A = NULL, *B = NULL, *M = NULL; cmsStage * Matrix = NULL; cmsStage * CLUT = NULL; @@ -2712,7 +2738,7 @@ if (CLUT != NULL) { offsetC = io ->Tell(io) - BaseOffset; - if (!WriteCLUT(self, io, Lut ->SaveAs8Bits ? 1 : 2, CLUT)) return FALSE; + if (!WriteCLUT(self, io, (Lut ->SaveAs8Bits ? 1U : 2U), CLUT)) return FALSE; } if (M != NULL) { @@ -2790,6 +2816,9 @@ if (!_cmsReadUInt8Number(io, &inputChan)) return NULL; if (!_cmsReadUInt8Number(io, &outputChan)) return NULL; + if (inputChan == 0 || inputChan >= cmsMAXCHANNELS) return NULL; + if (outputChan == 0 || outputChan >= cmsMAXCHANNELS) return NULL; + // Padding if (!_cmsReadUInt16Number(io, NULL)) return NULL; @@ -2849,7 +2878,7 @@ cmsBool Type_LUTB2A_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsPipeline* Lut = (cmsPipeline*) Ptr; - int inputChan, outputChan; + cmsUInt32Number inputChan, outputChan; cmsStage *A = NULL, *B = NULL, *M = NULL; cmsStage *Matrix = NULL; cmsStage *CLUT = NULL; @@ -2891,7 +2920,7 @@ if (CLUT != NULL) { offsetC = io ->Tell(io) - BaseOffset; - if (!WriteCLUT(self, io, Lut ->SaveAs8Bits ? 1 : 2, CLUT)) return FALSE; + if (!WriteCLUT(self, io, (Lut ->SaveAs8Bits ? 1U : 2U), CLUT)) return FALSE; } if (M != NULL) { @@ -2981,7 +3010,7 @@ for (i=0; i < Count; i++) { if (io ->Read(io, Name, 32, 1) != 1) goto Error; - Name[33] = 0; + Name[32] = 0; if (!_cmsReadUInt16Array(io, 3, PCS)) goto Error; @@ -3007,7 +3036,7 @@ cmsBool Type_ColorantTable_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) Ptr; - int i, nColors; + cmsUInt32Number i, nColors; nColors = cmsNamedColorCount(NamedColorList); @@ -3015,9 +3044,11 @@ for (i=0; i < nColors; i++) { - char root[33]; + char root[cmsMAX_PATH]; cmsUInt16Number PCS[3]; + memset(root, 0, sizeof(root)); + if (!cmsNamedColorInfo(NamedColorList, i, root, NULL, NULL, PCS, NULL)) return 0; root[32] = 0; @@ -3077,8 +3108,8 @@ cmsUInt32Number nDeviceCoords; // Num of device coordinates char prefix[32]; // Prefix for each color name char suffix[32]; // Suffix for each color name - cmsNAMEDCOLORLIST* v; - cmsUInt32Number i; + cmsNAMEDCOLORLIST* v; + cmsUInt32Number i; *nItems = 0; @@ -3099,7 +3130,7 @@ if (nDeviceCoords > cmsMAXCHANNELS) { cmsSignalError(self->ContextID, cmsERROR_RANGE, "Too many device coordinates '%d'", nDeviceCoords); - return 0; + goto Error; } for (i=0; i < count; i++) { @@ -3108,7 +3139,7 @@ char Root[33]; memset(Colorant, 0, sizeof(Colorant)); - if (io -> Read(io, Root, 32, 1) != 1) return NULL; + if (io -> Read(io, Root, 32, 1) != 1) goto Error; Root[32] = 0; // To prevent exploits if (!_cmsReadUInt16Array(io, 3, PCS)) goto Error; @@ -3135,7 +3166,7 @@ cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) Ptr; char prefix[33]; // Prefix for each color name char suffix[33]; // Suffix for each color name - int i, nColors; + cmsUInt32Number i, nColors; nColors = cmsNamedColorCount(NamedColorList); @@ -3155,7 +3186,7 @@ cmsUInt16Number PCS[3]; cmsUInt16Number Colorant[cmsMAXCHANNELS]; - char Root[33]; + char Root[cmsMAX_PATH]; if (!cmsNamedColorInfo(NamedColorList, i, Root, NULL, NULL, PCS, Colorant)) return 0; Root[32] = 0; @@ -3909,7 +3940,7 @@ cmsUInt16Number nSegments; cmsCurveSegment* Segments; cmsToneCurve* Curve; - cmsFloat32Number PrevBreak = -1E22F; // - infinite + cmsFloat32Number PrevBreak = MINUS_INF; // - infinite // Take signature and channels for each element. if (!_cmsReadUInt32Number(io, (cmsUInt32Number*) &ElementSig)) return NULL; @@ -3934,7 +3965,7 @@ } Segments[nSegments-1].x0 = PrevBreak; - Segments[nSegments-1].x1 = 1E22F; // A big cmsFloat32Number number + Segments[nSegments-1].x1 = PLUS_INF; // A big cmsFloat32Number number // Read segments for (i=0; i < nSegments; i++) { @@ -3968,7 +3999,7 @@ case cmsSigSampledCurveSeg: { cmsUInt32Number Count; - if (!_cmsReadUInt32Number(io, &Count)) return NULL; + if (!_cmsReadUInt32Number(io, &Count)) goto Error; Segments[i].nGridPoints = Count; Segments[i].SampledPoints = (cmsFloat32Number*) _cmsCalloc(self ->ContextID, Count, sizeof(cmsFloat32Number)); @@ -3987,7 +4018,7 @@ _cmsTagSignature2String(String, (cmsTagSignature) ElementSig); cmsSignalError(self->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unknown curve element type '%s' found.", String); } - return NULL; + goto Error; } } @@ -4001,7 +4032,12 @@ return Curve; Error: - if (Segments) _cmsFree(self ->ContextID, Segments); + if (Segments) { + for (i=0; i < nSegments; i++) { + if (Segments[i].SampledPoints) _cmsFree(self ->ContextID, Segments[i].SampledPoints); + } + _cmsFree(self ->ContextID, Segments); + } return NULL; } @@ -4055,7 +4091,7 @@ } _cmsFree(self ->ContextID, GammaTables); - *nItems = (mpe != NULL) ? 1 : 0; + *nItems = (mpe != NULL) ? 1U : 0; return mpe; cmsUNUSED_PARAMETER(SizeOfTag); @@ -4186,9 +4222,13 @@ if (!_cmsReadUInt16Number(io, &OutputChans)) return NULL; - nElems = InputChans * OutputChans; + // Input and output chans may be ANY (up to 0xffff), + // but we choose to limit to 16 channels for now + if (InputChans >= cmsMAXCHANNELS) return NULL; + if (OutputChans >= cmsMAXCHANNELS) return NULL; + + nElems = (cmsUInt32Number) InputChans * OutputChans; - // Input and output chans may be ANY (up to 0xffff) Matrix = (cmsFloat64Number*) _cmsCalloc(self ->ContextID, nElems, sizeof(cmsFloat64Number)); if (Matrix == NULL) return NULL; @@ -4203,7 +4243,11 @@ cmsFloat32Number v; - if (!_cmsReadFloat32Number(io, &v)) return NULL; + if (!_cmsReadFloat32Number(io, &v)) { + _cmsFree(self ->ContextID, Matrix); + _cmsFree(self ->ContextID, Offsets); + return NULL; + } Matrix[i] = v; } @@ -4212,7 +4256,11 @@ cmsFloat32Number v; - if (!_cmsReadFloat32Number(io, &v)) return NULL; + if (!_cmsReadFloat32Number(io, &v)) { + _cmsFree(self ->ContextID, Matrix); + _cmsFree(self ->ContextID, Offsets); + return NULL; + } Offsets[i] = v; } @@ -4283,18 +4331,22 @@ goto Error; // Copy MAX_INPUT_DIMENSIONS at most. Expand to cmsUInt32Number - nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? MAX_INPUT_DIMENSIONS : InputChans; - for (i=0; i < nMaxGrids; i++) GridPoints[i] = (cmsUInt32Number) Dimensions8[i]; + nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? (cmsUInt32Number) MAX_INPUT_DIMENSIONS : InputChans; + for (i = 0; i < nMaxGrids; i++) { + if (Dimensions8[i] == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least + GridPoints[i] = (cmsUInt32Number)Dimensions8[i]; + } + // Allocate the true CLUT mpe = cmsStageAllocCLutFloatGranular(self ->ContextID, GridPoints, InputChans, OutputChans, NULL); if (mpe == NULL) goto Error; - // Read the data + // Read and sanitize the data clut = (_cmsStageCLutData*) mpe ->Data; for (i=0; i < clut ->nEntries; i++) { - if (!_cmsReadFloat32Number(io, &clut ->Tab.TFloat[i])) goto Error; + if (!_cmsReadFloat32Number(io, &clut->Tab.TFloat[i])) goto Error; } *nItems = 1; @@ -4424,22 +4476,30 @@ if (!_cmsReadUInt16Number(io, &InputChans)) return NULL; if (!_cmsReadUInt16Number(io, &OutputChans)) return NULL; + if (InputChans == 0 || InputChans >= cmsMAXCHANNELS) return NULL; + if (OutputChans == 0 || OutputChans >= cmsMAXCHANNELS) return NULL; + // Allocates an empty LUT NewLUT = cmsPipelineAlloc(self ->ContextID, InputChans, OutputChans); if (NewLUT == NULL) return NULL; - if (!_cmsReadUInt32Number(io, &ElementCount)) return NULL; + if (!_cmsReadUInt32Number(io, &ElementCount)) goto Error; + if (!ReadPositionTable(self, io, ElementCount, BaseOffset, NewLUT, ReadMPEElem)) goto Error; - if (!ReadPositionTable(self, io, ElementCount, BaseOffset, NewLUT, ReadMPEElem)) { - if (NewLUT != NULL) cmsPipelineFree(NewLUT); - *nItems = 0; - return NULL; - } + // Check channel count + if (InputChans != NewLUT->InputChannels || + OutputChans != NewLUT->OutputChannels) goto Error; // Success *nItems = 1; return NewLUT; + // Error +Error: + if (NewLUT != NULL) cmsPipelineFree(NewLUT); + *nItems = 0; + return NULL; + cmsUNUSED_PARAMETER(SizeOfTag); } @@ -4450,7 +4510,7 @@ cmsBool Type_MPE_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsUInt32Number i, BaseOffset, DirectoryPos, CurrentPos; - int inputChan, outputChan; + cmsUInt32Number inputChan, outputChan; cmsUInt32Number ElemCount; cmsUInt32Number *ElementOffsets = NULL, *ElementSizes = NULL, Before; cmsStageSignature ElementSig; @@ -4498,7 +4558,7 @@ _cmsTagSignature2String(String, (cmsTagSignature) ElementSig); - // An unknow element was found. + // An unknown element was found. cmsSignalError(self->ContextID, cmsERROR_UNKNOWN_EXTENSION, "Found unknown MPE type '%s'", String); goto Error; } @@ -5233,38 +5293,38 @@ // This is the list of built-in types -static _cmsTagTypeLinkedList SupportedTagTypes[] = { +static const _cmsTagTypeLinkedList SupportedTagTypes[] = { -{TYPE_HANDLER(cmsSigChromaticityType, Chromaticity), &SupportedTagTypes[1] }, -{TYPE_HANDLER(cmsSigColorantOrderType, ColorantOrderType), &SupportedTagTypes[2] }, -{TYPE_HANDLER(cmsSigS15Fixed16ArrayType, S15Fixed16), &SupportedTagTypes[3] }, -{TYPE_HANDLER(cmsSigU16Fixed16ArrayType, U16Fixed16), &SupportedTagTypes[4] }, -{TYPE_HANDLER(cmsSigTextType, Text), &SupportedTagTypes[5] }, -{TYPE_HANDLER(cmsSigTextDescriptionType, Text_Description), &SupportedTagTypes[6] }, -{TYPE_HANDLER(cmsSigCurveType, Curve), &SupportedTagTypes[7] }, -{TYPE_HANDLER(cmsSigParametricCurveType, ParametricCurve), &SupportedTagTypes[8] }, -{TYPE_HANDLER(cmsSigDateTimeType, DateTime), &SupportedTagTypes[9] }, -{TYPE_HANDLER(cmsSigLut8Type, LUT8), &SupportedTagTypes[10] }, -{TYPE_HANDLER(cmsSigLut16Type, LUT16), &SupportedTagTypes[11] }, -{TYPE_HANDLER(cmsSigColorantTableType, ColorantTable), &SupportedTagTypes[12] }, -{TYPE_HANDLER(cmsSigNamedColor2Type, NamedColor), &SupportedTagTypes[13] }, -{TYPE_HANDLER(cmsSigMultiLocalizedUnicodeType, MLU), &SupportedTagTypes[14] }, -{TYPE_HANDLER(cmsSigProfileSequenceDescType, ProfileSequenceDesc), &SupportedTagTypes[15] }, -{TYPE_HANDLER(cmsSigSignatureType, Signature), &SupportedTagTypes[16] }, -{TYPE_HANDLER(cmsSigMeasurementType, Measurement), &SupportedTagTypes[17] }, -{TYPE_HANDLER(cmsSigDataType, Data), &SupportedTagTypes[18] }, -{TYPE_HANDLER(cmsSigLutAtoBType, LUTA2B), &SupportedTagTypes[19] }, -{TYPE_HANDLER(cmsSigLutBtoAType, LUTB2A), &SupportedTagTypes[20] }, -{TYPE_HANDLER(cmsSigUcrBgType, UcrBg), &SupportedTagTypes[21] }, -{TYPE_HANDLER(cmsSigCrdInfoType, CrdInfo), &SupportedTagTypes[22] }, -{TYPE_HANDLER(cmsSigMultiProcessElementType, MPE), &SupportedTagTypes[23] }, -{TYPE_HANDLER(cmsSigScreeningType, Screening), &SupportedTagTypes[24] }, -{TYPE_HANDLER(cmsSigViewingConditionsType, ViewingConditions), &SupportedTagTypes[25] }, -{TYPE_HANDLER(cmsSigXYZType, XYZ), &SupportedTagTypes[26] }, -{TYPE_HANDLER(cmsCorbisBrokenXYZtype, XYZ), &SupportedTagTypes[27] }, -{TYPE_HANDLER(cmsMonacoBrokenCurveType, Curve), &SupportedTagTypes[28] }, -{TYPE_HANDLER(cmsSigProfileSequenceIdType, ProfileSequenceId), &SupportedTagTypes[29] }, -{TYPE_HANDLER(cmsSigDictType, Dictionary), &SupportedTagTypes[30] }, +{TYPE_HANDLER(cmsSigChromaticityType, Chromaticity), (_cmsTagTypeLinkedList*) &SupportedTagTypes[1] }, +{TYPE_HANDLER(cmsSigColorantOrderType, ColorantOrderType), (_cmsTagTypeLinkedList*) &SupportedTagTypes[2] }, +{TYPE_HANDLER(cmsSigS15Fixed16ArrayType, S15Fixed16), (_cmsTagTypeLinkedList*) &SupportedTagTypes[3] }, +{TYPE_HANDLER(cmsSigU16Fixed16ArrayType, U16Fixed16), (_cmsTagTypeLinkedList*) &SupportedTagTypes[4] }, +{TYPE_HANDLER(cmsSigTextType, Text), (_cmsTagTypeLinkedList*) &SupportedTagTypes[5] }, +{TYPE_HANDLER(cmsSigTextDescriptionType, Text_Description), (_cmsTagTypeLinkedList*) &SupportedTagTypes[6] }, +{TYPE_HANDLER(cmsSigCurveType, Curve), (_cmsTagTypeLinkedList*) &SupportedTagTypes[7] }, +{TYPE_HANDLER(cmsSigParametricCurveType, ParametricCurve), (_cmsTagTypeLinkedList*) &SupportedTagTypes[8] }, +{TYPE_HANDLER(cmsSigDateTimeType, DateTime), (_cmsTagTypeLinkedList*) &SupportedTagTypes[9] }, +{TYPE_HANDLER(cmsSigLut8Type, LUT8), (_cmsTagTypeLinkedList*) &SupportedTagTypes[10] }, +{TYPE_HANDLER(cmsSigLut16Type, LUT16), (_cmsTagTypeLinkedList*) &SupportedTagTypes[11] }, +{TYPE_HANDLER(cmsSigColorantTableType, ColorantTable), (_cmsTagTypeLinkedList*) &SupportedTagTypes[12] }, +{TYPE_HANDLER(cmsSigNamedColor2Type, NamedColor), (_cmsTagTypeLinkedList*) &SupportedTagTypes[13] }, +{TYPE_HANDLER(cmsSigMultiLocalizedUnicodeType, MLU), (_cmsTagTypeLinkedList*) &SupportedTagTypes[14] }, +{TYPE_HANDLER(cmsSigProfileSequenceDescType, ProfileSequenceDesc),(_cmsTagTypeLinkedList*) &SupportedTagTypes[15] }, +{TYPE_HANDLER(cmsSigSignatureType, Signature), (_cmsTagTypeLinkedList*) &SupportedTagTypes[16] }, +{TYPE_HANDLER(cmsSigMeasurementType, Measurement), (_cmsTagTypeLinkedList*) &SupportedTagTypes[17] }, +{TYPE_HANDLER(cmsSigDataType, Data), (_cmsTagTypeLinkedList*) &SupportedTagTypes[18] }, +{TYPE_HANDLER(cmsSigLutAtoBType, LUTA2B), (_cmsTagTypeLinkedList*) &SupportedTagTypes[19] }, +{TYPE_HANDLER(cmsSigLutBtoAType, LUTB2A), (_cmsTagTypeLinkedList*) &SupportedTagTypes[20] }, +{TYPE_HANDLER(cmsSigUcrBgType, UcrBg), (_cmsTagTypeLinkedList*) &SupportedTagTypes[21] }, +{TYPE_HANDLER(cmsSigCrdInfoType, CrdInfo), (_cmsTagTypeLinkedList*) &SupportedTagTypes[22] }, +{TYPE_HANDLER(cmsSigMultiProcessElementType, MPE), (_cmsTagTypeLinkedList*) &SupportedTagTypes[23] }, +{TYPE_HANDLER(cmsSigScreeningType, Screening), (_cmsTagTypeLinkedList*) &SupportedTagTypes[24] }, +{TYPE_HANDLER(cmsSigViewingConditionsType, ViewingConditions), (_cmsTagTypeLinkedList*) &SupportedTagTypes[25] }, +{TYPE_HANDLER(cmsSigXYZType, XYZ), (_cmsTagTypeLinkedList*) &SupportedTagTypes[26] }, +{TYPE_HANDLER(cmsCorbisBrokenXYZtype, XYZ), (_cmsTagTypeLinkedList*) &SupportedTagTypes[27] }, +{TYPE_HANDLER(cmsMonacoBrokenCurveType, Curve), (_cmsTagTypeLinkedList*) &SupportedTagTypes[28] }, +{TYPE_HANDLER(cmsSigProfileSequenceIdType, ProfileSequenceId), (_cmsTagTypeLinkedList*) &SupportedTagTypes[29] }, +{TYPE_HANDLER(cmsSigDictType, Dictionary), (_cmsTagTypeLinkedList*) &SupportedTagTypes[30] }, {TYPE_HANDLER(cmsSigVcgtType, vcgt), NULL } }; @@ -5356,7 +5416,7 @@ { _cmsTagTypePluginChunkType* ctx = ( _cmsTagTypePluginChunkType*) _cmsContextGetClientChunk(ContextID, TagTypePlugin); - return GetHandler(sig, ctx->TagTypes, SupportedTagTypes); + return GetHandler(sig, ctx->TagTypes, (_cmsTagTypeLinkedList*) SupportedTagTypes); } // ******************************************************************************** @@ -5371,7 +5431,7 @@ } _cmsTagLinkedList; -// This is the list of built-in tags +// This is the list of built-in tags. The data of this list can be modified by plug-ins static _cmsTagLinkedList SupportedTags[] = { { cmsSigAToB0Tag, { 1, 3, { cmsSigLut16Type, cmsSigLutAtoBType, cmsSigLut8Type}, DecideLUTtypeA2B}, &SupportedTags[1]}, @@ -5420,7 +5480,7 @@ { cmsSigPreview2Tag, { 1, 3, { cmsSigLut16Type, cmsSigLutBtoAType, cmsSigLut8Type }, DecideLUTtypeB2A}, &SupportedTags[32]}, { cmsSigProfileDescriptionTag, { 1, 3, { cmsSigTextDescriptionType, cmsSigMultiLocalizedUnicodeType, cmsSigTextType}, DecideTextDescType}, &SupportedTags[33]}, - { cmsSigProfileSequenceDescTag, { 1, 1, { cmsSigProfileSequenceDescType }, NULL}, &SupportedTags[34]}, + { cmsSigProfileSequenceDescTag, { 1, 1, { cmsSigProfileSequenceDescType }, NULL}, &SupportedTags[34]}, { cmsSigTechnologyTag, { 1, 1, { cmsSigSignatureType }, NULL}, &SupportedTags[35]}, { cmsSigColorimetricIntentImageStateTag, { 1, 1, { cmsSigSignatureType }, NULL}, &SupportedTags[36]}, @@ -5457,10 +5517,10 @@ { cmsSigVcgtTag, { 1, 1, { cmsSigVcgtType}, NULL }, &SupportedTags[60]}, { cmsSigMetaTag, { 1, 1, { cmsSigDictType}, NULL }, &SupportedTags[61]}, { cmsSigProfileSequenceIdTag, { 1, 1, { cmsSigProfileSequenceIdType}, NULL }, &SupportedTags[62]}, + { cmsSigProfileDescriptionMLTag,{ 1, 1, { cmsSigMultiLocalizedUnicodeType}, NULL}, &SupportedTags[63]}, { cmsSigArgyllArtsTag, { 9, 1, { cmsSigS15Fixed16ArrayType}, NULL}, NULL} - }; /* diff -Nru lcms2-2.8/src/cmsvirt.c lcms2-2.9/src/cmsvirt.c --- lcms2-2.8/src/cmsvirt.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsvirt.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -291,7 +291,7 @@ { cmsHPROFILE hICC; cmsPipeline* Pipeline; - int nChannels; + cmsUInt32Number nChannels; hICC = cmsCreateProfilePlaceholder(ContextID); if (!hICC) @@ -397,7 +397,7 @@ cmsHPROFILE hICC; cmsPipeline* LUT; cmsStage* CLUT; - int nChannels; + cmsUInt32Number nChannels; if (ColorSpace != cmsSigCmykData) { cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "InkLimiting: Only CMYK currently supported"); @@ -726,13 +726,13 @@ // contrast, Saturation and white point displacement cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfileTHR(cmsContext ContextID, - int nLUTPoints, - cmsFloat64Number Bright, - cmsFloat64Number Contrast, - cmsFloat64Number Hue, - cmsFloat64Number Saturation, - int TempSrc, - int TempDest) + cmsUInt32Number nLUTPoints, + cmsFloat64Number Bright, + cmsFloat64Number Contrast, + cmsFloat64Number Hue, + cmsFloat64Number Saturation, + cmsUInt32Number TempSrc, + cmsUInt32Number TempDest) { cmsHPROFILE hICC; cmsPipeline* Pipeline; @@ -740,7 +740,7 @@ cmsCIExyY WhitePnt; cmsStage* CLUT; cmsUInt32Number Dimensions[MAX_INPUT_DIMENSIONS]; - int i; + cmsUInt32Number i; bchsw.Brightness = Bright; bchsw.Contrast = Contrast; @@ -778,7 +778,7 @@ for (i=0; i < MAX_INPUT_DIMENSIONS; i++) Dimensions[i] = nLUTPoints; CLUT = cmsStageAllocCLut16bitGranular(ContextID, Dimensions, 3, 3, NULL); - if (CLUT == NULL) return NULL; + if (CLUT == NULL) goto Error; if (!cmsStageSampleCLut16bit(CLUT, bchswSampler, (void*) &bchsw, 0)) { @@ -811,13 +811,13 @@ } -CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(int nLUTPoints, +CMSAPI cmsHPROFILE CMSEXPORT cmsCreateBCHSWabstractProfile(cmsUInt32Number nLUTPoints, cmsFloat64Number Bright, cmsFloat64Number Contrast, cmsFloat64Number Hue, cmsFloat64Number Saturation, - int TempSrc, - int TempDest) + cmsUInt32Number TempSrc, + cmsUInt32Number TempDest) { return cmsCreateBCHSWabstractProfileTHR(NULL, nLUTPoints, Bright, Contrast, Hue, Saturation, TempSrc, TempDest); } @@ -830,8 +830,10 @@ cmsHPROFILE hProfile; cmsPipeline* LUT = NULL; cmsStage* PostLin; - cmsToneCurve* EmptyTab; + cmsStage* OutLin; + cmsToneCurve* EmptyTab[3]; cmsUInt16Number Zero[2] = { 0, 0 }; + const cmsFloat64Number PickLstarMatrix[] = { 1, 0, 0 }; hProfile = cmsCreateProfilePlaceholder(ContextID); if (!hProfile) // can't allocate @@ -842,22 +844,28 @@ if (!SetTextTags(hProfile, L"NULL profile built-in")) goto Error; - cmsSetDeviceClass(hProfile, cmsSigOutputClass); cmsSetColorSpace(hProfile, cmsSigGrayData); cmsSetPCS(hProfile, cmsSigLabData); - // An empty LUTs is all we need - LUT = cmsPipelineAlloc(ContextID, 1, 1); + // Create a valid ICC 4 structure + LUT = cmsPipelineAlloc(ContextID, 3, 1); if (LUT == NULL) goto Error; - - EmptyTab = cmsBuildTabulatedToneCurve16(ContextID, 2, Zero); - PostLin = cmsStageAllocToneCurves(ContextID, 1, &EmptyTab); - cmsFreeToneCurve(EmptyTab); + + EmptyTab[0] = EmptyTab[1] = EmptyTab[2] = cmsBuildTabulatedToneCurve16(ContextID, 2, Zero); + PostLin = cmsStageAllocToneCurves(ContextID, 3, EmptyTab); + OutLin = cmsStageAllocToneCurves(ContextID, 1, EmptyTab); + cmsFreeToneCurve(EmptyTab[0]); if (!cmsPipelineInsertStage(LUT, cmsAT_END, PostLin)) goto Error; + if (!cmsPipelineInsertStage(LUT, cmsAT_END, cmsStageAllocMatrix(ContextID, 1, 3, PickLstarMatrix, NULL))) + goto Error; + + if (!cmsPipelineInsertStage(LUT, cmsAT_END, OutLin)) + goto Error; + if (!cmsWriteTag(hProfile, cmsSigBToA0Tag, (void*) LUT)) goto Error; if (!cmsWriteTag(hProfile, cmsSigMediaWhitePointTag, cmsD50_XYZ())) goto Error; @@ -938,7 +946,7 @@ { _cmsTRANSFORM* v = (_cmsTRANSFORM*) xform; cmsHPROFILE hICC = NULL; - int i, nColors; + cmsUInt32Number i, nColors; cmsNAMEDCOLORLIST *nc2 = NULL, *Original = NULL; // Create an empty placeholder @@ -1055,7 +1063,7 @@ { cmsHPROFILE hProfile = NULL; cmsUInt32Number FrmIn, FrmOut, ChansIn, ChansOut; - cmsUInt32Number ColorSpaceBitsIn, ColorSpaceBitsOut; + int ColorSpaceBitsIn, ColorSpaceBitsOut; _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform; cmsPipeline* LUT = NULL; cmsStage* mpe; diff -Nru lcms2-2.8/src/cmswtpnt.c lcms2-2.9/src/cmswtpnt.c --- lcms2-2.8/src/cmswtpnt.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmswtpnt.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -76,7 +76,6 @@ } // Obtain y(x) - y = -3.000*(x*x) + 2.870*x - 0.275; // wave factors (not used, but here for futures extensions) @@ -102,7 +101,7 @@ } ISOTEMPERATURE; -static ISOTEMPERATURE isotempdata[] = { +static const ISOTEMPERATURE isotempdata[] = { // {Mirek, Ut, Vt, Tt } {0, 0.18006, 0.26352, -0.24341}, {10, 0.18066, 0.26589, -0.25479}, @@ -266,7 +265,7 @@ // Build a White point, primary chromas transfer matrix from RGB to CIE XYZ // This is just an approximation, I am not handling all the non-linear // aspects of the RGB to XYZ process, and assumming that the gamma correction -// has transitive property in the tranformation chain. +// has transitive property in the transformation chain. // // the alghoritm: // diff -Nru lcms2-2.8/src/cmsxform.c lcms2-2.9/src/cmsxform.c --- lcms2-2.8/src/cmsxform.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/cmsxform.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -255,6 +255,8 @@ strideIn = 0; strideOut = 0; + memset(fIn, 0, sizeof(fIn)); + memset(fOut, 0, sizeof(fIn)); for (i = 0; i < LineCount; i++) { @@ -319,6 +321,7 @@ strideIn = 0; strideOut = 0; + memset(fIn, 0, sizeof(fIn)); for (i = 0; i < LineCount; i++) { @@ -356,6 +359,7 @@ strideIn = 0; strideOut = 0; + memset(wIn, 0, sizeof(wIn)); for (i = 0; i < LineCount; i++) { @@ -393,6 +397,8 @@ strideIn = 0; strideOut = 0; + memset(wIn, 0, sizeof(wIn)); + memset(wOut, 0, sizeof(wOut)); for (i = 0; i < LineCount; i++) { @@ -454,6 +460,8 @@ strideIn = 0; strideOut = 0; + memset(wIn, 0, sizeof(wIn)); + memset(wOut, 0, sizeof(wOut)); for (i = 0; i < LineCount; i++) { @@ -761,7 +769,10 @@ // Allocate needed memory _cmsTRANSFORM* p = (_cmsTRANSFORM*)_cmsMallocZero(ContextID, sizeof(_cmsTRANSFORM)); - if (!p) return NULL; + if (!p) { + cmsPipelineFree(lut); + return NULL; + } // Store the proposed pipeline p->Lut = lut; @@ -794,7 +805,7 @@ p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat; p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat; - // Save the day? + // Save the day? (Ignore the warning) if (Plugin->OldXform) { p->OldXform = (_cmsTransformFn) p->xform; p->xform = _cmsTransform2toTransformAdaptor; @@ -819,7 +830,7 @@ if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) { cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); - _cmsFree(ContextID, p); + cmsDeleteTransform(p); return NULL; } @@ -841,7 +852,7 @@ } else { - int BytesPerPixelInput; + cmsUInt32Number BytesPerPixelInput; p ->FromInput = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16; p ->ToOutput = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16; @@ -849,7 +860,7 @@ if (p ->FromInput == NULL || p ->ToOutput == NULL) { cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format"); - _cmsFree(ContextID, p); + cmsDeleteTransform(p); return NULL; } @@ -891,13 +902,13 @@ } static -cmsBool GetXFormColorSpaces(int nProfiles, cmsHPROFILE hProfiles[], cmsColorSpaceSignature* Input, cmsColorSpaceSignature* Output) +cmsBool GetXFormColorSpaces(cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[], cmsColorSpaceSignature* Input, cmsColorSpaceSignature* Output) { cmsColorSpaceSignature ColorSpaceIn, ColorSpaceOut; cmsColorSpaceSignature PostColorSpace; - int i; + cmsUInt32Number i; - if (nProfiles <= 0) return FALSE; + if (nProfiles == 0) return FALSE; if (hProfiles[0] == NULL) return FALSE; *Input = PostColorSpace = cmsGetColorSpace(hProfiles[0]); @@ -946,7 +957,7 @@ static cmsBool IsProperColorSpace(cmsColorSpaceSignature Check, cmsUInt32Number dwFormat) { - int Space1 = T_COLORSPACE(dwFormat); + int Space1 = (int) T_COLORSPACE(dwFormat); int Space2 = _cmsLCMScolorSpace(Check); if (Space1 == PT_ANY) return TRUE; @@ -1202,7 +1213,7 @@ hArray[0] = Input; hArray[1] = Output; - return cmsCreateMultiprofileTransformTHR(ContextID, hArray, Output == NULL ? 1 : 2, InputFormat, OutputFormat, Intent, dwFlags); + return cmsCreateMultiprofileTransformTHR(ContextID, hArray, Output == NULL ? 1U : 2U, InputFormat, OutputFormat, Intent, dwFlags); } CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransform(cmsHPROFILE Input, diff -Nru lcms2-2.8/src/lcms2_internal.h lcms2-2.9/src/lcms2_internal.h --- lcms2-2.8/src/lcms2_internal.h 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/lcms2_internal.h 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -77,7 +77,7 @@ // Maximum of channels for internal pipeline evaluation #define MAX_STAGE_CHANNELS 128 -// Unused parameter warning supression +// Unused parameter warning suppression #define cmsUNUSED_PARAMETER(x) ((void)x) // The specification for "inline" is section 6.7.4 of the C99 standard (ISO/IEC 9899:1999). @@ -96,8 +96,16 @@ # ifndef vsnprintf # define vsnprintf _vsnprintf # endif -#endif +/// Properly define some macros to accommodate +/// older MSVC versions. +# if _MSC_VER <= 1700 + #include + #define isnan _isnan + #define isinf(x) (!_finite((x))) +# endif + +#endif // A fast way to convert from/to 16 <-> 8 bits #define FROM_8_TO_16(rgb) (cmsUInt16Number) ((((cmsUInt16Number) (rgb)) << 8)|(rgb)) @@ -172,19 +180,48 @@ return _cmsQuickFloorWord(d); } +// Test bed entry points--------------------------------------------------------------- +#define CMSCHECKPOINT CMSAPI // Pthread support -------------------------------------------------------------------- #ifndef CMS_NO_PTHREADS // This is the threading support. Unfortunately, it has to be platform-dependent because // windows does not support pthreads. - #ifdef CMS_IS_WINDOWS_ #define WIN32_LEAN_AND_MEAN 1 #include +// The locking scheme in LCMS requires a single 'top level' mutex +// to work. This is actually implemented on Windows as a +// CriticalSection, because they are lighter weight. With +// pthreads, this is statically inited. Unfortunately, windows +// can't officially statically init critical sections. +// +// We can work around this in 2 ways. +// +// 1) We can use a proper mutex purely to protect the init +// of the CriticalSection. This in turns requires us to protect +// the Mutex creation, which we can do using the snappily +// named InterlockedCompareExchangePointer API (present on +// windows XP and above). +// +// 2) In cases where we want to work on pre-Windows XP, we +// can use an even more horrible hack described below. +// +// So why wouldn't we always use 2)? Because not calling +// the init function for a critical section means it fails +// testing with ApplicationVerifier (and presumably similar +// tools). +// +// We therefore default to 1, and people who want to be able +// to run on pre-Windows XP boxes can build with: +// CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT +// defined. This is automatically set for builds using +// versions of MSVC that don't have this API available. +// // From: http://locklessinc.com/articles/pthreads_on_windows/ // The pthreads API has an initialization macro that has no correspondence to anything in // the windows API. By investigating the internal definition of the critical section type, @@ -206,14 +243,30 @@ typedef CRITICAL_SECTION _cmsMutex; -#define CMS_MUTEX_INITIALIZER {(PRTL_CRITICAL_SECTION_DEBUG) -1,-1,0,0,0,0} - #ifdef _MSC_VER # if (_MSC_VER >= 1800) # pragma warning(disable : 26135) # endif #endif +#ifndef CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT +// If we are building with a version of MSVC smaller +// than 1400 (i.e. before VS2005) then we don't have +// the InterlockedCompareExchangePointer API, so use +// the old version. +# ifdef _MSC_VER +# if _MSC_VER < 1400 +# define CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT +# endif +# endif +#endif + +#ifdef CMS_RELY_ON_WINDOWS_STATIC_MUTEX_INIT +# define CMS_MUTEX_INITIALIZER {(PRTL_CRITICAL_SECTION_DEBUG) -1,-1,0,0,0,0} +#else +# define CMS_MUTEX_INITIALIZER {(PRTL_CRITICAL_SECTION_DEBUG)NULL,-1,0,0,0,0} +#endif + cmsINLINE int _cmsLockPrimitive(_cmsMutex *m) { EnterCriticalSection(m); @@ -449,7 +502,7 @@ void* chunks[MemoryClientMax]; // array of pointers to client chunks. Memory itself is hold in the suballocator. // If NULL, then it reverts to global Context0 - _cmsMemPluginChunkType DefaultMemoryManager; // The allocators used for creating the context itself. Cannot be overriden + _cmsMemPluginChunkType DefaultMemoryManager; // The allocators used for creating the context itself. Cannot be overridden }; // Returns a pointer to a valid context structure, including the global one if id is zero. @@ -771,10 +824,10 @@ // Interpolation --------------------------------------------------------------------------------------------------------- -cmsInterpParams* _cmsComputeInterpParams(cmsContext ContextID, int nSamples, int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags); -cmsInterpParams* _cmsComputeInterpParamsEx(cmsContext ContextID, const cmsUInt32Number nSamples[], int InputChan, int OutputChan, const void* Table, cmsUInt32Number dwFlags); -void _cmsFreeInterpParams(cmsInterpParams* p); -cmsBool _cmsSetInterpolationRoutine(cmsContext ContextID, cmsInterpParams* p); +CMSCHECKPOINT cmsInterpParams* CMSEXPORT _cmsComputeInterpParams(cmsContext ContextID, cmsUInt32Number nSamples, cmsUInt32Number InputChan, cmsUInt32Number OutputChan, const void* Table, cmsUInt32Number dwFlags); +cmsInterpParams* _cmsComputeInterpParamsEx(cmsContext ContextID, const cmsUInt32Number nSamples[], cmsUInt32Number InputChan, cmsUInt32Number OutputChan, const void* Table, cmsUInt32Number dwFlags); +CMSCHECKPOINT void CMSEXPORT _cmsFreeInterpParams(cmsInterpParams* p); +cmsBool _cmsSetInterpolationRoutine(cmsContext ContextID, cmsInterpParams* p); // Curves ---------------------------------------------------------------------------------------------------------------- @@ -824,20 +877,20 @@ // Special Stages (cannot be saved) -cmsStage* _cmsStageAllocLab2XYZ(cmsContext ContextID); -cmsStage* _cmsStageAllocXYZ2Lab(cmsContext ContextID); -cmsStage* _cmsStageAllocLabPrelin(cmsContext ContextID); -cmsStage* _cmsStageAllocLabV2ToV4(cmsContext ContextID); -cmsStage* _cmsStageAllocLabV2ToV4curves(cmsContext ContextID); -cmsStage* _cmsStageAllocLabV4ToV2(cmsContext ContextID); -cmsStage* _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS); -cmsStage* _cmsStageAllocIdentityCurves(cmsContext ContextID, int nChannels); -cmsStage* _cmsStageAllocIdentityCLut(cmsContext ContextID, int nChan); -cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID); -cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID); -cmsStage* _cmsStageNormalizeToLabFloat(cmsContext ContextID); -cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID); -cmsStage* _cmsStageClipNegatives(cmsContext ContextID, int nChannels); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocLab2XYZ(cmsContext ContextID); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocXYZ2Lab(cmsContext ContextID); +cmsStage* _cmsStageAllocLabPrelin(cmsContext ContextID); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocLabV2ToV4(cmsContext ContextID); +cmsStage* _cmsStageAllocLabV2ToV4curves(cmsContext ContextID); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocLabV4ToV2(cmsContext ContextID); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocNamedColor(cmsNAMEDCOLORLIST* NamedColorList, cmsBool UsePCS); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocIdentityCurves(cmsContext ContextID, cmsUInt32Number nChannels); +CMSCHECKPOINT cmsStage* CMSEXPORT _cmsStageAllocIdentityCLut(cmsContext ContextID, cmsUInt32Number nChan); +cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID); +cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID); +cmsStage* _cmsStageNormalizeToLabFloat(cmsContext ContextID); +cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID); +cmsStage* _cmsStageClipNegatives(cmsContext ContextID, cmsUInt32Number nChannels); // For curve set only @@ -872,9 +925,9 @@ // Read tags using low-level function, provide necessary glue code to adapt versions, etc. All those return a brand new copy // of the LUTS, since ownership of original is up to the profile. The user should free allocated resources. -cmsPipeline* _cmsReadInputLUT(cmsHPROFILE hProfile, int Intent); -cmsPipeline* _cmsReadOutputLUT(cmsHPROFILE hProfile, int Intent); -cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent); +CMSCHECKPOINT cmsPipeline* CMSEXPORT _cmsReadInputLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent); +CMSCHECKPOINT cmsPipeline* CMSEXPORT _cmsReadOutputLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent); +CMSCHECKPOINT cmsPipeline* CMSEXPORT _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, cmsUInt32Number Intent); // Special values cmsBool _cmsReadMediaWhitePoint(cmsCIEXYZ* Dest, cmsHPROFILE hProfile); @@ -899,8 +952,9 @@ // LUT optimization ------------------------------------------------------------------------------------------------ -cmsUInt16Number _cmsQuantizeVal(cmsFloat64Number i, int MaxSamples); -int _cmsReasonableGridpointsByColorspace(cmsColorSpaceSignature Colorspace, cmsUInt32Number dwFlags); +CMSCHECKPOINT cmsUInt16Number CMSEXPORT _cmsQuantizeVal(cmsFloat64Number i, cmsUInt32Number MaxSamples); + +cmsUInt32Number _cmsReasonableGridpointsByColorspace(cmsColorSpaceSignature Colorspace, cmsUInt32Number dwFlags); cmsBool _cmsEndPointsBySpace(cmsColorSpaceSignature Space, cmsUInt16Number **White, @@ -909,7 +963,7 @@ cmsBool _cmsOptimizePipeline(cmsContext ContextID, cmsPipeline** Lut, - int Intent, + cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags ); @@ -933,17 +987,17 @@ cmsBool _cmsFormatterIsFloat(cmsUInt32Number Type); cmsBool _cmsFormatterIs8bit(cmsUInt32Number Type); -cmsFormatter _cmsGetFormatter(cmsContext ContextID, - cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8 - cmsFormatterDirection Dir, - cmsUInt32Number dwFlags); +CMSCHECKPOINT cmsFormatter CMSEXPORT _cmsGetFormatter(cmsContext ContextID, + cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8 + cmsFormatterDirection Dir, + cmsUInt32Number dwFlags); #ifndef CMS_NO_HALF_SUPPORT // Half float -cmsFloat32Number _cmsHalf2Float(cmsUInt16Number h); -cmsUInt16Number _cmsFloat2Half(cmsFloat32Number flt); +CMSCHECKPOINT cmsFloat32Number CMSEXPORT _cmsHalf2Float(cmsUInt16Number h); +CMSCHECKPOINT cmsUInt16Number CMSEXPORT _cmsFloat2Half(cmsFloat32Number flt); #endif diff -Nru lcms2-2.8/src/Makefile.in lcms2-2.9/src/Makefile.in --- lcms2-2.8/src/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/src/Makefile.in 2017-11-21 08:22:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -19,7 +19,17 @@ # VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -83,15 +93,19 @@ build_triplet = @build@ host_triplet = @host@ subdir = src -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -200,6 +214,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -334,6 +349,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -375,7 +391,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -701,6 +716,8 @@ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-libLTLIBRARIES +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. Binary files /tmp/tmpOCPLj5/u12WxyAO2_/lcms2-2.8/testbed/bad_mpe.icc and /tmp/tmpOCPLj5/wJpmWv3wsW/lcms2-2.9/testbed/bad_mpe.icc differ diff -Nru lcms2-2.8/testbed/Makefile.am lcms2-2.9/testbed/Makefile.am --- lcms2-2.8/testbed/Makefile.am 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/testbed/Makefile.am 2017-11-20 20:59:38.000000000 +0000 @@ -11,8 +11,11 @@ # CFLAGS = --pedantic -Wall -std=c99 -O2 +# The testsuite binary is statically linked. This is necessary as it uses some +# of the internal funtions that are not necessarily exported by the shared +# library. testcms_LDADD = $(top_builddir)/src/liblcms2.la -testcms_LDFLAGS = @LDFLAGS@ +testcms_LDFLAGS = -static @LDFLAGS@ testcms_SOURCES = testcms2.c testplugin.c zoo_icc.c testcms2.h EXTRA_DIST = test1.icc bad.icc toosmall.icc test2.icc \ diff -Nru lcms2-2.8/testbed/Makefile.in lcms2-2.9/testbed/Makefile.in --- lcms2-2.8/testbed/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/testbed/Makefile.in 2017-11-21 08:22:46.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -18,7 +18,17 @@ # Makefile for building testcms # VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -83,15 +93,19 @@ host_triplet = @host@ check_PROGRAMS = testcms$(EXEEXT) subdir = testbed -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -166,6 +180,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -298,6 +313,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -312,8 +328,12 @@ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src # CFLAGS = --pedantic -Wall -std=c99 -O2 + +# The testsuite binary is statically linked. This is necessary as it uses some +# of the internal funtions that are not necessarily exported by the shared +# library. testcms_LDADD = $(top_builddir)/src/liblcms2.la -testcms_LDFLAGS = @LDFLAGS@ +testcms_LDFLAGS = -static @LDFLAGS@ testcms_SOURCES = testcms2.c testplugin.c zoo_icc.c testcms2.h EXTRA_DIST = test1.icc bad.icc toosmall.icc test2.icc \ test3.icc test4.icc \ @@ -335,7 +355,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testbed/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testbed/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -611,6 +630,8 @@ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am +.PRECIOUS: Makefile + check: if [ $(top_srcdir) != $(top_builddir) ]; then \ diff -Nru lcms2-2.8/testbed/testcms2.c lcms2-2.9/testbed/testcms2.c --- lcms2-2.8/testbed/testcms2.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/testbed/testcms2.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -1571,7 +1571,7 @@ if (Result[0] != 0 || Result[1] != 0 || Result[2] != 0){ Fail("Reverse interpolation didn't find zero"); - return 0; + goto Error; } // Transverse identity @@ -1591,6 +1591,10 @@ cmsPipelineFree(Lut); return (max <= FLOAT_PRECISSION); + +Error: + cmsPipelineFree(Lut); + return 0; } @@ -1648,9 +1652,9 @@ cmsPipelineEvalFloat(Target, Result, Lut); - if (!IsGoodFixed15_16("0", Target[0], Result[0])) return 0; - if (!IsGoodFixed15_16("1", Target[1], Result[1])) return 0; - if (!IsGoodFixed15_16("2", Target[2], Result[2])) return 0; + if (!IsGoodFixed15_16("0", Target[0], Result[0])) goto Error; + if (!IsGoodFixed15_16("1", Target[1], Result[1])) goto Error; + if (!IsGoodFixed15_16("2", Target[2], Result[2])) goto Error; } SubTest("4->3 zero"); @@ -1669,7 +1673,7 @@ if (Result[0] != 0 || Result[1] != 0 || Result[2] != 0 || Result[3] != 0){ Fail("Reverse interpolation didn't find zero"); - return 0; + goto Error; } SubTest("4->3 find CMY"); @@ -1689,6 +1693,10 @@ cmsPipelineFree(Lut); return (max <= FLOAT_PRECISSION); + +Error: + cmsPipelineFree(Lut); + return 0; } @@ -2731,7 +2739,7 @@ -// Join two gamma tables in floting point format. Result should be a straight line +// Join two gamma tables in floating point format. Result should be a straight line static cmsToneCurve* CombineGammaFloat(cmsToneCurve* g1, cmsToneCurve* g2) { @@ -3671,10 +3679,10 @@ { cmsNAMEDCOLORLIST* nc = NULL, *nc2; cmsInt32Number i, j, rc=1; - char Name[255]; + char Name[cmsMAX_PATH]; cmsUInt16Number PCS[3]; cmsUInt16Number Colorant[cmsMAXCHANNELS]; - char CheckName[255]; + char CheckName[cmsMAX_PATH]; cmsUInt16Number CheckPCS[3]; cmsUInt16Number CheckColorant[cmsMAXCHANNELS]; cmsHPROFILE h; @@ -3805,9 +3813,9 @@ Values[i] <<= 8; } - b.Fmt16(&info, Values, Buffer, 1); + b.Fmt16(&info, Values, Buffer, 2); memset(Values, 0, sizeof(Values)); - f.Fmt16(&info, Values, Buffer, 1); + f.Fmt16(&info, Values, Buffer, 2); for (i=0; i < nChannels; i++) { if (bytes == 1) @@ -4000,6 +4008,8 @@ C( TYPE_ALabV2_8 ); C( TYPE_LabV2_16 ); +#ifndef CMS_NO_HALF_SUPPORT + C( TYPE_GRAY_HALF_FLT ); C( TYPE_RGB_HALF_FLT ); C( TYPE_CMYK_HALF_FLT ); @@ -4011,6 +4021,7 @@ C( TYPE_BGRA_HALF_FLT ); C( TYPE_ABGR_HALF_FLT ); +#endif return FormatterFailed == 0 ? 1 : 0; } @@ -4106,7 +4117,9 @@ C( TYPE_RGB_DBL ); C( TYPE_BGR_DBL ); C( TYPE_CMYK_DBL ); + C( TYPE_XYZ_FLT ); +#ifndef CMS_NO_HALF_SUPPORT C( TYPE_GRAY_HALF_FLT ); C( TYPE_RGB_HALF_FLT ); C( TYPE_CMYK_HALF_FLT ); @@ -4117,8 +4130,9 @@ C( TYPE_BGR_HALF_FLT ); C( TYPE_BGRA_HALF_FLT ); C( TYPE_ABGR_HALF_FLT ); +#endif + - C( TYPE_XYZ_FLT ); return FormatterFailed == 0 ? 1 : 0; @@ -5240,139 +5254,139 @@ if (h == NULL) return 0; cmsSetProfileVersion(h, 4.3); - if (cmsGetTagCount(h) != 0) { Fail("Empty profile with nonzero number of tags"); return 0; } - if (cmsIsTag(h, cmsSigAToB0Tag)) { Fail("Found a tag in an empty profile"); return 0; } + if (cmsGetTagCount(h) != 0) { Fail("Empty profile with nonzero number of tags"); goto Error; } + if (cmsIsTag(h, cmsSigAToB0Tag)) { Fail("Found a tag in an empty profile"); goto Error; } cmsSetColorSpace(h, cmsSigRgbData); - if (cmsGetColorSpace(h) != cmsSigRgbData) { Fail("Unable to set colorspace"); return 0; } + if (cmsGetColorSpace(h) != cmsSigRgbData) { Fail("Unable to set colorspace"); goto Error; } cmsSetPCS(h, cmsSigLabData); - if (cmsGetPCS(h) != cmsSigLabData) { Fail("Unable to set colorspace"); return 0; } + if (cmsGetPCS(h) != cmsSigLabData) { Fail("Unable to set colorspace"); goto Error; } cmsSetDeviceClass(h, cmsSigDisplayClass); - if (cmsGetDeviceClass(h) != cmsSigDisplayClass) { Fail("Unable to set deviceclass"); return 0; } + if (cmsGetDeviceClass(h) != cmsSigDisplayClass) { Fail("Unable to set deviceclass"); goto Error; } cmsSetHeaderRenderingIntent(h, INTENT_SATURATION); - if (cmsGetHeaderRenderingIntent(h) != INTENT_SATURATION) { Fail("Unable to set rendering intent"); return 0; } + if (cmsGetHeaderRenderingIntent(h) != INTENT_SATURATION) { Fail("Unable to set rendering intent"); goto Error; } for (Pass = 1; Pass <= 2; Pass++) { SubTest("Tags holding XYZ"); - if (!CheckXYZ(Pass, h, cmsSigBlueColorantTag)) return 0; - if (!CheckXYZ(Pass, h, cmsSigGreenColorantTag)) return 0; - if (!CheckXYZ(Pass, h, cmsSigRedColorantTag)) return 0; - if (!CheckXYZ(Pass, h, cmsSigMediaBlackPointTag)) return 0; - if (!CheckXYZ(Pass, h, cmsSigMediaWhitePointTag)) return 0; - if (!CheckXYZ(Pass, h, cmsSigLuminanceTag)) return 0; + if (!CheckXYZ(Pass, h, cmsSigBlueColorantTag)) goto Error; + if (!CheckXYZ(Pass, h, cmsSigGreenColorantTag)) goto Error; + if (!CheckXYZ(Pass, h, cmsSigRedColorantTag)) goto Error; + if (!CheckXYZ(Pass, h, cmsSigMediaBlackPointTag)) goto Error; + if (!CheckXYZ(Pass, h, cmsSigMediaWhitePointTag)) goto Error; + if (!CheckXYZ(Pass, h, cmsSigLuminanceTag)) goto Error; SubTest("Tags holding curves"); - if (!CheckGamma(Pass, h, cmsSigBlueTRCTag)) return 0; - if (!CheckGamma(Pass, h, cmsSigGrayTRCTag)) return 0; - if (!CheckGamma(Pass, h, cmsSigGreenTRCTag)) return 0; - if (!CheckGamma(Pass, h, cmsSigRedTRCTag)) return 0; + if (!CheckGamma(Pass, h, cmsSigBlueTRCTag)) goto Error; + if (!CheckGamma(Pass, h, cmsSigGrayTRCTag)) goto Error; + if (!CheckGamma(Pass, h, cmsSigGreenTRCTag)) goto Error; + if (!CheckGamma(Pass, h, cmsSigRedTRCTag)) goto Error; SubTest("Tags holding text"); - if (!CheckTextSingle(Pass, h, cmsSigCharTargetTag)) return 0; - if (!CheckTextSingle(Pass, h, cmsSigScreeningDescTag)) return 0; + if (!CheckTextSingle(Pass, h, cmsSigCharTargetTag)) goto Error; + if (!CheckTextSingle(Pass, h, cmsSigScreeningDescTag)) goto Error; - if (!CheckText(Pass, h, cmsSigCopyrightTag)) return 0; - if (!CheckText(Pass, h, cmsSigProfileDescriptionTag)) return 0; - if (!CheckText(Pass, h, cmsSigDeviceMfgDescTag)) return 0; - if (!CheckText(Pass, h, cmsSigDeviceModelDescTag)) return 0; - if (!CheckText(Pass, h, cmsSigViewingCondDescTag)) return 0; + if (!CheckText(Pass, h, cmsSigCopyrightTag)) goto Error; + if (!CheckText(Pass, h, cmsSigProfileDescriptionTag)) goto Error; + if (!CheckText(Pass, h, cmsSigDeviceMfgDescTag)) goto Error; + if (!CheckText(Pass, h, cmsSigDeviceModelDescTag)) goto Error; + if (!CheckText(Pass, h, cmsSigViewingCondDescTag)) goto Error; SubTest("Tags holding cmsICCData"); - if (!CheckData(Pass, h, cmsSigPs2CRD0Tag)) return 0; - if (!CheckData(Pass, h, cmsSigPs2CRD1Tag)) return 0; - if (!CheckData(Pass, h, cmsSigPs2CRD2Tag)) return 0; - if (!CheckData(Pass, h, cmsSigPs2CRD3Tag)) return 0; - if (!CheckData(Pass, h, cmsSigPs2CSATag)) return 0; - if (!CheckData(Pass, h, cmsSigPs2RenderingIntentTag)) return 0; + if (!CheckData(Pass, h, cmsSigPs2CRD0Tag)) goto Error; + if (!CheckData(Pass, h, cmsSigPs2CRD1Tag)) goto Error; + if (!CheckData(Pass, h, cmsSigPs2CRD2Tag)) goto Error; + if (!CheckData(Pass, h, cmsSigPs2CRD3Tag)) goto Error; + if (!CheckData(Pass, h, cmsSigPs2CSATag)) goto Error; + if (!CheckData(Pass, h, cmsSigPs2RenderingIntentTag)) goto Error; SubTest("Tags holding signatures"); - if (!CheckSignature(Pass, h, cmsSigColorimetricIntentImageStateTag)) return 0; - if (!CheckSignature(Pass, h, cmsSigPerceptualRenderingIntentGamutTag)) return 0; - if (!CheckSignature(Pass, h, cmsSigSaturationRenderingIntentGamutTag)) return 0; - if (!CheckSignature(Pass, h, cmsSigTechnologyTag)) return 0; + if (!CheckSignature(Pass, h, cmsSigColorimetricIntentImageStateTag)) goto Error; + if (!CheckSignature(Pass, h, cmsSigPerceptualRenderingIntentGamutTag)) goto Error; + if (!CheckSignature(Pass, h, cmsSigSaturationRenderingIntentGamutTag)) goto Error; + if (!CheckSignature(Pass, h, cmsSigTechnologyTag)) goto Error; SubTest("Tags holding date_time"); - if (!CheckDateTime(Pass, h, cmsSigCalibrationDateTimeTag)) return 0; - if (!CheckDateTime(Pass, h, cmsSigDateTimeTag)) return 0; + if (!CheckDateTime(Pass, h, cmsSigCalibrationDateTimeTag)) goto Error; + if (!CheckDateTime(Pass, h, cmsSigDateTimeTag)) goto Error; SubTest("Tags holding named color lists"); - if (!CheckNamedColor(Pass, h, cmsSigColorantTableTag, 15, FALSE)) return 0; - if (!CheckNamedColor(Pass, h, cmsSigColorantTableOutTag, 15, FALSE)) return 0; - if (!CheckNamedColor(Pass, h, cmsSigNamedColor2Tag, 4096, TRUE)) return 0; + if (!CheckNamedColor(Pass, h, cmsSigColorantTableTag, 15, FALSE)) goto Error; + if (!CheckNamedColor(Pass, h, cmsSigColorantTableOutTag, 15, FALSE)) goto Error; + if (!CheckNamedColor(Pass, h, cmsSigNamedColor2Tag, 4096, TRUE)) goto Error; SubTest("Tags holding LUTs"); - if (!CheckLUT(Pass, h, cmsSigAToB0Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigAToB1Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigAToB2Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigBToA0Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigBToA1Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigBToA2Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigPreview0Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigPreview1Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigPreview2Tag)) return 0; - if (!CheckLUT(Pass, h, cmsSigGamutTag)) return 0; + if (!CheckLUT(Pass, h, cmsSigAToB0Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigAToB1Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigAToB2Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigBToA0Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigBToA1Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigBToA2Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigPreview0Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigPreview1Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigPreview2Tag)) goto Error; + if (!CheckLUT(Pass, h, cmsSigGamutTag)) goto Error; SubTest("Tags holding CHAD"); - if (!CheckCHAD(Pass, h, cmsSigChromaticAdaptationTag)) return 0; + if (!CheckCHAD(Pass, h, cmsSigChromaticAdaptationTag)) goto Error; SubTest("Tags holding Chromaticity"); - if (!CheckChromaticity(Pass, h, cmsSigChromaticityTag)) return 0; + if (!CheckChromaticity(Pass, h, cmsSigChromaticityTag)) goto Error; SubTest("Tags holding colorant order"); - if (!CheckColorantOrder(Pass, h, cmsSigColorantOrderTag)) return 0; + if (!CheckColorantOrder(Pass, h, cmsSigColorantOrderTag)) goto Error; SubTest("Tags holding measurement"); - if (!CheckMeasurement(Pass, h, cmsSigMeasurementTag)) return 0; + if (!CheckMeasurement(Pass, h, cmsSigMeasurementTag)) goto Error; SubTest("Tags holding CRD info"); - if (!CheckCRDinfo(Pass, h, cmsSigCrdInfoTag)) return 0; + if (!CheckCRDinfo(Pass, h, cmsSigCrdInfoTag)) goto Error; SubTest("Tags holding UCR/BG"); - if (!CheckUcrBg(Pass, h, cmsSigUcrBgTag)) return 0; + if (!CheckUcrBg(Pass, h, cmsSigUcrBgTag)) goto Error; SubTest("Tags holding MPE"); - if (!CheckMPE(Pass, h, cmsSigDToB0Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigDToB1Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigDToB2Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigDToB3Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigBToD0Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigBToD1Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigBToD2Tag)) return 0; - if (!CheckMPE(Pass, h, cmsSigBToD3Tag)) return 0; + if (!CheckMPE(Pass, h, cmsSigDToB0Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigDToB1Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigDToB2Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigDToB3Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigBToD0Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigBToD1Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigBToD2Tag)) goto Error; + if (!CheckMPE(Pass, h, cmsSigBToD3Tag)) goto Error; SubTest("Tags using screening"); - if (!CheckScreening(Pass, h, cmsSigScreeningTag)) return 0; + if (!CheckScreening(Pass, h, cmsSigScreeningTag)) goto Error; SubTest("Tags holding profile sequence description"); - if (!CheckProfileSequenceTag(Pass, h)) return 0; - if (!CheckProfileSequenceIDTag(Pass, h)) return 0; + if (!CheckProfileSequenceTag(Pass, h)) goto Error; + if (!CheckProfileSequenceIDTag(Pass, h)) goto Error; SubTest("Tags holding ICC viewing conditions"); - if (!CheckICCViewingConditions(Pass, h)) return 0; + if (!CheckICCViewingConditions(Pass, h)) goto Error; SubTest("VCGT tags"); - if (!CheckVCGT(Pass, h)) return 0; + if (!CheckVCGT(Pass, h)) goto Error; SubTest("RAW tags"); - if (!CheckRAWtags(Pass, h)) return 0; + if (!CheckRAWtags(Pass, h)) goto Error; SubTest("Dictionary meta tags"); - // if (!CheckDictionary16(Pass, h)) return 0; - if (!CheckDictionary24(Pass, h)) return 0; + // if (!CheckDictionary16(Pass, h)) goto Error; + if (!CheckDictionary24(Pass, h)) goto Error; if (Pass == 1) { cmsSaveProfileToFile(h, "alltags.icc"); @@ -5394,6 +5408,11 @@ cmsCloseProfile(h); remove("alltags.icc"); return 1; + +Error: + cmsCloseProfile(h); + remove("alltags.icc"); + return 0; } @@ -6856,6 +6875,33 @@ } +static +cmsInt32Number CheckCGATS2(void) +{ + cmsHANDLE handle; + const cmsUInt8Number junk[] = { 0x0, 0xd, 0xd, 0xa, 0x20, 0xd, 0x20, 0x20, 0x20, 0x3a, 0x31, 0x3d, 0x3d, 0x3d, 0x3d }; + + handle = cmsIT8LoadFromMem(0, (const void*)junk, sizeof(junk)); + if (handle) + cmsIT8Free(handle); + + return 1; +} + + +static +cmsInt32Number CheckCGATS_Overflow(void) +{ + cmsHANDLE handle; + const cmsUInt8Number junk[] = { "@\nA 1.e2147483648\n" }; + + handle = cmsIT8LoadFromMem(0, (const void*)junk, sizeof(junk)); + if (handle) + cmsIT8Free(handle); + + return 1; +} + // Create CSA/CRD static @@ -7952,8 +7998,142 @@ return 1; } +/** +* Bug reported & fixed. Thanks to Kornel Lesinski for spotting this. +*/ +static +int CheckSE(void) +{ + cmsHPROFILE input_profile = Create_AboveRGB(); + cmsHPROFILE output_profile = cmsCreate_sRGBProfile(); + cmsHTRANSFORM tr = cmsCreateTransform(input_profile, TYPE_RGBA_8, output_profile, TYPE_RGBA_16_SE, INTENT_RELATIVE_COLORIMETRIC, cmsFLAGS_COPY_ALPHA); + + cmsUInt8Number rgba[4] = { 40, 41, 41, 0xfa }; + cmsUInt16Number out[4]; + + cmsDoTransform(tr, rgba, out, 1); + cmsCloseProfile(input_profile); + cmsCloseProfile(output_profile); + cmsDeleteTransform(tr); + if (out[0] != 0xf622 || out[1] != 0x7f24 || out[2] != 0x7f24) + return 0; + + return 1; +} + +/** +* Bug reported. +*/ +static +int CheckForgedMPE(void) +{ + cmsUInt32Number i; + cmsHPROFILE srcProfile; + cmsHPROFILE dstProfile; + cmsColorSpaceSignature srcCS; + cmsUInt32Number nSrcComponents; + cmsUInt32Number srcFormat; + cmsUInt32Number intent = 0; + cmsUInt32Number flags = 0; + cmsHTRANSFORM hTransform; + cmsUInt8Number output[4]; + + srcProfile = cmsOpenProfileFromFile("bad_mpe.icc", "r"); + if (!srcProfile) + return 0; + + dstProfile = cmsCreate_sRGBProfile(); + if (!dstProfile) { + cmsCloseProfile(srcProfile); + return 0; + } + + srcCS = cmsGetColorSpace(srcProfile); + nSrcComponents = cmsChannelsOf(srcCS); + + if (srcCS == cmsSigLabData) { + srcFormat = + COLORSPACE_SH(PT_Lab) | CHANNELS_SH(nSrcComponents) | BYTES_SH(0); + } + else { + srcFormat = + COLORSPACE_SH(PT_ANY) | CHANNELS_SH(nSrcComponents) | BYTES_SH(1); + } + + cmsSetLogErrorHandler(ErrorReportingFunction); + + hTransform = cmsCreateTransform(srcProfile, srcFormat, dstProfile, + TYPE_BGR_8, intent, flags); + cmsCloseProfile(srcProfile); + cmsCloseProfile(dstProfile); + + cmsSetLogErrorHandler(FatalErrorQuit); + + // Should report error + if (!TrappedError) return 0; + + TrappedError = FALSE; + + // Transform should NOT be created + if (!hTransform) return 1; + + // Never should reach here + if (T_BYTES(srcFormat) == 0) { // 0 means double + double input[128]; + for (i = 0; i < nSrcComponents; i++) + input[i] = 0.5f; + cmsDoTransform(hTransform, input, output, 1); + } + else { + cmsUInt8Number input[128]; + for (i = 0; i < nSrcComponents; i++) + input[i] = 128; + cmsDoTransform(hTransform, input, output, 1); + } + cmsDeleteTransform(hTransform); + + return 0; +} + +/** +* What the self test is trying to do is creating a proofing transform +* with gamut check, so we can getting the coverage of one profile of +* another, i.e. to approximate the gamut intersection. e.g. +* Thanks to Richard Hughes for providing the test +*/ +static +int CheckProofingIntersection(void) +{ + cmsHPROFILE profile_null, hnd1, hnd2; + cmsHTRANSFORM transform; + + hnd1 = cmsCreate_sRGBProfile(); + hnd2 = Create_AboveRGB(); + + profile_null = cmsCreateNULLProfileTHR(DbgThread()); + transform = cmsCreateProofingTransformTHR(DbgThread(), + hnd1, + TYPE_RGB_FLT, + profile_null, + TYPE_GRAY_FLT, + hnd2, + INTENT_ABSOLUTE_COLORIMETRIC, + INTENT_ABSOLUTE_COLORIMETRIC, + cmsFLAGS_GAMUTCHECK | + cmsFLAGS_SOFTPROOFING); + + cmsCloseProfile(hnd1); + cmsCloseProfile(hnd2); + cmsCloseProfile(profile_null); + + // Failed? + if (transform == NULL) return 0; + + cmsDeleteTransform(transform); + return 1; +} // -------------------------------------------------------------------------------------------------- // P E R F O R M A N C E C H E C K S @@ -8373,6 +8553,7 @@ _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif + // First of all, check for the right header if (cmsGetEncodedCMMversion() != LCMS_VERSION) { Die("Oops, you are mixing header and shared lib!\nHeader version reports to be '%d' and shared lib '%d'\n", LCMS_VERSION, cmsGetEncodedCMMversion()); @@ -8402,7 +8583,7 @@ printf("done.\n"); PrintSupportedIntents(); - + Check("Base types", CheckBaseTypes); Check("endianess", CheckEndianess); Check("quick floor", CheckQuickFloor); @@ -8580,6 +8761,8 @@ Check("TAC detection", CheckTAC); Check("CGATS parser", CheckCGATS); + Check("CGATS parser on junk", CheckCGATS2); + Check("CGATS parser on overflow", CheckCGATS_Overflow); Check("PostScript generator", CheckPostScript); Check("Segment maxima GBD", CheckGBD); Check("MD5 digest", CheckMD5); @@ -8595,9 +8778,10 @@ Check("Set free a tag", CheckRemoveTag); Check("Matrix simplification", CheckMatrixSimplify); Check("Planar 8 optimization", CheckPlanar8opt); - + Check("Swap endian feature", CheckSE); Check("Transform line stride RGB", CheckTransformLineStride); - + Check("Forged MPE profile", CheckForgedMPE); + Check("Proofing intersection", CheckProofingIntersection); } if (DoPluginTests) diff -Nru lcms2-2.8/testbed/testplugin.c lcms2-2.9/testbed/testplugin.c --- lcms2-2.8/testbed/testplugin.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/testbed/testplugin.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/testbed/zoo_icc.c lcms2-2.9/testbed/zoo_icc.c --- lcms2-2.8/testbed/zoo_icc.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/testbed/zoo_icc.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/.travis.yml lcms2-2.9/.travis.yml --- lcms2-2.8/.travis.yml 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/.travis.yml 2017-11-20 20:59:38.000000000 +0000 @@ -1,5 +1,195 @@ language: c -compiler: - - gcc - - clang -script: ./configure && make && make check + +matrix: + include: +# OSX standard test build +# this is really a GCC frontend with an LLVM back-end + - os: osx + env: + - MATRIX_EVAL="CC=gcc && CXX=g++" + +# OSX and pure GCCs +# https://docs.travis-ci.com/user/languages/c/#GCC-on-OS-X + - os: osx + env: + - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + + - os: osx + env: + - MATRIX_EVAL="brew install gcc5 && CC=gcc-5 && CXX=g++-5" + + - os: osx + env: + - MATRIX_EVAL="brew install gcc6 && CC=gcc-6 && CXX=g++-6" + + - os: osx + env: + - MATRIX_EVAL="brew install gcc && CC=gcc-7 && CXX=g++-7" + +# OSX and pure LLVMs - the version is controlled by the osx_image variable +# images as per https://blog.travis-ci.com/2017-10-16-a-new-default-os-x-image-is-coming + - os: osx + osx_image: xcode6.4 + env: + - MATRIX_EVAL="CC=clang && CXX=clang" + + - os: osx + osx_image: xcode7.3 + env: + - MATRIX_EVAL="CC=clang && CXX=clang" + + - os: osx + osx_image: xcode8.3 + env: + - MATRIX_EVAL="CC=clang && CXX=clang" + + - os: osx + osx_image: xcode9 + env: + - MATRIX_EVAL="CC=clang && CXX=clang" + + - os: osx + osx_image: xcode9.1 + env: + - MATRIX_EVAL="CC=clang && CXX=clang" + +# Linux and GCCs + # gcc 4.8 at the time of writing + - os: linux + dist: trusty + env: + - MATRIX_EVAL="CC=gcc && CXX=g++" + +# for newer GCCs, add ubuntu-toolchain-r-test +# https://docs.travis-ci.com/user/languages/c/ + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.9 + env: + - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" + + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + env: + - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" + + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 + env: + - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" + + + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + env: + - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" + +# Linux and LLVMs +# https://docs.travis-ci.com/user/languages/c/#Clang + - os: linux + dist: trusty + env: + - MATRIX_EVAL="CC=clang && CXX=clang" + + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.6 + packages: + - clang-3.6 + env: + - MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6" + + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.7 + packages: + - clang-3.7 + env: + - MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7" + + - os: linux + dist: trusty + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-precise-3.8 + packages: + - clang-3.8 + env: + - MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8" + + - os: linux + dist: trusty + addons: + apt: + sources: + - llvm-toolchain-trusty-3.9 + packages: + - clang-3.9 + env: + - MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9" + + - os: linux + dist: trusty + addons: + apt: + sources: + - llvm-toolchain-trusty-4.0 + packages: + - clang-4.0 + env: + - MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0" + + - os: linux + dist: trusty + addons: + apt: + sources: + - llvm-toolchain-trusty-5.0 + packages: + - clang-5.0 + env: + - MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0" + + +before_install: +# avoid issues with outdated Homebrew installation on Mac OSX by updating it +# before anything else +# TODO: remove "brew update" line after 2017-11-15, see https://blog.travis-ci.com/2017-10-16-a-new-default-os-x-image-is-coming and +# https://github.com/travis-ci/travis-ci/issues/8552 + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - eval "${MATRIX_EVAL}" + +script: autoreconf -V && autoreconf --force && ./configure && cat config.log && make && make check diff -Nru lcms2-2.8/utils/common/utils.h lcms2-2.9/utils/common/utils.h --- lcms2-2.8/utils/common/utils.h 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/common/utils.h 2017-11-20 20:59:38.000000000 +0000 @@ -2,7 +2,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/utils/common/vprf.c lcms2-2.9/utils/common/vprf.c --- lcms2-2.8/utils/common/vprf.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/common/vprf.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/utils/jpgicc/jpgicc.c lcms2-2.9/utils/jpgicc/jpgicc.c --- lcms2-2.8/utils/jpgicc/jpgicc.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/jpgicc/jpgicc.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/utils/jpgicc/Makefile.in lcms2-2.9/utils/jpgicc/Makefile.in --- lcms2-2.8/utils/jpgicc/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/jpgicc/Makefile.in 2017-11-21 08:22:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,17 @@ # Bugs introduced by Marti Maria on October 2004 VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -85,14 +95,19 @@ host_triplet = @host@ @HasJPEG_TRUE@bin_PROGRAMS = jpgicc$(EXEEXT) subdir = utils/jpgicc -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -199,6 +214,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -331,6 +347,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -366,7 +383,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/jpgicc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign utils/jpgicc/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -715,6 +731,8 @@ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcms2-2.8/utils/linkicc/linkicc.c lcms2-2.9/utils/linkicc/linkicc.c --- lcms2-2.8/utils/linkicc/linkicc.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/linkicc/linkicc.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/utils/linkicc/Makefile.in lcms2-2.9/utils/linkicc/Makefile.in --- lcms2-2.8/utils/linkicc/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/linkicc/Makefile.in 2017-11-21 08:22:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,17 @@ # Additions and bugs by Marti Maria VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -85,14 +95,19 @@ host_triplet = @host@ bin_PROGRAMS = linkicc$(EXEEXT) subdir = utils/linkicc -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -169,6 +184,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -301,6 +317,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -336,7 +353,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/linkicc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign utils/linkicc/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -639,6 +655,8 @@ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcms2-2.8/utils/psicc/Makefile.in lcms2-2.9/utils/psicc/Makefile.in --- lcms2-2.8/utils/psicc/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/psicc/Makefile.in 2017-11-21 08:22:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,17 @@ # Additions and bugs by Marti Maria VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -85,14 +95,19 @@ host_triplet = @host@ bin_PROGRAMS = psicc$(EXEEXT) subdir = utils/psicc -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -169,6 +184,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -301,6 +317,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -336,7 +353,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/psicc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign utils/psicc/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -639,6 +655,8 @@ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcms2-2.8/utils/psicc/psicc.c lcms2-2.9/utils/psicc/psicc.c --- lcms2-2.8/utils/psicc/psicc.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/psicc/psicc.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/utils/tificc/Makefile.in lcms2-2.9/utils/tificc/Makefile.in --- lcms2-2.8/utils/tificc/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/tificc/Makefile.in 2017-11-21 08:22:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,17 @@ # bugs introduced by Marti Maria VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -85,14 +95,19 @@ host_triplet = @host@ @HasTIFF_TRUE@bin_PROGRAMS = tificc$(EXEEXT) subdir = utils/tificc -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -199,6 +214,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -331,6 +347,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -366,7 +383,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/tificc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign utils/tificc/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -715,6 +731,8 @@ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-man uninstall-man1 +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcms2-2.8/utils/tificc/tifdiff.c lcms2-2.9/utils/tificc/tifdiff.c --- lcms2-2.8/utils/tificc/tifdiff.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/tificc/tifdiff.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), diff -Nru lcms2-2.8/utils/tificc/tificc.c lcms2-2.9/utils/tificc/tificc.c --- lcms2-2.8/utils/tificc/tificc.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/tificc/tificc.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -650,7 +650,7 @@ } -// A replacement for (the nonstandard) filelenght +// A replacement for (the nonstandard) filelength static @@ -708,7 +708,7 @@ hProfile = cmsOpenProfileFromMem(EmbedBuffer, EmbedLen); // Print description found in the profile - if (Verbose & hProfile != NULL) { + if (Verbose && (hProfile != NULL)) { fprintf(stdout, "\n[Embedded profile]\n"); PrintProfileInformation(hProfile); diff -Nru lcms2-2.8/utils/transicc/Makefile.in lcms2-2.9/utils/transicc/Makefile.in --- lcms2-2.8/utils/transicc/Makefile.in 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/transicc/Makefile.in 2017-11-21 08:22:47.000000000 +0000 @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. +# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2013 Free Software Foundation, Inc. +# Copyright (C) 1994-2014 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,17 @@ # Additions and bugs by Marti Maria VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ @@ -85,14 +95,19 @@ host_triplet = @host@ bin_PROGRAMS = transicc$(EXEEXT) subdir = utils/transicc -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/m4/ax_append_compile_flags.m4 \ + $(top_srcdir)/m4/ax_append_flag.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \ + $(top_srcdir)/m4/ax_require_defined.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @@ -169,6 +184,7 @@ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -301,6 +317,7 @@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -336,7 +353,6 @@ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign utils/transicc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign utils/transicc/Makefile -.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ @@ -639,6 +655,8 @@ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff -Nru lcms2-2.8/utils/transicc/transicc.c lcms2-2.9/utils/transicc/transicc.c --- lcms2-2.8/utils/transicc/transicc.c 2016-07-20 07:46:01.000000000 +0000 +++ lcms2-2.9/utils/transicc/transicc.c 2017-11-20 20:59:38.000000000 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------------- // // Little Color Management System -// Copyright (c) 1998-2016 Marti Maria Saguer +// Copyright (c) 1998-2017 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), @@ -691,7 +691,7 @@ static cmsUInt16Number GetIndex(void) { - char Buffer[4096], Name[40], Prefix[40], Suffix[40]; + char Buffer[4096], Name[cmsMAX_PATH], Prefix[40], Suffix[40]; int index, max; const cmsNAMEDCOLORLIST* NamedColorList;