[libpng16] Changed ICC profile matrix/vector types to not depend on array

type rules.  By the ANSI-C standard the new types should be identical to the
previous versions, and all known versions of gcc tested with the previous
versions except for GCC-4.2.1 work with this version.  The change makes the
ANSI-C rule that const applied to an array of elements applies instead to the
elements in the array moot by explicitly applying const to the base
elements of the png_icc_matrix and png_icc_vector types. The accidental
(harmless) 'const' previously applied to the parameters of two of the
functions have also been removed.
This commit is contained in:
John Bowler 2012-09-06 12:17:00 -05:00 committed by Glenn Randers-Pehrson
parent 73f826cb49
commit b257147015
3 changed files with 33 additions and 15 deletions

View File

@ -1,5 +1,5 @@
Libpng 1.6.0beta30 - September 4, 2012 Libpng 1.6.0beta30 - September 6, 2012
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@ -504,7 +504,16 @@ Version 1.6.0beta29 [September 4, 2012]
part plus guessing a gAMA value requires code to pass selected RGB values part plus guessing a gAMA value requires code to pass selected RGB values
through the profile. through the profile.
Version 1.6.0beta30 [September 4, 2012] Version 1.6.0beta30 [September 6, 2012]
Changed ICC profile matrix/vector types to not depend on array type rules.
By the ANSI-C standard the new types should be identical to the previous
versions, and all known versions of gcc tested with the previous versions
except for GCC-4.2.1 work with this version. The change makes the ANSI-C
rule that const applied to an array of elements applies instead to the
elements in the array moot by explicitly applying const to the base
elements of the png_icc_matrix and png_icc_vector types. The accidental
(harmless) 'const' previously applied to the parameters of two of the
functions have also been removed.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

11
CHANGES
View File

@ -4256,7 +4256,16 @@ Version 1.6.0beta29 [September 4, 2012]
part plus guessing a gAMA value requires code to pass selected RGB values part plus guessing a gAMA value requires code to pass selected RGB values
through the profile. through the profile.
Version 1.6.0beta30 [September 4, 2012] Version 1.6.0beta30 [September 6, 2012]
Changed ICC profile matrix/vector types to not depend on array type rules.
By the ANSI-C standard the new types should be identical to the previous
versions, and all known versions of gcc tested with the previous versions
except for GCC-4.2.1 work with this version. The change makes the ANSI-C
rule that const applied to an array of elements applies instead to the
elements in the array moot by explicitly applying const to the base
elements of the png_icc_matrix and png_icc_vector types. The accidental
(harmless) 'const' previously applied to the parameters of two of the
functions have also been removed.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

22
png.c
View File

@ -749,13 +749,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.0beta30 - September 5, 2012" PNG_STRING_NEWLINE \ "libpng version 1.6.0beta30 - September 6, 2012" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.0beta30 - September 5, 2012\ return "libpng version 1.6.0beta30 - September 6, 2012\
Copyright (c) 1998-2012 Glenn Randers-Pehrson\ Copyright (c) 1998-2012 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -2156,13 +2156,13 @@ png_find_icc_tag(png_const_bytep profile, png_uint_32 tag, png_uint_32p length)
* to passing a (png_int_32[]) (which does not have const elements). * to passing a (png_int_32[]) (which does not have const elements).
*/ */
typedef png_int_32 png_icc_vector[3]; typedef png_int_32 png_icc_vector[3];
typedef png_icc_vector * PNG_RESTRICT png_icc_vectorrp; typedef png_int_32 (*PNG_RESTRICT png_icc_vectorrp)[3];
typedef const png_icc_vector * PNG_RESTRICT png_const_icc_vectorrp; typedef const png_int_32 (*PNG_RESTRICT png_const_icc_vectorrp)[3];
#define png_cpv(vector) png_constcast(const png_icc_vector*,&vector) #define png_cpv(vector) png_constcast(const png_icc_vector*,&vector)
typedef png_icc_vector png_icc_matrix[3]; typedef png_int_32 png_icc_matrix[3][3];
typedef png_icc_matrix * PNG_RESTRICT png_icc_matrixrp; typedef png_int_32 (*PNG_RESTRICT png_icc_matrixrp)[3][3];
typedef const png_icc_matrix * PNG_RESTRICT png_const_icc_matrixrp; typedef const png_int_32 (*PNG_RESTRICT png_const_icc_matrixrp)[3][3];
#define png_cpm(matrix) png_constcast(const png_icc_matrix*,&matrix) #define png_cpm(matrix) png_constcast(const png_icc_matrix*,&matrix)
/* These two painfully complex routines are to detect under or overflow on /* These two painfully complex routines are to detect under or overflow on
@ -2200,8 +2200,8 @@ png_sub(png_int_32 * PNG_RESTRICT result, png_int_32 a, png_int_32 b)
} }
static int static int
png_matrix_x_vector(const png_const_icc_matrixrp m, png_matrix_x_vector(png_const_icc_matrixrp m, png_const_icc_vectorrp v,
const png_const_icc_vectorrp v, const png_icc_vectorrp o) png_icc_vectorrp o)
/* Apply the matrix (prefixed) to the column vector, updating the vector with /* Apply the matrix (prefixed) to the column vector, updating the vector with
* the result. * the result.
*/ */
@ -2230,8 +2230,8 @@ png_matrix_x_vector(const png_const_icc_matrixrp m,
} }
static int static int
png_matrix_x_TmatrixT(const png_const_icc_matrixrp m1, png_matrix_x_TmatrixT(png_const_icc_matrixrp m1, png_const_icc_matrixrp m2,
const png_const_icc_matrixrp m2, const png_icc_matrixrp o) png_icc_matrixrp o)
/* NOTE: this passes in the transpose of the input matrix (because it passes /* NOTE: this passes in the transpose of the input matrix (because it passes
* rows, not columns to x_vector) and then transposes the output too. To get * rows, not columns to x_vector) and then transposes the output too. To get
* correct matrix multiplication of two matrices it is necessary to transpose * correct matrix multiplication of two matrices it is necessary to transpose