From 71c88b666cc071daa19fb863e117e04e5c3ec632 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 29 May 2010 20:39:20 +0200 Subject: [PATCH] Add z (size_t) prefix to bsnprintf --- bacula/src/lib/bsnprintf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bacula/src/lib/bsnprintf.c b/bacula/src/lib/bsnprintf.c index 5fa592610b..dcd9923251 100644 --- a/bacula/src/lib/bsnprintf.c +++ b/bacula/src/lib/bsnprintf.c @@ -115,6 +115,7 @@ static int32_t fmtfp(char *buffer, int32_t currlen, int32_t maxlen, #define DP_C_LDOUBLE 3 #define DP_C_INT64 4 #define DP_C_WCHAR 5 /* wide characters */ +#define DP_C_SIZE_T 6 #define char_to_int(p) ((p)- '0') #undef MAX @@ -250,6 +251,10 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args) ch = *format++; } break; + case 'z': + cflags = DP_C_SIZE_T; + ch = *format++; + break; case 'L': cflags = DP_C_LDOUBLE; ch = *format++; @@ -273,6 +278,8 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args) value = va_arg(args, int32_t); } else if (cflags == DP_C_INT64) { value = va_arg(args, int64_t); + } else if (cflags == DP_C_SIZE_T) { + value = va_arg(args, ssize_t); } else { value = va_arg(args, int); } @@ -299,6 +306,8 @@ int bvsnprintf(char *buffer, int32_t maxlen, const char *format, va_list args) value = va_arg(args, uint32_t); } else if (cflags == DP_C_INT64) { value = va_arg(args, uint64_t); + } else if (cflags == DP_C_SIZE_T) { + value = va_arg(args, size_t); } else { value = va_arg(args, unsigned int); } -- 2.39.5