S3M+IT: fix reading, IT: untested support for message writing

IT: reading was off starting with global volume because of wrong read size.
S3M+IT: correctly read the number of used patterns.
IT: fixed reading of message tag and implemented writing of message tag
(not tested yet).

I also added S3M+IT test files. TODO: Unit tests using them.
This commit is contained in:
Mathias Panzenböck
2011-06-23 05:41:23 +02:00
parent e202c658f0
commit 7236ef4d0f
9 changed files with 127 additions and 22 deletions

View File

@ -55,6 +55,32 @@ bool Mod::FileBase::readString(String &s, ulong size)
return true;
}
void Mod::FileBase::writeByte(uchar byte)
{
ByteVector data(1, byte);
writeBlock(data);
}
void Mod::FileBase::writeU16L(ushort number)
{
writeBlock(ByteVector::fromShort(number, false));
}
void Mod::FileBase::writeU32L(ulong number)
{
writeBlock(ByteVector::fromUInt(number, false));
}
void Mod::FileBase::writeU16B(ushort number)
{
writeBlock(ByteVector::fromShort(number, true));
}
void Mod::FileBase::writeU32B(ulong number)
{
writeBlock(ByteVector::fromUInt(number, true));
}
bool Mod::FileBase::readByte(uchar &byte)
{
ByteVector data(readBlock(1));

View File

@ -39,6 +39,12 @@ namespace TagLib {
FileBase(IOStream *stream);
void writeString(const String &s, ulong size, char padding = 0);
void writeByte(uchar byte);
void writeU16L(ushort number);
void writeU32L(ulong number);
void writeU16B(ushort number);
void writeU32B(ulong number);
bool readString(String &s, ulong size);
bool readByte(uchar &byte);
bool readU16L(ushort &number);