From 9918693037dce8aa4bb6f08741b6812923486c18 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 19 Jun 2024 11:26:03 +0200 Subject: Merging upstream version 1.76.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/core-foundation-sys/src/number.rs | 74 +++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 26 deletions(-) (limited to 'vendor/core-foundation-sys/src/number.rs') diff --git a/vendor/core-foundation-sys/src/number.rs b/vendor/core-foundation-sys/src/number.rs index c056a245b..d822d417d 100644 --- a/vendor/core-foundation-sys/src/number.rs +++ b/vendor/core-foundation-sys/src/number.rs @@ -9,7 +9,7 @@ use std::os::raw::c_void; -use base::{CFAllocatorRef, CFTypeID, CFComparisonResult}; +use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID}; #[repr(C)] pub struct __CFBoolean(c_void); @@ -19,23 +19,23 @@ pub type CFBooleanRef = *const __CFBoolean; pub type CFNumberType = u32; // members of enum CFNumberType -pub const kCFNumberSInt8Type: CFNumberType = 1; -pub const kCFNumberSInt16Type: CFNumberType = 2; -pub const kCFNumberSInt32Type: CFNumberType = 3; -pub const kCFNumberSInt64Type: CFNumberType = 4; -pub const kCFNumberFloat32Type: CFNumberType = 5; -pub const kCFNumberFloat64Type: CFNumberType = 6; -pub const kCFNumberCharType: CFNumberType = 7; -pub const kCFNumberShortType: CFNumberType = 8; -pub const kCFNumberIntType: CFNumberType = 9; -pub const kCFNumberLongType: CFNumberType = 10; -pub const kCFNumberLongLongType: CFNumberType = 11; -pub const kCFNumberFloatType: CFNumberType = 12; -pub const kCFNumberDoubleType: CFNumberType = 13; -pub const kCFNumberCFIndexType: CFNumberType = 14; +pub const kCFNumberSInt8Type: CFNumberType = 1; +pub const kCFNumberSInt16Type: CFNumberType = 2; +pub const kCFNumberSInt32Type: CFNumberType = 3; +pub const kCFNumberSInt64Type: CFNumberType = 4; +pub const kCFNumberFloat32Type: CFNumberType = 5; +pub const kCFNumberFloat64Type: CFNumberType = 6; +pub const kCFNumberCharType: CFNumberType = 7; +pub const kCFNumberShortType: CFNumberType = 8; +pub const kCFNumberIntType: CFNumberType = 9; +pub const kCFNumberLongType: CFNumberType = 10; +pub const kCFNumberLongLongType: CFNumberType = 11; +pub const kCFNumberFloatType: CFNumberType = 12; +pub const kCFNumberDoubleType: CFNumberType = 13; +pub const kCFNumberCFIndexType: CFNumberType = 14; pub const kCFNumberNSIntegerType: CFNumberType = 15; -pub const kCFNumberCGFloatType: CFNumberType = 16; -pub const kCFNumberMaxType: CFNumberType = 16; +pub const kCFNumberCGFloatType: CFNumberType = 16; +pub const kCFNumberMaxType: CFNumberType = 16; // This is an enum due to zero-sized types warnings. // For more details see https://github.com/rust-lang/rust/issues/27303 @@ -43,23 +43,45 @@ pub enum __CFNumber {} pub type CFNumberRef = *const __CFNumber; -extern { +extern "C" { /* * CFNumber.h */ pub static kCFBooleanTrue: CFBooleanRef; pub static kCFBooleanFalse: CFBooleanRef; + pub static kCFNumberPositiveInfinity: CFNumberRef; + pub static kCFNumberNegativeInfinity: CFNumberRef; + pub static kCFNumberNaN: CFNumberRef; - pub fn CFBooleanGetTypeID() -> CFTypeID; - pub fn CFBooleanGetValue(boolean: CFBooleanRef) -> bool; + /* Creating a Number */ + pub fn CFNumberCreate( + allocator: CFAllocatorRef, + theType: CFNumberType, + valuePtr: *const c_void, + ) -> CFNumberRef; - pub fn CFNumberCreate(allocator: CFAllocatorRef, theType: CFNumberType, valuePtr: *const c_void) - -> CFNumberRef; - //fn CFNumberGetByteSize - pub fn CFNumberGetValue(number: CFNumberRef, theType: CFNumberType, valuePtr: *mut c_void) -> bool; - pub fn CFNumberCompare(date: CFNumberRef, other: CFNumberRef, context: *mut c_void) -> CFComparisonResult; - pub fn CFNumberGetTypeID() -> CFTypeID; + /* Getting Information About Numbers */ + pub fn CFNumberGetByteSize(number: CFNumberRef) -> CFIndex; pub fn CFNumberGetType(number: CFNumberRef) -> CFNumberType; + pub fn CFNumberGetValue( + number: CFNumberRef, + theType: CFNumberType, + valuePtr: *mut c_void, + ) -> bool; + pub fn CFNumberIsFloatType(number: CFNumberRef) -> Boolean; + + /* Comparing Numbers */ + pub fn CFNumberCompare( + date: CFNumberRef, + other: CFNumberRef, + context: *mut c_void, + ) -> CFComparisonResult; + + /* Getting the CFNumber Type ID */ + pub fn CFNumberGetTypeID() -> CFTypeID; + + pub fn CFBooleanGetValue(boolean: CFBooleanRef) -> bool; + pub fn CFBooleanGetTypeID() -> CFTypeID; } #[cfg(test)] -- cgit v1.2.3