osezer patch 010
authorDan Olson <theoddone33@icculus.org>
Thu, 24 Apr 2008 07:02:26 +0000 (00:02 -0700)
committerDan Olson <theoddone33@icculus.org>
Thu, 24 Apr 2008 07:02:26 +0000 (00:02 -0700)
fixed a bunch of -Wshadow warnings.

base/i_linux.c
base/oss.c
base/p_maputl.c
base/p_setup.c
base/r_main.c
base/sv_save.c
include/p_local.h
include/r_local.h
opengl/ogl_tex.c

index e0ee727..a87c059 100644 (file)
@@ -1324,7 +1324,7 @@ int             basejoyx, basejoyy;
 
 void I_StartupJoystick (void)
 {
-       int     centerx, centery;
+       int     center_x, center_y;
 
        joystickpresent = 0;
        if ( M_CheckParm ("-nojoy") || !usejoystick )
@@ -1343,22 +1343,22 @@ void I_StartupJoystick (void)
        if (!WaitJoyButton ())
                return;
        I_ReadJoystick ();
-       centerx = joystickx;
-       centery = joysticky;
+       center_x = joystickx;
+       center_y = joysticky;
 
        ST_RealMessage("\nPush the joystick to the UPPER LEFT corner and press button 1:");
        if (!WaitJoyButton ())
                return;
        I_ReadJoystick ();
-       joyxl = (centerx + joystickx)/2;
-       joyyl = (centerx + joysticky)/2;
+       joyxl = (center_x + joystickx)/2;
+       joyyl = (center_x + joysticky)/2;
 
        ST_RealMessage("\nPush the joystick to the LOWER RIGHT corner and press button 1:");
        if (!WaitJoyButton ())
                return;
        I_ReadJoystick ();
-       joyxh = (centerx + joystickx)/2;
-       joyyh = (centery + joysticky)/2;
+       joyxh = (center_x + joystickx)/2;
+       joyyh = (center_y + joysticky)/2;
        ST_RealMessage("\n");
 }
 
index b25d9bb..4d71bcb 100644 (file)
@@ -47,7 +47,7 @@ typedef unsigned long   gulong;
 
 #define min(x,y) ((x)<(y)?(x):(y))
 
-static int fd = 0;
+static int audio_fd = 0;
 static void* buffer;
 static gboolean going = FALSE, prebuffer = FALSE, remove_prebuffer = FALSE;
 static gboolean paused = FALSE, unpause = FALSE, do_pause = FALSE;
@@ -84,12 +84,12 @@ int oss_get_output_time(void)
        audio_buf_info buf_info;
        int bytes;
 
-       if (!fd || !going)
+       if (!audio_fd || !going)
                return 0;
 
        if (!paused)
        {
-               if (!ioctl(fd, SNDCTL_DSP_GETOSPACE, &buf_info))
+               if (!ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &buf_info))
                        bytes = output_bytes - ((buf_info.fragstotal - buf_info.fragments) * buf_info.fragsize);
                else
                        bytes = output_bytes;
@@ -119,7 +119,7 @@ int oss_playing(void)
        audio_buf_info buf_info;
        int bytes;
 
-       if (!ioctl(fd, SNDCTL_DSP_GETOSPACE, &buf_info))
+       if (!ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &buf_info))
                bytes = ((buf_info.fragstotal - buf_info.fragments - 3) * buf_info.fragsize);
        else
                bytes = 0;
@@ -173,7 +173,7 @@ int oss_downsample(guchar * ob, guint length, guint speed, guint espeed)
                        *ptr++ = obuffer[off >> 8];
                        off += d;
                }
-               w = write(fd, nbuffer, nlen << 2);
+               w = write(audio_fd, nbuffer, nlen << 2);
                free(nbuffer);
        }
        else if (((format == AFMT_U16_BE || format == AFMT_U16_LE || format == AFMT_S16_BE || format == AFMT_S16_LE) && channels == 1)
@@ -193,7 +193,7 @@ int oss_downsample(guchar * ob, guint length, guint speed, guint espeed)
                        *ptr++ = obuffer[off >> 8];
                        off += d;
                }
-               w = write(fd, nbuffer, nlen << 1);
+               w = write(audio_fd, nbuffer, nlen << 1);
                free(nbuffer);
        }
        else
@@ -211,7 +211,7 @@ int oss_downsample(guchar * ob, guint length, guint speed, guint espeed)
                        *ptr++ = obuffer[off >> 8];
                        off += d;
                }
-               w = write(fd, nbuffer, nlen);
+               w = write(audio_fd, nbuffer, nlen);
                free(nbuffer);
        }
        return w;
@@ -245,17 +245,17 @@ void oss_write(void *ptr, int length)
                        return;
 
                if (frequency == efrequency)
-                       w = write(fd, ptr, length);
+                       w = write(audio_fd, ptr, length);
                else
                        w = oss_downsample(ptr, length, frequency, efrequency);
 
                if (w == -1 && errno == EIO)
                {
-                       close(fd);
-                       fd = open(device_name, O_WRONLY);
+                       close(audio_fd);
+                       audio_fd = open(device_name, O_WRONLY);
                        oss_set_audio_params();
                        if (frequency == efrequency)
-                               w = write(fd, ptr, length);
+                               w = write(audio_fd, ptr, length);
                        else
                                w = oss_downsample(ptr, length, frequency, efrequency);
                }
@@ -274,8 +274,8 @@ void oss_close(void)
                pthread_join(buffer_thread, NULL);
        else
        {
-               ioctl(fd, SNDCTL_DSP_RESET, 0);
-               close(fd);
+               ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+               close(audio_fd);
        }
 }
 
@@ -289,9 +289,9 @@ void oss_flush(int time)
        }
        else
        {
-               ioctl(fd, SNDCTL_DSP_RESET, 0);
-               close(fd);
-               fd = open(device_name, O_WRONLY);
+               ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+               close(audio_fd);
+               audio_fd = open(device_name, O_WRONLY);
                oss_set_audio_params();
                output_time_offset = time;
                written = (time / 10) * (bps / 100);
@@ -332,16 +332,16 @@ void *oss_loop(void *arg)
                                cnt = min(length, buffer_size - rd_index);
 
                                if (frequency == efrequency)
-                                       w = write(fd, buffer + rd_index, cnt);
+                                       w = write(audio_fd, buffer + rd_index, cnt);
                                else
                                        w = oss_downsample(buffer + rd_index, cnt, frequency, efrequency);
                                if (w == -1 && errno == EIO)
                                {
-                                       close(fd);
-                                       fd = open(device_name, O_WRONLY);
+                                       close(audio_fd);
+                                       audio_fd = open(device_name, O_WRONLY);
                                        oss_set_audio_params();
                                        if (frequency == efrequency)
-                                               w = write(fd, buffer + rd_index, cnt);
+                                               w = write(audio_fd, buffer + rd_index, cnt);
                                        else
                                                w = oss_downsample(buffer + rd_index, cnt, frequency, efrequency);
                                }
@@ -350,7 +350,7 @@ void *oss_loop(void *arg)
                                length -= cnt;
                        }
 /*                     if (!oss_used())
-                               ioctl(fd, SNDCTL_DSP_POST, 0);*/
+                               ioctl(audio_fd, SNDCTL_DSP_POST, 0);*/
                }
                else
                        usleep( 10000 );
@@ -358,21 +358,21 @@ void *oss_loop(void *arg)
                {
                        do_pause = FALSE;
                        paused = TRUE;
-                       if (!ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info))
+                       if (!ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &abuf_info))
                        {
                                rd_index -= (abuf_info.fragstotal - abuf_info.fragments) * abuf_info.fragsize;
                                output_bytes -= (abuf_info.fragstotal - abuf_info.fragments) * abuf_info.fragsize;
                        }
                        if (rd_index < 0)
                                rd_index += buffer_size;
-                       ioctl(fd, SNDCTL_DSP_RESET, 0);
+                       ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
 
                }
                if (unpause && paused)
                {
                        unpause = FALSE;
-                       close(fd);
-                       fd = open(device_name, O_WRONLY);
+                       close(audio_fd);
+                       audio_fd = open(device_name, O_WRONLY);
                        oss_set_audio_params();
                        paused = FALSE;
                }
@@ -384,9 +384,9 @@ void *oss_loop(void *arg)
                         * cause the driver to get fucked up by a reset
                         */
 
-                       ioctl(fd, SNDCTL_DSP_RESET, 0);
-                       close(fd);
-                       fd = open(device_name, O_WRONLY);
+                       ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+                       close(audio_fd);
+                       audio_fd = open(device_name, O_WRONLY);
                        oss_set_audio_params();
                        output_time_offset = flush;
                        written = (flush / 10) * (bps / 100);
@@ -397,8 +397,8 @@ void *oss_loop(void *arg)
 
        }
 
-       ioctl(fd, SNDCTL_DSP_RESET, 0);
-       close(fd);
+       ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+       close(audio_fd);
        munlock( buffer, buffer_size );
        free(buffer);
        pthread_exit(NULL);
@@ -408,15 +408,15 @@ void oss_set_audio_params(void)
 {
        int frag, stereo;
 
-       ioctl(fd, SNDCTL_DSP_RESET, 0);
+       ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
        frag = (oss_cfg.fragment_count << 16) | fragsize;
-       ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag);
-       ioctl(fd, SNDCTL_DSP_SETFMT, &format);
+       ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag);
+       ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format);
        stereo = channels - 1;
-       ioctl(fd, SNDCTL_DSP_STEREO, &stereo);
+       ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo);
        efrequency = frequency;
-       ioctl(fd, SNDCTL_DSP_SPEED, &efrequency);
-       ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &blk_size);
+       ioctl(audio_fd, SNDCTL_DSP_SPEED, &efrequency);
+       ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &blk_size);
 
        ebps = efrequency * channels;
        if (format == AFMT_U16_BE || format == AFMT_U16_LE || format == AFMT_S16_BE || format == AFMT_S16_LE)
@@ -510,8 +510,8 @@ int oss_open(AFormat fmt, int rate, int nch)
        else
                strcpy( device_name, "/dev/dsp" );
 
-       fd = open(device_name, O_WRONLY);
-       if (fd == -1)
+       audio_fd = open(device_name, O_WRONLY);
+       if (audio_fd == -1)
        {
                free(buffer);
                return 0;
@@ -526,27 +526,27 @@ int oss_open(AFormat fmt, int rate, int nch)
 static void scan_devices( char* type )
 {
        FILE* file;
-       char buffer[256];
-    char* tmp2;
+       char buf[256];
+       char* tmp2;
        int found = 0;
        int index = 0;
 
-    printf( "%s\n", type );
+       printf( "%s\n", type );
 
        file = fopen( "/dev/sndstat", "r" );
        if( file )
        {
-               while (fgets(buffer, 255, file))
+               while (fgets(buf, 255, file))
                {
-                       if (found && buffer[0] == '\n')
+                       if (found && buf[0] == '\n')
                                break;
-                       if (buffer[strlen(buffer) - 1] == '\n')
-                               buffer[strlen(buffer) - 1] = '\0';
+                       if (buf[strlen(buf) - 1] == '\n')
+                               buf[strlen(buf) - 1] = '\0';
                        if (found)
                        {
                                if (index == 0)
                                {
-                                       tmp2 = strchr(buffer, ':');
+                                       tmp2 = strchr(buf, ':');
                                        if (tmp2)
                                        {
                                                tmp2++;
@@ -554,16 +554,16 @@ static void scan_devices( char* type )
                                                        tmp2++;
                                        }
                                        else
-                                               tmp2 = buffer;
+                                               tmp2 = buf;
 
                                        printf( "  %s (default)\n", tmp2 );
                                }
                                else
-                {
-                                       printf( "  %s\n", buffer );
-                }
+                               {
+                                       printf( "  %s\n", buf );
+                               }
                        }
-                       if( ! strcasecmp(buffer, type) )
+                       if( ! strcasecmp(buf, type) )
                                found = 1;
                }
                fclose(file);
index a0573dc..861d27a 100644 (file)
@@ -248,18 +248,18 @@ float   frac, num, den, v1x,v1y,v1dx,v1dy,v2x,v2y,v2dx,v2dy;
 fixed_t opentop, openbottom, openrange;
 fixed_t lowfloor;
 
-void P_LineOpening (line_t *linedef)
+void P_LineOpening (line_t *ld)
 {
        sector_t        *front, *back;
 
-       if (linedef->sidenum[1] == -1)
+       if (ld->sidenum[1] == -1)
        {       // single sided line
                openrange = 0;
                return;
        }
 
-       front = linedef->frontsector;
-       back = linedef->backsector;
+       front = ld->frontsector;
+       back = ld->backsector;
 
        if (front->ceilingheight < back->ceilingheight)
                opentop = front->ceilingheight;
index 6bec2a1..835d9af 100644 (file)
@@ -196,7 +196,7 @@ void P_LoadSegs (int lump)
        mapseg_t        *ml;
        seg_t           *li;
        line_t  *ldef;
-       int                     linedef, side;
+       int                     _linedef, side;
 
        numsegs = W_LumpLength (lump) / sizeof(mapseg_t);
        segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0);
@@ -212,8 +212,8 @@ void P_LoadSegs (int lump)
 
                li->angle = (SHORT(ml->angle))<<16;
                li->offset = (SHORT(ml->offset))<<16;
-               linedef = SHORT(ml->linedef);
-               ldef = &lines[linedef];
+               _linedef = SHORT(ml->linedef);
+               ldef = &lines[_linedef];
                li->linedef = ldef;
                side = SHORT(ml->side);
                li->sidedef = &sides[ldef->sidenum[side]];
index 54c07ce..342a2e4 100644 (file)
@@ -523,7 +523,7 @@ void R_InitTextureMapping (void)
 
 void R_InitLightTables (void)
 {
-       int             i,j, level, startmap;
+       int             i, j, level, start_map;
        int             scale;
 
 //
@@ -531,12 +531,12 @@ void R_InitLightTables (void)
 //
        for (i=0 ; i< LIGHTLEVELS ; i++)
        {
-               startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
+               start_map = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
                for (j=0 ; j<MAXLIGHTZ ; j++)
                {
                        scale = FixedDiv ((SCREENWIDTH/2*FRACUNIT), (j+1)<<LIGHTZSHIFT);
                        scale >>= LIGHTSCALESHIFT;
-                       level = startmap - scale/DISTMAP;
+                       level = start_map - scale/DISTMAP;
                        if (level < 0)
                                level = 0;
                        if (level >= NUMCOLORMAPS)
@@ -579,7 +579,7 @@ void R_SetViewSize (int blocks, int detail)
 void R_ExecuteSetViewSize (void)
 {
        fixed_t cosadj, dy;
-       int             i,j, level, startmap;
+       int             i, j, level, start_map;
 
        setsizeneeded = false;
 
@@ -661,10 +661,10 @@ void R_ExecuteSetViewSize (void)
 //
        for (i=0 ; i< LIGHTLEVELS ; i++)
        {
-               startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
+               start_map = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS;
                for (j=0 ; j<MAXLIGHTSCALE ; j++)
                {
-                       level = startmap - j*SCREENWIDTH/(viewwidth<<detailshift)/DISTMAP;
+                       level = start_map - j*SCREENWIDTH/(viewwidth<<detailshift)/DISTMAP;
                        if (level < 0)
                                level = 0;
                        if (level >= NUMCOLORMAPS)
index 41d5b79..58d9c81 100644 (file)
@@ -369,7 +369,7 @@ void SV_LoadGame(int slot)
        SavePtr.b = SaveBuffer+HXS_DESCRIPTION_LENGTH;
 
        // Check the version text
-       if(strcmp(SavePtr.b, HXS_VERSION_TEXT))
+       if(strcmp((char *)SavePtr.b, HXS_VERSION_TEXT))
        { // Bad version
                return;
        }
index b7e4801..c6c4057 100644 (file)
@@ -216,7 +216,7 @@ int     P_BoxOnLineSide (fixed_t *tmbox, line_t *ld);
 
 extern  fixed_t opentop, openbottom, openrange;
 extern  fixed_t lowfloor;
-void    P_LineOpening (line_t *linedef);
+void    P_LineOpening (line_t *ld);
 
 boolean P_BlockLinesIterator (int x, int y, boolean(*func)(line_t*) );
 boolean P_BlockThingsIterator (int x, int y, boolean(*func)(mobj_t*) );
index 0d9c77c..18540f2 100644 (file)
@@ -362,7 +362,6 @@ extern  angle_t         rw_normalangle;
 //
 extern  int                             viewwidth, viewheight, viewwindowx, viewwindowy;
 extern  int                             centerx, centery;
-extern  int                             flyheight;
 extern  fixed_t                 centerxfrac;
 extern  fixed_t                 centeryfrac;
 extern  fixed_t                 projection;
index 8e89dbd..bb3d1e2 100644 (file)
@@ -602,9 +602,9 @@ void OGL_SetRawImage(int lump, int part)
                // Do a special fill for textures with h<200 (part 0).
                if(/*lumpinfo[lump].size/320 < 200 &&*/ !part)
                {
-                       int lines = lumpinfo[lump].size/320;
+                       int _lines = lumpinfo[lump].size/320;
                        // Copy the missing data from the beginning.
-                       memcpy(dat1+lines*256*3, dat1, 3*256*(256-lines));
+                       memcpy(dat1 + _lines*256*3, dat1, 3*256*(256 - _lines));
                }
                        
                // Generate and load the textures.
@@ -851,16 +851,16 @@ void OGL_UpdateTexParams(int mipmode)
 void OGL_UpdateRawScreenParams(int smoothing)
 {
        int             i;
-       int             glmode = (smoothing)? GL_LINEAR : GL_NEAREST;
+       int             _glmode = (smoothing)? GL_LINEAR : GL_NEAREST;
 
        for(i=0; i<numrawlumps; i++)
        {
                // First part 1.
                glBindTexture(GL_TEXTURE_2D, lumptexnames[rawlumps[i]]);
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmode);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glmode);
                // Then part 2.
                glBindTexture(GL_TEXTURE_2D, lumptexnames2[rawlumps[i]]);
-               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glmode);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _glmode);
        }
 }