From ab4c4a3830245db3d5e131736e2b556ee24729bf Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Thu, 9 Aug 2012 14:14:41 -0400 Subject: [PATCH] Removed some unused variables that gcc 4.6.1 complains about. --- src/SDL_hints.c | 5 ++- src/audio/SDL_audio.c | 8 ----- src/audio/SDL_wave.c | 6 ++-- src/haptic/SDL_haptic.c | 3 +- src/joystick/linux/SDL_sysjoystick.c | 3 +- src/render/SDL_render.c | 12 +------ src/render/software/SDL_rotate.c | 4 +-- src/video/SDL_RLEaccel.c | 5 +-- src/video/SDL_bmp.c | 53 +++++++++++++--------------- src/video/SDL_stretch.c | 2 -- 10 files changed, 33 insertions(+), 68 deletions(-) diff --git a/src/SDL_hints.c b/src/SDL_hints.c index b472f5322..72fd6c230 100755 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -57,7 +57,7 @@ SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority) { const char *env; - SDL_Hint *prev, *hint; + SDL_Hint *hint; if (!name || !value) { return SDL_FALSE; @@ -68,8 +68,7 @@ SDL_SetHintWithPriority(const char *name, const char *value, return SDL_FALSE; } - prev = NULL; - for (hint = SDL_hints; hint; prev = hint, hint = hint->next) { + for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { if (priority < hint->priority) { return SDL_FALSE; diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 6c95e816e..8b62cc74d 100755 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -314,7 +314,6 @@ SDL_RunAudio(void *devicep) int stream_len; void *udata; void (SDLCALL * fill) (void *userdata, Uint8 * stream, int len); - int silence; Uint32 delay; /* For streaming when the buffer sizes don't match up */ Uint8 *istream; @@ -335,12 +334,6 @@ SDL_RunAudio(void *devicep) device->use_streamer = 0; if (device->convert.needed) { - if (device->convert.src_format == AUDIO_U8) { - silence = 0x80; - } else { - silence = 0; - } - #if 0 /* !!! FIXME: I took len_div out of the structure. Use rate_incr instead? */ /* If the result of the conversion alters the length, i.e. resampling is being used, use the streamer */ if (device->convert.len_mult != 1 || device->convert.len_div != 1) { @@ -367,7 +360,6 @@ SDL_RunAudio(void *devicep) /* stream_len = device->convert.len; */ stream_len = device->spec.size; } else { - silence = device->spec.silence; stream_len = device->spec.size; } diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index d6df07bbe..9c6acc0d0 100755 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -49,7 +49,6 @@ static int InitMS_ADPCM(WaveFMT * format) { Uint8 *rogue_feel; - Uint16 extra_info; int i; /* Set the rogue pointer to the MS_ADPCM specific data */ @@ -62,7 +61,7 @@ InitMS_ADPCM(WaveFMT * format) SDL_SwapLE16(format->bitspersample); rogue_feel = (Uint8 *) format + sizeof(*format); if (sizeof(*format) == 16) { - extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); + /*const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);*/ rogue_feel += sizeof(Uint16); } MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]); @@ -233,7 +232,6 @@ static int InitIMA_ADPCM(WaveFMT * format) { Uint8 *rogue_feel; - Uint16 extra_info; /* Set the rogue pointer to the IMA_ADPCM specific data */ IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); @@ -245,7 +243,7 @@ InitIMA_ADPCM(WaveFMT * format) SDL_SwapLE16(format->bitspersample); rogue_feel = (Uint8 *) format + sizeof(*format); if (sizeof(*format) == 16) { - extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]); + /*const Uint16 extra_info = ((rogue_feel[1] << 8) | rogue_feel[0]);*/ rogue_feel += sizeof(Uint16); } IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1] << 8) | rogue_feel[0]); diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index 2ab4cbf4d..ae2ccebfa 100755 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -766,7 +766,6 @@ SDL_HapticRumbleInit(SDL_Haptic * haptic) int SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length) { - int ret; SDL_HapticPeriodic *efx; if (!ValidHaptic(haptic)) { @@ -790,7 +789,7 @@ SDL_HapticRumblePlay(SDL_Haptic * haptic, float strength, Uint32 length) efx = &haptic->rumble_effect.periodic; efx->magnitude = (Sint16)(32767.0f*strength); efx->length = length; - ret = SDL_HapticUpdateEffect(haptic, haptic->rumble_id, &haptic->rumble_effect); + SDL_HapticUpdateEffect(haptic, haptic->rumble_id, &haptic->rumble_effect); return SDL_HapticRunEffect(haptic, haptic->rumble_id, 1); } diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 934ca0549..1649eb636 100755 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -582,7 +582,7 @@ JS_ConfigJoystick(SDL_Joystick * joystick, int fd) { SDL_bool handled; unsigned char n; - int old_axes, tmp_naxes, tmp_nhats, tmp_nballs; + int tmp_naxes, tmp_nhats, tmp_nballs; const char *name; char *env, env_name[128]; int i; @@ -602,7 +602,6 @@ JS_ConfigJoystick(SDL_Joystick * joystick, int fd) } name = SDL_SYS_JoystickName(joystick->index); - old_axes = joystick->naxes; /* Generic analog joystick support */ if (SDL_strstr(name, "Analog") == name && SDL_strstr(name, "-hat")) { diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 05b02a070..ae10b8340 100755 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -546,11 +546,8 @@ int SDL_GetTextureColorMod(SDL_Texture * texture, Uint8 * r, Uint8 * g, Uint8 * b) { - SDL_Renderer *renderer; - CHECK_TEXTURE_MAGIC(texture, -1); - renderer = texture->renderer; if (r) { *r = texture->r; } @@ -1173,7 +1170,6 @@ int SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect) { - SDL_Window *window; SDL_Rect real_srcrect; SDL_Rect real_dstrect; @@ -1184,7 +1180,6 @@ SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, SDL_SetError("Texture was not created with this renderer"); return -1; } - window = renderer->window; real_srcrect.x = 0; real_srcrect.y = 0; @@ -1237,7 +1232,6 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_Rect * dstrect, const double angle, const SDL_Point *center, const SDL_RendererFlip flip) { - SDL_Window *window; SDL_Rect real_srcrect, real_dstrect; SDL_Point real_center; @@ -1253,8 +1247,6 @@ SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - window = renderer->window; - real_srcrect.x = 0; real_srcrect.y = 0; real_srcrect.w = texture->w; @@ -1291,7 +1283,6 @@ int SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void * pixels, int pitch) { - SDL_Window *window; SDL_Rect real_rect; CHECK_RENDERER_MAGIC(renderer, -1); @@ -1300,10 +1291,9 @@ SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Unsupported(); return -1; } - window = renderer->window; if (!format) { - format = SDL_GetWindowPixelFormat(window); + format = SDL_GetWindowPixelFormat(renderer->window); } real_rect.x = renderer->viewport.x; diff --git a/src/render/software/SDL_rotate.c b/src/render/software/SDL_rotate.c index b64f137ab..2eae0393f 100644 --- a/src/render/software/SDL_rotate.c +++ b/src/render/software/SDL_rotate.c @@ -272,7 +272,7 @@ Assumes dst surface was allocated with the correct dimensions. */ void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy) { - int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay, sw, sh; + int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay; tColorY *pc, *sp; int gap; @@ -283,8 +283,6 @@ void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int yd = ((src->h - dst->h) << 15); ax = (cx << 16) - (icos * cx); ay = (cy << 16) - (isin * cx); - sw = src->w - 1; - sh = src->h - 1; pc = (tColorY*) dst->pixels; gap = dst->pitch - dst->w; /* diff --git a/src/video/SDL_RLEaccel.c b/src/video/SDL_RLEaccel.c index 40fe95719..8554a5652 100755 --- a/src/video/SDL_RLEaccel.c +++ b/src/video/SDL_RLEaccel.c @@ -1270,9 +1270,8 @@ RLEColorkeySurface(SDL_Surface * surface) Uint8 *rlebuf, *dst; int maxn; int y; - Uint8 *srcbuf, *curbuf, *lastline; + Uint8 *srcbuf, *lastline; int maxsize = 0; - int skip, run; int bpp = surface->format->BytesPerPixel; getpix_func getpix; Uint32 ckey, rgbmask; @@ -1306,9 +1305,7 @@ RLEColorkeySurface(SDL_Surface * surface) /* Set up the conversion */ srcbuf = (Uint8 *) surface->pixels; - curbuf = srcbuf; maxn = bpp == 4 ? 65535 : 255; - skip = run = 0; dst = rlebuf; rgbmask = ~surface->format->Amask; ckey = surface->map->info.colorkey & rgbmask; diff --git a/src/video/SDL_bmp.c b/src/video/SDL_bmp.c index c31d022f0..f4a7f6140 100755 --- a/src/video/SDL_bmp.c +++ b/src/video/SDL_bmp.c @@ -67,23 +67,23 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) /* The Win32 BMP file header (14 bytes) */ char magic[2]; - Uint32 bfSize; - Uint16 bfReserved1; - Uint16 bfReserved2; - Uint32 bfOffBits; + /*Uint32 bfSize = 0;*/ + /*Uint16 bfReserved1 = 0;*/ + /*Uint16 bfReserved2 = 0;*/ + Uint32 bfOffBits = 0; /* The Win32 BITMAPINFOHEADER struct (40 bytes) */ - Uint32 biSize; - Sint32 biWidth; - Sint32 biHeight; - Uint16 biPlanes; - Uint16 biBitCount; - Uint32 biCompression; - Uint32 biSizeImage; - Sint32 biXPelsPerMeter; - Sint32 biYPelsPerMeter; - Uint32 biClrUsed; - Uint32 biClrImportant; + Uint32 biSize = 0; + Sint32 biWidth = 0; + Sint32 biHeight = 0; + /*Uint16 biPlanes = 0;*/ + Uint16 biBitCount = 0; + Uint32 biCompression = 0; + /*Uint32 biSizeImage = 0;*/ + /*Sint32 biXPelsPerMeter = 0;*/ + /*Sint32 biYPelsPerMeter = 0;*/ + Uint32 biClrUsed = 0; + /*Uint32 biClrImportant = 0;*/ /* Make sure we are passed a valid data source */ surface = NULL; @@ -106,9 +106,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) was_error = SDL_TRUE; goto done; } - bfSize = SDL_ReadLE32(src); - bfReserved1 = SDL_ReadLE16(src); - bfReserved2 = SDL_ReadLE16(src); + /*bfSize =*/ SDL_ReadLE32(src); + /*bfReserved1 =*/ SDL_ReadLE16(src); + /*bfReserved2 =*/ SDL_ReadLE16(src); bfOffBits = SDL_ReadLE32(src); /* Read the Win32 BITMAPINFOHEADER */ @@ -116,25 +116,20 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) if (biSize == 12) { biWidth = (Uint32) SDL_ReadLE16(src); biHeight = (Uint32) SDL_ReadLE16(src); - biPlanes = SDL_ReadLE16(src); + /*biPlanes =*/ SDL_ReadLE16(src); biBitCount = SDL_ReadLE16(src); biCompression = BI_RGB; - biSizeImage = 0; - biXPelsPerMeter = 0; - biYPelsPerMeter = 0; - biClrUsed = 0; - biClrImportant = 0; } else { biWidth = SDL_ReadLE32(src); biHeight = SDL_ReadLE32(src); - biPlanes = SDL_ReadLE16(src); + /*biPlanes =*/ SDL_ReadLE16(src); biBitCount = SDL_ReadLE16(src); biCompression = SDL_ReadLE32(src); - biSizeImage = SDL_ReadLE32(src); - biXPelsPerMeter = SDL_ReadLE32(src); - biYPelsPerMeter = SDL_ReadLE32(src); + /*biSizeImage =*/ SDL_ReadLE32(src); + /*biXPelsPerMeter =*/ SDL_ReadLE32(src); + /*biYPelsPerMeter =*/ SDL_ReadLE32(src); biClrUsed = SDL_ReadLE32(src); - biClrImportant = SDL_ReadLE32(src); + /*biClrImportant =*/ SDL_ReadLE32(src); } if (biHeight < 0) { topDown = SDL_TRUE; diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index 6f8084519..f64d47766 100755 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -209,7 +209,6 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, int src_locked; int dst_locked; int pos, inc; - int dst_width; int dst_maxrow; int src_row, dst_row; Uint8 *srcp = NULL; @@ -286,7 +285,6 @@ SDL_SoftStretch(SDL_Surface * src, const SDL_Rect * srcrect, inc = (srcrect->h << 16) / dstrect->h; src_row = srcrect->y; dst_row = dstrect->y; - dst_width = dstrect->w * bpp; #ifdef USE_ASM_STRETCH /* Write the opcodes for this stretch */