clang-tidy: add explicit deleted constructors

Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-05-30 22:46:50 -07:00
parent 9ef1cf15a9
commit 220d2bf026
30 changed files with 98 additions and 0 deletions

View File

@ -71,6 +71,9 @@ public:
Mutex &mutex); Mutex &mutex);
~Bzip2InputStream() noexcept override; ~Bzip2InputStream() noexcept override;
Bzip2InputStream(const Bzip2InputStream &) = delete;
Bzip2InputStream &operator=(const Bzip2InputStream &) = delete;
/* virtual methods from InputStream */ /* virtual methods from InputStream */
[[nodiscard]] bool IsEOF() const noexcept override; [[nodiscard]] bool IsEOF() const noexcept override;
size_t Read(std::unique_lock<Mutex> &lock, size_t Read(std::unique_lock<Mutex> &lock,

View File

@ -116,6 +116,9 @@ public:
zzip_file_close(file); zzip_file_close(file);
} }
ZzipInputStream(const ZzipInputStream &) = delete;
ZzipInputStream &operator=(const ZzipInputStream &) = delete;
/* virtual methods from InputStream */ /* virtual methods from InputStream */
[[nodiscard]] bool IsEOF() const noexcept override; [[nodiscard]] bool IsEOF() const noexcept override;
size_t Read(std::unique_lock<Mutex> &lock, size_t Read(std::unique_lock<Mutex> &lock,

View File

@ -83,6 +83,9 @@ public:
~AllocatedProxySong() { ~AllocatedProxySong() {
mpd_song_free(song); mpd_song_free(song);
} }
AllocatedProxySong(const AllocatedProxySong &) = delete;
AllocatedProxySong &operator=(const AllocatedProxySong &) = delete;
}; };
class ProxyDatabase final : public Database { class ProxyDatabase final : public Database {

View File

@ -138,6 +138,9 @@ public:
MadDecoder(DecoderClient *client, InputStream &input_stream) noexcept; MadDecoder(DecoderClient *client, InputStream &input_stream) noexcept;
~MadDecoder() noexcept; ~MadDecoder() noexcept;
MadDecoder(const MadDecoder &) = delete;
MadDecoder &operator=(const MadDecoder &) = delete;
void RunDecoder() noexcept; void RunDecoder() noexcept;
bool RunScan(TagHandler &handler) noexcept; bool RunScan(TagHandler &handler) noexcept;

View File

@ -137,6 +137,9 @@ public:
~MPDOpusDecoder(); ~MPDOpusDecoder();
MPDOpusDecoder(const MPDOpusDecoder &) = delete;
MPDOpusDecoder &operator=(const MPDOpusDecoder &) = delete;
/** /**
* Has DecoderClient::Ready() been called yet? * Has DecoderClient::Ready() been called yet?
*/ */

View File

@ -80,6 +80,9 @@ public:
DeinitVorbis(); DeinitVorbis();
} }
VorbisDecoder(const VorbisDecoder &) = delete;
VorbisDecoder &operator=(const VorbisDecoder &) = delete;
bool Seek(uint64_t where_frame); bool Seek(uint64_t where_frame);
static AudioFormat CheckAudioFormat(const vorbis_info &vi) { static AudioFormat CheckAudioFormat(const vorbis_info &vi) {

View File

@ -54,6 +54,9 @@ public:
FLAC__stream_encoder_delete(fse); FLAC__stream_encoder_delete(fse);
} }
FlacEncoder(const FlacEncoder &) = delete;
FlacEncoder &operator=(const FlacEncoder &) = delete;
/* virtual methods from class Encoder */ /* virtual methods from class Encoder */
void End() override { void End() override {
(void) FLAC__stream_encoder_finish(fse); (void) FLAC__stream_encoder_finish(fse);

View File

@ -47,6 +47,9 @@ public:
~LameEncoder() noexcept override; ~LameEncoder() noexcept override;
LameEncoder(const LameEncoder &) = delete;
LameEncoder &operator=(const LameEncoder &) = delete;
/* virtual methods from class Encoder */ /* virtual methods from class Encoder */
void Write(const void *data, size_t length) override; void Write(const void *data, size_t length) override;
size_t Read(void *dest, size_t length) noexcept override; size_t Read(void *dest, size_t length) noexcept override;

View File

@ -56,6 +56,9 @@ public:
OpusEncoder(AudioFormat &_audio_format, ::OpusEncoder *_enc, bool _chaining); OpusEncoder(AudioFormat &_audio_format, ::OpusEncoder *_enc, bool _chaining);
~OpusEncoder() noexcept override; ~OpusEncoder() noexcept override;
OpusEncoder(const OpusEncoder &) = delete;
OpusEncoder &operator=(const OpusEncoder &) = delete;
/* virtual methods from class Encoder */ /* virtual methods from class Encoder */
void End() override; void End() override;
void Write(const void *data, size_t length) override; void Write(const void *data, size_t length) override;

View File

@ -54,6 +54,9 @@ public:
audio_format(_audio_format), options(_options) {} audio_format(_audio_format), options(_options) {}
~TwolameEncoder() noexcept override; ~TwolameEncoder() noexcept override;
TwolameEncoder(const TwolameEncoder &) = delete;
TwolameEncoder &operator=(const TwolameEncoder &) = delete;
/* virtual methods from class Encoder */ /* virtual methods from class Encoder */
void End() override { void End() override {

View File

@ -44,6 +44,9 @@ public:
vorbis_info_clear(&vi); vorbis_info_clear(&vi);
} }
VorbisEncoder(const VorbisEncoder &) = delete;
VorbisEncoder &operator=(const VorbisEncoder &) = delete;
/* virtual methods from class Encoder */ /* virtual methods from class Encoder */
void End() override { void End() override {
PreTag(); PreTag();

View File

@ -43,6 +43,9 @@ public:
observer.proxy = nullptr; observer.proxy = nullptr;
} }
PreparedProxy(const PreparedProxy &) = delete;
PreparedProxy &operator=(const PreparedProxy &) = delete;
void Clear([[maybe_unused]] Proxy *_child) noexcept { void Clear([[maybe_unused]] Proxy *_child) noexcept {
assert(child == _child); assert(child == _child);
child = nullptr; child = nullptr;
@ -67,6 +70,9 @@ public:
parent.Clear(this); parent.Clear(this);
} }
Proxy(const Proxy &) = delete;
Proxy &operator=(const Proxy &) = delete;
Filter *Get() noexcept { Filter *Get() noexcept {
return filter.get(); return filter.get();
} }

View File

@ -42,6 +42,10 @@ public:
Compressor_delete(compressor); Compressor_delete(compressor);
} }
NormalizeFilter(const NormalizeFilter &) = delete;
NormalizeFilter &operator=(const NormalizeFilter &) = delete;
/* virtual methods from class Filter */ /* virtual methods from class Filter */
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override; ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
}; };

