(
char*
buffer,
size_tbufferLength);
91 size_tx_Read(
char*
buffer,
size_tbufferLength);
94kMax_UncomprSize = 1024*1024,
95kMax_ComprSize = 1024*1024
112: m_Src(src), m_BufferPos(0), m_BufferEnd(0)
127 while( buffer_length > 0 ) {
133buffer_length -=
cnt;
145 if(
x_Read(header, 8) != 8 ) {
147 "Too few header bytes");
149 size_tcompr_size = 0;
150 for(
size_t i= 0;
i< 4; ++
i) {
151compr_size = (compr_size<<8) | (
unsigned char)header[
i];
153 size_tuncompr_size = 0;
154 for(
size_t i= 4;
i< 8; ++
i) {
155uncompr_size = (uncompr_size<<8) | (
unsigned char)header[
i];
160 "Compressed size is too large");
164 "Uncompressed size is too large");
168 "Compressed data is not complete");
177 "Decompression failed");
202: m_Src(src), m_Type(eType_unknown)
223 "Too small buffer to determine compression type");
225 const char* header =
buffer;
226 size_tgot_already = 0;
232buffer_length -=
cnt;
233 if(
cnt== 0 || memcmp(header,
"ZIP", got_already) != 0 ) {
236 _TRACE(
"CNlmZipBtRdr: non-ZIP: "<< got_already);
270: m_Reader(reader), m_Own(own), m_Header(header),
271m_BufferPos(0), m_BufferEnd(0)
341*bytes_read =
count;
350 const char* header =
buffer;
351 size_theader_read = 0;
361header_read += cur_cnt;
362 if( memcmp(header,
"ZIP", header_read) != 0 ) {
380 "No 'ZIP' header in NLMZIP stream");
395 static const size_tkLengthsLength = 8;
396 static const size_tkMax_UncomprSize = 1024*1024;
397 static const size_tkMax_ComprSize = 1024*1024;
399 charheader[kLengthsLength];
408 size_tcompr_size = 0;
409 for(
size_t i= 0;
i< 4; ++
i) {
410compr_size = (compr_size<<8) | (
unsigned char)header[
i];
412 size_tuncompr_size = 0;
413 for(
size_t i= 4;
i< 8; ++
i) {
414uncompr_size = (uncompr_size<<8) | (
unsigned char)header[
i];
417 if( compr_size > kMax_ComprSize ) {
420 if( uncompr_size > kMax_UncomprSize ) {
424compr_size, &bytes) !=
eRW_Success|| bytes != compr_size ) {
CZipCompression m_Decompressor
size_t Read(char *buffer, size_t bufferLength)
size_t x_Read(char *buffer, size_t bufferLength)
const CResultZBtSrcX & operator=(const CResultZBtSrcX &)
CDynamicCharArray m_Buffer
CResultZBtSrcX(CByteSourceReader *reader)
CResultZBtSrcX(const CResultZBtSrcX &)
CRef< CByteSourceReader > m_Src
CDynamicCharArray m_Compressed
A very basic data-read interface.
virtual ERW_Result PendingCount(size_t *count)
Via parameter "count" (which is guaranteed to be supplied non-NULL) return the number of bytes that a...
void x_StartDecompressor(void)
CRef< CByteSourceReader > m_Src
ERW_Result x_DecompressBuffer(void)
size_t x_ReadZipHeader(char *buffer)
virtual void SetFlags(TFlags flags)
virtual TFlags GetFlags(void) const
Get/set flags.
unique_ptr< CZipCompression > m_Decompressor
CDynamicCharArray m_Compressed
CNlmZipBtRdr(CByteSourceReader *src)
unique_ptr< CResultZBtSrcX > m_Decompressor
char * At(size_t pos) const
virtual size_t Read(char *buffer, size_t bufferLength)
Read up to bufferLength bytes into buffer return amount of bytes read (if zero - see EndOfData())
CDynamicCharArray m_Buffer
CNlmZipReader(IReader *reader, TOwnership own=fOwnNone, EHeader header=eHeaderCheck)
char * Alloc(size_t size)
ERW_Result x_Read(char *buffer, size_t count, size_t *bytes_read)
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read=0)
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
virtual bool Pushback(const char *data, size_t size)
virtual bool DecompressBuffer(const void *src_buf, size_t src_len, void *dst_buf, size_t dst_size, size_t *dst_len)
Decompress data in the buffer.
@ fCheckFileHeader
Check (and skip) gzip file header on decompression stage.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Read(CObjectIStream &in, TObjectPtr object, const CTypeRef &type)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual size_t Read(char *buffer, size_t bufferLength)=0
Read up to bufferLength bytes into buffer return amount of bytes read (if zero - see EndOfData())
virtual bool Pushback(const char *data, size_t size)
ERW_Result
Result codes for I/O operations.
virtual ERW_Result Read(void *buf, size_t count, size_t *bytes_read=0)=0
Read as many as "count" bytes into a buffer pointed to by the "buf" argument.
@ eRW_Eof
End of data, should be considered permanent.
@ eRW_Error
Unrecoverable error, no retry possible.
@ eRW_Success
Everything is okay, I/O completed.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines: CTimeFormat - storage class for time format.
NCBI_XUTIL_EXPORT
Parameter to control printing diagnostic message about conversion of static array data from a differe...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4