mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
decrement when the input is invalid utf8
This commit is contained in:
parent
7304154452
commit
3537fa57d2
2 changed files with 3 additions and 4 deletions
|
@ -1018,9 +1018,9 @@ fn fromUtf8(allocator: *Allocator, arg: RocList) FromUtf8Result {
|
||||||
} else {
|
} else {
|
||||||
const temp = errorToProblem(@ptrCast([*]u8, arg.bytes), arg.length);
|
const temp = errorToProblem(@ptrCast([*]u8, arg.bytes), arg.length);
|
||||||
|
|
||||||
// TODO what should we do RC-wise here
|
// consume the input list
|
||||||
// const data_bytes = arg.len();
|
const data_bytes = arg.len();
|
||||||
// utils.decref(allocator, @alignOf(usize), arg.list_bytes, data_bytes);
|
utils.decref(allocator, @alignOf(usize), arg.bytes, data_bytes);
|
||||||
|
|
||||||
return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), .byte_index = temp.index, .problem_code = temp.problem };
|
return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), .byte_index = temp.index, .problem_code = temp.problem };
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ IO a : Task.Task a []
|
||||||
|
|
||||||
main : IO {}
|
main : IO {}
|
||||||
main =
|
main =
|
||||||
# when fromBytes [ 0 ] is
|
|
||||||
when Base64.fromBytes (Str.toBytes "Hello World") is
|
when Base64.fromBytes (Str.toBytes "Hello World") is
|
||||||
Ok str ->
|
Ok str ->
|
||||||
Task.putLine str
|
Task.putLine str
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue