Added an API to get the size of a file - WARNING! ABI CHANGE!
This commit is contained in:
parent
732a5d8165
commit
9bd6a89040
7 changed files with 102 additions and 38 deletions
|
@ -139,6 +139,8 @@
|
|||
#undef HAVE_SIN
|
||||
#undef HAVE_SINF
|
||||
#undef HAVE_SQRT
|
||||
#undef HAVE_FSEEKO
|
||||
#undef HAVE_FSEEKO64
|
||||
#undef HAVE_SIGACTION
|
||||
#undef HAVE_SA_SIGACTION
|
||||
#undef HAVE_SETJMP
|
||||
|
|
|
@ -45,14 +45,19 @@ extern "C" {
|
|||
*/
|
||||
typedef struct SDL_RWops
|
||||
{
|
||||
/**
|
||||
* Return the size of the file in this rwops, or -1 if unknown
|
||||
*/
|
||||
Sint64 (SDLCALL * size) (struct SDL_RWops * context);
|
||||
|
||||
/**
|
||||
* Seek to \c offset relative to \c whence, one of stdio's whence values:
|
||||
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
|
||||
*
|
||||
* \return the final offset in the data stream.
|
||||
*/
|
||||
long (SDLCALL * seek) (struct SDL_RWops * context, long offset,
|
||||
int whence);
|
||||
Sint64 (SDLCALL * seek) (struct SDL_RWops * context, Sint64 offset,
|
||||
int whence);
|
||||
|
||||
/**
|
||||
* Read up to \c maxnum objects each of size \c size from the data
|
||||
|
@ -60,8 +65,8 @@ typedef struct SDL_RWops
|
|||
*
|
||||
* \return the number of objects read, or 0 at error or end of file.
|
||||
*/
|
||||
size_t(SDLCALL * read) (struct SDL_RWops * context, void *ptr,
|
||||
size_t size, size_t maxnum);
|
||||
size_t (SDLCALL * read) (struct SDL_RWops * context, void *ptr,
|
||||
size_t size, size_t maxnum);
|
||||
|
||||
/**
|
||||
* Write exactly \c num objects each of size \c size from the area
|
||||
|
@ -69,8 +74,8 @@ typedef struct SDL_RWops
|
|||
*
|
||||
* \return the number of objects written, or 0 at error or end of file.
|
||||
*/
|
||||
size_t(SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
|
||||
size_t size, size_t num);
|
||||
size_t (SDLCALL * write) (struct SDL_RWops * context, const void *ptr,
|
||||
size_t size, size_t num);
|
||||
|
||||
/**
|
||||
* Close and free an allocated SDL_RWops structure.
|
||||
|
@ -166,6 +171,7 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
|
|||
* Macros to easily read and write from an SDL_RWops structure.
|
||||
*/
|
||||
/*@{*/
|
||||
#define SDL_RWsize(ctx) (ctx)->size(ctx)
|
||||
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
|
||||
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
|
||||
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue