[patch] for fix signed/unsigned problem at smidump

Hi,
there is a problem with smidump to xml for octet strings with negative values.
For example 0xd0 will be printed as 0xff.
This patch fix it:
Index: tools/dump-xml.c =================================================================== --- tools/dump-xml.c (Revision 28966) +++ tools/dump-xml.c (Arbeitskopie) @@ -244,7 +244,7 @@ } else { sprintf(s, "0x%*s", 2 * valuePtr->len, ""); for (i=0; i < valuePtr->len; i++) { - sprintf(ss, "%02x", valuePtr->value.ptr[i]); + sprintf(ss, "%02x", (unsigned char)(valuePtr-
value.ptr[i]));
strncpy(&s[2+2*i], ss, 2); } }
With regards, Claus Klein

On Thu, Sep 02, 2010 at 11:04:00PM +0200, Claus Klein wrote:
Hi,
there is a problem with smidump to xml for octet strings with negative values.
For example 0xd0 will be printed as 0xff.
This patch fix it:
[...]
Thanks. I have decided that the ptr should really be a pointer to unsigned char and not a pointer to char. This change requires two casts where we stick the ptr into library functions that expect a pointer to char - but the good news is that gcc detects this. The change is in revision 28971.
/js
participants (2)
-
Claus Klein
-
Juergen Schoenwaelder