Skip to content

Commit

Permalink
Changed PHYSFS_file to PHYSFS_File to match rest of API's naming
Browse files Browse the repository at this point in the history
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 8641e4e
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 156 deletions.
2 changes: 1 addition & 1 deletion extras/abs-file.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion extras/ignorecase.c
Expand Up @@ -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]))
{
Expand Down
12 changes: 6 additions & 6 deletions extras/physfs_rb/physfs/physfsrwops.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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;

Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions extras/physfs_rb/physfs/rb_physfs.c
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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);
}

Expand Down
34 changes: 17 additions & 17 deletions extras/physfs_rb/physfs/rb_physfs_file.c
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion extras/physfshttpd.c
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions extras/physfsrwops.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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;

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion extras/physfsrwops.h
Expand Up @@ -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
}
Expand Down

0 comments on commit 8641e4e

Please sign in to comment.