Commit 6cd5ccb for zlib
commit 6cd5ccb8d9a746647729461390a0b85d9f3525c9
Author: Mark Adler <git@madler.net>
Date: Sun Nov 1 20:09:51 2026 -0800
Avoid making gzprintf a stub when compiling as C++ code.
diff --git a/gzguts.h b/gzguts.h
index 3f49968..df4b0d6 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -92,8 +92,10 @@
# define vsnprintf _vsnprintf
# endif
# endif
-# elif !defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L
-/* Otherwise if C89/90, assume no C99 snprintf() or vsnprintf() */
+# elif (!defined(__STDC_VERSION__) || __STDC_VERSION__-0 < 199901L) && \
+ (!defined(__cplusplus) || __cplusplus < 201103L)
+/* Otherwise if C89/90 (and not C++11 or later), assume no C99 snprintf() or
+ vsnprintf() */
# ifndef NO_snprintf
# define NO_snprintf
# endif
diff --git a/gzlib.c b/gzlib.c
index 18bc6fb..c3b3efc 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -226,7 +226,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
(void)snprintf(state->path, len + 1, "%s", (const char *)path);
#else
- strcpy(state->path, path);
+ strcpy(state->path, (const char *)path);
#endif
}