Gunzip: added GetFilename() and GetComment() methods
parent
3f9667f3cd
commit
3d8e3683db
16
gzip.cpp
16
gzip.cpp
|
|
@ -63,15 +63,19 @@ void Gunzip::ProcessPrestreamHeader()
|
||||||
if (m_inQueue.Skip(length)!=length) throw HeaderErr();
|
if (m_inQueue.Skip(length)!=length) throw HeaderErr();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & FILENAME) // skip filename
|
m_filename.clear();
|
||||||
do
|
if (flags & FILENAME) // read filename
|
||||||
|
do {
|
||||||
if(!m_inQueue.Get(b)) throw HeaderErr();
|
if(!m_inQueue.Get(b)) throw HeaderErr();
|
||||||
while (b);
|
if (b) m_filename += char(b);
|
||||||
|
} while (b);
|
||||||
|
|
||||||
if (flags & COMMENTS) // skip comments
|
m_comment.clear();
|
||||||
do
|
if (flags & COMMENTS) // read comments
|
||||||
|
do {
|
||||||
if(!m_inQueue.Get(b)) throw HeaderErr();
|
if(!m_inQueue.Get(b)) throw HeaderErr();
|
||||||
while (b);
|
if (b) m_comment += char(b);
|
||||||
|
} while (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gunzip::ProcessDecompressedData(const byte *inString, size_t length)
|
void Gunzip::ProcessDecompressedData(const byte *inString, size_t length)
|
||||||
|
|
|
||||||
5
gzip.h
5
gzip.h
|
|
@ -73,6 +73,9 @@ public:
|
||||||
//! \param autoSignalPropagation 0 to turn off MessageEnd signal
|
//! \param autoSignalPropagation 0 to turn off MessageEnd signal
|
||||||
Gunzip(BufferedTransformation *attachment = NULLPTR, bool repeat = false, int autoSignalPropagation = -1);
|
Gunzip(BufferedTransformation *attachment = NULLPTR, bool repeat = false, int autoSignalPropagation = -1);
|
||||||
|
|
||||||
|
const std::string& GetFilename() const { return m_filename; }
|
||||||
|
const std::string& GetComment() const { return m_comment; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
enum {
|
enum {
|
||||||
//! \brief First header magic value
|
//! \brief First header magic value
|
||||||
|
|
@ -94,6 +97,8 @@ protected:
|
||||||
|
|
||||||
word32 m_length;
|
word32 m_length;
|
||||||
CRC32 m_crc;
|
CRC32 m_crc;
|
||||||
|
std::string m_filename;
|
||||||
|
std::string m_comment;
|
||||||
};
|
};
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue