Skip to content

Commit 5ccef25

Browse files
committed
Compile warnings: Add missing override
1 parent 746685e commit 5ccef25

28 files changed

+137
-133
lines changed

src/AudioTools/AudioCodecs/AudioCodecsBase.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class AudioDecoder : public AudioWriter, public AudioInfoSource {
2222
AudioDecoder(AudioDecoder const &) = delete;
2323
AudioDecoder &operator=(AudioDecoder const &) = delete;
2424

25-
virtual AudioInfo audioInfo() { return info; };
25+
AudioInfo audioInfo() override { return info; };
2626

2727
/// for most decoders this is not needed
28-
virtual void setAudioInfo(AudioInfo from) override {
28+
void setAudioInfo(AudioInfo from) override {
2929
TRACED();
3030
if (info != from) {
3131
notifyAudioChange(from);
@@ -97,7 +97,7 @@ class AudioEncoder : public AudioWriter {
9797
virtual const char *mime() = 0;
9898
/// Defines the sample rate, number of channels and bits per sample
9999
void setAudioInfo(AudioInfo from) override { info = from; }
100-
AudioInfo audioInfo() { return info; }
100+
AudioInfo audioInfo() override { return info; }
101101

102102
protected:
103103
AudioInfo info;
@@ -230,10 +230,10 @@ class StreamingDecoderAdapter : public StreamingDecoder {
230230
AudioInfo audioInfo() override { return p_decoder->audioInfo(); }
231231

232232
/// checks if the class is active
233-
virtual operator bool() { return *p_decoder; }
233+
virtual operator bool() override { return *p_decoder; }
234234

235235
/// Process a single read operation - to be called in the loop
236-
virtual bool copy() {
236+
virtual bool copy() override {
237237
int read = readBytes(&buffer[0], buffer.size());
238238
int written = 0;
239239
if (read > 0) written = p_decoder->write(&buffer[0], read);

src/AudioTools/AudioCodecs/AudioEncoded.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class EncodedAudioOutput : public ModifyingOutput {
9494
}
9595
}
9696

97-
void setOutput(Print &outputStream) { setOutput(&outputStream); }
97+
void setOutput(Print &outputStream) override { setOutput(&outputStream); }
9898

9999
/// Defines the output
100100
void setOutput(Print *outputStream) {
@@ -151,7 +151,7 @@ class EncodedAudioOutput : public ModifyingOutput {
151151
}
152152

153153
/// Starts the processing - sets the status to active
154-
virtual bool begin(AudioInfo newInfo) {
154+
virtual bool begin(AudioInfo newInfo) override {
155155
cfg = newInfo;
156156
return begin();
157157
}
@@ -194,7 +194,7 @@ class EncodedAudioOutput : public ModifyingOutput {
194194
}
195195

196196
/// Returns true if status is active and we still have data to be processed
197-
operator bool() { return active; }
197+
operator bool() override { return active; }
198198

199199
/// Provides the initialized decoder
200200
AudioDecoder &decoder() { return *decoder_ptr; }
@@ -286,22 +286,22 @@ class EncodedAudioStream : public ReformatBaseStream {
286286

287287
void setOutput(Print *stream) { setOutput(*stream); }
288288

289-
void setStream(AudioStream &stream) {
289+
void setStream(AudioStream &stream) override {
290290
ReformatBaseStream::setStream(stream);
291291
enc_out.setOutput(&stream);
292292
}
293293

294-
void setStream(Stream &stream) {
294+
void setStream(Stream &stream) override {
295295
ReformatBaseStream::setStream(stream);
296296
enc_out.setOutput(&stream);
297297
}
298298

299-
void setOutput(AudioOutput &stream) {
299+
void setOutput(AudioOutput &stream) override {
300300
ReformatBaseStream::setOutput(stream);
301301
enc_out.setOutput(&stream);
302302
}
303303

304-
void setOutput(Print &out) {
304+
void setOutput(Print &out) override {
305305
ReformatBaseStream::setOutput(out);
306306
enc_out.setOutput(&out);
307307
}
@@ -316,26 +316,26 @@ class EncodedAudioStream : public ReformatBaseStream {
316316
return begin();
317317
}
318318

319-
bool begin() {
319+
bool begin() override {
320320
// is_output_notify = false;
321321
setupReader();
322322
ReformatBaseStream::begin();
323323
return enc_out.begin(audioInfo());
324324
}
325325

326-
void end() {
326+
void end() override {
327327
enc_out.end();
328328
reader.end();
329329
}
330330

331-
int availableForWrite() { return enc_out.availableForWrite(); }
331+
int availableForWrite() override { return enc_out.availableForWrite(); }
332332

333-
size_t write(const uint8_t *data, size_t len) {
333+
size_t write(const uint8_t *data, size_t len) override {
334334
// addNotifyOnFirstWrite();
335335
return enc_out.write(data, len);
336336
}
337337

338-
size_t readBytes(uint8_t *data, size_t len) {
338+
size_t readBytes(uint8_t *data, size_t len) override {
339339
return reader.readBytes(data, len);
340340
}
341341

@@ -344,7 +344,7 @@ class EncodedAudioStream : public ReformatBaseStream {
344344
}
345345

346346
/// approx compression factor: e.g. mp3 is around 4
347-
float getByteFactor() { return byte_factor; }
347+
float getByteFactor() override { return byte_factor; }
348348
void setByteFactor(float factor) { byte_factor = factor; }
349349

350350
/// defines the size of the decoded frame in bytes

src/AudioTools/AudioCodecs/CodecAACFDK.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class AACDecoderFDK : public AudioDecoder {
3636
}
3737

3838
/// Defines the output stream
39-
void setOutput(Print &out_stream){
39+
void setOutput(Print &out_stream) override {
4040
dec->setOutput(out_stream);
4141
}
4242

43-
bool begin(){
43+
bool begin() override {
4444
return dec->begin(TT_MP4_ADTS, 1);
4545
}
4646

@@ -61,7 +61,7 @@ class AACDecoderFDK : public AudioDecoder {
6161
}
6262

6363
// write AAC data to be converted to PCM data
64-
virtual size_t write(const uint8_t *data, size_t len) {
64+
virtual size_t write(const uint8_t *data, size_t len) override {
6565
return dec->write(data, len);
6666
}
6767

@@ -81,12 +81,12 @@ class AACDecoderFDK : public AudioDecoder {
8181
}
8282

8383
// release the resources
84-
void end(){
84+
void end() override {
8585
TRACED();
8686
dec->end();
8787
}
8888

89-
virtual operator bool() {
89+
virtual operator bool() override {
9090
return (bool)*dec;
9191
}
9292

@@ -142,7 +142,7 @@ class AACEncoderFDK : public AudioEncoder {
142142
}
143143

144144
/// Defines the output
145-
void setOutput(Print &out_stream){
145+
void setOutput(Print &out_stream) override {
146146
enc->setOutput(out_stream);
147147
}
148148

@@ -253,7 +253,7 @@ class AACEncoderFDK : public AudioEncoder {
253253
* @param info
254254
* @return int
255255
*/
256-
virtual bool begin(AudioInfo info) {
256+
virtual bool begin(AudioInfo info) override {
257257
TRACED();
258258
return enc->begin(info.channels,info.sample_rate, info.bits_per_sample);
259259
}
@@ -272,19 +272,19 @@ class AACEncoderFDK : public AudioEncoder {
272272
}
273273

274274
// starts the processing
275-
bool begin() {
275+
bool begin() override {
276276
enc->begin();
277277
return true;
278278
}
279279

280280
// convert PCM data to AAC
281-
size_t write(const uint8_t *data, size_t len){
281+
size_t write(const uint8_t *data, size_t len) override {
282282
LOGD("write %d bytes", (int)len);
283283
return enc->write((uint8_t*)data, len);
284284
}
285285

286286
// release resources
287-
void end(){
287+
void end() override {
288288
TRACED();
289289
enc->end();
290290
}
@@ -301,11 +301,11 @@ class AACEncoderFDK : public AudioEncoder {
301301
return enc;
302302
}
303303

304-
const char *mime() {
304+
const char *mime() override {
305305
return "audio/aac";
306306
}
307307

308-
operator bool(){
308+
operator bool() override {
309309
return (bool) *enc;
310310
}
311311

src/AudioTools/AudioCodecs/CodecAACHelix.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class AACDecoderHelix : public AudioDecoder {
7575
// }
7676

7777
/// Defines the output Stream
78-
virtual void setOutput(Print &out_stream){
78+
virtual void setOutput(Print &out_stream) override {
7979
TRACED();
8080
AudioDecoder::setOutput(out_stream);
8181
if (aac!=nullptr) aac->setOutput(out_stream);

src/AudioTools/AudioCodecs/CodecMP3Helix.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class MP3DecoderHelix : public AudioDecoder {
7878
}
7979

8080
/// Starts the processing
81-
bool begin(){
81+
bool begin() override {
8282
TRACED();
8383
if (mp3!=nullptr) {
8484
//mp3->setDelay(CODEC_DELAY_MS);
@@ -88,7 +88,7 @@ class MP3DecoderHelix : public AudioDecoder {
8888
}
8989

9090
/// Releases the reserved memory
91-
void end(){
91+
void end() override {
9292
TRACED();
9393
if (mp3!=nullptr) mp3->end();
9494
}
@@ -107,14 +107,14 @@ class MP3DecoderHelix : public AudioDecoder {
107107
}
108108

109109
/// Write mp3 data to decoder
110-
size_t write(const uint8_t* data, size_t len) {
110+
size_t write(const uint8_t* data, size_t len) override {
111111
LOGD("%s: %zu", LOG_METHOD, len);
112112
if (mp3==nullptr) return 0;
113113
return mp3->write((uint8_t*)data, len);
114114
}
115115

116116
/// checks if the class is active
117-
operator bool(){
117+
operator bool() override {
118118
return mp3!=nullptr && (bool) *mp3;
119119
}
120120

src/AudioTools/AudioCodecs/CodecMP3MAD.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MP3DecoderMAD : public AudioDecoder {
4444
delete mad;
4545
}
4646

47-
void setOutput(Print &out){
47+
void setOutput(Print &out) override {
4848
TRACED();
4949
mad->setOutput(out);
5050
}
@@ -62,14 +62,14 @@ class MP3DecoderMAD : public AudioDecoder {
6262
}
6363

6464
/// Starts the processing
65-
bool begin(){
65+
bool begin() override {
6666
TRACED();
6767
mad->begin();
6868
return true;
6969
}
7070

7171
/// Releases the reserved memory
72-
void end(){
72+
void end() override{
7373
TRACED();
7474
mad->end();
7575
}
@@ -91,7 +91,7 @@ class MP3DecoderMAD : public AudioDecoder {
9191
}
9292

9393
/// Makes the mp3 data available for decoding: however we recommend to provide the data via a callback or input stream
94-
size_t write(const uint8_t *data, size_t len){
94+
size_t write(const uint8_t *data, size_t len) override {
9595
TRACED();
9696
return mad->write(data,len);
9797
}
@@ -103,7 +103,7 @@ class MP3DecoderMAD : public AudioDecoder {
103103
}
104104

105105
/// Returns true as long as we are processing data
106-
operator bool(){
106+
operator bool() override{
107107
return (bool)*mad;
108108
}
109109

@@ -123,7 +123,7 @@ class MP3DecoderMAD : public AudioDecoder {
123123
}
124124
}
125125

126-
virtual void addNotifyAudioChange(AudioInfoSupport &bi) {
126+
virtual void addNotifyAudioChange(AudioInfoSupport &bi) override {
127127
TRACED();
128128
audioChangeMAD = &bi;
129129
// register audio change handler

src/AudioTools/AudioCodecs/CodecWAV.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class WAVHeader {
7171
headerInfo.bits_per_sample = read_int16();
7272
if (!setPos("data")) return false;
7373
headerInfo.data_length = read_int32();
74-
if (!headerInfo.data_length==0 || headerInfo.data_length >= 0x7fff0000) {
74+
if (headerInfo.data_length==0 || headerInfo.data_length >= 0x7fff0000) {
7575
headerInfo.is_streamed = true;
7676
headerInfo.data_length = ~0;
7777
}
@@ -128,7 +128,8 @@ class WAVHeader {
128128
}
129129

130130
void dumpHeader() {
131-
char msg[buffer.available()+1] = {0};
131+
char msg[buffer.available()+1];
132+
memset(msg, 0, buffer.available()+1);
132133
for (int j = 0; j< buffer.available();j++){
133134
char c = (char)buffer.data()[j];
134135
if (!isalpha(c)){

src/AudioTools/AudioCodecs/HeaderParserMP3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class HeaderParserMP3 {
153153
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, -1},
154154
},
155155
};
156-
signed char rate_byte = rateTable[AudioVersion][Layer][BitrateIndex];
156+
signed char rate_byte = rateTable[(int)AudioVersion][(int)Layer][(int)BitrateIndex];
157157
if (rate_byte == -1) {
158158
LOGE("Unsupported bitrate");
159159
return 0;
@@ -178,7 +178,7 @@ class HeaderParserMP3 {
178178
{44100, 48000, 32000, 0},
179179
};
180180

181-
return rateTable[AudioVersion][SampleRateIndex];
181+
return rateTable[(int)AudioVersion][(int)SampleRateIndex];
182182
}
183183

184184
int getFrameLength() {

src/AudioTools/AudioCodecs/MultiDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class MultiDecoder : public AudioDecoder {
128128
return actual_decoder.decoder->write(data, len);
129129
}
130130

131-
virtual operator bool() {
131+
virtual operator bool() override {
132132
if (actual_decoder.decoder == &nop) return false;
133133
return is_first || actual_decoder.is_open;
134134
};

src/AudioTools/AudioLibs/AudioFFT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class AudioFFTBase : public AudioStream {
267267
}
268268
}
269269

270-
operator bool() { return p_driver != nullptr && p_driver->isValid(); }
270+
operator bool() override { return p_driver != nullptr && p_driver->isValid(); }
271271

272272
/// Notify change of audio information
273273
void setAudioInfo(AudioInfo info) override {

0 commit comments

Comments
 (0)