From fd695b094880cb65b300e2f7eb1ae1dcac586cef Mon Sep 17 00:00:00 2001 From: krcroft Date: Tue, 5 Nov 2019 17:22:40 -0800 Subject: [PATCH] Cleanup comments and NULL-handling in decoders --- src/libs/decoders/flac.c | 2 +- src/libs/decoders/mp3.cpp | 14 +++++++------- src/libs/decoders/vorbis.c | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/libs/decoders/flac.c b/src/libs/decoders/flac.c index eba6f47f..94445478 100644 --- a/src/libs/decoders/flac.c +++ b/src/libs/decoders/flac.c @@ -17,7 +17,7 @@ * published by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This SDL_sound Ogg Opus decoder backend is distributed in the hope that it + * This SDL_sound FLAC decoder backend is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. diff --git a/src/libs/decoders/mp3.cpp b/src/libs/decoders/mp3.cpp index 28ea00e3..cdc75687 100644 --- a/src/libs/decoders/mp3.cpp +++ b/src/libs/decoders/mp3.cpp @@ -90,14 +90,14 @@ static void MP3_close(Sound_Sample* const sample) { Sound_SampleInternal* const internal = static_cast(sample->opaque); mp3_t* p_mp3 = static_cast(internal->decoder_private); - if (p_mp3 != NULL) { - if (p_mp3->p_dr != NULL) { + if (p_mp3 != nullptr) { + if (p_mp3->p_dr != nullptr) { drmp3_uninit(p_mp3->p_dr); SDL_free(p_mp3->p_dr); } // maps and vector destructors free their memory SDL_free(p_mp3); - internal->decoder_private = NULL; + internal->decoder_private = nullptr; } } /* MP3_close */ @@ -147,10 +147,10 @@ static Sint32 MP3_open(Sound_Sample* const sample, const char* const ext) Sound_SampleInternal* const internal = static_cast(sample->opaque); Sint32 result(0); // assume failure until proven otherwise mp3_t* p_mp3 = (mp3_t*) SDL_calloc(1, sizeof (mp3_t)); - if (p_mp3 != NULL) { + if (p_mp3 != nullptr) { p_mp3->p_dr = (drmp3*) SDL_calloc(1, sizeof (drmp3)); - if (p_mp3->p_dr != NULL) { - result = drmp3_init(p_mp3->p_dr, mp3_read, mp3_seek, sample, NULL, NULL); + if (p_mp3->p_dr != nullptr) { + result = drmp3_init(p_mp3->p_dr, mp3_read, mp3_seek, sample, nullptr, nullptr); if (result == DRMP3_TRUE) { SNDDBG(("MP3: Accepting data stream.\n")); sample->flags = SOUND_SAMPLEFLAG_CANSEEK; @@ -199,7 +199,7 @@ static Sint32 MP3_seek(Sound_Sample* const sample, const Uint32 ms) } /* MP3_seek */ /* dr_mp3 will play layer 1 and 2 files, too */ -static const char* extensions_mp3[] = { "MP3", "MP2", "MP1", NULL }; +static const char* extensions_mp3[] = { "MP3", "MP2", "MP1", nullptr }; extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3 = { { diff --git a/src/libs/decoders/vorbis.c b/src/libs/decoders/vorbis.c index 228a6471..6211173f 100644 --- a/src/libs/decoders/vorbis.c +++ b/src/libs/decoders/vorbis.c @@ -17,10 +17,9 @@ * published by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * This SDL_sound Ogg Opus decoder backend is distributed in the hope that it - * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This decoder backend is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the SDL Sound Library. If not, see .