Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nanopb/nanopb.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-11 14:42:56 +0400
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-11 14:42:56 +0400
commitd395768c8d3e63125c15950434fa255fb8c57717 (patch)
tree2f6994c7f3f9484ee4f173bfb52adde6c1a8253d /tests/alltypes/decode_alltypes.c
parentb9f14bddf778a5ed27e3289b90a0657fec3e1a53 (diff)
Windows build fixes
Diffstat (limited to 'tests/alltypes/decode_alltypes.c')
-rw-r--r--tests/alltypes/decode_alltypes.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/alltypes/decode_alltypes.c b/tests/alltypes/decode_alltypes.c
index 55d025c..ee2e115 100644
--- a/tests/alltypes/decode_alltypes.c
+++ b/tests/alltypes/decode_alltypes.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <pb_decode.h>
#include "alltypes.pb.h"
+#include "test_helpers.h"
#define TEST(x) if (!(x)) { \
printf("Test " #x " failed.\n"); \
@@ -176,15 +177,19 @@ bool check_alltypes(pb_istream_t *stream, int mode)
int main(int argc, char **argv)
{
+ uint8_t buffer[1024];
+ size_t count;
+ pb_istream_t stream;
+
/* Whether to expect the optional values or the default values. */
int mode = (argc > 1) ? atoi(argv[1]) : 0;
/* Read the data into buffer */
- uint8_t buffer[1024];
- size_t count = fread(buffer, 1, sizeof(buffer), stdin);
+ SET_BINARY_MODE(stdin);
+ count = fread(buffer, 1, sizeof(buffer), stdin);
/* Construct a pb_istream_t for reading from the buffer */
- pb_istream_t stream = pb_istream_from_buffer(buffer, count);
+ stream = pb_istream_from_buffer(buffer, count);
/* Decode and print out the stuff */
if (!check_alltypes(&stream, mode))