summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Hund <heikoh@users.sf.net>2010-03-10 18:50:59 +0100
committerHeiko Hund <heikoh@users.sf.net>2010-03-10 18:50:59 +0100
commitb971f6f311637fc17beabb94ac96eb5dad8c5385 (patch)
tree897157a33589ddee2ffc561d0a3806723766e227
parentoverhaul of French localization (diff)
downloadopenvpn-gui-b971f6f311637fc17beabb94ac96eb5dad8c5385.tar.gz
fix _sntprintf_0 function
-rw-r--r--main.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/main.h b/main.h
index 204dbc8..c840096 100644
--- a/main.h
+++ b/main.h
@@ -70,14 +70,19 @@ struct security_attributes
#define CLEAR(x) memset(&(x), 0, sizeof(x))
/* _sntprintf with guaranteed \0 termination */
+#define _sntprintf_0(buf, ...) \
+ do { \
+ __sntprintf_0(buf, _tsizeof(buf), __VA_ARGS__); \
+ } while(0);
+
static inline int
-_sntprintf_0(TCHAR *buf, TCHAR *format, ...)
+__sntprintf_0(TCHAR *buf, size_t size, TCHAR *format, ...)
{
int i;
va_list args;
va_start(args, format);
- i = _vsntprintf(buf, _tsizeof(buf), format, args);
- buf[_tsizeof(buf) - 1] = _T('\0');
+ i = _vsntprintf(buf, size, format, args);
+ buf[size - 1] = _T('\0');
va_end(args);
return i;
}