From a57f21216cf5deb5dc30c1ab181fea91d15b0612 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 5 May 2017 10:19:54 +0200 Subject: Fix wav file format on ctrl-C and use more RAII --- src/faad_decoder.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/faad_decoder.cpp') diff --git a/src/faad_decoder.cpp b/src/faad_decoder.cpp index 73ea374..24c951a 100644 --- a/src/faad_decoder.cpp +++ b/src/faad_decoder.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Matthias P. Braendli (http://www.opendigitalradio.org) + Copyright (C) 2017 Matthias P. Braendli (http://www.opendigitalradio.org) 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 @@ -38,7 +38,7 @@ using namespace std; FaadDecoder::FaadDecoder() : m_data_len(0), - m_fd(NULL), + m_fd(nullptr), m_initialised(false) { } @@ -105,7 +105,7 @@ bool FaadDecoder::decode(vector > aus) } outBuffer = (int16_t *)NeAACDecDecode(m_faad_handle.decoder, &hInfo, &au[0], au.size()); - assert(outBuffer != NULL); + assert(outBuffer != nullptr); m_sample_rate = hInfo.samplerate; m_channels = hInfo.channels; @@ -125,7 +125,7 @@ bool FaadDecoder::decode(vector > aus) return false; } - if (m_fd == NULL) { + if (m_fd == nullptr) { stringstream ss; ss << m_filename << ".wav"; m_fd = wavfile_open(ss.str().c_str(), m_sample_rate); @@ -155,7 +155,7 @@ bool FaadDecoder::decode(vector > aus) void FaadDecoder::close() { - if (m_initialised) { + if (m_fd) { wavfile_close(m_fd); } } -- cgit v1.2.3