Move code to apple_compat.h
This commit is contained in:
parent
88b29c930f
commit
1b9a067bcc
|
@ -45,6 +45,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
#include <compat/apple_compat.h>
|
||||||
#include <retro_miscellaneous.h>
|
#include <retro_miscellaneous.h>
|
||||||
#include <file/file_path.h>
|
#include <file/file_path.h>
|
||||||
#include <rhash.h>
|
#include <rhash.h>
|
||||||
|
@ -105,32 +106,6 @@ typedef enum
|
||||||
CFAllDomainsMask = 0x0ffff /* All domains: all of the above and future items */
|
CFAllDomainsMask = 0x0ffff /* All domains: all of the above and future items */
|
||||||
} CFDomainMask;
|
} CFDomainMask;
|
||||||
|
|
||||||
#ifndef __has_feature
|
|
||||||
/* Compatibility with non-Clang compilers. */
|
|
||||||
#define __has_feature(x) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CF_RETURNS_RETAINED
|
|
||||||
#if __has_feature(attribute_cf_returns_retained)
|
|
||||||
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
|
|
||||||
#else
|
|
||||||
#define CF_RETURNS_RETAINED
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NS_INLINE
|
|
||||||
#define NS_INLINE inline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetainCompat(id X)
|
|
||||||
{
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
return (__bridge_retained CFTypeRef)X;
|
|
||||||
#else
|
|
||||||
return X;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSSearchPathDirectory NSConvertFlagsCF(unsigned flags)
|
static NSSearchPathDirectory NSConvertFlagsCF(unsigned flags)
|
||||||
{
|
{
|
||||||
switch (flags)
|
switch (flags)
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <retro_assert.h>
|
#include <retro_assert.h>
|
||||||
|
#include <compat/apple_compat.h>
|
||||||
|
|
||||||
#import "../../ui/drivers/cocoa/cocoa_common.h"
|
#import "../../ui/drivers/cocoa/cocoa_common.h"
|
||||||
#include "../video_context_driver.h"
|
#include "../video_context_driver.h"
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef __APPLE_COMPAT_H
|
||||||
|
#define __APPLE_COMPAT_H
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +35,32 @@ typedef unsigned NSUInteger;
|
||||||
typedef float CGFloat;
|
typedef float CGFloat;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __has_feature
|
||||||
|
/* Compatibility with non-Clang compilers. */
|
||||||
|
#define __has_feature(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CF_RETURNS_RETAINED
|
||||||
|
#if __has_feature(attribute_cf_returns_retained)
|
||||||
|
#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
|
||||||
|
#else
|
||||||
|
#define CF_RETURNS_RETAINED
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NS_INLINE
|
||||||
|
#define NS_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetainCompat(id X)
|
||||||
|
{
|
||||||
|
#if __has_feature(objc_arc)
|
||||||
|
return (__bridge_retained CFTypeRef)X;
|
||||||
|
#else
|
||||||
|
return X;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
|
@ -47,3 +76,5 @@ typedef float CGFloat;
|
||||||
#include <objc/objc-runtime.h>
|
#include <objc/objc-runtime.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue