mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 08:31:45 +00:00
-fixed the file validity checks in MapData::GetChecksum.
They need to be done per lump, because MapData::Seek can alter the FileReader being used for a specific lump. Even worse, the FileReader will be NULL when the function as it was is called for a map inside a Zip-file.
This commit is contained in:
parent
5e34b78451
commit
a2c81f1ca9
1 changed files with 22 additions and 25 deletions
|
@ -537,34 +537,31 @@ void MapData::GetChecksum(BYTE cksum[16])
|
||||||
{
|
{
|
||||||
MD5Context md5;
|
MD5Context md5;
|
||||||
|
|
||||||
if (file != NULL)
|
if (isText)
|
||||||
{
|
{
|
||||||
if (isText)
|
Seek(ML_TEXTMAP);
|
||||||
|
if (file != NULL) md5.Update(file, Size(ML_TEXTMAP));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Size(ML_LABEL) != 0)
|
||||||
{
|
{
|
||||||
Seek(ML_TEXTMAP);
|
Seek(ML_LABEL);
|
||||||
md5.Update(file, Size(ML_TEXTMAP));
|
if (file != NULL) md5.Update(file, Size(ML_LABEL));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Size(ML_LABEL) != 0)
|
|
||||||
{
|
|
||||||
Seek(ML_LABEL);
|
|
||||||
md5.Update(file, Size(ML_LABEL));
|
|
||||||
}
|
|
||||||
Seek(ML_THINGS);
|
|
||||||
md5.Update(file, Size(ML_THINGS));
|
|
||||||
Seek(ML_LINEDEFS);
|
|
||||||
md5.Update(file, Size(ML_LINEDEFS));
|
|
||||||
Seek(ML_SIDEDEFS);
|
|
||||||
md5.Update(file, Size(ML_SIDEDEFS));
|
|
||||||
Seek(ML_SECTORS);
|
|
||||||
md5.Update(file, Size(ML_SECTORS));
|
|
||||||
}
|
|
||||||
if (HasBehavior)
|
|
||||||
{
|
|
||||||
Seek(ML_BEHAVIOR);
|
|
||||||
md5.Update(file, Size(ML_BEHAVIOR));
|
|
||||||
}
|
}
|
||||||
|
Seek(ML_THINGS);
|
||||||
|
if (file != NULL) md5.Update(file, Size(ML_THINGS));
|
||||||
|
Seek(ML_LINEDEFS);
|
||||||
|
if (file != NULL) md5.Update(file, Size(ML_LINEDEFS));
|
||||||
|
Seek(ML_SIDEDEFS);
|
||||||
|
if (file != NULL) md5.Update(file, Size(ML_SIDEDEFS));
|
||||||
|
Seek(ML_SECTORS);
|
||||||
|
if (file != NULL) md5.Update(file, Size(ML_SECTORS));
|
||||||
|
}
|
||||||
|
if (HasBehavior)
|
||||||
|
{
|
||||||
|
Seek(ML_BEHAVIOR);
|
||||||
|
if (file != NULL) md5.Update(file, Size(ML_BEHAVIOR));
|
||||||
}
|
}
|
||||||
md5.Final(cksum);
|
md5.Final(cksum);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue