More code cleanup. I added -pedantic to the CFLAGS to see

what broke; mainly typecasts.  I've disabled -pedantic again
though, as there are some bugs in svgalib and libc headers
that prevent compilation with -pedantic.  I also didn't
bother to set explicit casts in linux/qgl_linux.c
This commit is contained in:
Jamie Wilkinson 2002-02-21 01:47:27 +00:00
parent c64a5e828a
commit ef847c61ae
30 changed files with 81 additions and 82 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@
debug*
quake2
release*
tags

View file

@ -54,7 +54,7 @@ GAME_DIR=$(MOUNT_DIR)/game
CTF_DIR=$(MOUNT_DIR)/ctf
XATRIX_DIR=$(MOUNT_DIR)/xatrix
BASE_CFLAGS=-Dstricmp=strcasecmp -Wall -Werror -pipe
BASE_CFLAGS=-Dstricmp=strcasecmp -Wall -Werror -pipe #-pedantic
ifneq ($(ARCH),i386)
BASE_CFLAGS+=-DC_ONLY

View file

@ -595,7 +595,7 @@ static void InitSig(void)
/*
** GLimp_SetMode
*/
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
int width, height;
int attrib[] = {

View file

@ -219,7 +219,7 @@ typedef struct
cvar_t *(*Cvar_Set)( char *name, char *value );
void (*Cvar_SetValue)( char *name, float value );
qboolean (*Vid_GetModeInfo)( int *width, int *height, int mode );
qboolean (*Vid_GetModeInfo)( unsigned int *width, unsigned int *height, int mode );
void (*Vid_MenuInit)( void );
void (*Vid_NewWindow)( int width, int height );
} refimport_t;

View file

@ -730,7 +730,7 @@ void ai_run_missile(edict_t *self)
self->monsterinfo.attack (self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
};
}
/*

View file

@ -258,7 +258,7 @@ void plat_CalcAcceleratedMove(moveinfo_t *moveinfo)
}
moveinfo->decel_distance = decel_dist;
};
}
void plat_Accelerate (moveinfo_t *moveinfo)
{
@ -329,7 +329,7 @@ void plat_Accelerate (moveinfo_t *moveinfo)
// we are at constant velocity (move_speed)
return;
};
}
void Think_AccelMove (edict_t *ent)
{
@ -975,7 +975,7 @@ void door_use (edict_t *self, edict_t *other, edict_t *activator)
ent->touch = NULL;
door_go_up (ent, activator);
}
};
}
void Touch_DoorTrigger (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{

View file

@ -499,7 +499,7 @@ void SP_point_combat (edict_t *self)
VectorSet (self->maxs, 8, 8, 16);
self->svflags = SVF_NOCLIENT;
gi.linkentity (self);
};
}
/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
@ -548,7 +548,7 @@ Used as a positional target for spotlights, etc.
void SP_info_null (edict_t *self)
{
G_FreeEdict (self);
};
}
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
@ -558,7 +558,7 @@ void SP_info_notnull (edict_t *self)
{
VectorCopy (self->s.origin, self->absmin);
VectorCopy (self->s.origin, self->absmax);
};
}
/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF

View file

@ -730,7 +730,7 @@ void ai_run_missile(edict_t *self)
self->monsterinfo.attack (self);
self->monsterinfo.attack_state = AS_STRAIGHT;
}
};
}
/*

View file

@ -258,7 +258,7 @@ void plat_CalcAcceleratedMove(moveinfo_t *moveinfo)
}
moveinfo->decel_distance = decel_dist;
};
}
void plat_Accelerate (moveinfo_t *moveinfo)
{
@ -329,7 +329,7 @@ void plat_Accelerate (moveinfo_t *moveinfo)
// we are at constant velocity (move_speed)
return;
};
}
void Think_AccelMove (edict_t *ent)
{
@ -975,7 +975,7 @@ void door_use (edict_t *self, edict_t *other, edict_t *activator)
ent->touch = NULL;
door_go_up (ent, activator);
}
};
}
void Touch_DoorTrigger (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{

View file

@ -484,7 +484,7 @@ void SP_point_combat (edict_t *self)
VectorSet (self->maxs, 8, 8, 16);
self->svflags = SVF_NOCLIENT;
gi.linkentity (self);
};
}
/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
@ -519,7 +519,7 @@ Used as a positional target for spotlights, etc.
void SP_info_null (edict_t *self)
{
G_FreeEdict (self);
};
}
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
@ -529,7 +529,7 @@ void SP_info_notnull (edict_t *self)
{
VectorCopy (self->s.origin, self->absmin);
VectorCopy (self->s.origin, self->absmax);
};
}
/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF

View file

@ -470,7 +470,7 @@ void jorg_pain (edict_t *self, edict_t *other, float kick, int damage)
self->monsterinfo.currentmove = &jorg_move_pain3;
}
}
};
}
void jorgBFG (edict_t *self)
{
@ -534,7 +534,7 @@ void jorg_firebullet (edict_t *self)
{
jorg_firebullet_left(self);
jorg_firebullet_right(self);
};
}
void jorg_attack(edict_t *self)
{

View file

@ -495,7 +495,7 @@ void MakronSaveloc (edict_t *self)
{
VectorCopy (self->enemy->s.origin, self->pos1); //save for aiming the shot
self->pos1[2] += self->enemy->viewheight;
};
}
// FIXME: He's not firing from the proper Z
void MakronRailgun (edict_t *self)
@ -597,12 +597,12 @@ void makron_pain (edict_t *self, edict_t *other, float kick, int damage)
}
}
}
};
}
void makron_sight(edict_t *self, edict_t *other)
{
self->monsterinfo.currentmove = &makron_move_sight;
};
}
void makron_attack(edict_t *self)
{

View file

@ -488,7 +488,7 @@ void supertank_pain (edict_t *self, edict_t *other, float kick, int damage)
gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM,0);
self->monsterinfo.currentmove = &supertank_move_pain3;
}
};
}
void supertankRocket (edict_t *self)

View file

@ -321,7 +321,7 @@ void tank_pain (edict_t *self, edict_t *other, float kick, int damage)
self->monsterinfo.currentmove = &tank_move_pain2;
else
self->monsterinfo.currentmove = &tank_move_pain3;
};
}
//

View file

@ -163,7 +163,7 @@ static void InitSig(void)
/*
** GLimp_SetMode
*/
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
int width, height;
GLint attribs[32];

