Add binary compatibility to PHYSFS_Io.
This commit is contained in:
parent
a7383c295f
commit
6222a4a92d
|
@ -526,6 +526,7 @@ static PHYSFS_sint64 ISO9660_length(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io ISO9660_Io =
|
static const PHYSFS_Io ISO9660_Io =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
ISO9660_read,
|
ISO9660_read,
|
||||||
ISO9660_write,
|
ISO9660_write,
|
||||||
ISO9660_seek,
|
ISO9660_seek,
|
||||||
|
@ -533,8 +534,7 @@ static const PHYSFS_Io ISO9660_Io =
|
||||||
ISO9660_length,
|
ISO9660_length,
|
||||||
ISO9660_duplicate,
|
ISO9660_duplicate,
|
||||||
ISO9660_flush,
|
ISO9660_flush,
|
||||||
ISO9660_destroy,
|
ISO9660_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -427,6 +427,7 @@ static void LZMA_destroy(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io LZMA_Io =
|
static const PHYSFS_Io LZMA_Io =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
LZMA_read,
|
LZMA_read,
|
||||||
LZMA_write,
|
LZMA_write,
|
||||||
LZMA_seek,
|
LZMA_seek,
|
||||||
|
@ -434,8 +435,7 @@ static const PHYSFS_Io LZMA_Io =
|
||||||
LZMA_length,
|
LZMA_length,
|
||||||
LZMA_duplicate,
|
LZMA_duplicate,
|
||||||
LZMA_flush,
|
LZMA_flush,
|
||||||
LZMA_destroy,
|
LZMA_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ static void UNPK_destroy(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io UNPK_Io =
|
static const PHYSFS_Io UNPK_Io =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
UNPK_read,
|
UNPK_read,
|
||||||
UNPK_write,
|
UNPK_write,
|
||||||
UNPK_seek,
|
UNPK_seek,
|
||||||
|
@ -140,8 +141,7 @@ static const PHYSFS_Io UNPK_Io =
|
||||||
UNPK_length,
|
UNPK_length,
|
||||||
UNPK_duplicate,
|
UNPK_duplicate,
|
||||||
UNPK_flush,
|
UNPK_flush,
|
||||||
UNPK_destroy,
|
UNPK_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -394,6 +394,7 @@ static void ZIP_destroy(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io ZIP_Io =
|
static const PHYSFS_Io ZIP_Io =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
ZIP_read,
|
ZIP_read,
|
||||||
ZIP_write,
|
ZIP_write,
|
||||||
ZIP_seek,
|
ZIP_seek,
|
||||||
|
@ -401,8 +402,7 @@ static const PHYSFS_Io ZIP_Io =
|
||||||
ZIP_length,
|
ZIP_length,
|
||||||
ZIP_duplicate,
|
ZIP_duplicate,
|
||||||
ZIP_flush,
|
ZIP_flush,
|
||||||
ZIP_destroy,
|
ZIP_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
13
src/physfs.c
13
src/physfs.c
|
@ -174,6 +174,7 @@ static void nativeIo_destroy(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io __PHYSFS_nativeIoInterface =
|
static const PHYSFS_Io __PHYSFS_nativeIoInterface =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
nativeIo_read,
|
nativeIo_read,
|
||||||
nativeIo_write,
|
nativeIo_write,
|
||||||
nativeIo_seek,
|
nativeIo_seek,
|
||||||
|
@ -181,8 +182,7 @@ static const PHYSFS_Io __PHYSFS_nativeIoInterface =
|
||||||
nativeIo_length,
|
nativeIo_length,
|
||||||
nativeIo_duplicate,
|
nativeIo_duplicate,
|
||||||
nativeIo_flush,
|
nativeIo_flush,
|
||||||
nativeIo_destroy,
|
nativeIo_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PHYSFS_Io *__PHYSFS_createNativeIo(const char *path, const int mode)
|
PHYSFS_Io *__PHYSFS_createNativeIo(const char *path, const int mode)
|
||||||
|
@ -369,6 +369,7 @@ static void memoryIo_destroy(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io __PHYSFS_memoryIoInterface =
|
static const PHYSFS_Io __PHYSFS_memoryIoInterface =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
memoryIo_read,
|
memoryIo_read,
|
||||||
memoryIo_write,
|
memoryIo_write,
|
||||||
memoryIo_seek,
|
memoryIo_seek,
|
||||||
|
@ -376,8 +377,7 @@ static const PHYSFS_Io __PHYSFS_memoryIoInterface =
|
||||||
memoryIo_length,
|
memoryIo_length,
|
||||||
memoryIo_duplicate,
|
memoryIo_duplicate,
|
||||||
memoryIo_flush,
|
memoryIo_flush,
|
||||||
memoryIo_destroy,
|
memoryIo_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PHYSFS_Io *__PHYSFS_createMemoryIo(const void *buf, PHYSFS_uint64 len,
|
PHYSFS_Io *__PHYSFS_createMemoryIo(const void *buf, PHYSFS_uint64 len,
|
||||||
|
@ -512,6 +512,7 @@ static void handleIo_destroy(PHYSFS_Io *io)
|
||||||
|
|
||||||
static const PHYSFS_Io __PHYSFS_handleIoInterface =
|
static const PHYSFS_Io __PHYSFS_handleIoInterface =
|
||||||
{
|
{
|
||||||
|
CURRENT_PHYSFS_IO_API_VERSION, NULL,
|
||||||
handleIo_read,
|
handleIo_read,
|
||||||
handleIo_write,
|
handleIo_write,
|
||||||
handleIo_seek,
|
handleIo_seek,
|
||||||
|
@ -519,8 +520,7 @@ static const PHYSFS_Io __PHYSFS_handleIoInterface =
|
||||||
handleIo_length,
|
handleIo_length,
|
||||||
handleIo_duplicate,
|
handleIo_duplicate,
|
||||||
handleIo_flush,
|
handleIo_flush,
|
||||||
handleIo_destroy,
|
handleIo_destroy
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static PHYSFS_Io *__PHYSFS_createHandleIo(PHYSFS_File *f)
|
static PHYSFS_Io *__PHYSFS_createHandleIo(PHYSFS_File *f)
|
||||||
|
@ -1494,6 +1494,7 @@ int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname,
|
||||||
const char *mountPoint, int appendToPath)
|
const char *mountPoint, int appendToPath)
|
||||||
{
|
{
|
||||||
BAIL_IF_MACRO(!io, PHYSFS_ERR_INVALID_ARGUMENT, 0);
|
BAIL_IF_MACRO(!io, PHYSFS_ERR_INVALID_ARGUMENT, 0);
|
||||||
|
BAIL_IF_MACRO(io->version != 0, PHYSFS_ERR_UNSUPPORTED, 0);
|
||||||
return doMount(io, fname, mountPoint, appendToPath);
|
return doMount(io, fname, mountPoint, appendToPath);
|
||||||
} /* PHYSFS_mountIo */
|
} /* PHYSFS_mountIo */
|
||||||
|
|
||||||
|
|
30
src/physfs.h
30
src/physfs.h
|
@ -2809,6 +2809,26 @@ PHYSFS_DECL PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle,
|
||||||
*/
|
*/
|
||||||
typedef struct PHYSFS_Io
|
typedef struct PHYSFS_Io
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* \brief Binary compatibility information.
|
||||||
|
*
|
||||||
|
* This must be set to zero at this time. Future versions of this
|
||||||
|
* struct will increment this field, so we know what a given
|
||||||
|
* implementation supports. We'll presumably keep supporting older
|
||||||
|
* versions as we offer new features, though.
|
||||||
|
*/
|
||||||
|
PHYSFS_uint32 version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Instance data for this struct.
|
||||||
|
*
|
||||||
|
* Each instance has a pointer associated with it that can be used to
|
||||||
|
* store anything it likes. This pointer is per-instance of the stream,
|
||||||
|
* so presumably it will change when calling duplicate(). This can be
|
||||||
|
* deallocated during the destroy() method.
|
||||||
|
*/
|
||||||
|
void *opaque;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Read more data.
|
* \brief Read more data.
|
||||||
*
|
*
|
||||||
|
@ -2936,16 +2956,6 @@ typedef struct PHYSFS_Io
|
||||||
* \param s The i/o instance to destroy.
|
* \param s The i/o instance to destroy.
|
||||||
*/
|
*/
|
||||||
void (*destroy)(struct PHYSFS_Io *io);
|
void (*destroy)(struct PHYSFS_Io *io);
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Instance data for this struct.
|
|
||||||
*
|
|
||||||
* Each instance has a pointer associated with it that can be used to
|
|
||||||
* store anything it likes. This pointer is per-instance of the stream,
|
|
||||||
* so presumably it will change when calling duplicate(). This can be
|
|
||||||
* deallocated during the destroy() method.
|
|
||||||
*/
|
|
||||||
void *opaque;
|
|
||||||
} PHYSFS_Io;
|
} PHYSFS_Io;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,8 @@ void __PHYSFS_smallFree(void *ptr);
|
||||||
#define PHYSFS_SUPPORTS_ISO9660 0
|
#define PHYSFS_SUPPORTS_ISO9660 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The latest supported PHYSFS_Io::version value. */
|
||||||
|
#define CURRENT_PHYSFS_IO_API_VERSION 0
|
||||||
|
|
||||||
/* Opaque data for file and dir handlers... */
|
/* Opaque data for file and dir handlers... */
|
||||||
typedef void PHYSFS_Dir;
|
typedef void PHYSFS_Dir;
|
||||||
|
|
Loading…
Reference in New Issue