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>bb10
parent
9bb27ca6cc
commit
d8d0325394
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue