misc/libphysfs/platform_macosx.c
author koda
Wed, 27 Apr 2016 01:03:15 -0400
changeset 11745 bb704a0f564d
parent 10017 de822cd3df3a
child 12218 bb5522e88ab2
permissions -rw-r--r--
Drop duplicated include from CMakeLists.txt
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     1
/*
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     2
 * Mac OS X support routines for PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
 * Please see the file LICENSE.txt in the source's root directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     5
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     6
 *  This file written by Ryan C. Gordon.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     7
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     9
#define __PHYSICSFS_INTERNAL__
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    10
#include "physfs_platforms.h"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    11
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    12
#ifdef PHYSFS_PLATFORM_MACOSX
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    13
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    14
#include <CoreFoundation/CoreFoundation.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    15
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    16
#if !defined(PHYSFS_NO_CDROM_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    17
#include <Carbon/Carbon.h>  /* !!! FIXME */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    18
#include <IOKit/storage/IOMedia.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
#include <IOKit/storage/IOCDMedia.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    20
#include <IOKit/storage/IODVDMedia.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    21
#include <sys/mount.h>
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    22
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
/* Seems to get defined in some system header... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    25
#ifdef Free
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    26
#undef Free
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    27
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    29
#include "physfs_internal.h"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    30
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    31
8928
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    32
#if defined(__APPLE__)
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    33
#if defined(TARGET_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    34
/* __eprintf shouldn't have been made visible from libstdc++, or anywhere, but
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    35
   on Mac OS X 10.4 it was defined in libstdc++.6.0.3.dylib; so on that platform
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    36
   we have to keep defining it to keep binary compatibility.
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    37
   We can't just put the libgcc version in the export list, because that
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    38
   doesn't work; once a symbol is marked as hidden, it stays that way.  */
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    39
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    40
void __eprintf (const char *string, const char *expression,
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 9183
diff changeset
    41
            unsigned int line, const char *filename)
8928
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    42
{
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    43
    fprintf(stderr, string, expression, line, filename);
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    44
    fflush(stderr);
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    45
    abort();
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    46
}
9183
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    47
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    48
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    49
/* apparently libssp is missing from 10.4 SDK
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    50
   code from http://wiki.osdev.org/GCC_Stack_Smashing_Protector */
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    51
void * __stack_chk_guard = NULL;
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    52
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    53
void __stack_chk_guard_setup()
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    54
{
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    55
    unsigned char * p;
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    56
    p = (unsigned char *) &__stack_chk_guard;
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    57
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    58
    /* If you have the ability to generate random numbers in your kernel then use them,
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    59
       otherwise for 32-bit code: *p = 0x00000aff; */
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    60
    *p = random();
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    61
}
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    62
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    63
void __attribute__((noreturn)) __stack_chk_fail()
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    64
{
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    65
    /* put your panic function or similar in here */
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    66
    unsigned char * vid = (unsigned char *)0xB8000;
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    67
    vid[1] = 7;
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    68
    for(;;)
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    69
    vid[0]++;
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    70
}
4cd7c7aafea7 libssp (required by stack-protector) is not available on 10.4
koda
parents: 8928
diff changeset
    71
