pkg/macos: copyAttribute should return optional

This commit is contained in:
Mitchell Hashimoto
2024-08-24 20:33:58 -07:00
parent d0c510ed29
commit f5234e286a
3 changed files with 4 additions and 4 deletions

View File

@ -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),

View File

@ -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()),

View File

@ -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,
};
}
};