From c4b246410d7b1388045d0a49cb6a6f216858c51c Mon Sep 17 00:00:00 2001 From: Vitaly Novichkov Date: Sun, 25 Mar 2018 00:04:17 +0300 Subject: MSVC warning muter and remove `sstream` usage --- src/adlmidi.cpp | 21 ++++++--------------- src/adlmidi_private.hpp | 8 +++++++- 2 files changed, 13 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/adlmidi.cpp b/src/adlmidi.cpp index 3b21436..586cb90 100644 --- a/src/adlmidi.cpp +++ b/src/adlmidi.cpp @@ -107,13 +107,9 @@ ADLMIDI_EXPORT int adl_setBank(ADL_MIDIPlayer *device, int bank) MIDIplay *play = reinterpret_cast(device->adl_midiPlayer); if(static_cast(bankno) >= NumBanks) { - #ifndef __WATCOMC__ - std::stringstream s; - s << "bank number may only be 0.." << (NumBanks - 1) << ".\n"; - play->setErrorString(s.str()); - #else - play->setErrorString("Selected embedded bank is not exists!\n"); - #endif + char errBuf[150]; + std::snprintf(errBuf, 150, "Embedded bank number may only be 0..%u!\n", (NumBanks - 1)); + play->setErrorString(errBuf); return -1; } @@ -142,14 +138,9 @@ ADLMIDI_EXPORT int adl_setNumFourOpsChn(ADL_MIDIPlayer *device, int ops4) MIDIplay *play = reinterpret_cast(device->adl_midiPlayer); if((unsigned int)ops4 > 6 * play->m_setup.NumCards) { - #ifndef __WATCOMC__ - std::stringstream s; - s << "number of four-op channels may only be 0.." << (6 * (play->m_setup.NumCards)) << " when " << play->m_setup.NumCards << " OPL3 cards are used.\n"; - play->setErrorString(s.str()); - #else - play->setErrorString("number of four-op channels may not be more than 6 channels per each OPL3 chip!\n"); - #endif - + char errBuff[250]; + std::snprintf(errBuff, 250, "number of four-op channels may only be 0..%u when %u OPL3 cards are used.\n", (6 * (play->m_setup.NumCards)), play->m_setup.NumCards); + play->setErrorString(errBuff); return -1; } diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 8b2bf19..8f0c657 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -75,7 +75,6 @@ typedef int32_t ssize_t; #include #include #include -#include //#ifdef __WATCOMC__ //#include //TODO: Implemnet a workaround for OpenWatcom to fix a crash while using those containers //#include @@ -105,6 +104,13 @@ typedef int32_t ssize_t; #include #include +#ifdef _MSC_VER +#pragma warning(disable:4319) +#pragma warning(disable:4267) +#pragma warning(disable:4244) +#pragma warning(disable:4146) +#endif + #include "fraction.hpp" #ifndef ADLMIDI_HW_OPL -- cgit v1.2.3