aboutsummaryrefslogtreecommitdiff
path: root/stdlib/bytes.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/bytes.c')
-rw-r--r--stdlib/bytes.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/stdlib/bytes.c b/stdlib/bytes.c
index 6c94c054..1e889f6d 100644
--- a/stdlib/bytes.c
+++ b/stdlib/bytes.c
@@ -17,15 +17,16 @@ PUREFUNC public Text_t Byte$as_text(const void *b, bool colorize, const TypeInfo
}
public Text_t Byte$hex(Byte_t byte, bool uppercase, bool prefix) {
- Text_t text = {.tag=TEXT_SHORT_ASCII};
+ struct Text_s text = {.tag=TEXT_ASCII};
+ text.ascii = GC_MALLOC_ATOMIC(8);
if (prefix && uppercase)
- text.length = (int64_t)snprintf(text.short_ascii, sizeof(text.short_ascii), "0x%02X", byte);
+ text.length = (int64_t)snprintf((char*)text.ascii, 8, "0x%02X", byte);
else if (prefix && !uppercase)
- text.length = (int64_t)snprintf(text.short_ascii, sizeof(text.short_ascii), "0x%02x", byte);
+ text.length = (int64_t)snprintf((char*)text.ascii, 8, "0x%02x", byte);
else if (!prefix && uppercase)
- text.length = (int64_t)snprintf(text.short_ascii, sizeof(text.short_ascii), "%02X", byte);
+ text.length = (int64_t)snprintf((char*)text.ascii, 8, "%02X", byte);
else if (!prefix && !uppercase)
- text.length = (int64_t)snprintf(text.short_ascii, sizeof(text.short_ascii), "%02x", byte);
+ text.length = (int64_t)snprintf((char*)text.ascii, 8, "%02x", byte);
return text;
}