8928
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    72
#endif
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    73
#endif /* __APPLE__ */
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    74
10a79d89ca31 expose a hidden function that prevented linking on osx 10.4 when compiling physfs statically
koda
parents: 8524
diff changeset
    75
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    76
/* Wrap PHYSFS_Allocator in a CFAllocator... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    77
static CFAllocatorRef cfallocator = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    78
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    79
static CFStringRef cfallocDesc(const void *info)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    80
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
    return CFStringCreateWithCString(cfallocator, "PhysicsFS",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    82
                                     kCFStringEncodingASCII);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    83
} /* cfallocDesc */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    85
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    86
static void *cfallocMalloc(CFIndex allocSize, CFOptionFlags hint, void *info)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    87
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    88
    return allocator.Malloc(allocSize);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
} /* cfallocMalloc */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    90
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    91
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    92
static void cfallocFree(void *ptr, void *info)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    93
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    94
    allocator.Free(ptr);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    95
} /* cfallocFree */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    96
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    97
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    98
static void *cfallocRealloc(void *ptr, CFIndex newsize,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    99
                            CFOptionFlags hint, void *info)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   100
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   101
    if ((ptr == NULL) || (newsize <= 0))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   102
        return NULL;  /* ADC docs say you should always return NULL here. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   103
    return allocator.Realloc(ptr, newsize);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   104
} /* cfallocRealloc */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   105
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   106
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   107
int __PHYSFS_platformInit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   108
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   109
    /* set up a CFAllocator, so Carbon can use the physfs allocator, too. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   110
    CFAllocatorContext ctx;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   111
    memset(&ctx, '\0', sizeof (ctx));
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   112
    ctx.copyDescription = cfallocDesc;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   113
    ctx.allocate = cfallocMalloc;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   114
    ctx.reallocate = cfallocRealloc;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   115
    ctx.deallocate = cfallocFree;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   116
    cfallocator = CFAllocatorCreate(kCFAllocatorUseContext, &ctx);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   117
    BAIL_IF_MACRO(!cfallocator, PHYSFS_ERR_OUT_OF_MEMORY, 0);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   118
    return 1;  /* success. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   119
} /* __PHYSFS_platformInit */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   120
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   121
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   122
int __PHYSFS_platformDeinit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   123
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   124
    CFRelease(cfallocator);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   125
    cfallocator = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   126
    return 1;  /* always succeed. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   127
} /* __PHYSFS_platformDeinit */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   128
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   129
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   130
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   131
/* CD-ROM detection code... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   132
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   133
/*
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   134
 * Code based on sample from Apple Developer Connection:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   135
 *  http://developer.apple.com/samplecode/Sample_Code/Devices_and_Hardware/Disks/VolumeToBSDNode/VolumeToBSDNode.c.htm
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   136
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   137
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   138
#if !defined(PHYSFS_NO_CDROM_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   139
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   140
static int darwinIsWholeMedia(io_service_t service)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   141
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   142
    int retval = 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   143
    CFTypeRef wholeMedia;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   144
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   145
    if (!IOObjectConformsTo(service, kIOMediaClass))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   146
        return 0;
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 9183
diff changeset
   147
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   148
    wholeMedia = IORegistryEntryCreateCFProperty(service,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   149
                                                 CFSTR(kIOMediaWholeKey),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   150
                                                 cfallocator, 0);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   151
    if (wholeMedia == NULL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   152
        return 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   153
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   154
    retval = CFBooleanGetValue(wholeMedia);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   155
    CFRelease(wholeMedia);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   156
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   157
    return retval;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   158
} /* darwinIsWholeMedia */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   159
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   160
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   161
static int darwinIsMountedDisc(char *bsdName, mach_port_t masterPort)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   162
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   163
    int retval = 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   164
    CFMutableDictionaryRef matchingDict;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   165
    kern_return_t rc;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   166
    io_iterator_t iter;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   167
    io_service_t service;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   168
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   169
    if ((matchingDict = IOBSDNameMatching(masterPort, 0, bsdName)) == NULL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   170
        return 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   171
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   172
    rc = IOServiceGetMatchingServices(masterPort, matchingDict, &iter);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   173
    if ((rc != KERN_SUCCESS) || (!iter))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   174
        return 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   175
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   176
    service = IOIteratorNext(iter);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   177
    IOObjectRelease(iter);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   178
    if (!service)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   179
        return 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   180
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   181
    rc = IORegistryEntryCreateIterator(service, kIOServicePlane,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   182
             kIORegistryIterateRecursively | kIORegistryIterateParents, &iter);
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 9183
diff changeset
   183
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   184
    if (!iter)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   185
        return 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   186
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   187
    if (rc != KERN_SUCCESS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   188
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   189
        IOObjectRelease(iter);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   190
        return 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   191
    } /* if */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   192
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   193
    IOObjectRetain(service);  /* add an extra object reference... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   194
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   195
    do
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   196
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   197
        if (darwinIsWholeMedia(service))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   198
        {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   199
            if ( (IOObjectConformsTo(service, kIOCDMediaClass)) ||
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   200
                 (IOObjectConformsTo(service, kIODVDMediaClass)) )
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   201
            {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   202
                retval = 1;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   203
            } /* if */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   204
        } /* if */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   205
        IOObjectRelease(service);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   206
    } while ((service = IOIteratorNext(iter)) && (!retval));
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 9183
diff changeset
   207
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   208
    IOObjectRelease(iter);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   209
    IOObjectRelease(service);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   210
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   211
    return retval;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   212
} /* darwinIsMountedDisc */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   213
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   214
#endif /* !defined(PHYSFS_NO_CDROM_SUPPORT) */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   215
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   216
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   217
void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   218
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   219
#if !defined(PHYSFS_NO_CDROM_SUPPORT)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   220
    const char *devPrefix = "/dev/";
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   221
    const int prefixLen = strlen(devPrefix);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   222
    mach_port_t masterPort = 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   223
    struct statfs *mntbufp;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   224
    int i, mounts;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   225
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   226
    if (IOMasterPort(MACH_PORT_NULL, &masterPort) != KERN_SUCCESS)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   227
        BAIL_MACRO(PHYSFS_ERR_OS_ERROR, ) /*return void*/;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   228
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   229
    mounts = getmntinfo(&mntbufp, MNT_WAIT);  /* NOT THREAD SAFE! */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   230
    for (i = 0; i < mounts; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   231
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   232
        char *dev = mntbufp[i].f_mntfromname;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   233
        char *mnt = mntbufp[i].f_mntonname;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   234
        if (strncmp(dev, devPrefix, prefixLen) != 0)  /* a virtual device? */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   235
            continue;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   236
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   237
        dev += prefixLen;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   238
        if (darwinIsMountedDisc(dev, masterPort))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   239
            cb(data, mnt);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   240
    } /* for */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   241
