Skip to content
Permalink
Browse files
Changed PHYSFS_file to PHYSFS_File to match rest of API's naming
convention. This won't break binary compat (function signatures are
extern "C" so name mangling doesn't apply), and I've placed a typedef
for the old name to support legacy source code.
  • Loading branch information
icculus committed Sep 26, 2004
1 parent 221a230 commit 8641e4e7efb644a994315f538b215f32f97ecc0c
@@ -92,7 +92,7 @@ from the Author.
#ifdef USE_PHYSFS

#include <physfs.h>
#define MY_FILETYPE PHYSFS_file
#define MY_FILETYPE PHYSFS_File
#define MY_SETBUFFER(fp,size) PHYSFS_setBuffer(fp,size)
#define MY_READ(p,s,n,fp) PHYSFS_read(fp,p,s,n)
#if PHYSFS_DEFAULT_READ_BUFFER
@@ -116,7 +116,7 @@ int main(int argc, char **argv)
{
int rc;
char buf[128];
PHYSFS_file *f;
PHYSFS_File *f;

if (!PHYSFS_init(argv[0]))
{
@@ -24,7 +24,7 @@

static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
int pos = 0;

if (whence == SEEK_SET)
@@ -98,7 +98,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)

static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
if (rc != maxnum)
{
@@ -112,7 +112,7 @@ static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)

static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
if (rc != num)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
@@ -123,7 +123,7 @@ static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)

static int physfsrwops_close(SDL_RWops *rw)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
if (!PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
@@ -135,7 +135,7 @@ static int physfsrwops_close(SDL_RWops *rw)
} /* physfsrwops_close */


static SDL_RWops *create_rwops(PHYSFS_file *handle)
static SDL_RWops *create_rwops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;

@@ -158,7 +158,7 @@ static SDL_RWops *create_rwops(PHYSFS_file *handle)
} /* create_rwops */


SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;
if (handle == NULL)
@@ -369,7 +369,7 @@ VALUE physfs_last_mod_time (VALUE self, VALUE name)
*/
VALUE physfs_open_read (VALUE self, VALUE name)
{
PHYSFS_file *file = PHYSFS_openRead (STR2CSTR(name));
PHYSFS_File *file = PHYSFS_openRead (STR2CSTR(name));
return physfs_file_new (file);
}

@@ -380,7 +380,7 @@ VALUE physfs_open_read (VALUE self, VALUE name)
*/
VALUE physfs_open_write (VALUE self, VALUE name)
{
PHYSFS_file *file = PHYSFS_openWrite (STR2CSTR(name));
PHYSFS_File *file = PHYSFS_openWrite (STR2CSTR(name));
return physfs_file_new (file);
}

@@ -391,7 +391,7 @@ VALUE physfs_open_write (VALUE self, VALUE name)
*/
VALUE physfs_open_append (VALUE self, VALUE name)
{
PHYSFS_file *file = PHYSFS_openAppend (STR2CSTR(name));
PHYSFS_File *file = PHYSFS_openAppend (STR2CSTR(name));
return physfs_file_new (file);
}

@@ -17,7 +17,7 @@ VALUE classPhysfsFile;
/*
* construct new PhysicsFS::File object
*/
VALUE physfs_file_new (PHYSFS_file *file)
VALUE physfs_file_new (PHYSFS_File *file)
{
if (file == 0)
return Qnil;
@@ -33,8 +33,8 @@ VALUE physfs_file_new (PHYSFS_file *file)
VALUE physfs_file_close (VALUE self)
{
int result;
PHYSFS_file *file;
Data_Get_Struct (self, PHYSFS_file, file);
PHYSFS_File *file;
Data_Get_Struct (self, PHYSFS_File, file);

if (file == 0)
return Qfalse;
@@ -59,9 +59,9 @@ VALUE physfs_file_read (VALUE self, VALUE objSize, VALUE objCount)
int objRead;
void *buffer;
VALUE result;
PHYSFS_file *file;
PHYSFS_File *file;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil; //wasted file - no read possible

@@ -89,9 +89,9 @@ VALUE physfs_file_read (VALUE self, VALUE objSize, VALUE objCount)
VALUE physfs_file_write (VALUE self, VALUE buf, VALUE objSize, VALUE objCount)
{
int result;
PHYSFS_file *file;
PHYSFS_File *file;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;

@@ -109,9 +109,9 @@ VALUE physfs_file_write (VALUE self, VALUE buf, VALUE objSize, VALUE objCount)
VALUE physfs_file_eof (VALUE self)
{
int result;
PHYSFS_file *file;
PHYSFS_File *file;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;

@@ -131,9 +131,9 @@ VALUE physfs_file_eof (VALUE self)
VALUE physfs_file_tell (VALUE self)
{
int result;
PHYSFS_file *file;
PHYSFS_File *file;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;

@@ -153,9 +153,9 @@ VALUE physfs_file_tell (VALUE self)
VALUE physfs_file_seek (VALUE self, VALUE pos)
{
int result;
PHYSFS_file *file;
PHYSFS_File *file;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;

@@ -173,9 +173,9 @@ VALUE physfs_file_seek (VALUE self, VALUE pos)
VALUE physfs_file_length (VALUE self)
{
int result;
PHYSFS_file *file;
PHYSFS_File *file;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;

@@ -196,10 +196,10 @@ VALUE physfs_file_length (VALUE self)
*/
VALUE physfs_file_to_rwops (VALUE self)
{
PHYSFS_file *file;
PHYSFS_File *file;
SDL_RWops *rwops;

Data_Get_Struct (self, PHYSFS_file, file);
Data_Get_Struct (self, PHYSFS_File, file);
if (file == 0)
return Qnil;

@@ -75,7 +75,7 @@ static char *txt404 =

static void feed_file_http(const char *ipstr, int sock, const char *fname)
{
PHYSFS_file *in = PHYSFS_openRead(fname);
PHYSFS_File *in = PHYSFS_openRead(fname);
char buffer[1024];
printf("%s: requested [%s].\n", ipstr, fname);
if (in == NULL)
@@ -25,7 +25,7 @@

static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
int pos = 0;

if (whence == SEEK_SET)
@@ -99,7 +99,7 @@ static int physfsrwops_seek(SDL_RWops *rw, int offset, int whence)

static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_read(handle, ptr, size, maxnum);
if (rc != maxnum)
{
@@ -113,7 +113,7 @@ static int physfsrwops_read(SDL_RWops *rw, void *ptr, int size, int maxnum)

static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
PHYSFS_sint64 rc = PHYSFS_write(handle, ptr, size, num);
if (rc != num)
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
@@ -124,7 +124,7 @@ static int physfsrwops_write(SDL_RWops *rw, const void *ptr, int size, int num)

static int physfsrwops_close(SDL_RWops *rw)
{
PHYSFS_file *handle = (PHYSFS_file *) rw->hidden.unknown.data1;
PHYSFS_File *handle = (PHYSFS_File *) rw->hidden.unknown.data1;
if (!PHYSFS_close(handle))
{
SDL_SetError("PhysicsFS error: %s", PHYSFS_getLastError());
@@ -136,7 +136,7 @@ static int physfsrwops_close(SDL_RWops *rw)
} /* physfsrwops_close */


static SDL_RWops *create_rwops(PHYSFS_file *handle)
static SDL_RWops *create_rwops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;

@@ -159,7 +159,7 @@ static SDL_RWops *create_rwops(PHYSFS_file *handle)
} /* create_rwops */


SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle)
SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle)
{
SDL_RWops *retval = NULL;
if (handle == NULL)
@@ -76,7 +76,7 @@ __EXPORT__ SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
* of the error can be gleaned from PHYSFS_getLastError().
*/
__EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_file *handle);
__EXPORT__ SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);

#ifdef __cplusplus
}

0 comments on commit 8641e4e

Please sign in to comment.