Make the default whitepoint and ycbcrcoeffs arrays const

Now that we are returning const pointers in TIFFGetFieldDefaulted,
we can now make these static default arrays const.

see #11
This commit is contained in:
Adam Goode 2020-03-08 00:54:36 +01:00 committed by Thomas Bernard
parent 63c666344f
commit d6827861cb
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -292,7 +292,7 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
case TIFFTAG_YCBCRCOEFFICIENTS: case TIFFTAG_YCBCRCOEFFICIENTS:
{ {
/* defaults are from CCIR Recommendation 601-1 */ /* defaults are from CCIR Recommendation 601-1 */
static float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f }; static const float ycbcrcoeffs[] = { 0.299f, 0.587f, 0.114f };
*va_arg(ap, const float **) = ycbcrcoeffs; *va_arg(ap, const float **) = ycbcrcoeffs;
return 1; return 1;
} }
@ -305,12 +305,13 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
return (1); return (1);
case TIFFTAG_WHITEPOINT: case TIFFTAG_WHITEPOINT:
{ {
static float whitepoint[2];
/* TIFF 6.0 specification tells that it is no default /* TIFF 6.0 specification tells that it is no default
value for the WhitePoint, but AdobePhotoshop TIFF value for the WhitePoint, but AdobePhotoshop TIFF
Technical Note tells that it should be CIE D50. */ Technical Note tells that it should be CIE D50. */
whitepoint[0] = D50_X0 / (D50_X0 + D50_Y0 + D50_Z0); static const float whitepoint[] = {
whitepoint[1] = D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0); D50_X0 / (D50_X0 + D50_Y0 + D50_Z0),
D50_Y0 / (D50_X0 + D50_Y0 + D50_Z0)
};
*va_arg(ap, const float **) = whitepoint; *va_arg(ap, const float **) = whitepoint;
return 1; return 1;
} }