From c9d6a58832e29eb5bbbb55fb532f595cdda811f6 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 9 Nov 2020 16:01:36 -0330 Subject: [PATCH] Fix minor warnings from clang static analyzer. --- src/common/PaletteHandler.hxx | 8 +++----- src/common/SoundSDL2.cxx | 2 +- src/debugger/gui/CartMNetworkWidget.cxx | 7 +++---- src/gui/RomAuditDialog.cxx | 3 ++- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/common/PaletteHandler.hxx b/src/common/PaletteHandler.hxx index 66da36715..42ba37cfc 100644 --- a/src/common/PaletteHandler.hxx +++ b/src/common/PaletteHandler.hxx @@ -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) { } }; diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index af99d3f2c..6caabc72e 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -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, diff --git a/src/debugger/gui/CartMNetworkWidget.cxx b/src/debugger/gui/CartMNetworkWidget.cxx index e9cc68869..e56a1ecb7 100644 --- a/src/debugger/gui/CartMNetworkWidget.cxx +++ b/src/debugger/gui/CartMNetworkWidget.cxx @@ -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; diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index 58b9acaba..09c264025 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -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; }