mirror of
https://github.com/intel/isa-l.git
synced 2024-12-12 09:23:50 +01:00
tests: reformat using new code style
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This commit is contained in:
parent
ae951677ab
commit
9ab5a9e579
@ -6,7 +6,8 @@
|
||||
#include <assert.h>
|
||||
#include "igzip_lib.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
||||
int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
struct inflate_state state;
|
||||
z_stream zstate;
|
||||
@ -58,10 +59,10 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
||||
/* If zlib errors, assert isal errors, excluding a few
|
||||
* cases where zlib is overzealous and when zlib notices
|
||||
* an error faster than isal */
|
||||
assert(iret < 0 || strcmp(zstate.msg, z_msg_invalid_code_set) == 0
|
||||
|| strcmp(zstate.msg, z_msg_invalid_dist_set) == 0
|
||||
|| strcmp(zstate.msg, z_msg_invalid_lit_len_set) == 0
|
||||
|| (iret == ISAL_END_INPUT && zstate.avail_in < 3));
|
||||
assert(iret < 0 || strcmp(zstate.msg, z_msg_invalid_code_set) == 0 ||
|
||||
strcmp(zstate.msg, z_msg_invalid_dist_set) == 0 ||
|
||||
strcmp(zstate.msg, z_msg_invalid_lit_len_set) == 0 ||
|
||||
(iret == ISAL_END_INPUT && zstate.avail_in < 3));
|
||||
|
||||
} else
|
||||
/* If zlib did not finish or error, assert isal did not finish
|
||||
|
@ -6,7 +6,8 @@
|
||||
#define DNAME_MAX 256
|
||||
#define FNAME_MAX (DNAME_MAX + 81)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
uint8_t *buf;
|
||||
int i, len, err;
|
||||
|
@ -7,9 +7,11 @@
|
||||
#include "igzip_lib.h"
|
||||
#include "test.h"
|
||||
|
||||
extern int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size);
|
||||
extern int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
FILE *in = NULL;
|
||||
unsigned char *in_buf = NULL;
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include <stddef.h>
|
||||
#include "igzip_lib.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
||||
int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
struct inflate_state state;
|
||||
uint8_t *isal_out_buf = (uint8_t *) (malloc(size * 2));
|
||||
|
@ -34,7 +34,8 @@ const int trailer_size[] = {
|
||||
4, // IGZIP_ZLIB_NO_HDR
|
||||
};
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
||||
int
|
||||
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
{
|
||||
struct inflate_state istate;
|
||||
struct isal_zstream cstate;
|
||||
@ -58,23 +59,23 @@ int LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
|
||||
|
||||
switch (level) {
|
||||
case 0:
|
||||
lev_buf_size = ISAL_DEF_LVL0_MIN + (in_param) *
|
||||
(ISAL_DEF_LVL0_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
lev_buf_size = ISAL_DEF_LVL0_MIN +
|
||||
(in_param) * (ISAL_DEF_LVL0_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
break;
|
||||
case 1:
|
||||
lev_buf_size = ISAL_DEF_LVL1_MIN + (in_param) *
|
||||
(ISAL_DEF_LVL1_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
lev_buf_size = ISAL_DEF_LVL1_MIN +
|
||||
(in_param) * (ISAL_DEF_LVL1_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
break;
|
||||
#ifdef ISAL_DEF_LVL2_MIN
|
||||
case 2:
|
||||
lev_buf_size = ISAL_DEF_LVL2_MIN + (in_param) *
|
||||
(ISAL_DEF_LVL2_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
lev_buf_size = ISAL_DEF_LVL2_MIN +
|
||||
(in_param) * (ISAL_DEF_LVL2_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
break;
|
||||
#endif
|
||||
#ifdef ISAL_DEF_LVL3_MIN
|
||||
case 3:
|
||||
lev_buf_size = ISAL_DEF_LVL3_MIN + (in_param) *
|
||||
(ISAL_DEF_LVL3_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
lev_buf_size = ISAL_DEF_LVL3_MIN +
|
||||
(in_param) * (ISAL_DEF_LVL3_EXTRA_LARGE / LEVEL_BIT_MASK);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user