forked from 0ad/0ad
stomped various lint warnings:
- /* */ -> // - clarified expressions - add casts - func() -> func(void) - signed/unsigned also KB -> KiB, MB -> MiB This was SVN commit r1775.
This commit is contained in:
parent
44ffb32169
commit
85fd8a0f0e
@ -12,8 +12,8 @@
|
|||||||
struct BIT_BUF
|
struct BIT_BUF
|
||||||
{
|
{
|
||||||
ulong buf;
|
ulong buf;
|
||||||
ulong cur; /* bit to be appended (toggled by add()) */
|
ulong cur; // bit to be appended (toggled by add())
|
||||||
ulong len; /* |buf| [bits] */
|
ulong len; // |buf| [bits]
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
@ -22,7 +22,7 @@ struct BIT_BUF
|
|||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* toggle current bit if desired, and add to buffer (new bit is LSB) */
|
// toggle current bit if desired, and add to buffer (new bit is LSB)
|
||||||
void add(ulong toggle)
|
void add(ulong toggle)
|
||||||
{
|
{
|
||||||
cur ^= toggle;
|
cur ^= toggle;
|
||||||
@ -31,7 +31,7 @@ struct BIT_BUF
|
|||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* extract LS n bits */
|
// extract LS n bits
|
||||||
uint extract(ulong n)
|
uint extract(ulong n)
|
||||||
{
|
{
|
||||||
ulong i = buf & ((1ul << n) - 1);
|
ulong i = buf & ((1ul << n) - 1);
|
||||||
@ -248,7 +248,7 @@ private:
|
|||||||
|
|
||||||
// from VFS, not currently needed
|
// from VFS, not currently needed
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
template<class T> class StringMap
|
template<class T> class StringMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -386,7 +386,7 @@ private:
|
|||||||
typedef typename Map::iterator MapIt;
|
typedef typename Map::iterator MapIt;
|
||||||
Map map;
|
Map map;
|
||||||
};
|
};
|
||||||
*/
|
#endif // #if 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
#ifndef __DETECT_H__
|
#ifndef __DETECT_H__
|
||||||
#define __DETECT_H__
|
#define __DETECT_H__
|
||||||
|
|
||||||
#include "lib.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -31,7 +29,7 @@ extern "C" {
|
|||||||
#include "sysdep/os.h"
|
#include "sysdep/os.h"
|
||||||
#include "sysdep/cpu.h"
|
#include "sysdep/cpu.h"
|
||||||
|
|
||||||
extern void get_cpu_info();
|
extern void get_cpu_info(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +39,7 @@ extern char snd_card[SND_CARD_LEN];
|
|||||||
const size_t SND_DRV_VER_LEN = 128;
|
const size_t SND_DRV_VER_LEN = 128;
|
||||||
extern char snd_drv_ver[SND_DRV_VER_LEN];
|
extern char snd_drv_ver[SND_DRV_VER_LEN];
|
||||||
|
|
||||||
extern void get_snd_info();
|
extern void get_snd_info(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -48,7 +48,7 @@ int _in_add_handler(EventHandler handler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* send event to each handler (newest first) until one returns true */
|
// send event to each handler (newest first) until one returns true
|
||||||
static void dispatch_event(const SDL_Event* event)
|
static void dispatch_event(const SDL_Event* event)
|
||||||
{
|
{
|
||||||
for(int i = handler_stack_top-1; i >= 0; i--)
|
for(int i = handler_stack_top-1; i >= 0; i--)
|
||||||
@ -70,7 +70,7 @@ static void dispatch_event(const SDL_Event* event)
|
|||||||
|
|
||||||
static enum
|
static enum
|
||||||
{
|
{
|
||||||
INIT, /* first call to in_record() or in_playback(): register cleanup routine */
|
INIT, // first call to in_record() or in_playback(): register cleanup routine
|
||||||
IDLE,
|
IDLE,
|
||||||
RECORD,
|
RECORD,
|
||||||
PLAYBACK
|
PLAYBACK
|
||||||
@ -148,10 +148,8 @@ void in_get_events()
|
|||||||
{
|
{
|
||||||
fread(&event, sizeof(SDL_Event), 1, f);
|
fread(&event, sizeof(SDL_Event), 1, f);
|
||||||
|
|
||||||
/*
|
// do this before dispatch_event(),
|
||||||
* do this before dispatch_event(),
|
// in case a handler calls in_stop() (setting f to 0)
|
||||||
* in case a handler calls in_stop() (setting f to 0)
|
|
||||||
*/
|
|
||||||
if(!fread(&next_event_time, sizeof(u32), 1, f))
|
if(!fread(&next_event_time, sizeof(u32), 1, f))
|
||||||
{
|
{
|
||||||
in_stop();
|
in_stop();
|
||||||
@ -163,7 +161,7 @@ exit(0x73c07d);
|
|||||||
dispatch_event(&event);
|
dispatch_event(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get new events */
|
// get new events
|
||||||
while(SDL_PollEvent(&event))
|
while(SDL_PollEvent(&event))
|
||||||
{
|
{
|
||||||
if(state == RECORD)
|
if(state == RECORD)
|
||||||
|
@ -51,11 +51,11 @@ typedef int (*EventHandler)(const void* sdl_event);
|
|||||||
extern int _in_add_handler(EventHandler handler);
|
extern int _in_add_handler(EventHandler handler);
|
||||||
#define in_add_handler(h) _in_add_handler((EventHandler)h)
|
#define in_add_handler(h) _in_add_handler((EventHandler)h)
|
||||||
|
|
||||||
extern void in_get_events();
|
extern void in_get_events(void);
|
||||||
|
|
||||||
extern int in_record(const char* fn);
|
extern int in_record(const char* fn);
|
||||||
extern int in_playback(const char* fn);
|
extern int in_playback(const char* fn);
|
||||||
extern void in_stop();
|
extern void in_stop(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -49,8 +49,7 @@ static struct ExitFunc
|
|||||||
void* func;
|
void* func;
|
||||||
uintptr_t arg;
|
uintptr_t arg;
|
||||||
CallConvention cc;
|
CallConvention cc;
|
||||||
}
|
} exit_funcs[MAX_EXIT_FUNCS];
|
||||||
exit_funcs[MAX_EXIT_FUNCS];
|
|
||||||
static int num_exit_funcs;
|
static int num_exit_funcs;
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +113,7 @@ int atexit2(void* func)
|
|||||||
// call from main as early as possible.
|
// call from main as early as possible.
|
||||||
void lib_init()
|
void lib_init()
|
||||||
{
|
{
|
||||||
atexit(call_exit_funcs);
|
(void)atexit(call_exit_funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,7 +130,7 @@ void lib_init()
|
|||||||
// otherwise, hash <len> bytes of buf.
|
// otherwise, hash <len> bytes of buf.
|
||||||
u32 fnv_hash(const void* buf, const size_t len)
|
u32 fnv_hash(const void* buf, const size_t len)
|
||||||
{
|
{
|
||||||
u32 h = 0x811c9dc5;
|
u32 h = 0x811c9dc5u;
|
||||||
// give distinct values for different length 0 buffers.
|
// give distinct values for different length 0 buffers.
|
||||||
// value taken from FNV; it has no special significance.
|
// value taken from FNV; it has no special significance.
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ u32 fnv_hash(const void* buf, const size_t len)
|
|||||||
while(*p)
|
while(*p)
|
||||||
{
|
{
|
||||||
h ^= *p++;
|
h ^= *p++;
|
||||||
h *= 0x01000193;
|
h *= 0x01000193u;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -152,7 +151,7 @@ u32 fnv_hash(const void* buf, const size_t len)
|
|||||||
while(bytes_left != 0)
|
while(bytes_left != 0)
|
||||||
{
|
{
|
||||||
h ^= *p++;
|
h ^= *p++;
|
||||||
h *= 0x01000193;
|
h *= 0x01000193u;
|
||||||
|
|
||||||
bytes_left--;
|
bytes_left--;
|
||||||
}
|
}
|
||||||
@ -202,7 +201,7 @@ u64 fnv_hash64(const void* buf, const size_t len)
|
|||||||
|
|
||||||
bool is_pow2(const long n)
|
bool is_pow2(const long n)
|
||||||
{
|
{
|
||||||
return (n != 0) && !(n & (n-1));
|
return (n != 0l) && !(n & (n-1l));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -219,9 +218,9 @@ int ilog2(const int n)
|
|||||||
or eax, -1 // return value
|
or eax, -1 // return value
|
||||||
lea edx, [ecx-1]
|
lea edx, [ecx-1]
|
||||||
test ecx, edx // power of 2?
|
test ecx, edx // power of 2?
|
||||||
jnz $ret
|
jnz skip
|
||||||
bsf eax, ecx
|
bsf eax, ecx
|
||||||
$ret:
|
skip:
|
||||||
mov [n], eax
|
mov [n], eax
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +248,7 @@ uint log2(uint x)
|
|||||||
while(bit < x)
|
while(bit < x)
|
||||||
{
|
{
|
||||||
l++;
|
l++;
|
||||||
bit *= 2;
|
bit += bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
return l;
|
return l;
|
||||||
@ -258,15 +257,19 @@ uint log2(uint x)
|
|||||||
|
|
||||||
int ilog2(const float x)
|
int ilog2(const float x)
|
||||||
{
|
{
|
||||||
u32 i = (u32&)x;
|
const u32 i = (u32&)x;
|
||||||
u32 exp = (i >> 23) & 0xff;
|
u32 biased_exp = (i >> 23) & 0xff;
|
||||||
return (int)exp - 127;
|
return (int)biased_exp - 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uintptr_t round_up(const uintptr_t n, const uintptr_t multiple)
|
uintptr_t round_up(const uintptr_t n, const uintptr_t multiple)
|
||||||
{
|
{
|
||||||
assert(multiple != 0);
|
if(multiple == 0) // paranoid divide-by-zero
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
const uintptr_t padded = n + multiple-1;
|
const uintptr_t padded = n + multiple-1;
|
||||||
const uintptr_t remainder = padded % multiple;
|
const uintptr_t remainder = padded % multiple;
|
||||||
const uintptr_t result = padded - remainder;
|
const uintptr_t result = padded - remainder;
|
||||||
@ -278,7 +281,7 @@ uintptr_t round_up(const uintptr_t n, const uintptr_t multiple)
|
|||||||
u16 addusw(u16 x, u16 y)
|
u16 addusw(u16 x, u16 y)
|
||||||
{
|
{
|
||||||
u32 t = x;
|
u32 t = x;
|
||||||
return (u16)MIN(t+y, 0xffff);
|
return (u16)MIN(t+y, 0xffffu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -292,14 +295,14 @@ u16 subusw(u16 x, u16 y)
|
|||||||
// input in [0, 1); convert to u8 range
|
// input in [0, 1); convert to u8 range
|
||||||
u8 fp_to_u8(double in)
|
u8 fp_to_u8(double in)
|
||||||
{
|
{
|
||||||
if(!(0 <= in && in < 1.0))
|
if(!(0.0 <= in && in < 1.0))
|
||||||
{
|
{
|
||||||
debug_warn("clampf not in [0,1)");
|
debug_warn("clampf not in [0,1)");
|
||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
int l = (int)(in * 255.0);
|
int l = (int)(in * 255.0);
|
||||||
assert((unsigned int)l <= 255);
|
assert((unsigned int)l <= 255u);
|
||||||
return (u8)l;
|
return (u8)l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,14 +310,14 @@ u8 fp_to_u8(double in)
|
|||||||
// input in [0, 1); convert to u16 range
|
// input in [0, 1); convert to u16 range
|
||||||
u16 fp_to_u16(double in)
|
u16 fp_to_u16(double in)
|
||||||
{
|
{
|
||||||
if(!(0 <= in && in < 1.0))
|
if(!(0.0 <= in && in < 1.0))
|
||||||
{
|
{
|
||||||
debug_warn("clampf not in [0,1)");
|
debug_warn("clampf not in [0,1)");
|
||||||
return 65535;
|
return 65535;
|
||||||
}
|
}
|
||||||
|
|
||||||
long l = (long)(in * 65535.0);
|
long l = (long)(in * 65535.0);
|
||||||
assert((unsigned long)l <= 65535);
|
assert((unsigned long)l <= 65535u);
|
||||||
return (u16)l;
|
return (u16)l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +405,7 @@ int match_wildcard(const char* s, const char* w)
|
|||||||
// s2 is advanced until match.
|
// s2 is advanced until match.
|
||||||
// initially 0 - we abort on mismatch before the first '*'.
|
// initially 0 - we abort on mismatch before the first '*'.
|
||||||
const char* s2 = 0;
|
const char* s2 = 0;
|
||||||
const char* w2;
|
const char* w2 = 0;
|
||||||
|
|
||||||
while(*s)
|
while(*s)
|
||||||
{
|
{
|
||||||
|
@ -251,8 +251,9 @@ enum LibError
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const size_t KB = 1ul << 10;
|
const size_t KiB = 1ul << 10;
|
||||||
const size_t MB = 1ul << 20;
|
const size_t MiB = 1ul << 20;
|
||||||
|
const size_t GiB = 1ul << 30;
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -268,7 +269,7 @@ const size_t MB = 1ul << 20;
|
|||||||
|
|
||||||
|
|
||||||
// call from main as early as possible.
|
// call from main as early as possible.
|
||||||
extern void lib_init();
|
extern void lib_init(void);
|
||||||
|
|
||||||
|
|
||||||
enum CallConvention // number of parameters and convention
|
enum CallConvention // number of parameters and convention
|
||||||
@ -317,18 +318,6 @@ extern u64 fnv_hash64(const void* buf, const size_t len);
|
|||||||
typedef u32 FnHash;
|
typedef u32 FnHash;
|
||||||
|
|
||||||
|
|
||||||
#ifndef min
|
|
||||||
inline int min(int a, int b)
|
|
||||||
{
|
|
||||||
return (a < b)? a : b;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int max(int a, int b)
|
|
||||||
{
|
|
||||||
return (a > b)? a : b;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern u16 addusw(u16 x, u16 y);
|
extern u16 addusw(u16 x, u16 y);
|
||||||
extern u16 subusw(u16 x, u16 y);
|
extern u16 subusw(u16 x, u16 y);
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/*
|
// block prefetch memcpy for large, uncached arrays
|
||||||
* block prefetch memcpy for large, uncached arrays
|
//
|
||||||
*
|
// src and len must be multiples of CHUNK_SIZE.
|
||||||
* src and len must be multiples of CHUNK_SIZE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -73,6 +73,7 @@ void oglCheck()
|
|||||||
E(GL_STACK_OVERFLOW)
|
E(GL_STACK_OVERFLOW)
|
||||||
E(GL_STACK_UNDERFLOW)
|
E(GL_STACK_UNDERFLOW)
|
||||||
E(GL_OUT_OF_MEMORY)
|
E(GL_OUT_OF_MEMORY)
|
||||||
|
default:;
|
||||||
}
|
}
|
||||||
#undef E
|
#undef E
|
||||||
debug_break();
|
debug_break();
|
||||||
@ -87,15 +88,15 @@ void oglPrintErrors()
|
|||||||
for(;;)
|
for(;;)
|
||||||
switch(glGetError())
|
switch(glGetError())
|
||||||
{
|
{
|
||||||
case GL_NO_ERROR:
|
E(GL_INVALID_ENUM)
|
||||||
return;
|
E(GL_INVALID_VALUE)
|
||||||
|
E(GL_INVALID_OPERATION)
|
||||||
|
E(GL_STACK_OVERFLOW)
|
||||||
|
E(GL_STACK_UNDERFLOW)
|
||||||
|
E(GL_OUT_OF_MEMORY)
|
||||||
|
|
||||||
E(GL_INVALID_ENUM)
|
default:
|
||||||
E(GL_INVALID_VALUE)
|
return;
|
||||||
E(GL_INVALID_OPERATION)
|
|
||||||
E(GL_STACK_OVERFLOW)
|
|
||||||
E(GL_STACK_UNDERFLOW)
|
|
||||||
E(GL_OUT_OF_MEMORY)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +105,7 @@ int max_tex_size; // [pixels]
|
|||||||
int tex_units;
|
int tex_units;
|
||||||
int max_VAR_elements = -1; // GF2: 64K; GF3: 1M
|
int max_VAR_elements = -1; // GF2: 64K; GF3: 1M
|
||||||
bool tex_compression_avail; // S3TC / DXT{1,3,5}
|
bool tex_compression_avail; // S3TC / DXT{1,3,5}
|
||||||
int video_mem; // [MB]; approximate
|
int video_mem; // [MiB]; approximate
|
||||||
|
|
||||||
|
|
||||||
// gfx_card and gfx_drv_ver are unchanged on failure.
|
// gfx_card and gfx_drv_ver are unchanged on failure.
|
||||||
@ -171,6 +172,6 @@ void oglInit()
|
|||||||
tex_compression_avail = oglExtAvail("GL_ARB_texture_compression") &&
|
tex_compression_avail = oglExtAvail("GL_ARB_texture_compression") &&
|
||||||
(oglExtAvail("GL_EXT_texture_compression_s3tc") || oglExtAvail("GL_S3_s3tc"));
|
(oglExtAvail("GL_EXT_texture_compression_s3tc") || oglExtAvail("GL_S3_s3tc"));
|
||||||
|
|
||||||
video_mem = (SDL_GetVideoInfo()->video_mem) / 1048576; // [MB]
|
video_mem = (SDL_GetVideoInfo()->video_mem) / 1048576; // [MiB]
|
||||||
// TODO: add sizeof(FB)?
|
// TODO: add sizeof(FB)?
|
||||||
}
|
}
|
||||||
|
@ -84,17 +84,17 @@ extern int max_tex_size; // [pixels]
|
|||||||
extern int tex_units;
|
extern int tex_units;
|
||||||
extern int max_VAR_elements; // GF2: 64K; GF3: 1M
|
extern int max_VAR_elements; // GF2: 64K; GF3: 1M
|
||||||
extern bool tex_compression_avail; // S3TC / DXT{1,3,5}
|
extern bool tex_compression_avail; // S3TC / DXT{1,3,5}
|
||||||
extern int video_mem; // [MB]; approximate
|
extern int video_mem; // [MiB]; approximate
|
||||||
|
|
||||||
|
|
||||||
// check if the extension <ext> is supported by the OpenGL implementation
|
// check if the extension <ext> is supported by the OpenGL implementation
|
||||||
extern bool oglExtAvail(const char* ext);
|
extern bool oglExtAvail(const char* ext);
|
||||||
|
|
||||||
// print all OpenGL errors
|
// print all OpenGL errors
|
||||||
extern void oglPrintErrors();
|
extern void oglPrintErrors(void);
|
||||||
|
|
||||||
#ifdef OGL_CHECKS
|
#ifdef OGL_CHECKS
|
||||||
extern void oglCheck();
|
extern void oglCheck(void);
|
||||||
#else
|
#else
|
||||||
# define oglCheck()
|
# define oglCheck()
|
||||||
#endif
|
#endif
|
||||||
@ -102,18 +102,18 @@ extern void oglCheck();
|
|||||||
// call before using any of the above, and after each mode change.
|
// call before using any of the above, and after each mode change.
|
||||||
//
|
//
|
||||||
// fails if OpenGL not ready for use.
|
// fails if OpenGL not ready for use.
|
||||||
extern void oglInit();
|
extern void oglInit(void);
|
||||||
|
|
||||||
// set detect.cpp gfx_card[] and gfx_drv_ver[].
|
// set detect.cpp gfx_card[] and gfx_drv_ver[].
|
||||||
// (called by detect.cpp get_gfx_info()).
|
// (called by detect.cpp get_gfx_info()).
|
||||||
//
|
//
|
||||||
// fails if OpenGL not ready for use.
|
// fails if OpenGL not ready for use.
|
||||||
// gfx_card and gfx_drv_ver are unchanged on failure.
|
// gfx_card and gfx_drv_ver are unchanged on failure.
|
||||||
extern int ogl_get_gfx_info();
|
extern int ogl_get_gfx_info(void);
|
||||||
|
|
||||||
// return a NULL-terminated string (of unlimited length) containing
|
// return a NULL-terminated string (of unlimited length) containing
|
||||||
// a space-separated list of supported extensions.
|
// a space-separated list of supported extensions.
|
||||||
extern const char* oglExtList();
|
extern const char* oglExtList(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
// all transfers are expanded to naturally aligned, whole blocks
|
// all transfers are expanded to naturally aligned, whole blocks
|
||||||
// (this makes caching parts of files feasible; it is also much faster
|
// (this makes caching parts of files feasible; it is also much faster
|
||||||
// for some aio implementations, e.g. wposix).
|
// for some aio implementations, e.g. wposix).
|
||||||
const size_t BLOCK_SIZE_LOG2 = 16; // 2**16 = 64 KB
|
const size_t BLOCK_SIZE_LOG2 = 16; // 2**16 = 64 KiB
|
||||||
const size_t BLOCK_SIZE = 1ul << BLOCK_SIZE_LOG2;
|
const size_t BLOCK_SIZE = 1ul << BLOCK_SIZE_LOG2;
|
||||||
|
|
||||||
const size_t SECTOR_SIZE = 4096;
|
const size_t SECTOR_SIZE = 4096;
|
||||||
@ -963,7 +963,7 @@ debug_out("file_io fd=%d size=%d ofs=%d\n", f->fd, data_size, data_ofs);
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// now we read the file in 64 KB chunks, N-buffered.
|
// now we read the file in 64 KiB chunks, N-buffered.
|
||||||
// if reading from Zip, inflate while reading the next block.
|
// if reading from Zip, inflate while reading the next block.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ static HDATA* h_data_from_idx(const i32 idx)
|
|||||||
HDATA*& page = pages[idx / hdata_per_page];
|
HDATA*& page = pages[idx / hdata_per_page];
|
||||||
if(!page)
|
if(!page)
|
||||||
{
|
{
|
||||||
page = (HDATA*)calloc(PAGE_SIZE, 1);
|
page = (HDATA*)calloc(1, PAGE_SIZE);
|
||||||
if(!page)
|
if(!page)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -373,7 +373,6 @@ static void remove_key(uintptr_t key, H_Type type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// currently cannot fail.
|
// currently cannot fail.
|
||||||
static int h_free_idx(i32 idx, HDATA* hd)
|
static int h_free_idx(i32 idx, HDATA* hd)
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ extern int h_force_free(Handle h, H_Type type);
|
|||||||
// user load the resource; refcounting is done under the hood.
|
// user load the resource; refcounting is done under the hood.
|
||||||
extern void h_add_ref(Handle h);
|
extern void h_add_ref(Handle h);
|
||||||
|
|
||||||
extern void h_mgr_shutdown();
|
extern void h_mgr_shutdown(void);
|
||||||
|
|
||||||
|
|
||||||
#endif // #ifndef H_MGR_H__
|
#endif // #ifndef H_MGR_H__
|
||||||
|
@ -10,4 +10,4 @@ extern int res_watch_dir(const char* path, intptr_t* watch);
|
|||||||
|
|
||||||
extern int res_cancel_watch(const intptr_t watch);
|
extern int res_cancel_watch(const intptr_t watch);
|
||||||
|
|
||||||
extern int res_reload_changed_files();
|
extern int res_reload_changed_files(void);
|
||||||
|
@ -29,7 +29,7 @@ extern int mem_free_h(Handle& hm);
|
|||||||
extern void* mem_get_ptr(Handle h, size_t* size = 0);
|
extern void* mem_get_ptr(Handle h, size_t* size = 0);
|
||||||
|
|
||||||
|
|
||||||
extern void mem_shutdown();
|
extern void mem_shutdown(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ static const int MAX_STREAMS = 2;
|
|||||||
// maximum IOs queued per stream.
|
// maximum IOs queued per stream.
|
||||||
static const int MAX_IOS = 4;
|
static const int MAX_IOS = 4;
|
||||||
|
|
||||||
static const size_t STREAM_BUF_SIZE = 32*KB;
|
static const size_t STREAM_BUF_SIZE = 32*KiB;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -607,7 +607,7 @@ static void io_buf_free(void* p)
|
|||||||
static void io_buf_init()
|
static void io_buf_init()
|
||||||
{
|
{
|
||||||
// allocate 1 big aligned block for all buffers.
|
// allocate 1 big aligned block for all buffers.
|
||||||
io_bufs = mem_alloc(TOTAL_BUF_SIZE, 4*KB);
|
io_bufs = mem_alloc(TOTAL_BUF_SIZE, 4*KiB);
|
||||||
// .. failed; io_buf_alloc calls will return 0
|
// .. failed; io_buf_alloc calls will return 0
|
||||||
if(!io_bufs)
|
if(!io_bufs)
|
||||||
return;
|
return;
|
||||||
@ -990,7 +990,7 @@ if(file_type == FT_OGG)
|
|||||||
size_t bytes_read;
|
size_t bytes_read;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
const size_t bufsize = 32*KB;
|
const size_t bufsize = 32*KiB;
|
||||||
char buf[bufsize];
|
char buf[bufsize];
|
||||||
bytes_read = ogg_read(sd->o, buf, bufsize);
|
bytes_read = ogg_read(sd->o, buf, bufsize);
|
||||||
data.insert(data.end(), &buf[0], &buf[bytes_read]);
|
data.insert(data.end(), &buf[0], &buf[bytes_read]);
|
||||||
@ -1654,7 +1654,7 @@ static int vm_update()
|
|||||||
// partition list; the first al_src_cap will be granted a source
|
// partition list; the first al_src_cap will be granted a source
|
||||||
// (if they don't have one already), after reclaiming all sources from
|
// (if they don't have one already), after reclaiming all sources from
|
||||||
// the remainder of the VSrc list entries.
|
// the remainder of the VSrc list entries.
|
||||||
uint first_unimportant = min((uint)vsrcs.size(), al_src_cap);
|
uint first_unimportant = MIN((uint)vsrcs.size(), al_src_cap);
|
||||||
list_foreach(reclaim, first_unimportant, 0);
|
list_foreach(reclaim, first_unimportant, 0);
|
||||||
list_foreach(grant, 0, first_unimportant);
|
list_foreach(grant, 0, first_unimportant);
|
||||||
|
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
// $Id: unifont.h,v 1.9 2004/11/24 23:47:48 gee Exp $
|
// $Id$
|
||||||
|
|
||||||
#ifndef __UNIFONT_H__
|
#ifndef __UNIFONT_H__
|
||||||
#define __UNIFONT_H__
|
#define __UNIFONT_H__
|
||||||
|
|
||||||
#include "handle.h"
|
#include <stdarg.h> // va_list
|
||||||
|
|
||||||
|
#include "handle.h"
|
||||||
|
|
||||||
// Load and return a handle to the font defined
|
// Load and return a handle to the font defined
|
||||||
// in fn+".fnt" with texture fn+".tga"
|
// in fn+".fnt" with texture fn+".tga"
|
||||||
Handle unifont_load(const char* fn, int scope = 0);
|
extern Handle unifont_load(const char* fn, int scope = 0);
|
||||||
|
|
||||||
// Release a handle to a previously loaded font
|
// Release a handle to a previously loaded font
|
||||||
int unifont_unload(Handle& h);
|
extern int unifont_unload(Handle& h);
|
||||||
|
|
||||||
// Use the font referenced by h for all subsequent glwprintf() calls.
|
// Use the font referenced by h for all subsequent glwprintf() calls.
|
||||||
// Must be called before any glwprintf().
|
// Must be called before any glwprintf().
|
||||||
int unifont_bind(Handle h);
|
extern int unifont_bind(Handle h);
|
||||||
|
|
||||||
// Output text at current OpenGL modelview pos.
|
// Output text at current OpenGL modelview pos.
|
||||||
void glwprintf(const wchar_t* fmt, ...);
|
extern void glvwprintf(const wchar_t* fmt, va_list args);
|
||||||
|
extern void glwprintf(const wchar_t* fmt, ...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
glwprintf assumes an environment roughly like:
|
glwprintf assumes an environment roughly like:
|
||||||
|
Loading…
Reference in New Issue
Block a user