Fix minor warnings from clang static analyzer.

This commit is contained in:
Stephen Anthony 2020-11-09 16:01:36 -03:30
parent 6f2de22789
commit 424eb6d718
4 changed files with 9 additions and 11 deletions

View File

@ -135,12 +135,10 @@ class PaletteHandler
};
struct vector2d {
float x;
float y;
float x{0.F};
float y{0.F};
explicit vector2d()
: x(0.F), y(0.F) { }
explicit vector2d(float _x, float _y)
explicit vector2d(float _x = 0.F, float _y = 0.F)
: x(_x), y(_y) { }
};

View File

@ -117,7 +117,7 @@ bool SoundSDL2::openDevice()
if(myIsInitializedFlag)
SDL_CloseAudioDevice(myDevice);
myDeviceId = BSPF::clamp(myAudioSettings.device(), 0u, uInt32(myDevices.size() - 1));
myDeviceId = BSPF::clamp(myAudioSettings.device(), 0U, uInt32(myDevices.size() - 1));
const char* device = myDeviceId ? myDevices.at(myDeviceId).first.c_str() : nullptr;
myDevice = SDL_OpenAudioDevice(device, 0, &desired, &myHardwareSpec,

View File

@ -26,14 +26,13 @@ CartridgeMNetworkWidget::CartridgeMNetworkWidget(
int x, int y, int w, int h,
CartridgeMNetwork& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart),
myLower2K(nullptr),
myUpper256B(nullptr)
myCart(cart)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMNetworkWidget::initialize(GuiObject* boss, CartridgeMNetwork& cart, ostringstream& info)
void CartridgeMNetworkWidget::initialize(GuiObject* boss,
CartridgeMNetwork& cart, ostringstream& info)
{
uInt32 size = cart.romBankCount() * cart.BANK_SIZE;

View File

@ -143,7 +143,8 @@ void RomAuditDialog::auditRoms()
// Only rename the file if we found a valid properties entry
if(name != "" && name != files[idx].getName())
{
const string& newfile = node.getPath() + name + "." + extension;
string newfile = node.getPath();
newfile.append(name).append(".").append(extension);
if(files[idx].getPath() != newfile && files[idx].rename(newfile))
renameSucceeded = true;
}