author | Wuzzy <Wuzzy2@mail.ru> |
Sat, 08 Dec 2018 14:02:25 +0100 | |
changeset 14377 | b251aa50c0d3 |
parent 13537 | ecdf6ce2301e |
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 |
|
9991 | 4 |
#include "physfscompat.h" |
5 |
||
8034 | 6 |
#define BUFSIZE 1024 |
13537
ecdf6ce2301e
Fix warnings about unused params in C code
Wuzzy <Wuzzy2@mail.ru>
parents:
9991
diff
changeset
|
7 |
#define UNUSED(x) (void)(x) |
8034 | 8 |
|
8073 | 9 |
void *physfsReaderBuffer; |
8034 | 10 |
|
8119
257ffa847aa2
physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents:
8074
diff
changeset
|
11 |
PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size) |
8034 | 12 |
{ |
13537
ecdf6ce2301e
Fix warnings about unused params in C code
Wuzzy <Wuzzy2@mail.ru>
parents:
9991
diff
changeset
|
13 |
UNUSED(L); |
8034 | 14 |
|
15 |
if(PHYSFS_eof(f)) |
|
16 |
{ |
|
17 |
return NULL; |
|
18 |
} |
|
19 |
else |
|
20 |
{ |
|
21 |
*size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE); |
|
22 |
||
23 |
if(*size == 0) |
|
24 |
return NULL; |
|
25 |
else |
|
26 |
return physfsReaderBuffer; |
|
27 |
} |
|
28 |
} |
|
8073 | 29 |
|
8119
257ffa847aa2
physfs: no carbon depency on osx, add cdecl attributes on extra functions
koda
parents:
8074
diff
changeset
|
30 |
PHYSFS_DECL void physfsReaderSetBuffer(void *buffer) |
8073 | 31 |
{ |
32 |
physfsReaderBuffer = buffer; |
|
8074
768427321cab
thou shall not use system headers for crossplatformness
koda
parents:
8073
diff
changeset
|
33 |
} |
768427321cab
thou shall not use system headers for crossplatformness
koda
parents:
8073
diff
changeset
|
34 |