mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-31 03:40:08 +00:00
encoding/cbor: various fixes
- "null" is the proper way to represent the nil value in the diagnostic format - hex encoding in diagnostic format was wrong - struct keys weren't sorted the right deterministic way
This commit is contained in:
@@ -3,6 +3,7 @@ package encoding_cbor
|
||||
import "base:intrinsics"
|
||||
|
||||
import "core:encoding/json"
|
||||
import "core:encoding/hex"
|
||||
import "core:io"
|
||||
import "core:mem"
|
||||
import "core:strconv"
|
||||
@@ -399,11 +400,11 @@ to_diagnostic_format_writer :: proc(w: io.Writer, val: Value, padding := 0) -> i
|
||||
io.write_string(w, str) or_return
|
||||
|
||||
case bool: io.write_string(w, "true" if v else "false") or_return
|
||||
case Nil: io.write_string(w, "nil") or_return
|
||||
case Nil: io.write_string(w, "null") or_return
|
||||
case Undefined: io.write_string(w, "undefined") or_return
|
||||
case ^Bytes:
|
||||
io.write_string(w, "h'") or_return
|
||||
for b in v { io.write_int(w, int(b), 16) or_return }
|
||||
hex.encode_into_writer(w, v^) or_return
|
||||
io.write_string(w, "'") or_return
|
||||
case ^Text:
|
||||
io.write_string(w, `"`) or_return
|
||||
|
||||
Reference in New Issue
Block a user