fix(windows): prevent @intCast crash on windows

This commit is contained in:
CJ van den Berg 2024-06-27 19:03:22 +02:00
parent 5ba56ab5c7
commit 379b7e8abf
5 changed files with 15 additions and 10 deletions

View file

@ -14,7 +14,7 @@ using thespian::stop_metronome;
extern "C" {
auto thespian_metronome_create_ms(unsigned long ms)
auto thespian_metronome_create_ms(uint64_t ms)
-> thespian_metronome_handle * {
try {
auto *handle = thespian::create_metronome(milliseconds(ms)).ref.release();
@ -27,7 +27,7 @@ auto thespian_metronome_create_ms(unsigned long ms)
return nullptr;
}
}
auto thespian_metronome_create_us(unsigned long us)
auto thespian_metronome_create_us(uint64_t us)
-> thespian_metronome_handle * {
try {
auto *handle = thespian::create_metronome(microseconds(us)).ref.release();

View file

@ -13,7 +13,7 @@ using thespian::timeout_ref;
extern "C" {
auto thespian_timeout_create_ms(unsigned long ms, cbor_buffer m)
auto thespian_timeout_create_ms(uint64_t ms, cbor_buffer m)
-> thespian_timeout_handle * {
try {
cbor::buffer buf;
@ -31,7 +31,7 @@ auto thespian_timeout_create_ms(unsigned long ms, cbor_buffer m)
return nullptr;
}
}
auto thespian_timeout_create_us(unsigned long us, cbor_buffer m)
auto thespian_timeout_create_us(uint64_t us, cbor_buffer m)
-> thespian_timeout_handle * {
try {
cbor::buffer buf;

View file

@ -681,11 +681,11 @@ pub const timeout = struct {
const Self = @This();
pub fn init(tick_time_us: u64, m: message) !Self {
return .{ .handle = c.thespian_timeout_create_us(@intCast(tick_time_us), m.to(c.cbor_buffer)) orelse return error.ThespianTimeoutInitFailed };
return .{ .handle = c.thespian_timeout_create_us(tick_time_us, m.to(c.cbor_buffer)) orelse return error.ThespianTimeoutInitFailed };
}
pub fn init_ms(tick_time_us: u64, m: message) !Self {
return .{ .handle = c.thespian_timeout_create_ms(@intCast(tick_time_us), m.to(c.cbor_buffer)) orelse return error.ThespianTimeoutInitFailed };
return .{ .handle = c.thespian_timeout_create_ms(tick_time_us, m.to(c.cbor_buffer)) orelse return error.ThespianTimeoutInitFailed };
}
pub fn cancel(self: *const Self) !void {