From f5234e286a0f9172fdee9a63419e717a94b28385 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 24 Aug 2024 20:33:58 -0700 Subject: [PATCH] pkg/macos: copyAttribute should return optional --- pkg/macos/foundation/number.zig | 2 +- pkg/macos/text/font.zig | 2 +- pkg/macos/text/font_descriptor.zig | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/macos/foundation/number.zig b/pkg/macos/foundation/number.zig index eec9f076a..88bf9edf6 100644 --- a/pkg/macos/foundation/number.zig +++ b/pkg/macos/foundation/number.zig @@ -15,7 +15,7 @@ pub const Number = opaque { )))) orelse Allocator.Error.OutOfMemory; } - pub fn getValue(self: *Number, comptime t: NumberType, ptr: *t.ValueType()) bool { + pub fn getValue(self: *const Number, comptime t: NumberType, ptr: *t.ValueType()) bool { return c.CFNumberGetValue( @ptrCast(self), @intFromEnum(t), diff --git a/pkg/macos/text/font.zig b/pkg/macos/text/font.zig index 7d8ca243c..c08e8ee14 100644 --- a/pkg/macos/text/font.zig +++ b/pkg/macos/text/font.zig @@ -145,7 +145,7 @@ pub const Font = opaque { ); } - pub fn copyAttribute(self: *Font, comptime attr: text.FontAttribute) attr.Value() { + pub fn copyAttribute(self: *Font, comptime attr: text.FontAttribute) ?attr.Value() { return @ptrFromInt(@intFromPtr(c.CTFontCopyAttribute( @ptrCast(self), @ptrCast(attr.key()), diff --git a/pkg/macos/text/font_descriptor.zig b/pkg/macos/text/font_descriptor.zig index fa4fba1ea..3b4928a6e 100644 --- a/pkg/macos/text/font_descriptor.zig +++ b/pkg/macos/text/font_descriptor.zig @@ -54,7 +54,7 @@ pub const FontDescriptor = opaque { c.CFRelease(self); } - pub fn copyAttribute(self: *const FontDescriptor, comptime attr: FontAttribute) attr.Value() { + pub fn copyAttribute(self: *const FontDescriptor, comptime attr: FontAttribute) ?attr.Value() { return @ptrFromInt(@intFromPtr(c.CTFontDescriptorCopyAttribute( @ptrCast(self), @ptrCast(attr.key()), @@ -153,7 +153,7 @@ pub const FontAttribute = enum { .enabled => *foundation.Number, .downloadable => *anyopaque, // CFBoolean .downloaded => *anyopaque, // CFBoolean - .variation_axes => ?*foundation.Array, + .variation_axes => *foundation.Array, }; } };