refactor: use more portable types in cbor matching
This commit is contained in:
parent
75aa43a0da
commit
ef742fe069
1 changed files with 3 additions and 3 deletions
|
@ -290,12 +290,12 @@ pub fn decodeArrayHeader(iter: *[]const u8) CborError!usize {
|
||||||
return 0;
|
return 0;
|
||||||
if (t.major != 4)
|
if (t.major != 4)
|
||||||
return error.CborInvalidType;
|
return error.CborInvalidType;
|
||||||
return decodePInt(iter, t.minor);
|
return @intCast(try decodePInt(iter, t.minor));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decodeString(iter_: *[]const u8, minor: u5) CborError![]const u8 {
|
fn decodeString(iter_: *[]const u8, minor: u5) CborError![]const u8 {
|
||||||
var iter = iter_.*;
|
var iter = iter_.*;
|
||||||
const len = try decodePInt(&iter, minor);
|
const len: usize = @intCast(try decodePInt(&iter, minor));
|
||||||
if (iter.len < len)
|
if (iter.len < len)
|
||||||
return error.CborTooShort;
|
return error.CborTooShort;
|
||||||
const s = iter[0..len];
|
const s = iter[0..len];
|
||||||
|
@ -392,7 +392,7 @@ fn matchBoolValue(iter: *[]const u8, val: bool) CborError!bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn skipString(iter: *[]const u8, minor: u5) CborError!void {
|
fn skipString(iter: *[]const u8, minor: u5) CborError!void {
|
||||||
const len = try decodePInt(iter, minor);
|
const len: usize = @intCast(try decodePInt(iter, minor));
|
||||||
if (iter.len < len)
|
if (iter.len < len)
|
||||||
return error.CborTooShort;
|
return error.CborTooShort;
|
||||||
iter.* = iter.*[len..];
|
iter.* = iter.*[len..];
|
||||||
|
|
Loading…
Add table
Reference in a new issue