#endif /* !defined(PHYSFS_NO_CDROM_SUPPORT) */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   242
} /* __PHYSFS_platformDetectAvailableCDs */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   243
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   244
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   245
static char *convertCFString(CFStringRef cfstr)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   246
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   247
    CFIndex len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfstr),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   248
                                                    kCFStringEncodingUTF8) + 1;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   249
    char *retval = (char *) allocator.Malloc(len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   250
    BAIL_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   251
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   252
    if (CFStringGetCString(cfstr, retval, len, kCFStringEncodingUTF8))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   253
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   254
        /* shrink overallocated buffer if possible... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   255
        CFIndex newlen = strlen(retval) + 1;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   256
        if (newlen < len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   257
        {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   258
            void *ptr = allocator.Realloc(retval, newlen);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   259
            if (ptr != NULL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   260
                retval = (char *) ptr;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   261
        } /* if */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   262
    } /* if */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   263
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   264
    else  /* probably shouldn't fail, but just in case... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   265
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   266
        allocator.Free(retval);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   267
        BAIL_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   268
    } /* else */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   269
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   270
    return retval;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   271
} /* convertCFString */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   272
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   273
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   274
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   275
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   276
    CFURLRef cfurl = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   277
    CFStringRef cfstr = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   278
    CFMutableStringRef cfmutstr = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   279
    char *retval = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   280
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   281
    cfurl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   282
    BAIL_IF_MACRO(cfurl == NULL, PHYSFS_ERR_OS_ERROR, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   283
    cfstr = CFURLCopyFileSystemPath(cfurl, kCFURLPOSIXPathStyle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   284
    CFRelease(cfurl);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   285
    BAIL_IF_MACRO(!cfstr, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   286
    cfmutstr = CFStringCreateMutableCopy(cfallocator, 0, cfstr);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   287
    CFRelease(cfstr);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   288
    BAIL_IF_MACRO(!cfmutstr, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   289
    CFStringAppendCString(cfmutstr, "/", kCFStringEncodingUTF8);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   290
    retval = convertCFString(cfmutstr);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   291
    CFRelease(cfmutstr);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   292
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   293
    return retval;  /* whew. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   294
} /* __PHYSFS_platformCalcBaseDir */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   295
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   296
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   297
char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   298
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   299
    /* !!! FIXME: there's a real API to determine this */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   300
    const char *userdir = __PHYSFS_getUserDir();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   301
    const char *append = "Library/Application Support/";
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   302
    const size_t len = strlen(userdir) + strlen(append) + strlen(app) + 2;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   303
    char *retval = allocator.Malloc(len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   304
    BAIL_IF_MACRO(!retval, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   305
    snprintf(retval, len, "%s%s%s/", userdir, append, app);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   306
    return retval;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   307
} /* __PHYSFS_platformCalcPrefDir */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   308
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   309
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   310
/* Platform allocator uses default CFAllocator at PHYSFS_init() time. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   311
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   312
static CFAllocatorRef cfallocdef = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   313
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   314
static int macosxAllocatorInit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   315
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   316
    int retval = 0;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   317
    cfallocdef = CFAllocatorGetDefault();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   318
    retval = (cfallocdef != NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   319
    if (retval)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   320
        CFRetain(cfallocdef);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   321
    return retval;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   322
} /* macosxAllocatorInit */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   323
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   324
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   325
static void macosxAllocatorDeinit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   326
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   327
    if (cfallocdef != NULL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   328
    {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   329
        CFRelease(cfallocdef);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   330
        cfallocdef = NULL;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   331
    } /* if */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   332
} /* macosxAllocatorDeinit */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   333
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   334
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   335
static void *macosxAllocatorMalloc(PHYSFS_uint64 s)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   336
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   337
    if (!__PHYSFS_ui64FitsAddressSpace(s))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   338
        BAIL_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   339
    return CFAllocatorAllocate(cfallocdef, (CFIndex) s, 0);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   340
} /* macosxAllocatorMalloc */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   341
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   342
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   343
static void *macosxAllocatorRealloc(void *ptr, PHYSFS_uint64 s)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   344
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   345
    if (!__PHYSFS_ui64FitsAddressSpace(s))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   346
        BAIL_MACRO(PHYSFS_ERR_OUT_OF_MEMORY, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   347
    return CFAllocatorReallocate(cfallocdef, ptr, (CFIndex) s, 0);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   348
} /* macosxAllocatorRealloc */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   349
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   350
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   351
static void macosxAllocatorFree(void *ptr)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   352
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   353
    CFAllocatorDeallocate(cfallocdef, ptr);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   354
} /* macosxAllocatorFree */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   355
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   356
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   357
int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   358
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   359
    allocator.Init = macosxAllocatorInit;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   360
    allocator.Deinit = macosxAllocatorDeinit;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   361
    allocator.Malloc = macosxAllocatorMalloc;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   362
    allocator.Realloc = macosxAllocatorRealloc;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   363
    allocator.Free = macosxAllocatorFree;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   364
    return 1;  /* return non-zero: we're supplying custom allocator. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   365
} /* __PHYSFS_platformSetDefaultAllocator */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   366
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   367
#endif /* PHYSFS_PLATFORM_MACOSX */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   368
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   369
/* end of macosx.c ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   370