From f9def39a465725c1b2a60f64200fba5d1614da36 Mon Sep 17 00:00:00 2001 From: Sergiu Dotenco Date: Thu, 26 Mar 2015 15:59:00 +0100 Subject: do not redefine snprintf if it's already available --- src/windows/port.cc | 2 ++ src/windows/port.h | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/windows/port.cc b/src/windows/port.cc index bfa6e70..d994325 100755 --- a/src/windows/port.cc +++ b/src/windows/port.cc @@ -55,6 +55,7 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) { return _vsnprintf(str, size-1, format, ap); } +#ifndef HAVE_SNPRINTF int snprintf(char *str, size_t size, const char *format, ...) { va_list ap; va_start(ap, format); @@ -62,3 +63,4 @@ int snprintf(char *str, size_t size, const char *format, ...) { va_end(ap); return r; } +#endif diff --git a/src/windows/port.h b/src/windows/port.h index 24d7677..d78a185 100755 --- a/src/windows/port.h +++ b/src/windows/port.h @@ -111,12 +111,16 @@ enum { STDIN_FILENO = 0, STDOUT_FILENO = 1, STDERR_FILENO = 2 }; * because they don't always NUL-terminate. :-( We also can't use the * name vsnprintf, since windows defines that (but not snprintf (!)). */ -extern int snprintf(char *str, size_t size, +#ifndef HAVE_SNPRINTF +extern int GOOGLE_GLOG_DLL_DECL snprintf(char *str, size_t size, const char *format, ...); -extern int safe_vsnprintf(char *str, size_t size, +#endif +extern int GOOGLE_GLOG_DLL_DECL safe_vsnprintf(char *str, size_t size, const char *format, va_list ap); #define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap) +#ifndef va_copy #define va_copy(dst, src) (dst) = (src) +#endif /* Windows doesn't support specifying the number of buckets as a * hash_map constructor arg, so we leave this blank. -- cgit v1.2.3