Increased warning level in Visual Studio compiles.

Also fixed some new warnings that VS now finds.
This commit is contained in:
Stephen Anthony 2018-08-19 12:34:40 -02:30
parent 8b156dc43d
commit 56437c38e6
20 changed files with 59 additions and 43 deletions

View File

@ -29,8 +29,8 @@ BankRomCheat::BankRomCheat(OSystem& os, const string& name, const string& code)
bank = unhex(myCode.substr(0, 2));
address = 0xf000 + unhex(myCode.substr(2, 3));
value = unhex(myCode.substr(5, 2));
count = unhex(myCode.substr(7, 1)) + 1;
value = uInt8(unhex(myCode.substr(5, 2)));
count = uInt8(unhex(myCode.substr(7, 1)) + 1);
// Back up original data; we need this if the cheat is ever disabled
for(int i = 0; i < count; ++i)

View File

@ -25,8 +25,8 @@ CheetahCheat::CheetahCheat(OSystem& os, const string& name, const string& code)
: Cheat(os, name, code)
{
address = 0xf000 + unhex(code.substr(0, 3));
value = unhex(code.substr(3, 2));
count = unhex(code.substr(5, 1)) + 1;
value = uInt8(unhex(code.substr(3, 2)));
count = uInt8(unhex(code.substr(5, 1)) + 1);
// Back up original data; we need this if the cheat is ever disabled
for(int i = 0; i < count; ++i)

View File

@ -85,7 +85,7 @@ Int16* AudioQueue::enqueue(Int16* fragment)
return newFragment;
}
const uInt8 capacity = myFragmentQueue.size();
const uInt8 capacity = uInt8(myFragmentQueue.size());
const uInt8 fragmentIndex = (myNextFragment + mySize) % capacity;
newFragment = myFragmentQueue.at(fragmentIndex);

View File

@ -383,7 +383,7 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
/* generate luma (y) filter using sinc kernel */
{
/* sinc with rolloff (dsf) */
float const rolloff = 1 + float(setup.sharpness) * 0.032;
float const rolloff = 1 + float(setup.sharpness) * 0.032f;
float const maxh = 32;
float const pow_a_n = float(pow( rolloff, maxh ));
float sum;
@ -406,7 +406,7 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
pow_a_n * rolloff * float(cos( (maxh - 1) * angle ));
float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff;
float dsf = num / den;
kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - 0.5;
kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - 0.5f;
}
}

View File

