Skip to content

Commit

Permalink
Use if with initalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer authored Sep 18, 2024
1 parent 1653504 commit 88f54e0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/encoder/encoderwave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand All @@ -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));
}
}
Expand Down

0 comments on commit 88f54e0

Please sign in to comment.