summaryrefslogtreecommitdiff
path: root/Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c')
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c b/Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c
index 579e28d2b8a..cf621fa5bf5 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/tools/pngcp.c
@@ -1,6 +1,6 @@
/* pngcp.c
*
- * Copyright (c) 2016,2022 John Cunningham Bowler
+ * Copyright (c) 2016,2022,2024 John Cunningham Bowler
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -88,16 +88,6 @@
# define voidcast(type, value) (value)
#endif /* __cplusplus */
-#ifdef __GNUC__
- /* Many versions of GCC erroneously report that local variables unmodified
- * within the scope of a setjmp may be clobbered. This hacks round the
- * problem (sometimes) without harming other compilers.
- */
-# define gv volatile
-#else
-# define gv
-#endif
-
/* 'CLOCK_PROCESS_CPUTIME_ID' is one of the clock timers for clock_gettime. It
* need not be supported even when clock_gettime is available. It returns the
* 'CPU' time the process has consumed. 'CPU' time is assumed to include time
@@ -395,6 +385,7 @@ struct display
{
jmp_buf error_return; /* Where to go to on error */
unsigned int errset; /* error_return is set */
+ int errlevel; /* error level from longjmp */
const char *operation; /* What is happening */
const char *filename; /* The name of the original file */
@@ -634,7 +625,10 @@ display_log(struct display *dp, error_level level, const char *fmt, ...)
if (level > APP_FAIL || (level > ERRORS && !(dp->options & CONTINUE)))
{
if (dp->errset)
+ {
+ dp->errlevel = level;
longjmp(dp->error_return, level);
+ }
else
exit(99);
@@ -2318,14 +2312,9 @@ cp_one_file(struct display *dp, const char *filename, const char *destname)
}
static int
-cppng(struct display *dp, const char *file, const char *gv dest)
- /* Exists solely to isolate the setjmp clobbers which some versions of GCC
- * erroneously generate.
- */
+cppng(struct display *dp, const char *file, const char *dest)
{
- int ret = setjmp(dp->error_return);
-
- if (ret == 0)
+ if (setjmp(dp->error_return) == 0)
{
dp->errset = 1;
cp_one_file(dp, file, dest);
@@ -2337,10 +2326,11 @@ cppng(struct display *dp, const char *file, const char *gv dest)
{
dp->errset = 0;
- if (ret < ERRORS) /* shouldn't longjmp on warnings */
- display_log(dp, INTERNAL_ERROR, "unexpected return code %d", ret);
+ if (dp->errlevel < ERRORS) /* shouldn't longjmp on warnings */
+ display_log(dp, INTERNAL_ERROR, "unexpected return code %d",
+ dp->errlevel);
- return ret;
+ return dp->errlevel;
}
}