X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=file.c;h=fe6167f3a979d33533bb757f9e4eff713f7f20da;hb=8c6f4c3fc3145e3e4de798dd6826c1414d899f4f;hp=2bbd81f89cc03705a18377b0dcb27eef9fdaf331;hpb=6bc29a1601b6326dad807ac4f1d6db9e37adb3b6;p=xonotic%2Fgmqcc.git diff --git a/file.c b/file.c index 2bbd81f..fe6167f 100644 --- a/file.c +++ b/file.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2012 - * Wolfgang Bumiller + * Copyright (C) 2012, 2013 * Dale Weiler * * Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -79,7 +78,7 @@ FILE *handle = NULL; file_init(); - return ((fopen_s(&handle, filename, mode) != 0) ? NULL : handle; + return (fopen_s(&handle, filename, mode) != 0) ? NULL : handle; } size_t file_read(void *buffer, size_t size, size_t count, FILE *fp) { @@ -131,12 +130,12 @@ * These are implemented as just generic wrappers to keep consistency in * the API. Not as macros though */ -void GMQCC_INLINE file_close(FILE *fp) { +void file_close(FILE *fp) { /* Invokes file_exception on windows if fp is null */ fclose (fp); } -size_t GMQCC_INLINE file_write ( +size_t file_write ( const void *buffer, size_t size, size_t count, @@ -146,26 +145,31 @@ size_t GMQCC_INLINE file_write ( return fwrite(buffer, size, count, fp); } -int GMQCC_INLINE file_error(FILE *fp) { +int file_error(FILE *fp) { /* Invokes file_exception on windows if fp is null */ return ferror(fp); } -int GMQCC_INLINE file_getc(FILE *fp) { +int file_getc(FILE *fp) { /* Invokes file_exception on windows if fp is null */ return fgetc(fp); } -int GMQCC_INLINE file_puts(FILE *fp, const char *str) { +int file_puts(FILE *fp, const char *str) { /* Invokes file_exception on windows if fp is null */ return fputs(str, fp); } -int GMQCC_INLINE file_seek(FILE *fp, long int off, int whence) { +int file_seek(FILE *fp, long int off, int whence) { /* Invokes file_exception on windows if fp is null */ return fseek(fp, off, whence); } +int file_putc(FILE *fp, int ch) { + /* Invokes file_exception on windows if fp is null */ + return fputc(ch, fp); +} + /* * Implements libc getline for systems that don't have it, which is * assmed all. This works the same as getline().