From 570768f62703b8ea5abf3232c1a5b4f73d419549 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Fri, 26 Mar 2021 22:52:30 +0000 Subject: [PATCH] test: fix shadowing variables --- test/testdrawchessboard.c | 4 ++-- test/testmultiaudio.c | 10 +++++----- test/testoverlay2.c | 1 - test/testrelative.c | 6 +++--- test/testspriteminimal.c | 8 ++++---- test/teststreaming.c | 4 ++-- test/testviewport.c | 4 ++-- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c index 7a11439b1..b16e61ab9 100644 --- a/test/testdrawchessboard.c +++ b/test/testdrawchessboard.c @@ -29,7 +29,7 @@ SDL_Surface *surface; int done; void -DrawChessBoard(SDL_Renderer * renderer) +DrawChessBoard() { int row = 0,column = 0,x = 0; SDL_Rect rect, darea; @@ -90,7 +90,7 @@ loop() } } - DrawChessBoard(renderer); + DrawChessBoard(); /* Got everything on rendering surface, now Update the drawing image on window screen */ diff --git a/test/testmultiaudio.c b/test/testmultiaudio.c index 7310fa5f5..b2b52326e 100644 --- a/test/testmultiaudio.c +++ b/test/testmultiaudio.c @@ -33,20 +33,20 @@ callback_data cbd[64]; void SDLCALL play_through_once(void *arg, Uint8 * stream, int len) { - callback_data *cbd = (callback_data *) arg; - Uint8 *waveptr = sound + cbd->soundpos; - int waveleft = soundlen - cbd->soundpos; + callback_data *cbdata = (callback_data *) arg; + Uint8 *waveptr = sound + cbdata->soundpos; + int waveleft = soundlen - cbdata->soundpos; int cpy = len; if (cpy > waveleft) cpy = waveleft; SDL_memcpy(stream, waveptr, cpy); len -= cpy; - cbd->soundpos += cpy; + cbdata->soundpos += cpy; if (len > 0) { stream += cpy; SDL_memset(stream, spec.silence, len); - SDL_AtomicSet(&cbd->done, 1); + SDL_AtomicSet(&cbdata->done, 1); } } diff --git a/test/testoverlay2.c b/test/testoverlay2.c index ff7b7e6c6..6afac4940 100644 --- a/test/testoverlay2.c +++ b/test/testoverlay2.c @@ -144,7 +144,6 @@ SDL_Texture *MooseTexture; SDL_Rect displayrect; int window_w; int window_h; -SDL_Window *window; SDL_Renderer *renderer; int paused = 0; int i; diff --git a/test/testrelative.c b/test/testrelative.c index b5c237d3b..539ba0c48 100644 --- a/test/testrelative.c +++ b/test/testrelative.c @@ -28,10 +28,10 @@ SDL_Rect rect; SDL_Event event; static void -DrawRects(SDL_Renderer * renderer, SDL_Rect * rect) +DrawRects(SDL_Renderer * renderer) { SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255); - SDL_RenderFillRect(renderer, rect); + SDL_RenderFillRect(renderer, &rect); } static void @@ -63,7 +63,7 @@ loop(){ if (rect.x > viewport.x + viewport.w) rect.x -= viewport.w; if (rect.y > viewport.y + viewport.h) rect.y -= viewport.h; - DrawRects(renderer, &rect); + DrawRects(renderer); SDL_RenderPresent(renderer); } diff --git a/test/testspriteminimal.c b/test/testspriteminimal.c index d0d528782..6d1024967 100644 --- a/test/testspriteminimal.c +++ b/test/testspriteminimal.c @@ -43,7 +43,7 @@ quit(int rc) } int -LoadSprite(char *file, SDL_Renderer *renderer) +LoadSprite(char *file) { SDL_Surface *temp; @@ -92,7 +92,7 @@ LoadSprite(char *file, SDL_Renderer *renderer) } void -MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite) +MoveSprites() { int i; int window_w = WINDOW_WIDTH; @@ -136,7 +136,7 @@ void loop() done = 1; } } - MoveSprites(renderer, sprite); + MoveSprites(); #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); @@ -158,7 +158,7 @@ main(int argc, char *argv[]) quit(2); } - if (LoadSprite("icon.bmp", renderer) < 0) { + if (LoadSprite("icon.bmp") < 0) { quit(2); } diff --git a/test/teststreaming.c b/test/teststreaming.c index e50b4fbc5..9a0975fa8 100644 --- a/test/teststreaming.c +++ b/test/teststreaming.c @@ -67,7 +67,7 @@ void quit(int rc) exit(rc); } -void UpdateTexture(SDL_Texture *texture, int frame) +void UpdateTexture(SDL_Texture *texture) { SDL_Color *color; Uint8 *src; @@ -110,7 +110,7 @@ loop() } frame = (frame + 1) % MOOSEFRAMES_COUNT; - UpdateTexture(MooseTexture, frame); + UpdateTexture(MooseTexture); SDL_RenderClear(renderer); SDL_RenderCopy(renderer, MooseTexture, NULL, NULL); diff --git a/test/testviewport.c b/test/testviewport.c index 279b5a43c..0c8f25541 100644 --- a/test/testviewport.c +++ b/test/testviewport.c @@ -92,7 +92,7 @@ LoadSprite(char *file, SDL_Renderer *renderer) } void -DrawOnViewport(SDL_Renderer * renderer, SDL_Rect viewport) +DrawOnViewport(SDL_Renderer * renderer) { SDL_Rect rect; @@ -174,7 +174,7 @@ loop() continue; /* Draw using viewport */ - DrawOnViewport(state->renderers[i], viewport); + DrawOnViewport(state->renderers[i]); /* Update the screen! */ if (use_target) {