[U-Boot-Users] printf question

Okay - so this is probably not a big deal, however when I use the printf in u-boot as follows:
unsigned char x = 0xC2;
printf("this is the problem %02X\n", x);
result is:
this is the problem FFFFFFFC2
-----Original Message----- From: Zhang, Jian [mailto:jzhang@ti.com] Sent: Tuesday, February 03, 2004 2:23 PM To: 'u-boot-users@lists.sourceforge.net' Cc: Zhang, Jian; Woodruff, Richard; Powers, John Subject: [U-Boot-Users] [PATCH] bug fixes for fat.h
This patch fixed two bugs found in fat.h. It is a diff with U-Boot-1.0.0 (10/29/2003).
1. The number of FAT12 entries in FAT12 buffer was calculated incorrectly. As a result, you are not able to read any big file using more 2048 FAT12 entries.
2. data_begin in fsdata struct can be negative depending on the FAT system layout. If it happens, wrong sectors are requested by fat code.
Best Regards, Jian Zhang
********************************************************************** This e-mail is the property of Lantronix. It is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential, or otherwise protected from disclosure. Distribution or copying of this e-mail, or the information contained herein, to anyone other than the intended recipient is prohibited.

Jerry Walden wrote:
Okay - so this is probably not a big deal, however when I use the printf in u-boot as follows:
unsigned char x = 0xC2;
printf("this is the problem %02X\n", x);
result is:
this is the problem FFFFFFFC2
On most systems any datum of size less than int is implicitly converted to int when passed to a varargs function such as printf.
Char is typically signed so the conversion of any char with the 7 bit set will result in a negative integer.
0xC2 -> 0xFFFFFFFFC2.
To solve it just and with 0xFF.
Regards
Pantelis

In message 603BA0CFF3788E46A0DB0918D9AA95100A09CA4B@sj580004wcom.int.lantronix.com you wrote:
Okay - so this is probably not a big deal, however when I use the printf in u-boot as follows:
unsigned char x = 0xC2; printf("this is the problem %02X\n", x);
result is:
this is the problem FFFFFFFC2
Which system is this on?
-----Original Message----- From: Zhang, Jian [mailto:jzhang@ti.com] Sent: Tuesday, February 03, 2004 2:23 PM To: 'u-boot-users@lists.sourceforge.net' Cc: Zhang, Jian; Woodruff, Richard; Powers, John Subject: [U-Boot-Users] [PATCH] bug fixes for fat.h
...
Why are you quoting a totally unrelated message here????
Wolfgang Denk
participants (3)
-
Jerry Walden
-
Pantelis Antoniou
-
Wolfgang Denk