Commit 570768f62703b8ea5abf3232c1a5b4f73d419549

Christian Rauch 2021-03-26T22:52:30

test: fix shadowing variables

diff --git a/test/testdrawchessboard.c b/test/testdrawchessboard.c
index 7a11439..b16e61a 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 7310fa5..b2b5232 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 ff7b7e6..6afac49 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 b5c237d..539ba0c 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 d0d5287..6d10249 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 e50b4fb..9a0975f 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 279b5a4..0c8f255 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) {