Add some ASSERTs which I think should always hold true for the purpose of ''understanding'' the string resource code. As it's difficult to understand, due to it multi-purposing one variable to hold two semantically different values (at the same time!).
In any case I ''think'' these ASSERTs always hold true, (and for the testing I've done so far they do). But I'd like some more certainty and confirmation, hence why I'm committing this (before I make changes that rely on that assertion holding true), so other people get a chance to test this and prove my assertion wrong. Thus, ''if'', these ASSERTs are triggered, please open a bugreport or otherwise notify me of it (e-mail, IRC, text message, postal mail, phone call, etc.) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5649 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
0651625733
commit
8eb2ed2827
|
@ -162,6 +162,7 @@ static void strresReleaseIDStrings(STR_RES *psRes)
|
|||
psID = treapGetSmallest(psRes->psIDTreap))
|
||||
{
|
||||
treapDel(psRes->psIDTreap, psID->pIDStr);
|
||||
ASSERT(psID->id & ID_ALLOC, "This assert should *never* trigger a crash, if it does please open a bugreport or send me (Giel) a mail");
|
||||
if (psID->id & ID_ALLOC)
|
||||
{
|
||||
free(psID->pIDStr);
|
||||
|
@ -235,6 +236,7 @@ BOOL strresGetIDNum(STR_RES *psRes, const char *pIDStr, UDWORD *pIDNum)
|
|||
return false;
|
||||
}
|
||||
|
||||
ASSERT(psID->id & ID_ALLOC, "This assert should *never* trigger a crash, if it does please open a bugreport or send me (Giel) a mail");
|
||||
*pIDNum = psID->id & ~ID_ALLOC;
|
||||
|
||||
return true;
|
||||
|
@ -299,6 +301,8 @@ BOOL strresStoreString(STR_RES *psRes, char *pID, const char *pString)
|
|||
// Remove the ID_ALLOC bit
|
||||
id = psID->id & ~ID_ALLOC;
|
||||
|
||||
ASSERT(psID->id & ID_ALLOC, "This assert should *never* trigger a crash, if it does please open a bugreport or send me (Giel) a mail");
|
||||
|
||||
// Find the block to store the string in
|
||||
for(psBlock = psRes->psStrings; psBlock->idEnd < id;
|
||||
psBlock = psBlock->psNext)
|
||||
|
|
Loading…
Reference in New Issue