aboutsummaryrefslogtreecommitdiff
path: root/gzguts.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-06-03 12:45:55 -0700
committerMark Adler <madler@alumni.caltech.edu>2012-06-03 12:45:55 -0700
commit25e4a3da552ab570d2a049cc2d75b6e23ba9362a (patch)
treeef330c044497135490b15c493ef579df710e6226 /gzguts.h
parentee026accdeefe2f25dbb09fa2bae6c1c63f98d15 (diff)
downloadzlib-25e4a3da552ab570d2a049cc2d75b6e23ba9362a.tar.gz
zlib-25e4a3da552ab570d2a049cc2d75b6e23ba9362a.tar.bz2
zlib-25e4a3da552ab570d2a049cc2d75b6e23ba9362a.zip
Use _snprintf for snprinf in Microsoft C.
More than a decade later, Microsoft C does not support the C99 standard. It's good that _snprintf has a different name, since it does not guarantee that the result is null terminated, as does snprintf. However where _snprintf is used under Microsoft C, the destination string is assured to be long enough, so this will not be a problem. This occurs in two places, both in gzlib.c. Where sprintf functionality is needed by gzprintf, vsnprintf is used in the case of Microsoft C.
Diffstat (limited to 'gzguts.h')
-rw-r--r--gzguts.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gzguts.h b/gzguts.h
index ee3f281..68d135b 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -88,6 +88,14 @@
88# endif 88# endif
89#endif 89#endif
90 90
91/* unlike snprintf (which is required in C99, yet still not supported by
92 Microsoft more than a decade later!), _snprintf does not guarantee null
93 termination of the result -- however this is only used in gzlib.c where
94 the result is assured to fit in the space provided */
95#ifdef _MSC_VER
96# define snprintf _snprintf
97#endif
98
91#ifndef local 99#ifndef local
92# define local static 100# define local static
93#endif 101#endif