From: Steinar H. Gunderson Date: Mon, 7 Dec 2020 09:22:39 +0000 (+0100) Subject: Fix an issue where the database was too small to create a proper zstd dictionary. X-Git-Tag: 1.1.2~6 X-Git-Url: https://git.sesse.net/?p=plocate;a=commitdiff_plain;h=520e32eb1187a4d8a9fd1ad622fa95a2ae073d6f Fix an issue where the database was too small to create a proper zstd dictionary. --- 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);