diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-09-11 13:16:20 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-09-11 13:16:20 +0300 |
commit | b9f14bddf778a5ed27e3289b90a0657fec3e1a53 (patch) | |
tree | 972d67e547f1816d3dbe0643ea8add734ef8e90e /tests/backwards_compatibility | |
parent | e2e9980627810fe0ee2b8f119bcf651f0f318a8a (diff) |
Make all the tests ANSI C compatible.
Diffstat (limited to 'tests/backwards_compatibility')
-rw-r--r-- | tests/backwards_compatibility/encode_legacy.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/tests/backwards_compatibility/encode_legacy.c b/tests/backwards_compatibility/encode_legacy.c index 0e313093..5c9d41b3 100644 --- a/tests/backwards_compatibility/encode_legacy.c +++ b/tests/backwards_compatibility/encode_legacy.c @@ -9,6 +9,7 @@ #include <string.h> #include <pb_encode.h> #include "alltypes_legacy.h" +#include "test_helpers.h" int main(int argc, char **argv) { @@ -113,19 +114,22 @@ int main(int argc, char **argv) } alltypes.end = 1099; - - uint8_t buffer[1024]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - - /* Now encode it and check if we succeeded. */ - if (pb_encode(&stream, AllTypes_fields, &alltypes)) - { - fwrite(buffer, 1, stream.bytes_written, stdout); - return 0; /* Success */ - } - else - { - fprintf(stderr, "Encoding failed!\n"); - return 1; /* Failure */ + + { + uint8_t buffer[1024]; + pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); + + /* Now encode it and check if we succeeded. */ + if (pb_encode(&stream, AllTypes_fields, &alltypes)) + { + SET_BINARY_MODE(stdout); + fwrite(buffer, 1, stream.bytes_written, stdout); + return 0; /* Success */ + } + else + { + fprintf(stderr, "Encoding failed!\n"); + return 1; /* Failure */ + } } } |