diff options
author | Jeffrey Walton <noloader@gmail.com> | 2017-05-12 16:51:03 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2017-05-12 16:51:03 -0400 |
commit | cfa339535bdf15054cf9fee7861f963630b0213e (patch) | |
tree | 91f08c0055a95b4a8fd423f8e8f69bc6acad000e | |
parent | 591b13934336a73edcc429f27d340a5fb91d51c6 (diff) | |
download | cryptopp-git-cfa339535bdf15054cf9fee7861f963630b0213e.tar.gz |
Revert "Write MTIME in big-endian order"
This reverts commit 591b13934336. RFC 1952 states the bytes are written in little-endian order, not big-endian. That includes MTIME.
-rw-r--r-- | gzip.cpp | 4 | ||||
-rw-r--r-- | gzip.h | 12 |
2 files changed, 8 insertions, 8 deletions
@@ -26,7 +26,7 @@ void Gzip::WritePrestreamHeader() AttachedTransformation()->Put(MAGIC2);
AttachedTransformation()->Put(DEFLATED);
AttachedTransformation()->Put((byte)flags); // general flag
- AttachedTransformation()->PutWord32(m_filetime, BIG_ENDIAN_ORDER); // time stamp
+ AttachedTransformation()->PutWord32(m_filetime, LITTLE_ENDIAN_ORDER); // time stamp
byte extra = (GetDeflateLevel() == 1) ? FAST : ((GetDeflateLevel() == 9) ? SLOW : 0);
AttachedTransformation()->Put(extra);
AttachedTransformation()->Put(GZIP_OS_CODE);
@@ -51,7 +51,7 @@ void Gzip::WritePoststreamTail() SecByteBlock crc(4);
m_crc.Final(crc);
AttachedTransformation()->Put(crc, 4);
- AttachedTransformation()->PutWord32(m_totalLen, BIG_ENDIAN_ORDER);
+ AttachedTransformation()->PutWord32(m_totalLen, LITTLE_ENDIAN_ORDER);
m_filetime = 0;
m_filename.clear();
@@ -37,14 +37,14 @@ public: //! \param filetime the filetime to set in the header. The application is responsible for setting it.
void SetFiletime(word32 filetime) { m_filetime = filetime; }
-
+
//! \param filename the original filename to set in the header. The application is responsible for setting it.
//! RFC 1952 requires a ISO/IEC 8859-1 encoding.
//! \param throwOnEncodingError if throwOnEncodingError is true, then the filename is checked to ensure it is
//! ISO/IEC 8859-1 encoded. If the filename does not adhere to ISO/IEC 8859-1, then a InvalidDataFormat
//! is thrown. If throwOnEncodingError is false then the filename is not checked.
void SetFilename(const std::string& filename, bool throwOnEncodingError = false);
-
+
//! \param comment the comment to set in the header. The application is responsible for setting it.
//! RFC 1952 requires a ISO/IEC 8859-1 encoding.
//! \param throwOnEncodingError if throwOnEncodingError is true, then the comment is checked to ensure it is
@@ -55,7 +55,7 @@ public: protected:
enum {MAGIC1=0x1f, MAGIC2=0x8b, // flags for the header
DEFLATED=8, FAST=4, SLOW=2};
-
+
enum FLAG_MASKS {
FILENAME=8, COMMENTS=16};
@@ -65,7 +65,7 @@ protected: word32 m_totalLen;
CRC32 m_crc;
-
+
word32 m_filetime;
std::string m_filename;
std::string m_comment;
@@ -99,13 +99,13 @@ public: //! \return the filetime of the stream as set in the header. The application is responsible for setting it on the decompressed file.
word32 GetFiletime() const { return m_filetime; }
-
+
//! \return the filename of the stream as set in the header. The application is responsible for setting it on the decompressed file.
//! \param throwOnEncodingError if throwOnEncodingError is true, then the filename is checked to ensure it is
//! ISO/IEC 8859-1 encoded. If the filename does not adhere to ISO/IEC 8859-1, then a InvalidDataFormat is thrown.
//! If throwOnEncodingError is false then the filename is not checked.
const std::string& GetFilename(bool throwOnEncodingError = false) const;
-
+
//! \return the comment of the stream as set in the header.
//! \param throwOnEncodingError if throwOnEncodingError is true, then the comment is checked to ensure it is
//! ISO/IEC 8859-1 encoded. If the comment does not adhere to ISO/IEC 8859-1, then a InvalidDataFormat is thrown.
|