Fix numerous warnings arising from addition of -Weffc++.
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 15 Sep 2013 08:10:55 +0000 (18:10 +1000)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sun, 15 Sep 2013 08:10:55 +0000 (18:10 +1000)
examples/cpp/decode/file/main.cpp
include/FLAC++/metadata.h
src/libFLAC++/metadata.cpp
src/test_libFLAC++/decoders.cpp
src/test_libFLAC++/encoders.cpp

index 64f4038..72a938b 100644 (file)
@@ -72,6 +72,9 @@ protected:
        virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
        virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
        virtual void error_callback(::FLAC__StreamDecoderErrorStatus status);
+private:
+       OurDecoder(const OurDecoder&);
+       OurDecoder&operator=(const OurDecoder&);
 };
 
 int main(int argc, char *argv[])
index d0c5c77..afa157e 100644 (file)
@@ -1090,6 +1090,10 @@ namespace FLAC {
                protected:
                        ::FLAC__Metadata_SimpleIterator *iterator_;
                        void clear();
+
+               private: // Do not use.
+                       SimpleIterator(const SimpleIterator&);
+                       SimpleIterator&operator=(const SimpleIterator&);
                };
 
                /* \} */
@@ -1174,6 +1178,10 @@ namespace FLAC {
                protected:
                        ::FLAC__Metadata_Chain *chain_;
                        virtual void clear();
+
+               private: // Do not use.
+                       Chain(const Chain&);
+                       Chain&operator=(const Chain&);
                };
 
                /** This class is a wrapper around the FLAC__metadata_iterator
@@ -1204,6 +1212,10 @@ namespace FLAC {
                protected:
                        ::FLAC__Metadata_Iterator *iterator_;
                        virtual void clear();
+
+               private: // Do not use.
+                       Iterator(const Iterator&);
+                       Iterator&operator=(const Iterator&);
                };
 
                /* \} */
index d6fff06..7dbfc31 100644 (file)
@@ -523,36 +523,72 @@ namespace FLAC {
                // VorbisComment::Entry
                //
 
-               VorbisComment::Entry::Entry()
+               VorbisComment::Entry::Entry() :
+                       is_valid_(true),
+                       entry_(),
+                       field_name_(0),
+                       field_name_length_(0),
+                       field_value_(0),
+                       field_value_length_(0)
                {
                        zero();
                }
 
-               VorbisComment::Entry::Entry(const char *field, unsigned field_length)
+               VorbisComment::Entry::Entry(const char *field, unsigned field_length) :
+                       is_valid_(true),
+                       entry_(),
+                       field_name_(0),
+                       field_name_length_(0),
+                       field_value_(0),
+                       field_value_length_(0)
                {
                        zero();
                        construct(field, field_length);
                }
 
-               VorbisComment::Entry::Entry(const char *field)
+               VorbisComment::Entry::Entry(const char *field) :
+                       is_valid_(true),
+                       entry_(),
+                       field_name_(0),
+                       field_name_length_(0),
+                       field_value_(0),
+                       field_value_length_(0)
                {
                        zero();
                        construct(field);
                }
 
-               VorbisComment::Entry::Entry(const char *field_name, const char *field_value, unsigned field_value_length)
+               VorbisComment::Entry::Entry(const char *field_name, const char *field_value, unsigned field_value_length) :
+                       is_valid_(true),
+                       entry_(),
+                       field_name_(0),
+                       field_name_length_(0),
+                       field_value_(0),
+                       field_value_length_(0)
                {
                        zero();
                        construct(field_name, field_value, field_value_length);
                }
 
-               VorbisComment::Entry::Entry(const char *field_name, const char *field_value)
+               VorbisComment::Entry::Entry(const char *field_name, const char *field_value) :
+                       is_valid_(true),
+                       entry_(),
+                       field_name_(0),
+                       field_name_length_(0),
+                       field_value_(0),
+                       field_value_length_(0)
                {
                        zero();
                        construct(field_name, field_value);
                }
 
-               VorbisComment::Entry::Entry(const Entry &entry)
+               VorbisComment::Entry::Entry(const Entry &entry) :
+                       is_valid_(true),
+                       entry_(),
+                       field_name_(0),
+                       field_name_length_(0),
+                       field_value_(0),
+                       field_value_length_(0)
                {
                        FLAC__ASSERT(entry.is_valid());
                        zero();
index 23a6778..77fe7e9 100644 (file)
@@ -125,6 +125,7 @@ public:
        bool error_occurred_;
 
        DecoderCommon(Layer layer): layer_(layer), current_metadata_number_(0), ignore_errors_(false), error_occurred_(false) { }
+       virtual ~DecoderCommon(void) { }
        ::FLAC__StreamDecoderWriteStatus common_write_callback_(const ::FLAC__Frame *frame);
        void common_metadata_callback_(const ::FLAC__StreamMetadata *metadata);
        void common_error_callback_(::FLAC__StreamDecoderErrorStatus status);
@@ -193,6 +194,9 @@ public:
        void error_callback(::FLAC__StreamDecoderErrorStatus status);
 
        bool test_respond(bool is_ogg);
+private:
+       StreamDecoder(const StreamDecoder&);
+       StreamDecoder&operator=(const StreamDecoder&);
 };
 
 ::FLAC__StreamDecoderReadStatus StreamDecoder::read_callback(FLAC__byte buffer[], size_t *bytes)
index 98b4685..e484c94 100644 (file)
@@ -106,6 +106,9 @@ public:
        ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
        ::FLAC__StreamEncoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
        void metadata_callback(const ::FLAC__StreamMetadata *metadata);
+private:
+       StreamEncoder(const StreamEncoder&);
+       StreamEncoder&operator=(const StreamEncoder&);
 };
 
 ::FLAC__StreamEncoderReadStatus StreamEncoder::read_callback(FLAC__byte buffer[], size_t *bytes)