Silence various Visual Studio warnings:
* Fix the ones in my code where I could use a proper type or valid casts.
* Ignore the designer-time and compiler-time warnings in vendor code or in my code where I am unable to suppress them via casting.
(Most of these were ignored already before introducing the CMake scripts, because they were in vendor code or were annoying to deal with.)
--- a/src/in_2sf/CMakeLists.txt
+++ b/src/in_2sf/CMakeLists.txt
@@ -117,6 +117,8 @@
add_library(in_2sf SHARED ${HEADERS} ${SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCES})
+target_compile_options(in_2sf PUBLIC
+ $<$<CXX_COMPILER_ID:MSVC>:/wd4018 /wd4100 /wd4146 /wd4127 /wd4189 /wd4201 /wd4245 /wd4456 /wd4459 /wd4701 /wd4703 /wd4706 /wd4996 /wd6001 /wd6011 /wd6297 /wd6308 /wd6385 /wd6386 /wd26454 /wd26495 /wd26812 /wd26819 /wd28112>)
target_link_libraries(in_2sf
in_xsf_framework)
--- a/src/in_2sf/XSFConfig_2SF.cpp
+++ b/src/in_2sf/XSFConfig_2SF.cpp
@@ -45,7 +45,7 @@
void About(HWND parent);
};
-unsigned XSFConfig::initSampleRate = DESMUME_SAMPLE_RATE;
+unsigned XSFConfig::initSampleRate = static_cast<unsigned>(DESMUME_SAMPLE_RATE);
std::string XSFConfig::commonName = "2SF Decoder";
std::string XSFConfig::versionNumber = "0.9b";
unsigned XSFConfig_2SF::initInterpolation = 2;
@@ -58,7 +58,7 @@
XSFConfig_2SF::XSFConfig_2SF() : XSFConfig(), interpolation(0), mutes()
{
- this->supportedSampleRates.push_back(DESMUME_SAMPLE_RATE);
+ this->supportedSampleRates.push_back(static_cast<unsigned>(DESMUME_SAMPLE_RATE));
}
void XSFConfig_2SF::LoadSpecificConfig()
--- a/src/in_2sf/XSFPlayer_2SF.cpp
+++ b/src/in_2sf/XSFPlayer_2SF.cpp
@@ -214,7 +214,7 @@
if (NDS_Init())
return false;
- static const int BUFFERSIZE = DESMUME_SAMPLE_RATE / 59.837; // truncates to 737, the traditional value, for 44100
+ static const int BUFFERSIZE = static_cast<int>(DESMUME_SAMPLE_RATE / 59.837); // truncates to 737, the traditional value, for 44100
SPU_ChangeSoundCore(SNDIFID_2SF, BUFFERSIZE);
execute = false;
--- a/src/in_gsf/CMakeLists.txt
+++ b/src/in_gsf/CMakeLists.txt
@@ -30,6 +30,8 @@
add_library(in_gsf SHARED ${HEADERS} ${SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCES})
+target_compile_options(in_gsf PUBLIC
+ $<$<CXX_COMPILER_ID:MSVC>:/wd4127 /wd4189 /wd26495 /wd26812>)
target_link_libraries(in_gsf
in_xsf_framework)
--- a/src/in_ncsf/CMakeLists.txt
+++ b/src/in_ncsf/CMakeLists.txt
@@ -40,6 +40,8 @@
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADERS})
source_group("Resource Files" FILES ${RESOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCES})
+target_compile_options(in_ncsf PUBLIC
+ $<$<CXX_COMPILER_ID:MSVC>:/wd6011 /wd6385 /wd26819>)
target_link_libraries(in_ncsf
in_xsf_framework)
--- a/src/in_ncsf/SSEQPlayer/Channel.cpp
+++ b/src/in_ncsf/SSEQPlayer/Channel.cpp
@@ -90,7 +90,7 @@
finalVol += Cnv_Sust(trk.expr);
if (finalVol < -AMPL_K)
finalVol = -AMPL_K;
- this->extAmpl = finalVol;
+ this->extAmpl = static_cast<std::int16_t>(finalVol);
}
// Original FSS Function: Chn_UpdatePan
@@ -526,7 +526,7 @@
std::uint32_t counter = this->modCounter + (this->modSpeed << 6);
while (counter >= 0x8000)
counter -= 0x8000;
- this->modCounter = counter;
+ this->modCounter = static_cast<std::uint16_t>(counter);
}
if (bTmrNeedUpdate)
@@ -574,7 +574,7 @@
else if (totalVol < AMPL_K - 60)
cr |= SOUND_VOLDIV(1);
- this->vol = ((cr & SOUND_VOL(0x7F)) << 4) >> calcVolDivShift((cr & SOUND_VOLDIV(3)) >> 8);
+ this->vol = static_cast<std::uint16_t>(((cr & SOUND_VOL(0x7F)) << 4) >> calcVolDivShift((cr & SOUND_VOLDIV(3)) >> 8));
this->flags.reset(ToIntegral(ChannelFlag::UpdateVolume));
}
--- a/src/in_ncsf/SSEQPlayer/Channel.h
+++ b/src/in_ncsf/SSEQPlayer/Channel.h
@@ -106,11 +106,11 @@
RingBuffer() : bufferPos(N / 2), getPos(N / 2)
{
- std::fill_n(&this->buffer[0], N * 2, 0);
+ std::fill_n(&this->buffer[0], N * 2, static_cast<std::int16_t>(0));
}
void Clear()
{
- std::fill_n(&this->buffer[0], N * 2, 0);
+ std::fill_n(&this->buffer[0], N * 2, static_cast<std::int16_t>(0));
this->bufferPos = this->getPos = N / 2;
}
void PushSample(std::int16_t sample)
--- a/src/in_ncsf/SSEQPlayer/INFOEntry.cpp
+++ b/src/in_ncsf/SSEQPlayer/INFOEntry.cpp
@@ -29,7 +29,7 @@
INFOEntryBANK::INFOEntryBANK() : fileID(0)
{
- std::fill_n(&this->waveArc[0], 4, 0);
+ std::fill_n(&this->waveArc[0], 4, static_cast<std::uint16_t>(0));
}
void INFOEntryBANK::Read(PseudoFile &file)
--- a/src/in_ncsf/SSEQPlayer/NDSStdHeader.cpp
+++ b/src/in_ncsf/SSEQPlayer/NDSStdHeader.cpp
@@ -14,7 +14,7 @@
NDSStdHeader::NDSStdHeader() : magic(0)
{
- std::fill_n(&this->type[0], 4, 0);
+ std::fill_n(&this->type[0], 4, static_cast<std::int8_t>(0));
}
void NDSStdHeader::Read(PseudoFile &file)
--- a/src/in_ncsf/SSEQPlayer/Player.cpp
+++ b/src/in_ncsf/SSEQPlayer/Player.cpp
@@ -17,13 +17,13 @@
Player::Player() : prio(0), nTracks(0), tempo(0), tempoCount(0), tempoRate(0), masterVol(0), sseqVol(0), sseq(nullptr), allowedChannels(0), sampleRate(0),
interpolation(Interpolation::None)
{
- std::fill_n(&this->trackIds[0], FSS_TRACKCOUNT, 0);
+ std::fill_n(&this->trackIds[0], FSS_TRACKCOUNT, static_cast<std::uint8_t>(0));
for (std::int8_t i = 0; i < 16; ++i)
{
this->channels[i].chnId = i;
this->channels[i].ply = this;
}
- std::fill_n(&this->variables[0], 32, -1);
+ std::fill_n(&this->variables[0], 32, static_cast<std::int16_t>(-1));
}
// Original FSS Function: Player_Setup
@@ -34,10 +34,10 @@
int firstTrack = this->TrackAlloc();
if (firstTrack == -1)
return false;
- this->tracks[firstTrack].Init(firstTrack, this, nullptr, 0);
+ this->tracks[firstTrack].Init(static_cast<std::uint8_t>(firstTrack), this, nullptr, 0);
this->nTracks = 1;
- this->trackIds[0] = firstTrack;
+ this->trackIds[0] = static_cast<std::uint8_t>(firstTrack);
this->tracks[firstTrack].startPos = this->tracks[firstTrack].pos = &this->sseq->data[0];
@@ -53,7 +53,7 @@
this->tempoCount = 0;
this->tempoRate = 0x100;
this->masterVol = 0; // this is actually the highest level
- std::fill_n(&this->variables[0], 32, -1);
+ std::fill_n(&this->variables[0], 32, static_cast<std::int16_t>(-1));
}
// Original FSS Function: Player_FreeTracks
--- a/src/in_ncsf/SSEQPlayer/SBNK.cpp
+++ b/src/in_ncsf/SSEQPlayer/SBNK.cpp
@@ -13,7 +13,7 @@
#include "SBNK.h"
#include "common.h"
-SBNKInstrument::SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType) : lowNote(lowerNote), highNote(upperNote),
+SBNKInstrument::SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, std::uint16_t recordType) : lowNote(lowerNote), highNote(upperNote),
record(recordType), swav(0), swar(0), noteNumber(0), attackRate(0), decayRate(0), sustainLevel(0), releaseRate(0), pan(0)
{
}
--- a/src/in_ncsf/SSEQPlayer/SBNK.h
+++ b/src/in_ncsf/SSEQPlayer/SBNK.h
@@ -30,7 +30,7 @@
std::uint8_t releaseRate;
std::uint8_t pan;
- SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, int recordType);
+ SBNKInstrument(std::uint8_t lowerNote, std::uint8_t upperNote, std::uint16_t recordType);
void Read(PseudoFile &file);
};
--- a/src/in_ncsf/SSEQPlayer/SWAV.cpp
+++ b/src/in_ncsf/SSEQPlayer/SWAV.cpp
@@ -75,11 +75,11 @@
{
std::int32_t nibble = origData[i + 4] & 0x0F;
DecodeADPCMNibble(nibble, stepIndex, predictedValue);
- finalData[2 * i] = predictedValue;
+ finalData[2 * i] = static_cast<std::int16_t>(predictedValue);
nibble = (origData[i + 4] >> 4) & 0x0F;
DecodeADPCMNibble(nibble, stepIndex, predictedValue);
- finalData[2 * i + 1] = predictedValue;
+ finalData[2 * i + 1] = static_cast<std::int16_t>(predictedValue);
}
}
--- a/src/in_ncsf/SSEQPlayer/Track.cpp
+++ b/src/in_ncsf/SSEQPlayer/Track.cpp
@@ -26,7 +26,7 @@
}
// Original FSS Function: Player_InitTrack
-void Track::Init(std::uint8_t handle, Player *player, const std::uint8_t *dataPos, int n)
+void Track::Init(std::uint8_t handle, Player *player, const std::uint8_t *dataPos, std::uint8_t n)
{
this->trackId = handle;
this->num = n;
@@ -46,7 +46,7 @@
this->startPos = this->pos = nullptr;
std::fill_n(&this->stack[0], FSS_TRACKSTACKSIZE, StackValue());
this->stackPos = 0;
- std::fill_n(&this->loopCount[0], FSS_TRACKSTACKSIZE, 0);
+ std::fill_n(&this->loopCount[0], FSS_TRACKSTACKSIZE, static_cast<std::uint8_t>(0));
this->overriding() = false;
this->lastComparisonResult = true;
@@ -105,7 +105,7 @@
}
// Original FSS Function: Note_On
-int Track::NoteOn(int key, int vel, int len)
+int Track::NoteOn(std::uint8_t key, int vel, int len)
{
auto sbnk = this->ply->sseq->bank;
@@ -172,7 +172,7 @@
chn = &this->ply->channels[nCh];
chn->tempReg.CR = SOUND_FORMAT_PSG | SCHANNEL_ENABLE | SOUND_DUTY(noteDef->swav & 0x7);
}
- chn->tempReg.TIMER = -SOUND_FREQ(262 * 8); // key #60 (C4)
+ chn->tempReg.TIMER = static_cast<std::uint16_t>(-SOUND_FREQ(262 * 8)); // key #60 (C4)
chn->reg.samplePosition = -1;
chn->reg.psgX = 0x7FFF;
}
@@ -223,7 +223,7 @@
}
// Original FSS Function: Note_On_Tie
-int Track::NoteOnTie(int key, int vel)
+int Track::NoteOnTie(std::uint8_t key, int vel)
{
// Find an existing note
int i;
@@ -518,9 +518,9 @@
if (cmd < 0x80)
{
// Note on
- int key = cmd + this->transpose;
- int vel = this->overriding.val(pData, read8, true);
- int len = this->overriding.val(pData, readvl);
+ std::uint8_t key = static_cast<std::uint8_t>(cmd + this->transpose);
+ int vel = this->overriding.val<std::uint8_t>(pData, read8, true);
+ int len = this->overriding.val<int>(pData, readvl);
if (this->state[ToIntegral(TrackState::NoteWait)])
this->wait = len;
if (this->state[ToIntegral(TrackState::TieBit)])
@@ -539,23 +539,23 @@
case SSEQCommand::OpenTrack:
{
- int tNum = read8(pData);
+ std::uint8_t tNum = read8(pData);
auto trackPos = &this->ply->sseq->data[read24(pData)];
int newTrack = this->ply->TrackAlloc();
if (newTrack != -1)
{
- this->ply->tracks[newTrack].Init(newTrack, this->ply, trackPos, tNum);
- this->ply->trackIds[this->ply->nTracks++] = newTrack;
+ this->ply->tracks[newTrack].Init(static_cast<std::uint8_t>(newTrack), this->ply, trackPos, tNum);
+ this->ply->trackIds[this->ply->nTracks++] = static_cast<std::uint8_t>(newTrack);
}
break;
}
case SSEQCommand::Rest:
- this->wait = this->overriding.val(pData, readvl);
+ this->wait = this->overriding.val<int>(pData, readvl);
break;
case SSEQCommand::Patch:
- this->patch = this->overriding.val(pData, readvl);
+ this->patch = this->overriding.val<std::uint16_t>(pData, readvl);
break;
case SSEQCommand::Goto:
@@ -578,23 +578,23 @@
break;
case SSEQCommand::Pan:
- this->pan = this->overriding.val(pData, read8) - 64;
+ this->pan = this->overriding.val<std::uint8_t>(pData, read8) - 64;
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Pan));
break;
case SSEQCommand::Volume:
- this->vol = this->overriding.val(pData, read8);
+ this->vol = this->overriding.val<std::uint8_t>(pData, read8);
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Volume));
break;
case SSEQCommand::MasterVolume:
- this->ply->masterVol = Cnv_Sust(this->overriding.val(pData, read8));
+ this->ply->masterVol = Cnv_Sust(this->overriding.val<std::uint8_t>(pData, read8));
for (std::uint8_t i = 0; i < this->ply->nTracks; ++i)
this->ply->tracks[this->ply->trackIds[i]].updateFlags.set(ToIntegral(TrackUpdateFlag::Volume));
break;
case SSEQCommand::Priority:
- this->prio = this->ply->prio + read8(pData);
+ this->prio = static_cast<std::uint8_t>(this->ply->prio + read8(pData));
// Update here?
break;
@@ -608,7 +608,7 @@
break;
case SSEQCommand::Expression:
- this->expr = this->overriding.val(pData, read8);
+ this->expr = this->overriding.val<std::uint8_t>(pData, read8);
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Volume));
break;
@@ -621,10 +621,10 @@
return;
case SSEQCommand::LoopStart:
- value = this->overriding.val(pData, read8);
+ value = this->overriding.val<std::uint8_t>(pData, read8);
if (this->stackPos < FSS_TRACKSTACKSIZE)
{
- this->loopCount[this->stackPos] = value;
+ this->loopCount[this->stackPos] = static_cast<std::uint8_t>(value);
this->stack[this->stackPos++] = StackValue(StackType::Loop, *pData);
}
break;
@@ -647,11 +647,11 @@
//-----------------------------------------------------------------
case SSEQCommand::Transpose:
- this->transpose = this->overriding.val(pData, read8);
+ this->transpose = this->overriding.val<std::int8_t>(pData, read8);
break;
case SSEQCommand::PitchBend:
- this->pitchBend = this->overriding.val(pData, read8);
+ this->pitchBend = this->overriding.val<std::int8_t>(pData, read8);
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Timer));
break;
@@ -665,19 +665,19 @@
//-----------------------------------------------------------------
case SSEQCommand::Attack:
- this->a = this->overriding.val(pData, read8);
+ this->a = this->overriding.val<std::uint8_t>(pData, read8);
break;
case SSEQCommand::Decay:
- this->d = this->overriding.val(pData, read8);
+ this->d = this->overriding.val<std::uint8_t>(pData, read8);
break;
case SSEQCommand::Sustain:
- this->s = this->overriding.val(pData, read8);
+ this->s = this->overriding.val<std::uint8_t>(pData, read8);
break;
case SSEQCommand::Release:
- this->r = this->overriding.val(pData, read8);
+ this->r = this->overriding.val<std::uint8_t>(pData, read8);
break;
//-----------------------------------------------------------------
@@ -685,7 +685,7 @@
//-----------------------------------------------------------------
case SSEQCommand::PortamentoKey:
- this->portaKey = read8(pData) + this->transpose;
+ this->portaKey = static_cast<std::uint8_t>(read8(pData) + this->transpose);
this->state.set(ToIntegral(TrackState::PortamentoBit));
// Update here?
break;
@@ -696,13 +696,13 @@
break;
case SSEQCommand::PortamentoTime:
- this->portaTime = this->overriding.val(pData, read8);
+ this->portaTime = this->overriding.val<std::uint8_t>(pData, read8);
this->state.set(ToIntegral(TrackState::PortamentoBit));
// Update here?
break;
case SSEQCommand::SweepPitch:
- this->sweepPitch = this->overriding.val(pData, read16);
+ this->sweepPitch = this->overriding.val<std::int16_t>(pData, read16);
this->state.set(ToIntegral(TrackState::PortamentoBit));
// Update here?
break;
@@ -712,12 +712,12 @@
//-----------------------------------------------------------------
case SSEQCommand::ModulationDepth:
- this->modDepth = this->overriding.val(pData, read8);
+ this->modDepth = this->overriding.val<std::uint8_t>(pData, read8);
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Modulation));
break;
case SSEQCommand::ModulationSpeed:
- this->modSpeed = this->overriding.val(pData, read8);
+ this->modSpeed = this->overriding.val<std::uint8_t>(pData, read8);
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Modulation));
break;
@@ -732,7 +732,7 @@
break;
case SSEQCommand::ModulationDelay:
- this->modDelay = this->overriding.val(pData, read16);
+ this->modDelay = this->overriding.val<std::uint16_t>(pData, read16);
this->updateFlags.set(ToIntegral(TrackUpdateFlag::Modulation));
break;
@@ -746,8 +746,8 @@
this->overriding.cmd = read8(pData);
if ((this->overriding.cmd >= ToIntegral(SSEQCommand::SetVariable) && this->overriding.cmd <= ToIntegral(SSEQCommand::CompareNotEqualTo)) || this->overriding.cmd < 0x80)
this->overriding.extraValue = read8(pData);
- std::int16_t minVal = read16(pData);
- std::int16_t maxVal = read16(pData);
+ std::int16_t minVal = static_cast<std::int16_t>(read16(pData));
+ std::int16_t maxVal = static_cast<std::int16_t>(read16(pData));
this->overriding.value = (CalcRandom() % (maxVal - minVal + 1)) + minVal;
break;
}
@@ -772,11 +772,11 @@
case SSEQCommand::ShiftVariable:
case SSEQCommand::RandomVariable:
{
- std::int8_t varNo = this->overriding.val(pData, read8, true);
- value = this->overriding.val(pData, read16);
+ std::int8_t varNo = this->overriding.val<std::int8_t>(pData, read8, true);
+ value = this->overriding.val<std::int16_t>(pData, read16);
if (cmd == ToIntegral(SSEQCommand::DivideVariable) && !value) // Division by 0, skip it to prevent crashing
break;
- this->ply->variables[varNo] = VarFunc(cmd)(this->ply->variables[varNo], value);
+ this->ply->variables[varNo] = VarFunc(cmd)(this->ply->variables[varNo], static_cast<std::int16_t>(value));
break;
}
@@ -791,9 +791,9 @@
case SSEQCommand::CompareLessThan:
case SSEQCommand::CompareNotEqualTo:
{
- std::int8_t varNo = this->overriding.val(pData, read8, true);
- value = this->overriding.val(pData, read16);
- this->lastComparisonResult = CompareFunc(cmd)(this->ply->variables[varNo], value);
+ std::int8_t varNo = this->overriding.val<std::int8_t>(pData, read8, true);
+ value = this->overriding.val<std::int16_t>(pData, read16);
+ this->lastComparisonResult = CompareFunc(cmd)(this->ply->variables[varNo], static_cast<std::int16_t>(value));
break;
}
--- a/src/in_ncsf/SSEQPlayer/Track.h
+++ b/src/in_ncsf/SSEQPlayer/Track.h
@@ -42,12 +42,12 @@
Override() : overriding(false), cmd(0), value(0), extraValue(0) { }
bool operator()() const { return this->overriding; }
bool &operator()() { return this->overriding; }
- int val(const std::uint8_t **pData, std::function<int (const std::uint8_t **)> reader, bool returnExtra = false)
+ template<typename T> T val(const std::uint8_t **pData, std::function<int (const std::uint8_t **)> reader, bool returnExtra = false)
{
if (this->overriding)
- return returnExtra ? this->extraValue : this->value;
+ return static_cast<T>(returnExtra ? this->extraValue : this->value);
else
- return reader(pData);
+ return static_cast<T>(reader(pData));
}
};
@@ -86,12 +86,12 @@
Track();
- void Init(std::uint8_t handle, Player *ply, const std::uint8_t *pos, int n);
+ void Init(std::uint8_t handle, Player *ply, const std::uint8_t *pos, std::uint8_t n);
void Zero();
void ClearState();
void Free();
- int NoteOn(int key, int vel, int len);
- int NoteOnTie(int key, int vel);
+ int NoteOn(std::uint8_t key, int vel, int len);
+ int NoteOnTie(std::uint8_t key, int vel);
void ReleaseAllNotes();
void Run();
};
--- a/src/in_ncsf/SSEQPlayer/common.h
+++ b/src/in_ncsf/SSEQPlayer/common.h
@@ -138,7 +138,7 @@
/*
* The remaining functions in this file come from the FeOS Sound System source code.
*/
-inline int Cnv_Attack(int attk)
+inline std::uint8_t Cnv_Attack(int attk)
{
static const std::uint8_t lut[] =
{
@@ -151,7 +151,7 @@
return attk >= 0x6D ? lut[0x7F - attk] : 0xFF - attk;
}
-inline int Cnv_Fall(int fall)
+inline std::uint16_t Cnv_Fall(int fall)
{
if (fall & 0x80) // Supposedly invalid value...
fall = 0; // Use apparently correct default
@@ -165,7 +165,7 @@
return (0x1E00 / (0x7E - fall)) & 0xFFFF;
}
-inline int Cnv_Scale(int scale)
+inline std::int16_t Cnv_Scale(int scale)
{
static const std::int16_t lut[] =
{
@@ -192,7 +192,7 @@
return lut[scale];
}
-inline int Cnv_Sust(int sust)
+inline std::int16_t Cnv_Sust(int sust)
{
static const std::int16_t lut[] =
{
@@ -238,17 +238,17 @@
return -lut[4 * lut_size - arg];
}
-inline int read8(const std::uint8_t **ppData)
+inline std::uint8_t read8(const std::uint8_t **ppData)
{
auto pData = *ppData;
- int x = *pData;
+ std::uint8_t x = *pData;
*ppData = pData + 1;
return x;
}
-inline int read16(const std::uint8_t **ppData)
-{
- int x = read8(ppData);
+inline std::uint16_t read16(const std::uint8_t **ppData)
+{
+ std::uint16_t x = read8(ppData);
x |= read8(ppData) << 8;
return x;
}
--- a/src/in_snsf/CMakeLists.txt
+++ b/src/in_snsf/CMakeLists.txt
@@ -44,6 +44,8 @@
add_library(in_snsf SHARED ${HEADERS} ${SOURCES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Header Files" FILES ${HEADERS})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "Source Files" FILES ${SOURCES})
+target_compile_options(in_snsf PUBLIC
+ $<$<CXX_COMPILER_ID:MSVC>:/wd4127 /wd4245 /wd6385 /wd6386 /wd26453 /wd26495 /wd26812 /wd26819>)
target_link_libraries(in_snsf
in_xsf_framework)
--- a/src/in_snsf/XSFPlayer_SNSF.cpp
+++ b/src/in_snsf/XSFPlayer_SNSF.cpp
@@ -100,7 +100,7 @@
return;
if (bytes > bleft)
bytes = bleft;
- std::fill_n(&this->buf[this->fil], bytes, 0);
+ std::fill_n(&this->buf[this->fil], bytes, static_cast<std::uint8_t>(0));
S9xMixSamples(&this->buf[this->fil], bytes >> 1);
this->fil += bytes;
}
--- a/src/in_xsf_framework/CMakeLists.txt
+++ b/src/in_xsf_framework/CMakeLists.txt
@@ -235,7 +235,7 @@
UNICODE_INPUT_PLUGIN
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<CONFIG:Debug>>:_ITERATOR_DEBUG_LEVEL=0>)
target_compile_options(in_xsf_framework PUBLIC
- $<$<CXX_COMPILER_ID:MSVC>:/W4>)
+ $<$<CXX_COMPILER_ID:MSVC>:/W4 /wd4244 /wd6258 /wd26451 /wd28159>)
target_include_directories(in_xsf_framework PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/winamp