@ -1101,6 +1101,7 @@ string CartDebug::saveDisassembly()
}
// Some boilerplate, similar to what DiStella adds
// FIXME - change 'time' to proper C++ way - unsafe function
time_t currtime;
time(&currtime);
out << "; Disassembly of " << myOSystem.romFile().getShortPath() << "\n"
@ -1292,7 +1293,7 @@ string CartDebug::clearConfig(int bank)
endbank = startbank + 1;
}
uInt32 count = 0;
size_t count = 0;
for(uInt32 b = startbank; b < endbank; ++b)
{
count += myBankInfo[b].directiveList.size();

View File

@ -717,7 +717,7 @@ const FunctionDefMap Debugger::getFunctionDefMap() const
string Debugger::builtinHelp() const
{
ostringstream buf;
uInt16 len, c_maxlen = 0, i_maxlen = 0;
size_t len, c_maxlen = 0, i_maxlen = 0;
// Get column widths for aligned output (functions)
for(uInt32 i = 0; i < NUM_BUILTIN_FUNCS; ++i)

View File

@ -1235,10 +1235,10 @@ void DebuggerParser::executeHelp()
if(argCount == 0) // normal help, show all commands
{
// Find length of longest command
uInt16 clen = 0;
size_t clen = 0;
for(int i = 0; i < kNumCommands; ++i)
{
uInt16 len = commands[i].cmdString.length();
size_t len = commands[i].cmdString.length();
if(len > clen) clen = len;
}
@ -1789,6 +1789,7 @@ void DebuggerParser::executeSaveses()
struct tm* timeinfo;
char buffer[80];
// FIXME - change 'time' to proper C++ way - unsafe function
time(&currtime);
timeinfo = localtime(&currtime);
strftime(buffer, 80, "session_%F_%H-%M-%S.txt", timeinfo);

View File

@ -883,7 +883,7 @@ int DiStella::mark(uInt32 address, uInt8 mask, bool directive)
return 3;
} else if (type == CartDebug::ADDR_ZPRAM && myOffset != 0) {
return 5;
} else if (address >= myOffset && address <= myAppData.end + myOffset) {
} else if (address >= uInt32(myOffset) && address <= uInt32(myAppData.end + myOffset)) {
myLabels[address - myOffset] = myLabels[address - myOffset] | mask;
if (directive) myDirectives[address - myOffset] = mask;
return 1;

View File

@ -689,7 +689,7 @@ void PromptWidget::textPaste()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::addToHistory(const char* str)
{
strncpy(_history[_historyIndex], str, kLineBufferSize-1);
strncpy(_history[_historyIndex], str, kLineBufferSize-1); //FIXME - unsafe function
_historyIndex = (_historyIndex + 1) % kHistorySize;
_historyLine = 0;

View File

@ -116,7 +116,7 @@ uInt8 CartridgeAR::peek(uInt16 addr)
// Is the data hold register being set?
if(!(addr & 0x0F00) && (!myWriteEnabled || !myWritePending))
{
myDataHoldRegister = addr;
myDataHoldRegister = uInt8(addr); // FIXME - check cast here
myNumberOfDistinctAccesses = mySystem->m6502().distinctAccesses();
myWritePending = true;
}
@ -163,7 +163,7 @@ bool CartridgeAR::poke(uInt16 addr, uInt8)
// Is the data hold register being set?
if(!(addr & 0x0F00) && (!myWriteEnabled || !myWritePending))
{
myDataHoldRegister = addr;
myDataHoldRegister = uInt8(addr); // FIXME - check cast here
myNumberOfDistinctAccesses = mySystem->m6502().distinctAccesses();
myWritePending = true;
}
@ -400,7 +400,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
bool CartridgeAR::bank(uInt16 bank)
{
if(!bankLocked())
return bankConfiguration(bank);
return bankConfiguration(uInt8(bank));
else
return false;
}

View File

@ -39,7 +39,10 @@ CartridgeDPC::CartridgeDPC(const BytePtr& image, uInt32 size,
// Initialize the DPC data fetcher registers
for(int i = 0; i < 8; ++i)
myTops[i] = myBottoms[i] = myCounters[i] = myFlags[i] = 0;
{
myTops[i] = myBottoms[i] = myFlags[i] = 0;
myCounters[i] = 0;
}
// None of the data fetchers are in music mode
myMusicMode[0] = myMusicMode[1] = myMusicMode[2] = false;

View File

@ -90,8 +90,11 @@ void CartridgeDPCPlus::setInitialState()
// Initialize the DPC data fetcher registers
for(int i = 0; i < 8; ++i)
myTops[i] = myBottoms[i] = myCounters[i] = myFractionalIncrements[i] =
{
myTops[i] = myBottoms[i] = myFractionalIncrements[i] = 0;
myFractionalCounters[i] = 0;
myCounters[i] = 0;
}
// Set waveforms to first waveform entry
myMusicWaveforms[0] = myMusicWaveforms[1] = myMusicWaveforms[2] = 0;

View File

@ -981,7 +981,8 @@ void Console::generateColorLossPalette()
float Console::getFramerate() const
{
return
(myConsoleTiming == ConsoleTiming::ntsc ? 262. * 60. : 312. * 50.) / myTIA->frameBufferScanlinesLastFrame();
(myConsoleTiming == ConsoleTiming::ntsc ? 262.f * 60.f : 312.f * 50.f) /
myTIA->frameBufferScanlinesLastFrame();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -162,6 +162,7 @@ cerr << "myTape = " << myTape << endl;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::openSampleFile()
{
#if 0
static const char* const kvNameTable[6] = {
"kvs3.wav", "kvs1.wav", "kvs2.wav", "kvb3.wav", "kvb1.wav", "kvb2.wav"
};
@ -202,17 +203,20 @@ cerr << "opened file: " << "kvshared.wav" << endl;
myTapeBusy = false;
myFilePointer = StartSong[i];
}
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KidVid::closeSampleFile()
{
#if 0
if(myFileOpened)
{
fclose(mySampleFile);
fclose(mySharedSampleFile);
myFileOpened = false;
}
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -117,7 +117,7 @@ bool PointingDevice::setMouseControl(
void PointingDevice::setSensitivity(int sensitivity)
{
BSPF::clamp(sensitivity, 1, 20, 10);
TB_SENSITIVITY = sensitivity / 10.0;
TB_SENSITIVITY = sensitivity / 10.0f;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -221,12 +221,12 @@ void TIASurface::enableScanlineInterpolation(bool enable)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::enablePhosphor(bool enable, int blend)
{
if(myUsePhosphor == enable && myPhosphorPercent == blend / 100.0)
if(myUsePhosphor == enable && myPhosphorPercent == blend / 100.0f)
return;
myUsePhosphor = enable;
if(blend >= 0)
myPhosphorPercent = blend / 100.0;
myPhosphorPercent = blend / 100.0f;
myFilter = Filter(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10);
memset(myRGBFramebuffer, 0, sizeof(myRGBFramebuffer));
@ -234,9 +234,9 @@ void TIASurface::enablePhosphor(bool enable, int blend)
// Precalculate the average colors for the 'phosphor' effect
if(myUsePhosphor)
{
for(Int16 c = 255; c >= 0; c--)
for(Int16 p = 255; p >= 0; p--)
myPhosphorPalette[c][p] = getPhosphor(c, p);
for(int c = 255; c >= 0; c--)
for(int p = 255; p >= 0; p--)
myPhosphorPalette[c][p] = getPhosphor(uInt8(c), uInt8(p));
myNTSCFilter.setPhosphorPalette(myPhosphorPalette);
}

View File

@ -210,12 +210,8 @@ void TabWidget::handleMouseLeft()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
switch(cmd)
{
default:
sendCommand(cmd, data, _id);
break;
}
// Command is not inspected; simply forward it to the caller
sendCommand(cmd, data, _id);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -1,3 +1,7 @@
// Added by SA: TODO - find a better way to do this
#ifdef BSPF_WINDOWS
#define _CRT_SECURE_NO_WARNINGS
#endif
/* pngpriv.h - private declarations for use inside libpng
*

View File

@ -251,12 +251,11 @@ bool FilesystemNodeWINDOWS::
// Files enumeration
WIN32_FIND_DATA desc;
HANDLE handle;
char searchPath[MAX_PATH + 10];
sprintf(searchPath, "%s*", _path.c_str());
handle = FindFirstFile(toUnicode(searchPath), &desc);
ostringstream searchPath;
searchPath << _path << "*";
handle = FindFirstFile(searchPath.str().c_str(), &desc);
if(handle == INVALID_HANDLE_VALUE)
return false;

View File

@ -108,7 +108,6 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -117,10 +116,12 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -140,7 +141,6 @@
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -149,9 +149,11 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -168,7 +170,6 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -177,10 +178,12 @@
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -201,7 +204,6 @@
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<AdditionalOptions>/MP /std:c++latest %(AdditionalOptions)</AdditionalOptions>
<Optimization>Full</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers>
@ -211,9 +213,11 @@
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level2</WarningLevel>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ObjectFileName>$(IntDir)%(RelativeDir)</ObjectFileName>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>