Skip to content

Commit

Permalink
BUILD BREAK: remove ISO-C99 commments
Browse files Browse the repository at this point in the history
These comments break checks for ISO-C conformance to prior levels of the
standard (C90, C95).

The check in pngpriv.h can be updated to include the specific revision
of ISO-C if it is decided to require something later than C90.

Signed-off-by: John Bowler <[email protected]>
  • Loading branch information
jbowler committed Sep 22, 2024
1 parent 626761b commit c02f75b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 28 deletions.
2 changes: 0 additions & 2 deletions contrib/libtests/pngimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
# define SKIP 0
#endif

//#if PNG_LIBPNG_VER < 10700
/* READ_PNG and WRITE_PNG were not defined, so: */
# ifdef PNG_INFO_IMAGE_SUPPORTED
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
Expand All @@ -56,7 +55,6 @@
# define PNG_WRITE_PNG_SUPPORTED
# endif /* WRITE */
# endif /* INFO_IMAGE */
//#endif /* pre 1.7.0 */

#ifdef PNG_READ_PNG_SUPPORTED
/* If a transform is valid on both read and write this implies that if the
Expand Down
2 changes: 0 additions & 2 deletions contrib/libtests/pngstest.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,8 @@ print_opts(png_uint_32 opts)
printf(" --sRGB-16bit");
if (opts & NO_RESEED)
printf(" --noreseed");
//#if PNG_LIBPNG_VER < 10700 /* else on by default */
if (opts & GBG_ERROR)
printf(" --fault-gbg-warning");
//#endif
}

#define FORMAT_NO_CHANGE 0x80000000 /* additional flag */
Expand Down
3 changes: 0 additions & 3 deletions contrib/libtests/pngunknown.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ typedef png_byte *png_const_bytep;
# define png_const_structp png_structp
#endif

//#if PNG_LIBPNG_VER < 10700
/* Copied from libpng 1.7.0 png.h */
#define PNG_u2(b1, b2) (((unsigned int)(b1) << 8) + (b2))

Expand Down Expand Up @@ -143,8 +142,6 @@ typedef png_byte *png_const_bytep;
#define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
#define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))

//#endif /* PNG_LIBPNG_VER < 10700 */

#ifdef __cplusplus
# define this not_the_cpp_this
# define new not_the_cpp_new
Expand Down
21 changes: 8 additions & 13 deletions contrib/tools/pngcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
# include "../../png.h"
#endif

//#if PNG_LIBPNG_VER < 10700
/* READ_PNG and WRITE_PNG were not defined, so: */
# ifdef PNG_INFO_IMAGE_SUPPORTED
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
Expand All @@ -63,7 +62,6 @@
# define PNG_WRITE_PNG_SUPPORTED
# endif /* WRITE */
# endif /* INFO_IMAGE */
//#endif /* pre 1.7.0 */

#if (defined(PNG_READ_PNG_SUPPORTED)) && (defined(PNG_WRITE_PNG_SUPPORTED))
#include <stdarg.h>
Expand Down Expand Up @@ -400,11 +398,11 @@ struct display
png_alloc_size_t read_size;
png_structp read_pp;
png_infop ip;
//# if PNG_LIBPNG_VER < 10700 && defined PNG_TEXT_SUPPORTED
# if defined PNG_TEXT_SUPPORTED
png_textp text_ptr; /* stash of text chunks */
int num_text;
int text_stashed;
//# endif /* pre 1.7 */
# endif

# ifdef PNG_PNGCP_TIMING_SUPPORTED
struct timespec read_time;
Expand Down Expand Up @@ -489,11 +487,11 @@ display_init(struct display *dp)
dp->ip = NULL;
dp->write_pp = NULL;
dp->min_windowBits = -1; /* this is an OPTIND, so -1 won't match anything */
//# if PNG_LIBPNG_VER < 10700 && defined PNG_TEXT_SUPPORTED
# if defined PNG_TEXT_SUPPORTED
dp->text_ptr = NULL;
dp->num_text = 0;
dp->text_stashed = 0;
//# endif /* pre 1.7 */
# endif
}

