diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-12 21:03:34 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2020-08-12 21:03:34 +0000 |
| commit | 7ef8d11baeaf1847ba7f1df5d858f8cffea9300d (patch) | |
| tree | a741fb49db8834efd4b46d760b89082547eb2a9d /src/plugins/Input/mpeg | |
| parent | 6f301f5880f7efce76ed46e7b502830642b87370 (diff) | |
| download | qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.tar.gz qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.tar.bz2 qmmp-7ef8d11baeaf1847ba7f1df5d858f8cffea9300d.zip | |
coding style fixes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9470 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/mpeg')
| -rw-r--r-- | src/plugins/Input/mpeg/decoder_mad.cpp | 17 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/decoder_mad.h | 42 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/decoder_mpg123.cpp | 13 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/decoder_mpg123.h | 12 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/mpegmetadatamodel.cpp | 8 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/settingsdialog.h | 2 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/tagextractor.cpp | 16 | ||||
| -rw-r--r-- | src/plugins/Input/mpeg/tagextractor.h | 5 |
8 files changed, 45 insertions, 70 deletions
diff --git a/src/plugins/Input/mpeg/decoder_mad.cpp b/src/plugins/Input/mpeg/decoder_mad.cpp index f6645119d..58f48f680 100644 --- a/src/plugins/Input/mpeg/decoder_mad.cpp +++ b/src/plugins/Input/mpeg/decoder_mad.cpp @@ -3,7 +3,7 @@ * * * Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> * * Copyright (C) 2000-2004 Robert Leslie <rob@mars.org> * - * Copyright (C) 2009-2018 Ilya Kotov forkotov02@ya.ru * + * Copyright (C) 2009-2020 Ilya Kotov forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -34,20 +34,7 @@ #define INPUT_BUFFER_SIZE (32*1024) DecoderMAD::DecoderMAD(QIODevice *i) : Decoder(i) -{ - m_inited = false; - m_totalTime = 0; - m_channels = 0; - m_bitrate = 0; - m_freq = 0; - m_len = 0; - m_input_buf = nullptr; - m_input_bytes = 0; - m_skip_frames = 0; - m_eof = false; - m_skip_bytes = 0; - m_play_bytes = -1; -} +{} DecoderMAD::~DecoderMAD() { diff --git a/src/plugins/Input/mpeg/decoder_mad.h b/src/plugins/Input/mpeg/decoder_mad.h index bd986b80f..d8640634c 100644 --- a/src/plugins/Input/mpeg/decoder_mad.h +++ b/src/plugins/Input/mpeg/decoder_mad.h @@ -3,7 +3,7 @@ * * * Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com> * * Copyright (C) 2000-2004 Robert Leslie <rob@mars.org> * - * Copyright (C) 2009-2018 Ilya Kotov forkotov02@ya.ru * + * Copyright (C) 2009-2020 Ilya Kotov forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -31,7 +31,7 @@ class DecoderMAD : public Decoder { public: - DecoderMAD(QIODevice *i); + explicit DecoderMAD(QIODevice *i); virtual ~DecoderMAD(); // standard decoder API @@ -61,36 +61,28 @@ private: bool findXingHeader(struct mad_bitptr, unsigned int bitlen); LameHeader *findLameHeader(struct mad_bitptr ptr, unsigned int bitlen); uint findID3v2(uchar *data, ulong size); - bool m_inited, m_eof; - qint64 m_totalTime; - int m_channels, m_skip_frames; - uint m_bitrate; - long m_freq, m_len; + + bool m_inited = false, m_eof = false; + qint64 m_totalTime = 0; + int m_channels = 0, m_skip_frames = 0; + uint m_bitrate = 0; + long m_freq = 0, m_len = 0; // file input buffer - char *m_input_buf; - qint64 m_input_bytes; + char *m_input_buf = nullptr; + qint64 m_input_bytes = 0; // MAD decoder //xing header struct XingHeader { - int flags; - unsigned long frames; - unsigned long bytes; - unsigned char toc[100]; - long scale; - LameHeader *lame; - - XingHeader() - { - flags = 0; - frames = 0; - bytes = 0; - scale = 0; - lame = nullptr; - } + int flags = 0; + unsigned long frames = 0; + unsigned long bytes = 0; + unsigned char toc[100] = { 0 }; + long scale = 0; + LameHeader *lame = nullptr; }; XingHeader m_xing; @@ -105,7 +97,7 @@ private: struct mad_stream m_stream; struct mad_frame m_frame; struct mad_synth m_synth; - qint64 m_skip_bytes, m_play_bytes; + qint64 m_skip_bytes = 0, m_play_bytes = -1; }; diff --git a/src/plugins/Input/mpeg/decoder_mpg123.cpp b/src/plugins/Input/mpeg/decoder_mpg123.cpp index e359f455d..a830c2c0c 100644 --- a/src/plugins/Input/mpeg/decoder_mpg123.cpp +++ b/src/plugins/Input/mpeg/decoder_mpg123.cpp @@ -29,13 +29,13 @@ ssize_t mpg123_read_cb (void *src, void *buf, size_t size) { - DecoderMPG123 *d = (DecoderMPG123 *) src; + DecoderMPG123 *d = static_cast<DecoderMPG123 *>(src); return d->input()->read((char *)buf, size); } off_t mpg123_seek_cb(void *src, off_t offset, int whence) { - DecoderMPG123 *d = (DecoderMPG123 *) src; + DecoderMPG123 *d = static_cast<DecoderMPG123 *>(src); if (d->input()->isSequential()) return -1; @@ -61,14 +61,7 @@ off_t mpg123_seek_cb(void *src, off_t offset, int whence) } DecoderMPG123::DecoderMPG123(QIODevice *i) : Decoder(i) -{ - m_totalTime = 0; - m_rate = 0; - m_frame_info.bitrate = 0; - m_mpg123_encoding = MPG123_ENC_SIGNED_16; - m_handle = nullptr; - m_errors = 0; -} +{} DecoderMPG123::~DecoderMPG123() { diff --git a/src/plugins/Input/mpeg/decoder_mpg123.h b/src/plugins/Input/mpeg/decoder_mpg123.h index 80f4a61ac..a72d7e15a 100644 --- a/src/plugins/Input/mpeg/decoder_mpg123.h +++ b/src/plugins/Input/mpeg/decoder_mpg123.h @@ -30,7 +30,7 @@ class QIODevice; class DecoderMPG123 : public Decoder { public: - DecoderMPG123(QIODevice *i); + explicit DecoderMPG123(QIODevice *i); virtual ~DecoderMPG123(); // standard decoder API @@ -43,12 +43,12 @@ public: private: void cleanup(mpg123_handle *handle); void setMPG123Format(int encoding); - mpg123_handle *m_handle; + mpg123_handle *m_handle = nullptr; mpg123_frameinfo m_frame_info; - qint64 m_totalTime; - long m_rate; - int m_mpg123_encoding; - int m_errors; + qint64 m_totalTime = 0; + long m_rate = 0; + int m_mpg123_encoding = MPG123_ENC_SIGNED_16; + int m_errors = 0; }; diff --git a/src/plugins/Input/mpeg/mpegmetadatamodel.cpp b/src/plugins/Input/mpeg/mpegmetadatamodel.cpp index 31b6bad07..a9ecad0ce 100644 --- a/src/plugins/Input/mpeg/mpegmetadatamodel.cpp +++ b/src/plugins/Input/mpeg/mpegmetadatamodel.cpp @@ -146,11 +146,11 @@ void MPEGMetaDataModel::removeCover() } MpegFileTagModel::MpegFileTagModel(bool using_rusxmms, TagLib::MPEG::File *file, TagLib::MPEG::File::TagTypes tagType) - : TagModel() + : TagModel(), + m_using_rusxmms(using_rusxmms), + m_file(file), + m_tagType(tagType) { - m_tagType = tagType; - m_file = file; - m_using_rusxmms = using_rusxmms; QSettings settings(Qmmp::configFile(), QSettings::IniFormat); settings.beginGroup("MPEG"); if (m_tagType == TagLib::MPEG::File::ID3v1) diff --git a/src/plugins/Input/mpeg/settingsdialog.h b/src/plugins/Input/mpeg/settingsdialog.h index 26a5f23da..d2faf9b67 100644 --- a/src/plugins/Input/mpeg/settingsdialog.h +++ b/src/plugins/Input/mpeg/settingsdialog.h @@ -30,7 +30,7 @@ class SettingsDialog : public QDialog { Q_OBJECT public: - SettingsDialog(bool using_rusxmms, QWidget *parent = nullptr); + explicit SettingsDialog(bool using_rusxmms, QWidget *parent = nullptr); ~SettingsDialog(); diff --git a/src/plugins/Input/mpeg/tagextractor.cpp b/src/plugins/Input/mpeg/tagextractor.cpp index e94a1368f..715cc1ace 100644 --- a/src/plugins/Input/mpeg/tagextractor.cpp +++ b/src/plugins/Input/mpeg/tagextractor.cpp @@ -29,11 +29,8 @@ #include "tagextractor.h" -TagExtractor::TagExtractor(QIODevice *d) -{ - m_d = d; -} - +TagExtractor::TagExtractor(QIODevice *d) : m_d(d) +{} TagExtractor::~TagExtractor() { @@ -100,14 +97,19 @@ const QMap<Qmmp::MetaData, QString> TagExtractor::id3v2tag() return m_tag; } -ID3v2Tag::ID3v2Tag(QByteArray *array, long offset) : TagLib::ID3v2::Tag() +ID3v2Tag::ID3v2Tag(QByteArray *array, long offset) : TagLib::ID3v2::Tag(), + m_offset(offset) { m_buf = new QBuffer(array); m_buf->open(QIODevice::ReadOnly); - m_offset = offset; read(); } +ID3v2Tag::~ID3v2Tag() +{ + delete m_buf; +} + void ID3v2Tag::read () { m_buf->seek(m_offset); diff --git a/src/plugins/Input/mpeg/tagextractor.h b/src/plugins/Input/mpeg/tagextractor.h index cabccf4b8..45280daf9 100644 --- a/src/plugins/Input/mpeg/tagextractor.h +++ b/src/plugins/Input/mpeg/tagextractor.h @@ -40,7 +40,7 @@ class QByteArray; class TagExtractor { public: - TagExtractor(QIODevice *d); + explicit TagExtractor(QIODevice *d); ~TagExtractor(); @@ -56,9 +56,10 @@ class ID3v2Tag : public TagLib::ID3v2::Tag { public: ID3v2Tag(QByteArray *array, long offset); + ~ID3v2Tag(); protected: - void read (); + void read(); private: QBuffer *m_buf; |
