X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=fs.c;h=55e4edced16558d92eb1a69a098826b465247d96;hb=d8b3faa8711d172ee66f8c6e30f154dc7de4646d;hp=c91805e52af160eeff680a7cad82302ab8816c41;hpb=033cf7c7d397c3fdc23a1448b0068000219efef6;p=xonotic%2Fgmqcc.git diff --git a/fs.c b/fs.c index c91805e..55e4edc 100644 --- a/fs.c +++ b/fs.c @@ -20,6 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#define GMQCC_PLATFORM_HEADER #include "gmqcc.h" #include "platform.h" @@ -59,7 +60,8 @@ int fs_file_error(fs_file_t *fp) { } int fs_file_getc(fs_file_t *fp) { - return platform_fgetc((FILE*)fp); + int get = platform_fgetc((FILE*)fp); + return (get == EOF) ? FS_FILE_EOF : get; } int fs_file_puts(fs_file_t *fp, const char *str) { @@ -67,6 +69,11 @@ int fs_file_puts(fs_file_t *fp, const char *str) { } int fs_file_seek(fs_file_t *fp, long int off, int whence) { + switch(whence) { + case FS_FILE_SEEK_CUR: whence = SEEK_CUR; break; + case FS_FILE_SEEK_SET: whence = SEEK_SET; break; + case FS_FILE_SEEK_END: whence = SEEK_END; break; + } return platform_fseek((FILE*)fp, off, whence); }