Inspection: Parameter can be made pointer to const

This commit is contained in:
Urs Fleisch 2024-01-20 17:12:02 +01:00
parent b4f77a4d52
commit 6b17aa3694
14 changed files with 23 additions and 23 deletions

View File

@ -441,7 +441,7 @@ void taglib_property_set_append(TagLib_File *f, const char *prop, const char *va
_taglib_property_set(f, prop, value, true);
}
char** taglib_property_keys(TagLib_File *file)
char** taglib_property_keys(const TagLib_File *file)
{
if(file == NULL)
return NULL;
@ -461,7 +461,7 @@ char** taglib_property_keys(TagLib_File *file)
return props;
}
char **taglib_property_get(TagLib_File *file, const char *prop)
char **taglib_property_get(const TagLib_File *file, const char *prop)
{
if(file == NULL || prop == NULL)
return NULL;
@ -585,7 +585,7 @@ BOOL taglib_complex_property_set_append(
return _taglib_complex_property_set(file, key, value, true);
}
char** taglib_complex_property_keys(TagLib_File *file)
char** taglib_complex_property_keys(const TagLib_File *file)
{
if(file == NULL) {
return NULL;
@ -608,7 +608,7 @@ char** taglib_complex_property_keys(TagLib_File *file)
}
TagLib_Complex_Property_Attribute*** taglib_complex_property_get(
TagLib_File *file, const char *key)
const TagLib_File *file, const char *key)
{
if(file == NULL || key == NULL) {
return NULL;

View File

@ -354,7 +354,7 @@ TAGLIB_C_EXPORT void taglib_property_set_append(TagLib_File *file, const char *p
* \return NULL terminated array of C-strings (char *), only NULL if empty.
* It must be freed by the client using taglib_property_free().
*/
TAGLIB_C_EXPORT char** taglib_property_keys(TagLib_File *file);
TAGLIB_C_EXPORT char** taglib_property_keys(const TagLib_File *file);
/*!
* Get value(s) of property \a prop.
@ -362,7 +362,7 @@ TAGLIB_C_EXPORT char** taglib_property_keys(TagLib_File *file);
* \return NULL terminated array of C-strings (char *), only NULL if empty.
* It must be freed by the client using taglib_property_free().
*/
TAGLIB_C_EXPORT char** taglib_property_get(TagLib_File *file, const char *prop);
TAGLIB_C_EXPORT char** taglib_property_get(const TagLib_File *file, const char *prop);
/*!
* Frees the NULL terminated array \a props and the C-strings it contains.
@ -541,7 +541,7 @@ TAGLIB_C_EXPORT BOOL taglib_complex_property_set_append(
* \return NULL terminated array of C-strings (char *), only NULL if empty.
* It must be freed by the client using taglib_complex_property_free_keys().
*/
TAGLIB_C_EXPORT char** taglib_complex_property_keys(TagLib_File *file);
TAGLIB_C_EXPORT char** taglib_complex_property_keys(const TagLib_File *file);
/*!
* Get value(s) of complex property \a key.
@ -551,7 +551,7 @@ TAGLIB_C_EXPORT char** taglib_complex_property_keys(TagLib_File *file);
* It must be freed by the client using taglib_complex_property_free().
*/
TAGLIB_C_EXPORT TagLib_Complex_Property_Attribute*** taglib_complex_property_get(
TagLib_File *file, const char *key);
const TagLib_File *file, const char *key);
/*!
* Extract the complex property values of a picture.

View File

@ -86,7 +86,7 @@ namespace
class DSDIFF::File::FilePrivate
{
public:
FilePrivate(ID3v2::FrameFactory *frameFactory)
FilePrivate(const ID3v2::FrameFactory *frameFactory)
: ID3v2FrameFactory(frameFactory ? frameFactory
: ID3v2::FrameFactory::instance())
{

View File

@ -34,7 +34,7 @@ using namespace TagLib;
class DSF::File::FilePrivate
{
public:
FilePrivate(ID3v2::FrameFactory *frameFactory)
FilePrivate(const ID3v2::FrameFactory *frameFactory)
: ID3v2FrameFactory(frameFactory ? frameFactory
: ID3v2::FrameFactory::instance())
{

View File

@ -143,7 +143,7 @@ MP4::Atom::find(const char *name1, const char *name2, const char *name3, const c
return this;
}
auto it = std::find_if(d->children.cbegin(), d->children.cend(),
[&name1](Atom *child) { return child->d->name == name1; });
[&name1](const Atom *child) { return child->d->name == name1; });
return it != d->children.cend() ? (*it)->find(name2, name3, name4) : nullptr;
}
@ -170,7 +170,7 @@ MP4::Atom::path(MP4::AtomList &path, const char *name1, const char *name2, const
return true;
}
auto it = std::find_if(d->children.cbegin(), d->children.cend(),
[&name1](Atom *child) { return child->d->name == name1; });
[&name1](const Atom *child) { return child->d->name == name1; });
return it != d->children.cend() ? (*it)->path(path, name2, name3) : false;
}
@ -243,7 +243,7 @@ MP4::Atom *
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; });
[&name1](const Atom *atom) { return atom->name() == name1; });
return it != d->atoms.cend() ? (*it)->find(name2, name3, name4) : nullptr;
}
@ -252,7 +252,7 @@ MP4::Atoms::path(const char *name1, const char *name2, const char *name3, const
{
MP4::AtomList path;
auto it = std::find_if(d->atoms.cbegin(), d->atoms.cend(),
[&name1](Atom *atom) { return atom->name() == name1; });
[&name1](const Atom *atom) { return atom->name() == name1; });
if(it != d->atoms.cend()) {
if(!(*it)->path(path, name2, name3, name4)) {
path.clear();

View File

@ -36,7 +36,7 @@ using namespace TagLib;
class MP4::File::FilePrivate
{
public:
FilePrivate(MP4::ItemFactory *mp4ItemFactory)
FilePrivate(const MP4::ItemFactory *mp4ItemFactory)
: itemFactory(mp4ItemFactory ? mp4ItemFactory
: MP4::ItemFactory::instance())
{

View File

@ -69,7 +69,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
MP4::Properties::Properties(File *file, MP4::Atoms *atoms, ReadStyle style) :
MP4::Properties::Properties(File *file, const MP4::Atoms *atoms, ReadStyle style) :
AudioProperties(style),
d(std::make_unique<PropertiesPrivate>())
{

View File

@ -44,7 +44,7 @@ namespace TagLib {
ALAC
};
Properties(File *file, Atoms *atoms, ReadStyle style = Average);
Properties(File *file, const Atoms *atoms, ReadStyle style = Average);
~Properties() override;
Properties(const Properties &) = delete;

View File

@ -437,7 +437,7 @@ PropertyMap UserTextIdentificationFrame::asProperties() const
}
UserTextIdentificationFrame *UserTextIdentificationFrame::find(
ID3v2::Tag *tag, const String &description) // static
const ID3v2::Tag *tag, const String &description) // static
{
for(const auto &frame : std::as_const(tag->frameList("TXXX"))) {
auto f = dynamic_cast<UserTextIdentificationFrame *>(frame);

View File

@ -300,7 +300,7 @@ namespace TagLib {
* Searches for the user defined text frame with the description \a description
* in \a tag. This returns null if no matching frames were found.
*/
static UserTextIdentificationFrame *find(Tag *tag, const String &description);
static UserTextIdentificationFrame *find(const Tag *tag, const String &description);
/*!
* Returns an appropriate TXXX frame description for the given free-form tag key.

View File

@ -173,7 +173,7 @@ PropertyMap UserUrlLinkFrame::asProperties() const
return map;
}
UserUrlLinkFrame *UserUrlLinkFrame::find(ID3v2::Tag *tag, const String &description) // static
UserUrlLinkFrame *UserUrlLinkFrame::find(const ID3v2::Tag *tag, const String &description) // static
{
for(const auto &frame : std::as_const(tag->frameList("WXXX"))) {
auto f = dynamic_cast<UserUrlLinkFrame *>(frame);

View File

@ -170,7 +170,7 @@ namespace TagLib {
* Searches for the user defined url frame with the description \a description
* in \a tag. This returns null if no matching frames were found.
*/
static UserUrlLinkFrame *find(Tag *tag, const String &description);
static UserUrlLinkFrame *find(const Tag *tag, const String &description);
protected:
void parseFields(const ByteVector &data) override;

View File

@ -34,7 +34,7 @@ using namespace TagLib;
class RIFF::AIFF::File::FilePrivate
{
public:
FilePrivate(ID3v2::FrameFactory *frameFactory)
FilePrivate(const ID3v2::FrameFactory *frameFactory)
: ID3v2FrameFactory(frameFactory ? frameFactory
: ID3v2::FrameFactory::instance())
{

View File

@ -41,7 +41,7 @@ namespace
class RIFF::WAV::File::FilePrivate
{
public:
FilePrivate(ID3v2::FrameFactory *frameFactory)
FilePrivate(const ID3v2::FrameFactory *frameFactory)
: ID3v2FrameFactory(frameFactory ? frameFactory
: ID3v2::FrameFactory::instance())
{