fixed rest of the strict-aliasing and uninitialized use warnings.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@367 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2011-01-01 14:05:20 +00:00
parent 9289a26a88
commit 3281636a96
5 changed files with 74 additions and 55 deletions

View file

@ -586,13 +586,13 @@ void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom)
{
static int oldtop = -2;
static int oldbottom = -2;
gltexture_t *glt;
if (top != oldtop || bottom != oldbottom)
{
glpic_t *p = (glpic_t *)pic->data;
gltexture_t *glt = p->gltexture;
oldtop = top;
oldbottom = bottom;
glt = ((glpic_t *)pic->data)->gltexture;
TexMgr_ReloadImage (glt, top, bottom);
}
Draw_Pic (x, y, pic);

View file

@ -784,6 +784,7 @@ void R_RenderView (void)
if (!cl.worldmodel)
Sys_Error ("R_RenderView: NULL worldmodel");
time1 = 0; /* avoid compiler warning */
if (r_speeds.value)
{
glFinish ();

View file

@ -427,8 +427,6 @@ TexMgr_LoadPalette -- johnfitz -- was VID_SetPalette, moved here, renamed, rewri
*/
void TexMgr_LoadPalette (void)
{
byte mask[] = {255,255,255,0};
byte black[] = {0,0,0,255};
byte *pal, *src, *dst;
int i, mark;
FILE *f;
@ -452,7 +450,7 @@ void TexMgr_LoadPalette (void)
*dst++ = *src++;
*dst++ = 255;
}
d_8to24table[255] &= *(int *)mask;
((byte *) &d_8to24table[255]) [3] = 0;
//fullbright palette, 0-223 are black (for additive blending)
src = pal + 224*3;
@ -465,7 +463,11 @@ void TexMgr_LoadPalette (void)
*dst++ = 255;
}
for (i=0; i<224; i++)
d_8to24table_fbright[i] = *(int *)black;
{
dst = (byte *) &d_8to24table_fbright[i];
dst[3] = 255;
dst[2] = dst[1] = dst[0] = 0;
}
//nobright palette, 224-255 are black (for additive blending)
dst = (byte *)d_8to24table_nobright;
@ -478,11 +480,15 @@ void TexMgr_LoadPalette (void)
*dst++ = 255;
}
for (i=224; i<256; i++)
d_8to24table_nobright[i] = *(int *)black;
{
dst = (byte *) &d_8to24table_nobright[i];
dst[3] = 255;
dst[2] = dst[1] = dst[0] = 0;
}
//conchars palette, 0 and 255 are transparent
memcpy(d_8to24table_conchars, d_8to24table, 256*4);
d_8to24table_conchars[0] &= *(int *)mask;
((byte *) &d_8to24table_conchars[0]) [3] = 0;
Hunk_FreeToLowMark (mark);
}
@ -1149,6 +1155,8 @@ gltexture_t *TexMgr_LoadImage (model_t *owner, const char *name, int width, int
case SRC_RGBA:
crc = CRC_Block(data, width * height * 4);
break;
default: /* not reachable but avoids compiler warnings */
crc = 0;
}
if ((flags & TEXPREF_OVERWRITE) && (glt = TexMgr_FindTexture (owner, name)))
{

View file

@ -196,24 +196,24 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height)
switch (targa_header.pixel_size)
{
case 24:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = 255;
break;
blue = getc(fin);
green = getc(fin);
red = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = 255;
break;
case 32:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
break;
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
break;
}
}
}
@ -236,17 +236,19 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height)
switch (targa_header.pixel_size)
{
case 24:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = 255;
break;
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = 255;
break;
case 32:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
break;
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
break;
default: /* avoid compiler warnings */
blue = red = green = alphabyte = 0;
}
for(j=0;j<packetSize;j++)
@ -277,24 +279,26 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height)
switch (targa_header.pixel_size)
{
case 24:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = 255;
break;
blue = getc(fin);
green = getc(fin);
red = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = 255;
break;
case 32:
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
break;
blue = getc(fin);
green = getc(fin);
red = getc(fin);
alphabyte = getc(fin);
*pixbuf++ = red;
*pixbuf++ = green;
*pixbuf++ = blue;
*pixbuf++ = alphabyte;
break;
default: /* avoid compiler warnings */
blue = red = green = alphabyte = 0;
}
column++;
if (column==columns) // pixel packet run spans across rows

View file

@ -820,7 +820,7 @@ void R_DrawParticles (void)
particle_t *p;
float scale;
vec3_t up, right, p_up, p_right, p_upright; //johnfitz -- p_ vectors
byte color[4]; //johnfitz -- particle transparency
GLubyte color[4], *c; //johnfitz -- particle transparency
extern cvar_t r_particles; //johnfitz
//float alpha; //johnfitz -- particle transparency
@ -854,7 +854,10 @@ void R_DrawParticles (void)
scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
//johnfitz -- particle transparency and fade out
*(int *)color = d_8to24table[(int)p->color];
c = (GLubyte *) &d_8to24table[(int)p->color];
color[0] = c[0];
color[1] = c[1];
color[2] = c[2];
//alpha = CLAMP(0, p->die + 0.5 - cl.time, 1);
color[3] = 255; //(int)(alpha * 255);
glColor4ubv(color);
@ -896,7 +899,10 @@ void R_DrawParticles (void)
scale *= texturescalefactor; //johnfitz -- compensate for apparent size of different particle textures
//johnfitz -- particle transparency and fade out
*(int *)color = d_8to24table[(int)p->color];
c = (GLubyte *) &d_8to24table[(int)p->color];
color[0] = c[0];
color[1] = c[1];
color[2] = c[2];
//alpha = CLAMP(0, p->die + 0.5 - cl.time, 1);
color[3] = 255; //(int)(alpha * 255);
glColor4ubv(color);