summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmin Truta <ctruta@gmail.com>2018-08-18 21:01:02 -0400
committerCosmin Truta <ctruta@gmail.com>2018-08-18 21:01:02 -0400
commit1ef88828146c23bfc6d81042c6d6ecd61ccc983b (patch)
treede8eafd6a8c372f3bdb70a51ed799896bdc99c30
parent58eedced2578c143705c1d8503e4ed3a40aaa8b3 (diff)
downloadlibpng-1ef88828146c23bfc6d81042c6d6ecd61ccc983b.tar.gz
Replace the remaining uses of PNG_CONST with const
In v1.6.0, compiler support for const became a requirement. It should be used consistently. To maintain backwards compatibility, PNG_CONST is still maintained in deprecated form.
-rw-r--r--contrib/examples/pngpixel.c6
-rw-r--r--contrib/gregbook/readpng2.c2
-rw-r--r--contrib/libtests/pngstest.c2
-rw-r--r--contrib/libtests/pngunknown.c2
-rw-r--r--contrib/tools/makesRGB.c6
-rw-r--r--libpng-manual.txt2
-rw-r--r--libpng.32
-rw-r--r--png.c20
-rw-r--r--pngconf.h5
-rw-r--r--pngerror.c2
-rw-r--r--pngpread.c10
-rw-r--r--pngread.c4
-rw-r--r--pngrtran.c20
-rw-r--r--pngrutil.c22
-rw-r--r--pngset.c2
-rw-r--r--pngtest.c14
-rw-r--r--pngtrans.c6
-rw-r--r--pngwrite.c4
-rw-r--r--pngwutil.c20
19 files changed, 75 insertions, 76 deletions
diff --git a/contrib/examples/pngpixel.c b/contrib/examples/pngpixel.c
index f762379ed..b0e72cb5b 100644
--- a/contrib/examples/pngpixel.c
+++ b/contrib/examples/pngpixel.c
@@ -42,7 +42,7 @@ component(png_const_bytep row, png_uint_32 x, unsigned int c,
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
- row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
+ row = (png_const_bytep)(((const png_byte (*)[8])row) + bit_offset_hi);
row += bit_offset_lo >> 3;
bit_offset_lo &= 0x07;
@@ -73,7 +73,7 @@ static void
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
png_uint_32 x)
{
- PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
+ const unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
switch (png_get_color_type(png_ptr, info_ptr))
{
@@ -87,7 +87,7 @@ print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
*/
case PNG_COLOR_TYPE_PALETTE:
{
- PNG_CONST int index = component(row, x, 0, bit_depth, 1);
+ const int index = component(row, x, 0, bit_depth, 1);
png_colorp palette = NULL;
int num_palette = 0;
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index 5d13e1530..610b3cd87 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -146,7 +146,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
/* These byte strings were copied from png.h. If a future version
* of readpng2.c recognizes more chunks, add them to this list.
*/
- static PNG_CONST png_byte chunks_to_process[] = {
+ static const png_byte chunks_to_process[] = {
98, 75, 71, 68, '\0', /* bKGD */
103, 65, 77, 65, '\0', /* gAMA */
115, 82, 71, 66, '\0', /* sRGB */
diff --git a/contrib/libtests/pngstest.c b/contrib/libtests/pngstest.c
index 74c8d100c..45a52b558 100644
--- a/contrib/libtests/pngstest.c
+++ b/contrib/libtests/pngstest.c
@@ -372,7 +372,7 @@ print_opts(png_uint_32 opts)
*/
#define FORMAT_COUNT 64
#define FORMAT_MASK 0x3f
-static PNG_CONST char * PNG_CONST format_names[FORMAT_COUNT] =
+static const char * const format_names[FORMAT_COUNT] =
{
"sRGB-gray",
"sRGB-gray+alpha",
diff --git a/contrib/libtests/pngunknown.c b/contrib/libtests/pngunknown.c
index d9cc4488b..05bdd833d 100644
--- a/contrib/libtests/pngunknown.c
+++ b/contrib/libtests/pngunknown.c
@@ -56,7 +56,7 @@
defined(PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED)
#if PNG_LIBPNG_VER < 10500
-/* This deliberately lacks the PNG_CONST. */
+/* This deliberately lacks the const. */
typedef png_byte *png_const_bytep;
/* This is copied from 1.5.1 png.h: */
diff --git a/contrib/tools/makesRGB.c b/contrib/tools/makesRGB.c
index e66c9f157..d0c0ca931 100644
--- a/contrib/tools/makesRGB.c
+++ b/contrib/tools/makesRGB.c
@@ -388,7 +388,7 @@ main(int argc, char **argv)
if (!test_only)
{
- printf("PNG_CONST png_uint_16 png_sRGB_table[256] =\n{\n ");
+ printf("const png_uint_16 png_sRGB_table[256] =\n{\n ");
for (i=0; i<255; )
{
do
@@ -401,7 +401,7 @@ main(int argc, char **argv)
printf("%d\n};\n\n", png_sRGB_table[i]);
- printf("PNG_CONST png_uint_16 png_sRGB_base[512] =\n{\n ");
+ printf("const png_uint_16 png_sRGB_base[512] =\n{\n ");
for (i=0; i<511; )
{
do
@@ -413,7 +413,7 @@ main(int argc, char **argv)
}
printf("%d\n};\n\n", png_sRGB_base[i]);
- printf("PNG_CONST png_byte png_sRGB_delta[512] =\n{\n ");
+ printf("const png_byte png_sRGB_delta[512] =\n{\n ");
for (i=0; i<511; )
{
do
diff --git a/libpng-manual.txt b/libpng-manual.txt
index 8d66f257f..e846aea6e 100644
--- a/libpng-manual.txt
+++ b/libpng-manual.txt
@@ -4870,7 +4870,7 @@ to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep.
There are changes of form in png.h, including new and changed macros to
declare parts of the API. Some API functions with arguments that are
pointers to data not modified within the function have been corrected to
-declare these arguments with PNG_CONST.
+declare these arguments with const.
Much of the internal use of C macros to control the library build has also
changed and some of this is visible in the exported header files, in
diff --git a/libpng.3 b/libpng.3
index c39580c17..0f9b8f27e 100644
--- a/libpng.3
+++ b/libpng.3
@@ -5389,7 +5389,7 @@ to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep.
There are changes of form in png.h, including new and changed macros to
declare parts of the API. Some API functions with arguments that are
pointers to data not modified within the function have been corrected to
-declare these arguments with PNG_CONST.
+declare these arguments with const.
Much of the internal use of C macros to control the library build has also
changed and some of this is visible in the exported header files, in
diff --git a/png.c b/png.c
index 1e7003c4a..74293c859 100644
--- a/png.c
+++ b/png.c
@@ -736,7 +736,7 @@ png_save_int_32(png_bytep buf, png_int_32 i)
int PNGAPI
png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
{
- static PNG_CONST char short_months[12][4] =
+ static const char short_months[12][4] =
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
@@ -3970,18 +3970,18 @@ png_gamma_correct(png_structrp png_ptr, unsigned int value,
*/
static void
png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
- PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
+ const unsigned int shift, const png_fixed_point gamma_val)
{
/* Various values derived from 'shift': */
- PNG_CONST unsigned int num = 1U << (8U - shift);
+ const unsigned int num = 1U << (8U - shift);
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
/* CSE the division and work round wacky GCC warnings (see the comments
* in png_gamma_8bit_correct for where these come from.)
*/
- PNG_CONST double fmax = 1./(((png_int_32)1 << (16U - shift))-1);
+ const double fmax = 1./(((png_int_32)1 << (16U - shift))-1);
#endif
- PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
- PNG_CONST unsigned int max_by_2 = 1U << (15U-shift);
+ const unsigned int max = (1U << (16U - shift))-1U;
+ const unsigned int max_by_2 = 1U << (15U-shift);
unsigned int i;
png_uint_16pp table = *ptable =
@@ -4047,10 +4047,10 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
*/
static void
png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
- PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma_val)
+ const unsigned int shift, const png_fixed_point gamma_val)
{
- PNG_CONST unsigned int num = 1U << (8U - shift);
- PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
+ const unsigned int num = 1U << (8U - shift);
+ const unsigned int max = (1U << (16U - shift))-1U;
unsigned int i;
png_uint_32 last;
@@ -4115,7 +4115,7 @@ png_build_16to8_table(png_structrp png_ptr, png_uint_16pp *ptable,
*/
static void
png_build_8bit_table(png_structrp png_ptr, png_bytepp ptable,
- PNG_CONST png_fixed_point gamma_val)
+ const png_fixed_point gamma_val)
{
unsigned int i;
png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256);
diff --git a/pngconf.h b/pngconf.h
index 20f7eb942..40e8ee081 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -58,9 +58,8 @@
#endif /* PNG_BUILDING_SYMBOL_TABLE */
-/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
- * PNG_NO_CONST; this is no longer supported except for data declarations which
- * apparently still cause problems in 2011 on some compilers.
+/* Prior to 1.6.0, it was possible to turn off 'const' in declarations,
+ * using PNG_NO_CONST. This is no longer supported.
*/
#define PNG_CONST const /* backward compatibility only */
diff --git a/pngerror.c b/pngerror.c
index df323802e..89a49039c 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -425,7 +425,7 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
* if the character is invalid.
*/
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
-static PNG_CONST char png_digit[16] = {
+static const char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'
};
diff --git a/pngpread.c b/pngpread.c
index fd0f0b207..e283627b7 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -972,20 +972,20 @@ png_read_push_finish_row(png_structrp png_ptr)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
+ static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */
- static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
+ static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */
- static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
+ static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
- static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/
#endif
diff --git a/pngread.c b/pngread.c
index 2d3a100ea..9c477c1bf 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1621,7 +1621,7 @@ png_image_skip_unused_chunks(png_structrp png_ptr)
* errors (which are unfortunately quite common.)
*/
{
- static PNG_CONST png_byte chunks_to_process[] = {
+ static const png_byte chunks_to_process[] = {
98, 75, 71, 68, '\0', /* bKGD */
99, 72, 82, 77, '\0', /* cHRM */
103, 65, 77, 65, '\0', /* gAMA */
@@ -3946,7 +3946,7 @@ png_image_read_direct(png_voidp argument)
*/
if (linear != 0)
{
- PNG_CONST png_uint_16 le = 0x0001;
+ const png_uint_16 le = 0x0001;
if ((*(png_const_bytep) & le) != 0)
png_set_swap(png_ptr);
diff --git a/pngrtran.c b/pngrtran.c
index 3302a7c63..e61be8782 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -2995,11 +2995,11 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
if ((row_info->color_type & PNG_COLOR_MASK_PALETTE) == 0 &&
(row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
{
- PNG_CONST png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff;
- PNG_CONST png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff;
- PNG_CONST png_uint_32 bc = 32768 - rc - gc;
- PNG_CONST png_uint_32 row_width = row_info->width;
- PNG_CONST int have_alpha =
+ const png_uint_32 rc = png_ptr->rgb_to_gray_red_coeff;
+ const png_uint_32 gc = png_ptr->rgb_to_gray_green_coeff;
+ const png_uint_32 bc = 32768 - rc - gc;
+ const png_uint_32 row_width = row_info->width;
+ const int have_alpha =
(row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0;
if (row_info->bit_depth == 8)
@@ -4143,11 +4143,11 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
{
if (row_info->bit_depth == 8)
{
- PNG_CONST png_bytep table = png_ptr->gamma_from_1;
+ const png_bytep table = png_ptr->gamma_from_1;
if (table != NULL)
{
- PNG_CONST int step =
+ const int step =
(row_info->color_type & PNG_COLOR_MASK_COLOR) ? 4 : 2;
/* The alpha channel is the last component: */
@@ -4162,12 +4162,12 @@ png_do_encode_alpha(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
else if (row_info->bit_depth == 16)
{
- PNG_CONST png_uint_16pp table = png_ptr->gamma_16_from_1;
- PNG_CONST int gamma_shift = png_ptr->gamma_shift;
+ const png_uint_16pp table = png_ptr->gamma_16_from_1;
+ const int gamma_shift = png_ptr->gamma_shift;
if (table != NULL)
{
- PNG_CONST int step =
+ const int step =
(row_info->color_type & PNG_COLOR_MASK_COLOR) ? 8 : 4;
/* The alpha channel is the last component: */
diff --git a/pngrutil.c b/pngrutil.c
index 905671285..1c4c9750f 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -3363,7 +3363,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
/* Hence the pre-compiled masks indexed by PACKSWAP (or not), depth and
* then pass:
*/
- static PNG_CONST png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
+ static const png_uint_32 row_mask[2/*PACKSWAP*/][3/*depth*/][6] =
{
/* Little-endian byte masks for PACKSWAP */
{ S_MASKS(1,0), S_MASKS(2,0), S_MASKS(4,0) },
@@ -3374,7 +3374,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
/* display_mask has only three entries for the odd passes, so index by
* pass>>1.
*/
- static PNG_CONST png_uint_32 display_mask[2][3][3] =
+ static const png_uint_32 display_mask[2][3][3] =
{
/* Little-endian byte masks for PACKSWAP */
{ B_MASKS(1,0), B_MASKS(2,0), B_MASKS(4,0) },
@@ -3687,7 +3687,7 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
{
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Offset to next interlace block */
- static PNG_CONST unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
png_debug(1, "in png_do_read_interlace");
if (row != NULL && row_info != NULL)
@@ -4329,16 +4329,16 @@ png_read_finish_row(png_structrp png_ptr)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+ static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */
- static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+ static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */
- static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+ static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
png_debug(1, "in png_read_finish_row");
png_ptr->row_number++;
@@ -4394,16 +4394,16 @@ png_read_start_row(png_structrp png_ptr)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+ static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */
- static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+ static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */
- static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+ static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
unsigned int max_pixel_depth;
size_t row_bytes;
diff --git a/pngset.c b/pngset.c
index e90e35a10..d1d735480 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1399,7 +1399,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
/* Ignore all unknown chunks and all chunks recognized by
* libpng except for IHDR, PLTE, tRNS, IDAT, and IEND
*/
- static PNG_CONST png_byte chunks_to_ignore[] = {
+ static const png_byte chunks_to_ignore[] = {
98, 75, 71, 68, '\0', /* bKGD */
99, 72, 82, 77, '\0', /* cHRM */
101, 88, 73, 102, '\0', /* eXIf */
diff --git a/pngtest.c b/pngtest.c
index 887e7fe53..bec7e5133 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -449,13 +449,13 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, size_t length)
*/
typedef struct
{
- PNG_CONST char *file_name;
+ const char *file_name;
} pngtest_error_parameters;
static void PNGCBAPI
pngtest_warning(png_structp png_ptr, png_const_charp message)
{
- PNG_CONST char *name = "UNKNOWN (ERROR!)";
+ const char *name = "UNKNOWN (ERROR!)";
pngtest_error_parameters *test =
(pngtest_error_parameters*)png_get_error_ptr(png_ptr);
@@ -850,7 +850,7 @@ pngtest_check_text_support(png_structp png_ptr, png_textp text_ptr,
/* Test one file */
static int
-test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
+test_one_file(const char *inname, const char *outname)
{
static png_FILE_p fpin;
static png_FILE_p fpout; /* "static" prevents setjmp corruption */
@@ -1809,11 +1809,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
/* Input and output filenames */
#ifdef RISCOS
-static PNG_CONST char *inname = "pngtest/png";
-static PNG_CONST char *outname = "pngout/png";
+static const char *inname = "pngtest/png";
+static const char *outname = "pngout/png";
#else
-static PNG_CONST char *inname = "pngtest.png";
-static PNG_CONST char *outname = "pngout.png";
+static const char *inname = "pngtest.png";
+static const char *outname = "pngout.png";
#endif
int
diff --git a/pngtrans.c b/pngtrans.c
index 97586c07f..1100f46eb 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -345,7 +345,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-static PNG_CONST png_byte onebppswaptable[256] = {
+static const png_byte onebppswaptable[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
@@ -380,7 +380,7 @@ static PNG_CONST png_byte onebppswaptable[256] = {
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
-static PNG_CONST png_byte twobppswaptable[256] = {
+static const png_byte twobppswaptable[256] = {
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
@@ -415,7 +415,7 @@ static PNG_CONST png_byte twobppswaptable[256] = {
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
};
-static PNG_CONST png_byte fourbppswaptable[256] = {
+static const png_byte fourbppswaptable[256] = {
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
diff --git a/pngwrite.c b/pngwrite.c
index 832947309..052a47c57 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -469,7 +469,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
#ifdef PNG_CONVERT_tIME_SUPPORTED
void PNGAPI
-png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime)
+png_convert_from_struct_tm(png_timep ptime, const struct tm * ttime)
{
png_debug(1, "in png_convert_from_struct_tm");
@@ -2052,7 +2052,7 @@ png_image_write_main(png_voidp argument)
*/
if (write_16bit != 0)
{
- PNG_CONST png_uint_16 le = 0x0001;
+ const png_uint_16 le = 0x0001;
if ((*(png_const_bytep) & le) != 0)
png_set_swap(png_ptr);
diff --git a/pngwutil.c b/pngwutil.c
index 562ea8f4b..5a4ded5f6 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1893,16 +1893,16 @@ png_write_start_row(png_structrp png_ptr)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+ static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */
- static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+ static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */
- static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+ static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
png_alloc_size_t buf_size;
@@ -2008,16 +2008,16 @@ png_write_finish_row(png_structrp png_ptr)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+ static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */
- static PNG_CONST png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+ static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */
- static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+ static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
png_debug(1, "in png_write_finish_row");
@@ -2098,10 +2098,10 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
- static PNG_CONST png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+ static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */
- static PNG_CONST png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+ static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
png_debug(1, "in png_do_write_interlace");