author | koda |
Sun, 17 Mar 2013 01:26:40 +0100 | |
changeset 8739 | bbab7e35eaf2 |
parent 8524 | a65e9bcf0a03 |
child 9991 | 3858d99476f5 |
permissions | -rw-r--r-- |
8074
768427321cab
thou shall not use system headers for crossplatformness
koda
parents:
8073
diff
changeset
|
1 |
#include "lua.h" |
768427321cab
thou shall not use system headers for crossplatformness
koda
parents:
8073
diff
changeset
|
2 |
#include "physfs.h" |
8034 | 3 |
|
4 |
#define BUFSIZE 1024 |
|
5 |
||
8073 | 6 |
void *physfsReaderBuffer; |
8034 | 7 |
|
8119
257ffa847aa2
physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents:
8074
diff
changeset
|
8 |
PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size) |
8034 | 9 |
{ |
10 |
||
11 |
if(PHYSFS_eof(f)) |
|
12 |
{ |
|
13 |
return NULL; |
|
14 |
} |
|
15 |
else |
|
16 |
{ |
|
17 |
*size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE); |
|
18 |
||
19 |
if(*size == 0) |
|
20 |
return NULL; |
|
21 |
else |
|
22 |
return physfsReaderBuffer; |
|
23 |
} |
|
24 |
} |
|
8073 | 25 |
|
8119
257ffa847aa2
physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents:
8074
diff
changeset
|
26 |
PHYSFS_DECL void physfsReaderSetBuffer(void *buffer) |
8073 | 27 |
{ |
28 |
physfsReaderBuffer = buffer; |
|
8074
768427321cab
thou shall not use system headers for crossplatformness
koda
parents:
8073
diff
changeset
|
29 |
} |
768427321cab
thou shall not use system headers for crossplatformness
koda
parents:
8073
diff
changeset
|
30 |