package kit: Actually add support for B_HPKG_COMPRESSION_NONE
Until now we always declared in the HPKG header that the package file is zlib compressed. For uncompressed files we would just store all individual chunks uncompressed. Now we handle completely uncompressed files slightly differently: We don't write the redundant chunk size table anymore. The size savings are minor, but it makes the uncompressed format read-streamable which may be handy.
This commit is contained in:
@@ -52,11 +52,15 @@ public:
|
||||
uint32 Flags() const;
|
||||
void SetFlags(uint32 flags);
|
||||
|
||||
uint32 Compression() const;
|
||||
void SetCompression(uint32 compression);
|
||||
|
||||
int32 CompressionLevel() const;
|
||||
void SetCompressionLevel(int32 compressionLevel);
|
||||
|
||||
private:
|
||||
uint32 fFlags;
|
||||
uint32 fCompression;
|
||||
int32 fCompressionLevel;
|
||||
};
|
||||
|
||||
|
||||
@@ -92,10 +92,6 @@ public:
|
||||
void SetFile(BPositionIO* file)
|
||||
{ fFile = file; }
|
||||
|
||||
uint64 HeapOverhead(uint64 uncompressedSize) const;
|
||||
// additional bytes needed when storing
|
||||
// the given amount of data
|
||||
|
||||
// BAbstractBufferedDataReader
|
||||
virtual status_t ReadDataToOutput(off_t offset,
|
||||
size_t size, BDataIO* output);
|
||||
@@ -152,6 +148,8 @@ public:
|
||||
OffsetArray();
|
||||
~OffsetArray();
|
||||
|
||||
bool InitUncompressedChunksOffsets(
|
||||
size_t totalChunkCount);
|
||||
bool InitChunksOffsets(size_t totalChunkCount,
|
||||
size_t baseIndex, const uint16* chunkSizes,
|
||||
size_t chunkCount);
|
||||
@@ -162,6 +160,10 @@ public:
|
||||
|
||||
uint64 operator[](size_t index) const;
|
||||
|
||||
private:
|
||||
static uint32* _AllocateOffsetArray(size_t totalChunkCount,
|
||||
size_t offset32BitChunkCount);
|
||||
|
||||
private:
|
||||
uint32* fOffsets;
|
||||
// - NULL, if chunkCount <= 1
|
||||
|
||||
@@ -22,6 +22,7 @@ class BPackageEntryAttribute;
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
struct hpkg_header;
|
||||
class PackageWriterImpl;
|
||||
|
||||
|
||||
@@ -34,7 +35,7 @@ public:
|
||||
status_t Init(const char* fileName, uint32 flags);
|
||||
status_t Init(int fd, bool keepFD, uint32 flags);
|
||||
status_t Init(BPositionIO* file, bool keepFile,
|
||||
uint32 flags);
|
||||
uint32 flags, hpkg_header* _header = NULL);
|
||||
status_t ParseContent(
|
||||
BPackageContentHandler* contentHandler);
|
||||
status_t ParseContent(BLowLevelPackageContentHandler*
|
||||
|
||||
@@ -101,8 +101,11 @@ protected:
|
||||
typedef DoublyLinkedList<PackageAttribute> PackageAttributeList;
|
||||
|
||||
protected:
|
||||
status_t Init(const char* fileName, size_t headerSize,
|
||||
status_t Init(const char* fileName,
|
||||
const BPackageWriterParameters& parameters);
|
||||
status_t InitHeapReader(size_t headerSize);
|
||||
|
||||
void SetCompression(uint32 compression);
|
||||
|
||||
void RegisterPackageInfo(
|
||||
PackageAttributeList& attributeList,
|
||||
|
||||
Reference in New Issue
Block a user