Commit 80322306 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] %t... in vsnprintf

handling of %t... (ptrdiff_t) in vsnprintf
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent acd3bd82
...@@ -269,6 +269,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) ...@@ -269,6 +269,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
int qualifier; /* 'h', 'l', or 'L' for integer fields */ int qualifier; /* 'h', 'l', or 'L' for integer fields */
/* 'z' support added 23/7/1999 S.H. */ /* 'z' support added 23/7/1999 S.H. */
/* 'z' changed to 'Z' --davidm 1/25/99 */ /* 'z' changed to 'Z' --davidm 1/25/99 */
/* 't' added for ptrdiff_t */
/* Reject out-of-range values early */ /* Reject out-of-range values early */
if (unlikely((int) size < 0)) { if (unlikely((int) size < 0)) {
...@@ -339,7 +340,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) ...@@ -339,7 +340,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
/* get the conversion qualifier */ /* get the conversion qualifier */
qualifier = -1; qualifier = -1;
if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
*fmt =='Z' || *fmt == 'z') { *fmt =='Z' || *fmt == 'z' || *fmt == 't') {
qualifier = *fmt; qualifier = *fmt;
++fmt; ++fmt;
if (qualifier == 'l' && *fmt == 'l') { if (qualifier == 'l' && *fmt == 'l') {
...@@ -467,6 +468,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) ...@@ -467,6 +468,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
num = (signed long) num; num = (signed long) num;
} else if (qualifier == 'Z' || qualifier == 'z') { } else if (qualifier == 'Z' || qualifier == 'z') {
num = va_arg(args, size_t); num = va_arg(args, size_t);
} else if (qualifier == 't') {
num = va_arg(args, ptrdiff_t);
} else if (qualifier == 'h') { } else if (qualifier == 'h') {
num = (unsigned short) va_arg(args, int); num = (unsigned short) va_arg(args, int);
if (flags & SIGN) if (flags & SIGN)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment