[pzstd] Fix frame size for small files + add logging
This commit is contained in:
+10
-2
@@ -40,7 +40,8 @@ class SharedState {
|
||||
if (!options.decompress) {
|
||||
auto parameters = options.determineParameters();
|
||||
cStreamPool.reset(new ResourcePool<ZSTD_CStream>{
|
||||
[parameters]() -> ZSTD_CStream* {
|
||||
[this, parameters]() -> ZSTD_CStream* {
|
||||
this->log(VERBOSE, "Creating new ZSTD_CStream\n");
|
||||
auto zcs = ZSTD_createCStream();
|
||||
if (zcs) {
|
||||
auto err = ZSTD_initCStream_advanced(
|
||||
@@ -57,7 +58,8 @@ class SharedState {
|
||||
}});
|
||||
} else {
|
||||
dStreamPool.reset(new ResourcePool<ZSTD_DStream>{
|
||||
[]() -> ZSTD_DStream* {
|
||||
[this]() -> ZSTD_DStream* {
|
||||
this->log(VERBOSE, "Creating new ZSTD_DStream\n");
|
||||
auto zds = ZSTD_createDStream();
|
||||
if (zds) {
|
||||
auto err = ZSTD_initDStream(zds);
|
||||
@@ -74,6 +76,12 @@ class SharedState {
|
||||
}
|
||||
}
|
||||
|
||||
~SharedState() {
|
||||
// The resource pools have references to this, so destroy them first.
|
||||
cStreamPool.reset();
|
||||
dStreamPool.reset();
|
||||
}
|
||||
|
||||
Logger log;
|
||||
ErrorHolder errorHolder;
|
||||
std::unique_ptr<ResourcePool<ZSTD_CStream>> cStreamPool;
|
||||
|
||||
Reference in New Issue
Block a user