Update Zig (#164)

* update zig

* pkg/fontconfig: clean up @as

* pkg/freetype,harfbuzz: clean up @as

* pkg/imgui: clean up @as

* pkg/macos: clean up @as

* pkg/pixman,utf8proc: clean up @as

* clean up @as

* lots more @as cleanup

* undo flatpak changes

* clean up @as
This commit is contained in:
Mitchell Hashimoto
2023-06-30 12:15:31 -07:00
committed by GitHub
parent 0c632e7345
commit 314f9287b1
110 changed files with 892 additions and 1022 deletions

View File

@@ -54,7 +54,7 @@ pub const Blob = struct {
pub fn create(data: []const u8, mode: MemoryMode) Error!Blob {
const handle = c.hb_blob_create_or_fail(
data.ptr,
@intCast(c_uint, data.len),
@intCast(data.len),
@intFromEnum(mode),
null,
null,
@@ -83,14 +83,14 @@ pub const Blob = struct {
const Callback = struct {
pub fn callback(data: ?*anyopaque) callconv(.C) void {
@call(.{ .modifier = .always_inline }, destroycb, .{
@ptrCast(?*T, @alignCast(@alignOf(T), data)),
@as(?*T, @ptrCast(@alignCast(data))),
});
}
};
return c.hb_blob_set_user_data(
self.handle,
@ptrCast([*c]c.hb_user_data_key_t, key),
@ptrCast(key),
ptr,
if (destroycb != null) Callback.callback else null,
if (replace) 1 else 0,
@@ -104,13 +104,9 @@ pub const Blob = struct {
comptime T: type,
key: ?*anyopaque,
) ?*T {
const opt = c.hb_blob_get_user_data(
self.handle,
@ptrCast([*c]c.hb_user_data_key_t, key),
);
const opt = c.hb_blob_get_user_data(self.handle, @ptrCast(key));
if (opt) |ptr|
return @ptrCast(?*T, @alignCast(@alignOf(T), ptr))
return @ptrCast(@alignCast(ptr))
else
return null;
}