bool nsImportScanFile::FillBufferFromFile(void)
{
  uint64_t available;
  nsresult rv = m_pInputStream->Available(&available);
  if (NS_FAILED(rv))
    return false;

  // Fill up a buffer and scan it
  ShiftBuffer();

  // Read in some more bytes
  uint32_t  cnt = m_bufSz - m_bytesInBuf;
  // To distinguish from disk errors
  // Check first for end of file?
  // Set a done flag if true...
  uint32_t read;
  char *pBuf = (char *)m_pBuf;
  pBuf += m_bytesInBuf;
  rv = m_pInputStream->Read(pBuf, (int32_t) cnt, &read);

  if (NS_FAILED(rv))
    return false;
  rv = m_pInputStream->Available(&available);
  if (NS_FAILED(rv))
          m_eof = true;

  m_bytesInBuf += cnt;
  return true;
}
PRBool nsImportScanFile::FillBufferFromFile( void)
{
  PRUint32 available;
  nsresult rv = m_pInputStream->Available( &available);
  if (NS_FAILED(rv))
    return( PR_FALSE);

  // Fill up a buffer and scan it
  ShiftBuffer();

  // Read in some more bytes
  PRUint32  cnt = m_bufSz - m_bytesInBuf;
  // To distinguish from disk errors
  // Check first for end of file?
  // Set a done flag if true...
  PRUint32 read;
  char *pBuf = (char *)m_pBuf;
  pBuf += m_bytesInBuf;
  rv = m_pInputStream->Read(pBuf, (PRInt32) cnt, &read);

  if (NS_FAILED( rv))
    return( PR_FALSE);
  rv = m_pInputStream->Available( &available);
  if (NS_FAILED(rv))
          m_eof = PR_TRUE;

  m_bytesInBuf += cnt;
  return( PR_TRUE);
}
Exemple #3
0
int HashBuffer(unsigned char*Dest,int Param10,unsigned char*Src,int Param18,int Param1c)
{
	int BuffLen=((Param1c+Param18-1)>>3)-(Param18>>3)+2;
	unsigned char *Temp=new unsigned char[BuffLen];
	Temp[BuffLen-1]=0;
	memcpy(Temp,Src+(Param18>>3),BuffLen-1);
	int EAX=(Param1c+Param18)&7;
	if(EAX)
		Temp[BuffLen-2]&=(0xff)<<(8-EAX);
	int ESI = Param18&7;
    int EDI=Param10&7;
	ShiftBuffer(Temp,BuffLen-1,-ESI);
	ShiftBuffer(Temp,BuffLen,EDI);
    unsigned char*TempPtr =(Param10>>3)+Dest;
	int LoopCount=BuffLen-1+(EDI>ESI);
	if(LoopCount)
		for(int i=0;i<LoopCount;i++)
			TempPtr[i] = TempPtr[i]|(Temp[i]);
	delete[] Temp;
	return Param10 + Param1c;
}