void VMObject::WalkObjects(walk_heap_fn walk) { clazz = static_cast<GCClass*>(walk(clazz)); long numFields = GetNumberOfFields(); for (long i = 0; i < numFields; ++i) { # warning not sure whether the use of _store_ptr is correct and robust here FIELDS[i] = walk(_store_ptr(GetField(i))); } }
/*** PUBLIC Metodo GetAllFieldSlots Retorna os slots de todos os campos Parameters: - pTicket -> ticket de seguranca Return: - ponteiro para uma estrutura Comments: - ***/ TSlotCache * LBSC_Base::GetAllFieldSlots( const LBSC_Ticket *pTicket ) { PRINTLOG( _clLBSLog, ("LBSC_Base::GetAllFieldSlots") ); CLBAutoRegCrit AutoRegCrit(&rcRegCrit); if( bBaseObjOk == FALSE ){ NRETURN( LBSE_OBJNOTOK ); } if( plbscsOwnerSession->TicketIsOk( pTicket ) != 0 ){ NRETURN( LBSE_TICKETNOTOK ); } TSlotCache *ptscRet = new TSlotCache; if( !ptscRet ){ NRETURN( LBSE_NOMEMORY ); } ptscRet->iNumberOfFieldSlots = GetNumberOfFields(); ptscRet->pSlots = new TSlotCacheInfo[ ptscRet->iNumberOfFieldSlots ]; if( !ptscRet->pSlots ){ delete ptscRet; NRETURN( LBSE_NOMEMORY ); } for( int i = 0; i < ptscRet->iNumberOfFieldSlots; i++ ){ // pra evitar a carga de todos os dados do registro so porque estamos querendo obter a estrutura BOOL bAux = lbscrCurrRecord.bMustLoadData; lbscrCurrRecord.bMustLoadData = FALSE; LBSC_Field *pfField = lbscrCurrRecord[ i ]; // reabilita a carga dos dados dos campos lbscrCurrRecord.bMustLoadData = bAux; if( !pfField ){ // deu pau delete ptscRet; NRETURN( LBSE_ERROR ); } ptscRet->pSlots[ i ].uiId = pfField->GetId(); ptscRet->pSlots[ i ].iSize = pfField->lSlotSize; if( ptscRet->pSlots[ i ].iSize < 0 ){ if( ptscRet->pSlots[ i ].iSize == LBSE_EMPTYSLOT ){ ptscRet->pSlots[ i ].pBuff = NULL; } else { delete ptscRet; return( NULL ); } } else { ptscRet->pSlots[ i ].pBuff = new char[ ptscRet->pSlots[ i ].iSize ]; if( !ptscRet->pSlots[ i ].pBuff ){ delete ptscRet; NRETURN( LBSE_NOMEMORY ); } memcpy( ptscRet->pSlots[ i ].pBuff, pfField->pvSlot, pfField->lSlotSize ); } } SetError( LBS_OK ); return( ptscRet ); }