summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2018-07-31 11:51:23 -0700
committerThiago Macieira <thiago.macieira@intel.com>2018-08-03 20:26:52 +0000
commitd8d0325394d9e5601260fea0433a8b67fd7e6cb8 (patch)
tree7ef265d8480c419e81fe1c46f6ea2a325c3047b1 /src/gui/text
parent9bb27ca6cc76a848d9c4a1d7757abf5ffc3943e6 (diff)
Remove member function from CentralFileHeader
I could have placed the class in an unnamed namespace. That would mark the member function as a local symbol too. But I preferred to move outside so I could make it static. Change-Id: Ie01831ddac5446fdbdeefffd154688c0883ed653 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qzip.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index b68c36fd9e..fc7fbcac12 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -391,7 +391,6 @@ struct CentralFileHeader
uchar internal_file_attributes[2];
uchar external_file_attributes[4];
uchar offset_local_header[4];
- LocalFileHeader toLocalHeader() const;
};
Q_DECLARE_TYPEINFO(CentralFileHeader, Q_PRIMITIVE_TYPE);
@@ -541,19 +540,19 @@ public:
void addEntry(EntryType type, const QString &fileName, const QByteArray &contents);
};
-LocalFileHeader CentralFileHeader::toLocalHeader() const
+static LocalFileHeader toLocalHeader(const CentralFileHeader &ch)
{
LocalFileHeader h;
writeUInt(h.signature, 0x04034b50);
- copyUShort(h.version_needed, version_needed);
- copyUShort(h.general_purpose_bits, general_purpose_bits);
- copyUShort(h.compression_method, compression_method);
- copyUInt(h.last_mod_file, last_mod_file);
- copyUInt(h.crc_32, crc_32);
- copyUInt(h.compressed_size, compressed_size);
- copyUInt(h.uncompressed_size, uncompressed_size);
- copyUShort(h.file_name_length, file_name_length);
- copyUShort(h.extra_field_length, extra_field_length);
+ copyUShort(h.version_needed, ch.version_needed);
+ copyUShort(h.general_purpose_bits, ch.general_purpose_bits);
+ copyUShort(h.compression_method, ch.compression_method);
+ copyUInt(h.last_mod_file, ch.last_mod_file);
+ copyUInt(h.crc_32, ch.crc_32);
+ copyUInt(h.compressed_size, ch.compressed_size);
+ copyUInt(h.uncompressed_size, ch.uncompressed_size);
+ copyUShort(h.file_name_length, ch.file_name_length);
+ copyUShort(h.extra_field_length, ch.extra_field_length);
return h;
}
@@ -751,7 +750,7 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
fileHeaders.append(header);
- LocalFileHeader h = header.h.toLocalHeader();
+ LocalFileHeader h = toLocalHeader(header.h);
device->write((const char *)&h, sizeof(LocalFileHeader));
device->write(header.file_name);
device->write(data);