diff --git a/.gitignore b/.gitignore index 91e7bad..bd31a53 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ !**/ *.o +*.a .cproject .project .settings/language.settings.xml diff --git a/Makefile b/Makefile index 12ffce8..76d0867 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ +DEBUG=true + CC = gcc RM = rm -f -CFLAGS = -fPIC -g -O2 -std=c99 \ +CFLAGS = -fPIC -O0 -std=c99 \ -Wall -Wextra -pedantic -Werror \ -Wdeclaration-after-statement \ -Wno-format-zero-length \ @@ -10,10 +12,14 @@ CFLAGS = -fPIC -g -O2 -std=c99 \ -Wunused \ -Wvla +ifdef DEBUG +CFLAGS += -g3 +endif + LDFLAGS = -g LDLIBS = -TARGET_LIB = mulithash.a +TARGET_LIB = libmultihash.a TARGET_BIN = multihash SRCS = src/hashes.c src/errors.c src/multihash.c diff --git a/include/mh/multihash.h b/include/mh/multihash.h index 5ac32a5..247736c 100644 --- a/include/mh/multihash.h +++ b/include/mh/multihash.h @@ -44,7 +44,7 @@ int mh_new_length(int code, size_t digest_len); * @param digest the data within the multihash * @returns error (if < 0) or 0 */ -int mh_new(unsigned char *buffer, int code, const unsigned char *digest, +int mh_new(unsigned char* buffer, int code, const unsigned char *digest, size_t digest_len); #endif /* end of include guard */ diff --git a/src/multihash.c b/src/multihash.c index 1d29d9d..6f61a24 100644 --- a/src/multihash.c +++ b/src/multihash.c @@ -117,7 +117,7 @@ int mh_new_length(int code, size_t hash_len) { * @param digest the data within the multihash * @returns error (if < 0) or 0 */ -int mh_new(unsigned char *buffer, int code, const unsigned char *digest, +int mh_new(unsigned char* buffer, int code, const unsigned char *digest, size_t digest_len) { if (code & VARINT_MASK) return MH_E_VARINT_NOT_SUPPORTED;