Rizin
unix-like reverse engineering framework and cli tools
|
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "xxhash.h"
#include "lz4.h"
#include "lz4hc.h"
Go to the source code of this file.
Macros | |
#define | MIN_CLEVEL (int)(-5) |
#define | MIN(a, b) ( (a) < (b) ? (a) : (b) ) |
#define | MSG(...) fprintf(stderr, __VA_ARGS__) |
#define | CONTROL_MSG(c, ...) |
Typedefs | |
typedef int(* | compressFn) (const char *src, char *dst, int srcSize, int dstSize, int cLevel) |
Functions | |
static size_t | checkBuffers (const void *buff1, const void *buff2, size_t buffSize) |
static int | select_clevel (const void *refBuff, size_t refBuffSize) |
static void | roundTripTest (void *resultBuff, size_t resultBuffCapacity, void *compressedBuff, size_t compressedBuffCapacity, const void *srcBuff, size_t srcSize, int clevel) |
static void | roundTripCheck (const void *srcBuff, size_t srcSize, int clevel) |
static size_t | getFileSize (const char *infilename) |
static int | isDirectory (const char *infilename) |
static void | loadFile (void *buffer, const char *fileName, size_t fileSize) |
static void | fileCheck (const char *fileName, int clevel) |
int | bad_usage (const char *exeName) |
int | main (int argCount, const char **argv) |
#define CONTROL_MSG | ( | c, | |
... | |||
) |
Definition at line 52 of file roundTripTest.c.
#define MIN_CLEVEL (int)(-5) |
Definition at line 24 of file roundTripTest.c.
#define MSG | ( | ... | ) | fprintf(stderr, __VA_ARGS__) |
Definition at line 50 of file roundTripTest.c.
Definition at line 90 of file roundTripTest.c.
Definition at line 202 of file roundTripTest.c.
References test-lz4-list::exit, test-lz4-speed::fileName, free(), getFileSize(), loadFile(), malloc(), MSG, and roundTripCheck().
Referenced by main().
Definition at line 148 of file roundTripTest.c.
References r, S_ISREG, and stat.
Referenced by fileCheck().
Definition at line 164 of file roundTripTest.c.
References r, S_ISDIR, and stat.
Referenced by loadFile().
loadFile() : requirement : buffer
size >= fileSize
Definition at line 182 of file roundTripTest.c.
References test-lz4-list::exit, f, benchmark::FILE, test-lz4-speed::fileName, isDirectory(), MSG, and NULL.
Referenced by fileCheck().
Definition at line 229 of file roundTripTest.c.
References argv, assert(), bad_usage(), fileCheck(), and MSG.
Definition at line 127 of file roundTripTest.c.
References test-lz4-list::exit, free(), LZ4_compressBound(), malloc(), roundTripTest(), and srcSize.
Referenced by fileCheck().
|
static |
roundTripTest() : Compresses srcBuff
into compressedBuff
, then decompresses compressedBuff
into resultBuff
. If clevel==0, compression level is derived from srcBuff's content head bytes. This function abort() if it detects any round-trip error. Therefore, if it returns, round trip is considered successfully validated. Note : compressedBuffCapacity
should be >= LZ4_compressBound(srcSize)
for compression to be guaranteed to work
Definition at line 101 of file roundTripTest.c.
References assert(), checkBuffers(), compress(), CONTROL_MSG, LZ4_compress_fast(), LZ4_compress_HC(), LZ4_decompress_safe(), LZ4HC_CLEVEL_MIN, select_clevel(), and srcSize.
Referenced by roundTripCheck().
Definition at line 77 of file roundTripTest.c.
References LZ4HC_CLEVEL_MAX, MIN, MIN_CLEVEL, and XXH32().
Referenced by roundTripTest().