aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pb_decode.c2
-rw-r--r--pb_encode.c4
-rw-r--r--tests/Makefile7
3 files changed, 8 insertions, 5 deletions
diff --git a/pb_decode.c b/pb_decode.c
index 458d5f1e..e183be7d 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -409,7 +409,7 @@ static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_str
bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct)
{
- uint8_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 7) / 8] = {}; /* Used to check for required fields */
+ uint8_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 7) / 8] = {0}; /* Used to check for required fields */
pb_field_iterator_t iter;
pb_message_set_to_defaults(fields, dest_struct);
diff --git a/pb_encode.c b/pb_encode.c
index be909ec2..8868bb64 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -99,7 +99,7 @@ static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *fie
}
else
{
- pb_ostream_t sizestream = {0};
+ pb_ostream_t sizestream = {0,0,0,0};
p = pData;
for (i = 0; i < count; i++)
{
@@ -314,7 +314,7 @@ bool checkreturn pb_encode_string(pb_ostream_t *stream, const uint8_t *buffer, s
bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct)
{
/* First calculate the message size using a non-writing substream. */
- pb_ostream_t substream = {0};
+ pb_ostream_t substream = {0,0,0,0};
size_t size;
bool status;
diff --git a/tests/Makefile b/tests/Makefile
index 8c063f30..5a5d94ab 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,6 +3,9 @@ LDFLAGS=--coverage
DEPS=../pb_decode.h ../pb_encode.h ../pb.h person.pb.h callbacks.pb.h unittests.h unittestproto.pb.h alltypes.pb.h missing_fields.pb.h
TESTS=test_decode1 test_encode1 decode_unittests encode_unittests test_no_messages
+# More strict checks for the core part of nanopb
+CFLAGS_CORE=-pedantic -Wextra
+
all: breakpoints $(TESTS) run_unittests
clean:
@@ -13,9 +16,9 @@ clean:
$(CC) $(CFLAGS) -c -o $@ $<
pb_encode.o: ../pb_encode.c $(DEPS)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
pb_decode.o: ../pb_decode.c $(DEPS)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CFLAGS_CORE) -c -o $@ $<
test_decode1: test_decode1.o pb_decode.o person.pb.o
test_decode2: test_decode2.o pb_decode.o person.pb.o