diff --git a/TinyFrame.c b/TinyFrame.c index a960f66..be69d8e 100644 --- a/TinyFrame.c +++ b/TinyFrame.c @@ -145,8 +145,13 @@ static inline uint32_t crc32_byte(uint32_t cksum, const uint8_t byte) /** Init with a user-allocated buffer */ void _TF_FN TF_InitStatic(TinyFrame *tf, TF_Peer peer_bit) { - // Zero it out - memset(&tf, 0, sizeof(struct TinyFrame_)); + if (tf == NULL) return; + + // Zero it out, keeping user config + uint32_t usertag = tf->usertag; + memset(tf, 0, sizeof(struct TinyFrame_)); + tf->usertag = usertag; + tf->peer_bit = peer_bit; } @@ -833,11 +838,15 @@ void _TF_FN TF_Tick(TinyFrame *tf) /** Default impl for claiming write mutex; can be specific to the instance */ void __attribute__((weak)) TF_ClaimTx(TinyFrame *tf) { + (void) tf; + // do nothing } /** Default impl for releasing write mutex; can be specific to the instance */ void __attribute__((weak)) TF_ReleaseTx(TinyFrame *tf) { + (void) tf; + // do nothing } diff --git a/demo/multipart_tx/Makefile b/demo/multipart_tx/Makefile index 118c385..a132e80 100644 --- a/demo/multipart_tx/Makefile +++ b/demo/multipart_tx/Makefile @@ -1,11 +1,12 @@ CFILES=../utils.c ../../TinyFrame.c INCLDIRS=-I. -I.. -I../.. -CFLAGS=-O0 -ggdb --std=gnu99 -Wno-main -Wall -Wextra $(CFILES) $(INCLDIRS) +CFLAGS=-O0 -ggdb --std=gnu99 -Wno-main -Wall -Wno-unused -Wextra $(CFILES) $(INCLDIRS) -run: test.bin - ./test.bin build: test.bin +run: test.bin + ./test.bin + test.bin: test.c $(CFILES) gcc test.c $(CFLAGS) -o test.bin diff --git a/demo/multipart_tx/test.c b/demo/multipart_tx/test.c index b4f6363..a2c3a67 100644 --- a/demo/multipart_tx/test.c +++ b/demo/multipart_tx/test.c @@ -25,7 +25,7 @@ void TF_WriteImpl(TinyFrame *tf, const uint8_t *buff, size_t len) TF_Result myListener(TinyFrame *tf, TF_Msg *msg) { dumpFrameInfo(msg); - if (strcmp(msg->data, romeo) == 0) { + if (strcmp((const char *) msg->data, romeo) == 0) { printf("FILE TRANSFERRED OK!\r\n"); } else { diff --git a/demo/socket_demo/Makefile b/demo/socket_demo/Makefile index 6c3e627..d4f067b 100644 --- a/demo/socket_demo/Makefile +++ b/demo/socket_demo/Makefile @@ -1,6 +1,6 @@ CFILES=../demo.c ../utils.c ../../TinyFrame.c INCLDIRS=-I. -I.. -I../.. -CFLAGS=-O0 -ggdb --std=gnu99 -Wno-main -Wall -Wextra $(CFILES) $(INCLDIRS) +CFLAGS=-O0 -ggdb --std=gnu99 -Wno-main -Wall -Wno-unused -Wextra $(CFILES) $(INCLDIRS) build: master.bin slave.bin