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 { struct vector2d {
float x; float x{0.F};
float y; float y{0.F};
explicit vector2d() explicit vector2d(float _x = 0.F, float _y = 0.F)
: x(0.F), y(0.F) { }
explicit vector2d(float _x, float _y)
: x(_x), y(_y) { } : x(_x), y(_y) { }
}; };

View File

@ -117,7 +117,7 @@ bool SoundSDL2::openDevice()
if(myIsInitializedFlag) if(myIsInitializedFlag)
SDL_CloseAudioDevice(myDevice); 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; const char* device = myDeviceId ? myDevices.at(myDeviceId).first.c_str() : nullptr;
myDevice = SDL_OpenAudioDevice(device, 0, &desired, &myHardwareSpec, myDevice = SDL_OpenAudioDevice(device, 0, &desired, &myHardwareSpec,

View File

@ -26,14 +26,13 @@ CartridgeMNetworkWidget::CartridgeMNetworkWidget(
int x, int y, int w, int h, int x, int y, int w, int h,
CartridgeMNetwork& cart) CartridgeMNetwork& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h), : CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart(cart), myCart(cart)
myLower2K(nullptr),
myUpper256B(nullptr)
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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; 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 // Only rename the file if we found a valid properties entry
if(name != "" && name != files[idx].getName()) 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)) if(files[idx].getPath() != newfile && files[idx].rename(newfile))
renameSucceeded = true; renameSucceeded = true;
} }