Fix some compile warnings in taglib

This commit is contained in:
Jonas Kvinge
2020-04-23 21:00:16 +02:00
parent ac40094d37
commit c1ac2debb8
24 changed files with 64 additions and 90 deletions

View File

@@ -87,7 +87,7 @@ public:
// static members // static members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool APE::File::isSupported(IOStream *stream) bool APE::File::isSupported(IOStream*)
{ {
// An APE file has an ID "MAC " somewhere. An ID3v2 tag may precede. // An APE file has an ID "MAC " somewhere. An ID3v2 tag may precede.

View File

@@ -264,6 +264,7 @@ int ASF::Attribute::dataSize() const
case BytesType: case BytesType:
if(d->pictureValue.isValid()) if(d->pictureValue.isValid())
return d->pictureValue.dataSize(); return d->pictureValue.dataSize();
break;
case GuidType: case GuidType:
return d->byteVectorValue.size(); return d->byteVectorValue.size();
} }
@@ -305,6 +306,7 @@ ByteVector ASF::Attribute::render(const String &name, int kind) const
data.append(d->pictureValue.render()); data.append(d->pictureValue.render());
break; break;
} }
break;
case GuidType: case GuidType:
data.append(d->byteVectorValue); data.append(d->byteVectorValue);
break; break;

View File

