summaryrefslogtreecommitdiff
path: root/gzip.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-05-12 19:52:42 -0400
committerJeffrey Walton <noloader@gmail.com>2017-05-12 19:52:42 -0400
commit78db20d9395f05a2b41774e103011eaca467e31a (patch)
treedff5188de33f3a475d4673a387886bcd00cc502e /gzip.h
parente3ae7000eaf92cf1cfa6f546ec1a0f6d84543f34 (diff)
downloadcryptopp-git-78db20d9395f05a2b41774e103011eaca467e31a.tar.gz
Add FileName, FileTime and Comment to argnames.h
Add self tests to verify handling of filenames, filetimes and comments
Diffstat (limited to 'gzip.h')
-rw-r--r--gzip.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/gzip.h b/gzip.h
index 271ff500..0c3f53df 100644
--- a/gzip.h
+++ b/gzip.h
@@ -27,13 +27,17 @@ public:
//! if a file has both compressible and uncompressible parts, it may fail to compress
//! some of the compressible parts.
Gzip(BufferedTransformation *attachment=NULLPTR, unsigned int deflateLevel=DEFAULT_DEFLATE_LEVEL, unsigned int log2WindowSize=DEFAULT_LOG2_WINDOW_SIZE, bool detectUncompressible=true)
- : Deflator(attachment, deflateLevel, log2WindowSize, detectUncompressible), m_totalLen(0) {}
+ : Deflator(attachment, deflateLevel, log2WindowSize, detectUncompressible), m_totalLen(0) { }
+
//! \brief Construct a Gzip compressor
//! \param parameters a set of NameValuePairs to initialize this object
//! \param attachment an attached transformation
//! \details Possible parameter names: Log2WindowSize, DeflateLevel, DetectUncompressible
Gzip(const NameValuePairs &parameters, BufferedTransformation *attachment=NULLPTR)
- : Deflator(parameters, attachment), m_totalLen(0) {}
+ : Deflator(parameters, attachment), m_totalLen(0)
+ {
+ IsolatedInitialize(parameters);
+ }
//! \param filetime the filetime to set in the header. The application is responsible for setting it.
void SetFiletime(word32 filetime) { m_filetime = filetime; }
@@ -52,6 +56,8 @@ public:
//! is thrown. If throwOnEncodingError is false then the comment is not checked.
void SetComment(const std::string& comment, bool throwOnEncodingError = false);
+ void IsolatedInitialize(const NameValuePairs &parameters);
+
protected:
enum {MAGIC1=0x1f, MAGIC2=0x8b, // flags for the header
DEFLATED=8, FAST=4, SLOW=2};