mirror of
https://github.com/taglib/taglib.git
synced 2025-07-27 09:24:25 -04:00
Change the size type of containers from uint to size_t
This commit is contained in:
@ -108,7 +108,7 @@ bool Ogg::FLAC::File::save()
|
||||
|
||||
// Put the size in the first 32 bit (I assume no more than 24 bit are used)
|
||||
|
||||
ByteVector v = ByteVector::fromUInt(d->xiphCommentData.size());
|
||||
ByteVector v = ByteVector::fromUInt32(d->xiphCommentData.size());
|
||||
|
||||
// Set the type of the metadata-block to be a Xiph / Vorbis comment
|
||||
|
||||
@ -230,7 +230,7 @@ void Ogg::FLAC::File::scan()
|
||||
|
||||
char blockType = header[0] & 0x7f;
|
||||
bool lastBlock = (header[0] & 0x80) != 0;
|
||||
uint length = header.mid(1, 3).toUInt();
|
||||
uint length = header.mid(1, 3).toUInt32();
|
||||
overhead += length;
|
||||
|
||||
// Sanity: First block should be the stream_info metadata
|
||||
@ -253,7 +253,7 @@ void Ogg::FLAC::File::scan()
|
||||
header = metadataHeader.mid(0, 4);
|
||||
blockType = header[0] & 0x7f;
|
||||
lastBlock = (header[0] & 0x80) != 0;
|
||||
length = header.mid(1, 3).toUInt();
|
||||
length = header.mid(1, 3).toUInt32();
|
||||
overhead += length;
|
||||
|
||||
if(blockType == 1) {
|
||||
|
@ -269,7 +269,7 @@ bool Ogg::File::nextPage()
|
||||
uint currentPacket = d->currentPage->firstPacketIndex() + i;
|
||||
if(d->packetToPageMap.size() <= currentPacket)
|
||||
d->packetToPageMap.push_back(List<int>());
|
||||
d->packetToPageMap[currentPacket].append(d->pages.size() - 1);
|
||||
d->packetToPageMap[currentPacket].append(static_cast<int>(d->pages.size()) - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -133,7 +133,7 @@ Ogg::Page::ContainsPacketFlags Ogg::Page::containsPacket(int index) const
|
||||
|
||||
TagLib::uint Ogg::Page::packetCount() const
|
||||
{
|
||||
return d->header.packetSizes().size();
|
||||
return static_cast<uint>(d->header.packetSizes().size());
|
||||
}
|
||||
|
||||
ByteVectorList Ogg::Page::packets() const
|
||||
@ -188,7 +188,7 @@ ByteVector Ogg::Page::render() const
|
||||
// the entire page with the 4 bytes reserved for the checksum zeroed and then
|
||||
// inserted in bytes 22-25 of the page header.
|
||||
|
||||
ByteVector checksum = ByteVector::fromUInt(data.checksum(), false);
|
||||
ByteVector checksum = ByteVector::fromUInt32(data.checksum(), false);
|
||||
for(int i = 0; i < 4; i++)
|
||||
data[i + 22] = checksum[i];
|
||||
|
||||
@ -205,7 +205,7 @@ List<Ogg::Page *> Ogg::Page::paginate(const ByteVectorList &packets,
|
||||
{
|
||||
List<Page *> l;
|
||||
|
||||
int totalSize = 0;
|
||||
size_t totalSize = 0;
|
||||
|
||||
for(ByteVectorList::ConstIterator it = packets.begin(); it != packets.end(); ++it)
|
||||
totalSize += (*it).size();
|
||||
@ -331,7 +331,7 @@ Ogg::Page::Page(const ByteVectorList &packets,
|
||||
// Build a page from the list of packets.
|
||||
|
||||
for(ByteVectorList::ConstIterator it = packets.begin(); it != packets.end(); ++it) {
|
||||
packetSizes.append((*it).size());
|
||||
packetSizes.append(static_cast<int>((*it).size()));
|
||||
data.append(*it);
|
||||
}
|
||||
d->packets = packets;
|
||||
|
@ -203,15 +203,15 @@ ByteVector Ogg::PageHeader::render() const
|
||||
|
||||
// absolute granular position
|
||||
|
||||
data.append(ByteVector::fromLongLong(d->absoluteGranularPosition, false));
|
||||
data.append(ByteVector::fromUInt64(d->absoluteGranularPosition, false));
|
||||
|
||||
// stream serial number
|
||||
|
||||
data.append(ByteVector::fromUInt(d->streamSerialNumber, false));
|
||||
data.append(ByteVector::fromUInt32(d->streamSerialNumber, false));
|
||||
|
||||
// page sequence number
|
||||
|
||||
data.append(ByteVector::fromUInt(d->pageSequenceNumber, false));
|
||||
data.append(ByteVector::fromUInt32(d->pageSequenceNumber, false));
|
||||
|
||||
// checksum -- this is left empty and should be filled in by the Ogg::Page
|
||||
// class
|
||||
@ -255,9 +255,9 @@ void Ogg::PageHeader::read()
|
||||
d->firstPageOfStream = flags.test(1);
|
||||
d->lastPageOfStream = flags.test(2);
|
||||
|
||||
d->absoluteGranularPosition = data.mid(6, 8).toLongLong(false);
|
||||
d->streamSerialNumber = data.mid(14, 4).toUInt(false);
|
||||
d->pageSequenceNumber = data.mid(18, 4).toUInt(false);
|
||||
d->absoluteGranularPosition = data.mid(6, 8).toInt64(false);
|
||||
d->streamSerialNumber = data.mid(14, 4).toUInt32(false);
|
||||
d->pageSequenceNumber = data.mid(18, 4).toUInt32(false);
|
||||
|
||||
// Byte number 27 is the number of page segments, which is the only variable
|
||||
// length portion of the page header. After reading the number of page
|
||||
|
@ -129,11 +129,11 @@ void Opus::Properties::read()
|
||||
pos += 1;
|
||||
|
||||
// *Pre-skip* (16 bits, unsigned, little endian)
|
||||
ushort preSkip = data.mid(pos, 2).toUShort(false);
|
||||
ushort preSkip = data.mid(pos, 2).toUInt16(false);
|
||||
pos += 2;
|
||||
|
||||
// *Input Sample Rate* (32 bits, unsigned, little endian)
|
||||
d->inputSampleRate = data.mid(pos, 4).toUInt(false);
|
||||
d->inputSampleRate = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
// *Output Gain* (16 bits, signed, little endian)
|
||||
|
@ -116,29 +116,29 @@ void Speex::Properties::read()
|
||||
int pos = 28;
|
||||
|
||||
// speex_version_id; /**< Version for Speex (for checking compatibility) */
|
||||
d->speexVersion = data.mid(pos, 4).toUInt(false);
|
||||
d->speexVersion = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
// header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
|
||||
pos += 4;
|
||||
|
||||
// rate; /**< Sampling rate used */
|
||||
d->sampleRate = data.mid(pos, 4).toUInt(false);
|
||||
d->sampleRate = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
// mode; /**< Mode used (0 for narrowband, 1 for wideband) */
|
||||
d->mode = data.mid(pos, 4).toUInt(false);
|
||||
d->mode = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
// mode_bitstream_version; /**< Version ID of the bit-stream */
|
||||
pos += 4;
|
||||
|
||||
// nb_channels; /**< Number of channels encoded */
|
||||
d->channels = data.mid(pos, 4).toUInt(false);
|
||||
d->channels = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
// bitrate; /**< Bit-rate used */
|
||||
d->bitrate = data.mid(pos, 4).toUInt(false);
|
||||
d->bitrate = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
// frame_size; /**< Size of frames */
|
||||
@ -146,7 +146,7 @@ void Speex::Properties::read()
|
||||
pos += 4;
|
||||
|
||||
// vbr; /**< 1 for a VBR encoding, 0 otherwise */
|
||||
d->vbr = data.mid(pos, 4).toUInt(false) == 1;
|
||||
d->vbr = data.mid(pos, 4).toUInt32(false) == 1;
|
||||
pos += 4;
|
||||
|
||||
// frames_per_packet; /**< Number of frames stored per Ogg packet */
|
||||
|
@ -151,22 +151,22 @@ void Ogg::Vorbis::Properties::read()
|
||||
|
||||
pos += 7;
|
||||
|
||||
d->vorbisVersion = data.mid(pos, 4).toUInt(false);
|
||||
d->vorbisVersion = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
d->channels = uchar(data[pos]);
|
||||
pos += 1;
|
||||
|
||||
d->sampleRate = data.mid(pos, 4).toUInt(false);
|
||||
d->sampleRate = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
d->bitrateMaximum = data.mid(pos, 4).toUInt(false);
|
||||
d->bitrateMaximum = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
d->bitrateNominal = data.mid(pos, 4).toUInt(false);
|
||||
d->bitrateNominal = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
d->bitrateMinimum = data.mid(pos, 4).toUInt(false);
|
||||
d->bitrateMinimum = data.mid(pos, 4).toUInt32(false);
|
||||
|
||||
// TODO: Later this should be only the "fast" mode.
|
||||
d->bitrate = d->bitrateNominal;
|
||||
|
@ -179,7 +179,7 @@ TagLib::uint Ogg::XiphComment::fieldCount() const
|
||||
|
||||
FieldListMap::ConstIterator it = d->fieldListMap.begin();
|
||||
for(; it != d->fieldListMap.end(); ++it)
|
||||
count += (*it).second.size();
|
||||
count += static_cast<uint>((*it).second.size());
|
||||
|
||||
return count;
|
||||
}
|
||||
@ -286,12 +286,12 @@ ByteVector Ogg::XiphComment::render(bool addFramingBit) const
|
||||
|
||||
ByteVector vendorData = d->vendorID.data(String::UTF8);
|
||||
|
||||
data.append(ByteVector::fromUInt(vendorData.size(), false));
|
||||
data.append(ByteVector::fromUInt32(vendorData.size(), false));
|
||||
data.append(vendorData);
|
||||
|
||||
// Add the number of fields.
|
||||
|
||||
data.append(ByteVector::fromUInt(fieldCount(), false));
|
||||
data.append(ByteVector::fromUInt32(fieldCount(), false));
|
||||
|
||||
// Iterate over the the field lists. Our iterator returns a
|
||||
// std::pair<String, StringList> where the first String is the field name and
|
||||
@ -311,7 +311,7 @@ ByteVector Ogg::XiphComment::render(bool addFramingBit) const
|
||||
fieldData.append('=');
|
||||
fieldData.append((*valuesIt).data(String::UTF8));
|
||||
|
||||
data.append(ByteVector::fromUInt(fieldData.size(), false));
|
||||
data.append(ByteVector::fromUInt32(fieldData.size(), false));
|
||||
data.append(fieldData);
|
||||
}
|
||||
}
|
||||
@ -346,7 +346,7 @@ void Ogg::XiphComment::parse(const ByteVector &data)
|
||||
|
||||
uint pos = 0;
|
||||
|
||||
uint vendorLength = data.mid(0, 4).toUInt(false);
|
||||
uint vendorLength = data.mid(0, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
d->vendorID = String(data.mid(pos, vendorLength), String::UTF8);
|
||||
@ -354,7 +354,7 @@ void Ogg::XiphComment::parse(const ByteVector &data)
|
||||
|
||||
// Next the number of fields in the comment vector.
|
||||
|
||||
uint commentFields = data.mid(pos, 4).toUInt(false);
|
||||
uint commentFields = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
if(commentFields > (data.size() - 8) / 4) {
|
||||
@ -366,7 +366,7 @@ void Ogg::XiphComment::parse(const ByteVector &data)
|
||||
// Each comment field is in the format "KEY=value" in a UTF8 string and has
|
||||
// 4 bytes before the text starts that gives the length.
|
||||
|
||||
uint commentLength = data.mid(pos, 4).toUInt(false);
|
||||
uint commentLength = data.mid(pos, 4).toUInt32(false);
|
||||
pos += 4;
|
||||
|
||||
String comment = String(data.mid(pos, commentLength), String::UTF8);
|
||||
@ -375,8 +375,8 @@ void Ogg::XiphComment::parse(const ByteVector &data)
|
||||
break;
|
||||
}
|
||||
|
||||
int commentSeparatorPosition = comment.find("=");
|
||||
if(commentSeparatorPosition == -1) {
|
||||
const size_t commentSeparatorPosition = comment.find("=");
|
||||
if(commentSeparatorPosition == String::npos) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user