@@ -51,7 +51,7 @@ namespace
int chunkIndex(const ChunkList &chunks, const ByteVector &id) int chunkIndex(const ChunkList &chunks, const ByteVector &id)
{ {
for(int i = 0; i < chunks.size(); i++) { for (unsigned long int i = 0 ; i < chunks.size() ; i++) {
if(chunks[i].name == id) if(chunks[i].name == id)
return i; return i;
} }
@@ -64,8 +64,8 @@ namespace
if(name.size() != 4) if(name.size() != 4)
return false; return false;
for(int i = 0; i < 4; i++) { for (int i = 0 ; i < 4 ; i++) {
if(name[i] < 32 || name[i] > 127) if (name[i] < 32)
return false; return false;
} }
@@ -227,7 +227,7 @@ bool DSDIFF::File::save()
return save(AllTags); return save(AllTags);
} }
bool DSDIFF::File::save(TagTypes tags, StripTags strip, ID3v2::Version version) bool DSDIFF::File::save(TagTypes tags, StripTags, ID3v2::Version version)
{ {
if(readOnly()) { if(readOnly()) {
debug("DSDIFF::File::save() -- File is read only."); debug("DSDIFF::File::save() -- File is read only.");

View File

@@ -180,7 +180,7 @@ bool DSF::File::save()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void DSF::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) void DSF::File::read(bool, Properties::ReadStyle propertiesStyle)
{ {
// A DSF file consists of four chunks: DSD chunk, format chunk, data chunk, and metadata chunk // A DSF file consists of four chunks: DSD chunk, format chunk, data chunk, and metadata chunk
// The file format is not chunked in the sense of a RIFF File, though // The file format is not chunked in the sense of a RIFF File, though

View File

@@ -228,10 +228,10 @@ namespace
return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle); return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
if(ext == "OGA") { if(ext == "OGA") {
/* .oga can be any audio in the Ogg container. First try FLAC, then Vorbis. */ /* .oga can be any audio in the Ogg container. First try FLAC, then Vorbis. */
File *file = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle); File *file_flac = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(file->isValid()) if (file_flac->isValid())
return file; return file_flac;
delete file; delete file_flac;
return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle); return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
} }
if(ext == "FLAC") if(ext == "FLAC")

View File

@@ -92,8 +92,8 @@ namespace TagLib {
class TAGLIB_EXPORT FileTypeResolver class TAGLIB_EXPORT FileTypeResolver
{ {
TAGLIB_IGNORE_MISSING_DESTRUCTOR
public: public:
virtual ~FileTypeResolver();
/*! /*!
* This method must be overridden to provide an additional file type * This method must be overridden to provide an additional file type
* resolver. If the resolver is able to determine the file type it should * resolver. If the resolver is able to determine the file type it should
@@ -286,4 +286,4 @@ namespace TagLib {
} }
} // namespace Strawberry_TagLib::TagLib } // namespace Strawberry_TagLib::TagLib
#endif #endif // TAGLIB_FILEREF_H

View File

@@ -122,15 +122,15 @@ MP4::Atom::find(const char *name1, const char *name2, const char *name3, const c
} }
MP4::AtomList MP4::AtomList
MP4::Atom::findall(const char *name, bool recursive) MP4::Atom::findall(const char *_name, bool recursive)
{ {
MP4::AtomList result; MP4::AtomList result;
for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) { for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) {
if((*it)->name == name) { if((*it)->name == _name) {
result.append(*it); result.append(*it);
} }
if(recursive) { if(recursive) {
result.append((*it)->findall(name, recursive)); result.append((*it)->findall(_name, recursive));
} }
} }
return result; return result;

View File

@@ -67,7 +67,7 @@ namespace TagLib {
}; };
struct AtomData { struct AtomData {
AtomData(AtomDataType type, ByteVector data) : type(type), locale(0), data(data) {} AtomData(AtomDataType _type, ByteVector _data) : type(_type), locale(0), data(_data) {}
AtomDataType type; AtomDataType type;
int locale; int locale;
ByteVector data; ByteVector data;

View File

@@ -334,14 +334,14 @@ ByteVector TableOfContentsFrame::renderFields() const
data.append(flags); data.append(flags);
data.append((char)(entryCount())); data.append((char)(entryCount()));
ByteVectorList::ConstIterator it = d->childElements.begin(); ByteVectorList::ConstIterator it = d->childElements.begin();
while(it != d->childElements.end()) { while (it != d->childElements.end()) {
data.append(*it); data.append(*it);
data.append('\0'); data.append('\0');
it++; it++;
} }
FrameList l = d->embeddedFrameList; FrameList l = d->embeddedFrameList;
for(FrameList::ConstIterator it = l.begin(); it != l.end(); ++it) for (FrameList::ConstIterator it2 = l.begin(); it2 != l.end(); ++it2)
data.append((*it)->render()); data.append((*it2)->render());
return data; return data;
} }

View File

@@ -417,7 +417,7 @@ namespace
{"TYER", "TDRC"}, // 2.3 -> 2.4 {"TYER", "TDRC"}, // 2.3 -> 2.4
{"TIME", "TDRC"}, // 2.3 -> 2.4 {"TIME", "TDRC"}, // 2.3 -> 2.4
}; };
const size_t deprecatedFramesSize = sizeof(deprecatedFrames) / sizeof(deprecatedFrames[0]);; const size_t deprecatedFramesSize = sizeof(deprecatedFrames) / sizeof(deprecatedFrames[0]);
} }
String Frame::frameIDToKey(const ByteVector &id) String Frame::frameIDToKey(const ByteVector &id)

View File

@@ -69,7 +69,7 @@ public:
// public members // public members
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
MPEG::Header::Header(const ByteVector &data) : MPEG::Header::Header(const ByteVector&) :
d(new HeaderPrivate()) d(new HeaderPrivate())
{ {
debug("MPEG::Header::Header() - This constructor is no longer used."); debug("MPEG::Header::Header() - This constructor is no longer used.");

View File

@@ -296,10 +296,10 @@ void Ogg::File::writePacket(unsigned int i, const ByteVector &packet)
break; break;
page.setPageSequenceNumber(page.pageSequenceNumber() + numberOfNewPages); page.setPageSequenceNumber(page.pageSequenceNumber() + numberOfNewPages);
const ByteVector data = page.render(); const ByteVector data2 = page.render();
seek(pageOffset + 18); seek(pageOffset + 18);
writeBlock(data.mid(18, 8)); writeBlock(data2.mid(18, 8));
if(page.header()->lastPageOfStream()) if(page.header()->lastPageOfStream())
break; break;

View File

@@ -379,8 +379,7 @@ ByteVector Ogg::XiphComment::render(bool addFramingBit) const
// std::pair<String, StringList> where the first String is the field name and // std::pair<String, StringList> where the first String is the field name and
// the StringList is the values associated with that field. // the StringList is the values associated with that field.
FieldListMap::ConstIterator it = d->fieldListMap.begin(); for(FieldListMap::ConstIterator it = d->fieldListMap.begin() ; it != d->fieldListMap.end() ; ++it) {
for(; it != d->fieldListMap.end(); ++it) {
// And now iterate over the values of the current list. // And now iterate over the values of the current list.
@@ -398,7 +397,7 @@ ByteVector Ogg::XiphComment::render(bool addFramingBit) const
} }
} }
for(PictureConstIterator it = d->pictureList.begin(); it != d->pictureList.end(); ++it) { for (PictureConstIterator it = d->pictureList.begin(); it != d->pictureList.end(); ++it) {
ByteVector picture = (*it)->render().toBase64(); ByteVector picture = (*it)->render().toBase64();
data.append(ByteVector::fromUInt(picture.size() + 23, false)); data.append(ByteVector::fromUInt(picture.size() + 23, false));
data.append("METADATA_BLOCK_PICTURE="); data.append("METADATA_BLOCK_PICTURE=");

View File

@@ -46,8 +46,8 @@ struct Chunk
class RIFF::File::FilePrivate class RIFF::File::FilePrivate
{ {
public: public:
explicit FilePrivate(Endianness endianness) : explicit FilePrivate(Endianness _endianness) :
endianness(endianness), endianness(_endianness),
size(0), size(0),
sizeOffset(0) {} sizeOffset(0) {}

View File

@@ -77,11 +77,6 @@ ByteVectorList::ByteVectorList() :
} }
ByteVectorList::ByteVectorList(const ByteVectorList &l) : List<ByteVector>(l)
{
}
ByteVectorList::~ByteVectorList() ByteVectorList::~ByteVectorList()
{ {

View File

@@ -53,13 +53,6 @@ namespace TagLib {
*/ */
virtual ~ByteVectorList(); virtual ~ByteVectorList();
/*!
* Make a shallow, implicitly shared, copy of \a l. Because this is
* implicitly shared, this method is lightweight and suitable for
* pass-by-value usage.
*/
ByteVectorList(const ByteVectorList &l);
/*! /*!
* Convert the ByteVectorList to a ByteVector separated by \a separator. By * Convert the ByteVectorList to a ByteVector separated by \a separator. By
* default a space is used. * default a space is used.

View File

@@ -43,8 +43,8 @@ public:
long position; long position;
}; };
ByteVectorStream::ByteVectorStreamPrivate::ByteVectorStreamPrivate(const ByteVector &data) : ByteVectorStream::ByteVectorStreamPrivate::ByteVectorStreamPrivate(const ByteVector &_data) :
data(data), data(_data),
position(0) position(0)
{ {
} }

View File

@@ -71,9 +71,9 @@ using namespace Strawberry_TagLib::TagLib;
class File::FilePrivate class File::FilePrivate
{ {
public: public:
FilePrivate(IOStream *stream, bool owner) : FilePrivate(IOStream *_stream, bool _owner) :
stream(stream), stream(_stream),
streamOwner(owner), streamOwner(_owner),
valid(true) {} valid(true) {}
~FilePrivate() ~FilePrivate()

View File

@@ -28,16 +28,10 @@
using namespace Strawberry_TagLib::TagLib; using namespace Strawberry_TagLib::TagLib;
PropertyMap::PropertyMap() : SimplePropertyMap() PropertyMap::PropertyMap() : SimplePropertyMap() {}
{
}
PropertyMap::PropertyMap(const PropertyMap &m) : SimplePropertyMap(m), unsupported(m.unsupported) PropertyMap::PropertyMap(const SimplePropertyMap &m) {
{
}
PropertyMap::PropertyMap(const SimplePropertyMap &m)
{
for(SimplePropertyMap::ConstIterator it = m.begin(); it != m.end(); ++it){ for(SimplePropertyMap::ConstIterator it = m.begin(); it != m.end(); ++it){
String key = it->first.upper(); String key = it->first.upper();
if(!key.isEmpty()) if(!key.isEmpty())
@@ -45,14 +39,13 @@ PropertyMap::PropertyMap(const SimplePropertyMap &m)
else else
unsupported.append(it->first); unsupported.append(it->first);
} }
} }
PropertyMap::~PropertyMap() PropertyMap::~PropertyMap() {}
{
} bool PropertyMap::insert(const String &key, const StringList &values) {
bool PropertyMap::insert(const String &key, const StringList &values)
{
String realKey = key.upper(); String realKey = key.upper();
Iterator result = SimplePropertyMap::find(realKey); Iterator result = SimplePropertyMap::find(realKey);
if(result == end()) if(result == end())
@@ -60,6 +53,7 @@ bool PropertyMap::insert(const String &key, const StringList &values)
else else
SimplePropertyMap::operator[](realKey).append(values); SimplePropertyMap::operator[](realKey).append(values);
return true; return true;
} }
bool PropertyMap::replace(const String &key, const StringList &values) bool PropertyMap::replace(const String &key, const StringList &values)

View File

@@ -115,8 +115,6 @@ namespace TagLib {
PropertyMap(); PropertyMap();
PropertyMap(const PropertyMap &m);
/*! /*!
* Creates a PropertyMap initialized from a SimplePropertyMap. Copies all * Creates a PropertyMap initialized from a SimplePropertyMap. Copies all
* entries from \a m that have valid keys. * entries from \a m that have valid keys.

View File

@@ -62,13 +62,6 @@ StringList::StringList() :
} }
StringList::StringList(const StringList &l) :
List<String>(l),
d(nullptr)
{
}
StringList::StringList(const String &s) : StringList::StringList(const String &s) :
List<String>(), List<String>(),
d(nullptr) d(nullptr)

View File

@@ -57,7 +57,7 @@ namespace TagLib {
* implicitly shared, this method is lightweight and suitable for * implicitly shared, this method is lightweight and suitable for
* pass-by-value usage. * pass-by-value usage.
*/ */
StringList(const StringList &l); StringList(const StringList &l) = default;
/*! /*!
* Constructs a StringList with \a s as a member. * Constructs a StringList with \a s as a member.

View File

@@ -193,7 +193,7 @@ namespace TagLib
// The last resort. May cause a buffer overflow. // The last resort. May cause a buffer overflow.
length = vsprintf(buf, format, args); length = vsprintf(buf, format, args);
if(length >= BufferSize) { if(length >= (int)BufferSize) {
debug("Utils::formatString() - Buffer overflow! Returning an empty string."); debug("Utils::formatString() - Buffer overflow! Returning an empty string.");
length = -1; length = -1;
} }

View File

@@ -110,7 +110,7 @@ template<typename T>
class ValueReader : public Reader class ValueReader : public Reader
{ {
public: public:
explicit ValueReader(T &value) : value(value) explicit ValueReader(T &_value) : value(_value)
{ {
} }
@@ -172,8 +172,8 @@ template<typename T>
class NumberReader : public ValueReader<T> class NumberReader : public ValueReader<T>
{ {
public: public:
NumberReader(T &value, bool bigEndian) : NumberReader(T &_value, bool _bigEndian) :
ValueReader<T>(value), bigEndian(bigEndian) ValueReader<T>(_value), bigEndian(_bigEndian)
{ {
} }
@@ -184,8 +184,8 @@ protected:
class U16Reader : public NumberReader<unsigned short> class U16Reader : public NumberReader<unsigned short>
{ {
public: public:
U16Reader(unsigned short &value, bool bigEndian) U16Reader(unsigned short &_value, bool _bigEndian)
: NumberReader<unsigned short>(value, bigEndian) {} : NumberReader<unsigned short>(_value, _bigEndian) {}
unsigned int read(Strawberry_TagLib::TagLib::File &file, unsigned int limit) unsigned int read(Strawberry_TagLib::TagLib::File &file, unsigned int limit)
{ {
@@ -203,8 +203,8 @@ public:
class U32Reader : public NumberReader<unsigned long> class U32Reader : public NumberReader<unsigned long>
{ {
public: public:
U32Reader(unsigned long &value, bool bigEndian = true) : U32Reader(unsigned long &_value, bool _bigEndian = true) :
NumberReader<unsigned long>(value, bigEndian) NumberReader<unsigned long>(_value, _bigEndian)
{ {
} }
@@ -479,11 +479,11 @@ bool XM::File::save()
if(sampleHeaderSize > 18U) { if(sampleHeaderSize > 18U) {
seek(pos + 18); seek(pos + 18);
const unsigned int len = std::min(sampleHeaderSize - 18U, 22UL); const unsigned int len2 = std::min(sampleHeaderSize - 18U, 22UL);
if(sampleNameIndex >= lines.size()) if(sampleNameIndex >= lines.size())
writeString(String(), len); writeString(String(), len2);
else else
writeString(lines[sampleNameIndex ++], len); writeString(lines[sampleNameIndex ++], len2);
} }
} }
pos += sampleHeaderSize; pos += sampleHeaderSize;
@@ -560,10 +560,10 @@ void XM::File::read(bool)
StructReader pattern; StructReader pattern;
pattern.byte(packingType).u16L(rowCount).u16L(dataSize); pattern.byte(packingType).u16L(rowCount).u16L(dataSize);
unsigned int count = pattern.read(*this, patternHeaderLength - 4U); unsigned int count2 = pattern.read(*this, patternHeaderLength - 4U);
READ_ASSERT(count == std::min(patternHeaderLength - 4U, (unsigned long)pattern.size())); READ_ASSERT(count2 == std::min(patternHeaderLength - 4U, (unsigned long)pattern.size()));
seek(patternHeaderLength - (4 + count) + dataSize, Current); seek(patternHeaderLength - (4 + count2) + dataSize, Current);
} }
StringList intrumentNames; StringList intrumentNames;
@@ -583,17 +583,17 @@ void XM::File::read(bool)
instrument.string(instrumentName, 22).byte(instrumentType).u16L(sampleCount); instrument.string(instrumentName, 22).byte(instrumentType).u16L(sampleCount);
// 4 for instrumentHeaderSize // 4 for instrumentHeaderSize
unsigned int count = 4 + instrument.read(*this, instrumentHeaderSize - 4U); unsigned int count2 = 4 + instrument.read(*this, instrumentHeaderSize - 4U);
READ_ASSERT(count == std::min(instrumentHeaderSize, (unsigned long)instrument.size() + 4)); READ_ASSERT(count2 == std::min(instrumentHeaderSize, (unsigned long)instrument.size() + 4));
long offset = 0; long offset = 0;
if(sampleCount > 0) { if(sampleCount > 0) {
unsigned long sampleHeaderSize = 0; unsigned long sampleHeaderSize = 0;
sumSampleCount += sampleCount; sumSampleCount += sampleCount;
// wouldn't know which header size to assume otherwise: // wouldn't know which header size to assume otherwise:
READ_ASSERT(instrumentHeaderSize >= count + 4 && readU32L(sampleHeaderSize)); READ_ASSERT(instrumentHeaderSize >= count2 + 4 && readU32L(sampleHeaderSize));
// skip unhandled header proportion: // skip unhandled header proportion:
seek(instrumentHeaderSize - count - 4, Current); seek(instrumentHeaderSize - count2 - 4, Current);
for(unsigned short j = 0; j < sampleCount; ++ j) { for(unsigned short j = 0; j < sampleCount; ++ j) {
unsigned long sampleLength = 0; unsigned long sampleLength = 0;
@@ -618,17 +618,17 @@ void XM::File::read(bool)
.byte(compression) .byte(compression)
.string(sampleName, 22); .string(sampleName, 22);
unsigned int count = sample.read(*this, sampleHeaderSize); unsigned int count3 = sample.read(*this, sampleHeaderSize);
READ_ASSERT(count == std::min(sampleHeaderSize, (unsigned long)sample.size())); READ_ASSERT(count3 == std::min(sampleHeaderSize, (unsigned long)sample.size()));
// skip unhandled header proportion: // skip unhandled header proportion:
seek(sampleHeaderSize - count, Current); seek(sampleHeaderSize - count3, Current);
offset += sampleLength; offset += sampleLength;
sampleNames.append(sampleName); sampleNames.append(sampleName);
} }
} }
else { else {
offset = instrumentHeaderSize - count; offset = instrumentHeaderSize - count2;
} }
intrumentNames.append(instrumentName); intrumentNames.append(instrumentName);
seek(offset, Current); seek(offset, Current);