static void
Expand Down Expand Up @@ -531,7 +529,7 @@ display_clean(struct display *dp)
display_clean_write(dp, 1/*freeinfo*/);
dp->output_file = NULL;

//# if PNG_LIBPNG_VER < 10700 && defined PNG_TEXT_SUPPORTED
# if defined PNG_TEXT_SUPPORTED
/* This is actually created and used by the write code, but only
* once; it has to be retained for subsequent writes of the same file.
*/
Expand All @@ -542,7 +540,7 @@ display_clean(struct display *dp)
free(dp->text_ptr);
dp->text_ptr = NULL;
}
//# endif /* pre 1.7 */
# endif

/* leave the filename for error detection */
dp->results = 0; /* reset for next time */
Expand Down Expand Up @@ -635,7 +633,7 @@ display_log(struct display *dp, error_level level, const char *fmt, ...)
}
}

//#if PNG_LIBPNG_VER < 10700 && defined PNG_TEXT_SUPPORTED
#if defined PNG_TEXT_SUPPORTED
static void
text_stash(struct display *dp)
{
Expand Down Expand Up @@ -687,10 +685,7 @@ text_restore(struct display *dp)

#define text_restore(dp) if (dp->text_stashed) text_restore(dp)

//#else
//#define text_stash(dp) ((void)0)
//#define text_restore(dp) ((void)0)
//#endif /* pre 1.7 */
#endif /* pre 1.7 */

/* OPTIONS:
*
Expand Down
2 changes: 0 additions & 2 deletions contrib/tools/pngfix.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
# define aligncastconst(type, value) ((const void*)(value))
#endif /* __cplusplus */

//#if PNG_LIBPNG_VER < 10700
/* Chunk tags (copied from pngpriv.h) */
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
#define PNG_U32(b1,b2,b3,b4) \
Expand Down Expand Up @@ -117,7 +116,6 @@
#define png_tIME PNG_U32(116, 73, 77, 69)
#define png_tRNS PNG_U32(116, 82, 78, 83)
#define png_zTXt PNG_U32(122, 84, 88, 116)
//#endif

/* The 8-byte signature as a pair of 32-bit quantities */
#define sig1 PNG_U32(137, 80, 78, 71)
Expand Down
2 changes: 0 additions & 2 deletions png.c
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,6 @@ png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
return 1;
}

//# if PNG_LIBPNG_VER < 10700
/* To do: remove the following from libpng-1.7 */
/* Original API that uses a private buffer in png_struct.
* Deprecated because it causes png_struct to carry a spurious temporary
Expand All @@ -781,7 +780,6 @@ png_convert_to_rfc1123(png_structrp png_ptr, png_const_timep ptime)

return NULL;
}
//# endif /* LIBPNG_VER < 10700 */
# endif /* TIME_RFC1123 */

#endif /* READ || WRITE */
Expand Down
2 changes: 0 additions & 2 deletions png.h
Original file line number Diff line number Diff line change
Expand Up @@ -1027,11 +1027,9 @@ PNG_EXPORT(22, void, png_read_info,
* routine. The original implementation used a 29 character buffer in
* png_struct, this will be removed in future versions.
*/
//#if PNG_LIBPNG_VER < 10700
/* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */
PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, (png_structrp png_ptr,
png_const_timep ptime),PNG_DEPRECATED);
//#endif
PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, (char out[29],
png_const_timep ptime));
#endif
Expand Down
2 changes: 0 additions & 2 deletions pngstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,10 @@ struct png_struct_def
png_uint_32 options; /* On/off state (up to 16 options) */
#endif

//#if PNG_LIBPNG_VER < 10700
/* To do: remove this from libpng-1.7 */
#ifdef PNG_TIME_RFC1123_SUPPORTED
char time_buffer[29]; /* String to hold RFC 1123 time text */
#endif
//#endif

/* New members added in libpng-1.0.6 */

Expand Down

0 comments on commit c02f75b

Please sign in to comment.