From 520e32eb1187a4d8a9fd1ad622fa95a2ae073d6f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 7 Dec 2020 10:22:39 +0100 Subject: [PATCH] Fix an issue where the database was too small to create a proper zstd dictionary. --- database-builder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database-builder.cpp b/database-builder.cpp index 6e792be..1e3b442 100644 --- a/database-builder.cpp +++ b/database-builder.cpp @@ -163,7 +163,7 @@ string DictionaryBuilder::train(size_t buf_size) string buf; buf.resize(buf_size); size_t ret = ZDICT_trainFromBuffer(&buf[0], buf_size, dictionary_buf.data(), lengths.data(), lengths.size()); - if (ret == size_t(-1)) { + if (ZDICT_isError(ret)) { return ""; } dprintf("Sampled %zu bytes in %zu blocks, built a dictionary of size %zu\n", dictionary_buf.size(), lengths.size(), ret); -- 2.39.2