View file

@ -129,7 +129,7 @@ static void InitSig(void)
/*
** GLimp_SetMode
*/
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
int width, height;
GLint attribs[32];

View file

@ -633,7 +633,7 @@ char *RW_Sys_GetClipboardData()
&type, &format, &len,
&tmp, &data);
if (result == Success) {
ret = strdup(data);
ret = strdup((char*) data);
}
XFree(data);
}
@ -669,9 +669,9 @@ static void InitSig(void)
/*
** GLimp_SetMode
*/
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
int width, height;
unsigned int width, height;
int attrib[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
@ -925,12 +925,12 @@ int GLimp_Init( void *hinstance, void *wndproc )
if ( glw_state.OpenGLLib) {
#define GPA( a ) dlsym( glw_state.OpenGLLib, a )
qglXChooseVisual = GPA("glXChooseVisual");
qglXCreateContext = GPA("glXCreateContext");
qglXDestroyContext = GPA("glXDestroyContext");
qglXMakeCurrent = GPA("glXMakeCurrent");
qglXCopyContext = GPA("glXCopyContext");
qglXSwapBuffers = GPA("glXSwapBuffers");
qglXChooseVisual = (XVisualInfo*(*)(Display*, int, int*)) GPA("glXChooseVisual");
qglXCreateContext = (GLXContext(*)(Display*, XVisualInfo*, GLXContext, Bool)) GPA("glXCreateContext");
qglXDestroyContext = (void(*)(Display*, GLXContext)) GPA("glXDestroyContext");
qglXMakeCurrent = (Bool(*)(Display*, GLXDrawable, GLXContext)) GPA("glXMakeCurrent");
qglXCopyContext = (void(*)(Display*, GLXContext, GLXContext, GLuint)) GPA("glXCopyContext");
qglXSwapBuffers = (void(*)(Display*, GLXDrawable)) GPA("glXSwapBuffers");
return true;
}

View file

@ -290,7 +290,7 @@ void RW_IN_Init(in_state_t *in_state_p)
UseMouse = false;
}
else
mouse_seteventhandler(mousehandler);
mouse_seteventhandler((__mouse_handler) mousehandler);
}
void RW_IN_Shutdown(void)

