Skip to content

Commit

Permalink
Cleaned up what symbols are exported from the library.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jul 12, 2017
1 parent 2cb1f73 commit 19b15d3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -25,7 +25,7 @@ endif()
include_directories(./src)

if(APPLE)
set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-fno-common -framework CoreFoundation -framework IOKit")
set(OTHER_LDFLAGS ${OTHER_LDFLAGS} "-framework CoreFoundation -framework IOKit")
endif()

if(CMAKE_COMPILER_IS_GNUCC)
Expand Down
4 changes: 2 additions & 2 deletions src/archiver_vdf.c
Expand Up @@ -25,8 +25,8 @@
#define VDF_CRC16 0x8005
#define VDF_HASHTABLE_SIZE 65536

const char* VDF_SIGNATURE_G1 = "PSVDSC_V2.00\r\n\r\n";
const char* VDF_SIGNATURE_G2 = "PSVDSC_V2.00\n\r\n\r";
static const char* VDF_SIGNATURE_G1 = "PSVDSC_V2.00\r\n\r\n";
static const char* VDF_SIGNATURE_G2 = "PSVDSC_V2.00\n\r\n\r";

typedef union
{
Expand Down
1 change: 0 additions & 1 deletion src/physfs.c
Expand Up @@ -1123,7 +1123,6 @@ static int doRegisterArchiver(const PHYSFS_Archiver *_archiver);
static int initStaticArchivers(void)
{
#define REGISTER_STATIC_ARCHIVER(arc) { \
extern const PHYSFS_Archiver __PHYSFS_Archiver_##arc; \
if (!doRegisterArchiver(&__PHYSFS_Archiver_##arc)) { \
return 0; \
} \
Expand Down
38 changes: 31 additions & 7 deletions src/physfs_internal.h
Expand Up @@ -14,13 +14,6 @@
#error Do not include this header from your applications.
#endif

/* Make sure everything that includes this header exports no symbols by
default. physfs.h uses function attributes to mark only the public API as
visible. */
#if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)
#pragma GCC visibility push(hidden)
#endif

/* Turn off MSVC warnings that are aggressively anti-portability. */
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS 1
Expand Down Expand Up @@ -69,6 +62,33 @@ extern "C" {
#define _FILE_OFFSET_BITS 64
#endif

/* All public APIs need to be in physfs.h with a PHYSFS_DECL.
All file-private symbols need to be marked "static".
Everything shared between PhysicsFS sources needs to be in this
file between the visibility pragma blocks. */
#if PHYSFS_MINIMUM_GCC_VERSION(4,0) || defined(__clang__)
#define PHYSFS_HAVE_PRAGMA_VISIBILITY 1
#endif

#if PHYSFS_HAVE_PRAGMA_VISIBILITY
#pragma GCC visibility push(hidden)
#endif

/* These are the build-in archivers. We list them all as "extern" here without
#ifdefs to keep it tidy, but obviously you need to make sure these are
wrapped in PHYSFS_SUPPORTS_* checks before actually referencing them. */
extern const PHYSFS_Archiver __PHYSFS_Archiver_DIR;
extern const PHYSFS_Archiver __PHYSFS_Archiver_ZIP;
extern const PHYSFS_Archiver __PHYSFS_Archiver_LZMA;
extern const PHYSFS_Archiver __PHYSFS_Archiver_GRP;
extern const PHYSFS_Archiver __PHYSFS_Archiver_QPAK;
extern const PHYSFS_Archiver __PHYSFS_Archiver_HOG;
extern const PHYSFS_Archiver __PHYSFS_Archiver_MVL;
extern const PHYSFS_Archiver __PHYSFS_Archiver_WAD;
extern const PHYSFS_Archiver __PHYSFS_Archiver_SLB;
extern const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660;
extern const PHYSFS_Archiver __PHYSFS_Archiver_VDF;

/* a real C99-compliant snprintf() is in Visual Studio 2015,
but just use this everywhere for binary compatibility. */
#if defined(_MSC_VER)
Expand Down Expand Up @@ -655,6 +675,10 @@ int __PHYSFS_platformGrabMutex(void *mutex);
*/
void __PHYSFS_platformReleaseMutex(void *mutex);

#if PHYSFS_HAVE_PRAGMA_VISIBILITY
#pragma GCC visibility pop
#endif

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 19b15d3

Please sign in to comment.