- Fixed: FWadCollection::CheckNumForName() read the lump each iteration before

checking for the end marker. On 32-bit systems, this is -1, but on 64-bit
  systems, it is a very large integer that is highly unlikely to be in mapped
  memory.


SVN r1564 (trunk)
This commit is contained in:
Randy Heit 2009-04-30 02:41:20 +00:00
parent edbeab54a0
commit f7d7e9faf9
3 changed files with 11 additions and 4 deletions

View file

@ -1,4 +1,10 @@
April 28, 2009 (Changes by Graf Zahl) April 29, 2009
- Fixed: FWadCollection::CheckNumForName() read the lump each iteration before
checking for the end marker. On 32-bit systems, this is -1, but on 64-bit
systems, it is a very large integer that is highly unlikely to be in mapped
memory.
April 28, 2009 (Changes by Graf Zahl)
- Added ML_BLOCKUSE line flag, accessible through UDMF and Line_SetBlocking. - Added ML_BLOCKUSE line flag, accessible through UDMF and Line_SetBlocking.
April 25, 2009 (Changes by Graf Zahl) April 25, 2009 (Changes by Graf Zahl)

View file

@ -47,6 +47,8 @@ about these properties of platform.
#if defined(LITTLE_ENDIAN_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300) #if defined(LITTLE_ENDIAN_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300)
unsigned long _byteswap_ulong(unsigned long);
unsigned __int64 _byteswap_uint64(unsigned __int64);
#pragma intrinsic(_byteswap_ulong) #pragma intrinsic(_byteswap_ulong)
#pragma intrinsic(_byteswap_uint64) #pragma intrinsic(_byteswap_uint64)
#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p)) #define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))

View file

@ -418,6 +418,7 @@ int FWadCollection::CheckNumForName (const char *name, int space)
int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bool exact) int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bool exact)
{ {
FResourceLump *lump;
char uname[8]; char uname[8];
DWORD i; DWORD i;
@ -428,18 +429,16 @@ int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bo
uppercopy (uname, name); uppercopy (uname, name);
i = FirstLumpIndex[LumpNameHash (uname) % NumLumps]; i = FirstLumpIndex[LumpNameHash (uname) % NumLumps];
FResourceLump *lump = LumpInfo[i].lump;
// If exact is true if will only find lumps in the same WAD, otherwise // If exact is true if will only find lumps in the same WAD, otherwise
// also those in earlier WADs. // also those in earlier WADs.
while (i != NULL_INDEX && while (i != NULL_INDEX &&
(*(QWORD *)&lump->Name != *(QWORD *)&uname || (lump = LumpInfo[i].lump, *(QWORD *)&lump->Name != *(QWORD *)&uname ||
lump->Namespace != space || lump->Namespace != space ||
(exact? (LumpInfo[i].wadnum != wadnum) : (LumpInfo[i].wadnum > wadnum)) )) (exact? (LumpInfo[i].wadnum != wadnum) : (LumpInfo[i].wadnum > wadnum)) ))
{ {
i = NextLumpIndex[i]; i = NextLumpIndex[i];
lump = LumpInfo[i].lump;
} }
return i != NULL_INDEX ? i : -1; return i != NULL_INDEX ? i : -1;