From 67a7ff98c5af5700c73b710500a1eab6b2e04c85 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 15 Apr 2021 13:25:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20Clean=20up=20compiler=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdParty/Storm/Source/storm.h | 2 +- CMakeLists.txt | 2 +- DiabloUI/diabloui.h | 2 +- Source/movie.cpp | 2 +- Source/msg.cpp | 2 +- Source/quests.cpp | 4 ++++ Source/setmaps.cpp | 2 ++ Source/sound.cpp | 2 +- Source/trigs.cpp | 2 ++ SourceX/DiabloUI/credits.cpp | 4 ++-- SourceX/DiabloUI/diabloui.cpp | 2 +- SourceX/DiabloUI/dialogs.cpp | 8 ++++---- SourceX/DiabloUI/progress.cpp | 2 +- SourceX/DiabloUI/selhero.cpp | 2 +- SourceX/DiabloUI/ttf_render_wrapped.cpp | 2 +- SourceX/controls/controller_motion.cpp | 4 ++-- SourceX/controls/devices/game_controller.cpp | 2 +- SourceX/controls/devices/joystick.cpp | 2 +- SourceX/dvlnet/base_protocol.h | 4 ++-- SourceX/dvlnet/tcp_client.cpp | 6 +++--- SourceX/storm/storm.cpp | 12 ++++++------ SourceX/thread.cpp | 2 +- 22 files changed, 40 insertions(+), 32 deletions(-) diff --git a/3rdParty/Storm/Source/storm.h b/3rdParty/Storm/Source/storm.h index 9fd7d66f6..965fdb250 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/3rdParty/Storm/Source/storm.h @@ -281,7 +281,7 @@ int getIniInt(const char *keyname, const char *valuename, int defaultValue); void setIniInt(const char *keyname, const char *valuename, int value); void setIniFloat(const char *keyname, const char *valuename, float value); -void SVidPlayBegin(const char *filename, int a2, int a3, int a4, int a5, int flags, HANDLE *video); +void SVidPlayBegin(const char *filename, int flags, HANDLE *video); void SVidPlayEnd(HANDLE video); /* SErrGetLastError @ 463 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ecc750c9..37e27c3ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -669,7 +669,7 @@ if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_compile_options(devilution PUBLIC $<${DEBUG_GENEX}:-fno-omit-frame-pointer>) # Warnings for devilutionX - target_compile_options(${BIN_TARGET} PRIVATE -Wall -Wextra -Wno-unused-parameter -Wno-format-security) + target_compile_options(${BIN_TARGET} PRIVATE -Wall -Wextra -Wno-unused-parameter) # For ARM and other default unsigned char platforms target_compile_options(devilution PRIVATE -fsigned-char) diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h index c10a754bd..28f369a47 100644 --- a/DiabloUI/diabloui.h +++ b/DiabloUI/diabloui.h @@ -55,7 +55,7 @@ void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool bool UiCreditsDialog(); bool UiSupportDialog(); bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, void (*fnSound)(const char *file), int attractTimeOut); -bool UiProgressDialog(const char *msg, int enable, int (*fnfunc)(), int rate); +bool UiProgressDialog(const char *msg, int (*fnfunc)(), int rate); void UiProfileCallback(); void UiProfileDraw(); bool UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); diff --git a/Source/movie.cpp b/Source/movie.cpp index 80086a668..1c26404c9 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -28,7 +28,7 @@ void play_movie(const char *pszMovie, bool user_can_close) stream_stop(); effects_play_sound("Sfx\\Misc\\blank.wav"); - SVidPlayBegin(pszMovie, 0, 0, 0, 0, loop_movie ? 0x100C0808 : 0x10280808, &video_stream); + SVidPlayBegin(pszMovie, loop_movie ? 0x100C0808 : 0x10280808, &video_stream); MSG Msg; while (video_stream && movie_playing) { while (movie_playing && FetchMessage(&Msg)) { diff --git a/Source/msg.cpp b/Source/msg.cpp index 5e1d78d99..28ca8b2b2 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -152,7 +152,7 @@ bool msg_wait_resync() sgbRecvCmd = CMD_DLEVEL_END; gbBufferMsgs = 1; sgdwOwnerWait = SDL_GetTicks(); - success = UiProgressDialog("Waiting for game data...", 1, msg_wait_for_turns, 20); + success = UiProgressDialog("Waiting for game data...", msg_wait_for_turns, 20); gbBufferMsgs = 0; if (!success) { msg_free_packets(); diff --git a/Source/quests.cpp b/Source/quests.cpp index 88fc03a62..b4068c5c9 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -653,6 +653,8 @@ void SetReturnLvlPos() ReturnLvl = quests[Q_SCHAMB]._qlevel; ReturnLvlT = DTYPE_CATACOMBS; break; + case SL_MAZE: + break; case SL_POISONWATER: ReturnLvlX = quests[Q_PWATER]._qtx; ReturnLvlY = quests[Q_PWATER]._qty + 1; @@ -665,6 +667,8 @@ void SetReturnLvlPos() ReturnLvl = quests[Q_BETRAYER]._qlevel; ReturnLvlT = DTYPE_HELL; break; + case SL_NONE: + break; } } diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 6a6e47bf2..f6adb4619 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -196,6 +196,8 @@ void LoadSetMap() DRLG_SetMapTrans("Levels\\L1Data\\Vile1.DUN"); InitNoTriggers(); break; + case SL_NONE: + break; } } diff --git a/Source/sound.cpp b/Source/sound.cpp index a7b41d053..4e0f381f7 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -171,7 +171,7 @@ void snd_init() int result = Mix_OpenAudio(22050, AUDIO_S16LSB, 2, 1024); if (result < 0) { - SDL_Log(Mix_GetError()); + SDL_Log("%s", Mix_GetError()); } Mix_AllocateChannels(25); Mix_ReserveChannels(1); // reserve one channel for naration (SFileDda*) diff --git a/Source/trigs.cpp b/Source/trigs.cpp index 356193de7..84703107a 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -826,6 +826,8 @@ void CheckTrigForce() case SL_POISONWATER: trigflag = ForcePWaterTrig(); break; + default: + break; } } diff --git a/SourceX/DiabloUI/credits.cpp b/SourceX/DiabloUI/credits.cpp index 76090d51c..828008b55 100644 --- a/SourceX/DiabloUI/credits.cpp +++ b/SourceX/DiabloUI/credits.cpp @@ -57,7 +57,7 @@ SDL_Surface *RenderText(const char *text, SDL_Color color) return NULL; SDL_Surface *result = TTF_RenderUTF8_Solid(font, text, color); if (result == NULL) - SDL_Log(TTF_GetError()); + SDL_Log("%s", TTF_GetError()); return result; } @@ -79,7 +79,7 @@ CachedLine PrepareLine(std::size_t index) const SDL_Color &text_color = palette->colors[224]; SDL_Color colors[3] = { mask_color, text_color, shadow_color }; if (SDLC_SetSurfaceColors(surface.get(), colors, 0, 3) <= -1) - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); SDLC_SetColorKey(surface.get(), 0); // Blit the shadow first: diff --git a/SourceX/DiabloUI/diabloui.cpp b/SourceX/DiabloUI/diabloui.cpp index fa7f4ff26..5fd825c50 100644 --- a/SourceX/DiabloUI/diabloui.cpp +++ b/SourceX/DiabloUI/diabloui.cpp @@ -305,7 +305,7 @@ void UiFocusNavigation(SDL_Event *event) if (SDL_GetModState() & KMOD_CTRL) { char *clipboard = SDL_GetClipboardText(); if (clipboard == NULL) { - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); } else { selhero_CatToName(clipboard, UiTextInput, UiTextInputLen); } diff --git a/SourceX/DiabloUI/dialogs.cpp b/SourceX/DiabloUI/dialogs.cpp index 41b9809c9..e3f62c081 100644 --- a/SourceX/DiabloUI/dialogs.cpp +++ b/SourceX/DiabloUI/dialogs.cpp @@ -260,16 +260,16 @@ void UiOkDialog(const char *text, const char *caption, bool error, std::vector::recv() } catch (packet_exception &e) { // drop packet proto.disconnect(sender); - SDL_Log(e.what()); + SDL_Log("%s", e.what()); } } } catch (std::exception &e) { - SDL_Log(e.what()); + SDL_Log("%s", e.what()); return; } } diff --git a/SourceX/dvlnet/tcp_client.cpp b/SourceX/dvlnet/tcp_client.cpp index 30702f1af..414da2f69 100644 --- a/SourceX/dvlnet/tcp_client.cpp +++ b/SourceX/dvlnet/tcp_client.cpp @@ -21,7 +21,7 @@ int tcp_client::create(std::string addrstr, std::string passwd) local_server.reset(new tcp_server(ioc, addrstr, port, passwd)); return join(local_server->localhost_self(), passwd); } catch (std::system_error &e) { - SDL_SetError(e.what()); + SDL_SetError("%s", e.what()); return -1; } } @@ -39,7 +39,7 @@ int tcp_client::join(std::string addrstr, std::string passwd) asio::ip::tcp::no_delay option(true); sock.set_option(option); } catch (std::exception &e) { - SDL_SetError(e.what()); + SDL_SetError("%s", e.what()); return -1; } start_recv(); @@ -54,7 +54,7 @@ int tcp_client::join(std::string addrstr, std::string passwd) try { poll(); } catch (const std::runtime_error &e) { - SDL_SetError(e.what()); + SDL_SetError("%s", e.what()); return -1; } if (plr_self != PLR_BROADCAST) diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index b0a77aa03..d17abebd3 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -373,7 +373,7 @@ static bool HaveAudio() void SVidRestartMixer() { if (Mix_OpenAudio(22050, AUDIO_S16LSB, 2, 1024) < 0) { - SDL_Log(Mix_GetError()); + SDL_Log("%s", Mix_GetError()); } Mix_AllocateChannels(25); Mix_ReserveChannels(1); @@ -469,7 +469,7 @@ private: static AudioQueue *sVidAudioQueue = new AudioQueue(); #endif -void SVidPlayBegin(const char *filename, int a2, int a3, int a4, int a5, int flags, HANDLE *video) +void SVidPlayBegin(const char *filename, int flags, HANDLE *video) { if (flags & 0x10000 || flags & 0x20000000) { return; @@ -668,7 +668,7 @@ bool SVidPlayContinue(void) memcpy(logical_palette, orig_palette, sizeof(logical_palette)); if (SDLC_SetSurfaceAndPaletteColors(SVidSurface, SVidPalette, colors, 0, 256) <= -1) { - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); return false; } } @@ -682,7 +682,7 @@ bool SVidPlayContinue(void) unsigned char *audio = SVidApplyVolume(smk_get_audio(SVidSMK, 0), len); #if SDL_VERSION_ATLEAST(2, 0, 4) if (SDL_QueueAudio(deviceId, audio, len) <= -1) { - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); return false; } #else @@ -698,7 +698,7 @@ bool SVidPlayContinue(void) #ifndef USE_SDL1 if (renderer) { if (SDL_BlitSurface(SVidSurface, NULL, GetOutputSurface(), NULL) <= -1) { - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); return false; } } else @@ -731,7 +731,7 @@ bool SVidPlayContinue(void) SDL_Surface *tmp = SDL_ConvertSurfaceFormat(SVidSurface, format, 0); #endif if (SDL_BlitScaled(tmp, NULL, output_surface, &pal_surface_offset) <= -1) { - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); return false; } SDL_FreeSurface(tmp); diff --git a/SourceX/thread.cpp b/SourceX/thread.cpp index f9626c3b3..a70b473a2 100644 --- a/SourceX/thread.cpp +++ b/SourceX/thread.cpp @@ -69,7 +69,7 @@ int WaitForEvent(event_emul *e) } int ret = SDL_CondWait(e->cond, e->mutex); if (ret <= -1 || SDL_CondSignal(e->cond) <= -1 || SDL_UnlockMutex(e->mutex) <= -1) { - SDL_Log(SDL_GetError()); + SDL_Log("%s", SDL_GetError()); return -1; } return ret;