From 5dca3403a18ace8b5154db6ab3ea815e616cd67a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 8 Feb 2020 10:42:37 +0100 Subject: [PATCH] - use C++11 features to delete unwanted methods. --- source/decoder/mpg123_decoder.h | 9 +++++---- source/decoder/sndfile_decoder.h | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/decoder/mpg123_decoder.h b/source/decoder/mpg123_decoder.h index 4f6e955..7e91588 100644 --- a/source/decoder/mpg123_decoder.h +++ b/source/decoder/mpg123_decoder.h @@ -25,6 +25,11 @@ struct MPG123Decoder : public SoundDecoder virtual size_t getSampleOffset() override; virtual size_t getSampleLength() override; + // Make non-copyable + MPG123Decoder() = default; + MPG123Decoder(const MPG123Decoder& rhs) = delete; + MPG123Decoder& operator=(const MPG123Decoder& rhs) = delete; + virtual ~MPG123Decoder(); protected: @@ -37,10 +42,6 @@ private: static off_t file_lseek(void *handle, off_t offset, int whence); static ssize_t file_read(void *handle, void *buffer, size_t bytes); - - // Make non-copyable - MPG123Decoder(const MPG123Decoder &rhs); - MPG123Decoder& operator=(const MPG123Decoder &rhs); }; #endif diff --git a/source/decoder/sndfile_decoder.h b/source/decoder/sndfile_decoder.h index af182f4..2645ebd 100644 --- a/source/decoder/sndfile_decoder.h +++ b/source/decoder/sndfile_decoder.h @@ -21,6 +21,11 @@ struct SndFileDecoder : public SoundDecoder virtual size_t getSampleOffset() override; virtual size_t getSampleLength() override; + SndFileDecoder() = default; + // Make non-copyable + SndFileDecoder(const SndFileDecoder& rhs) = delete; + SndFileDecoder& operator=(const SndFileDecoder& rhs) = delete; + virtual ~SndFileDecoder(); protected: @@ -36,10 +41,6 @@ private: static sf_count_t file_read(void *ptr, sf_count_t count, void *user_data); static sf_count_t file_write(const void *ptr, sf_count_t count, void *user_data); static sf_count_t file_tell(void *user_data); - - // Make non-copyable - SndFileDecoder(const SndFileDecoder &rhs); - SndFileDecoder& operator=(const SndFileDecoder &rhs); }; #endif