template<class T, int ALIGN=1>
void HandleAppender<T, ALIGN>::AddRealSize(Size amount) {
if (realSize == 0)
size = realSize = GetHandleSize(hand);
if (size + amount > realSize) {
realSize *= 2;
SetHandleSize(hand,realSize);
if (MemError())
THROW_OCMemErr(MemError(),realSize);
}
}
Worked find, so long as I was only appending longs to the handle. However,
I then changed it to append double_t's, which on the 68K are 10 bytes. Not
a good thing, considering the first double added has a realsize of 8 bytes
yet a size of 10...
Changed to:
template<class T, int ALIGN=1>
void HandleAppender<T, ALIGN>::AddRealSize(Size amount) {
if (realSize == 0)
size = realSize = GetHandleSize(hand);
if (size + amount > realSize) {
while (size + amount > realSize)
realSize *= 2;
SetHandleSize(hand,realSize);
if (MemError())
THROW_OCMemErr(MemError(),realSize);
}
}
Thank God for MacsBug or this would of never been found.
It's building now, so I'll soon know if I've caught the bug -- or if there
is yet another.
Well, at least all of these bugs result in some more nice debugging code
being added. One can now trace OTVar's, for example. It's also how memory
tracing, execution tracing, bison tracing, etc. got in there.
BTW: I putting togeth a thourough tester for OTVar.