mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
cppcheck: add const
Found with constVariablePointer, constParameterPointer Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
8b9a260d18
commit
3a003c1229
@ -226,7 +226,7 @@ bool DSDIFF::File::save(int tags, StripTags strip, ID3v2::Version version)
|
||||
|
||||
// First: save ID3V2 chunk
|
||||
|
||||
ID3v2::Tag *id3v2Tag = ID3v2Tag();
|
||||
const ID3v2::Tag *id3v2Tag = ID3v2Tag();
|
||||
|
||||
if((tags & ID3v2) && id3v2Tag) {
|
||||
if(d->isID3InPropChunk) {
|
||||
@ -255,7 +255,7 @@ bool DSDIFF::File::save(int tags, StripTags strip, ID3v2::Version version)
|
||||
|
||||
// Second: save the DIIN chunk
|
||||
|
||||
DSDIFF::DIIN::Tag *diinTag = DIINTag();
|
||||
const DSDIFF::DIIN::Tag *diinTag = DIINTag();
|
||||
|
||||
if((tags & DIIN) && diinTag) {
|
||||
if(!diinTag->title().isEmpty()) {
|
||||
|
@ -138,7 +138,7 @@ MP4::Properties::read(File *file, Atoms *atoms)
|
||||
|
||||
const MP4::AtomList trakList = moov->findall("trak");
|
||||
for(const auto &track : trakList) {
|
||||
MP4::Atom *hdlr = track->find("mdia", "hdlr");
|
||||
const MP4::Atom *hdlr = track->find("mdia", "hdlr");
|
||||
if(!hdlr) {
|
||||
debug("MP4: Atom 'trak.mdia.hdlr' not found");
|
||||
return;
|
||||
@ -156,7 +156,7 @@ MP4::Properties::read(File *file, Atoms *atoms)
|
||||
return;
|
||||
}
|
||||
|
||||
MP4::Atom *mdhd = trak->find("mdia", "mdhd");
|
||||
const MP4::Atom *mdhd = trak->find("mdia", "mdhd");
|
||||
if(!mdhd) {
|
||||
debug("MP4: Atom 'trak.mdia.mdhd' not found");
|
||||
return;
|
||||
@ -186,7 +186,7 @@ MP4::Properties::read(File *file, Atoms *atoms)
|
||||
}
|
||||
if(length == 0) {
|
||||
// No length found in the media header (mdhd), try the movie header (mvhd)
|
||||
if(MP4::Atom *mvhd = moov->find("mvhd")) {
|
||||
if(const MP4::Atom *mvhd = moov->find("mvhd")) {
|
||||
file->seek(mvhd->offset());
|
||||
data = file->readBlock(mvhd->length());
|
||||
if(data.size() >= 24 + 4) {
|
||||
|
@ -65,7 +65,7 @@ MP4::Tag::Tag(TagLib::File *file, MP4::Atoms *atoms,
|
||||
d->file = file;
|
||||
d->atoms = atoms;
|
||||
|
||||
MP4::Atom *ilst = atoms->find("moov", "udta", "meta", "ilst");
|
||||
const MP4::Atom *ilst = atoms->find("moov", "udta", "meta", "ilst");
|
||||
if(!ilst) {
|
||||
//debug("Atom moov.udta.meta.ilst not found.");
|
||||
return;
|
||||
@ -268,7 +268,7 @@ MP4::Tag::saveExisting(ByteVector data, const AtomList &path)
|
||||
// check if there is an atom before 'ilst', and possibly use it as padding
|
||||
if(index != meta->children().cbegin()) {
|
||||
auto prevIndex = std::prev(index);
|
||||
MP4::Atom *prev = *prevIndex;
|
||||
const MP4::Atom *prev = *prevIndex;
|
||||
if(prev->name() == "free") {
|
||||
offset = prev->offset();
|
||||
length += prev->length();
|
||||
@ -277,7 +277,7 @@ MP4::Tag::saveExisting(ByteVector data, const AtomList &path)
|
||||
// check if there is an atom after 'ilst', and possibly use it as padding
|
||||
auto nextIndex = std::next(index);
|
||||
if(nextIndex != meta->children().cend()) {
|
||||
MP4::Atom *next = *nextIndex;
|
||||
const MP4::Atom *next = *nextIndex;
|
||||
if(next->name() == "free") {
|
||||
length += next->length();
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ void TagUnion::set(int index, Tag *tag)
|
||||
|
||||
PropertyMap TagUnion::properties() const
|
||||
{
|
||||
auto it = std::find_if(d->tags.cbegin(), d->tags.cend(), [](Tag *t) {
|
||||
auto it = std::find_if(d->tags.cbegin(), d->tags.cend(), [](const Tag *t) {
|
||||
return t && !t->isEmpty();
|
||||
});
|
||||
return it != d->tags.cend() ? (*it)->properties() : PropertyMap();
|
||||
|
Loading…
Reference in New Issue
Block a user