Inspection: Member function can be made const

This commit is contained in:
Urs Fleisch 2024-01-20 16:48:08 +01:00
parent c907d8b273
commit b4f77a4d52
6 changed files with 16 additions and 16 deletions

View File

@ -148,7 +148,7 @@ MP4::Atom::find(const char *name1, const char *name2, const char *name3, const c
}
MP4::AtomList
MP4::Atom::findall(const char *name, bool recursive)
MP4::Atom::findall(const char *name, bool recursive) const
{
MP4::AtomList result;
for(const auto &child : std::as_const(d->children)) {
@ -240,7 +240,7 @@ MP4::Atoms::Atoms(File *file) :
MP4::Atoms::~Atoms() = default;
MP4::Atom *
MP4::Atoms::find(const char *name1, const char *name2, const char *name3, const char *name4)
MP4::Atoms::find(const char *name1, const char *name2, const char *name3, const char *name4) const
{
auto it = std::find_if(d->atoms.cbegin(), d->atoms.cend(),
[&name1](Atom *atom) { return atom->name() == name1; });
@ -248,7 +248,7 @@ MP4::Atoms::find(const char *name1, const char *name2, const char *name3, const
}
MP4::AtomList
MP4::Atoms::path(const char *name1, const char *name2, const char *name3, const char *name4)
MP4::Atoms::path(const char *name1, const char *name2, const char *name3, const char *name4) const
{
MP4::AtomList path;
auto it = std::find_if(d->atoms.cbegin(), d->atoms.cend(),

View File

@ -82,7 +82,7 @@ namespace TagLib {
Atom &operator=(const Atom &) = delete;
Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
bool path(AtomList &path, const char *name1, const char *name2 = nullptr, const char *name3 = nullptr);
AtomList findall(const char *name, bool recursive = false);
AtomList findall(const char *name, bool recursive = false) const;
void addToOffset(offset_t delta);
void prependChild(Atom *atom);
bool removeChild(Atom *meta);
@ -105,8 +105,8 @@ namespace TagLib {
~Atoms();
Atoms(const Atoms &) = delete;
Atoms &operator=(const Atoms &) = delete;
Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
AtomList path(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr);
Atom *find(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr) const;
AtomList path(const char *name1, const char *name2 = nullptr, const char *name3 = nullptr, const char *name4 = nullptr) const;
bool checkRootLevelAtoms();
const AtomList &atoms() const;

View File

@ -125,7 +125,7 @@ MP4::Properties::codec() const
////////////////////////////////////////////////////////////////////////////////
void
MP4::Properties::read(File *file, Atoms *atoms)
MP4::Properties::read(File *file, const Atoms *atoms)
{
MP4::Atom *moov = atoms->find("moov");
if(!moov) {

View File

@ -88,7 +88,7 @@ namespace TagLib {
Codec codec() const;
private:
void read(File *file, Atoms *atoms);
void read(File *file, const Atoms *atoms);
class PropertiesPrivate;
TAGLIB_MSVC_SUPPRESS_WARNING_NEEDS_TO_HAVE_DLL_INTERFACE

View File

@ -41,27 +41,27 @@ public:
PublicRIFF(FileName file) : RIFF::File(file, BigEndian)
{
}
unsigned int riffSize()
unsigned int riffSize() const
{
return RIFF::File::riffSize();
}
unsigned int chunkCount()
unsigned int chunkCount() const
{
return RIFF::File::chunkCount();
}
offset_t chunkOffset(unsigned int i)
offset_t chunkOffset(unsigned int i) const
{
return RIFF::File::chunkOffset(i);
}
unsigned int chunkPadding(unsigned int i)
unsigned int chunkPadding(unsigned int i) const
{
return RIFF::File::chunkPadding(i);
}
unsigned int chunkDataSize(unsigned int i)
unsigned int chunkDataSize(unsigned int i) const
{
return RIFF::File::chunkDataSize(i);
}
ByteVector chunkName(unsigned int i)
ByteVector chunkName(unsigned int i) const
{
return RIFF::File::chunkName(i);
}

View File

@ -39,7 +39,7 @@ using namespace TagLib;
namespace {
void propertiesToMap(
TagLib_File *file,
const TagLib_File *file,
std::unordered_map<std::string, std::list<std::string>> &propertyMap)
{
if(char **keys = taglib_property_keys(file)) {
@ -59,7 +59,7 @@ void propertiesToMap(
}
void complexPropertyKeysToList(
TagLib_File *file,
const TagLib_File *file,
std::list<std::string> &keyList)
{
if(char **complexKeys = taglib_complex_property_keys(file)) {