aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_decode2.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-10-18 19:45:28 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-10-18 19:45:28 +0300
commitdcab39a41c0a403db38860c22426075e6ae9f25d (patch)
tree7f1824628371ec59353b0765a209e6e5518401f7 /tests/test_decode2.c
parent900c8dd1252afe2b2474b852ae48dcb46e100505 (diff)
Remove the "buf = NULL" => skip requirement from pb_istream_t callbacks.
Rationale: it's easy to implement the callback wrong. Doing so introduces io errors when unknown fields are present in the input. If code is not tested with unknown fields, these bugs can remain hidden for long time. Added a special case for the memory buffer stream, where it gives a small speed benefit. Added testcase for skipping fields with test_decode2 implementation. Update issue 37 Status: FixedInGit
Diffstat (limited to 'tests/test_decode2.c')
-rw-r--r--tests/test_decode2.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/tests/test_decode2.c b/tests/test_decode2.c
index 762b2b3..2142977 100644
--- a/tests/test_decode2.c
+++ b/tests/test_decode2.c
@@ -59,13 +59,6 @@ bool callback(pb_istream_t *stream, uint8_t *buf, size_t count)
FILE *file = (FILE*)stream->state;
bool status;
- if (buf == NULL)
- {
- /* Skipping data */
- while (count-- && fgetc(file) != EOF);
- return count == 0;
- }
-
status = (fread(buf, 1, count, file) == count);
if (feof(file))