From ce7a6a7b657e4c8f9514d4181230068bd45823e2 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sun, 2 Jul 2023 15:28:30 +0200 Subject: update for latest zig --- helpers.zig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'helpers.zig') diff --git a/helpers.zig b/helpers.zig index 7bcbabe..1a56231 100644 --- a/helpers.zig +++ b/helpers.zig @@ -13,8 +13,8 @@ pub fn setResult(ctx: ?*c.sqlite3_context, result: anytype) void { const ResultType = @TypeOf(result); switch (ResultType) { - Text => c.sqlite3_result_text(ctx, result.data.ptr, @intCast(c_int, result.data.len), c.SQLITE_TRANSIENT), - Blob => c.sqlite3_result_blob(ctx, result.data.ptr, @intCast(c_int, result.data.len), c.SQLITE_TRANSIENT), + Text => c.sqlite3_result_text(ctx, result.data.ptr, @intCast(result.data.len), c.SQLITE_TRANSIENT), + Blob => c.sqlite3_result_blob(ctx, result.data.ptr, @intCast(result.data.len), c.SQLITE_TRANSIENT), else => switch (@typeInfo(ResultType)) { .Int => |info| if ((info.bits + if (info.signedness == .unsigned) 1 else 0) <= 32) { c.sqlite3_result_int(ctx, result); @@ -31,7 +31,7 @@ pub fn setResult(ctx: ?*c.sqlite3_context, result: anytype) void { }, .Pointer => |ptr| switch (ptr.size) { .Slice => switch (ptr.child) { - u8 => c.sqlite3_result_text(ctx, result.ptr, @intCast(c_int, result.len), c.SQLITE_TRANSIENT), + u8 => c.sqlite3_result_text(ctx, result.ptr, @intCast(result.len), c.SQLITE_TRANSIENT), else => @compileError("cannot use a result of type " ++ @typeName(ResultType)), }, else => @compileError("cannot use a result of type " ++ @typeName(ResultType)), @@ -51,16 +51,16 @@ pub fn setTypeFromValue(comptime ArgType: type, arg: *ArgType, sqlite_value: *c. else => switch (@typeInfo(ArgType)) { .Int => |info| if ((info.bits + if (info.signedness == .unsigned) 1 else 0) <= 32) { const value = c.sqlite3_value_int(sqlite_value); - arg.* = @intCast(ArgType, value); + arg.* = @intCast(value); } else if ((info.bits + if (info.signedness == .unsigned) 1 else 0) <= 64) { const value = c.sqlite3_value_int64(sqlite_value); - arg.* = @intCast(ArgType, value); + arg.* = @intCast(value); } else { @compileError("integer " ++ @typeName(ArgType) ++ " is not representable in sqlite"); }, .Float => { const value = c.sqlite3_value_double(sqlite_value); - arg.* = @floatCast(ArgType, value); + arg.* = @floatCast(value); }, .Bool => { const value = c.sqlite3_value_int(sqlite_value); @@ -79,7 +79,7 @@ pub fn setTypeFromValue(comptime ArgType: type, arg: *ArgType, sqlite_value: *c. } fn sliceFromValue(sqlite_value: *c.sqlite3_value) []const u8 { - const size = @intCast(usize, c.sqlite3_value_bytes(sqlite_value)); + const size: usize = @intCast(c.sqlite3_value_bytes(sqlite_value)); const value = c.sqlite3_value_text(sqlite_value); debug.assert(value != null); // TODO(vincent): how do we handle this properly ? -- cgit v1.2.3