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
////////////////////////////////////////////////////////////////////////////////
bool APE::File::isSupported(IOStream *stream)
bool APE::File::isSupported(IOStream*)
{
// 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:
if(d->pictureValue.isValid())
return d->pictureValue.dataSize();
break;
case GuidType:
return d->byteVectorValue.size();
}
@ -305,6 +306,7 @@ ByteVector ASF::Attribute::render(const String &name, int kind) const
data.append(d->pictureValue.render());
break;
}
break;
case GuidType:
data.append(d->byteVectorValue);
break;

View File

@ -51,7 +51,7 @@ namespace
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)
return i;
}
@ -64,8 +64,8 @@ namespace
if(name.size() != 4)
return false;
for(int i = 0; i < 4; i++) {
if(name[i] < 32 || name[i] > 127)
for (int i = 0 ; i < 4 ; i++) {
if (name[i] < 32)
return false;
}
@ -227,7 +227,7 @@ bool DSDIFF::File::save()
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()) {
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
// 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);
if(ext == "OGA") {
/* .oga can be any audio in the Ogg container. First try FLAC, then Vorbis. */
File *file = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
if(file->isValid())
return file;
delete file;
File *file_flac = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
if (file_flac->isValid())
return file_flac;
delete file_flac;
return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
}
if(ext == "FLAC")

View File

@ -92,8 +92,8 @@ namespace TagLib {
class TAGLIB_EXPORT FileTypeResolver
{
TAGLIB_IGNORE_MISSING_DESTRUCTOR
public:
virtual ~FileTypeResolver();
/*!
* This method must be overridden to provide an additional file type
* resolver. If the resolver is able to determine the file type it should
@ -286,4 +286,4 @@ namespace 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::Atom::findall(const char *name, bool recursive)
MP4::Atom::findall(const char *_name, bool recursive)
{
MP4::AtomList result;
for(AtomList::ConstIterator it = children.begin(); it != children.end(); ++it) {
if((*it)->name == name) {
if((*it)->name == _name) {
result.append(*it);
}
if(recursive) {
result.append((*it)->findall(name, recursive));
result.append((*it)->findall(_name, recursive));
}
}
return result;

View File

@ -67,7 +67,7 @@ namespace TagLib {
};
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;
int locale;
ByteVector data;

View File

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

View File

@ -417,7 +417,7 @@ namespace
{"TYER", "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)

View File

@ -69,7 +69,7 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
MPEG::Header::Header(const ByteVector &data) :
MPEG::Header::Header(const ByteVector&) :
d(new HeaderPrivate())
{
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;
page.setPageSequenceNumber(page.pageSequenceNumber() + numberOfNewPages);
const ByteVector data = page.render();
const ByteVector data2 = page.render();
seek(pageOffset + 18);
writeBlock(data.mid(18, 8));
writeBlock(data2.mid(18, 8));
if(page.header()->lastPageOfStream())
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
// the StringList is the values associated with that field.
FieldListMap::ConstIterator it = d->fieldListMap.begin();
for(; it != d->fieldListMap.end(); ++it) {
for(FieldListMap::ConstIterator it = d->fieldListMap.begin() ; it != d->fieldListMap.end() ; ++it) {
// 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();
data.append(ByteVector::fromUInt(picture.size() + 23, false));
data.append("METADATA_BLOCK_PICTURE=");

View File

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

View File

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

View File

@ -53,13 +53,6 @@ namespace TagLib {
*/
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
* default a space is used.

View File

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

View File

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

View File

@ -28,16 +28,10 @@
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){
String key = it->first.upper();
if(!key.isEmpty())
@ -45,14 +39,13 @@ PropertyMap::PropertyMap(const SimplePropertyMap &m)
else
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();
Iterator result = SimplePropertyMap::find(realKey);
if(result == end())
@ -60,6 +53,7 @@ bool PropertyMap::insert(const String &key, const StringList &values)
else
SimplePropertyMap::operator[](realKey).append(values);
return true;
}
bool PropertyMap::replace(const String &key, const StringList &values)

View File

@ -115,8 +115,6 @@ namespace TagLib {
PropertyMap();
PropertyMap(const PropertyMap &m);
/*!
* Creates a PropertyMap initialized from a SimplePropertyMap. Copies all
* 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) :
List<String>(),
d(nullptr)

View File

@ -57,7 +57,7 @@ namespace TagLib {
* implicitly shared, this method is lightweight and suitable for
* pass-by-value usage.
*/
StringList(const StringList &l);
StringList(const StringList &l) = default;
/*!
* 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.
length = vsprintf(buf, format, args);
if(length >= BufferSize) {
if(length >= (int)BufferSize) {
debug("Utils::formatString() - Buffer overflow! Returning an empty string.");
length = -1;
}

View File

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