Browse Source

[Fix] Fix padded numbers printing

tags/1.7.8
Vsevolod Stakhov 6 years ago
parent
commit
3f3e6a3ebf
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      src/libutil/printf.c

+ 8
- 4
src/libutil/printf.c View File

*--p = _hex[(guint32) (ui64 & 0xf)]; *--p = _hex[(guint32) (ui64 & 0xf)];
} while (ui64 >>= 4); } while (ui64 >>= 4);


len = (temp + sizeof (temp)) - p + 1;
len = (temp + sizeof (temp)) - p;
} }
else { /* hexadecimal == 2 */ else { /* hexadecimal == 2 */
p = temp + sizeof(temp); p = temp + sizeof(temp);
*--p = _HEX[(guint32) (ui64 & 0xf)]; *--p = _HEX[(guint32) (ui64 & 0xf)];
} while (ui64 >>= 4); } while (ui64 >>= 4);


len = (temp + sizeof (temp)) - p + 1;
len = (temp + sizeof (temp)) - p;
} }


/* zero or space padding */ /* zero or space padding */


while (width > 0 && buf < last) {
*buf++ = zero;
if (len < width) {
width -= len;

while (width-- > 0 && buf < last) {
*buf++ = zero;
}
} }


/* number safe copy */ /* number safe copy */

Loading…
Cancel
Save