Пример #1
0
void VFSFile::dropBuf(bool del)
{
    VFS_GUARD_OPT(this);
    if(del)
        delBuf(_buf);
    _buf = NULL;
}
Пример #2
0
void VFSFileZip::dropBuf(bool del)
{
    VFSFile::dropBuf(del);

    VFS_GUARD_OPT(this);
    if(del)
        delBuf(_fixedStr);
    _fixedStr = NULL;

}
Пример #3
0
//non-POSIX version
//Nastavuje, se kterym odkladacim buferem se bude pracovat...
//-----------------------------------------------------------
int ie_swap(int newswap) //nastavi ten spravny bufer do pameti...
{
 int rc;
 unsigned i;

 if(swapnum==newswap) return 1;

 if(swap2 && newswap>=0) //we are trying to optimize access to virtual memory now:
 {
  if(newswap==which1 && swapstr==swap2)            // go from 2 to 1
  {
   mod2=swapmod;
   swapstr=swap1;
   swapidx=(unsigned *)swap1;
   swapnum=which1;
   swapmod=mod1;
   return 1;
  }

  if(newswap==which2 && swapstr==swap1)       // go from 1 to 2
  {
   mod1=swapmod;
   swapstr=swap2;
   swapidx=(unsigned *)swap2;
   swapnum=which2;
   swapmod=mod2;
   return 1;
  }

  //!!JdS: 2004/1/5 {Revised the conditional expression for optimization ...}
  if(swapstr==swap2 && (swapoptimize || swapcontext[newswap]>=swapcontext[which2]
       && swapcontext[which1]>=swapcontext[which2]) ) //2 to 1
//if(swapstr==swap2 && (swapoptimize || swapcontext[newswap]<=swapcontext[which1] &&
//   swapcontext[newswap]<=swapcontext[which1]) ) //2 to 1
  {
   mod2=swapmod;
   swapstr=swap1;
   swapidx=(unsigned *)swap1;
   swapnum=which1;
   swapmod=mod1;
  }
  else
  //!!JdS: 2004/1/5 {Revised the conditional expression for optimization ...}
  if(swapstr==swap1 && (swapoptimize || swapcontext[newswap]>=swapcontext[which1]
       && swapcontext[which2]>=swapcontext[which1] || which2==-1)) //1 to 2
//if(swapstr==swap1 && (swapoptimize ||swapcontext[newswap]<=swapcontext[which2] &&
//   swapcontext[newswap]<=swapcontext[which2] || which2==-1)) //1 to 2
  {
   mod1=swapmod;
   swapstr=swap2;
   swapidx=(unsigned *)swap2;
   swapnum=which2;
   swapmod=mod2;
  }
 } //----------------------------------------------------------------------

 if(swapmod && swapnum>=0)   // byl akt.buffer modifikovan?
 {
  //vymazat pripadne stary swap:
  if(swapbufflag[swapnum])
  {
   delBuf(&swapbuf[swapnum]);
   swapbufflag[swapnum]=0;
  }

  //do prvnich 2048 bytu ulozim pole swapidx
  //!memcpy(swapstr,swapidx,2048);

  //do handleru swapf[swapnym] ulozit bufer swapstr
  rc=saveBuf(swapstr,(unsigned)((IE_SWAPSTART+swapsize[swapnum])),&swapbuf[swapnum]);
//  printf("swapnum=%d, ulozeno %u bajtu, rc=%d",newswap,(unsigned)(IE_SWAPSTART+swapsize[swapnum]),rc);
  if(rc!=1) return 2;
  swapbufflag[swapnum]=1;
  swapmod=0;
  swapsavecount++;
 }//endif

 if(newswap==-1) return 1;

 //nacteni noveho akt.bufferu:
 i=IE_MAXSWAPLEN+IE_SWAPSTART; //!!! tady byla tezka chyba
 if(swapbufflag[newswap])
 {
  rc=fromBuf(swapstr,0,&i,&swapbuf[newswap]);
  if(rc!=1) return 2;
 }
 else
 {
  while(i>0)
  {
   i--;
   swapstr[i]='\0';
  }//loop
 }//endif
 swapnum=newswap;
 if(swap2==swapstr)
 {
  which2=swapnum;
  mod2=0;
 }
 else
 {
  which1=swapnum;
  mod1=0;
 }

 swaploadcount++;
 return 1;
}