S3M: unit tests and bug fixes (NUL char. is not optional in S3M strings)

This commit is contained in:
Mathias Panzenböck
2011-06-23 20:08:05 +02:00
parent e810f2f61f
commit 561cfdb0ec
5 changed files with 139 additions and 4 deletions

View File

@ -82,7 +82,9 @@ bool S3M::File::save()
// note: if title starts with "Extended Module: "
// the file would look like an .xm file
seek(0);
writeString(d->tag.title(), 28);
writeString(d->tag.title(), 27);
// string terminating NUL is not optional:
writeByte(0);
seek(32);
@ -120,9 +122,11 @@ bool S3M::File::save()
seek(((long)instrumentOffset << 4) + 48);
if(i < lines.size())
writeString(lines[i], 28);
writeString(lines[i], 27);
else
writeString(String::null, 28);
writeString(String::null, 27);
// string terminating NUL is not optional:
writeByte(0);
}
return true;
}
@ -163,6 +167,8 @@ void S3M::File::read(bool)
// I've seen players who call the next two bytes
// "ultra click" and "use panning values" (if == 0xFC).
// I don't see them in any spec, though.
// Hm, but there is "UltraClick-removal" and some other
// variables in ScreamTracker IIIs GUI.
seek(12, Current);

View File

@ -30,7 +30,7 @@ public:
PropertiesPrivate() :
tableLength(0),
channels(0),
stereo(0),
stereo(false),
sampleCount(0),
patternCount(0),
flags(0),