Commit 57078b58 authored by Steven Fuller's avatar Steven Fuller

cleanup.

parent 97f342f9
...@@ -9,32 +9,33 @@ ...@@ -9,32 +9,33 @@
#define O_BINARY 0 #define O_BINARY 0
#endif #endif
/* TimeCount from David Haslam -- dch@sirius.demon.co.uk */
static struct timeval t0; static struct timeval t0;
static long tc0; static unsigned long tc0;
void set_TimeCount(unsigned long t) void set_TimeCount(unsigned long t)
{ {
tc0 = t; tc0 = t;
gettimeofday(&t0, NULL); gettimeofday(&t0, NULL);
} }
unsigned long get_TimeCount() unsigned long get_TimeCount(void)
{ {
struct timeval t1; struct timeval t1;
long secs, usecs; long secs, usecs;
long tc; unsigned long tc;
gettimeofday(&t1, NULL); gettimeofday(&t1, NULL);
secs = t1.tv_sec - t0.tv_sec; secs = t1.tv_sec - t0.tv_sec;
usecs = t1.tv_usec - t0.tv_usec; usecs = t1.tv_usec - t0.tv_usec;
if (usecs < 0) { if (usecs < 0) {
usecs += 1000000; usecs += 1000000;
secs--; secs--;
} }
tc = tc0 + secs * 70 + usecs * 70 / 1000000; tc = tc0 + secs * 70 + (usecs * 70) / 1000000;
return tc; return tc;
} }
...@@ -65,6 +66,8 @@ char *strlwr(char *s) ...@@ -65,6 +66,8 @@ char *strlwr(char *s)
char *itoa(int value, char *string, int radix) char *itoa(int value, char *string, int radix)
{ {
(void) radix;
/* wolf3d only uses radix 10 */ /* wolf3d only uses radix 10 */
sprintf(string, "%d", value); sprintf(string, "%d", value);
return string; return string;
...@@ -72,12 +75,18 @@ char *itoa(int value, char *string, int radix) ...@@ -72,12 +75,18 @@ char *itoa(int value, char *string, int radix)
char *ltoa(long value, char *string, int radix) char *ltoa(long value, char *string, int radix)
{ {
(void) radix;
/* wolf3d only uses radix 10 */
sprintf(string, "%ld", value); sprintf(string, "%ld", value);
return string; return string;
} }
char *ultoa(unsigned long value, char *string, int radix) char *ultoa(unsigned long value, char *string, int radix)
{ {
(void) radix;
/* wolf3d only uses radix 10 */
sprintf(string, "%lu", value); sprintf(string, "%lu", value);
return string; return string;
} }
......
...@@ -8,7 +8,7 @@ void SavePCX256ToFile(const unsigned char *buf, int width, int height, const uns ...@@ -8,7 +8,7 @@ void SavePCX256ToFile(const unsigned char *buf, int width, int height, const uns
void SavePCXRGBToFile(const unsigned char *buf, int width, int height, const char *name); void SavePCXRGBToFile(const unsigned char *buf, int width, int height, const char *name);
void set_TimeCount(unsigned long t); void set_TimeCount(unsigned long t);
unsigned long get_TimeCount(); unsigned long get_TimeCount(void);
long filelength(int handle); long filelength(int handle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment