diff options
author | Al Viro <viro@www.linux.org.uk> | 2005-08-23 17:48:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-23 21:43:46 -0400 |
commit | 8032230694ec56c168a1404c67a54d281536cbed (patch) | |
tree | b3079a0781ab60de50cf4a0cc69e073985c165b4 | |
parent | acd3bd82c08d1a399760605706a86821148243d9 (diff) |
[PATCH] %t... in vsnprintf
handling of %t... (ptrdiff_t) in vsnprintf
Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | lib/vsprintf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index a9bda0a361f3..e4e9031dd9c3 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c | |||
@@ -269,6 +269,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
269 | int qualifier; /* 'h', 'l', or 'L' for integer fields */ | 269 | int qualifier; /* 'h', 'l', or 'L' for integer fields */ |
270 | /* 'z' support added 23/7/1999 S.H. */ | 270 | /* 'z' support added 23/7/1999 S.H. */ |
271 | /* 'z' changed to 'Z' --davidm 1/25/99 */ | 271 | /* 'z' changed to 'Z' --davidm 1/25/99 */ |
272 | /* 't' added for ptrdiff_t */ | ||
272 | 273 | ||
273 | /* Reject out-of-range values early */ | 274 | /* Reject out-of-range values early */ |
274 | if (unlikely((int) size < 0)) { | 275 | if (unlikely((int) size < 0)) { |
@@ -339,7 +340,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
339 | /* get the conversion qualifier */ | 340 | /* get the conversion qualifier */ |
340 | qualifier = -1; | 341 | qualifier = -1; |
341 | if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || | 342 | if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || |
342 | *fmt =='Z' || *fmt == 'z') { | 343 | *fmt =='Z' || *fmt == 'z' || *fmt == 't') { |
343 | qualifier = *fmt; | 344 | qualifier = *fmt; |
344 | ++fmt; | 345 | ++fmt; |
345 | if (qualifier == 'l' && *fmt == 'l') { | 346 | if (qualifier == 'l' && *fmt == 'l') { |
@@ -467,6 +468,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) | |||
467 | num = (signed long) num; | 468 | num = (signed long) num; |
468 | } else if (qualifier == 'Z' || qualifier == 'z') { | 469 | } else if (qualifier == 'Z' || qualifier == 'z') { |
469 | num = va_arg(args, size_t); | 470 | num = va_arg(args, size_t); |
471 | } else if (qualifier == 't') { | ||
472 | num = va_arg(args, ptrdiff_t); | ||
470 | } else if (qualifier == 'h') { | 473 | } else if (qualifier == 'h') { |
471 | num = (unsigned short) va_arg(args, int); | 474 | num = (unsigned short) va_arg(args, int); |
472 | if (flags & SIGN) | 475 | if (flags & SIGN) |