/* createDict() : `dictFileName` is supposed to have been created using `zstd --train` */ static const ZSTD_CDict* createDict(const char* dictFileName) { size_t dictSize; printf("loading dictionary %s \n", dictFileName); void* const dictBuffer = loadFile_X(dictFileName, &dictSize); const ZSTD_CDict* const ddict = ZSTD_createCDict(dictBuffer, dictSize, 3); free(dictBuffer); return ddict; }
/* createDict() : `dictFileName` is supposed to have been created using `zstd --train` */ static ZSTD_CDict* createCDict_orDie(const char* dictFileName) { size_t dictSize; printf("loading dictionary %s \n", dictFileName); void* const dictBuffer = loadFile_orDie(dictFileName, &dictSize); ZSTD_CDict* const cdict = ZSTD_createCDict(dictBuffer, dictSize, 3); if (!cdict) { fprintf(stderr, "ZSTD_createCDict error \n"); exit(7); } free(dictBuffer); return cdict; }