diff options
| author | Steven Fuller <relnev@icculus.org> | 2001-08-15 05:23:32 +0000 |
|---|---|---|
| committer | Patryk Obara <dreamer.tan@gmail.com> | 2019-08-20 02:22:36 +0200 |
| commit | 3ea03344ec2b9c5cd17b0ef253adece705558019 (patch) | |
| tree | ea26fd2828bb9e4c55f32f6239e092221ea456e4 /src/tools/util.c | |
| parent | 14d3cc45bcf1a9dce1e982fd82b79d7053be4048 (diff) | |
Removing junk.
Diffstat (limited to 'src/tools/util.c')
| -rw-r--r-- | src/tools/util.c | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/tools/util.c b/src/tools/util.c deleted file mode 100644 index 3c1f5aa..0000000 --- a/src/tools/util.c +++ /dev/null @@ -1,90 +0,0 @@ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <stdint.h> - -#include "util.h" - -int32_t ReadInt32M(FILE *fp) -{ - unsigned char d[4]; - - fread(d, 1, 4, fp); - - return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3] << 0); -} - -int32_t ReadInt24M(FILE *fp) -{ - unsigned char d[3]; - - fread(d, 1, 3, fp); - - return (d[0] << 16) | (d[1] << 8) | (d[2] << 0); -} - -int16_t ReadInt16M(FILE *fp) -{ - unsigned char d[2]; - - fread(d, 1, 2, fp); - - return (d[0] << 8) | (d[1] << 0); -} - -int32_t ReadInt32L(FILE *fp) -{ - unsigned char d[4]; - - fread(d, 1, 4, fp); - - return (d[3] << 24) | (d[2] << 16) | (d[1] << 8) | (d[0] << 0); -} - -int32_t ReadInt24L(FILE *fp) -{ - unsigned char d[3]; - - fread(d, 1, 3, fp); - - return (d[2] << 16) | (d[1] << 8) | (d[0] << 0); -} - -int16_t ReadInt16L(FILE *fp) -{ - unsigned char d[2]; - - fread(d, 1, 2, fp); - - return (d[1] << 8) | (d[0] << 0); -} - -int8_t ReadInt8(FILE *fp) -{ - unsigned char d[1]; - - fread(d, 1, 1, fp); - - return d[0]; -} - -int filelength(int filedes) -{ - struct stat buf; - - if (fstat(filedes, &buf) == -1) - return -1; - - return buf.st_size; -} - -int fsize(char *file_name) -{ - struct stat buf; - - if (stat(file_name, &buf) == -1) - return -1; - - return buf.st_size; -} |
