Navigation Menu

Skip to content

Commit

Permalink
Removed BeOS support (Haiku still supported, though!).
Browse files Browse the repository at this point in the history
Since Haiku has pthread support, dropped the BLocker code and use the pthread
code from platform_posix.c instead.
  • Loading branch information
icculus committed Jul 12, 2017
1 parent c2c1c7a commit 68ad1fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 61 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Expand Up @@ -55,10 +55,10 @@ set(LZMA_SRCS
src/lzma/C/Compress/Lzma/LzmaDecode.c
)

if(HAIKU OR BEOS)
if(HAIKU)
# We add this explicitly, since we don't want CMake to think this
# is a C++ project unless we're on BeOS/Haiku.
set(PHYSFS_BEOS_SRCS src/platform_beos.cpp)
# is a C++ project unless we're on Haiku.
set(PHYSFS_HAIKU_SRCS src/platform_beos.cpp)
find_library(BE_LIBRARY be)
find_library(ROOT_LIBRARY root)
set(OPTIONAL_LIBRARY_LIBS ${OPTIONAL_LIBRARY_LIBS} ${BE_LIBRARY} ${ROOT_LIBRARY})
Expand Down Expand Up @@ -96,7 +96,7 @@ set(PHYSFS_SRCS
src/archiver_slb.c
src/archiver_iso9660.c
src/archiver_vdf.c
${PHYSFS_BEOS_SRCS}
${PHYSFS_HAIKU_SRCS}
)


Expand Down
4 changes: 1 addition & 3 deletions src/physfs_platforms.h
Expand Up @@ -14,11 +14,9 @@

#if (defined __HAIKU__)
# define PHYSFS_PLATFORM_HAIKU 1
# define PHYSFS_PLATFORM_BEOS 1
# define PHYSFS_PLATFORM_POSIX 1
#elif ((defined __BEOS__) || (defined __beos__))
# define PHYSFS_PLATFORM_BEOS 1
# define PHYSFS_PLATFORM_POSIX 1
# error BeOS support was dropped from PhysicsFS 2.1. Sorry. Try Haiku!
#elif (defined _WIN32_WCE) || (defined _WIN64_WCE)
# error PocketPC support was dropped from PhysicsFS 2.1. Sorry.
#elif ((defined WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP)
Expand Down
50 changes: 3 additions & 47 deletions src/platform_beos.cpp
@@ -1,5 +1,5 @@
/*
* BeOS platform-dependent support routines for PhysicsFS.
* Haiku platform-dependent support routines for PhysicsFS.
*
* Please see the file LICENSE.txt in the source's root directory.
*
Expand All @@ -9,9 +9,8 @@
#define __PHYSICSFS_INTERNAL__
#include "physfs_platforms.h"

#ifdef PHYSFS_PLATFORM_BEOS

#ifdef PHYSFS_PLATFORM_HAIKU

#include <os/kernel/OS.h>
#include <os/app/Roster.h>
#include <os/storage/Volume.h>
Expand All @@ -21,19 +20,6 @@
#include <os/storage/Path.h>
#include <os/kernel/fs_info.h>
#include <os/device/scsi.h>
#include <os/support/Locker.h>
#else
#include <be/kernel/OS.h>
#include <be/app/Roster.h>
#include <be/storage/Volume.h>
#include <be/storage/VolumeRoster.h>
#include <be/storage/Directory.h>
#include <be/storage/Entry.h>
#include <be/storage/Path.h>
#include <be/kernel/fs_info.h>
#include <be/device/scsi.h>
#include <be/support/Locker.h>
#endif

#include <errno.h>
#include <unistd.h>
Expand Down Expand Up @@ -197,37 +183,7 @@ char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
return retval;
} /* __PHYSFS_platformCalcPrefDir */


void *__PHYSFS_platformGetThreadID(void)
{
return (void *) find_thread(NULL);
} /* __PHYSFS_platformGetThreadID */


void *__PHYSFS_platformCreateMutex(void)
{
return new BLocker("PhysicsFS lock", true);
} /* __PHYSFS_platformCreateMutex */


void __PHYSFS_platformDestroyMutex(void *mutex)
{
delete ((BLocker *) mutex);
} /* __PHYSFS_platformDestroyMutex */


int __PHYSFS_platformGrabMutex(void *mutex)
{
return ((BLocker *) mutex)->Lock() ? 1 : 0;
} /* __PHYSFS_platformGrabMutex */


void __PHYSFS_platformReleaseMutex(void *mutex)
{
((BLocker *) mutex)->Unlock();
} /* __PHYSFS_platformReleaseMutex */

#endif /* PHYSFS_PLATFORM_BEOS */
#endif /* PHYSFS_PLATFORM_HAIKU */

/* end of beos.cpp ... */

7 changes: 0 additions & 7 deletions src/platform_posix.c
Expand Up @@ -21,10 +21,7 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>

#ifndef PHYSFS_PLATFORM_BEOS
#include <pthread.h>
#endif

#include "physfs_internal.h"

Expand Down Expand Up @@ -340,8 +337,6 @@ int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *st)
} /* __PHYSFS_platformStat */


#ifndef PHYSFS_PLATFORM_BEOS /* BeOS has its own code in platform_beos.cpp */

typedef struct
{
pthread_mutex_t mutex;
Expand Down Expand Up @@ -418,8 +413,6 @@ void __PHYSFS_platformReleaseMutex(void *mutex)
} /* if */
} /* __PHYSFS_platformReleaseMutex */

#endif /* !PHYSFS_PLATFORM_BEOS */

#endif /* PHYSFS_PLATFORM_POSIX */

/* end of posix.c ... */
Expand Down

0 comments on commit 68ad1fa

Please sign in to comment.