CMS 3D CMS Logo

Functions

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/GeneratorInterface/ReggeGribovPartonMCInterface/src/7zStream.cc File Reference

#include <string.h>
#include "Types.h"

Go to the source code of this file.

Functions

SRes LookInStream_LookRead (ILookInStream *stream, void *buf, size_t *size)
SRes LookInStream_Read (ILookInStream *stream, void *buf, size_t size)
SRes LookInStream_Read2 (ILookInStream *stream, void *buf, size_t size, SRes errorType)
SRes LookInStream_SeekTo (ILookInStream *stream, UInt64 offset)
void LookToRead_CreateVTable (CLookToRead *p, int lookahead)
void LookToRead_Init (CLookToRead *p)
static SRes LookToRead_Look_Exact (void *pp, const void **buf, size_t *size)
static SRes LookToRead_Look_Lookahead (void *pp, const void **buf, size_t *size)
static SRes LookToRead_Read (void *pp, void *buf, size_t *size)
static SRes LookToRead_Seek (void *pp, Int64 *pos, ESzSeek origin)
static SRes LookToRead_Skip (void *pp, size_t offset)
void SecToLook_CreateVTable (CSecToLook *p)
static SRes SecToLook_Read (void *pp, void *buf, size_t *size)
void SecToRead_CreateVTable (CSecToRead *p)
static SRes SecToRead_Read (void *pp, void *buf, size_t *size)
SRes SeqInStream_Read (ISeqInStream *stream, void *buf, size_t size)
SRes SeqInStream_Read2 (ISeqInStream *stream, void *buf, size_t size, SRes errorType)
SRes SeqInStream_ReadByte (ISeqInStream *stream, Byte *buf)

Function Documentation

SRes LookInStream_LookRead ( ILookInStream stream,
void *  buf,
size_t *  size 
)

Definition at line 40 of file 7zStream.cc.

References ILookInStream::Look, RINOK, ILookInStream::Skip, and SZ_OK.

Referenced by SecToLook_Read().

{
  const void *lookBuf;
  if (*size == 0)
    return SZ_OK;
  RINOK(stream->Look(stream, &lookBuf, size));
  memcpy(buf, lookBuf, *size);
  return stream->Skip(stream, *size);
}
SRes LookInStream_Read ( ILookInStream stream,
void *  buf,
size_t  size 
)

Definition at line 64 of file 7zStream.cc.

References LookInStream_Read2(), and SZ_ERROR_INPUT_EOF.

{
  return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
}
SRes LookInStream_Read2 ( ILookInStream stream,
void *  buf,
size_t  size,
SRes  errorType 
)

Definition at line 50 of file 7zStream.cc.

References ILookInStream::Read, RINOK, findQualityFiles::size, and SZ_OK.

Referenced by LookInStream_Read().

{
  while (size != 0)
  {
    size_t processed = size;
    RINOK(stream->Read(stream, buf, &processed));
    if (processed == 0)
      return errorType;
    buf = (void *)((Byte *)buf + processed);
    size -= processed;
  }
  return SZ_OK;
}
SRes LookInStream_SeekTo ( ILookInStream stream,
UInt64  offset 
)

Definition at line 34 of file 7zStream.cc.

References evf::evtn::offset(), ILookInStream::Seek, SZ_SEEK_SET, and lumiQTWidget::t.

{
  Int64 t = offset;
  return stream->Seek(stream, &t, SZ_SEEK_SET);
}
void LookToRead_CreateVTable ( CLookToRead p,
int  lookahead 
)
void LookToRead_Init ( CLookToRead p)

Definition at line 144 of file 7zStream.cc.

References CLookToRead::pos, and CLookToRead::size.

{
  p->pos = p->size = 0;
}
static SRes LookToRead_Look_Exact ( void *  pp,
const void **  buf,
size_t *  size 
) [static]

Definition at line 87 of file 7zStream.cc.

References CLookToRead::buf, LookToRead_BUF_SIZE, AlCaHLTBitMon_ParallelJobs::p, CLookToRead::pos, ISeekInStream::Read, CLookToRead::realStream, CLookToRead::size, findQualityFiles::size, and SZ_OK.

Referenced by LookToRead_CreateVTable().

{
  SRes res = SZ_OK;
  CLookToRead *p = (CLookToRead *)pp;
  size_t size2 = p->size - p->pos;
  if (size2 == 0 && *size > 0)
  {
    p->pos = 0;
    if (*size > LookToRead_BUF_SIZE)
      *size = LookToRead_BUF_SIZE;
    res = p->realStream->Read(p->realStream, p->buf, size);
    size2 = p->size = *size;
  }
  if (size2 < *size)
    *size = size2;
  *buf = p->buf + p->pos;
  return res;
}
static SRes LookToRead_Look_Lookahead ( void *  pp,
const void **  buf,
size_t *  size 
) [static]

