Skip to content

Commit

Permalink
Merge pull request #19 from matthewberends/master
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan authored Sep 21, 2024
2 parents e79c939 + c90a1cc commit e74500e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion c_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ C_SRC_OUTPUT ?= $(CURDIR)/../priv/$(PROJECT)_nif.so


LZ4 ?= lz4
LZ4_VSN ?= 1.9.2
LZ4_VSN ?= 1.10.0
LZ4_SRC ?= $(LZ4)-$(LZ4_VSN)
LZ4_SRC_TAR ?= v$(LZ4_VSN).tar.gz
LZ4_SRC_PACKAGE_LINK ?= https://github.com/lz4/lz4/archive/$(LZ4_SRC_TAR)
Expand Down
13 changes: 4 additions & 9 deletions c_src/lz4b.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ static ERL_NIF_TERM frame_compress(ErlNifEnv* env, int argc, const ERL_NIF_TERM
return ERROR_ATOM("bad_preference");
}

if (bin.size < 4096)
{
cap = 4096;
} else {
cap = LZ4F_compressFrameBound((size_t) bin.size, pref);
}
cap = LZ4F_compressFrameBound((size_t) bin.size, pref);

if (!enif_alloc_binary(cap, &output)) {
free(pref);
Expand Down Expand Up @@ -359,9 +354,9 @@ int parse_edecompressOption(ErlNifEnv* env,
enif_get_uint(env, *(opts+1), (unsigned int *) stepsize);
enif_get_uint(env, *(opts+2), (unsigned int *) buffgrow_size);
enif_get_uint(env, *(opts+3), &(dccopt -> stableDst));
enif_get_uint(env, *(opts+4), &(dccopt -> reserved[0]));
enif_get_uint(env, *(opts+5), &(dccopt -> reserved[1]));
enif_get_uint(env, *(opts+6), &(dccopt -> reserved[2]));
enif_get_uint(env, *(opts+4), &(dccopt -> skipChecksums));
enif_get_uint(env, *(opts+5), &(dccopt -> reserved1));
enif_get_uint(env, *(opts+6), &(dccopt -> reserved0));
return 1;
}

Expand Down

0 comments on commit e74500e

Please sign in to comment.