int TItemList::Reduce(int length) { int remain = length; while(remain > 0 && Size() > 0) { TItem* pItem = Front(); remain -= pItem->Reduce(remain); if(pItem->IsEmpty()) itPool.PutFreeItem(PopFront()); } return length - remain; }
int TItemList::Fetch(BYTE* pData, int length) { int remain = length; while(remain > 0 && Size() > 0) { TItem* pItem = Front(); int fetch = pItem->Fetch(pData, remain); pData += fetch; remain -= fetch; if(pItem->IsEmpty()) itPool.PutFreeItem(PopFront()); } return length - remain; }