fixed : better error message when dictionary missing

during benchmark.
Also : refactored ZSTD_fillHashTable(),
just for readability (it does the same thing)
This commit is contained in:
Yann Collet
2018-12-20 17:20:07 -08:00
parent e4ae24c229
commit ed2fb6bd57
3 changed files with 19 additions and 12 deletions
+6
View File
@@ -25,6 +25,7 @@
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
#include <stdio.h> /* fprintf, fopen */
#include <errno.h>
#include <assert.h> /* assert */
#include "benchfn.h"
@@ -799,6 +800,11 @@ BMK_benchOutcome_t BMK_benchFilesAdvanced(
/* Load dictionary */
if (dictFileName != NULL) {
U64 const dictFileSize = UTIL_getFileSize(dictFileName);
if (dictFileSize == UTIL_FILESIZE_UNKNOWN) {
DISPLAYLEVEL(1, "error loading %s : %s \n", dictFileName, strerror(errno));
free(fileSizes);
RETURN_ERROR(9, BMK_benchOutcome_t, "benchmark aborted");
}
if (dictFileSize > 64 MB) {
free(fileSizes);
RETURN_ERROR(10, BMK_benchOutcome_t, "dictionary file %s too large", dictFileName);