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

Writing Tags: Handle inaccessible tags correctly #571

Merged
merged 2 commits into from
Apr 28, 2015
Merged

Writing Tags: Handle inaccessible tags correctly #571

merged 2 commits into from
Apr 28, 2015

Conversation

uklotzde
Copy link
Contributor

Do not segfault when trying to write metadata into files with inaccessible tags.

Observed for some .m4a files when TagLib failed to access (read/write) the existing MP4 tag. In this case calling tag() might return 0.

Only relevant when writing metadata into file tags has been enabled.

Observed for some .m4a files when TagLib failed to access (read/write) the
existing MP4 tag.

if (kFileTypeMP3 == fileType) {
QScopedPointer<TagLib::MPEG::File> pMPEGFile(
new TagLib::MPEG::File(fileName.toLocal8Bit().constData()));
bool defaultID3V2 = true;
if (hasAPETag(*pMPEGFile)) {
writeTrackMetadataIntoAPETag(pMPEGFile->APETag(), trackMetadata);
tagWritten |= writeTrackMetadataIntoAPETag(pMPEGFile->APETag(), trackMetadata);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like you care about individual bits. On the other hand it is a nice on-liner :-/
Do you actually need to care about the previous state? From a short skim over the code it looks like we are only pass such statement once.

@uklotzde
Copy link
Contributor Author

The bitwise-or-assignment operator is just the most compact way to collect the results that are needed for the final evaluation. The new name of the boolean variable hopefully reveals the intention better than before.

I've also added a separate warning message for each possible error.

@daschuer
Copy link
Member

Thank you for the fix! LGTM

daschuer added a commit that referenced this pull request Apr 28, 2015
Writing Tags: Handle inaccessible tags correctly
@daschuer daschuer merged commit bfc533d into mixxxdj:master Apr 28, 2015
@uklotzde uklotzde deleted the TagWritingFixes branch May 6, 2015 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants