From d8884b845ecad6985b0551d3bd2d4295a6d0c42a Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 1 Nov 2022 13:10:46 +0100
Subject: [PATCH] emscripten: fix warnings in tests
---
test/loopwave.c | 3 ++-
test/testgles2.c | 2 ++
test/testoffscreen.c | 4 ++++
test/testviewport.c | 4 ++--
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/test/loopwave.c b/test/loopwave.c
index 354ac2cb7bee..1b5fa95f0e6b 100644
--- a/test/loopwave.c
+++ b/test/loopwave.c
@@ -70,12 +70,13 @@ open_audio()
SDL_PauseAudioDevice(device, SDL_FALSE);
}
+#ifndef __EMSCRIPTEN__
static void reopen_audio()
{
close_audio();
open_audio();
}
-
+#endif
void SDLCALL
fillerup(void *unused, Uint8 * stream, int len)
diff --git a/test/testgles2.c b/test/testgles2.c
index b5c0ec8838bd..721c24b7f2b7 100644
--- a/test/testgles2.c
+++ b/test/testgles2.c
@@ -472,6 +472,7 @@ render_window(int index)
++frames;
}
+#ifndef __EMSCRIPTEN__
static int SDLCALL
render_thread_fn(void* render_ctx)
{
@@ -512,6 +513,7 @@ loop_threaded()
SDLTest_CommonEvent(state, &event, &done);
}
}
+#endif
static void
loop()
diff --git a/test/testoffscreen.c b/test/testoffscreen.c
index e5fd72107c8a..e2a8f4b68bce 100644
--- a/test/testoffscreen.c
+++ b/test/testoffscreen.c
@@ -100,7 +100,9 @@ loop()
int
main(int argc, char *argv[])
{
+#ifndef __EMSCRIPTEN__
Uint32 then, now, frames;
+#endif
/* Enable standard application logging */
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
@@ -135,10 +137,12 @@ main(int argc, char *argv[])
srand((unsigned int)time(NULL));
+#ifndef __EMSCRIPTEN__
/* Main render loop */
frames = 0;
then = SDL_GetTicks();
done = 0;
+#endif
SDL_Log("Rendering %u frames offscreen\n", max_frames);
diff --git a/test/testviewport.c b/test/testviewport.c
index 162b31069a54..ad5faf77a7f9 100644
--- a/test/testviewport.c
+++ b/test/testviewport.c
@@ -99,14 +99,14 @@ DrawOnViewport(SDL_Renderer * renderer)
void
loop()
{
+ SDL_Event event;
+ int i;
#ifdef __EMSCRIPTEN__
/* Avoid using delays */
if(SDL_GetTicks() - wait_start < 1000)
return;
wait_start = SDL_GetTicks();
#endif
- SDL_Event event;
- int i;
/* Check for events */
while (SDL_PollEvent(&event)) {
SDLTest_CommonEvent(state, &event, &done);