Exemplo n.º 1
0
OniStatus Recorder::detachAllStreams()
{
    xnl::LockGuard<AttachedStreams> guard(m_streams);
    for (AttachedStreams::Iterator 
                i = m_streams.Begin(),
                e = m_streams.End();
         i != e; ++i)
    {
        detachStream(*i->Key());
    }
    return ONI_STATUS_OK;
}
//--------------------------------------
bool ZipSubRStream::setPosition(const U32 in_newPosition)
{
   AssertFatal(m_pStream != NULL, "Error, not attached");

   if (in_newPosition == 0)
   {
      Stream* pStream = getStream();
      U32 resetPosition = m_originalSlavePosition;
      U32 uncompressedSize = m_uncompressedSize;
      detachStream();
      pStream->setPosition(resetPosition);
      attachStream(pStream);
      setUncompressedSize(uncompressedSize);
      return true;
   }
   else
   {
      if (in_newPosition > m_uncompressedSize)
         return false;

      U32 newPosition = in_newPosition;
      if (newPosition < m_currentPosition)
      {
         Stream* pStream = getStream();
         U32 resetPosition = m_originalSlavePosition;
         U32 uncompressedSize = m_uncompressedSize;
         detachStream();
         pStream->setPosition(resetPosition);
         attachStream(pStream);
         setUncompressedSize(uncompressedSize);
      }
      else
      {
         newPosition -= m_currentPosition;
      }

      bool bRet = true;
      char *buffer = new char[2048];
      while (newPosition >= 2048)
      {
         newPosition -= 2048;
         if (!_read(2048,buffer))
         {
            bRet = false;
            break;
         }
      };
      if (bRet && newPosition > 0)
      {
         if (!_read(newPosition,buffer))
         {
            bRet = false;
         };
      };

      delete [] buffer;

      return bRet;

   }
}
//--------------------------------------
ZipSubWStream::~ZipSubWStream()
{
   detachStream();
}
Exemplo n.º 4
0
ResizeFilterStream::~ResizeFilterStream()
{
   detachStream();
}