From d2d1af830b3f144937ea5e4c3f0e5b74c4c3d737 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 18 Jun 2014 21:42:40 +0200 Subject: [PATCH] Revert "Move ZlibDecompressor to libshared" This reverts commit 9af2105d36856be60528c361edf14a263f242338. Conflicts: src/kits/package/Jamfile --- .../hpkg/{BufferDataOutput.h => DataOutput.h} | 0 .../package/hpkg/ZlibCompressionBase.h | 1 + .../private/package/hpkg/ZlibDecompressor.h | 1 + .../private/shared/ZlibCompressionBase.h | 1 - .../build/private/shared/ZlibDecompressor.h | 1 - .../hpkg/{BufferDataOutput.h => DataOutput.h} | 15 ++++++++----- headers/os/package/hpkg/DataReader.h | 10 ++++----- headers/private/package/hpkg/DataWriters.h | 6 ++--- .../hpkg/PackageFileHeapAccessorBase.h | 2 +- headers/private/package/hpkg/WriterImplBase.h | 2 +- .../hpkg}/ZlibCompressionBase.h | 15 ++++++++++--- headers/private/package/hpkg/ZlibCompressor.h | 14 ++++++------ .../hpkg}/ZlibDecompressor.h | 22 ++++++++++++++----- .../kernel/file_systems/packagefs/Jamfile | 17 +++++--------- .../packagefs/package/CachedDataReader.cpp | 17 +++++--------- .../packagefs/package/CachedDataReader.h | 10 ++++----- .../packagefs/package/Package.cpp | 1 + .../packagefs/package/PackageFile.cpp | 9 ++------ src/build/libpackage/Jamfile | 6 +++-- src/build/libshared/Jamfile | 4 ---- src/kits/package/Jamfile | 4 +++- .../{BufferDataOutput.cpp => DataOutput.cpp} | 12 ++++++++-- src/kits/package/hpkg/DataReader.cpp | 7 +++--- src/kits/package/hpkg/DataWriters.cpp | 2 +- src/kits/package/hpkg/PackageDataReader.cpp | 4 ++-- .../hpkg/PackageFileHeapAccessorBase.cpp | 12 +++++----- src/kits/package/hpkg/PackageReaderImpl.cpp | 4 ++-- src/kits/package/hpkg/PackageWriterImpl.cpp | 2 +- src/kits/package/hpkg/ReaderImplBase.cpp | 4 ++-- .../hpkg}/ZlibCompressionBase.cpp | 10 ++++++++- src/kits/package/hpkg/ZlibCompressor.cpp | 8 +++---- .../hpkg}/ZlibDecompressor.cpp | 18 ++++++++++----- .../package/hpkg/v1/PackageDataReaderV1.cpp | 14 ++++++------ .../package/hpkg/v1/PackageReaderImplV1.cpp | 4 ++-- src/kits/package/hpkg/v1/ReaderImplBaseV1.cpp | 6 ++--- src/kits/shared/Jamfile | 9 -------- .../loader/file_systems/packagefs/Jamfile | 5 +---- 37 files changed, 148 insertions(+), 131 deletions(-) rename headers/build/os/package/hpkg/{BufferDataOutput.h => DataOutput.h} (100%) create mode 100644 headers/build/private/package/hpkg/ZlibCompressionBase.h create mode 100644 headers/build/private/package/hpkg/ZlibDecompressor.h delete mode 100644 headers/build/private/shared/ZlibCompressionBase.h delete mode 100644 headers/build/private/shared/ZlibDecompressor.h rename headers/os/package/hpkg/{BufferDataOutput.h => DataOutput.h} (69%) rename headers/private/{shared => package/hpkg}/ZlibCompressionBase.h (50%) rename headers/private/{shared => package/hpkg}/ZlibDecompressor.h (67%) rename src/kits/package/hpkg/{BufferDataOutput.cpp => DataOutput.cpp} (78%) rename src/kits/{shared => package/hpkg}/ZlibCompressionBase.cpp (84%) rename src/kits/{shared => package/hpkg}/ZlibDecompressor.cpp (91%) diff --git a/headers/build/os/package/hpkg/BufferDataOutput.h b/headers/build/os/package/hpkg/DataOutput.h similarity index 100% rename from headers/build/os/package/hpkg/BufferDataOutput.h rename to headers/build/os/package/hpkg/DataOutput.h diff --git a/headers/build/private/package/hpkg/ZlibCompressionBase.h b/headers/build/private/package/hpkg/ZlibCompressionBase.h new file mode 100644 index 0000000000..052cfd0bde --- /dev/null +++ b/headers/build/private/package/hpkg/ZlibCompressionBase.h @@ -0,0 +1 @@ +#include <../private/package/hpkg/ZlibCompressionBase.h> diff --git a/headers/build/private/package/hpkg/ZlibDecompressor.h b/headers/build/private/package/hpkg/ZlibDecompressor.h new file mode 100644 index 0000000000..698aca62f9 --- /dev/null +++ b/headers/build/private/package/hpkg/ZlibDecompressor.h @@ -0,0 +1 @@ +#include <../private/package/hpkg/ZlibDecompressor.h> diff --git a/headers/build/private/shared/ZlibCompressionBase.h b/headers/build/private/shared/ZlibCompressionBase.h deleted file mode 100644 index 09353da0ea..0000000000 --- a/headers/build/private/shared/ZlibCompressionBase.h +++ /dev/null @@ -1 +0,0 @@ -#include <../private/shared/ZlibCompressionBase.h> diff --git a/headers/build/private/shared/ZlibDecompressor.h b/headers/build/private/shared/ZlibDecompressor.h deleted file mode 100644 index a1706144f7..0000000000 --- a/headers/build/private/shared/ZlibDecompressor.h +++ /dev/null @@ -1 +0,0 @@ -#include <../private/shared/ZlibDecompressor.h> diff --git a/headers/os/package/hpkg/BufferDataOutput.h b/headers/os/package/hpkg/DataOutput.h similarity index 69% rename from headers/os/package/hpkg/BufferDataOutput.h rename to headers/os/package/hpkg/DataOutput.h index 10af41c40f..290937adab 100644 --- a/headers/os/package/hpkg/BufferDataOutput.h +++ b/headers/os/package/hpkg/DataOutput.h @@ -6,7 +6,6 @@ #define _PACKAGE__HPKG__DATA_OUTPUT_H_ -#include #include @@ -15,15 +14,21 @@ namespace BPackageKit { namespace BHPKG { -class BBufferDataOutput : public BDataIO { +class BDataOutput { +public: + virtual ~BDataOutput(); + + virtual status_t WriteData(const void* buffer, size_t size) = 0; +}; + + +class BBufferDataOutput : public BDataOutput { public: BBufferDataOutput(void* buffer, size_t size); size_t BytesWritten() const { return fBytesWritten; } - virtual status_t Write(const void* buffer, size_t size); - virtual ssize_t Read(void* buffer, size_t size) - { return B_NOT_SUPPORTED; } + virtual status_t WriteData(const void* buffer, size_t size); private: void* fBuffer; diff --git a/headers/os/package/hpkg/DataReader.h b/headers/os/package/hpkg/DataReader.h index 6d103ec68e..2590415fba 100644 --- a/headers/os/package/hpkg/DataReader.h +++ b/headers/os/package/hpkg/DataReader.h @@ -9,14 +9,14 @@ #include -class BDataIO; - - namespace BPackageKit { namespace BHPKG { +class BDataOutput; + + class BDataReader { public: virtual ~BDataReader(); @@ -33,7 +33,7 @@ public: virtual status_t ReadData(off_t offset, void* buffer, size_t size); virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) = 0; + BDataOutput* output) = 0; }; @@ -73,7 +73,7 @@ public: virtual status_t ReadData(off_t offset, void* buffer, size_t size); virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output); + BDataOutput* output); private: const void* fData; diff --git a/headers/private/package/hpkg/DataWriters.h b/headers/private/package/hpkg/DataWriters.h index 20e0729997..26f67cf411 100644 --- a/headers/private/package/hpkg/DataWriters.h +++ b/headers/private/package/hpkg/DataWriters.h @@ -7,7 +7,7 @@ #define _PACKAGE__HPKG__PRIVATE__DATA_WRITERS_H_ -#include +#include #include @@ -59,7 +59,7 @@ private: }; -class ZlibDataWriter : public AbstractDataWriter, private BDataIO { +class ZlibDataWriter : public AbstractDataWriter, private BDataOutput { public: ZlibDataWriter(AbstractDataWriter* dataWriter); @@ -71,7 +71,7 @@ public: private: // BDataOutput - virtual status_t Write(const void* buffer, size_t size); + virtual status_t WriteData(const void* buffer, size_t size); private: AbstractDataWriter* fDataWriter; diff --git a/headers/private/package/hpkg/PackageFileHeapAccessorBase.h b/headers/private/package/hpkg/PackageFileHeapAccessorBase.h index 84ce06ee76..47ae47f161 100644 --- a/headers/private/package/hpkg/PackageFileHeapAccessorBase.h +++ b/headers/private/package/hpkg/PackageFileHeapAccessorBase.h @@ -49,7 +49,7 @@ public: // BAbstractBufferedDataReader virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output); + BDataOutput* output); public: static const size_t kChunkSize = 64 * 1024; diff --git a/headers/private/package/hpkg/WriterImplBase.h b/headers/private/package/hpkg/WriterImplBase.h index 66c6e0a556..0686335ca6 100644 --- a/headers/private/package/hpkg/WriterImplBase.h +++ b/headers/private/package/hpkg/WriterImplBase.h @@ -10,7 +10,7 @@ #include -#include +#include #include #include #include diff --git a/headers/private/shared/ZlibCompressionBase.h b/headers/private/package/hpkg/ZlibCompressionBase.h similarity index 50% rename from headers/private/shared/ZlibCompressionBase.h rename to headers/private/package/hpkg/ZlibCompressionBase.h index 2ebfbb0ce9..786e579908 100644 --- a/headers/private/shared/ZlibCompressionBase.h +++ b/headers/private/package/hpkg/ZlibCompressionBase.h @@ -2,13 +2,17 @@ * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ -#ifndef _PRIVATE__ZLIB_COMPRESSION_BASE_H_ -#define _PRIVATE__ZLIB_COMPRESSION_BASE_H_ +#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSION_BASE_H_ +#define _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSION_BASE_H_ #include +namespace BPackageKit { + +namespace BHPKG { + namespace BPrivate { @@ -20,4 +24,9 @@ public: } // namespace BPrivate -#endif // _PRIVATE__ZLIB_COMPRESSION_BASE_H_ +} // namespace BHPKG + +} // namespace BPackageKit + + +#endif // _PACKAGE__HPKG__PRIVATE__ZLIB_COMPRESSION_BASE_H_ diff --git a/headers/private/package/hpkg/ZlibCompressor.h b/headers/private/package/hpkg/ZlibCompressor.h index 9d73f2bb67..4f6dd141f7 100644 --- a/headers/private/package/hpkg/ZlibCompressor.h +++ b/headers/private/package/hpkg/ZlibCompressor.h @@ -8,10 +8,7 @@ #include -#include - - -class BDataIO; +#include namespace BPackageKit { @@ -19,12 +16,15 @@ namespace BPackageKit { namespace BHPKG { +class BDataOutput; + + namespace BPrivate { -class ZlibCompressor : public ::BPrivate::ZlibCompressionBase { +class ZlibCompressor : public ZlibCompressionBase { public: - ZlibCompressor(BDataIO* output); + ZlibCompressor(BDataOutput* output); ~ZlibCompressor(); status_t Init(int compressionLevel = Z_BEST_COMPRESSION); @@ -39,7 +39,7 @@ public: private: z_stream fStream; - BDataIO* fOutput; + BDataOutput* fOutput; bool fStreamInitialized; }; diff --git a/headers/private/shared/ZlibDecompressor.h b/headers/private/package/hpkg/ZlibDecompressor.h similarity index 67% rename from headers/private/shared/ZlibDecompressor.h rename to headers/private/package/hpkg/ZlibDecompressor.h index 2d1efab4cc..8d4556b236 100644 --- a/headers/private/shared/ZlibDecompressor.h +++ b/headers/private/package/hpkg/ZlibDecompressor.h @@ -2,16 +2,21 @@ * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ -#ifndef _PRIVATE__ZLIB_DECOMPRESSOR_H_ -#define _PRIVATE__ZLIB_DECOMPRESSOR_H_ +#ifndef _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_ +#define _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_ #include -#include +#include -class BDataIO; +namespace BPackageKit { + +namespace BHPKG { + + +class BDataOutput; namespace BPrivate { @@ -19,7 +24,7 @@ namespace BPrivate { class ZlibDecompressor : public ZlibCompressionBase { public: - ZlibDecompressor(BDataIO* output); + ZlibDecompressor(BDataOutput* output); ~ZlibDecompressor(); status_t Init(); @@ -34,7 +39,7 @@ public: private: z_stream fStream; - BDataIO* fOutput; + BDataOutput* fOutput; bool fStreamInitialized; bool fFinished; }; @@ -42,4 +47,9 @@ private: } // namespace BPrivate +} // namespace BHPKG + +} // namespace BPackageKit + + #endif // _PACKAGE__HPKG__PRIVATE__ZLIB_DECOMPRESSOR_H_ diff --git a/src/add-ons/kernel/file_systems/packagefs/Jamfile b/src/add-ons/kernel/file_systems/packagefs/Jamfile index 47e4b2184c..53907f2234 100644 --- a/src/add-ons/kernel/file_systems/packagefs/Jamfile +++ b/src/add-ons/kernel/file_systems/packagefs/Jamfile @@ -75,8 +75,8 @@ HAIKU_PACKAGE_FS_SHARED_SOURCES = HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES = BlockBufferPoolImpl.cpp - BufferDataOutput.cpp BufferPool.cpp + DataOutput.cpp DataReader.cpp ErrorOutput.cpp FDDataReader.cpp @@ -91,6 +91,10 @@ HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES = PackageFileHeapReader.cpp PackageReaderImpl.cpp ReaderImplBase.cpp + + # compression + ZlibCompressionBase.cpp + ZlibDecompressor.cpp ; HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES_V1 = @@ -111,14 +115,6 @@ Includes local libSharedSources = NaturalCompare.cpp - - # compression - ZlibCompressionBase.cpp - ZlibDecompressor.cpp -; - -local supportKitSources = - DataIO.cpp ; @@ -129,7 +125,6 @@ KernelAddon packagefs $(HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES) $(HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES_V1) $(libSharedSources) - $(supportKitSources) : $(TARGET_KERNEL_LIBSUPC++) kernel_libz.a ; @@ -143,5 +138,3 @@ SEARCH on [ FGristFiles $(HAIKU_PACKAGE_FS_PACKAGE_READER_SOURCES_V1) ] += [ FDirName $(HAIKU_TOP) src kits package hpkg v1 ] ; SEARCH on [ FGristFiles $(libSharedSources) ] += [ FDirName $(HAIKU_TOP) src kits shared ] ; -SEARCH on [ FGristFiles $(supportKitSources) ] - += [ FDirName $(HAIKU_TOP) src kits support ] ; diff --git a/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.cpp b/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.cpp index ac7c2463c3..fa6f3fc990 100644 --- a/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.cpp @@ -31,7 +31,7 @@ page_physical_number_less(const vm_page* a, const vm_page* b) // #pragma mark - PagesDataOutput -struct CachedDataReader::PagesDataOutput : public BDataIO { +struct CachedDataReader::PagesDataOutput : public BDataOutput { PagesDataOutput(vm_page** pages, size_t pageCount) : fPages(pages), @@ -40,7 +40,7 @@ struct CachedDataReader::PagesDataOutput : public BDataIO { { } - virtual status_t Write(const void* buffer, size_t size) + virtual status_t WriteData(const void* buffer, size_t size) { while (size > 0) { if (fPageCount == 0) @@ -67,11 +67,6 @@ struct CachedDataReader::PagesDataOutput : public BDataIO { return B_OK; } - virtual ssize_t Read(void* buffer, size_t size) - { - return B_NOT_SUPPORTED; - } - private: vm_page** fPages; size_t fPageCount; @@ -137,7 +132,7 @@ CachedDataReader::ReadData(off_t offset, void* buffer, size_t size) status_t CachedDataReader::ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) + BDataOutput* output) { if (offset > fCache->virtual_end || (off_t)size > fCache->virtual_end - offset) { @@ -173,7 +168,7 @@ CachedDataReader::ReadDataToOutput(off_t offset, size_t size, status_t CachedDataReader::_ReadCacheLine(off_t lineOffset, size_t lineSize, - off_t requestOffset, size_t requestLength, BDataIO* output) + off_t requestOffset, size_t requestLength, BDataOutput* output) { PRINT("CachedDataReader::_ReadCacheLine(%" B_PRIdOFF ", %zu, %" B_PRIdOFF ", %zu, %p\n", lineOffset, lineSize, requestOffset, requestLength, @@ -371,7 +366,7 @@ CachedDataReader::_CachePages(vm_page** pages, size_t firstPage, */ status_t CachedDataReader::_WritePages(vm_page** pages, size_t pagesRelativeOffset, - size_t requestLength, BDataIO* output) + size_t requestLength, BDataOutput* output) { PRINT("%p->CachedDataReader::_WritePages(%" B_PRIuSIZE ", %" B_PRIuSIZE ", %p)\n", this, pagesRelativeOffset, requestLength, output); @@ -394,7 +389,7 @@ CachedDataReader::_WritePages(vm_page** pages, size_t pagesRelativeOffset, // write the page's data size_t toCopy = std::min(B_PAGE_SIZE - inPageOffset, requestLength); - error = output->Write((uint8*)(address + inPageOffset), toCopy); + error = output->WriteData((uint8*)(address + inPageOffset), toCopy); // unmap the page vm_put_physical_page(address, handle); diff --git a/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.h b/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.h index 847e16d28d..7cba87ca4e 100644 --- a/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.h +++ b/src/add-ons/kernel/file_systems/packagefs/package/CachedDataReader.h @@ -15,12 +15,10 @@ using BPackageKit::BHPKG::BAbstractBufferedDataReader; +using BPackageKit::BHPKG::BDataOutput; using BPackageKit::BHPKG::BDataReader; -class BDataIO; - - class CachedDataReader : public BAbstractBufferedDataReader { public: CachedDataReader(); @@ -32,7 +30,7 @@ public: virtual status_t ReadData(off_t offset, void* buffer, size_t size); virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output); + BDataOutput* output); private: class CacheLineLocker @@ -123,7 +121,7 @@ private: private: status_t _ReadCacheLine(off_t lineOffset, size_t lineSize, off_t requestOffset, - size_t requestLength, BDataIO* output); + size_t requestLength, BDataOutput* output); void _DiscardPages(vm_page** pages, size_t firstPage, size_t pageCount); @@ -131,7 +129,7 @@ private: size_t pageCount); status_t _WritePages(vm_page** pages, size_t pagesRelativeOffset, - size_t requestLength, BDataIO* output); + size_t requestLength, BDataOutput* output); status_t _ReadIntoPages(vm_page** pages, size_t firstPage, size_t pageCount); diff --git a/src/add-ons/kernel/file_systems/packagefs/package/Package.cpp b/src/add-ons/kernel/file_systems/packagefs/package/Package.cpp index eb0847e45a..dd846226f3 100644 --- a/src/add-ons/kernel/file_systems/packagefs/package/Package.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/package/Package.cpp @@ -39,6 +39,7 @@ using namespace BPackageKit; +using BPackageKit::BHPKG::BDataOutput; using BPackageKit::BHPKG::BErrorOutput; using BPackageKit::BHPKG::BFDDataReader; using BPackageKit::BHPKG::BPackageInfoAttributeValue; diff --git a/src/add-ons/kernel/file_systems/packagefs/package/PackageFile.cpp b/src/add-ons/kernel/file_systems/packagefs/package/PackageFile.cpp index 0db672df5c..01abec7ee1 100644 --- a/src/add-ons/kernel/file_systems/packagefs/package/PackageFile.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/package/PackageFile.cpp @@ -29,7 +29,7 @@ using namespace BPackageKit::BHPKG; // #pragma mark - DataAccessor -struct PackageFile::IORequestOutput : BDataIO { +struct PackageFile::IORequestOutput : BDataOutput { public: IORequestOutput(io_request* request) : @@ -37,16 +37,11 @@ public: { } - virtual status_t Write(const void* buffer, size_t size) + virtual status_t WriteData(const void* buffer, size_t size) { RETURN_ERROR(write_to_io_request(fRequest, buffer, size)); } - virtual ssize_t Read(void* buffer, size_t size) - { - return B_NOT_SUPPORTED; - } - private: io_request* fRequest; }; diff --git a/src/build/libpackage/Jamfile b/src/build/libpackage/Jamfile index 6814f3c981..ca37f93a9b 100644 --- a/src/build/libpackage/Jamfile +++ b/src/build/libpackage/Jamfile @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src build libpackage ; -UsePrivateBuildHeaders kernel package shared storage support ; +UsePrivateBuildHeaders kernel package shared storage ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ; @@ -33,9 +33,9 @@ HPKG_SOURCES = BlockBufferPool.cpp BlockBufferPoolImpl.cpp BlockBufferPoolNoLock.cpp - BufferDataOutput.cpp BufferPool.cpp PoolBuffer.cpp + DataOutput.cpp DataReader.cpp DataWriters.cpp ErrorOutput.cpp @@ -77,7 +77,9 @@ HPKG_SOURCES = ReaderImplBaseV1.cpp # compression + ZlibCompressionBase.cpp ZlibCompressor.cpp + ZlibDecompressor.cpp ; # TODO: remove this hack once gcc2 has -iquote implemented diff --git a/src/build/libshared/Jamfile b/src/build/libshared/Jamfile index f42f7f7b8e..44984b7097 100644 --- a/src/build/libshared/Jamfile +++ b/src/build/libshared/Jamfile @@ -10,8 +10,4 @@ BuildPlatformStaticLibraryPIC libshared_build.a : Keymap.cpp NaturalCompare.cpp SHA256.cpp - - # compression - ZlibCompressionBase.cpp - ZlibDecompressor.cpp ; diff --git a/src/kits/package/Jamfile b/src/kits/package/Jamfile index 8b9644946e..7706f84263 100644 --- a/src/kits/package/Jamfile +++ b/src/kits/package/Jamfile @@ -13,9 +13,9 @@ HPKG_SOURCES = BlockBufferPool.cpp BlockBufferPoolImpl.cpp BlockBufferPoolNoLock.cpp - BufferDataOutput.cpp BufferPool.cpp CommitTransactionResult.cpp + DataOutput.cpp DataReader.cpp DataWriters.cpp ErrorOutput.cpp @@ -58,7 +58,9 @@ HPKG_SOURCES = ReaderImplBaseV1.cpp # compression + ZlibCompressionBase.cpp ZlibCompressor.cpp + ZlibDecompressor.cpp ; local architectureObject ; diff --git a/src/kits/package/hpkg/BufferDataOutput.cpp b/src/kits/package/hpkg/DataOutput.cpp similarity index 78% rename from src/kits/package/hpkg/BufferDataOutput.cpp rename to src/kits/package/hpkg/DataOutput.cpp index 8ae25437a4..00694b31cd 100644 --- a/src/kits/package/hpkg/BufferDataOutput.cpp +++ b/src/kits/package/hpkg/DataOutput.cpp @@ -4,7 +4,7 @@ */ -#include +#include #include @@ -14,6 +14,14 @@ namespace BPackageKit { namespace BHPKG { +// #pragma mark - BDataOutput + + +BDataOutput::~BDataOutput() +{ +} + + // #pragma mark - BBufferDataOutput @@ -27,7 +35,7 @@ BBufferDataOutput::BBufferDataOutput(void* buffer, size_t size) status_t -BBufferDataOutput::Write(const void* buffer, size_t size) +BBufferDataOutput::WriteData(const void* buffer, size_t size) { if (size == 0) return B_OK; diff --git a/src/kits/package/hpkg/DataReader.cpp b/src/kits/package/hpkg/DataReader.cpp index eb1a81c762..b47f988a2f 100644 --- a/src/kits/package/hpkg/DataReader.cpp +++ b/src/kits/package/hpkg/DataReader.cpp @@ -6,8 +6,7 @@ #include -#include -#include +#include #include @@ -71,7 +70,7 @@ BBufferDataReader::ReadData(off_t offset, void* buffer, size_t size) status_t BBufferDataReader::ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) + BDataOutput* output) { if (size == 0) return B_OK; @@ -82,7 +81,7 @@ BBufferDataReader::ReadDataToOutput(off_t offset, size_t size, if (size > fSize || offset > (off_t)fSize - (off_t)size) return B_ERROR; - return output->Write((const uint8*)fData + offset, size); + return output->WriteData((const uint8*)fData + offset, size); } diff --git a/src/kits/package/hpkg/DataWriters.cpp b/src/kits/package/hpkg/DataWriters.cpp index a22dcd01eb..29318c890d 100644 --- a/src/kits/package/hpkg/DataWriters.cpp +++ b/src/kits/package/hpkg/DataWriters.cpp @@ -112,7 +112,7 @@ ZlibDataWriter::WriteDataNoThrow(const void* buffer, status_t -ZlibDataWriter::Write(const void* buffer, size_t size) +ZlibDataWriter::WriteData(const void* buffer, size_t size) { return fDataWriter->WriteDataNoThrow(buffer, size); } diff --git a/src/kits/package/hpkg/PackageDataReader.cpp b/src/kits/package/hpkg/PackageDataReader.cpp index 3f0d32653c..9c808fec44 100644 --- a/src/kits/package/hpkg/PackageDataReader.cpp +++ b/src/kits/package/hpkg/PackageDataReader.cpp @@ -13,7 +13,7 @@ #include #include -#include +#include namespace BPackageKit { @@ -53,7 +53,7 @@ public: } virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) + BDataOutput* output) { if (size == 0) return B_OK; diff --git a/src/kits/package/hpkg/PackageFileHeapAccessorBase.cpp b/src/kits/package/hpkg/PackageFileHeapAccessorBase.cpp index 3ffa2a8756..024b8f21e9 100644 --- a/src/kits/package/hpkg/PackageFileHeapAccessorBase.cpp +++ b/src/kits/package/hpkg/PackageFileHeapAccessorBase.cpp @@ -14,11 +14,11 @@ #include #include -#include +#include #include #include -#include +#include namespace BPackageKit { @@ -140,7 +140,7 @@ PackageFileHeapAccessorBase::~PackageFileHeapAccessorBase() status_t PackageFileHeapAccessorBase::ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) + BDataOutput* output) { if (size == 0) return B_OK; @@ -174,8 +174,8 @@ PackageFileHeapAccessorBase::ReadDataToOutput(off_t offset, size_t size, // The last chunk may be shorter than kChunkSize, but since // size (and thus remainingSize) had been clamped, that doesn't // harm. - error = output->Write((char*)uncompressedDataBuffer + inChunkOffset, - toWrite); + error = output->WriteData( + (char*)uncompressedDataBuffer + inChunkOffset, toWrite); if (error != B_OK) return error; @@ -213,7 +213,7 @@ PackageFileHeapAccessorBase::DecompressChunkData(void* compressedDataBuffer, size_t uncompressedSize) { size_t actualSize; - status_t error = ::BPrivate::ZlibDecompressor::DecompressSingleBuffer( + status_t error = ZlibDecompressor::DecompressSingleBuffer( compressedDataBuffer, compressedSize, uncompressedDataBuffer, uncompressedSize, actualSize); if (error != B_OK) { diff --git a/src/kits/package/hpkg/PackageReaderImpl.cpp b/src/kits/package/hpkg/PackageReaderImpl.cpp index b821d4c7c1..68425989c6 100644 --- a/src/kits/package/hpkg/PackageReaderImpl.cpp +++ b/src/kits/package/hpkg/PackageReaderImpl.cpp @@ -22,11 +22,11 @@ #include -#include +#include #include #include #include -#include +#include namespace BPackageKit { diff --git a/src/kits/package/hpkg/PackageWriterImpl.cpp b/src/kits/package/hpkg/PackageWriterImpl.cpp index a9348dbac4..c57eebad0b 100644 --- a/src/kits/package/hpkg/PackageWriterImpl.cpp +++ b/src/kits/package/hpkg/PackageWriterImpl.cpp @@ -37,7 +37,7 @@ #include -#include +#include #include #include #include diff --git a/src/kits/package/hpkg/ReaderImplBase.cpp b/src/kits/package/hpkg/ReaderImplBase.cpp index e5c156498a..af771ece4b 100644 --- a/src/kits/package/hpkg/ReaderImplBase.cpp +++ b/src/kits/package/hpkg/ReaderImplBase.cpp @@ -19,9 +19,9 @@ #include -#include +#include #include -#include +#include namespace BPackageKit { diff --git a/src/kits/shared/ZlibCompressionBase.cpp b/src/kits/package/hpkg/ZlibCompressionBase.cpp similarity index 84% rename from src/kits/shared/ZlibCompressionBase.cpp rename to src/kits/package/hpkg/ZlibCompressionBase.cpp index 2377353f76..4fe43377a9 100644 --- a/src/kits/shared/ZlibCompressionBase.cpp +++ b/src/kits/package/hpkg/ZlibCompressionBase.cpp @@ -4,13 +4,17 @@ */ -#include +#include #include #include +namespace BPackageKit { + +namespace BHPKG { + namespace BPrivate { @@ -44,3 +48,7 @@ ZlibCompressionBase::TranslateZlibError(int error) } // namespace BPrivate + +} // namespace BHPKG + +} // namespace BPackageKit diff --git a/src/kits/package/hpkg/ZlibCompressor.cpp b/src/kits/package/hpkg/ZlibCompressor.cpp index b9e6e6fc64..a2a5dea5a8 100644 --- a/src/kits/package/hpkg/ZlibCompressor.cpp +++ b/src/kits/package/hpkg/ZlibCompressor.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include namespace BPackageKit { @@ -22,7 +22,7 @@ namespace BPrivate { static const size_t kOutputBufferSize = 1024; -ZlibCompressor::ZlibCompressor(BDataIO* output) +ZlibCompressor::ZlibCompressor(BDataOutput* output) : fOutput(output), fStreamInitialized(false) @@ -82,7 +82,7 @@ ZlibCompressor::CompressNext(const void* input, size_t inputSize) return TranslateZlibError(zlibError); if (fStream.avail_out < sizeof(outputBuffer)) { - status_t error = fOutput->Write(outputBuffer, + status_t error = fOutput->WriteData(outputBuffer, sizeof(outputBuffer) - fStream.avail_out); if (error != B_OK) return error; @@ -109,7 +109,7 @@ ZlibCompressor::Finish() return TranslateZlibError(zlibError); if (fStream.avail_out < sizeof(outputBuffer)) { - status_t error = fOutput->Write(outputBuffer, + status_t error = fOutput->WriteData(outputBuffer, sizeof(outputBuffer) - fStream.avail_out); if (error != B_OK) return error; diff --git a/src/kits/shared/ZlibDecompressor.cpp b/src/kits/package/hpkg/ZlibDecompressor.cpp similarity index 91% rename from src/kits/shared/ZlibDecompressor.cpp rename to src/kits/package/hpkg/ZlibDecompressor.cpp index 17552a827b..2ab2d4c07b 100644 --- a/src/kits/shared/ZlibDecompressor.cpp +++ b/src/kits/package/hpkg/ZlibDecompressor.cpp @@ -4,14 +4,18 @@ */ -#include +#include #include #include -#include +#include +namespace BPackageKit { + +namespace BHPKG { + namespace BPrivate { @@ -19,7 +23,7 @@ namespace BPrivate { static const size_t kOutputBufferSize = 1024; -ZlibDecompressor::ZlibDecompressor(BDataIO* output) +ZlibDecompressor::ZlibDecompressor(BDataOutput* output) : fOutput(output), fStreamInitialized(false), @@ -85,7 +89,7 @@ ZlibDecompressor::DecompressNext(const void* input, size_t inputSize) return TranslateZlibError(zlibError); if (fStream.avail_out < sizeof(outputBuffer)) { - status_t error = fOutput->Write(outputBuffer, + status_t error = fOutput->WriteData(outputBuffer, sizeof(outputBuffer) - fStream.avail_out); if (error != B_OK) return error; @@ -114,7 +118,7 @@ ZlibDecompressor::Finish() return TranslateZlibError(zlibError); if (fStream.avail_out < sizeof(outputBuffer)) { - status_t error = fOutput->Write(outputBuffer, + status_t error = fOutput->WriteData(outputBuffer, sizeof(outputBuffer) - fStream.avail_out); if (error != B_OK) return error; @@ -182,3 +186,7 @@ ZlibDecompressor::DecompressSingleBuffer(const void* input, size_t inputSize, } // namespace BPrivate + +} // namespace BHPKG + +} // namespace BPackageKit diff --git a/src/kits/package/hpkg/v1/PackageDataReaderV1.cpp b/src/kits/package/hpkg/v1/PackageDataReaderV1.cpp index e8d47ed468..4c60352aac 100644 --- a/src/kits/package/hpkg/v1/PackageDataReaderV1.cpp +++ b/src/kits/package/hpkg/v1/PackageDataReaderV1.cpp @@ -11,12 +11,12 @@ #include #include -#include #include #include +#include #include #include -#include +#include namespace BPackageKit { @@ -27,7 +27,7 @@ namespace V1 { using BHPKG::BPrivate::PoolBufferPutter; -using ::BPrivate::ZlibDecompressor; +using BHPKG::BPrivate::ZlibDecompressor; // minimum/maximum zlib chunk size we consider sane @@ -98,7 +98,7 @@ public: } virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) + BDataOutput* output) { if (size == 0) return B_OK; @@ -125,7 +125,7 @@ public: return error; // write to the output - error = output->Write(buffer->Buffer(), toRead); + error = output->WriteData(buffer->Buffer(), toRead); if (error != B_OK) return error; @@ -205,7 +205,7 @@ public: } virtual status_t ReadDataToOutput(off_t offset, size_t size, - BDataIO* output) + BDataOutput* output) { // check offset and size if (size == 0) @@ -244,7 +244,7 @@ public: // write data to output size_t toCopy = std::min(size, (size_t)fChunkSize - inChunkOffset); - error = output->Write( + error = output->WriteData( (uint8*)fUncompressBuffer->Buffer() + inChunkOffset, toCopy); if (error != B_OK) return error; diff --git a/src/kits/package/hpkg/v1/PackageReaderImplV1.cpp b/src/kits/package/hpkg/v1/PackageReaderImplV1.cpp index 8541f84e5b..5fa75d5218 100644 --- a/src/kits/package/hpkg/v1/PackageReaderImplV1.cpp +++ b/src/kits/package/hpkg/v1/PackageReaderImplV1.cpp @@ -22,12 +22,12 @@ #include -#include +#include #include #include #include #include -#include +#include namespace BPackageKit { diff --git a/src/kits/package/hpkg/v1/ReaderImplBaseV1.cpp b/src/kits/package/hpkg/v1/ReaderImplBaseV1.cpp index 9768c33cad..74bf776baa 100644 --- a/src/kits/package/hpkg/v1/ReaderImplBaseV1.cpp +++ b/src/kits/package/hpkg/v1/ReaderImplBaseV1.cpp @@ -19,9 +19,9 @@ #include -#include +#include #include -#include +#include namespace BPackageKit { @@ -33,7 +33,7 @@ namespace V1 { namespace BPrivate { -using ::BPrivate::ZlibDecompressor; +using BHPKG::BPrivate::ZlibDecompressor; static const size_t kScratchBufferSize = 64 * 1024; diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile index 6b78dc3a47..212d499896 100644 --- a/src/kits/shared/Jamfile +++ b/src/kits/shared/Jamfile @@ -11,8 +11,6 @@ for architectureObject in [ MultiArchSubDirSetup ] { on $(architectureObject) { local architecture = $(TARGET_PACKAGING_ARCH) ; - UseBuildFeatureHeaders zlib ; - UseHeaders [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR_$(TARGET_PACKAGING_ARCHS[1])) servers input ] ; @@ -23,9 +21,6 @@ for architectureObject in [ MultiArchSubDirSetup ] { # for RWLockManager only UsePrivateSystemHeaders ; UsePrivateHeaders kernel libroot ; - - Includes [ FGristFiles $(HPKG_SOURCES) ] - : [ BuildFeatureAttribute zlib : headers ] ; StaticLibrary [ MultiArchDefaultGristFiles libshared.a ] : AboutMenuItem.cpp @@ -52,10 +47,6 @@ for architectureObject in [ MultiArchSubDirSetup ] { TextTable.cpp Thread.cpp Variant.cpp - - # compression - ZlibCompressionBase.cpp - ZlibDecompressor.cpp ; Includes [ FGristFiles Keymap.cpp ] diff --git a/src/system/boot/loader/file_systems/packagefs/Jamfile b/src/system/boot/loader/file_systems/packagefs/Jamfile index 7fadf511ee..2425fdf443 100644 --- a/src/system/boot/loader/file_systems/packagefs/Jamfile +++ b/src/system/boot/loader/file_systems/packagefs/Jamfile @@ -13,8 +13,6 @@ SubDirC++Flags -fno-rtti -include $(kernelC++Header) ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits shared ] ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits support ] ; BootStaticLibrary boot_packagefs : @@ -27,9 +25,9 @@ BootStaticLibrary boot_packagefs : BlockBufferPool.cpp BlockBufferPoolImpl.cpp BlockBufferPoolNoLock.cpp - BufferDataOutput.cpp BufferPool.cpp PoolBuffer.cpp + DataOutput.cpp DataReader.cpp ErrorOutput.cpp FDDataReader.cpp @@ -44,7 +42,6 @@ BootStaticLibrary boot_packagefs : ReaderImplBase.cpp # compression - DataIO.cpp ZlibCompressionBase.cpp ZlibDecompressor.cpp