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.
This commit is contained in:
Stephen Anthony 2019-12-24 17:50:27 -03:30
parent 8e1791b801
commit eeb8363df6
21 changed files with 28 additions and 32 deletions

View File

@ -131,7 +131,7 @@ void AudioQueue::closeSink(Int16* fragment)
lock_guard<mutex> 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;

View File

@ -67,7 +67,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings)
if(!openDevice())
return;
mute(true);
SoundSDL2::mute(true);
Logger::debug("SoundSDL2::SoundSDL2 initialized");
}

View File

@ -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);
}
/**

View File

@ -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;
}

View File

@ -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<float>(myCurrentFragment[myFragmentIndex] / static_cast<float>(0x7fff));

View File

@ -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

View File

@ -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)

View File

@ -92,7 +92,7 @@ class Cartridge : public Device
ROM property.
*/
void setStartBankFromPropsFunc(StartBankFromPropsFunc func) {
myStartBankFromPropsFunc = func;
myStartBankFromPropsFunc = std::move(func);
}
/**

View File

@ -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);
}
/**

View File

@ -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

View File

@ -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

View File

@ -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;
};
// ############################################################################

View File

@ -95,7 +95,7 @@ void DelayQueue<length, capacity>::push(uInt8 address, uInt8 value, uInt8 delay)
template<unsigned length, unsigned capacity>
void DelayQueue<length, capacity>::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<length, capacity>::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<length, capacity>::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();

View File

@ -137,7 +137,7 @@ bool DelayQueueMember<capacity>::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];

View File

@ -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;
};

View File

@ -373,7 +373,7 @@ void Dialog::buildCurrentFocusList(int tabID)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::addSurface(shared_ptr<FBSurface> surface)
void Dialog::addSurface(const shared_ptr<FBSurface>& surface)
{
mySurfaceStack.push(surface);
}

View File

@ -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<FBSurface> surface);
void addSurface(const shared_ptr<FBSurface>& surface);
void setFlags(int flags) { _flags |= flags; setDirty(); }
void clearFlags(int flags) { _flags &= ~flags; setDirty(); }

View File

@ -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
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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;

View File

@ -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();

View File

@ -50,8 +50,6 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font,
_fontWidth = _font.getMaxCharWidth();
_fontHeight = _font.getLineHeight();
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -