1
0
forked from mirrors/0ad

big merge goes linux! ; )

This was SVN commit r171.
This commit is contained in:
olsner
2004-03-04 20:36:31 +00:00
parent 838efe149e
commit a470253b0b
15 changed files with 79 additions and 17 deletions
+4 -3
View File
@@ -26,7 +26,9 @@
#include "lib.h"
#include "detect.h"
#include "sysdep/ia32.h"
#ifdef _M_IX86
# include "sysdep/ia32.h"
#endif
#include "timer.h"
#include "ogl.h"
#include "sdl.h"
@@ -79,7 +81,6 @@ void get_mem_status()
#endif
}
//
// graphics card
//
@@ -90,7 +91,7 @@ char gfx_drv[128] = "unknown";
// attempt to detect graphics card without OpenGL (in case ogl init fails,
// or we want more detailed info). gfx_card[] is unchanged on failure.
inline void get_gfx_info()
void get_gfx_info()
{
#ifdef _WIN32
win_get_gfx_card();
+42
View File
@@ -216,7 +216,49 @@ void base32(const int len, const u8* in, u8* out)
}
}
#ifndef _WIN32
char *_itoa(int value, char *out, int radix)
{
return _ltoa(value, out, radix);
}
static const char digits[]="0123456789abcdef";
char *_ultoa(unsigned long int value, char *out, int radix)
{
char buf[21];
char *p=buf+21;
while (value)
{
*(--p)=digits[value % radix];
value /= radix;
}
memcpy(out, p, (buf+21)-p);
out[(buf+21)-p]=0;
return out;
}
char *_ltoa(long val, char *out, int radix)
{
char buf[21];
char *p=buf+21;
bool sign=val < 0;
if (sign) val=-val;
while (val)
{
*(--p)=digits[val % radix];
val /= radix;
}
if (sign) *(--p) = '-';
memcpy(out, p, (buf+21)-p);
out[(buf+21)-p]=0;
return out;
}
#endif
+9 -1
View File
@@ -20,6 +20,7 @@
#define __MISC_H__
#include "types.h"
#include "config.h"
// bswap32 is overloaded!
#ifdef __cplusplus
@@ -67,7 +68,7 @@ static inline u32 read_le32(const void* p)
for(int i = 0; i < 4; i++)
{
t <<= 8;
t |= *(const u8*)p++;
t |= *((const u8*)p)++;
}
return t;
#else
@@ -98,6 +99,13 @@ extern float fminf(float, float);
// big endian!
extern void base32(const int len, const u8* in, u8* out);
#ifndef _WIN32
char *_itoa(int, char *, int radix);
char *_ultoa(unsigned long int, char*, int radix);
char *_ltoa(long, char *, int radix);
#endif
+4 -1
View File
@@ -11,14 +11,17 @@
#include <unistd.h>
#include <sys/time.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <pthread.h>
#include <sys/mman.h>
#include <aio.h>
#include <errno.h>
#include <dirent.h>
#include <sys/utsname.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#endif // #ifdef _WIN32 else
#endif // #ifdef _WIN32 else
+1 -1
View File
@@ -682,7 +682,7 @@ skip_wait:
}
// read directly into target buffer
else
p = cb->aio_buf;
p = (void *)cb->aio_buf; // cb->aio_buf is volatile, p is not
return ret;
}
+1 -1
View File
@@ -209,7 +209,7 @@ static int Font_reload(Font* f, const char* fn)
}
inline Handle font_load(const char* fn, int scope)
Handle font_load(const char* fn, int scope)
{
return h_alloc(H_Font, fn, scope);
}
+1 -1
View File
@@ -746,7 +746,7 @@ static int Tex_reload(Tex* t, const char* fn)
}
inline Handle tex_load(const char* const fn, int scope)
Handle tex_load(const char* const fn, int scope)
{
return h_alloc(H_Tex, fn, scope);
}
+1 -1
View File
@@ -25,7 +25,7 @@
// load and return a handle to the texture given in <fn>.
// supports RAW, BMP, JP2, PNG, TGA, DDS
extern Handle tex_load(const char* fn, int scope = 0);
extern Handle tex_load(const char* const fn, int scope = 0);
extern int tex_bind(Handle ht);
+2 -2
View File
@@ -294,13 +294,13 @@ found_ecdr:
// open and return a handle to the zip archive indicated by <fn>
inline Handle zip_archive_open(const char* const fn)
Handle zip_archive_open(const char* const fn)
{
return h_alloc(H_ZArchive, fn);
}
// close the archive <ha> and set ha to 0
inline int zip_archive_close(Handle& ha)
int zip_archive_close(Handle& ha)
{
return h_free(ha, H_ZArchive);
}
+1 -1
View File
@@ -21,7 +21,7 @@
#include "h_mgr.h"
#include "lib.h"
#include "File.h"
#include "file.h"
//
+2 -1
View File
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
#include "sysdep.h"
@@ -28,4 +29,4 @@ void check_heap()
{
}
#endif // #ifndef _WIN32
#endif // #ifndef _WIN32
+3 -1
View File
@@ -1,9 +1,11 @@
#if !defined(__WIN_H__) && defined(_WIN32)
#define __WIN_H__
#include <wchar.h>
// C99
#define snprintf _snprintf
#define snwprintf _snwprintf
#define swprintf _snwprintf
#define vsnprintf _vsnprintf
#include <stddef.h> // wchar_t
+5 -1
View File
@@ -338,7 +338,11 @@ int pthread_mutex_timedlock(pthread_mutex_t* m, const struct timespec* abs_timeo
return WaitForSingleObject(*m, ms_timeout) == WAIT_OBJECT_0? 0 : -1;
}
int pthread_mutex_destroy(pthread_mutex_t* m)
{
CloseHandle(*m);
return 0;
}
//////////////////////////////////////////////////////////////////////////////
//
+2 -1
View File
@@ -18,6 +18,7 @@
#ifdef HAVE_X
#include <Xlib.h>
#include "detect.h"
// useful for choosing a video mode. not called by detect().
// if we fail, don't change the outputs (assumed initialized to defaults)
@@ -33,4 +34,4 @@ void get_cur_resolution(int& xres, int& yres)
XCloseDisplay(disp);
}
#endif // #ifdef HAVE_X
#endif // #ifdef HAVE_X
+1 -1
View File
@@ -88,7 +88,7 @@ double timer_res()
#elif defined(HAVE_CLOCK_GETTIME)
struct timespec res;
clock_getres(CLOCK_REALTIME, res);
clock_getres(CLOCK_REALTIME, &res);
return res.tv_nsec * 1e-9;
#else