Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use if with initalizer #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading