repository writer: fix use of incorrect header size

The header size of the package file header was used, which resulted in
broken repository files.
This commit is contained in:
Ingo Weinhold 2013-07-04 16:37:24 +02:00
parent 32086850f7
commit 695a1b248a
4 changed files with 8 additions and 6 deletions

View File

@ -100,7 +100,7 @@ protected:
typedef DoublyLinkedList<PackageAttribute> PackageAttributeList;
protected:
status_t Init(const char* fileName,
status_t Init(const char* fileName, size_t headerSize,
const BPackageWriterParameters& parameters);
void RegisterPackageInfo(

View File

@ -606,7 +606,8 @@ status_t
PackageWriterImpl::_Init(const char* fileName,
const BPackageWriterParameters& parameters)
{
status_t result = inherited::Init(fileName, parameters);
status_t result = inherited::Init(fileName, sizeof(hpkg_header),
parameters);
if (result != B_OK)
return result;

View File

@ -250,7 +250,8 @@ RepositoryWriterImpl::Finish()
status_t
RepositoryWriterImpl::_Init(const char* fileName)
{
return inherited::Init(fileName, BPackageWriterParameters());
return inherited::Init(fileName, sizeof(hpkg_repo_header),
BPackageWriterParameters());
}

View File

@ -243,7 +243,7 @@ WriterImplBase::~WriterImplBase()
status_t
WriterImplBase::Init(const char* fileName,
WriterImplBase::Init(const char* fileName, size_t headerSize,
const BPackageWriterParameters& parameters)
{
fParameters = parameters;
@ -266,8 +266,8 @@ WriterImplBase::Init(const char* fileName,
fFileName = fileName;
// create heap writer
fHeapWriter = new PackageFileHeapWriter(fErrorOutput, FD(),
sizeof(hpkg_header), fParameters.CompressionLevel());
fHeapWriter = new PackageFileHeapWriter(fErrorOutput, FD(), headerSize,
fParameters.CompressionLevel());
fHeapWriter->Init();
fDataWriter = fHeapWriter->DataWriter();