[haiku-commits] r35911 - haiku/trunk/src/kits/app

  • From: stefano.ceccherini@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 19 Mar 2010 12:51:56 +0100 (CET)

Author: jackburton
Date: 2010-03-19 12:51:56 +0100 (Fri, 19 Mar 2010)
New Revision: 35911
Changeset: http://dev.haiku-os.org/changeset/35911/haiku
Ticket: http://dev.haiku-os.org/ticket/5596

Modified:
   haiku/trunk/src/kits/app/Message.cpp
Log:
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.


Modified: haiku/trunk/src/kits/app/Message.cpp
===================================================================
--- haiku/trunk/src/kits/app/Message.cpp        2010-03-19 09:38:28 UTC (rev 
35910)
+++ haiku/trunk/src/kits/app/Message.cpp        2010-03-19 11:51:56 UTC (rev 
35911)
@@ -98,6 +98,15 @@
 }
 
 
+template<typename Type>
+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 @@
                                        break;
 
                                case B_INT8_TYPE:
-                                       print_type<int8>("int8(0x%hx or %d or 
'%.1s')\n", pointer);
+                                       print_type3<int8>("int8(0x%hx or %d or 
'%.1s')\n",
+                                               pointer);
                                        break;
 
                                case B_UINT8_TYPE:
-                                       print_type<uint8>("uint8(0x%hx or %u or 
'%.1s')\n",
+                                       print_type3<uint8>("uint8(0x%hx or %u 
or '%.1s')\n",
                                                pointer);
                                        break;
 


Other related posts:

  • » [haiku-commits] r35911 - haiku/trunk/src/kits/app - stefano . ceccherini