Browse Source

🚨 Clean up compiler warnings

pull/1549/head
Anders Jenbo 5 years ago
parent
commit
67a7ff98c5
  1. 2
      3rdParty/Storm/Source/storm.h
  2. 2
      CMakeLists.txt
  3. 2
      DiabloUI/diabloui.h
  4. 2
      Source/movie.cpp
  5. 2
      Source/msg.cpp
  6. 4
      Source/quests.cpp
  7. 2
      Source/setmaps.cpp
  8. 2
      Source/sound.cpp
  9. 2
      Source/trigs.cpp
  10. 4
      SourceX/DiabloUI/credits.cpp
  11. 2
      SourceX/DiabloUI/diabloui.cpp
  12. 8
      SourceX/DiabloUI/dialogs.cpp
  13. 2
      SourceX/DiabloUI/progress.cpp
  14. 2
      SourceX/DiabloUI/selhero.cpp
  15. 2
      SourceX/DiabloUI/ttf_render_wrapped.cpp
  16. 4
      SourceX/controls/controller_motion.cpp
  17. 2
      SourceX/controls/devices/game_controller.cpp
  18. 2
      SourceX/controls/devices/joystick.cpp
  19. 4
      SourceX/dvlnet/base_protocol.h
  20. 6
      SourceX/dvlnet/tcp_client.cpp
  21. 12
      SourceX/storm/storm.cpp
  22. 2
      SourceX/thread.cpp

2
3rdParty/Storm/Source/storm.h vendored

@ -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

2
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)

2
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);

2
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)) {

2
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();

4
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;
}
}

2
Source/setmaps.cpp

@ -196,6 +196,8 @@ void LoadSetMap()
DRLG_SetMapTrans("Levels\\L1Data\\Vile1.DUN");
InitNoTriggers();
break;
case SL_NONE:
break;
}
}

2
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*)

2
Source/trigs.cpp

@ -826,6 +826,8 @@ void CheckTrigForce()
case SL_POISONWATER:
trigflag = ForcePWaterTrig();
break;
default:
break;
}
}

4
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:

2
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);
}

8
SourceX/DiabloUI/dialogs.cpp

@ -260,16 +260,16 @@ void UiOkDialog(const char *text, const char *caption, bool error, std::vector<U
if (!gbActive || inDialog) {
if (SDL_ShowCursor(SDL_ENABLE) <= -1) {
SDL_Log(SDL_GetError());
SDL_Log("%s", SDL_GetError());
}
#ifndef RUN_TESTS
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, text, caption, NULL) <= -1) {
SDL_Log(SDL_GetError());
SDL_Log("%s", SDL_GetError());
#else
{
#endif
SDL_Log(text);
SDL_Log(caption);
SDL_Log("%s", text);
SDL_Log("%s", caption);
}
return;
}

2
SourceX/DiabloUI/progress.cpp

@ -88,7 +88,7 @@ void progress_Render(BYTE progress)
}
}
bool UiProgressDialog(const char *msg, int enable, int (*fnfunc)(), int rate)
bool UiProgressDialog(const char *msg, int (*fnfunc)(), int rate)
{
progress_Load(msg);
SetFadeLevel(256);

2
SourceX/DiabloUI/selhero.cpp

@ -537,7 +537,7 @@ static void UiSelHeroDialog(
} while (selhero_navigateYesNo);
*dlgresult = selhero_result;
snprintf(*name, sizeof(*name), selhero_heroInfo.name);
strncpy(*name, selhero_heroInfo.name, sizeof(*name));
}
void UiSelHeroSingDialog(

2
SourceX/DiabloUI/ttf_render_wrapped.cpp

@ -144,7 +144,7 @@ SDL_Surface *RenderUTF8_Solid_Wrapped(TTF_Font *font, const char *text, SDL_Colo
}
SDL_Surface *tmp = TTF_RenderUTF8_Solid(font, text, fg);
if (tmp == NULL) {
SDL_Log(TTF_GetError());
SDL_Log("%s", TTF_GetError());
SDL_FreeSurface(textbuf);
SDL_free(strLines);
SDL_stack_free(str);

4
SourceX/controls/controller_motion.cpp

@ -60,7 +60,7 @@ void ScaleJoystickAxes(float *x, float *y, float deadzone)
}
// SELECT + D-Pad to simulate right stick movement.
bool SimulateRightStickWithDpad(const SDL_Event &event, ControllerButtonEvent ctrl_event)
bool SimulateRightStickWithDpad(ControllerButtonEvent ctrl_event)
{
if (sgOptions.Controller.bDpadHotkeys)
return false;
@ -144,7 +144,7 @@ bool ProcessControllerMotion(const SDL_Event &event, ControllerButtonEvent ctrl_
if (ProcessKbCtrlAxisMotion(event))
return true;
#endif
return SimulateRightStickWithDpad(event, ctrl_event);
return SimulateRightStickWithDpad(ctrl_event);
}
AxisDirection GetLeftStickOrDpadDirection(bool allow_dpad)

2
SourceX/controls/devices/game_controller.cpp

@ -158,7 +158,7 @@ void GameController::Add(int joystick_index)
GameController result;
result.sdl_game_controller_ = SDL_GameControllerOpen(joystick_index);
if (result.sdl_game_controller_ == NULL) {
SDL_Log(SDL_GetError());
SDL_Log("%s", SDL_GetError());
SDL_ClearError();
return;
}

2
SourceX/controls/devices/joystick.cpp

@ -256,7 +256,7 @@ void Joystick::Add(int device_index)
SDL_JoystickNameForIndex(device_index));
result.sdl_joystick_ = SDL_JoystickOpen(device_index);
if (result.sdl_joystick_ == NULL) {
SDL_Log(SDL_GetError());
SDL_Log("%s", SDL_GetError());
SDL_ClearError();
return;
}

4
SourceX/dvlnet/base_protocol.h

@ -181,11 +181,11 @@ void base_protocol<P>::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;
}
}

6
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)

12
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);

2
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;

Loading…
Cancel
Save