View File

@ -107,6 +107,9 @@ public:
*/ */
virtual ~InputStream() noexcept; virtual ~InputStream() noexcept;
InputStream(const InputStream &) = delete;
InputStream &operator=(const InputStream &) = delete;
/** /**
* Opens a new input stream. You may not access it until the "ready" * Opens a new input stream. You may not access it until the "ready"
* flag is set. * flag is set.

View File

@ -99,6 +99,9 @@ public:
snd_pcm_close(capture_handle); snd_pcm_close(capture_handle);
} }
AlsaInputStream(const AlsaInputStream &) = delete;
AlsaInputStream &operator=(const AlsaInputStream &) = delete;
static InputStreamPtr Create(EventLoop &event_loop, const char *uri, static InputStreamPtr Create(EventLoop &event_loop, const char *uri,
Mutex &mutex); Mutex &mutex);

View File

@ -88,6 +88,9 @@ class CdioParanoiaInputStream final : public InputStream {
cdio_destroy(cdio); cdio_destroy(cdio);
} }
CdioParanoiaInputStream(const CdioParanoiaInputStream &) = delete;
CdioParanoiaInputStream &operator=(const CdioParanoiaInputStream &) = delete;
/* virtual methods from InputStream */ /* virtual methods from InputStream */
[[nodiscard]] bool IsEOF() const noexcept override; [[nodiscard]] bool IsEOF() const noexcept override;
size_t Read(std::unique_lock<Mutex> &lock, size_t Read(std::unique_lock<Mutex> &lock,

View File

@ -41,6 +41,9 @@ public:
Stop(); Stop();
} }
MmsInputStream(const MmsInputStream &) = delete;
MmsInputStream &operator=(const MmsInputStream &) = delete;
protected: protected:
void Open() override; void Open() override;
size_t ThreadRead(void *ptr, size_t size) override; size_t ThreadRead(void *ptr, size_t size) override;

View File

@ -51,6 +51,9 @@ public:
DeferClose(); DeferClose();
} }
NfsInputStream(const NfsInputStream &) = delete;
NfsInputStream &operator=(const NfsInputStream &) = delete;
void Open() { void Open() {
assert(!IsReady()); assert(!IsReady());

View File

@ -57,6 +57,9 @@ public:
qobuz_client->RemoveLoginHandler(*this); qobuz_client->RemoveLoginHandler(*this);
} }
QobuzInputStream(const QobuzInputStream &) = delete;
QobuzInputStream &operator=(const QobuzInputStream &) = delete;
/* virtual methods from InputStream */ /* virtual methods from InputStream */
void Check() override { void Check() override {

View File

@ -70,6 +70,9 @@ public:
tidal_session->RemoveLoginHandler(*this); tidal_session->RemoveLoginHandler(*this);
} }
TidalInputStream(const TidalInputStream &) = delete;
TidalInputStream &operator=(const TidalInputStream &) = delete;
/* virtual methods from InputStream */ /* virtual methods from InputStream */
void Check() override { void Check() override {

View File

@ -57,6 +57,9 @@ public:
better solution? */ better solution? */
} }
CurlSocket(const CurlSocket &) = delete;
CurlSocket &operator=(const CurlSocket &) = delete;
auto &GetEventLoop() const noexcept { auto &GetEventLoop() const noexcept {
return socket_event.GetEventLoop(); return socket_event.GetEventLoop();
} }

