Remove ZSTD_ENABLED checks from the Package Kit.

BZstdCompressionAlgorithm already has these #ifdefs and will
return error codes appropriately if built without libzstd,
so we do not need to check again inside the Package Kit.

This should not break the no-zstd build (well, it is broken
somewhat right now anyway, but this will not break it further),
and it simplifies logic somewhat.
This commit is contained in:
Augustin Cavalier 2021-10-26 15:33:45 -04:00
parent a04b2f4c5e
commit 0cf34918bf
4 changed files with 1 additions and 14 deletions

View File

@ -5,11 +5,9 @@ UseBuildFeatureHeaders zlib ;
UsePrivateKernelHeaders ;
UsePrivateHeaders package shared storage support file_systems ;
local zstdSources ;
local zstdKernelLib ;
if [ FIsBuildFeatureEnabled zstd ] {
zstdSources = ZstdCompressionAlgorithm.cpp ;
zstdKernelLib = kernel_libzstd.a ;
UseBuildFeatureHeaders zstd ;
Includes [ FGristFiles $(zstdSources) ]
@ -112,7 +110,7 @@ local storageKitSources =
local supportKitSources =
CompressionAlgorithm.cpp
ZlibCompressionAlgorithm.cpp
$(zstdSources)
ZstdCompressionAlgorithm.cpp
;
KernelAddon packagefs

View File

@ -64,9 +64,6 @@ HPKG_SOURCES =
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
if [ FIsBuildFeatureEnabled zstd ] {
SubDirC++Flags -DZSTD_ENABLED ;
}
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg v1 ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package manager ] ;

View File

@ -20,9 +20,7 @@
#include <DataIO.h>
#include <ZlibCompressionAlgorithm.h>
#ifdef ZSTD_ENABLED
#include <ZstdCompressionAlgorithm.h>
#endif
#include <package/hpkg/HPKGDefsPrivate.h>
#include <package/hpkg/PackageFileHeapReader.h>
@ -834,7 +832,6 @@ ReaderImplBase::InitHeapReader(uint32 compression, uint32 chunkSize,
return B_NO_MEMORY;
}
break;
#ifdef ZSTD_ENABLED
case B_HPKG_COMPRESSION_ZSTD:
decompressionAlgorithm = DecompressionAlgorithmOwner::Create(
new(std::nothrow) BZstdCompressionAlgorithm,
@ -846,7 +843,6 @@ ReaderImplBase::InitHeapReader(uint32 compression, uint32 chunkSize,
return B_NO_MEMORY;
}
break;
#endif
default:
fErrorOutput->PrintError("Error: Invalid heap compression\n");
return B_BAD_DATA;

View File

@ -20,9 +20,7 @@
#include <AutoDeleter.h>
#include <ZlibCompressionAlgorithm.h>
#ifdef ZSTD_ENABLED
#include <ZstdCompressionAlgorithm.h>
#endif
#include <package/hpkg/DataReader.h>
#include <package/hpkg/ErrorOutput.h>
@ -329,7 +327,6 @@ WriterImplBase::InitHeapReader(size_t headerSize)
throw std::bad_alloc();
}
break;
#ifdef ZSTD_ENABLED
case B_HPKG_COMPRESSION_ZSTD:
compressionAlgorithm = CompressionAlgorithmOwner::Create(
new(std::nothrow) BZstdCompressionAlgorithm,
@ -351,7 +348,6 @@ WriterImplBase::InitHeapReader(size_t headerSize)
throw std::bad_alloc();
}
break;
#endif
default:
fErrorOutput->PrintError("Error: Invalid heap compression\n");
return B_BAD_VALUE;