diff options
author | johannst <johannes.stoelp@gmail.com> | 2021-03-26 23:17:46 +0100 |
---|---|---|
committer | johannst <johannes.stoelp@gmail.com> | 2021-03-26 23:17:46 +0100 |
commit | 1d2a6f21294f8390b683e4e097cb49210ed832d1 (patch) | |
tree | 19f6854c3e1fa6a82ec4ed4bb57b2d3dadf979b8 /lib/src/fmt.c | |
parent | cf97ecd5b52c2f7a8953fd1674742d46fd15418a (diff) | |
download | dynld-1d2a6f21294f8390b683e4e097cb49210ed832d1.tar.gz dynld-1d2a6f21294f8390b683e4e097cb49210ed832d1.zip |
Added dyn allocator + syscall wrappers + minor fixes.
Diffstat (limited to 'lib/src/fmt.c')
-rw-r--r-- | lib/src/fmt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/src/fmt.c b/lib/src/fmt.c index be1ca3a..b0840de 100644 --- a/lib/src/fmt.c +++ b/lib/src/fmt.c @@ -11,7 +11,7 @@ static const char* num2dec(char* buf, unsigned long len, unsigned long long num) } while (num > 0 && pbuf != buf) { - char d = (num % 10) + '0'; + char d = (char)(num % 10) + '0'; *(--pbuf) = d; num /= 10; } @@ -28,7 +28,7 @@ static const char* num2hex(char* buf, unsigned long len, unsigned long long num) while (num > 0 && pbuf != buf) { char d = (num & 0xf); - *(--pbuf) = d + (d > 9 ? 'a' - 10 : '0'); + *(--pbuf) = (char)(d + (d > 9 ? 'a' - 10 : '0')); num >>= 4; } return pbuf; @@ -73,7 +73,7 @@ int vfmt(char* buf, unsigned long len, const char* fmt, va_list ap) { val *= -1; put('-'); } - const char* ptr = num2dec(scratch, sizeof(scratch), val); + const char* ptr = num2dec(scratch, sizeof(scratch), (unsigned long)val); puts(ptr); } break; case 'x': { |