diff --git a/SRC/ENGINE/ACTOR.CPP b/SRC/ENGINE/ACTOR.CPP index 75fa4873..0e3e6793 100644 --- a/SRC/ENGINE/ACTOR.CPP +++ b/SRC/ENGINE/ACTOR.CPP @@ -687,7 +687,7 @@ bool ACTR::_FDoFrm(bool fPositionBody, bool *pfPositionDirty, bool *pfSoundInFra // An aetActn Event will change _rtelCur at the time it is executed for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetAdd) { if (!_FIsAddNow(iaev)) @@ -816,7 +816,7 @@ bool ACTR::FReplayFrame(long grfscen) for (iaev = _iaevFrmMin; iaev < _iaevCur; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet != aetSnd) continue; @@ -871,7 +871,7 @@ bool ACTR::_FIsDoneAevSub(long iaev, RTEL rtel) for (; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetAdd) return fTrue; if (aev.rtel > rtel) @@ -992,11 +992,11 @@ bool ACTR::_FDoAevCore(long iaev) AEV aev; COST cost; - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.nfrm != _nfrmCur) { aev.nfrm = _nfrmCur; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } AssertIn(aev.aet, 0, aetLim); @@ -1279,14 +1279,14 @@ void ACTR::_MergeAev(long iaevFirst, long iaevNew, long *piaevRtn) return; } - _pggaev->GetFixed(iaevNew, &aevNew); + _pggaev->GetFixed(iaevNew, &aevNew, sizeof(aevNew)); // // Check if Aev is in the list already // for (iaev = iaevFirst; iaev < iaevNew; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if ((aev.aet != aevNew.aet) && (aev.aet != aetRem) && (aev.aet != aetRotH)) continue; @@ -1802,7 +1802,7 @@ bool ACTR::_FAddAevFromPrev(long iaevLim, ulong grfaet) _FFindPrevAevAet(aetAdd, iaevLim, &iaevAdd); _FindAevLastSub(iaevAdd, iaevLim, &iaevLast); - _pggaev->GetFixed(_iaevCur - 1, &aevCur); + _pggaev->GetFixed(_iaevCur - 1, &aevCur, sizeof(aevCur)); // It is more efficient to insert non-costume events backwards for (iaev = iaevLast; iaev > iaevAdd; iaev--) @@ -1811,7 +1811,7 @@ bool ACTR::_FAddAevFromPrev(long iaevLim, ulong grfaet) break; Assert(iaev >= 0, "Logic error"); - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (!(grfaet & (1 << aev.aet)) || aev.aet == aetCost) continue; @@ -1845,7 +1845,7 @@ bool ACTR::_FAddAevFromPrev(long iaevLim, ulong grfaet) // Costumes needed to be gathered forward for (iaev = iaevAdd + 1; iaev <= iaevLast; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet != aetCost) continue; @@ -1929,7 +1929,7 @@ bool ACTR::_FAddAevFromLater(void) // Find the next Add event for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetAdd) { iaevStart = iaev; @@ -1944,7 +1944,7 @@ bool ACTR::_FAddAevFromLater(void) // Stuff in the events from this next Add event for (iaev = iaevStart; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel != rtelAdd) { @@ -2002,7 +2002,7 @@ bool ACTR::_FFindPrevAevAet(long aet, long iaevCur, long *piaevAdd) iaevCur--; for (; iaevCur >= 0; iaevCur--) { - _pggaev->GetFixed(iaevCur, &aev); + _pggaev->GetFixed(iaevCur, &aev, sizeof(aev)); if (aev.aet == aet) { *piaevAdd = iaevCur; @@ -2067,7 +2067,7 @@ void ACTR::_FindAevLastSub(long iaevAdd, long iaevLim, long *piaevLast) if (iaevLim == ivNil) iaevLim = _pggaev->IvMac(); - _pggaev->GetFixed(iaevLim - 1, &aev); + _pggaev->GetFixed(iaevLim - 1, &aev, sizeof(aev)); if (_FIsStalled(iaevAdd, &aev.rtel, piaevLast)) { @@ -2570,11 +2570,11 @@ bool ACTR::FSoonerLater(long dnfrm) // The times of past events need to be correct. for (iaev = _iaevCur - 1; dnfrmT > 0 && iaev >= 0; iaev--) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet != aetAdd || iaev == 0) { aev.nfrm -= dnfrmT; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); continue; } @@ -2582,7 +2582,7 @@ bool ACTR::FSoonerLater(long dnfrm) paevPrev = (AEV *)_pggaev->QvFixedGet(iaev - 1); dnfrmSub = aev.nfrm - (paevPrev->nfrm); aev.nfrm -= dnfrmT; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); dnfrmT -= (dnfrmSub - 1); } } @@ -2592,12 +2592,12 @@ bool ACTR::FSoonerLater(long dnfrm) dnfrmT = dnfrm; for (iaev = _iaevAddCur; dnfrmT > 0 && iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet != aetAdd || iaev == _iaevAddCur) { nfrmSav = aev.nfrm; aev.nfrm += dnfrmT; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); continue; } // Adjust for the gap between subroutes @@ -2606,12 +2606,12 @@ bool ACTR::FSoonerLater(long dnfrm) if (dnfrmT <= 0) break; aev.nfrm += dnfrmT; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } } - _pggaev->GetFixed(0, &aev); + _pggaev->GetFixed(0, &aev, sizeof(aev)); _nfrmFirst = aev.nfrm; - _pggaev->GetFixed(_pggaev->IvMac() - 1, &aev); + _pggaev->GetFixed(_pggaev->IvMac() - 1, &aev, sizeof(aev)); _nfrmLast = aev.nfrm; _nfrmCur += dnfrm; @@ -2997,7 +2997,7 @@ void ACTR::_PrepXfrmFill(long aet, void *pvVar, long cbVar, long iaevMin, long i // and store the ptr in pvVarCmp for (iaev = 0; iaev < iaevMin - 1; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aet != aev.aet) continue; @@ -3012,7 +3012,7 @@ void ACTR::_PrepXfrmFill(long aet, void *pvVar, long cbVar, long iaevMin, long i for (iaev = iaevMin; iaev < _pggaev->IvMac(); iaev++) { bool fDelete = fFalse; - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(AEV)); // Stage entrance events are boundaries to edits if (aetAdd == aev.aet) @@ -3201,7 +3201,7 @@ void ACTR::_PrepActnFill(long iaevMin, long anidPrev, long anidNew, ulong grfaet for (iaev = iaevMin; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); // Stage entrance events are boundaries to edits if (aetAdd == aev.aet) @@ -3287,7 +3287,7 @@ void ACTR::_PrepCostFill(long iaevMin, AEVCOST *paevcost) for (iaev = iaevMin; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); // Stage entrance events are boundaries to edits if (aetAdd == aev.aet) @@ -3381,7 +3381,7 @@ void ACTR::_AdjustAevForRteIns(long irptAdjust, long iaevMin) for (iaev = iaevMin; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel.irpt >= irptAdjust) // offset from later point { aev.rtel.irpt++; @@ -3401,7 +3401,7 @@ void ACTR::_AdjustAevForRteIns(long irptAdjust, long iaevMin) aev.rtel.irpt++; } } - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } } /*************************************************************************** @@ -3435,7 +3435,7 @@ void ACTR::_AdjustAevForRteDel(long irptAdjust, long iaevMin) for (iaev = iaevMin; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel.irpt > irptAdjust) // offset from later point { aev.rtel.irpt--; @@ -3455,7 +3455,7 @@ void ACTR::_AdjustAevForRteDel(long irptAdjust, long iaevMin) else continue; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } } @@ -3537,7 +3537,7 @@ LDoneMove: // at the location of the event. for (iaev = iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if ((aev.rtel <= *prtel) && (aev.aet == aetStep || aev.aet == aetActn)) { *prtel = aev.rtel; @@ -3758,7 +3758,7 @@ void ACTR::_CalcRteOrient(BMAT34 *pbmat34, BRA *pxa, BRA *pya, BRA *pza, ulong * *pza = aZero; AssertIn(_iaevAddCur, 0, _pggaev->IvMac()); - _pggaev->GetFixed(_iaevAddCur, &aev); + _pggaev->GetFixed(_iaevAddCur, &aev, sizeof(aev)); irptAdd = aev.rtel.irpt; irptPrev = (rZero < _rtelCur.dwrOffset || _rtelCur.irpt == aev.rtel.irpt) ? _rtelCur.irpt : _rtelCur.irpt - 1; @@ -4084,7 +4084,7 @@ bool ACTR::_FComputeLifetime(long *pnfrmLast) // Scan all events for this frame for (iaev = iaevNew; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if ((aev.rtel > rtel) && ((aetAdd != aev.aet) || (_fModeRecord && !fEndSubRoute) || (!fEndSubRoute && !fDoneSubRoute))) @@ -4157,7 +4157,7 @@ bool ACTR::_FComputeLifetime(long *pnfrmLast) if (aev.nfrm != _nfrmLast) { aev.nfrm = _nfrmLast; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(AEV)); } } @@ -4203,7 +4203,7 @@ bool ACTR::_FComputeLifetime(long *pnfrmLast) } // Add events jump in space. Update rtel - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); rtel = aev.rtel; // Initialization for _AdvanceRtel() @@ -4242,7 +4242,7 @@ bool ACTR::_FIsStalled(long iaevFirst, RTEL *prtel, long *piaevLast) for (iaev = iaevFirst; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if ((aev.rtel.irpt > prtel->irpt) || (aev.rtel.dwrOffset > prtel->dwrOffset)) { if (piaevLast != pvNil) @@ -4331,7 +4331,7 @@ bool ACTR::FBeginRecord(ulong tsCurrent, bool fReplace, PACTR pactrRestore) for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (irptNext < aev.rtel.irpt) break; if (aetRem == aev.aet) @@ -4375,7 +4375,7 @@ bool ACTR::FBeginRecord(ulong tsCurrent, bool fReplace, PACTR pactrRestore) for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet != aetAdd) continue; nfrmAdd = aev.nfrm; @@ -4386,7 +4386,7 @@ bool ACTR::FBeginRecord(ulong tsCurrent, bool fReplace, PACTR pactrRestore) } else { - _pggaev->GetFixed(iaev - 1, &aev); + _pggaev->GetFixed(iaev - 1, &aev, sizeof(AEV)); nfrmPrev = aev.nfrm; } _dnfrmGap -= (nfrmAdd - nfrmPrev); @@ -4640,7 +4640,7 @@ bool ACTR::FEndRecord(bool fReplace, PACTR pactrRestore) for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetAdd) { irptLim = aev.rtel.irpt; @@ -4696,7 +4696,7 @@ bool ACTR::FEndRecord(bool fReplace, PACTR pactrRestore) // for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); #ifdef BUG1961 // If we were rejoin-recording from a static segment, there is @@ -4722,7 +4722,7 @@ bool ACTR::FEndRecord(bool fReplace, PACTR pactrRestore) else { aev.rtel = rtelJoin; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); _MergeAev(iaevJoinFirst, iaev, &iaevNew); if (iaevNew < iaev) iaev--; @@ -4802,7 +4802,7 @@ void ACTR::DeleteFwdCore(bool fDeleteAll, bool *pfAlive, long iaevCur) goto LEnd; } #ifdef DEBUG - _pggaev->GetFixed(_iaevAddCur, &aev); + _pggaev->GetFixed(_iaevAddCur, &aev, sizeof(aev)); Assert(aetAdd == aev.aet, "Should be an add event at _iaevAddCur"); #endif // DEBUG if (_fOnStage) @@ -4821,7 +4821,7 @@ void ACTR::DeleteFwdCore(bool fDeleteAll, bool *pfAlive, long iaevCur) // Tweak events override the last step event. for (iaev = _iaevCur - 1; iaev > 0; iaev--) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel != _rtelCur) break; if (aev.aet == aetTweak) @@ -4995,7 +4995,7 @@ void ACTR::_SaveCurPathOrien(void) if (_iaevAddCur >= 0 && !_ptmpl->FIsTdt()) { - _pggaev->GetFixed(_iaevAddCur, &aev); + _pggaev->GetFixed(_iaevAddCur, &aev, sizeof(aev)); _pglrpt->Get(aev.rtel.irpt, &rpt); if (rZero != rpt.dwr) // ie, non-static path segment { @@ -5057,7 +5057,7 @@ void ACTR::DeleteBackCore(bool *pfAlive) // previous and next nodes for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel.irpt > _rtelCur.irpt) break; @@ -5084,7 +5084,7 @@ void ACTR::DeleteBackCore(bool *pfAlive) dwrOffsetT = BrsSub(aev.rtel.dwrOffset, _rtelCur.dwrOffset); aev.rtel.dwrOffset = dwrOffsetT; } - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } // @@ -5105,7 +5105,7 @@ void ACTR::DeleteBackCore(bool *pfAlive) // for (iaev = 0; iaev < _iaevCur; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (!_fOnStage || iaev < _iaevAddCur) { _RemoveAev(iaev); @@ -5154,7 +5154,7 @@ void ACTR::DeleteBackCore(bool *pfAlive) LDefault: aev.rtel = _rtelCur; aev.nfrm = _nfrmCur; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); if (iaev > 0) _MergeAev(0, iaev, &iaevNew); else @@ -5186,9 +5186,9 @@ void ACTR::DeleteBackCore(bool *pfAlive) #endif // BUG1866 for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); aev.rtel.irpt -= dnrpt; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } #ifndef BUG1866 if (!_fOnStage) @@ -5207,7 +5207,7 @@ void ACTR::DeleteBackCore(bool *pfAlive) else { // Adjust remaining state variables - _pggaev->GetFixed(0, &aev); + _pggaev->GetFixed(0, &aev, sizeof(aev)); Assert(aev.aet == aetAdd, "An aetAdd event should be the first event"); _nfrmFirst = aev.nfrm; _fLifeDirty = fTrue; @@ -5264,14 +5264,14 @@ void ACTR::_TruncateSubRte(long irptDelLim) // Update aev's rtel's for (iaev = _iaevCur - 1; iaev >= 0; iaev--) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel.irpt < irpt) break; if (aev.rtel.dwrOffset >= rptNode1.dwr) { aev.rtel.dwrOffset = rZero; aev.rtel.irpt++; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); } } @@ -5464,7 +5464,7 @@ bool ACTR::FChangeTagTmpl(TAG *ptagTmplNew) // events in this GG as we go for (iaev = _pggaev->IvMac() - 1; iaev >= 0; iaev--) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetCost) { _pggaev->Get(iaev, &aevcost); @@ -5527,12 +5527,12 @@ void ACTR::AssertValid(ulong grfobj) } AssertIn(_rtelCur.irpt, 0, irptMac + 1); // Supply a debug readable view of the event stream - _pggaev->GetFixed(0, &aev); + _pggaev->GetFixed(0, &aev, sizeof(aev)); Assert(aetAdd == aev.aet, "BUG: No add event at front of list"); for (iaev = 0; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); Assert(rtel <= aev.rtel, "Illegal ordering in event list"); AssertIn(aev.aet, 0, aetLim); diff --git a/SRC/ENGINE/ACTREDIT.CPP b/SRC/ENGINE/ACTREDIT.CPP index 0034b81e..7d6afb95 100644 --- a/SRC/ENGINE/ACTREDIT.CPP +++ b/SRC/ENGINE/ACTREDIT.CPP @@ -61,7 +61,7 @@ bool ACTR::FCopy(PACTR *ppactr, bool fEntireScene) // for (iaev = _iaevAddCur; iaev < _iaevCur; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); // Is this an event we want to copy? switch (aev.aet) @@ -144,7 +144,7 @@ bool ACTR::FCopy(PACTR *ppactr, bool fEntireScene) // for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if ((!fEntireScene) && (aetAdd == aev.aet) && (*ppactr)->_pggaev->IvMac() > 0) { @@ -638,11 +638,11 @@ bool ACTR::FPasteRte(PACTR pactr) // for (iaev = _iaevCur; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.rtel.irpt > _rtelCur.irpt + crptDel) { aev.rtel.irpt += crptNew - crptDel; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(aev)); continue; } else @@ -799,7 +799,7 @@ bool ACTR::FPaste(long nfrm, SCEN *pscen) _GetNewOrigin(&xr, &yr, &zr); Assert(_pggaev->IvMac() > 0, "Nothing to paste!"); - _pggaev->GetFixed(0, &aev); + _pggaev->GetFixed(0, &aev, sizeof(AEV)); if (aev.aet != aetAdd) return fFalse; dnfrm = aev.nfrm - nfrm; @@ -827,11 +827,11 @@ bool ACTR::FPaste(long nfrm, SCEN *pscen) // Update sound events for (iaev = 0; iaev < _pggaev->IvMac(); iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(AEV)); if (dnfrm != 0) { aev.nfrm -= dnfrm; - _pggaev->PutFixed(iaev, &aev); + _pggaev->PutFixed(iaev, &aev, sizeof(AEV)); } if (aetSnd != aev.aet) continue; diff --git a/SRC/ENGINE/ACTRSND.CPP b/SRC/ENGINE/ACTRSND.CPP index c8867ea2..5b4a69b8 100644 --- a/SRC/ENGINE/ACTRSND.CPP +++ b/SRC/ENGINE/ACTRSND.CPP @@ -442,7 +442,7 @@ bool ACTR::FSetVlmSnd(long sty, bool fMotionMatch, long vlm) // Set the volume for any events in the actor list for this frame for (iaev = _iaevFrmMin; iaev < _iaevCur; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetActn) fActnThisFrame = fTrue; @@ -465,7 +465,7 @@ bool ACTR::FSetVlmSnd(long sty, bool fMotionMatch, long vlm) { for (iaev = _iaevFrmMin - 1; iaev > 0; iaev--) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); // Quit when the action changes if (aev.aet == aetActn || (nfrmMM != ivNil && nfrmMM > aev.nfrm)) @@ -543,7 +543,7 @@ bool ACTR::FQuerySnd(long sty, bool fMotionMatch, PGL *pglTagSnd, long *pvlm, bo // Non-motion match sounds for (iaev = _iaevFrmMin; iaev < _iaevCur; iaev++) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet != aetSnd) continue; @@ -637,7 +637,7 @@ bool ACTR::FDeleteSndCore(long sty, bool fMotionMatch) iaevFirst = (fMotionMatch) ? _iaevActnCur : _iaevFrmMin; for (iaev = _iaevCur - 1; iaev >= iaevFirst; iaev--) { - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (fMotionMatch && nfrmMM != ivNil && nfrmMM > aev.nfrm) break; @@ -705,7 +705,7 @@ bool ACTR::FSoundInFrm(void) { AEV aev; - _pggaev->GetFixed(iaev, &aev); + _pggaev->GetFixed(iaev, &aev, sizeof(aev)); if (aev.aet == aetSnd) return fTrue; } diff --git a/SRC/ENGINE/MOVIE.CPP b/SRC/ENGINE/MOVIE.CPP index 6b9cb86f..5966e74d 100644 --- a/SRC/ENGINE/MOVIE.CPP +++ b/SRC/ENGINE/MOVIE.CPP @@ -479,7 +479,7 @@ bool MVIE::FReadRollCall(PCRF pcrf, CNO cno, PGST *ppgst, long *paridLim) imactrMac = (*ppgst)->IvMac(); for (imactr = 0; imactr < imactrMac; imactr++) { - (*ppgst)->GetExtra(imactr, &mactr, sizeof(MACTR)); + (*ppgst)->GetExtra(imactr, &mactr, sizeof(mactr)); if (bo == kboOther) SwapBytesBom(&mactr, kbomMactr); @@ -489,7 +489,7 @@ bool MVIE::FReadRollCall(PCRF pcrf, CNO cno, PGST *ppgst, long *paridLim) // Open the tags, since they might be TDTs AssertDo(vptagm->FOpenTag(&mactr.tagTmpl, pcrf), "Should never fail when not copying the tag"); - (*ppgst)->PutExtra(imactr, &mactr, sizeof(MACTR)); + (*ppgst)->PutExtra(imactr, &mactr, sizeof(mactr)); } return fTrue; @@ -622,7 +622,7 @@ MVIE::~MVIE(void) { for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); vptagm->CloseTag(&mactr.tagTmpl); } ReleasePpo(&_pgstmactr); @@ -774,7 +774,7 @@ bool MVIE::FGetArid(long iarid, long *parid, PSTN pstn, long *pcactRef, PTAG pta } _pgstmactr->GetStn(iarid, pstn); - _pgstmactr->GetExtra(iarid, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(iarid, &mactr, sizeof(mactr)); *parid = mactr.arid; *pcactRef = mactr.cactRef; if (pvNil != ptagTmpl) @@ -851,7 +851,7 @@ bool MVIE::FChooseArid(long arid) // for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.arid == arid) { pactr = ACTR::PactrNew(&(mactr.tagTmpl)); @@ -928,7 +928,7 @@ bool MVIE::FGetName(long arid, PSTN pstn) for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.arid == arid) { _pgstmactr->GetStn(imactr, pstn); @@ -963,7 +963,7 @@ bool MVIE::FNameActr(long arid, PSTN pstn) for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.arid == arid) { @@ -998,7 +998,7 @@ bool MVIE::FIsPropBrwsIarid(long iarid) AssertIn(iarid, 0, _pgstmactr->IvMac()); MACTR mactr; - _pgstmactr->GetExtra(iarid, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(iarid, &mactr, sizeof(mactr)); return FPure(mactr.grfbrws & fbrwsProp); } @@ -1019,7 +1019,7 @@ bool MVIE::FIsIaridTdt(long iarid) AssertIn(iarid, 0, _pgstmactr->IvMac()); MACTR mactr; - _pgstmactr->GetExtra(iarid, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(iarid, &mactr, sizeof(mactr)); return FPure(mactr.grfbrws & fbrwsTdt); } @@ -1047,12 +1047,12 @@ void MVIE::ChangeActrTag(long arid, PTAG ptag) for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.arid == arid) { mactr.tagTmpl = *ptag; - _pgstmactr->PutExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->PutExtra(imactr, &mactr, sizeof(mactr)); return; } } @@ -1089,7 +1089,7 @@ bool MVIE::FAddToRollCall(ACTR *pactr, PSTN pstn) for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.arid == pactr->Arid()) { TAG tagTmpl; @@ -1103,7 +1103,7 @@ bool MVIE::FAddToRollCall(ACTR *pactr, PSTN pstn) // ACTR::GetTagTmpl doesn't AddRef the pcrf, so do it here: TAGM::DupTag(&tagTmpl); } - _pgstmactr->PutExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->PutExtra(imactr, &mactr, sizeof(mactr)); Pmcc()->UpdateRollCall(); return (fTrue); } @@ -1167,7 +1167,7 @@ void MVIE::RemFromRollCall(ACTR *pactr, bool fDelIfOnlyRef) // for (imactr = 0; imactr < _pgstmactr->IvMac(); imactr++) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.arid == pactr->Arid()) { mactr.cactRef--; @@ -1179,7 +1179,7 @@ void MVIE::RemFromRollCall(ACTR *pactr, bool fDelIfOnlyRef) } else { - _pgstmactr->PutExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->PutExtra(imactr, &mactr, sizeof(mactr)); } if (mactr.cactRef == 0) @@ -2540,7 +2540,7 @@ LRetry: for (imactr = 0; imactr < _pgstmactr->IvMac();) { - _pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); if (mactr.cactRef == 0) { _pgstmactr->Delete(imactr); @@ -4981,7 +4981,7 @@ bool MVIE::_FAddMvieToRollCall(CNO cno, long aridMin) MACTR mactr; pgstmactr->GetStn(imactr, &stn); - pgstmactr->GetExtra(imactr, &mactr, sizeof(MACTR)); + pgstmactr->GetExtra(imactr, &mactr, sizeof(mactr)); mactr.arid += aridMin; mactr.cactRef = 0; @@ -5067,7 +5067,7 @@ LFail: imactrMac = _pgstmactr->IvMac(); while (imactr--) { - _pgstmactr->GetExtra(--imactrMac, &mactr, sizeof(MACTR)); + _pgstmactr->GetExtra(--imactrMac, &mactr, sizeof(mactr)); vptagm->CloseTag(&mactr.tagTmpl); _pgstmactr->Delete(imactrMac); pgstmactr->Delete(imactr); @@ -5077,7 +5077,7 @@ LFail: imactrMac = pgstmactr->IvMac(); while (imactrMac--) { - pgstmactr->GetExtra(imactrMac, &mactr, sizeof(MACTR)); + pgstmactr->GetExtra(imactrMac, &mactr, sizeof(mactr)); vptagm->CloseTag(&mactr.tagTmpl); } ReleasePpo(&pgstmactr); diff --git a/SRC/ENGINE/SCENE.CPP b/SRC/ENGINE/SCENE.CPP index 6adc45e0..0e9cdc4f 100644 --- a/SRC/ENGINE/SCENE.CPP +++ b/SRC/ENGINE/SCENE.CPP @@ -944,7 +944,7 @@ bool SCEN::FGotoFrm(long nfrm) // for (; _isevFrmLim > 0; _isevFrmLim--) { - _pggsevFrm->GetFixed(_isevFrmLim - 1, &sev); + _pggsevFrm->GetFixed(_isevFrmLim - 1, &sev, sizeof(SEV)); if (sev.nfrm <= _nfrmCur) { break; @@ -963,7 +963,7 @@ bool SCEN::FGotoFrm(long nfrm) // for (isev = _isevFrmLim - 1; isev >= 0; isev--) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(SEV)); if (sev.nfrm < _nfrmCur) { break; @@ -1010,7 +1010,7 @@ bool SCEN::FGotoFrm(long nfrm) // for (; _isevFrmLim < _pggsevFrm->IvMac(); _isevFrmLim++) { - _pggsevFrm->GetFixed(_isevFrmLim, &sev); + _pggsevFrm->GetFixed(_isevFrmLim, &sev, sizeof(sev)); if (sev.nfrm > _nfrmCur) { break; @@ -1103,7 +1103,7 @@ void SCEN::_DoPrerenderingWork(bool fStartNow) { for (isev = _isevFrmLim - 1; isev >= 0; isev--) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.nfrm != _nfrmCur) { return; // no camera view change in this frame @@ -1123,7 +1123,7 @@ void SCEN::_DoPrerenderingWork(bool fStartNow) nfrmNextChange = _nfrmLast; // if no more view changes, go til end of scene for (isev = _isevFrmLim; isev < _pggsevFrm->IvMac(); isev++) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.sevt == sevtChngCamera) { nfrmNextChange = sev.nfrm; @@ -1242,7 +1242,7 @@ bool SCEN::FReplayFrm(ulong grfscen) // for (isev = _isevFrmLim - 1; isev >= 0; isev--) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.nfrm < _nfrmCur) { break; @@ -1615,7 +1615,7 @@ void SCEN::_MoveBackFirstFrame(long nfrm) // for (isev = 0; isev < _pggsevFrm->IvMac(); isev++) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.nfrm != _nfrmFirst) { @@ -1629,7 +1629,7 @@ void SCEN::_MoveBackFirstFrame(long nfrm) // Move this back // sev.nfrm = nfrm; - _pggsevFrm->PutFixed(isev, &sev); + _pggsevFrm->PutFixed(isev, &sev, sizeof(sev)); _pggsevFrm->Move(isev, 0); } } @@ -1680,7 +1680,7 @@ bool SCEN::FAddSndCore(bool fLoop, bool fQueue, long vlm, long sty, long ctag, P // for (isev = _isevFrmLim - 1; isev >= 0; isev--) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.nfrm != _nfrmCur) break; if (sev.sevt == sevtPlaySnd) @@ -1861,7 +1861,7 @@ bool SCEN::FAddSndCoreTagc(bool fLoop, bool fQueue, long vlm, long sty, long cta // for (isev = _isevFrmLim - 1; isev >= 0; isev--) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.nfrm != _nfrmCur) break; if (sev.sevt == sevtPlaySnd) @@ -3335,7 +3335,7 @@ bool SCEN::FSetBkgdCore(PTAG ptag, PTAG ptagOld) for (isev = 0; isev < _pggsevStart->IvMac(); isev++) { - _pggsevStart->GetFixed(isev, &sev); + _pggsevStart->GetFixed(isev, &sev, sizeof(sev)); if (sev.sevt == sevtSetBkgd) { @@ -3531,7 +3531,7 @@ bool SCEN::FIsEmpty(void) for (isev = 0; isev < _pggsevFrm->IvMac(); isev++) { - _pggsevFrm->GetFixed(isev, &sev); + _pggsevFrm->GetFixed(isev, &sev, sizeof(sev)); if (sev.sevt != sevtChngCamera && sev.sevt != sevtPlaySnd) { return (fFalse); @@ -4038,7 +4038,7 @@ LFail1: // while (isevStart--) { - pscen->_pggsevStart->GetFixed(isevStart, &sev); + pscen->_pggsevStart->GetFixed(isevStart, &sev, sizeof(sev)); switch (sev.sevt) { case sevtAddActr: @@ -4063,7 +4063,7 @@ LFail1: // while (isevFrm--) { - pscen->_pggsevFrm->GetFixed(isevFrm, &sev); + pscen->_pggsevFrm->GetFixed(isevFrm, &sev, sizeof(sev)); switch (sev.sevt) { case sevtAddActr: @@ -4130,7 +4130,7 @@ bool SCEN::FPlayStartEvents(bool fActorsOnly) { SEV sev; - _pggsevStart->GetFixed(isev, &sev); + _pggsevStart->GetFixed(isev, &sev, sizeof(sev)); if (fActorsOnly && sev.sevt != sevtAddActr) continue; @@ -5572,14 +5572,14 @@ bool SCEN::FChopBackCore() { _isevFrmLim--; - _pggsevFrm->GetFixed(_isevFrmLim, &sev); + _pggsevFrm->GetFixed(_isevFrmLim, &sev, sizeof(sev)); if ((sev.sevt == sevtChngCamera) && (fCopyCam)) { fCopyCam = fFalse; sev.nfrm = _nfrmCur; - _pggsevFrm->PutFixed(_isevFrmLim, &sev); + _pggsevFrm->PutFixed(_isevFrmLim, &sev, sizeof(sev)); } else { @@ -5597,7 +5597,7 @@ bool SCEN::FChopBackCore() for (; _isevFrmLim < _pggsevFrm->IvMac(); _isevFrmLim++) { - _pggsevFrm->GetFixed(_isevFrmLim, &sev); + _pggsevFrm->GetFixed(_isevFrmLim, &sev, sizeof(sev)); if (sev.nfrm != _nfrmCur) { break; diff --git a/SRC/ENGINE/TAGL.CPP b/SRC/ENGINE/TAGL.CPP index bdd1da3a..8c602b3d 100644 --- a/SRC/ENGINE/TAGL.CPP +++ b/SRC/ENGINE/TAGL.CPP @@ -103,7 +103,7 @@ void TAGL::GetTag(long itag, PTAG ptag) TAGF tagf; - _pggtagf->GetFixed(itag, &tagf); + _pggtagf->GetFixed(itag, &tagf, sizeof(tagf)); *ptag = tagf.tag; } @@ -182,13 +182,13 @@ bool TAGL::FInsertTag(PTAG ptag, bool fCacheChildren) return fTrue; } // Tag is already in GG, see if fCacheChildren needs to be updated - _pggtagf->GetFixed(itag, &tagf); + _pggtagf->GetFixed(itag, &tagf, sizeof(TAGF)); if (!tagf.fCacheChildren && fCacheChildren) { // FIXME(bruxisma): The compiler has correctly identified that this // should be an assignment. tagf.fCacheChildren == fTrue; - _pggtagf->PutFixed(itag, &tagf); + _pggtagf->PutFixed(itag, &tagf, sizeof(tagf)); } return fTrue; } @@ -214,7 +214,7 @@ bool TAGL::FInsertChild(PTAG ptag, CHID chid, CTG ctg) } #ifdef DEBUG TAGF tagf; - _pggtagf->GetFixed(itagf, &tagf); + _pggtagf->GetFixed(itagf, &tagf, sizeof(tagf)); if (tagf.tag.ctg != ptag->ctg || tagf.tag.cno != ptag->cno) Bug("_FFindTag has a bug"); #endif // DEBUG @@ -259,7 +259,7 @@ bool TAGL::FCacheTags(void) for (itagf = 0; itagf < _pggtagf->IvMac(); itagf++) { // Cache the main tag - _pggtagf->GetFixed(itagf, &tagf); + _pggtagf->GetFixed(itagf, &tagf, sizeof(tagf)); if (!vptagm->FCacheTagToHD(&tagf.tag, tagf.fCacheChildren)) return fFalse; diff --git a/SRC/ENGINE/TMPL.CPP b/SRC/ENGINE/TMPL.CPP index 9ae62cd6..20bd0e22 100644 --- a/SRC/ENGINE/TMPL.CPP +++ b/SRC/ENGINE/TMPL.CPP @@ -232,7 +232,7 @@ void ACTN::GetCel(long icel, CEL *pcel) AssertIn(icel, 0, Ccel()); AssertVarMem(pcel); - _pggcel->GetFixed(icel, pcel); + _pggcel->GetFixed(icel, pcel, sizeof(*pcel)); } /*************************************************************************** diff --git a/kauai/SRC/CHUNK.CPP b/kauai/SRC/CHUNK.CPP index 1cb29478..2e02819e 100644 --- a/kauai/SRC/CHUNK.CPP +++ b/kauai/SRC/CHUNK.CPP @@ -1038,7 +1038,7 @@ void CFL::AssertValid(ulong grfcfl) fFirstCrp = fTrue; for (icrp = _pggcrp->IvMac(); icrp-- != 0;) { - _pggcrp->GetFixed(icrp, &crp); + _pggcrp->GetFixed(icrp, &crp, sizeof(crp)); cbVar = _pggcrp->Cb(icrp); cbRgch = crp.CbRgch(cbVar); @@ -2794,7 +2794,7 @@ void CFL::Move(CTG ctg, CNO cno, CTG ctgNew, CNO cnoNew) // index. In ship, we'll stop once we changed ccrpRef KIDs. Debug(ccrpRef++;) for (icrp = _pggcrp->IvMac(); icrp-- > 0 && ccrpRef > 0;) { - _pggcrp->GetFixed(icrp, &crp); + _pggcrp->GetFixed(icrp, &crp, sizeof(crp)); qkid = (KID *)_pggcrp->QvGet(icrp); for (ikid = 0; ikid < crp.ckid;) { diff --git a/kauai/SRC/CURSOR.CPP b/kauai/SRC/CURSOR.CPP index 6e616e16..f4097355 100644 --- a/kauai/SRC/CURSOR.CPP +++ b/kauai/SRC/CURSOR.CPP @@ -63,7 +63,7 @@ bool CURS::FReadCurs(PCRF pcrf, CTG ctg, CNO cno, PBLCK pblck, PBACO *ppbaco, lo dzpBest = klwMax; for (icurf = 0; icurf < pggcurf->IvMac(); icurf++) { - pggcurf->GetFixed(icurf, &curf); + pggcurf->GetFixed(icurf, &curf, sizeof(curf)); if (kboOther == bo) SwapBytesBom(&curf, kbomCurf); if (curf.dxp > dxp || curf.dyp > dyp || curf.curt != curtMonochrome || @@ -82,7 +82,7 @@ bool CURS::FReadCurs(PCRF pcrf, CTG ctg, CNO cno, PBLCK pblck, PBACO *ppbaco, lo } } AssertIn(icurfBest, 0, pggcurf->IvMac()); - pggcurf->GetFixed(icurfBest, &curf); + pggcurf->GetFixed(icurfBest, &curf, sizeof(curf)); if (kboOther == bo) SwapBytesBom(&curf, kbomCurf); cbRowSrc = LwRoundAway(LwDivAway(curf.dxp, 8), 2); diff --git a/kauai/SRC/DLG.H b/kauai/SRC/DLG.H index e135b2f8..844de7d7 100644 --- a/kauai/SRC/DLG.H +++ b/kauai/SRC/DLG.H @@ -92,11 +92,11 @@ class DLG : public DLG_PAR long IditFromSit(long sit); void GetDit(long idit, DIT *pdit) { - GetFixed(idit, pdit); + GetFixed(idit, pdit, sizeof(DIT)); } void PutDit(long idit, DIT *pdit) { - PutFixed(idit, pdit); + PutFixed(idit, pdit, sizeof(DIT)); } void GetStn(long idit, PSTN pstn); diff --git a/kauai/SRC/GROUPS.CPP b/kauai/SRC/GROUPS.CPP index d20e04ec..496e11da 100644 --- a/kauai/SRC/GROUPS.CPP +++ b/kauai/SRC/GROUPS.CPP @@ -1373,37 +1373,41 @@ void *GGB::PvFixedLock(long iv, long *pcbVar) /*************************************************************************** Get the fixed sized data for the element. ***************************************************************************/ -void GGB::GetFixed(long iv, void *pv) +void GGB::GetFixed(long iv, void *pv, size_t sz) { AssertThis(0); AssertIn(_cbFixed, 1, kcbMax); AssertIn(iv, 0, _ivMac); Assert(!FFree(iv), "element free!"); AssertPvCb(pv, _cbFixed); + Assert(sz <= _cbFixed, "tried to get too many bytes"); LOC loc; loc = *_Qloc(iv); AssertIn(loc.cb, _cbFixed, _bvMac - loc.bv + 1); - CopyPb(_Qb1(loc.bv), pv, _cbFixed); + //CopyPb(_Qb1(loc.bv), pv, _cbFixed); + CopyPb(_Qb1(loc.bv), pv, sz); } /*************************************************************************** Put the fixed sized data for the element. ***************************************************************************/ -void GGB::PutFixed(long iv, void *pv) +void GGB::PutFixed(long iv, void *pv, size_t sz) { AssertThis(0); AssertIn(_cbFixed, 1, kcbMax); AssertIn(iv, 0, _ivMac); Assert(!FFree(iv), "element free!"); AssertPvCb(pv, _cbFixed); + Assert(sz <= _cbFixed, "tried to put too many bytes"); LOC loc; loc = *_Qloc(iv); AssertIn(loc.cb, _cbFixed, _bvMac - loc.bv + 1); - CopyPb(pv, _Qb1(loc.bv), _cbFixed); + //CopyPb(pv, _Qb1(loc.bv), _cbFixed); + CopyPb(pv, _Qb1(loc.bv), sz); AssertThis(0); } diff --git a/kauai/SRC/GROUPS.H b/kauai/SRC/GROUPS.H index edac66a0..a4d82550 100644 --- a/kauai/SRC/GROUPS.H +++ b/kauai/SRC/GROUPS.H @@ -289,8 +289,8 @@ class GGB : public GGB_PAR } void *QvFixedGet(long iv, long *pcbVar = pvNil); void *PvFixedLock(long iv, long *pcbVar = pvNil); - void GetFixed(long iv, void *pv); - void PutFixed(long iv, void *pv); + void GetFixed(long iv, void *pv, size_t sz); + void PutFixed(long iv, void *pv, size_t sz); // access to the variable portion long Cb(long iv); diff --git a/kauai/SRC/RTXT.CPP b/kauai/SRC/RTXT.CPP index 4388fa6d..c63c132f 100644 --- a/kauai/SRC/RTXT.CPP +++ b/kauai/SRC/RTXT.CPP @@ -1209,11 +1209,11 @@ bool TXRD::_FReadChunk(PCFL pcfl, CTG ctg, CNO cno, bool fCopyText) { if (_pagcact->FFree(icact)) continue; - _pagcact->GetFixed(icact, &cact); + _pagcact->GetFixed(icact, &cact, sizeof(cact)); if (bo == kboOther) { SwapBytesRglw(&cact, 1); - _pagcact->PutFixed(icact, &cact); + _pagcact->PutFixed(icact, &cact, sizeof(cact)); } if (!_FOpenArg(icact, B3Lw(cact), bo, osk)) return fFalse; @@ -1673,14 +1673,14 @@ bool TXRD::_FEnsureInAg(byte sprm, void *pv, long cb, long *pjv) continue; if (FEqualRgb(qv, pv, cb)) { - _pagcact->GetFixed(iv, &cact); + _pagcact->GetFixed(iv, &cact, sizeof(cact)); if (B3Lw(cact) == sprm) { *pjv = iv + 1; AssertIn(cact & 0x00FFFFFFL, 1, 0x00FFFFFFL); cact++; Assert(B3Lw(cact) == sprm, "cact overflowed"); - _pagcact->PutFixed(iv, &cact); + _pagcact->PutFixed(iv, &cact, sizeof(cact)); return fTrue; } } @@ -1711,14 +1711,14 @@ void TXRD::_ReleaseInAg(long jv) return; } - _pagcact->GetFixed(jv - 1, &cact); + _pagcact->GetFixed(jv - 1, &cact, sizeof(cact)); cactT = cact & 0x00FFFFFFL; if (--cactT <= 0) _pagcact->Delete(jv - 1); else { cact--; - _pagcact->PutFixed(jv - 1, &cact); + _pagcact->PutFixed(jv - 1, &cact, sizeof(cact)); } } @@ -1735,10 +1735,10 @@ void TXRD::_AddRefInAg(long jv) return; } - _pagcact->GetFixed(jv - 1, &cact); + _pagcact->GetFixed(jv - 1, &cact, sizeof(cact)); AssertIn(cact & 0x00FFFFFFL, 1, 0x00FFFFFFL); ++cact; - _pagcact->PutFixed(jv - 1, &cact); + _pagcact->PutFixed(jv - 1, &cact, sizeof(cact)); } /*************************************************************************** diff --git a/kauai/SRC/STREAM.CPP b/kauai/SRC/STREAM.CPP index c6766737..495c798e 100644 --- a/kauai/SRC/STREAM.CPP +++ b/kauai/SRC/STREAM.CPP @@ -245,7 +245,7 @@ BSF::~BSF(void) // release all our reference counts for (iflo = _pggflo->IvMac(); iflo-- > 0;) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); if (pvNil != flo.pfil) ReleasePpo(&flo.pfil); } @@ -271,7 +271,7 @@ long BSF::_IfloFind(long ib, long *pib, long *pcb) { for (cb = ib; iflo < _pggflo->IvMac(); iflo++) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); if (flo.cb > cb) { *pib = ib - cb; @@ -316,7 +316,7 @@ bool BSF::_FEnsureSplit(long ib, long *piflo) return fTrue; } - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); Assert(cbT == flo.cb, 0); cbT = ib - ibMin; @@ -340,7 +340,7 @@ bool BSF::_FEnsureSplit(long ib, long *piflo) flo.fp -= cbT; flo.pfil->AddRef(); } - _pggflo->PutFixed(iflo, &flo); + _pggflo->PutFixed(iflo, &flo, sizeof(flo)); if (pvNil != piflo) *piflo = iflo + 1; return fTrue; @@ -364,8 +364,8 @@ void BSF::_AttemptMerge(long ibMin, long ibLim) iflo = _IfloFind(LwMax(0, ibMin - 1), &ib); while (ib < ibLim && iflo < _pggflo->IvMac() - 1) { - _pggflo->GetFixed(iflo, &flo); - _pggflo->GetFixed(iflo + 1, &floT); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); + _pggflo->GetFixed(iflo + 1, &floT, sizeof(floT)); if (flo.pfil != floT.pfil || pvNil != flo.pfil && flo.fp + flo.cb != floT.fp) { // cant merge them, try the next @@ -384,7 +384,7 @@ void BSF::_AttemptMerge(long ibMin, long ibLim) AssertPo(flo.pfil, 0); } flo.cb += floT.cb; - _pggflo->PutFixed(iflo, &flo); + _pggflo->PutFixed(iflo, &flo, sizeof(flo)); } } @@ -450,7 +450,7 @@ bool BSF::FReplaceBsf(PBSF pbsfSrc, long ibSrc, long cbSrc, long ibDst, long cbD // adjust the usage counts on the file pieces for (iflo = ifloDst + ifloLimSrc - ifloMinWhole; iflo-- > ifloDst;) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); if (pvNil != flo.pfil) flo.pfil->AddRef(); } @@ -460,7 +460,7 @@ bool BSF::FReplaceBsf(PBSF pbsfSrc, long ibSrc, long cbSrc, long ibDst, long cbD if (ifloMinSrc < ifloMinWhole) { cbT = cbMinFlo - ibSrc + ibMinSrc; - pbsfSrc->_pggflo->GetFixed(ifloMinSrc, &flo); + pbsfSrc->_pggflo->GetFixed(ifloMinSrc, &flo, sizeof(flo)); if (pvNil == flo.pfil) { // a memory piece @@ -494,7 +494,7 @@ bool BSF::FReplaceBsf(PBSF pbsfSrc, long ibSrc, long cbSrc, long ibDst, long cbD fRet = FReplace(pvNil, 0, ibDst + cbIns, cbDel); else { - pbsfSrc->_pggflo->GetFixed(ifloLimSrc, &flo); + pbsfSrc->_pggflo->GetFixed(ifloLimSrc, &flo, sizeof(flo)); if (pvNil == flo.pfil) { // a memory piece @@ -559,7 +559,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) // if ib is in a file flo, split it if (ibT > 0) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); if (pvNil != flo.pfil) { if (!_FEnsureSplit(ib, &iflo)) @@ -578,14 +578,14 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) if (ibT > 0 && cbDel > 0) { // we need to start deleting in the middle of a piece - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); Assert(pvNil == flo.pfil, "why wasn't this flo split?"); if (ibT + cbDel < flo.cb) { // deleting just part of this piece and no others _pggflo->DeleteRgb(iflo, ibT, cbDel); flo.cb -= cbDel; - _pggflo->PutFixed(iflo, &flo); + _pggflo->PutFixed(iflo, &flo, sizeof(flo)); _ibMac -= cbDel; cbDel = 0; } @@ -595,7 +595,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) cbT = flo.cb - ibT; _pggflo->DeleteRgb(iflo, ibT, cbT); flo.cb = ibT; - _pggflo->PutFixed(iflo, &flo); + _pggflo->PutFixed(iflo, &flo, sizeof(flo)); _ibMac -= cbT; cbDel -= cbT; iflo++; @@ -607,7 +607,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) while (cbDel > 0 && iflo < _pggflo->IvMac()) { // deleting from the beginning of the flo - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); if (cbDel < flo.cb) { // just remove the first part @@ -618,7 +618,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) flo.cb -= cbDel; _ibMac -= cbDel; cbDel = 0; - _pggflo->PutFixed(iflo, &flo); + _pggflo->PutFixed(iflo, &flo, sizeof(flo)); } else { @@ -635,7 +635,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) { if (iflo < _pggflo->IvMac()) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); if (pvNil == flo.pfil) goto LInsertInMem; } @@ -643,7 +643,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) if (iflo > 0) { // see if the previous flow is a memory one - _pggflo->GetFixed(iflo - 1, &flo); + _pggflo->GetFixed(iflo - 1, &flo, sizeof(flo)); if (pvNil == flo.pfil) { iflo--; @@ -651,7 +651,7 @@ bool BSF::FReplace(void *prgb, long cbIns, long ib, long cbDel) LInsertInMem: AssertDo(_pggflo->FInsertRgb(iflo, ibT, cbIns, prgb), "this shouldn't fail!"); flo.cb += cbIns; - _pggflo->PutFixed(iflo, &flo); + _pggflo->PutFixed(iflo, &flo, sizeof(flo)); _ibMac += cbIns; goto LTryMerge; } @@ -753,7 +753,7 @@ void BSF::FetchRgb(long ib, long cb, void *prgb) ib -= ibMin; for (; cb > 0 && iflo < _pggflo->IvMac(); iflo++) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); Assert(flo.cb > ib, "_IfloFind messed up"); // get min(cb, flo.cb - ib) bytes from position ib @@ -823,7 +823,7 @@ bool BSF::FWriteRgb(PBLCK pblck, long ib) for (ibDst = 0; fRet && ibDst < cbWrite && iflo < _pggflo->IvMac(); iflo++) { Assert(pblck->Cb() == 0, 0); - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); Assert(flo.cb > ib, "_IfloFind messed up"); // write min(cbWrite, flo.cb - ib) bytes from position ib @@ -911,7 +911,7 @@ void BSF::AssertValid(ulong grfobj) for (cb = 0, iflo = _pggflo->IvMac(); iflo-- > 0;) { - _pggflo->GetFixed(iflo, &flo); + _pggflo->GetFixed(iflo, &flo, sizeof(flo)); cbT = _pggflo->Cb(iflo); if (pvNil == flo.pfil) Assert(cbT == flo.cb, "wrong sized entry"); diff --git a/kauai/TOOLS/CHELPEXP.CPP b/kauai/TOOLS/CHELPEXP.CPP index 0f705016..58f4518c 100644 --- a/kauai/TOOLS/CHELPEXP.CPP +++ b/kauai/TOOLS/CHELPEXP.CPP @@ -293,7 +293,7 @@ bool _FWriteHelpPropAg(PCFL pcfl, PCHSE pchse, KID *pkid, CKI *pckiPar) continue; } - pag->GetFixed(iv, &lw); + pag->GetFixed(iv, &lw, sizeof(long)); stn.FFormatSz(PszLit("\tITEM LONG 0x%x"), lw); pchse->DumpSz(stn.Psz()); diff --git a/kauai/TOOLS/CHGRP.CPP b/kauai/TOOLS/CHGRP.CPP index 09f26d50..6e082c6d 100644 --- a/kauai/TOOLS/CHGRP.CPP +++ b/kauai/TOOLS/CHGRP.CPP @@ -1446,7 +1446,7 @@ bool DOCI::_FWrite(long iv) else { Assert(cb == ((PGGB)_pgrpb)->CbFixed(), "bad cb in GG/AG"); - ((PGGB)_pgrpb)->PutFixed(iv, pv); + ((PGGB)_pgrpb)->PutFixed(iv, pv, cb); } break; case kclsGST: @@ -1532,7 +1532,7 @@ HQ DOCI::_HqRead(void) if (_dln == 0) ((PGGB)_pgrpb)->Get(_iv, pv); else - ((PGGB)_pgrpb)->GetFixed(_iv, pv); + ((PGGB)_pgrpb)->GetFixed(_iv, pv, cb); break; case kclsGST: case kclsAST: