Merge branch 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux

* 'fix-display-signed-char' of https://github.com/Ram-Z/util-linux:
  hexdump: correctly display signed single byte integers
This commit is contained in:
Karel Zak 2021-06-09 10:32:23 +02:00
commit 20cc7d100a
1 changed files with 3 additions and 1 deletions

View File

@ -145,13 +145,15 @@ print(struct hexdump_pr *pr, unsigned char *bp) {
}
case F_INT:
{
char cval; /* int8_t */
short sval; /* int16_t */
int ival; /* int32_t */
long long Lval; /* int64_t, int64_t */
switch(pr->bcnt) {
case 1:
printf(pr->fmt, (unsigned long long) *bp);
memmove(&cval, bp, sizeof(cval));
printf(pr->fmt, (unsigned long long) cval);
break;
case 2:
memmove(&sval, bp, sizeof(sval));