View file

@ -680,7 +680,7 @@ void GLimp_EndFrame (void)
** SWimp_SetMode
*/
#ifndef OPENGL
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
rserr_t retval = rserr_ok;
@ -704,7 +704,7 @@ rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen
return retval;
}
#else
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
ri.Con_Printf (PRINT_ALL, "setting mode %d:", mode );

View file

@ -171,7 +171,7 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
vga_setmode(current_mode);
VGA_pagebase = framebuffer_ptr = (char *) vga_getgraphmem();
VGA_pagebase = framebuffer_ptr = (byte *) vga_getgraphmem();
// if (vga_setlinearaddressing()>0)
// framebuffer_ptr = (char *) vga_getgraphmem();
if (!framebuffer_ptr)
@ -220,7 +220,7 @@ void SWimp_EndFrame (void)
/*
** SWimp_SetMode
*/
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
rserr_t retval = rserr_ok;

View file

@ -560,7 +560,7 @@ char *RW_Sys_GetClipboardData()
&type, &format, &len,
&tmp, &data);
if (result == Success) {
ret = strdup(data);
ret = strdup((char*) data);
}
XFree(data);
}
@ -1245,8 +1245,7 @@ void SWimp_EndFrame (void)
/*
** SWimp_SetMode
*/
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
{
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen ) {
rserr_t retval = rserr_ok;
ri.Con_Printf (PRINT_ALL, "setting mode %d:", mode );

View file

@ -150,7 +150,7 @@ vidmode_t vid_modes[] =
{ "Mode 10: 2048x1536", 2048, 1536, 10 }
};
qboolean VID_GetModeInfo( int *width, int *height, int mode )
qboolean VID_GetModeInfo( unsigned int *width, unsigned int *height, int mode )
{
if ( mode < 0 || mode >= VID_NUM_MODES )
return false;
@ -282,7 +282,7 @@ qboolean VID_LoadRefresh( char *name )
ri.Vid_MenuInit = VID_MenuInit;
ri.Vid_NewWindow = VID_NewWindow;
if ( ( GetRefAPI = (void *) dlsym( reflib_library, "GetRefAPI" ) ) == 0 )
if ( ( GetRefAPI = (GetRefAPI_t) dlsym( reflib_library, "GetRefAPI" ) ) == 0 )
Com_Error( ERR_FATAL, "dlsym failed on %s", name );
re = GetRefAPI( ri );
@ -299,16 +299,16 @@ qboolean VID_LoadRefresh( char *name )
in_state.viewangles = cl.viewangles;
in_state.in_strafe_state = &in_strafe.state;
if ((RW_IN_Init_fp = dlsym(reflib_library, "RW_IN_Init")) == NULL ||
(RW_IN_Shutdown_fp = dlsym(reflib_library, "RW_IN_Shutdown")) == NULL ||
(RW_IN_Activate_fp = dlsym(reflib_library, "RW_IN_Activate")) == NULL ||
(RW_IN_Commands_fp = dlsym(reflib_library, "RW_IN_Commands")) == NULL ||
(RW_IN_Move_fp = dlsym(reflib_library, "RW_IN_Move")) == NULL ||
(RW_IN_Frame_fp = dlsym(reflib_library, "RW_IN_Frame")) == NULL)
if ((RW_IN_Init_fp = (void (*)(in_state_t *)) dlsym(reflib_library, "RW_IN_Init")) == NULL ||
(RW_IN_Shutdown_fp = (void(*)(void)) dlsym(reflib_library, "RW_IN_Shutdown")) == NULL ||
(RW_IN_Activate_fp = (void(*)(qboolean)) dlsym(reflib_library, "RW_IN_Activate")) == NULL ||
(RW_IN_Commands_fp = (void(*)(void)) dlsym(reflib_library, "RW_IN_Commands")) == NULL ||
(RW_IN_Move_fp = (void(*)(usercmd_t *)) dlsym(reflib_library, "RW_IN_Move")) == NULL ||
(RW_IN_Frame_fp = (void(*)(void)) dlsym(reflib_library, "RW_IN_Frame")) == NULL)
Sys_Error("No RW_IN functions in REF.\n");
/* this one is optional */
RW_Sys_GetClipboardData_fp = dlsym(reflib_library, "RW_Sys_GetClipboardData");
RW_Sys_GetClipboardData_fp = (char*(*)(void)) dlsym(reflib_library, "RW_Sys_GetClipboardData");
Real_IN_Init();
@ -321,9 +321,9 @@ qboolean VID_LoadRefresh( char *name )
/* Init KBD */
#if 1
if ((KBD_Init_fp = dlsym(reflib_library, "KBD_Init")) == NULL ||
(KBD_Update_fp = dlsym(reflib_library, "KBD_Update")) == NULL ||
(KBD_Close_fp = dlsym(reflib_library, "KBD_Close")) == NULL)
if ((KBD_Init_fp = (void(*)(Key_Event_fp_t)) dlsym(reflib_library, "KBD_Init")) == NULL ||
(KBD_Update_fp = (void(*)(void)) dlsym(reflib_library, "KBD_Update")) == NULL ||
(KBD_Close_fp = (void(*)(void)) dlsym(reflib_library, "KBD_Close")) == NULL)
Sys_Error("No KBD functions in REF.\n");
#else
{

View file

@ -35,7 +35,7 @@ void GLimp_Shutdown( void )
{
}
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
}

View file

@ -39,7 +39,7 @@ void SWimp_Shutdown( void )
{
}
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
}