Definition at line 69 of file 7zStream.cc.

References CLookToRead::buf, LookToRead_BUF_SIZE, AlCaHLTBitMon_ParallelJobs::p, CLookToRead::pos, ISeekInStream::Read, CLookToRead::realStream, CLookToRead::size, and SZ_OK.

Referenced by LookToRead_CreateVTable().

{
  SRes res = SZ_OK;
  CLookToRead *p = (CLookToRead *)pp;
  size_t size2 = p->size - p->pos;
  if (size2 == 0 && *size > 0)
  {
    p->pos = 0;
    size2 = LookToRead_BUF_SIZE;
    res = p->realStream->Read(p->realStream, p->buf, &size2);
    p->size = size2;
  }
  if (size2 < *size)
    *size = size2;
  *buf = p->buf + p->pos;
  return res;
}
static SRes LookToRead_Read ( void *  pp,
void *  buf,
size_t *  size 
) [static]

Definition at line 113 of file 7zStream.cc.

References CLookToRead::buf, AlCaHLTBitMon_ParallelJobs::p, CLookToRead::pos, ISeekInStream::Read, CLookToRead::realStream, CLookToRead::size, findQualityFiles::size, and SZ_OK.

Referenced by LookToRead_CreateVTable().

{
  CLookToRead *p = (CLookToRead *)pp;
  size_t rem = p->size - p->pos;
  if (rem == 0)
    return p->realStream->Read(p->realStream, buf, size);
  if (rem > *size)
    rem = *size;
  memcpy(buf, p->buf + p->pos, rem);
  p->pos += rem;
  *size = rem;
  return SZ_OK;
}
static SRes LookToRead_Seek ( void *  pp,
Int64 pos,
ESzSeek  origin 
) [static]
static SRes LookToRead_Skip ( void *  pp,
size_t  offset 
) [static]

Definition at line 106 of file 7zStream.cc.

References evf::evtn::offset(), AlCaHLTBitMon_ParallelJobs::p, CLookToRead::pos, and SZ_OK.

Referenced by LookToRead_CreateVTable().

{
  CLookToRead *p = (CLookToRead *)pp;
  p->pos += offset;
  return SZ_OK;
}
void SecToLook_CreateVTable ( CSecToLook p)

Definition at line 155 of file 7zStream.cc.

References ISeqInStream::Read, CSecToLook::s, and SecToLook_Read().

{
  p->s.Read = SecToLook_Read;
}
static SRes SecToLook_Read ( void *  pp,
void *  buf,
size_t *  size 
) [static]
void SecToRead_CreateVTable ( CSecToRead p)

Definition at line 166 of file 7zStream.cc.

References ISeqInStream::Read, CSecToRead::s, and SecToRead_Read().

{
  p->s.Read = SecToRead_Read;
}
static SRes SecToRead_Read ( void *  pp,
void *  buf,
size_t *  size 
) [static]

Definition at line 160 of file 7zStream.cc.

References AlCaHLTBitMon_ParallelJobs::p, ILookInStream::Read, and CSecToRead::realStream.

Referenced by SecToRead_CreateVTable().

{
  CSecToRead *p = (CSecToRead *)pp;
  return p->realStream->Read(p->realStream, buf, size);
}
SRes SeqInStream_Read ( ISeqInStream stream,
void *  buf,
size_t  size 
)

Definition at line 22 of file 7zStream.cc.

References SeqInStream_Read2(), and SZ_ERROR_INPUT_EOF.

Referenced by LzmaFile::Open().

{
  return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
}
SRes SeqInStream_Read2 ( ISeqInStream stream,
void *  buf,
size_t  size,
SRes  errorType 
)

Definition at line 8 of file 7zStream.cc.

References ISeqInStream::Read, RINOK, findQualityFiles::size, and SZ_OK.

Referenced by SeqInStream_Read().

{
  while (size != 0)
  {
    size_t processed = size;
    RINOK(stream->Read(stream, buf, &processed));
    if (processed == 0)
      return errorType;
    buf = (void *)((Byte *)buf + processed);
    size -= processed;
  }
  return SZ_OK;
}
SRes SeqInStream_ReadByte ( ISeqInStream stream,
Byte buf 
)

Definition at line 27 of file 7zStream.cc.

References ISeqInStream::Read, RINOK, SZ_ERROR_INPUT_EOF, and SZ_OK.

{
  size_t processed = 1;
  RINOK(stream->Read(stream, buf, &processed));
  return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
}