mirror of
https://github.com/facebook/zstd.git
synced 2025-10-08 00:04:02 -04:00
Merge pull request #3184 from htnhan/features/list_verbose_to_show_dictionary_id
zstd -lv <file> to show dictID
This commit is contained in:
commit
02ef78be58
@ -2721,6 +2721,7 @@ typedef struct {
|
|||||||
int decompUnavailable;
|
int decompUnavailable;
|
||||||
int usesCheck;
|
int usesCheck;
|
||||||
U32 nbFiles;
|
U32 nbFiles;
|
||||||
|
unsigned dictID;
|
||||||
} fileInfo_t;
|
} fileInfo_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -2775,6 +2776,12 @@ FIO_analyzeFrames(fileInfo_t* info, FILE* const srcFile)
|
|||||||
}
|
}
|
||||||
ERROR_IF(ZSTD_getFrameHeader(&header, headerBuffer, numBytesRead) != 0,
|
ERROR_IF(ZSTD_getFrameHeader(&header, headerBuffer, numBytesRead) != 0,
|
||||||
info_frame_error, "Error: could not decode frame header");
|
info_frame_error, "Error: could not decode frame header");
|
||||||
|
if (info->dictID != 0 && info->dictID != header.dictID) {
|
||||||
|
DISPLAY("WARNING: File contains multiple frames with different dictionary IDs. Showing dictID 0 instead");
|
||||||
|
info->dictID = 0;
|
||||||
|
} else {
|
||||||
|
info->dictID = header.dictID;
|
||||||
|
}
|
||||||
info->windowSize = header.windowSize;
|
info->windowSize = header.windowSize;
|
||||||
/* move to the end of the frame header */
|
/* move to the end of the frame header */
|
||||||
{ size_t const headerSize = ZSTD_frameHeaderSize(headerBuffer, numBytesRead);
|
{ size_t const headerSize = ZSTD_frameHeaderSize(headerBuffer, numBytesRead);
|
||||||
@ -2887,6 +2894,7 @@ displayInfo(const char* inFileName, const fileInfo_t* info, int displayLevel)
|
|||||||
DISPLAYOUT("# Zstandard Frames: %d\n", info->numActualFrames);
|
DISPLAYOUT("# Zstandard Frames: %d\n", info->numActualFrames);
|
||||||
if (info->numSkippableFrames)
|
if (info->numSkippableFrames)
|
||||||
DISPLAYOUT("# Skippable Frames: %d\n", info->numSkippableFrames);
|
DISPLAYOUT("# Skippable Frames: %d\n", info->numSkippableFrames);
|
||||||
|
DISPLAYOUT("DictID: %u\n", info->dictID);
|
||||||
DISPLAYOUT("Window Size: %.*f%s (%llu B)\n",
|
DISPLAYOUT("Window Size: %.*f%s (%llu B)\n",
|
||||||
window_hrs.precision, window_hrs.value, window_hrs.suffix,
|
window_hrs.precision, window_hrs.value, window_hrs.suffix,
|
||||||
(unsigned long long)info->windowSize);
|
(unsigned long long)info->windowSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user