shithub: m8c

Download patch

ref: 3a71fc7783ba652072beacd37abce5197cf431a6
parent: a4e93e180f339a2af400474fdfbf28329e2239f0
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Fri Apr 18 19:04:47 EDT 2025

fix clang warnings

--- a/src/backends/audio_sdl.c
+++ b/src/backends/audio_sdl.c
@@ -25,7 +25,9 @@
     audio_close();
     return;
   }
-  if (bytes_available == 0) { return; }
+  if (bytes_available == 0) {
+    return;
+  }
 
   Uint8 *src_audio_data = SDL_malloc(bytes_available);
   if (!src_audio_data) { // check allocation
--- a/src/gamepads.c
+++ b/src/gamepads.c
@@ -44,7 +44,7 @@
   // Try to load the game controller database file
   char db_filename[2048] = {0};
   if (snprintf(db_filename, sizeof(db_filename), "%sgamecontrollerdb.txt",
-               SDL_GetPrefPath("", "m8c")) >= sizeof(db_filename)) {
+               SDL_GetPrefPath("", "m8c")) >= (int)sizeof(db_filename)) {
     SDL_LogError(SDL_LOG_CATEGORY_INPUT, "Path too long for buffer");
     return -1;
   }
--- a/src/main.c
+++ b/src/main.c
@@ -54,8 +54,6 @@
         ctx->device_connected = 1;
         screensaver_destroy();
         screensaver_initialized = 0;
-        // renderer_clear_screen();
-        SDL_Log("Device connected.");
         SDL_Delay(100);     // Give the device time to initialize
         m8_reset_display(); // Avoid display glitches.
       } else {
@@ -92,7 +90,7 @@
 
   config_params_s conf = config_initialize(*config_filename);
 #ifndef TARGET_OS_IOS
-  // It's not possible to edit the config on iOS so let's just go with the defaults
+  // It's not possible to edit the config on iOS, so let's go with the defaults
   config_read(&conf);
 #endif
   return conf;
@@ -201,7 +199,7 @@
       audio_initialize(ctx->conf.audio_device_name, ctx->conf.audio_buffer_size);
     }
     ctx->app_state = RUN;
-    SDL_Delay(100);     // Give the device time to initialize
+    SDL_Delay(100); // Give the device time to initialize
     m8_reset_display(); // Avoid display glitches.
   } else {
     SDL_LogCritical(SDL_LOG_CATEGORY_ERROR, "Device not detected.");
@@ -213,6 +211,8 @@
 }
 
 void SDL_AppQuit(void *appstate, SDL_AppResult result) {
+  (void)result; // Suppress compiler warning
+
   struct app_context *app = appstate;
 
   if (app) {
--