From eeb8363df63ba12607ad9798cebdda802176d31c Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Tue, 24 Dec 2019 17:50:27 -0330 Subject: [PATCH] More fixes for warnings from clang-tidy. Sorry if these are all over the place; I'm fixing them in the order that the tool finds them. --- src/common/AudioQueue.cxx | 2 +- src/common/SoundSDL2.cxx | 2 +- src/common/TimerManager.hxx | 4 ++-- src/common/Variant.hxx | 2 +- src/common/audio/SimpleResampler.cxx | 4 ++-- src/common/bspf.hxx | 2 +- src/common/tv_filters/AtariNTSC.cxx | 4 +--- src/emucore/Cart.hxx | 2 +- src/emucore/Control.hxx | 2 +- src/emucore/tia/AudioChannel.hxx | 8 ++++---- src/emucore/tia/Background.hxx | 2 +- src/emucore/tia/Ball.hxx | 2 +- src/emucore/tia/DelayQueue.hxx | 6 +++--- src/emucore/tia/DelayQueueMember.hxx | 2 +- src/emucore/tia/frame-manager/AbstractFrameManager.hxx | 4 ++-- src/gui/Dialog.cxx | 2 +- src/gui/Dialog.hxx | 2 +- src/gui/EditTextWidget.cxx | 2 +- src/gui/FileListWidget.cxx | 2 +- src/gui/FileListWidget.hxx | 2 +- src/gui/Widget.cxx | 2 -- 21 files changed, 28 insertions(+), 32 deletions(-) diff --git a/src/common/AudioQueue.cxx b/src/common/AudioQueue.cxx index 8a0a34d4e..ac1ea6d66 100644 --- a/src/common/AudioQueue.cxx +++ b/src/common/AudioQueue.cxx @@ -131,7 +131,7 @@ void AudioQueue::closeSink(Int16* fragment) lock_guard guard(myMutex); if (myFirstFragmentForDequeue && fragment) - throw new runtime_error("attempt to return unknown buffer on closeSink"); + throw runtime_error("attempt to return unknown buffer on closeSink"); if (!myFirstFragmentForDequeue) myFirstFragmentForDequeue = fragment; diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index bf45e5d19..12c2be304 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -67,7 +67,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings) if(!openDevice()) return; - mute(true); + SoundSDL2::mute(true); Logger::debug("SoundSDL2::SoundSDL2 initialized"); } diff --git a/src/common/TimerManager.hxx b/src/common/TimerManager.hxx index a11ea2a7c..59dadcfbb 100644 --- a/src/common/TimerManager.hxx +++ b/src/common/TimerManager.hxx @@ -77,7 +77,7 @@ class TimerManager Call function every 'period' ms, starting 'period' ms from now. */ TimerId setInterval(const TFunction& func, millisec period) { - return addTimer(period, period, std::move(func)); + return addTimer(period, period, func); } /** @@ -86,7 +86,7 @@ class TimerManager Call function once 'timeout' ms from now. */ TimerId setTimeout(const TFunction& func, millisec timeout) { - return addTimer(timeout, 0, std::move(func)); + return addTimer(timeout, 0, func); } /** diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx index df6c64239..08b3253ff 100644 --- a/src/common/Variant.hxx +++ b/src/common/Variant.hxx @@ -36,7 +36,7 @@ class Variant string data; // Use singleton so we use only one ostringstream object - inline ostringstream& buf() { + static ostringstream& buf() { static ostringstream buf; return buf; } diff --git a/src/common/audio/SimpleResampler.cxx b/src/common/audio/SimpleResampler.cxx index e3efd2df6..48ba246e0 100644 --- a/src/common/audio/SimpleResampler.cxx +++ b/src/common/audio/SimpleResampler.cxx @@ -44,7 +44,7 @@ void SimpleResampler::fillFragment(float* fragment, uInt32 length) } if (!myCurrentFragment) { - std::fill_n(fragment, length, 0.f); + std::fill_n(fragment, length, 0.F); return; } @@ -61,7 +61,7 @@ void SimpleResampler::fillFragment(float* fragment, uInt32 length) fragment[2*i + 1] = sampleR; } else - fragment[i] = (sampleL + sampleR) / 2.f; + fragment[i] = (sampleL + sampleR) / 2.F; } else { float sample = static_cast(myCurrentFragment[myFragmentIndex] / static_cast(0x7fff)); diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 353d2ad03..f7b27af0c 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -99,7 +99,7 @@ static const string EmptyString(""); namespace BSPF { - static constexpr float PI_f = 3.141592653589793238462643383279502884f; + static constexpr float PI_f = 3.141592653589793238462643383279502884F; static constexpr double PI_d = 3.141592653589793238462643383279502884; // CPU architecture type diff --git a/src/common/tv_filters/AtariNTSC.cxx b/src/common/tv_filters/AtariNTSC.cxx index 14c88196f..2e3bd06cc 100644 --- a/src/common/tv_filters/AtariNTSC.cxx +++ b/src/common/tv_filters/AtariNTSC.cxx @@ -166,7 +166,6 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width, ATARI_NTSC_RGB_OUT_8888(5, line_out[5]) ATARI_NTSC_RGB_OUT_8888(6, line_out[6]) - line_in += 2; line_out += 7; ATARI_NTSC_COLOR_IN(0, NTSC_black) @@ -243,7 +242,6 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_ ATARI_NTSC_RGB_OUT_8888(5, line_out[5]) ATARI_NTSC_RGB_OUT_8888(6, line_out[6]) - line_in += 2; line_out += 7; ATARI_NTSC_COLOR_IN(0, NTSC_black) @@ -261,7 +259,7 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_ // Do phosphor mode (blend the resulting frames) // Note: The unrolled code assumed that AtariNTSC::outWidth(kTIAW) == outPitch == 565 - // Now this got changed to 568 so he final 5 calculations got removed. + // Now this got changed to 568 so the final 5 calculations got removed. for (uInt32 x = AtariNTSC::outWidth(in_width) / 8; x; --x) { // Store back into displayed frame buffer (for next frame) diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index d3151977d..f3afbe7a2 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -92,7 +92,7 @@ class Cartridge : public Device ROM property. */ void setStartBankFromPropsFunc(StartBankFromPropsFunc func) { - myStartBankFromPropsFunc = func; + myStartBankFromPropsFunc = std::move(func); } /** diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 54442928c..1903a3ce2 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -253,7 +253,7 @@ class Controller : public Serializable Inject a callback to be notified on analog pin updates. */ void setOnAnalogPinUpdateCallback(onAnalogPinUpdateCallback callback) { - myOnAnalogPinUpdateCallback = callback; + myOnAnalogPinUpdateCallback = std::move(callback); } /** diff --git a/src/emucore/tia/AudioChannel.hxx b/src/emucore/tia/AudioChannel.hxx index a7213765a..716fb2d30 100644 --- a/src/emucore/tia/AudioChannel.hxx +++ b/src/emucore/tia/AudioChannel.hxx @@ -59,10 +59,10 @@ class AudioChannel : public Serializable uInt8 myNoiseCounter; private: - AudioChannel(const AudioChannel&); - AudioChannel(AudioChannel&&); - AudioChannel& operator=(const AudioChannel&); - AudioChannel& operator=(AudioChannel&&); + AudioChannel(const AudioChannel&) = delete; + AudioChannel(AudioChannel&&) = delete; + AudioChannel& operator=(const AudioChannel&) = delete; + AudioChannel& operator=(AudioChannel&&) = delete; }; #endif // TIA_AUDIO_CHANNEL_HXX diff --git a/src/emucore/tia/Background.hxx b/src/emucore/tia/Background.hxx index cb8e5cbd5..1c19e7192 100644 --- a/src/emucore/tia/Background.hxx +++ b/src/emucore/tia/Background.hxx @@ -61,7 +61,7 @@ class Background : public Serializable Background(const Background&) = delete; Background(Background&&) = delete; Background& operator=(const Background&) = delete; - Background& operator=(Background&&); + Background& operator=(Background&&) = delete; }; #endif // TIA_BACKGROUND diff --git a/src/emucore/tia/Ball.hxx b/src/emucore/tia/Ball.hxx index 7bfe77cda..3d7ff67b5 100644 --- a/src/emucore/tia/Ball.hxx +++ b/src/emucore/tia/Ball.hxx @@ -333,7 +333,7 @@ class Ball : public Serializable Ball(const Ball&) = delete; Ball(Ball&&) = delete; Ball& operator=(const Ball&) = delete; - Ball& operator=(Ball&&); + Ball& operator=(Ball&&) = delete; }; // ############################################################################ diff --git a/src/emucore/tia/DelayQueue.hxx b/src/emucore/tia/DelayQueue.hxx index ec7072352..5cf2dfb32 100644 --- a/src/emucore/tia/DelayQueue.hxx +++ b/src/emucore/tia/DelayQueue.hxx @@ -95,7 +95,7 @@ void DelayQueue::push(uInt8 address, uInt8 value, uInt8 delay) template void DelayQueue::reset() { - for (uInt8 i = 0; i < length; ++i) + for (uInt32 i = 0; i < length; ++i) myMembers[i].clear(); myIndex = 0; @@ -127,7 +127,7 @@ bool DelayQueue::save(Serializer& out) const { out.putInt(length); - for (uInt8 i = 0; i < length; ++i) + for (uInt32 i = 0; i < length; ++i) myMembers[i].save(out); out.putByte(myIndex); @@ -150,7 +150,7 @@ bool DelayQueue::load(Serializer& in) { if (in.getInt() != length) throw runtime_error("delay queue length mismatch"); - for (uInt8 i = 0; i < length; ++i) + for (uInt32 i = 0; i < length; ++i) myMembers[i].load(in); myIndex = in.getByte(); diff --git a/src/emucore/tia/DelayQueueMember.hxx b/src/emucore/tia/DelayQueueMember.hxx index 636f2e0bf..90a381e1a 100644 --- a/src/emucore/tia/DelayQueueMember.hxx +++ b/src/emucore/tia/DelayQueueMember.hxx @@ -137,7 +137,7 @@ bool DelayQueueMember::load(Serializer& in) try { mySize = in.getByte(); - if (mySize > capacity) throw new runtime_error("invalid delay queue size"); + if (mySize > capacity) throw runtime_error("invalid delay queue size"); for(uInt32 i = 0; i < mySize; ++i) { Entry& e = myEntries[i]; diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.hxx b/src/emucore/tia/frame-manager/AbstractFrameManager.hxx index c827eb0cf..7a20b7033 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.hxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.hxx @@ -293,8 +293,8 @@ class AbstractFrameManager : public Serializable AbstractFrameManager(const AbstractFrameManager&) = delete; AbstractFrameManager(AbstractFrameManager&&) = delete; - AbstractFrameManager& operator=(const AbstractFrameManager&); - AbstractFrameManager& operator=(AbstractFrameManager&&); + AbstractFrameManager& operator=(const AbstractFrameManager&) = delete; + AbstractFrameManager& operator=(AbstractFrameManager&&) = delete; }; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index c076dcebe..777d96029 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -373,7 +373,7 @@ void Dialog::buildCurrentFocusList(int tabID) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Dialog::addSurface(shared_ptr surface) +void Dialog::addSurface(const shared_ptr& surface) { mySurfaceStack.push(surface); } diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index d55aee8d6..1063b32eb 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -88,7 +88,7 @@ class Dialog : public GuiObject the surface render() call will always occur in such a case, the surface should call setVisible() to enable/disable its output. */ - void addSurface(shared_ptr surface); + void addSurface(const shared_ptr& surface); void setFlags(int flags) { _flags |= flags; setDirty(); } void clearFlags(int flags) { _flags &= ~flags; setDirty(); } diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index a2fe4de26..acd9aecc5 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -29,7 +29,7 @@ EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font, { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; - startEditMode(); // We're always in edit mode + EditableWidget::startEditMode(); // We're always in edit mode } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index 34a6f2e05..ac21298fe 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -71,7 +71,7 @@ void FileListWidget::setDirectory(const FilesystemNode& node, string select) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FileListWidget::setLocation(const FilesystemNode& node, string select) +void FileListWidget::setLocation(const FilesystemNode& node, const string& select) { _node = node; diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx index c209a13a1..d7a0310d4 100644 --- a/src/gui/FileListWidget.hxx +++ b/src/gui/FileListWidget.hxx @@ -83,7 +83,7 @@ class FileListWidget : public StringListWidget private: /** Very similar to setDirectory(), but also updates the history */ - void setLocation(const FilesystemNode& node, string select = EmptyString); + void setLocation(const FilesystemNode& node, const string& select = EmptyString); /** Descend into currently selected directory */ void selectDirectory(); diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 4b5e43816..4d9dd06ae 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -50,8 +50,6 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font, _fontWidth = _font.getMaxCharWidth(); _fontHeight = _font.getLineHeight(); - - setDirty(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -