glfw: dont use @errSetCast

This commit is contained in:
Lee Cannon 2022-02-08 02:08:26 +00:00 committed by Stephen Gutekanst
parent 3e79a12f3d
commit 2e9347399d
10 changed files with 74 additions and 87 deletions

View file

@ -76,7 +76,7 @@ pub inline fn init(hints: InitHints) error{PlatformError}!void {
if (c.glfwInit() == c.GLFW_TRUE) return;
getError() catch |err| return switch (err) {
Error.PlatformError => @errSetCast(error{PlatformError}, err),
Error.PlatformError => |e| e,
else => unreachable,
};
}
@ -243,7 +243,7 @@ pub inline fn pollEvents() error{PlatformError}!void {
c.glfwPollEvents();
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.PlatformError => @errSetCast(error{PlatformError}, err),
Error.PlatformError => |e| e,
else => unreachable,
};
}
@ -283,7 +283,7 @@ pub inline fn waitEvents() error{PlatformError}!void {
c.glfwWaitEvents();
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.PlatformError => @errSetCast(error{PlatformError}, err),
Error.PlatformError => |e| e,
else => unreachable,
};
}
@ -331,7 +331,7 @@ pub inline fn waitEventsTimeout(timeout: f64) error{PlatformError}!void {
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.InvalidValue => unreachable,
Error.PlatformError => @errSetCast(error{PlatformError}, err),
Error.PlatformError => |e| e,
else => unreachable,
};
}
@ -351,7 +351,7 @@ pub inline fn postEmptyEvent() error{PlatformError}!void {
c.glfwPostEmptyEvent();
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.PlatformError => @errSetCast(error{PlatformError}, err),
Error.PlatformError => |e| e,
else => unreachable,
};
}