From 88f54e0c428197543de4e9b3e7ca0ce99cf54905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 18 Sep 2024 11:55:19 +0200 Subject: [PATCH] Use if with initalizer --- src/encoder/encoderwave.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/encoder/encoderwave.cpp b/src/encoder/encoderwave.cpp index 91e90874cb3..7d6e8f63e77 100644 --- a/src/encoder/encoderwave.cpp +++ b/src/encoder/encoderwave.cpp @@ -166,17 +166,14 @@ void EncoderWave::initStream() { // However, while formats like Ogg/Vorbis and FLAC fully support utf-8, others like WAV and // AIFF officially only support ASCII. Writing utf-8 strings to WAV and AIF files with // libsndfile will work when read back with libsndfile, but may not work with other programs. - int ret; if (!m_metaDataTitle.isEmpty()) { - ret = sf_set_string(m_pSndfile, SF_STR_TITLE, m_metaDataTitle.toUtf8().constData()); - if (ret != 0) { + if (int ret = sf_set_string(m_pSndfile, SF_STR_TITLE, m_metaDataTitle.toUtf8().constData()); ret != 0) { qWarning("libsndfile error: %s", sf_error_number(ret)); } } if (!m_metaDataArtist.isEmpty()) { - ret = sf_set_string(m_pSndfile, SF_STR_ARTIST, m_metaDataArtist.toUtf8().constData()); - if (ret != 0) { + if (int ret = sf_set_string(m_pSndfile, SF_STR_ARTIST, m_metaDataArtist.toUtf8().constData()); ret != 0) { qWarning("libsndfile error: %s", sf_error_number(ret)); } } @@ -187,8 +184,7 @@ void EncoderWave::initStream() { // write the SF_STR_COMMENT string into the text chunk with id "ANNO". strType = SF_STR_COMMENT; } - ret = sf_set_string(m_pSndfile, strType, m_metaDataAlbum.toUtf8().constData()); - if (ret != 0) { + if (int ret = sf_set_string(m_pSndfile, strType, m_metaDataAlbum.toUtf8().constData()); ret != 0) { qWarning("libsndfile error: %s", sf_error_number(ret)); } }