12
12
use crate :: base:: { id, nil, BOOL , NO , SEL } ;
13
13
use bitflags:: bitflags;
14
14
use block:: Block ;
15
- use libc ;
15
+ use core :: ffi :: { c_char , c_double , c_ulong , c_ulonglong , c_void } ;
16
16
use objc:: { class, msg_send, sel, sel_impl} ;
17
- use std:: os:: raw:: c_void;
18
17
use std:: ptr;
19
18
20
19
#[ cfg( target_pointer_width = "32" ) ]
21
- pub type NSInteger = libc :: c_int ;
20
+ pub type NSInteger = core :: ffi :: c_int ;
22
21
#[ cfg( target_pointer_width = "32" ) ]
23
- pub type NSUInteger = libc :: c_uint ;
22
+ pub type NSUInteger = core :: ffi :: c_uint ;
24
23
25
24
#[ cfg( target_pointer_width = "64" ) ]
26
- pub type NSInteger = libc :: c_long ;
25
+ pub type NSInteger = core :: ffi :: c_long ;
27
26
#[ cfg( target_pointer_width = "64" ) ]
28
- pub type NSUInteger = libc :: c_ulong ;
27
+ pub type NSUInteger = core :: ffi :: c_ulong ;
29
28
30
29
pub const NSIntegerMax : NSInteger = NSInteger :: max_value ( ) ;
31
30
pub const NSNotFound : NSInteger = NSIntegerMax ;
@@ -245,7 +244,7 @@ impl NSProcessInfo for id {
245
244
}
246
245
}
247
246
248
- pub type NSTimeInterval = libc :: c_double ;
247
+ pub type NSTimeInterval = c_double ;
249
248
250
249
pub trait NSArray : Sized {
251
250
unsafe fn array ( _: Self ) -> id {
@@ -401,7 +400,7 @@ pub trait NSDictionary: Sized {
401
400
unsafe fn fileOwnerAccountID ( self ) -> id ;
402
401
unsafe fn fileOwnerAccountName ( self ) -> id ;
403
402
unsafe fn filePosixPermissions ( self ) -> NSUInteger ;
404
- unsafe fn fileSize ( self ) -> libc :: c_ulonglong ;
403
+ unsafe fn fileSize ( self ) -> c_ulonglong ;
405
404
unsafe fn fileSystemFileNumber ( self ) -> NSUInteger ;
406
405
unsafe fn fileSystemNumber ( self ) -> NSInteger ;
407
406
unsafe fn fileType ( self ) -> id ;
@@ -581,7 +580,7 @@ impl NSDictionary for id {
581
580
msg_send ! [ self , filePosixPermissions]
582
581
}
583
582
584
- unsafe fn fileSize ( self ) -> libc :: c_ulonglong {
583
+ unsafe fn fileSize ( self ) -> c_ulonglong {
585
584
msg_send ! [ self , fileSize]
586
585
}
587
586
@@ -616,7 +615,7 @@ impl NSDictionary for id {
616
615
617
616
bitflags ! {
618
617
#[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
619
- pub struct NSEnumerationOptions : libc :: c_ulonglong {
618
+ pub struct NSEnumerationOptions : c_ulonglong {
620
619
const NSEnumerationConcurrent = 1 << 0 ;
621
620
const NSEnumerationReverse = 1 << 1 ;
622
621
}
@@ -639,7 +638,7 @@ pub trait NSString: Sized {
639
638
640
639
unsafe fn stringByAppendingString_ ( self , other : id ) -> id ;
641
640
unsafe fn init_str ( self , string : & str ) -> Self ;
642
- unsafe fn UTF8String ( self ) -> * const libc :: c_char ;
641
+ unsafe fn UTF8String ( self ) -> * const c_char ;
643
642
unsafe fn len ( self ) -> usize ;
644
643
unsafe fn isEqualToString ( self , string : & str ) -> bool ;
645
644
unsafe fn substringWithRange ( self , range : NSRange ) -> id ;
@@ -667,7 +666,7 @@ impl NSString for id {
667
666
msg_send ! [ self , lengthOfBytesUsingEncoding: UTF8_ENCODING ]
668
667
}
669
668
670
- unsafe fn UTF8String ( self ) -> * const libc :: c_char {
669
+ unsafe fn UTF8String ( self ) -> * const c_char {
671
670
msg_send ! [ self , UTF8String ]
672
671
}
673
672
@@ -690,18 +689,18 @@ impl NSDate for id {}
690
689
691
690
#[ repr( C ) ]
692
691
struct NSFastEnumerationState {
693
- pub state : libc :: c_ulong ,
692
+ pub state : c_ulong ,
694
693
pub items_ptr : * mut id ,
695
- pub mutations_ptr : * mut libc :: c_ulong ,
696
- pub extra : [ libc :: c_ulong ; 5 ] ,
694
+ pub mutations_ptr : * mut c_ulong ,
695
+ pub extra : [ c_ulong ; 5 ] ,
697
696
}
698
697
699
698
const NS_FAST_ENUM_BUF_SIZE : usize = 16 ;
700
699
701
700
pub struct NSFastIterator {
702
701
state : NSFastEnumerationState ,
703
702
buffer : [ id ; NS_FAST_ENUM_BUF_SIZE ] ,
704
- mut_val : Option < libc :: c_ulong > ,
703
+ mut_val : Option < c_ulong > ,
705
704
len : usize ,
706
705
idx : usize ,
707
706
object : id ,
@@ -1596,7 +1595,7 @@ impl NSData for id {
1596
1595
1597
1596
bitflags ! {
1598
1597
#[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
1599
- pub struct NSDataReadingOptions : libc :: c_ulonglong {
1598
+ pub struct NSDataReadingOptions : c_ulonglong {
1600
1599
const NSDataReadingMappedIfSafe = 1 << 0 ;
1601
1600
const NSDataReadingUncached = 1 << 1 ;
1602
1601
const NSDataReadingMappedAlways = 1 << 3 ;
@@ -1605,7 +1604,7 @@ bitflags! {
1605
1604
1606
1605
bitflags ! {
1607
1606
#[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
1608
- pub struct NSDataBase64EncodingOptions : libc :: c_ulonglong {
1607
+ pub struct NSDataBase64EncodingOptions : c_ulonglong {
1609
1608
const NSDataBase64Encoding64CharacterLineLength = 1 << 0 ;
1610
1609
const NSDataBase64Encoding76CharacterLineLength = 1 << 1 ;
1611
1610
const NSDataBase64EncodingEndLineWithCarriageReturn = 1 << 4 ;
@@ -1615,22 +1614,22 @@ bitflags! {
1615
1614
1616
1615
bitflags ! {
1617
1616
#[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
1618
- pub struct NSDataBase64DecodingOptions : libc :: c_ulonglong {
1617
+ pub struct NSDataBase64DecodingOptions : c_ulonglong {
1619
1618
const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0 ;
1620
1619
}
1621
1620
}
1622
1621
1623
1622
bitflags ! {
1624
1623
#[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
1625
- pub struct NSDataWritingOptions : libc :: c_ulonglong {
1624
+ pub struct NSDataWritingOptions : c_ulonglong {
1626
1625
const NSDataWritingAtomic = 1 << 0 ;
1627
1626
const NSDataWritingWithoutOverwriting = 1 << 1 ;
1628
1627
}
1629
1628
}
1630
1629
1631
1630
bitflags ! {
1632
1631
#[ derive( Clone , Copy , Debug , Default , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
1633
- pub struct NSDataSearchOptions : libc :: c_ulonglong {
1632
+ pub struct NSDataSearchOptions : c_ulonglong {
1634
1633
const NSDataSearchBackwards = 1 << 0 ;
1635
1634
const NSDataSearchAnchored = 1 << 1 ;
1636
1635
}
0 commit comments