View File

@ -63,6 +63,9 @@ public:
}); });
} }
AlsaMixerMonitor(const AlsaMixerMonitor &) = delete;
AlsaMixerMonitor &operator=(const AlsaMixerMonitor &) = delete;
private: private:
Event::Duration PrepareSockets() noexcept override; Event::Duration PrepareSockets() noexcept override;
void DispatchSockets() noexcept override; void DispatchSockets() noexcept override;
@ -87,6 +90,9 @@ public:
~AlsaMixer() override; ~AlsaMixer() override;
AlsaMixer(const AlsaMixer &) = delete;
AlsaMixer &operator=(const AlsaMixer &) = delete;
void Configure(const ConfigBlock &block); void Configure(const ConfigBlock &block);
void Setup(); void Setup();

View File

@ -55,6 +55,9 @@ public:
~PulseMixer() override; ~PulseMixer() override;
PulseMixer(const PulseMixer &) = delete;
PulseMixer &operator=(const PulseMixer &) = delete;
void Offline(); void Offline();
void VolumeCallback(const pa_sink_input_info *i, int eol); void VolumeCallback(const pa_sink_input_info *i, int eol);
void Update(pa_context *context, pa_stream *stream); void Update(pa_context *context, pa_stream *stream);

View File

@ -38,6 +38,7 @@ class UpnpNeighborExplorer final
:name(std::move(_name)), comment(std::move(_comment)), :name(std::move(_name)), comment(std::move(_comment)),
alive(true) {} alive(true) {}
Server(const Server &) = delete; Server(const Server &) = delete;
Server &operator=(const Server &) = delete;
gcc_pure gcc_pure
bool operator==(const Server &other) const noexcept { bool operator==(const Server &other) const noexcept {

View File

@ -226,6 +226,9 @@ public:
snd_config_update_free_global(); snd_config_update_free_global();
} }
AlsaOutput(const AlsaOutput &) = delete;
AlsaOutput &operator=(const AlsaOutput &) = delete;
using MultiSocketMonitor::GetEventLoop; using MultiSocketMonitor::GetEventLoop;
gcc_pure gcc_pure

View File

@ -42,6 +42,9 @@ public:
~AoInit() noexcept { ~AoInit() noexcept {
ao_shutdown(); ao_shutdown();
} }
AoInit(const AoInit &) = delete;
AoInit &operator=(const AoInit &) = delete;
}; };
class AoOutput final : AudioOutput, SafeSingleton<AoInit> { class AoOutput final : AudioOutput, SafeSingleton<AoInit> {
@ -55,6 +58,9 @@ class AoOutput final : AudioOutput, SafeSingleton<AoInit> {
explicit AoOutput(const ConfigBlock &block); explicit AoOutput(const ConfigBlock &block);
~AoOutput() override; ~AoOutput() override;
AoOutput(const AoOutput &) = delete;
AoOutput &operator=(const AoOutput &) = delete;
public: public:
static AudioOutput *Create(EventLoop &, const ConfigBlock &block) { static AudioOutput *Create(EventLoop &, const ConfigBlock &block) {
return new AoOutput(block); return new AoOutput(block);

View File

@ -49,6 +49,9 @@ public:
CloseFifo(); CloseFifo();
} }
FifoOutput(const FifoOutput &) = delete;
FifoOutput &operator=(const FifoOutput &) = delete;
static AudioOutput *Create(EventLoop &, static AudioOutput *Create(EventLoop &,
const ConfigBlock &block) { const ConfigBlock &block) {
return new FifoOutput(block); return new FifoOutput(block);

View File

@ -51,6 +51,9 @@ struct ShoutOutput final : AudioOutput {
explicit ShoutOutput(const ConfigBlock &block); explicit ShoutOutput(const ConfigBlock &block);
~ShoutOutput() override; ~ShoutOutput() override;
ShoutOutput(const ShoutOutput &) = delete;
ShoutOutput &operator=(const ShoutOutput &) = delete;
static AudioOutput *Create(EventLoop &event_loop, static AudioOutput *Create(EventLoop &event_loop,
const ConfigBlock &block); const ConfigBlock &block);

View File

@ -85,6 +85,9 @@ public:
nfs_finish(); nfs_finish();
} }
NfsStorage(const NfsStorage &) = delete;
NfsStorage &operator=(const NfsStorage &) = delete;
/* virtual methods from class Storage */ /* virtual methods from class Storage */
StorageFileInfo GetInfo(std::string_view uri_utf8, bool follow) override; StorageFileInfo GetInfo(std::string_view uri_utf8, bool follow) override;

View File

@ -93,6 +93,9 @@ public:
} }
} }
UdisksStorage(const UdisksStorage &) = delete;
UdisksStorage &operator=(const UdisksStorage &) = delete;
EventLoop &GetEventLoop() const noexcept { EventLoop &GetEventLoop() const noexcept {
return defer_mount.GetEventLoop(); return defer_mount.GetEventLoop();
} }