]> git.sesse.net Git - plocate/commitdiff
Fix an issue where the database was too small to create a proper zstd dictionary.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Mon, 7 Dec 2020 09:22:39 +0000 (10:22 +0100)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Wed, 9 Dec 2020 23:33:46 +0000 (00:33 +0100)
database-builder.cpp

index 6e792be450202767b55eec08c869cae3b242b4a9..1e3b442d1fb10af81d51ecdb99f8c527a942f36a 100644 (file)
@@ -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);