mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-03-03 15:31:11 +00:00
As if you couldn't already tell from Ion Maiden, I like shitty one liners
git-svn-id: https://svn.eduke32.com/eduke32@7383 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3c0a38d47a
commit
2b3be31fa2
1 changed files with 5 additions and 19 deletions
|
@ -20,18 +20,11 @@ using buildvfs_FILE = PHYSFS_File *;
|
||||||
static inline int buildvfs_fgetc(buildvfs_FILE fp)
|
static inline int buildvfs_fgetc(buildvfs_FILE fp)
|
||||||
{
|
{
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
return buildvfs_fread(&c, 1, 1, fp) != 1 ? buildvfs_EOF : c;
|
||||||
if (buildvfs_fread(&c, 1, 1, fp) != 1)
|
|
||||||
return buildvfs_EOF;
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
static inline int buildvfs_fputc(char c, buildvfs_FILE fp)
|
static inline int buildvfs_fputc(char c, buildvfs_FILE fp)
|
||||||
{
|
{
|
||||||
if (PHYSFS_writeBytes(fp, &c, 1) != 1)
|
return PHYSFS_writeBytes(fp, &c, 1) != 1 ? buildvfs_EOF : c;
|
||||||
return buildvfs_EOF;
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
#define buildvfs_fclose(fp) PHYSFS_close(fp)
|
#define buildvfs_fclose(fp) PHYSFS_close(fp)
|
||||||
#define buildvfs_feof(fp) PHYSFS_eof(fp)
|
#define buildvfs_feof(fp) PHYSFS_eof(fp)
|
||||||
|
@ -110,9 +103,7 @@ static inline int64_t buildvfs_length(int fd)
|
||||||
return filelength(fd);
|
return filelength(fd);
|
||||||
#else
|
#else
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (fstat(fd, &st) < 0)
|
return fstat(fd, &st) < 0 ? -1 : st.st_size;
|
||||||
return -1;
|
|
||||||
return st.st_size;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,13 +134,8 @@ static inline int64_t buildvfs_flength(FILE * f)
|
||||||
#define buildvfs_exists(fn) (access((fn), F_OK) == 0)
|
#define buildvfs_exists(fn) (access((fn), F_OK) == 0)
|
||||||
static inline int buildvfs_isdir(char const *path)
|
static inline int buildvfs_isdir(char const *path)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct Bstat st;
|
||||||
if (stat(path, &st) != 0)
|
return (Bstat(path, &st) ? 0 : (st.st_mode & S_IFDIR) == S_IFDIR);
|
||||||
return 0;
|
|
||||||
else if ((st.st_mode & S_IFDIR) != S_IFDIR)
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
#define buildvfs_unlink(path) unlink(path)
|
#define buildvfs_unlink(path) unlink(path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue