From e6dc15ca688d88677415e70429abda1503f52612 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 19 Mar 2010 11:51:56 +0000 Subject: [PATCH] int8 and uint8 passed 3 parameters to the printf string, but only 2 were used, leading to various problems (like bug #5596). I added another variation of print_type which handles that case. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35911 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/app/Message.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/kits/app/Message.cpp b/src/kits/app/Message.cpp index 1258daa218..b7376cb7b7 100644 --- a/src/kits/app/Message.cpp +++ b/src/kits/app/Message.cpp @@ -98,6 +98,15 @@ print_type(const char *format, uint8 *pointer) } +template +static void +print_type3(const char *format, uint8 *pointer) +{ + Type *item = (Type *)pointer; + printf(format, *item, *item, *item); +} + + static status_t handle_reply(port_id replyPort, int32 *_code, bigtime_t timeout, BMessage *reply) @@ -595,11 +604,12 @@ BMessage::_PrintToStream(const char* indent) const break; case B_INT8_TYPE: - print_type("int8(0x%hx or %d or '%.1s')\n", pointer); + print_type3("int8(0x%hx or %d or '%.1s')\n", + pointer); break; case B_UINT8_TYPE: - print_type("uint8(0x%hx or %u or '%.1s')\n", + print_type3("uint8(0x%hx or %u or '%.1s')\n", pointer); break;