diff --git a/pkg/freetype/face.zig b/pkg/freetype/face.zig index 84178b860..f8714d4fe 100644 --- a/pkg/freetype/face.zig +++ b/pkg/freetype/face.zig @@ -193,8 +193,8 @@ pub const Face = struct { ) void { c.FT_Set_Transform( self.handle, - @constCast(@ptrCast(matrix)), - @constCast(@ptrCast(delta)), + @ptrCast(@constCast(matrix)), + @ptrCast(@constCast(delta)), ); } }; diff --git a/pkg/macos/foundation/array.zig b/pkg/macos/foundation/array.zig index d3a977539..7b580eb03 100644 --- a/pkg/macos/foundation/array.zig +++ b/pkg/macos/foundation/array.zig @@ -68,7 +68,7 @@ pub const MutableArray = opaque { comptime Elem: type, value: *const Elem, ) void { - CFArrayAppendValue(self, @constCast(@ptrCast(value))); + CFArrayAppendValue(self, @ptrCast(@constCast(value))); } pub fn removeValue(self: *MutableArray, idx: usize) void { diff --git a/pkg/macos/foundation/attributed_string.zig b/pkg/macos/foundation/attributed_string.zig index de509b2c0..c7f27d7d7 100644 --- a/pkg/macos/foundation/attributed_string.zig +++ b/pkg/macos/foundation/attributed_string.zig @@ -10,7 +10,7 @@ pub const AttributedString = opaque { str: *foundation.String, attributes: *foundation.Dictionary, ) Allocator.Error!*AttributedString { - return @constCast(@ptrCast(c.CFAttributedStringCreate( + return @ptrCast(@constCast(c.CFAttributedStringCreate( null, @ptrCast(str), @ptrCast(attributes), diff --git a/pkg/macos/foundation/dictionary.zig b/pkg/macos/foundation/dictionary.zig index 90642e59a..a529442ac 100644 --- a/pkg/macos/foundation/dictionary.zig +++ b/pkg/macos/foundation/dictionary.zig @@ -17,8 +17,8 @@ pub const Dictionary = opaque { return @as(?*Dictionary, @ptrFromInt(@intFromPtr(c.CFDictionaryCreate( null, - @constCast(@ptrCast(if (keys) |slice| slice.ptr else null)), - @constCast(@ptrCast(if (values) |slice| slice.ptr else null)), + @ptrCast(@constCast(if (keys) |slice| slice.ptr else null)), + @ptrCast(@constCast(if (values) |slice| slice.ptr else null)), @intCast(if (keys) |slice| slice.len else 0), &c.kCFTypeDictionaryKeyCallBacks, &c.kCFTypeDictionaryValueCallBacks, diff --git a/pkg/macos/text/font.zig b/pkg/macos/text/font.zig index 383861d62..ea37891f5 100644 --- a/pkg/macos/text/font.zig +++ b/pkg/macos/text/font.zig @@ -68,7 +68,7 @@ pub const Font = opaque { } pub fn copyTable(self: *Font, tag: FontTableTag) ?*foundation.Data { - return @constCast(@ptrCast(c.CTFontCopyTable( + return @ptrCast(@constCast(c.CTFontCopyTable( @ptrCast(self), @intFromEnum(tag), c.kCTFontTableOptionNoOptions, @@ -90,7 +90,7 @@ pub const Font = opaque { } pub fn createPathForGlyph(self: *Font, glyph: graphics.Glyph) ?*graphics.Path { - return @constCast(@ptrCast(c.CTFontCreatePathForGlyph( + return @ptrCast(@constCast(c.CTFontCreatePathForGlyph( @ptrCast(self), glyph, null, diff --git a/pkg/macos/text/line.zig b/pkg/macos/text/line.zig index 135fd8558..248f8e645 100644 --- a/pkg/macos/text/line.zig +++ b/pkg/macos/text/line.zig @@ -51,7 +51,7 @@ pub const Line = opaque { } pub fn getGlyphRuns(self: *Line) *foundation.Array { - return @constCast(@ptrCast(c.CTLineGetGlyphRuns(@ptrCast(self)))); + return @ptrCast(@constCast(c.CTLineGetGlyphRuns(@ptrCast(self)))); } }; diff --git a/pkg/macos/video/display_link.zig b/pkg/macos/video/display_link.zig index 4bbf58a0c..7d6b437f9 100644 --- a/pkg/macos/video/display_link.zig +++ b/pkg/macos/video/display_link.zig @@ -74,7 +74,7 @@ pub const DisplayLink = opaque { callbackFn( displayLink, - @alignCast(@ptrCast(inner_userinfo)), + @ptrCast(@alignCast(inner_userinfo)), ); return c.kCVReturnSuccess; } diff --git a/pkg/oniguruma/init.zig b/pkg/oniguruma/init.zig index 933e50b5a..ea64724c2 100644 --- a/pkg/oniguruma/init.zig +++ b/pkg/oniguruma/init.zig @@ -6,7 +6,7 @@ const errors = @import("errors.zig"); /// the encodings that the program will use. pub fn init(encs: []const *Encoding) !void { _ = try errors.convertError(c.onig_initialize( - @constCast(@ptrCast(@alignCast(encs.ptr))), + @ptrCast(@alignCast(@constCast(encs.ptr))), @intCast(encs.len), )); } diff --git a/pkg/wuffs/src/jpeg.zig b/pkg/wuffs/src/jpeg.zig index c07278eed..700ba01b9 100644 --- a/pkg/wuffs/src/jpeg.zig +++ b/pkg/wuffs/src/jpeg.zig @@ -31,7 +31,7 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData { } var source_buffer: c.wuffs_base__io_buffer = .{ - .data = .{ .ptr = @constCast(@ptrCast(data.ptr)), .len = data.len }, + .data = .{ .ptr = @ptrCast(@constCast(data.ptr)), .len = data.len }, .meta = .{ .wi = data.len, .ri = 0, diff --git a/pkg/wuffs/src/png.zig b/pkg/wuffs/src/png.zig index 1f37bb375..d79ae5b56 100644 --- a/pkg/wuffs/src/png.zig +++ b/pkg/wuffs/src/png.zig @@ -31,7 +31,7 @@ pub fn decode(alloc: Allocator, data: []const u8) Error!ImageData { } var source_buffer: c.wuffs_base__io_buffer = .{ - .data = .{ .ptr = @constCast(@ptrCast(data.ptr)), .len = data.len }, + .data = .{ .ptr = @ptrCast(@constCast(data.ptr)), .len = data.len }, .meta = .{ .wi = data.len, .ri = 0, diff --git a/src/apprt/gtk/class.zig b/src/apprt/gtk/class.zig index 4b46f8365..942666cf4 100644 --- a/src/apprt/gtk/class.zig +++ b/src/apprt/gtk/class.zig @@ -282,7 +282,7 @@ pub fn Common( fn setter(self: *Self, value: ?[:0]const u8) void { const priv = private(self); if (@field(priv, name)) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); } // We don't need to copy this because it was already diff --git a/src/apprt/gtk/class/resize_overlay.zig b/src/apprt/gtk/class/resize_overlay.zig index 9bb9a0a7c..f6e0c1442 100644 --- a/src/apprt/gtk/class/resize_overlay.zig +++ b/src/apprt/gtk/class/resize_overlay.zig @@ -172,7 +172,7 @@ pub const ResizeOverlay = extern struct { /// overlay if it is currently hidden; you must call schedule. pub fn setLabel(self: *Self, label: ?[:0]const u8) void { const priv = self.private(); - if (priv.label_text) |v| glib.free(@constCast(@ptrCast(v))); + if (priv.label_text) |v| glib.free(@ptrCast(@constCast(v))); priv.label_text = null; if (label) |v| priv.label_text = glib.ext.dupeZ(u8, v); self.as(gobject.Object).notifyByPspec(properties.label.impl.param_spec); @@ -285,7 +285,7 @@ pub const ResizeOverlay = extern struct { fn finalize(self: *Self) callconv(.c) void { const priv = self.private(); if (priv.label_text) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.label_text = null; } diff --git a/src/apprt/gtk/class/surface.zig b/src/apprt/gtk/class/surface.zig index 401e542e4..d49885256 100644 --- a/src/apprt/gtk/class/surface.zig +++ b/src/apprt/gtk/class/surface.zig @@ -1626,7 +1626,7 @@ pub const Surface = extern struct { priv.core_surface = null; } if (priv.mouse_hover_url) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.mouse_hover_url = null; } if (priv.default_size) |v| { @@ -1642,15 +1642,15 @@ pub const Surface = extern struct { priv.min_size = null; } if (priv.pwd) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.pwd = null; } if (priv.title) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.title = null; } if (priv.title_override) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.title_override = null; } self.clearCgroup(); @@ -1674,7 +1674,7 @@ pub const Surface = extern struct { /// title. For manually set titles see `setTitleOverride`. pub fn setTitle(self: *Self, title: ?[:0]const u8) void { const priv = self.private(); - if (priv.title) |v| glib.free(@constCast(@ptrCast(v))); + if (priv.title) |v| glib.free(@ptrCast(@constCast(v))); priv.title = null; if (title) |v| priv.title = glib.ext.dupeZ(u8, v); self.as(gobject.Object).notifyByPspec(properties.title.impl.param_spec); @@ -1684,7 +1684,7 @@ pub const Surface = extern struct { /// unless this is unset (null). pub fn setTitleOverride(self: *Self, title: ?[:0]const u8) void { const priv = self.private(); - if (priv.title_override) |v| glib.free(@constCast(@ptrCast(v))); + if (priv.title_override) |v| glib.free(@ptrCast(@constCast(v))); priv.title_override = null; if (title) |v| priv.title_override = glib.ext.dupeZ(u8, v); self.as(gobject.Object).notifyByPspec(properties.@"title-override".impl.param_spec); @@ -1698,7 +1698,7 @@ pub const Surface = extern struct { /// Set the pwd for this surface, copies the value. pub fn setPwd(self: *Self, pwd: ?[:0]const u8) void { const priv = self.private(); - if (priv.pwd) |v| glib.free(@constCast(@ptrCast(v))); + if (priv.pwd) |v| glib.free(@ptrCast(@constCast(v))); priv.pwd = null; if (pwd) |v| priv.pwd = glib.ext.dupeZ(u8, v); self.as(gobject.Object).notifyByPspec(properties.pwd.impl.param_spec); @@ -1783,7 +1783,7 @@ pub const Surface = extern struct { pub fn setMouseHoverUrl(self: *Self, url: ?[:0]const u8) void { const priv = self.private(); - if (priv.mouse_hover_url) |v| glib.free(@constCast(@ptrCast(v))); + if (priv.mouse_hover_url) |v| glib.free(@ptrCast(@constCast(v))); priv.mouse_hover_url = null; if (url) |v| priv.mouse_hover_url = glib.ext.dupeZ(u8, v); self.as(gobject.Object).notifyByPspec(properties.@"mouse-hover-url".impl.param_spec); diff --git a/src/apprt/gtk/class/surface_title_dialog.zig b/src/apprt/gtk/class/surface_title_dialog.zig index de36f3090..6d3bf33de 100644 --- a/src/apprt/gtk/class/surface_title_dialog.zig +++ b/src/apprt/gtk/class/surface_title_dialog.zig @@ -136,7 +136,7 @@ pub const SurfaceTitleDialog = extern struct { fn finalize(self: *Self) callconv(.c) void { const priv = self.private(); if (priv.initial_value) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.initial_value = null; } diff --git a/src/apprt/gtk/class/tab.zig b/src/apprt/gtk/class/tab.zig index 373507507..26b006bb6 100644 --- a/src/apprt/gtk/class/tab.zig +++ b/src/apprt/gtk/class/tab.zig @@ -270,11 +270,11 @@ pub const Tab = extern struct { fn finalize(self: *Self) callconv(.c) void { const priv = self.private(); if (priv.tooltip) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.tooltip = null; } if (priv.title) |v| { - glib.free(@constCast(@ptrCast(v))); + glib.free(@ptrCast(@constCast(v))); priv.title = null; } diff --git a/src/cli/args.zig b/src/cli/args.zig index b8f393864..c4a40acf5 100644 --- a/src/cli/args.zig +++ b/src/cli/args.zig @@ -324,7 +324,7 @@ pub fn parseIntoField( return; } const raw = field.default_value_ptr orelse break :default; - const ptr: *const field.type = @alignCast(@ptrCast(raw)); + const ptr: *const field.type = @ptrCast(@alignCast(raw)); @field(dst, field.name) = ptr.*; return; } @@ -586,7 +586,7 @@ pub fn parseAutoStruct( break :default @field(default, field.name); } else { const default_ptr = field.default_value_ptr orelse return error.InvalidValue; - const typed_ptr: *const field.type = @alignCast(@ptrCast(default_ptr)); + const typed_ptr: *const field.type = @ptrCast(@alignCast(default_ptr)); break :default typed_ptr.*; } }; diff --git a/src/inspector/Inspector.zig b/src/inspector/Inspector.zig index 27abb8657..d23510949 100644 --- a/src/inspector/Inspector.zig +++ b/src/inspector/Inspector.zig @@ -149,7 +149,7 @@ pub fn setup() void { font_config.FontDataOwnedByAtlas = false; _ = cimgui.c.ImFontAtlas_AddFontFromMemoryTTF( io.Fonts, - @constCast(@ptrCast(font.embedded.regular)), + @ptrCast(@constCast(font.embedded.regular)), font.embedded.regular.len, font_size, font_config, diff --git a/src/terminal/bitmap_allocator.zig b/src/terminal/bitmap_allocator.zig index 724c71be5..1121058a3 100644 --- a/src/terminal/bitmap_allocator.zig +++ b/src/terminal/bitmap_allocator.zig @@ -92,7 +92,7 @@ pub fn BitmapAllocator(comptime chunk_size: comptime_int) type { return error.OutOfMemory; const chunks = self.chunks.ptr(base); - const ptr: [*]T = @alignCast(@ptrCast(&chunks[idx * chunk_size])); + const ptr: [*]T = @ptrCast(@alignCast(&chunks[idx * chunk_size])); return ptr[0..n]; }