mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Remove custom integer types.
This commit is contained in:
parent
0e4f9f4e94
commit
1f5ed5fb28
@ -46,14 +46,14 @@ public:
|
||||
length(0) {}
|
||||
|
||||
// Nomenclature is from DSF file format specification
|
||||
uint formatVersion;
|
||||
uint formatID;
|
||||
uint channelType;
|
||||
uint channelNum;
|
||||
uint samplingFrequency;
|
||||
uint bitsPerSample;
|
||||
unsigned int formatVersion;
|
||||
unsigned int formatID;
|
||||
unsigned int channelType;
|
||||
unsigned int channelNum;
|
||||
unsigned int samplingFrequency;
|
||||
unsigned int bitsPerSample;
|
||||
long long sampleCount;
|
||||
uint blockSizePerChannel;
|
||||
unsigned int blockSizePerChannel;
|
||||
|
||||
// Computed
|
||||
int bitrate;
|
||||
|
@ -75,8 +75,8 @@ public:
|
||||
|
||||
// Determine the length of the integer
|
||||
char firstByte = document->readBlock(1)[0];
|
||||
uint byteSize = 1;
|
||||
for(uint i = 0; i < 8 && ((firstByte << i) & (1 << 7)) == 0; ++i)
|
||||
size_t byteSize = 1;
|
||||
for(size_t i = 0; i < 8 && ((firstByte << i) & (1 << 7)) == 0; ++i)
|
||||
++byteSize;
|
||||
|
||||
// Load the integer
|
||||
@ -325,7 +325,7 @@ String EBML::Element::getAsString()
|
||||
return String(getAsBinary(), String::UTF8);
|
||||
}
|
||||
|
||||
signed long long EBML::Element::getAsInt()
|
||||
long long EBML::Element::getAsInt()
|
||||
{
|
||||
// The debug note about returning 0 because of empty data is irrelevant. The
|
||||
// behavior is as expected.
|
||||
|
@ -35,21 +35,21 @@
|
||||
namespace TagLib {
|
||||
|
||||
namespace EBML {
|
||||
|
||||
|
||||
/*!
|
||||
* Represents an element of the EBML. The only instance of this child, that
|
||||
* is directly used is the root element. Every other element is accessed
|
||||
* via pointers to the elements within the root element.
|
||||
*
|
||||
*
|
||||
* Just create one root instance per file to prevent race conditions.
|
||||
*
|
||||
*
|
||||
* Changes of the document tree will be directly written back to the file.
|
||||
* Invalid values (exceeding the maximal value defined in the RFC) will be
|
||||
* truncated.
|
||||
*
|
||||
* This class should not be used by library users since the proper file
|
||||
* class should handle the internals.
|
||||
*
|
||||
*
|
||||
* NOTE: Currently does not adjust CRC32 values.
|
||||
*/
|
||||
class TAGLIB_EXPORT Element
|
||||
@ -57,218 +57,218 @@ namespace TagLib {
|
||||
public:
|
||||
//! Destroys the instance of the element.
|
||||
~Element();
|
||||
|
||||
|
||||
/*!
|
||||
* Creates an root element using document.
|
||||
*/
|
||||
Element(File *document);
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the first found child element with the given id. Returns a null
|
||||
* pointer if the child does not exist.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
Element *getChild(const ulli id);
|
||||
|
||||
|
||||
/*!
|
||||
* Returns a list of all child elements with the given id. Returns an
|
||||
* empty list if no such element exists.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
List<Element *> getChildren(const ulli id);
|
||||
|
||||
|
||||
/*!
|
||||
* Returns a list of every child elements available. Returns an empty list
|
||||
* if there are no children.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
List<Element *> getChildren();
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the parent element or null if no such element exists.
|
||||
*/
|
||||
Element *getParent();
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the raw content of the element.
|
||||
*/
|
||||
ByteVector getAsBinary();
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the content of this element interpreted as a string.
|
||||
*/
|
||||
String getAsString();
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the content of this element interpreted as an signed integer.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not an INT element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
signed long long getAsInt();
|
||||
|
||||
long long getAsInt();
|
||||
|
||||
/*!
|
||||
* Returns the content of this element interpreted as an unsigned integer.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not an UINT element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
ulli getAsUnsigned();
|
||||
|
||||
|
||||
/*!
|
||||
* Returns the content of this element interpreted as a floating point
|
||||
* type.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not an FLOAT element (see
|
||||
* corresponding DTD)
|
||||
*
|
||||
*
|
||||
* NOTE: There are 10 byte floats defined, therefore we might need a long
|
||||
* double to store the value.
|
||||
*/
|
||||
long double getAsFloat();
|
||||
|
||||
|
||||
/*!
|
||||
* Adds an empty element with given id to this element. Returns a pointer
|
||||
* to the new element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
Element *addElement(ulli id);
|
||||
|
||||
|
||||
/*!
|
||||
* Adds a new element, containing the given binary, to this element.
|
||||
* Returns a pointer to the new element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
Element *addElement(ulli id, const ByteVector &binary);
|
||||
|
||||
|
||||
/*!
|
||||
* Adds a new element, containing the given string, to this element.
|
||||
* Returns a pointer to the new element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
Element *addElement(ulli id, const String &string);
|
||||
|
||||
|
||||
/*!
|
||||
* Adds a new element, containing the given integer, to this element.
|
||||
* Returns a pointer to the new element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
Element *addElement(ulli id, signed long long number);
|
||||
|
||||
|
||||
/*!
|
||||
* Adds a new element, containing the given unsigned integer, to this element.
|
||||
* Returns a pointer to the new element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*/
|
||||
Element *addElement(ulli id, ulli number);
|
||||
|
||||
|
||||
/*!
|
||||
* Adds a new element, containing the given floating point value, to this element.
|
||||
* Returns a pointer to the new element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*
|
||||
*
|
||||
* This method is not implemented!
|
||||
*/
|
||||
Element *addElement(ulli id, long double number);
|
||||
|
||||
|
||||
/*!
|
||||
* Removes all children with the given id. Returns false if there was no
|
||||
* such element.
|
||||
* If useVoid is true, the element will be changed to a void element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*
|
||||
*
|
||||
* Every pointer to a removed element is invalidated.
|
||||
*/
|
||||
bool removeChildren(ulli id, bool useVoid = true);
|
||||
|
||||
|
||||
/*!
|
||||
* Removes all children. Returns false if this element had no children.
|
||||
* If useVoid ist rue, the element will be changed to a void element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*
|
||||
*
|
||||
* Every pointer to a removed element is invalidated.
|
||||
*/
|
||||
bool removeChildren(bool useVoid = true);
|
||||
|
||||
|
||||
/*!
|
||||
* Removes the given element.
|
||||
* If useVoid is true, the element will be changed to a void element.
|
||||
*
|
||||
*
|
||||
* Do not call this method if *this element is not a container element (see
|
||||
* corresponding DTD)
|
||||
*
|
||||
*
|
||||
* The pointer to the given element is invalidated.
|
||||
*/
|
||||
bool removeChild(Element *element, bool useVoid = true);
|
||||
|
||||
|
||||
/*!
|
||||
* Writes the given binary to this element.
|
||||
*/
|
||||
void setAsBinary(const ByteVector &binary);
|
||||
|
||||
|
||||
/*!
|
||||
* Writes the given string to this element.
|
||||
*/
|
||||
void setAsString(const String &string);
|
||||
|
||||
|
||||
/*!
|
||||
* Writes the given integer to this element.
|
||||
*/
|
||||
void setAsInt(signed long long number);
|
||||
|
||||
|
||||
/*!
|
||||
* Writes the given unsigned integer to this element.
|
||||
*/
|
||||
void setAsUnsigned(ulli number);
|
||||
|
||||
|
||||
/*!
|
||||
* Writes the given floating point variable to this element.
|
||||
*
|
||||
*
|
||||
* This method is not implemented!
|
||||
*/
|
||||
void setAsFloat(long double number);
|
||||
|
||||
|
||||
private:
|
||||
//! Non-copyable
|
||||
Element(const Element &);
|
||||
//! Non-copyable
|
||||
Element &operator=(const File &);
|
||||
|
||||
|
||||
//! Lazy parsing. This method will be triggered when trying to access
|
||||
//! children.
|
||||
void populate();
|
||||
|
||||
|
||||
class ElementPrivate;
|
||||
ElementPrivate *d;
|
||||
|
||||
|
||||
//! Creates a new Element from an ElementPrivate. (The constructor takes
|
||||
//! ownership of the pointer and will delete it when the element is
|
||||
//! destroyed.
|
||||
Element(ElementPrivate *pe);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ String EBML::Matroska::File::Tag::genre() const
|
||||
return String();
|
||||
}
|
||||
|
||||
uint EBML::Matroska::File::Tag::year() const
|
||||
unsigned int EBML::Matroska::File::Tag::year() const
|
||||
{
|
||||
if(e->year != e->document->d->tags.end())
|
||||
return e->year->first.find(Constants::DATE_RELEASE)->second.front().toInt();
|
||||
@ -491,7 +491,7 @@ uint EBML::Matroska::File::Tag::year() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint EBML::Matroska::File::Tag::track() const
|
||||
unsigned int EBML::Matroska::File::Tag::track() const
|
||||
{
|
||||
if(e->track != e->document->d->tags.end())
|
||||
return e->track->first.find(Constants::PART_NUMBER)->second.front().toInt();
|
||||
@ -544,7 +544,7 @@ void EBML::Matroska::File::Tag::setGenre(const String &s)
|
||||
e->insert(Constants::GENRE, Constants::MostCommonPartValue, s);
|
||||
}
|
||||
|
||||
void EBML::Matroska::File::Tag::setYear(uint i)
|
||||
void EBML::Matroska::File::Tag::setYear(unsigned int i)
|
||||
{
|
||||
String s = String::number(i);
|
||||
if(e->year != e->document->d->tags.end())
|
||||
@ -553,7 +553,7 @@ void EBML::Matroska::File::Tag::setYear(uint i)
|
||||
e->insert(Constants::DATE_RELEASE, Constants::MostCommonPartValue, s);
|
||||
}
|
||||
|
||||
void EBML::Matroska::File::Tag::setTrack(uint i)
|
||||
void EBML::Matroska::File::Tag::setTrack(unsigned int i)
|
||||
{
|
||||
String s = String::number(i);
|
||||
if(e->track != e->document->d->tags.end())
|
||||
|
@ -142,13 +142,13 @@ namespace TagLib {
|
||||
/*!
|
||||
* Returns the year; if there is no year set, this will return 0.
|
||||
*/
|
||||
virtual uint year() const;
|
||||
virtual unsigned int year() const;
|
||||
|
||||
/*!
|
||||
* Returns the track number; if there is no track number set, this will
|
||||
* return 0.
|
||||
*/
|
||||
virtual uint track() const;
|
||||
virtual unsigned int track() const;
|
||||
|
||||
/*!
|
||||
* Sets the title to s. If s is String::null then this value will be
|
||||
@ -189,12 +189,12 @@ namespace TagLib {
|
||||
/*!
|
||||
* Sets the year to i. If s is 0 then this value will be cleared.
|
||||
*/
|
||||
virtual void setYear(uint i);
|
||||
virtual void setYear(unsigned int i);
|
||||
|
||||
/*!
|
||||
* Sets the track to i. If s is 0 then this value will be cleared.
|
||||
*/
|
||||
virtual void setTrack(uint i);
|
||||
virtual void setTrack(unsigned int i);
|
||||
|
||||
private:
|
||||
class TagPrivate;
|
||||
|
@ -166,7 +166,7 @@ bool IT::File::save()
|
||||
if(messageOffset + messageLength >= fileSize) {
|
||||
// append new message
|
||||
seek(54);
|
||||
writeU16L(static_cast<ushort>(message.size()));
|
||||
writeU16L(static_cast<unsigned short>(message.size()));
|
||||
writeU32L(messageOffset);
|
||||
seek(messageOffset);
|
||||
writeBlock(message);
|
||||
|
@ -44,8 +44,8 @@ namespace
|
||||
bool m_bool;
|
||||
int m_int;
|
||||
MP4::Item::IntPair m_intPair;
|
||||
uchar m_byte;
|
||||
uint m_uint;
|
||||
unsigned char m_byte;
|
||||
unsigned int m_uint;
|
||||
long long m_longlong;
|
||||
};
|
||||
StringList m_stringList;
|
||||
@ -253,13 +253,13 @@ MP4::Item::toString() const
|
||||
case TypeStringList:
|
||||
return d->data->m_stringList.toString(" / ");
|
||||
case TypeByteVectorList:
|
||||
for(TagLib::uint i = 0; i < d->data->m_byteVectorList.size(); i++) {
|
||||
for(size_t i = 0; i < d->data->m_byteVectorList.size(); i++) {
|
||||
desc.append(Utils::formatString(
|
||||
"[%d bytes of data]", static_cast<int>(d->data->m_byteVectorList[i].size())));
|
||||
}
|
||||
return desc.toString(", ");
|
||||
case TypeCoverArtList:
|
||||
for(TagLib::uint i = 0; i < d->data->m_coverArtList.size(); i++) {
|
||||
for(size_t i = 0; i < d->data->m_coverArtList.size(); i++) {
|
||||
desc.append(Utils::formatString(
|
||||
"[%d bytes of data]", static_cast<int>(d->data->m_coverArtList[i].data().size())));
|
||||
}
|
||||
|
@ -598,7 +598,7 @@ MP4::Tag::updateOffsets(long delta, long long offset)
|
||||
}
|
||||
d->file->seek(atom->offset + 9);
|
||||
ByteVector data = d->file->readBlock(static_cast<size_t>(atom->length - 9));
|
||||
const uint flags = data.toUInt24BE(0);
|
||||
const unsigned int flags = data.toUInt24BE(0);
|
||||
if(flags & 1) {
|
||||
long long o = data.toInt64BE(7);
|
||||
if(o > offset) {
|
||||
|
@ -35,7 +35,7 @@ using namespace TagLib;
|
||||
|
||||
namespace
|
||||
{
|
||||
const TagLib::uint HeaderSize = 56;
|
||||
const unsigned int HeaderSize = 56;
|
||||
}
|
||||
|
||||
class MPC::AudioProperties::PropertiesPrivate
|
||||
|
@ -194,7 +194,7 @@ void Frame::setText(const String &)
|
||||
ByteVector Frame::render() const
|
||||
{
|
||||
ByteVector fieldData = renderFields();
|
||||
d->header->setFrameSize(static_cast<uint>(fieldData.size()));
|
||||
d->header->setFrameSize(static_cast<unsigned int>(fieldData.size()));
|
||||
ByteVector headerData = d->header->render();
|
||||
|
||||
return headerData + fieldData;
|
||||
@ -733,7 +733,7 @@ void Frame::Header::setData(const ByteVector &data, unsigned int version)
|
||||
// iTunes writes v2.4 tags with v2.3-like frame sizes
|
||||
if(d->frameSize > 127) {
|
||||
if(!isValidFrameID(data.mid(d->frameSize + 10, 4))) {
|
||||
const uint uintSize = data.toUInt32BE(4);
|
||||
const unsigned int uintSize = data.toUInt32BE(4);
|
||||
if(isValidFrameID(data.mid(uintSize + 10, 4))) {
|
||||
d->frameSize = uintSize;
|
||||
}
|
||||
|
@ -131,9 +131,9 @@ Ogg::Page::ContainsPacketFlags Ogg::Page::containsPacket(int index) const
|
||||
return flags;
|
||||
}
|
||||
|
||||
unsigned int Ogg::Page::packetCount() const
|
||||
size_t Ogg::Page::packetCount() const
|
||||
{
|
||||
return static_cast<uint>(d->header.packetSizes().size());
|
||||
return d->header.packetSizes().size();
|
||||
}
|
||||
|
||||
ByteVectorList Ogg::Page::packets() const
|
||||
|
@ -121,7 +121,7 @@ namespace TagLib {
|
||||
/*!
|
||||
* Returns the number of packets (whole or partial) in this page.
|
||||
*/
|
||||
unsigned int packetCount() const;
|
||||
size_t packetCount() const;
|
||||
|
||||
/*!
|
||||
* Returns a list of the packets in this page.
|
||||
|
@ -95,9 +95,9 @@ unsigned int RIFF::File::riffSize() const
|
||||
return d->size;
|
||||
}
|
||||
|
||||
unsigned int RIFF::File::chunkCount() const
|
||||
size_t RIFF::File::chunkCount() const
|
||||
{
|
||||
return static_cast<TagLib::uint>(d->chunks.size());
|
||||
return d->chunks.size();
|
||||
}
|
||||
|
||||
unsigned int RIFF::File::chunkDataSize(unsigned int i) const
|
||||
@ -105,7 +105,7 @@ unsigned int RIFF::File::chunkDataSize(unsigned int i) const
|
||||
return d->chunks[i].size;
|
||||
}
|
||||
|
||||
long long RIFF::File::chunkOffset(uint i) const
|
||||
long long RIFF::File::chunkOffset(unsigned int i) const
|
||||
{
|
||||
return d->chunks[i].offset;
|
||||
}
|
||||
@ -187,7 +187,7 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
|
||||
// First we update the global size
|
||||
|
||||
d->size += static_cast<uint>((offset & 1) + data.size() + 8);
|
||||
d->size += static_cast<unsigned int>((offset & 1) + data.size() + 8);
|
||||
if(d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt32BE(d->size), 4, 4);
|
||||
else
|
||||
@ -199,8 +199,8 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
name,
|
||||
data,
|
||||
offset,
|
||||
static_cast<uint>(std::max(0LL, length() - offset)),
|
||||
static_cast<uint>(offset & 1));
|
||||
static_cast<size_t>(std::max(0LL, length() - offset)),
|
||||
static_cast<unsigned int>(offset & 1));
|
||||
|
||||
// And update our internal structure
|
||||
|
||||
@ -211,7 +211,7 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
|
||||
Chunk chunk;
|
||||
chunk.name = name;
|
||||
chunk.size = static_cast<uint>(data.size());
|
||||
chunk.size = static_cast<unsigned int>(data.size());
|
||||
chunk.offset = offset + 8;
|
||||
chunk.padding = static_cast<char>(data.size() & 1);
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace TagLib {
|
||||
/*!
|
||||
* \return The number of chunks in the file.
|
||||
*/
|
||||
unsigned int chunkCount() const;
|
||||
size_t chunkCount() const;
|
||||
|
||||
/*!
|
||||
* \return The offset within the file for the selected chunk number.
|
||||
|
@ -246,7 +246,7 @@ void RIFF::Info::Tag::parse(const ByteVector &data)
|
||||
{
|
||||
size_t p = 4;
|
||||
while(p < data.size()) {
|
||||
const uint size = data.toUInt32LE(p + 4);
|
||||
const unsigned int size = data.toUInt32LE(p + 4);
|
||||
if(size > data.size() - p - 8)
|
||||
break;
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
#define numberUnion(method) \
|
||||
for(size_t j = 0; j < COUNT; ++j) { \
|
||||
uint val = d->tags[j] ? d->tags[j]->method() : 0; \
|
||||
unsigned int val = d->tags[j] ? d->tags[j]->method() : 0; \
|
||||
if(val > 0) \
|
||||
return val; \
|
||||
} \
|
||||
|
@ -48,15 +48,6 @@
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
// These integer types are deprecated. Do not use them.
|
||||
|
||||
typedef wchar_t wchar; // Assumed to be sufficient to store a UTF-16 char.
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long ulong;
|
||||
typedef unsigned long long ulonglong;
|
||||
|
||||
enum ByteOrder
|
||||
{
|
||||
LittleEndian,
|
||||
|
@ -134,7 +134,7 @@ inline T toNumber(const ByteVector &v, size_t offset)
|
||||
T sum = 0;
|
||||
for(size_t i = 0; i < length; ++i) {
|
||||
const size_t shift = (ENDIAN == BigEndian ? length - 1 - i : i) * 8;
|
||||
sum |= static_cast<T>(static_cast<uchar>(v[offset + i])) << shift;
|
||||
sum |= static_cast<T>(static_cast<unsigned char>(v[offset + i])) << shift;
|
||||
}
|
||||
|
||||
return sum;
|
||||
@ -292,42 +292,42 @@ ByteVector ByteVector::fromCString(const char *s, size_t length)
|
||||
|
||||
ByteVector ByteVector::fromUInt16LE(size_t value)
|
||||
{
|
||||
return fromNumber<ushort, LittleEndian>(static_cast<ushort>(value));
|
||||
return fromNumber<unsigned short, LittleEndian>(static_cast<unsigned short>(value));
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromUInt16BE(size_t value)
|
||||
{
|
||||
return fromNumber<ushort, BigEndian>(static_cast<ushort>(value));
|
||||
return fromNumber<unsigned short, BigEndian>(static_cast<unsigned short>(value));
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromUInt32LE(size_t value)
|
||||
{
|
||||
return fromNumber<uint, LittleEndian>(static_cast<uint>(value));
|
||||
return fromNumber<unsigned int, LittleEndian>(static_cast<unsigned int>(value));
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromUInt32BE(size_t value)
|
||||
{
|
||||
return fromNumber<uint, BigEndian>(static_cast<uint>(value));
|
||||
return fromNumber<unsigned int, BigEndian>(static_cast<unsigned int>(value));
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromUInt64LE(ulonglong value)
|
||||
ByteVector ByteVector::fromUInt64LE(unsigned long long value)
|
||||
{
|
||||
return fromNumber<ulonglong, LittleEndian>(value);
|
||||
return fromNumber<unsigned long long, LittleEndian>(value);
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromUInt64BE(ulonglong value)
|
||||
ByteVector ByteVector::fromUInt64BE(unsigned long long value)
|
||||
{
|
||||
return fromNumber<ulonglong, BigEndian>(value);
|
||||
return fromNumber<unsigned long long, BigEndian>(value);
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromFloat32LE(float value)
|
||||
{
|
||||
return fromFloat<float, uint, LittleEndian>(value);
|
||||
return fromFloat<float, unsigned int, LittleEndian>(value);
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromFloat32BE(float value)
|
||||
{
|
||||
return fromFloat<float, uint, BigEndian>(value);
|
||||
return fromFloat<float, unsigned int, BigEndian>(value);
|
||||
}
|
||||
|
||||
ByteVector ByteVector::fromFloat64LE(double value)
|
||||
@ -691,62 +691,62 @@ unsigned int ByteVector::checksum() const
|
||||
|
||||
short ByteVector::toInt16LE(size_t offset) const
|
||||
{
|
||||
return static_cast<short>(toNumber<ushort, 2, LittleEndian>(*this, offset));
|
||||
return static_cast<short>(toNumber<unsigned short, 2, LittleEndian>(*this, offset));
|
||||
}
|
||||
|
||||
short ByteVector::toInt16BE(size_t offset) const
|
||||
{
|
||||
return static_cast<short>(toNumber<ushort, 2, BigEndian>(*this, offset));
|
||||
return static_cast<short>(toNumber<unsigned short, 2, BigEndian>(*this, offset));
|
||||
}
|
||||
|
||||
ushort ByteVector::toUInt16LE(size_t offset) const
|
||||
unsigned short ByteVector::toUInt16LE(size_t offset) const
|
||||
{
|
||||
return toNumber<ushort, 2, LittleEndian>(*this, offset);
|
||||
return toNumber<unsigned short, 2, LittleEndian>(*this, offset);
|
||||
}
|
||||
|
||||
ushort ByteVector::toUInt16BE(size_t offset) const
|
||||
unsigned short ByteVector::toUInt16BE(size_t offset) const
|
||||
{
|
||||
return toNumber<ushort, 2, BigEndian>(*this, offset);
|
||||
return toNumber<unsigned short, 2, BigEndian>(*this, offset);
|
||||
}
|
||||
|
||||
uint ByteVector::toUInt24LE(size_t offset) const
|
||||
unsigned int ByteVector::toUInt24LE(size_t offset) const
|
||||
{
|
||||
return toNumber<uint, 3, LittleEndian>(*this, offset);
|
||||
return toNumber<unsigned int, 3, LittleEndian>(*this, offset);
|
||||
}
|
||||
|
||||
uint ByteVector::toUInt24BE(size_t offset) const
|
||||
unsigned int ByteVector::toUInt24BE(size_t offset) const
|
||||
{
|
||||
return toNumber<uint, 3, BigEndian>(*this, offset);
|
||||
return toNumber<unsigned int, 3, BigEndian>(*this, offset);
|
||||
}
|
||||
|
||||
uint ByteVector::toUInt32LE(size_t offset) const
|
||||
unsigned int ByteVector::toUInt32LE(size_t offset) const
|
||||
{
|
||||
return toNumber<uint, 4, LittleEndian>(*this, offset);
|
||||
return toNumber<unsigned int, 4, LittleEndian>(*this, offset);
|
||||
}
|
||||
|
||||
uint ByteVector::toUInt32BE(size_t offset) const
|
||||
unsigned int ByteVector::toUInt32BE(size_t offset) const
|
||||
{
|
||||
return toNumber<uint, 4, BigEndian>(*this, offset);
|
||||
return toNumber<unsigned int, 4, BigEndian>(*this, offset);
|
||||
}
|
||||
|
||||
long long ByteVector::toInt64LE(size_t offset) const
|
||||
{
|
||||
return static_cast<long long>(toNumber<ulonglong, 8, LittleEndian>(*this, offset));
|
||||
return static_cast<long long>(toNumber<unsigned long long, 8, LittleEndian>(*this, offset));
|
||||
}
|
||||
|
||||
long long ByteVector::toInt64BE(size_t offset) const
|
||||
{
|
||||
return static_cast<long long>(toNumber<ulonglong, 8, BigEndian>(*this, offset));
|
||||
return static_cast<long long>(toNumber<unsigned long long, 8, BigEndian>(*this, offset));
|
||||
}
|
||||
|
||||
float ByteVector::toFloat32LE(size_t offset) const
|
||||
{
|
||||
return toFloat<float, uint, LittleEndian>(*this, offset);
|
||||
return toFloat<float, unsigned int, LittleEndian>(*this, offset);
|
||||
}
|
||||
|
||||
float ByteVector::toFloat32BE(size_t offset) const
|
||||
{
|
||||
return toFloat<float, uint, BigEndian>(*this, offset);
|
||||
return toFloat<float, unsigned int, BigEndian>(*this, offset);
|
||||
}
|
||||
|
||||
double ByteVector::toFloat64LE(size_t offset) const
|
||||
|
@ -295,48 +295,48 @@ namespace TagLib {
|
||||
short toInt16BE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 2 bytes at \a offset of the vector to a ushort as an unsigned
|
||||
* 16-bit little-endian integer.
|
||||
* Converts the 2 bytes at \a offset of the vector to a unsigned short as an
|
||||
* unsigned 16-bit little-endian integer.
|
||||
*
|
||||
* \see fromUInt16LE()
|
||||
*/
|
||||
ushort toUInt16LE(size_t offset) const;
|
||||
unsigned short toUInt16LE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 2 bytes at \a offset of the vector to a ushort as an unsigned
|
||||
* 16-bit big-endian integer.
|
||||
* Converts the 2 bytes at \a offset of the vector to a unsigned short as an
|
||||
* unsigned 16-bit big-endian integer.
|
||||
*
|
||||
* \see fromUInt16BE()
|
||||
*/
|
||||
ushort toUInt16BE(size_t offset) const;
|
||||
unsigned short toUInt16BE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 3 bytes at \a offset of the vector to a uint as an unsigned
|
||||
* 24-bit little-endian integer.
|
||||
* Converts the 3 bytes at \a offset of the vector to a unsigned int as an
|
||||
* unsigned 24-bit little-endian integer.
|
||||
*/
|
||||
uint toUInt24LE(size_t offset) const;
|
||||
unsigned int toUInt24LE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 3 bytes at \a offset of the vector to a uint as an unsigned
|
||||
* 24-bit big-endian integer.
|
||||
* Converts the 3 bytes at \a offset of the vector to a unsigned int as an
|
||||
* unsigned 24-bit big-endian integer.
|
||||
*/
|
||||
uint toUInt24BE(size_t offset) const;
|
||||
unsigned int toUInt24BE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 4 bytes at \a offset of the vector to a uint as an unsigned
|
||||
* 32-bit little-endian integer.
|
||||
* Converts the 4 bytes at \a offset of the vector to a unsigned int as an
|
||||
* unsigned 32-bit little-endian integer.
|
||||
*
|
||||
* \see fromUInt32LE()
|
||||
*/
|
||||
uint toUInt32LE(size_t offset) const;
|
||||
unsigned int toUInt32LE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 4 bytes at \a offset of the vector to a ushort as an unsigned
|
||||
* 32-bit big-endian integer.
|
||||
* Converts the 4 bytes at \a offset of the vector to a unsigned int as an
|
||||
* unsigned 32-bit big-endian integer.
|
||||
*
|
||||
* \see fromUInt32BE()
|
||||
*/
|
||||
uint toUInt32BE(size_t offset) const;
|
||||
unsigned int toUInt32BE(size_t offset) const;
|
||||
|
||||
/*!
|
||||
* Converts the 8 bytes at \a offset of the vector to a long long as a signed
|
||||
@ -436,7 +436,7 @@ namespace TagLib {
|
||||
*
|
||||
* \see toUInt64LE()
|
||||
*/
|
||||
static ByteVector fromUInt64LE(ulonglong value);
|
||||
static ByteVector fromUInt64LE(unsigned long long value);
|
||||
|
||||
/*!
|
||||
* Creates a 8 byte ByteVector based on \a value as an unsigned 64-bit
|
||||
@ -444,7 +444,7 @@ namespace TagLib {
|
||||
*
|
||||
* \see toUInt64BE()
|
||||
*/
|
||||
static ByteVector fromUInt64BE(ulonglong value);
|
||||
static ByteVector fromUInt64BE(unsigned long long value);
|
||||
|
||||
/*!
|
||||
* Creates a 4 byte ByteVector based on \a value as an IEEE754 32-bit
|
||||
|
@ -708,7 +708,7 @@ String &String::operator+=(char c)
|
||||
{
|
||||
detach();
|
||||
|
||||
*d->data += uchar(c);
|
||||
*d->data += static_cast<unsigned char>(c);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace
|
||||
{
|
||||
enum { TrueAudioID3v2Index = 0, TrueAudioID3v1Index = 1 };
|
||||
|
||||
const TagLib::uint HeaderSize = 18;
|
||||
const unsigned int HeaderSize = 18;
|
||||
}
|
||||
|
||||
class TrueAudio::File::FilePrivate
|
||||
@ -166,7 +166,7 @@ bool TrueAudio::File::save()
|
||||
ByteVector data = ID3v2Tag()->render();
|
||||
insert(data, d->ID3v2Location, d->ID3v2OriginalSize);
|
||||
d->ID3v1Location -= d->ID3v2OriginalSize - data.size();
|
||||
d->ID3v2OriginalSize = static_cast<uint>(data.size());
|
||||
d->ID3v2OriginalSize = static_cast<unsigned int>(data.size());
|
||||
d->hasID3v2 = true;
|
||||
}
|
||||
else if(d->hasID3v2) {
|
||||
|
@ -74,35 +74,35 @@ namespace
|
||||
* Reads associated values from \a file, but never reads more
|
||||
* then \a limit bytes.
|
||||
*/
|
||||
virtual uint read(TagLib::File &file, uint limit) = 0;
|
||||
virtual unsigned int read(TagLib::File &file, unsigned int limit) = 0;
|
||||
|
||||
/*!
|
||||
* Returns the number of bytes this reader would like to read.
|
||||
*/
|
||||
virtual uint size() const = 0;
|
||||
virtual unsigned int size() const = 0;
|
||||
};
|
||||
|
||||
class SkipReader : public Reader
|
||||
{
|
||||
public:
|
||||
SkipReader(uint size) : m_size(size)
|
||||
SkipReader(unsigned int size) : m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
uint read(TagLib::File &file, uint limit)
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
uint count = std::min(m_size, limit);
|
||||
unsigned int count = std::min(m_size, limit);
|
||||
file.seek(count, TagLib::File::Current);
|
||||
return count;
|
||||
}
|
||||
|
||||
uint size() const
|
||||
unsigned int size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
private:
|
||||
uint m_size;
|
||||
unsigned int m_size;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
@ -120,12 +120,12 @@ namespace
|
||||
class StringReader : public ValueReader<String>
|
||||
{
|
||||
public:
|
||||
StringReader(String &string, uint size) :
|
||||
StringReader(String &string, unsigned int size) :
|
||||
ValueReader<String>(string), m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
uint read(TagLib::File &file, uint limit)
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
ByteVector data = file.readBlock(std::min(m_size, limit));
|
||||
size_t count = data.size();
|
||||
@ -135,33 +135,33 @@ namespace
|
||||
}
|
||||
data.replace((char) 0xff, ' ');
|
||||
value = data;
|
||||
return static_cast<uint>(count);
|
||||
return static_cast<unsigned int>(count);
|
||||
}
|
||||
|
||||
uint size() const
|
||||
unsigned int size() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
private:
|
||||
uint m_size;
|
||||
unsigned int m_size;
|
||||
};
|
||||
|
||||
class ByteReader : public ValueReader<uchar>
|
||||
class ByteReader : public ValueReader<unsigned char>
|
||||
{
|
||||
public:
|
||||
ByteReader(uchar &byte) : ValueReader<uchar>(byte) {}
|
||||
ByteReader(unsigned char &byte) : ValueReader<unsigned char>(byte) {}
|
||||
|
||||
uint read(TagLib::File &file, uint limit)
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
ByteVector data = file.readBlock(std::min(1U,limit));
|
||||
if(data.size() > 0) {
|
||||
value = data[0];
|
||||
}
|
||||
return static_cast<uint>(data.size());
|
||||
return static_cast<unsigned int>(data.size());
|
||||
}
|
||||
|
||||
uint size() const
|
||||
unsigned int size() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -180,13 +180,13 @@ namespace
|
||||
bool bigEndian;
|
||||
};
|
||||
|
||||
class U16Reader : public NumberReader<ushort>
|
||||
class U16Reader : public NumberReader<unsigned short>
|
||||
{
|
||||
public:
|
||||
U16Reader(ushort &value, bool bigEndian)
|
||||
: NumberReader<ushort>(value, bigEndian) {}
|
||||
U16Reader(unsigned short &value, bool bigEndian)
|
||||
: NumberReader<unsigned short>(value, bigEndian) {}
|
||||
|
||||
uint read(TagLib::File &file, uint limit)
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
ByteVector data = file.readBlock(std::min(2U,limit));
|
||||
|
||||
@ -195,24 +195,24 @@ namespace
|
||||
else
|
||||
value = data.toUInt16LE(0);
|
||||
|
||||
return static_cast<uint>(data.size());
|
||||
return static_cast<unsigned int>(data.size());
|
||||
}
|
||||
|
||||
uint size() const
|
||||
unsigned int size() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
};
|
||||
|
||||
class U32Reader : public NumberReader<uint>
|
||||
class U32Reader : public NumberReader<unsigned int>
|
||||
{
|
||||
public:
|
||||
U32Reader(uint &value, bool bigEndian = true) :
|
||||
NumberReader<uint>(value, bigEndian)
|
||||
U32Reader(unsigned int &value, bool bigEndian = true) :
|
||||
NumberReader<unsigned int>(value, bigEndian)
|
||||
{
|
||||
}
|
||||
|
||||
uint read(TagLib::File &file, uint limit)
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
ByteVector data = file.readBlock(std::min(4U,limit));
|
||||
|
||||
@ -221,10 +221,10 @@ namespace
|
||||
else
|
||||
value = data.toUInt32LE(0);
|
||||
|
||||
return static_cast<uint>(data.size());
|
||||
return static_cast<unsigned int>(data.size());
|
||||
}
|
||||
|
||||
uint size() const
|
||||
unsigned int size() const
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@ -250,7 +250,7 @@ namespace
|
||||
/*!
|
||||
* Don't read anything but skip \a size bytes.
|
||||
*/
|
||||
StructReader &skip(uint size)
|
||||
StructReader &skip(unsigned int size)
|
||||
{
|
||||
m_readers.append(new SkipReader(size));
|
||||
return *this;
|
||||
@ -259,7 +259,7 @@ namespace
|
||||
/*!
|
||||
* Read a string of \a size characters (bytes) into \a string.
|
||||
*/
|
||||
StructReader &string(String &string, uint size)
|
||||
StructReader &string(String &string, unsigned int size)
|
||||
{
|
||||
m_readers.append(new StringReader(string, size));
|
||||
return *this;
|
||||
@ -268,7 +268,7 @@ namespace
|
||||
/*!
|
||||
* Read a byte into \a byte.
|
||||
*/
|
||||
StructReader &byte(uchar &byte)
|
||||
StructReader &byte(unsigned char &byte)
|
||||
{
|
||||
m_readers.append(new ByteReader(byte));
|
||||
return *this;
|
||||
@ -278,7 +278,7 @@ namespace
|
||||
* Read a unsigned 16 Bit integer into \a number. The byte order
|
||||
* is controlled by \a bigEndian.
|
||||
*/
|
||||
StructReader &u16(ushort &number, bool bigEndian)
|
||||
StructReader &u16(unsigned short &number, bool bigEndian)
|
||||
{
|
||||
m_readers.append(new U16Reader(number, bigEndian));
|
||||
return *this;
|
||||
@ -287,7 +287,7 @@ namespace
|
||||
/*!
|
||||
* Read a unsigned 16 Bit little endian integer into \a number.
|
||||
*/
|
||||
StructReader &u16L(ushort &number)
|
||||
StructReader &u16L(unsigned short &number)
|
||||
{
|
||||
return u16(number, false);
|
||||
}
|
||||
@ -295,7 +295,7 @@ namespace
|
||||
/*!
|
||||
* Read a unsigned 16 Bit big endian integer into \a number.
|
||||
*/
|
||||
StructReader &u16B(ushort &number)
|
||||
StructReader &u16B(unsigned short &number)
|
||||
{
|
||||
return u16(number, true);
|
||||
}
|
||||
@ -304,7 +304,7 @@ namespace
|
||||
* Read a unsigned 32 Bit integer into \a number. The byte order
|
||||
* is controlled by \a bigEndian.
|
||||
*/
|
||||
StructReader &u32(uint &number, bool bigEndian)
|
||||
StructReader &u32(unsigned int &number, bool bigEndian)
|
||||
{
|
||||
m_readers.append(new U32Reader(number, bigEndian));
|
||||
return *this;
|
||||
@ -313,7 +313,7 @@ namespace
|
||||
/*!
|
||||
* Read a unsigned 32 Bit little endian integer into \a number.
|
||||
*/
|
||||
StructReader &u32L(uint &number)
|
||||
StructReader &u32L(unsigned int &number)
|
||||
{
|
||||
return u32(number, false);
|
||||
}
|
||||
@ -321,14 +321,14 @@ namespace
|
||||
/*!
|
||||
* Read a unsigned 32 Bit big endian integer into \a number.
|
||||
*/
|
||||
StructReader &u32B(uint &number)
|
||||
StructReader &u32B(unsigned int &number)
|
||||
{
|
||||
return u32(number, true);
|
||||
}
|
||||
|
||||
uint size() const
|
||||
unsigned int size() const
|
||||
{
|
||||
uint size = 0;
|
||||
unsigned int size = 0;
|
||||
for(List<Reader*>::ConstIterator i = m_readers.begin();
|
||||
i != m_readers.end(); ++ i) {
|
||||
size += (*i)->size();
|
||||
@ -336,12 +336,12 @@ namespace
|
||||
return size;
|
||||
}
|
||||
|
||||
uint read(TagLib::File &file, uint limit)
|
||||
unsigned int read(TagLib::File &file, unsigned int limit)
|
||||
{
|
||||
uint sumcount = 0;
|
||||
unsigned int sumcount = 0;
|
||||
for(List<Reader*>::ConstIterator i = m_readers.begin();
|
||||
limit > 0 && i != m_readers.end(); ++ i) {
|
||||
uint count = (*i)->read(file, limit);
|
||||
unsigned int count = (*i)->read(file, limit);
|
||||
limit -= count;
|
||||
sumcount += count;
|
||||
}
|
||||
@ -595,7 +595,7 @@ void XM::File::read(bool)
|
||||
// skip unhandeled header proportion:
|
||||
seek(instrumentHeaderSize - count - 4, Current);
|
||||
|
||||
for(ushort j = 0; j < sampleCount; ++ j) {
|
||||
for(unsigned short j = 0; j < sampleCount; ++ j) {
|
||||
unsigned int sampleLength = 0;
|
||||
unsigned int loopStart = 0;
|
||||
unsigned int loopLength = 0;
|
||||
|
@ -174,7 +174,7 @@ void XM::AudioProperties::setInstrumentCount(unsigned short instrumentCount)
|
||||
d->instrumentCount = instrumentCount;
|
||||
}
|
||||
|
||||
void XM::AudioProperties::setSampleCount(uint sampleCount)
|
||||
void XM::AudioProperties::setSampleCount(unsigned int sampleCount)
|
||||
{
|
||||
d->sampleCount = sampleCount;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user