mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Use a standard type rather than TagLib::ulong.
This won't break the ABI compatibility.
This commit is contained in:
parent
363c471a2d
commit
085a0ef298
@ -600,7 +600,7 @@ bool ASF::File::save()
|
||||
writeBlock(ByteVector::fromUInt(d->objects.size(), false));
|
||||
writeBlock(ByteVector("\x01\x02", 2));
|
||||
|
||||
insert(data, 30, static_cast<ulong>(d->headerSize - 30));
|
||||
insert(data, 30, static_cast<unsigned long>(d->headerSize - 30));
|
||||
|
||||
d->headerSize = data.size() + 30;
|
||||
|
||||
|
@ -109,7 +109,7 @@ bool IT::File::save()
|
||||
StringList lines = d->tag.comment().split("\n");
|
||||
for(unsigned short i = 0; i < instrumentCount; ++ i) {
|
||||
seek(192L + length + ((long)i << 2));
|
||||
ulong instrumentOffset = 0;
|
||||
unsigned long instrumentOffset = 0;
|
||||
if(!readU32L(instrumentOffset))
|
||||
return false;
|
||||
|
||||
@ -124,7 +124,7 @@ bool IT::File::save()
|
||||
|
||||
for(unsigned short i = 0; i < sampleCount; ++ i) {
|
||||
seek(192L + length + ((long)instrumentCount << 2) + ((long)i << 2));
|
||||
ulong sampleOffset = 0;
|
||||
unsigned long sampleOffset = 0;
|
||||
if(!readU32L(sampleOffset))
|
||||
return false;
|
||||
|
||||
@ -151,13 +151,13 @@ bool IT::File::save()
|
||||
|
||||
unsigned short special = 0;
|
||||
unsigned short messageLength = 0;
|
||||
ulong messageOffset = 0;
|
||||
unsigned long messageOffset = 0;
|
||||
|
||||
seek(46);
|
||||
if(!readU16L(special))
|
||||
return false;
|
||||
|
||||
ulong fileSize = File::length();
|
||||
unsigned long fileSize = File::length();
|
||||
if(special & Properties::MessageAttached) {
|
||||
seek(54);
|
||||
if(!readU16L(messageLength) || !readU32L(messageOffset))
|
||||
|
@ -33,14 +33,14 @@ Mod::FileBase::FileBase(IOStream *stream) : TagLib::File(stream)
|
||||
{
|
||||
}
|
||||
|
||||
void Mod::FileBase::writeString(const String &s, ulong size, char padding)
|
||||
void Mod::FileBase::writeString(const String &s, unsigned long size, char padding)
|
||||
{
|
||||
ByteVector data(s.data(String::Latin1));
|
||||
data.resize(size, padding);
|
||||
writeBlock(data);
|
||||
}
|
||||
|
||||
bool Mod::FileBase::readString(String &s, ulong size)
|
||||
bool Mod::FileBase::readString(String &s, unsigned long size)
|
||||
{
|
||||
ByteVector data(readBlock(size));
|
||||
if(data.size() < size) return false;
|
||||
@ -66,7 +66,7 @@ void Mod::FileBase::writeU16L(unsigned short number)
|
||||
writeBlock(ByteVector::fromShort(number, false));
|
||||
}
|
||||
|
||||
void Mod::FileBase::writeU32L(ulong number)
|
||||
void Mod::FileBase::writeU32L(unsigned long number)
|
||||
{
|
||||
writeBlock(ByteVector::fromUInt(number, false));
|
||||
}
|
||||
@ -76,7 +76,7 @@ void Mod::FileBase::writeU16B(unsigned short number)
|
||||
writeBlock(ByteVector::fromShort(number, true));
|
||||
}
|
||||
|
||||
void Mod::FileBase::writeU32B(ulong number)
|
||||
void Mod::FileBase::writeU32B(unsigned long number)
|
||||
{
|
||||
writeBlock(ByteVector::fromUInt(number, true));
|
||||
}
|
||||
@ -97,7 +97,7 @@ bool Mod::FileBase::readU16L(unsigned short &number)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mod::FileBase::readU32L(ulong &number) {
|
||||
bool Mod::FileBase::readU32L(unsigned long &number) {
|
||||
ByteVector data(readBlock(4));
|
||||
if(data.size() < 4) return false;
|
||||
number = data.toUInt(false);
|
||||
@ -112,7 +112,7 @@ bool Mod::FileBase::readU16B(unsigned short &number)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mod::FileBase::readU32B(ulong &number) {
|
||||
bool Mod::FileBase::readU32B(unsigned long &number) {
|
||||
ByteVector data(readBlock(4));
|
||||
if(data.size() < 4) return false;
|
||||
number = data.toUInt(true);
|
||||
|
@ -40,19 +40,19 @@ namespace TagLib {
|
||||
FileBase(FileName file);
|
||||
FileBase(IOStream *stream);
|
||||
|
||||
void writeString(const String &s, ulong size, char padding = 0);
|
||||
void writeString(const String &s, unsigned long size, char padding = 0);
|
||||
void writeByte(unsigned char byte);
|
||||
void writeU16L(unsigned short number);
|
||||
void writeU32L(ulong number);
|
||||
void writeU32L(unsigned long number);
|
||||
void writeU16B(unsigned short number);
|
||||
void writeU32B(ulong number);
|
||||
void writeU32B(unsigned long number);
|
||||
|
||||
bool readString(String &s, ulong size);
|
||||
bool readString(String &s, unsigned long size);
|
||||
bool readByte(unsigned char &byte);
|
||||
bool readU16L(unsigned short &number);
|
||||
bool readU32L(ulong &number);
|
||||
bool readU32L(unsigned long &number);
|
||||
bool readU16B(unsigned short &number);
|
||||
bool readU32B(ulong &number);
|
||||
bool readU32B(unsigned long &number);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -39,9 +39,9 @@
|
||||
|
||||
#define READ_BYTE(setter) READ(setter,unsigned char,readByte)
|
||||
#define READ_U16L(setter) READ(setter,unsigned short,readU16L)
|
||||
#define READ_U32L(setter) READ(setter,ulong,readU32L)
|
||||
#define READ_U32L(setter) READ(setter,unsigned long,readU32L)
|
||||
#define READ_U16B(setter) READ(setter,unsigned short,readU16B)
|
||||
#define READ_U32B(setter) READ(setter,ulong,readU32B)
|
||||
#define READ_U32B(setter) READ(setter,unsigned long,readU32B)
|
||||
|
||||
#define READ_STRING(setter,size) \
|
||||
{ \
|
||||
@ -56,9 +56,9 @@
|
||||
|
||||
#define READ_BYTE_AS(name) READ_AS(unsigned char,name,readByte)
|
||||
#define READ_U16L_AS(name) READ_AS(unsigned short,name,readU16L)
|
||||
#define READ_U32L_AS(name) READ_AS(ulong,name,readU32L)
|
||||
#define READ_U32L_AS(name) READ_AS(unsigned long,name,readU32L)
|
||||
#define READ_U16B_AS(name) READ_AS(unsigned short,name,readU16B)
|
||||
#define READ_U32B_AS(name) READ_AS(ulong,name,readU32B)
|
||||
#define READ_U32B_AS(name) READ_AS(unsigned long,name,readU32B)
|
||||
|
||||
#define READ_STRING_AS(name,size) \
|
||||
String name; \
|
||||
|
@ -247,7 +247,7 @@ void MPC::Properties::readSV8(File *file, long streamLength)
|
||||
break;
|
||||
}
|
||||
|
||||
const ulong begSilence = readSize(data, pos);
|
||||
const unsigned long begSilence = readSize(data, pos);
|
||||
if(pos > dataSize - 2) {
|
||||
debug("MPC::Properties::readSV8() - \"SH\" packet is corrupt.");
|
||||
break;
|
||||
|
@ -409,7 +409,7 @@ long MPEG::File::previousFrameOffset(long position)
|
||||
ByteVector buffer;
|
||||
|
||||
while (position > 0) {
|
||||
long size = ulong(position) < bufferSize() ? position : bufferSize();
|
||||
long size = std::min<long>(position, bufferSize());
|
||||
position -= size;
|
||||
|
||||
seek(position);
|
||||
|
@ -103,7 +103,7 @@ void MPEG::XingHeader::parse(const ByteVector &data)
|
||||
|
||||
// Xing header found.
|
||||
|
||||
if(data.size() < static_cast<ulong>(offset + 16)) {
|
||||
if(data.size() < static_cast<unsigned long>(offset + 16)) {
|
||||
debug("MPEG::XingHeader::parse() -- Xing header found but too short.");
|
||||
return;
|
||||
}
|
||||
@ -127,7 +127,7 @@ void MPEG::XingHeader::parse(const ByteVector &data)
|
||||
|
||||
// VBRI header found.
|
||||
|
||||
if(data.size() < static_cast<ulong>(offset + 32)) {
|
||||
if(data.size() < static_cast<unsigned long>(offset + 32)) {
|
||||
debug("MPEG::XingHeader::parse() -- VBRI header found but too short.");
|
||||
return;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
// Couldn't find an existing chunk, so let's create a new one.
|
||||
|
||||
uint i = d->chunks.size() - 1;
|
||||
ulong offset = d->chunks[i].offset + d->chunks[i].size;
|
||||
unsigned long offset = d->chunks[i].offset + d->chunks[i].size;
|
||||
|
||||
// First we update the global size
|
||||
|
||||
@ -284,7 +284,7 @@ void RIFF::File::read()
|
||||
}
|
||||
|
||||
void RIFF::File::writeChunk(const ByteVector &name, const ByteVector &data,
|
||||
ulong offset, ulong replace, uint leadingPadding)
|
||||
unsigned long offset, unsigned long replace, uint leadingPadding)
|
||||
{
|
||||
ByteVector combined;
|
||||
if(leadingPadding) {
|
||||
|
@ -145,7 +145,7 @@ namespace TagLib {
|
||||
|
||||
void read();
|
||||
void writeChunk(const ByteVector &name, const ByteVector &data,
|
||||
ulong offset, ulong replace = 0,
|
||||
unsigned long offset, unsigned long replace = 0,
|
||||
uint leadingPadding = 0);
|
||||
|
||||
class FilePrivate;
|
||||
|
@ -68,7 +68,7 @@ FileName ByteVectorStream::name() const
|
||||
return FileName(""); // XXX do we need a name?
|
||||
}
|
||||
|
||||
ByteVector ByteVectorStream::readBlock(ulong length)
|
||||
ByteVector ByteVectorStream::readBlock(unsigned long length)
|
||||
{
|
||||
if(length == 0)
|
||||
return ByteVector();
|
||||
@ -88,7 +88,7 @@ void ByteVectorStream::writeBlock(const ByteVector &data)
|
||||
d->position += size;
|
||||
}
|
||||
|
||||
void ByteVectorStream::insert(const ByteVector &data, ulong start, ulong replace)
|
||||
void ByteVectorStream::insert(const ByteVector &data, unsigned long start, unsigned long replace)
|
||||
{
|
||||
long sizeDiff = data.size() - replace;
|
||||
if(sizeDiff < 0) {
|
||||
@ -96,20 +96,20 @@ void ByteVectorStream::insert(const ByteVector &data, ulong start, ulong replace
|
||||
}
|
||||
else if(sizeDiff > 0) {
|
||||
truncate(length() + sizeDiff);
|
||||
ulong readPosition = start + replace;
|
||||
ulong writePosition = start + data.size();
|
||||
unsigned long readPosition = start + replace;
|
||||
unsigned long writePosition = start + data.size();
|
||||
memmove(d->data.data() + writePosition, d->data.data() + readPosition, length() - sizeDiff - readPosition);
|
||||
}
|
||||
seek(start);
|
||||
writeBlock(data);
|
||||
}
|
||||
|
||||
void ByteVectorStream::removeBlock(ulong start, ulong length)
|
||||
void ByteVectorStream::removeBlock(unsigned long start, unsigned long length)
|
||||
{
|
||||
ulong readPosition = start + length;
|
||||
ulong writePosition = start;
|
||||
if(readPosition < ulong(ByteVectorStream::length())) {
|
||||
ulong bytesToMove = ByteVectorStream::length() - readPosition;
|
||||
unsigned long readPosition = start + length;
|
||||
unsigned long writePosition = start;
|
||||
if(readPosition < static_cast<unsigned long>(ByteVectorStream::length())) {
|
||||
unsigned long bytesToMove = ByteVectorStream::length() - readPosition;
|
||||
memmove(d->data.data() + writePosition, d->data.data() + readPosition, bytesToMove);
|
||||
writePosition += bytesToMove;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace TagLib {
|
||||
/*!
|
||||
* Reads a block of size \a length at the current get pointer.
|
||||
*/
|
||||
ByteVector readBlock(ulong length);
|
||||
ByteVector readBlock(unsigned long length);
|
||||
|
||||
/*!
|
||||
* Attempts to write the block \a data at the current get pointer. If the
|
||||
@ -81,7 +81,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it requires rewriting all of the file
|
||||
* after the insertion point.
|
||||
*/
|
||||
void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
|
||||
void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
|
||||
|
||||
/*!
|
||||
* Removes a block of the file starting a \a start and continuing for
|
||||
@ -90,7 +90,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it involves rewriting all of the file
|
||||
* after the removed portion.
|
||||
*/
|
||||
void removeBlock(ulong start = 0, ulong length = 0);
|
||||
void removeBlock(unsigned long start = 0, unsigned long length = 0);
|
||||
|
||||
/*!
|
||||
* Returns true if the file is read only (or if the file can not be opened).
|
||||
|
@ -224,7 +224,7 @@ PropertyMap File::setProperties(const PropertyMap &properties)
|
||||
return tag()->setProperties(properties);
|
||||
}
|
||||
|
||||
ByteVector File::readBlock(ulong length)
|
||||
ByteVector File::readBlock(unsigned long length)
|
||||
{
|
||||
return d->stream->readBlock(length);
|
||||
}
|
||||
@ -404,12 +404,12 @@ long File::rfind(const ByteVector &pattern, long fromOffset, const ByteVector &b
|
||||
return -1;
|
||||
}
|
||||
|
||||
void File::insert(const ByteVector &data, ulong start, ulong replace)
|
||||
void File::insert(const ByteVector &data, unsigned long start, unsigned long replace)
|
||||
{
|
||||
d->stream->insert(data, start, replace);
|
||||
}
|
||||
|
||||
void File::removeBlock(ulong start, ulong length)
|
||||
void File::removeBlock(unsigned long start, unsigned long length)
|
||||
{
|
||||
d->stream->removeBlock(start, length);
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace TagLib {
|
||||
/*!
|
||||
* Reads a block of size \a length at the current get pointer.
|
||||
*/
|
||||
ByteVector readBlock(ulong length);
|
||||
ByteVector readBlock(unsigned long length);
|
||||
|
||||
/*!
|
||||
* Attempts to write the block \a data at the current get pointer. If the
|
||||
@ -190,7 +190,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it requires rewriting all of the file
|
||||
* after the insertion point.
|
||||
*/
|
||||
void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
|
||||
void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
|
||||
|
||||
/*!
|
||||
* Removes a block of the file starting a \a start and continuing for
|
||||
@ -199,7 +199,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it involves rewriting all of the file
|
||||
* after the removed portion.
|
||||
*/
|
||||
void removeBlock(ulong start = 0, ulong length = 0);
|
||||
void removeBlock(unsigned long start = 0, unsigned long length = 0);
|
||||
|
||||
/*!
|
||||
* Returns true if the file is read only (or if the file can not be opened).
|
||||
|
@ -172,7 +172,7 @@ FileName FileStream::name() const
|
||||
return d->name;
|
||||
}
|
||||
|
||||
ByteVector FileStream::readBlock(ulong length)
|
||||
ByteVector FileStream::readBlock(unsigned long length)
|
||||
{
|
||||
if(!isOpen()) {
|
||||
debug("FileStream::readBlock() -- invalid file.");
|
||||
@ -182,7 +182,7 @@ ByteVector FileStream::readBlock(ulong length)
|
||||
if(length == 0)
|
||||
return ByteVector();
|
||||
|
||||
const ulong streamLength = static_cast<ulong>(FileStream::length());
|
||||
const unsigned long streamLength = static_cast<unsigned long>(FileStream::length());
|
||||
if(length > bufferSize() && length > streamLength)
|
||||
length = streamLength;
|
||||
|
||||
@ -209,7 +209,7 @@ void FileStream::writeBlock(const ByteVector &data)
|
||||
writeFile(d->file, data);
|
||||
}
|
||||
|
||||
void FileStream::insert(const ByteVector &data, ulong start, ulong replace)
|
||||
void FileStream::insert(const ByteVector &data, unsigned long start, unsigned long replace)
|
||||
{
|
||||
if(!isOpen()) {
|
||||
debug("FileStream::insert() -- invalid file.");
|
||||
@ -243,7 +243,7 @@ void FileStream::insert(const ByteVector &data, ulong start, ulong replace)
|
||||
// the *differnce* in the tag sizes. We want to avoid overwriting parts
|
||||
// that aren't yet in memory, so this is necessary.
|
||||
|
||||
ulong bufferLength = bufferSize();
|
||||
unsigned long bufferLength = bufferSize();
|
||||
|
||||
while(data.size() - replace > bufferLength)
|
||||
bufferLength += bufferSize();
|
||||
@ -291,14 +291,14 @@ void FileStream::insert(const ByteVector &data, ulong start, ulong replace)
|
||||
}
|
||||
}
|
||||
|
||||
void FileStream::removeBlock(ulong start, ulong length)
|
||||
void FileStream::removeBlock(unsigned long start, unsigned long length)
|
||||
{
|
||||
if(!isOpen()) {
|
||||
debug("FileStream::removeBlock() -- invalid file.");
|
||||
return;
|
||||
}
|
||||
|
||||
ulong bufferLength = bufferSize();
|
||||
unsigned long bufferLength = bufferSize();
|
||||
|
||||
long readPosition = start + length;
|
||||
long writePosition = start;
|
||||
|
@ -67,7 +67,7 @@ namespace TagLib {
|
||||
/*!
|
||||
* Reads a block of size \a length at the current get pointer.
|
||||
*/
|
||||
ByteVector readBlock(ulong length);
|
||||
ByteVector readBlock(unsigned long length);
|
||||
|
||||
/*!
|
||||
* Attempts to write the block \a data at the current get pointer. If the
|
||||
@ -87,7 +87,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it requires rewriting all of the file
|
||||
* after the insertion point.
|
||||
*/
|
||||
void insert(const ByteVector &data, ulong start = 0, ulong replace = 0);
|
||||
void insert(const ByteVector &data, unsigned long start = 0, unsigned long replace = 0);
|
||||
|
||||
/*!
|
||||
* Removes a block of the file starting a \a start and continuing for
|
||||
@ -96,7 +96,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it involves rewriting all of the file
|
||||
* after the removed portion.
|
||||
*/
|
||||
void removeBlock(ulong start = 0, ulong length = 0);
|
||||
void removeBlock(unsigned long start = 0, unsigned long length = 0);
|
||||
|
||||
/*!
|
||||
* Returns true if the file is read only (or if the file can not be opened).
|
||||
|
@ -89,7 +89,7 @@ namespace TagLib {
|
||||
/*!
|
||||
* Reads a block of size \a length at the current get pointer.
|
||||
*/
|
||||
virtual ByteVector readBlock(ulong length) = 0;
|
||||
virtual ByteVector readBlock(unsigned long length) = 0;
|
||||
|
||||
/*!
|
||||
* Attempts to write the block \a data at the current get pointer. If the
|
||||
@ -109,7 +109,8 @@ namespace TagLib {
|
||||
* \note This method is slow since it requires rewriting all of the file
|
||||
* after the insertion point.
|
||||
*/
|
||||
virtual void insert(const ByteVector &data, ulong start = 0, ulong replace = 0) = 0;
|
||||
virtual void insert(const ByteVector &data,
|
||||
unsigned long start = 0, unsigned long replace = 0) = 0;
|
||||
|
||||
/*!
|
||||
* Removes a block of the file starting a \a start and continuing for
|
||||
@ -118,7 +119,7 @@ namespace TagLib {
|
||||
* \note This method is slow since it involves rewriting all of the file
|
||||
* after the removed portion.
|
||||
*/
|
||||
virtual void removeBlock(ulong start = 0, ulong length = 0) = 0;
|
||||
virtual void removeBlock(unsigned long start = 0, unsigned long length = 0) = 0;
|
||||
|
||||
/*!
|
||||
* Returns true if the file is read only (or if the file can not be opened).
|
||||
|
@ -31,7 +31,6 @@
|
||||
using namespace TagLib;
|
||||
using namespace XM;
|
||||
using TagLib::uint;
|
||||
using TagLib::ulong;
|
||||
|
||||
/*!
|
||||
* The Reader classes are helpers to make handling of the stripped XM
|
||||
@ -198,11 +197,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class U32Reader : public NumberReader<ulong>
|
||||
class U32Reader : public NumberReader<unsigned long>
|
||||
{
|
||||
public:
|
||||
U32Reader(ulong &value, bool bigEndian = true) :
|
||||
NumberReader<ulong>(value, bigEndian)
|
||||
U32Reader(unsigned long &value, bool bigEndian = true) :
|
||||
NumberReader<unsigned long>(value, bigEndian)
|
||||
{
|
||||
}
|
||||
|
||||
@ -293,7 +292,7 @@ public:
|
||||
* Read a unsigned 32 Bit integer into \a number. The byte order
|
||||
* is controlled by \a bigEndian.
|
||||
*/
|
||||
StructReader &u32(ulong &number, bool bigEndian)
|
||||
StructReader &u32(unsigned long &number, bool bigEndian)
|
||||
{
|
||||
m_readers.append(new U32Reader(number, bigEndian));
|
||||
return *this;
|
||||
@ -302,7 +301,7 @@ public:
|
||||
/*!
|
||||
* Read a unsigned 32 Bit little endian integer into \a number.
|
||||
*/
|
||||
StructReader &u32L(ulong &number)
|
||||
StructReader &u32L(unsigned long &number)
|
||||
{
|
||||
return u32(number, false);
|
||||
}
|
||||
@ -310,7 +309,7 @@ public:
|
||||
/*!
|
||||
* Read a unsigned 32 Bit big endian integer into \a number.
|
||||
*/
|
||||
StructReader &u32B(ulong &number)
|
||||
StructReader &u32B(unsigned long &number)
|
||||
{
|
||||
return u32(number, true);
|
||||
}
|
||||
@ -410,7 +409,7 @@ bool XM::File::save()
|
||||
writeString(d->tag.trackerName(), 20);
|
||||
|
||||
seek(60);
|
||||
ulong headerSize = 0;
|
||||
unsigned long headerSize = 0;
|
||||
if(!readU32L(headerSize))
|
||||
return false;
|
||||
|
||||
@ -425,7 +424,7 @@ bool XM::File::save()
|
||||
// need to read patterns again in order to seek to the instruments:
|
||||
for(unsigned short i = 0; i < patternCount; ++ i) {
|
||||
seek(pos);
|
||||
ulong patternHeaderLength = 0;
|
||||
unsigned long patternHeaderLength = 0;
|
||||
if(!readU32L(patternHeaderLength) || patternHeaderLength < 4)
|
||||
return false;
|
||||
|
||||
@ -441,7 +440,7 @@ bool XM::File::save()
|
||||
uint sampleNameIndex = instrumentCount;
|
||||
for(unsigned short i = 0; i < instrumentCount; ++ i) {
|
||||
seek(pos);
|
||||
ulong instrumentHeaderSize = 0;
|
||||
unsigned long instrumentHeaderSize = 0;
|
||||
if(!readU32L(instrumentHeaderSize) || instrumentHeaderSize < 4)
|
||||
return false;
|
||||
|
||||
@ -459,7 +458,7 @@ bool XM::File::save()
|
||||
return false;
|
||||
}
|
||||
|
||||
ulong sampleHeaderSize = 0;
|
||||
unsigned long sampleHeaderSize = 0;
|
||||
if(sampleCount > 0) {
|
||||
seek(pos + 29);
|
||||
if(instrumentHeaderSize < 33U || !readU32L(sampleHeaderSize))
|
||||
@ -471,7 +470,7 @@ bool XM::File::save()
|
||||
for(unsigned short j = 0; j < sampleCount; ++ j) {
|
||||
if(sampleHeaderSize > 4U) {
|
||||
seek(pos);
|
||||
ulong sampleLength = 0;
|
||||
unsigned long sampleLength = 0;
|
||||
if(!readU32L(sampleLength))
|
||||
return false;
|
||||
|
||||
@ -532,7 +531,7 @@ void XM::File::read(bool)
|
||||
.u16L(bpmSpeed);
|
||||
|
||||
uint count = header.read(*this, headerSize - 4U);
|
||||
uint size = std::min(headerSize - 4U, (ulong)header.size());
|
||||
uint size = std::min(headerSize - 4U, (unsigned long)header.size());
|
||||
|
||||
READ_ASSERT(count == size);
|
||||
|
||||
@ -559,7 +558,7 @@ void XM::File::read(bool)
|
||||
pattern.byte(packingType).u16L(rowCount).u16L(dataSize);
|
||||
|
||||
uint count = pattern.read(*this, patternHeaderLength - 4U);
|
||||
READ_ASSERT(count == std::min(patternHeaderLength - 4U, (ulong)pattern.size()));
|
||||
READ_ASSERT(count == std::min(patternHeaderLength - 4U, (unsigned long)pattern.size()));
|
||||
|
||||
seek(patternHeaderLength - (4 + count) + dataSize, Current);
|
||||
}
|
||||
@ -582,9 +581,9 @@ void XM::File::read(bool)
|
||||
|
||||
// 4 for instrumentHeaderSize
|
||||
uint count = 4 + instrument.read(*this, instrumentHeaderSize - 4U);
|
||||
READ_ASSERT(count == std::min(instrumentHeaderSize, (ulong)instrument.size() + 4));
|
||||
READ_ASSERT(count == std::min(instrumentHeaderSize, (unsigned long)instrument.size() + 4));
|
||||
|
||||
ulong sampleHeaderSize = 0;
|
||||
unsigned long sampleHeaderSize = 0;
|
||||
long offset = 0;
|
||||
if(sampleCount > 0) {
|
||||
sumSampleCount += sampleCount;
|
||||
@ -594,9 +593,9 @@ void XM::File::read(bool)
|
||||
seek(instrumentHeaderSize - count - 4, Current);
|
||||
|
||||
for(unsigned short j = 0; j < sampleCount; ++ j) {
|
||||
ulong sampleLength = 0;
|
||||
ulong loopStart = 0;
|
||||
ulong loopLength = 0;
|
||||
unsigned long sampleLength = 0;
|
||||
unsigned long loopStart = 0;
|
||||
unsigned long loopLength = 0;
|
||||
unsigned char volume = 0;
|
||||
unsigned char finetune = 0;
|
||||
unsigned char sampleType = 0;
|
||||
@ -617,7 +616,7 @@ void XM::File::read(bool)
|
||||
.string(sampleName, 22);
|
||||
|
||||
uint count = sample.read(*this, sampleHeaderSize);
|
||||
READ_ASSERT(count == std::min(sampleHeaderSize, (ulong)sample.size()));
|
||||
READ_ASSERT(count == std::min(sampleHeaderSize, (unsigned long)sample.size()));
|
||||
// skip unhandeled header proportion:
|
||||
seek(sampleHeaderSize - count, Current);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user