View file

@ -68,7 +68,7 @@ void Cmd_Wait_f (void)
sizebuf_t cmd_text;
byte cmd_text_buf[8192];
byte defer_text_buf[8192];
char defer_text_buf[8192];
/*
============

View file

@ -99,7 +99,7 @@ typedef struct image_s
int upload_width, upload_height; // after power of two and picmip
int registration_sequence; // 0 = free
struct msurface_s *texturechain; // for sort-by-texture world drawing
int texnum; // gl texture binding
GLuint texnum; // gl texture binding
float sl, tl, sh, th; // 0,0 - 1,1 unless part of the scrap
qboolean scrap;
qboolean has_alpha;
@ -402,11 +402,11 @@ void GL_DrawParticles (void);
typedef struct
{
int renderer;
const char *renderer_string;
const char *vendor_string;
const char *version_string;
const char *extensions_string;
int renderer;
const char * renderer_string;
const char * vendor_string;
const char * version_string;
const char * extensions_string;
qboolean allow_cds;
} glconfig_t;
@ -459,7 +459,7 @@ void GLimp_BeginFrame( float camera_separation );
void GLimp_EndFrame( void );
int GLimp_Init( void *hinstance, void *hWnd );
void GLimp_Shutdown( void );
int GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen );
int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen );
void GLimp_AppActivate( qboolean active );
void GLimp_EnableLogging( qboolean enable );
void GLimp_LogNewFrame( void );

View file

@ -1168,13 +1168,13 @@ qboolean R_Init( void *hinstance, void *hWnd )
/*
** get our various GL strings
*/
gl_config.vendor_string = qglGetString (GL_VENDOR);
gl_config.vendor_string = (char *) qglGetString (GL_VENDOR);
ri.Con_Printf (PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string );
gl_config.renderer_string = qglGetString (GL_RENDERER);
gl_config.renderer_string = (char *) qglGetString (GL_RENDERER);
ri.Con_Printf (PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string );
gl_config.version_string = qglGetString (GL_VERSION);
gl_config.version_string = (char *) qglGetString (GL_VERSION);
ri.Con_Printf (PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string );
gl_config.extensions_string = qglGetString (GL_EXTENSIONS);
gl_config.extensions_string = (char *) qglGetString (GL_EXTENSIONS);
ri.Con_Printf (PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string );
strcpy( renderer_buffer, gl_config.renderer_string );
@ -1270,8 +1270,8 @@ qboolean R_Init( void *hinstance, void *hWnd )
strstr( gl_config.extensions_string, "GL_SGI_compiled_vertex_array" ) )
{
ri.Con_Printf( PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n" );
qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" );
qglUnlockArraysEXT = ( void * ) qwglGetProcAddress( "glUnlockArraysEXT" );
qglLockArraysEXT = (void(APIENTRY*)(int,int)) qwglGetProcAddress( "glLockArraysEXT" );
qglUnlockArraysEXT = (void(APIENTRY*)(void)) qwglGetProcAddress( "glUnlockArraysEXT" );
}
else
{
@ -1335,7 +1335,7 @@ qboolean R_Init( void *hinstance, void *hWnd )
if ( gl_ext_palettedtexture->value )
{
ri.Con_Printf( PRINT_ALL, "...using GL_EXT_shared_texture_palette\n" );
qglColorTableEXT = qwglGetProcAddress( "glColorTableEXT" );
qglColorTableEXT = (void(APIENTRY*)(GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid*)) qwglGetProcAddress( "glColorTableEXT" );
}
else
{
@ -1352,9 +1352,9 @@ qboolean R_Init( void *hinstance, void *hWnd )
if ( gl_ext_multitexture->value )
{
ri.Con_Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" );
qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMultiTexCoord2fARB" );
qglActiveTextureARB = ( void * ) qwglGetProcAddress( "glActiveTextureARB" );
qglClientActiveTextureARB = ( void * ) qwglGetProcAddress( "glClientActiveTextureARB" );
qglMTexCoord2fSGIS = (void(APIENTRY*)(GLenum, GLfloat, GLfloat)) qwglGetProcAddress( "glMultiTexCoord2fARB" );
qglActiveTextureARB = (void(APIENTRY*)(GLenum)) qwglGetProcAddress( "glActiveTextureARB" );
qglClientActiveTextureARB = (void(APIENTRY*)(GLenum)) qwglGetProcAddress( "glClientActiveTextureARB" );
GL_Texture0 = GL_TEXTURE0_ARB;
GL_Texture1 = GL_TEXTURE1_ARB;
}
@ -1377,8 +1377,8 @@ qboolean R_Init( void *hinstance, void *hWnd )
else if ( gl_ext_multitexture->value )
{
ri.Con_Printf( PRINT_ALL, "...using GL_SGIS_multitexture\n" );
qglMTexCoord2fSGIS = ( void * ) qwglGetProcAddress( "glMTexCoord2fSGIS" );
qglSelectTextureSGIS = ( void * ) qwglGetProcAddress( "glSelectTextureSGIS" );
qglMTexCoord2fSGIS = (void(APIENTRY*)(GLenum, GLfloat, GLfloat)) qwglGetProcAddress( "glMTexCoord2fSGIS" );
qglSelectTextureSGIS = (void(APIENTRY*)(GLenum)) qwglGetProcAddress( "glSelectTextureSGIS" );
GL_Texture0 = GL_TEXTURE0_SGIS;
GL_Texture1 = GL_TEXTURE1_SGIS;
}

View file

@ -88,8 +88,7 @@ typedef struct
pixel_t *alphamap; // 256 * 256 translucency map
int rowbytes; // may be > width if displayed in a window
// can be negative for stupid dibs
int width;
int height;
unsigned int width, height;
} viddef_t;
typedef enum
@ -844,6 +843,6 @@ void SWimp_EndFrame (void);
int SWimp_Init( void *hInstance, void *wndProc );
void SWimp_SetPalette( const unsigned char *palette);
void SWimp_Shutdown( void );
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen );
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen );
void SWimp_AppActivate( qboolean active );

View file

@ -156,7 +156,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
/*
** GLimp_SetMode
*/
rserr_t GLimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
rserr_t GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
int width, height;
const char *win_fs[] = { "W", "FS" };

View file

@ -263,7 +263,7 @@ void SWimp_EndFrame (void)
/*
** SWimp_SetMode
*/
rserr_t SWimp_SetMode( int *pwidth, int *pheight, int mode, qboolean fullscreen )
rserr_t SWimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboolean fullscreen )
{
const char *win_fs[] = { "W", "FS" };
rserr_t retval = rserr_ok;