fix data forks in MacBinary

This commit is contained in:
Wolfgang Thaller 2017-10-05 15:32:57 +02:00
parent fd5a1e57f2
commit bcfcbb90a3
1 changed files with 5 additions and 1 deletions

View File

@ -70,7 +70,9 @@ static void writeMacBinary(std::ostream& out, std::string filename,
out.seekp(128);
out << data;
std::streampos dataend = out.tellp();
std::streampos rsrcstart = ((int)dataend + 0x7F) & ~0x7F;
while((int)out.tellp() % 128)
byte(out,0);
std::streampos rsrcstart = out.tellp(); //((int)dataend + 0x7F) & ~0x7F;
rsrc.writeFork(out);
std::streampos rsrcend = out.tellp();
@ -351,9 +353,11 @@ bool ResourceFile::read()
unsigned short crc = CalculateCRC(0,header,124);
if(word(in) != crc)
return false;
in.seekg(128);
std::vector<char> buf(datasize);
in.read(buf.data(), datasize);
data = std::string(buf.begin(), buf.end());
datasize = ((int)datasize + 0x7F) & ~0x7F;
in.seekg(128 + datasize);
resources = Resources(in);
}