Build fixes for Windows/Visual C++
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
Import("env")
|
||||
|
||||
env.NanopbProto("alltypes")
|
||||
env.Program(["encode_alltypes.c", "alltypes.pb.c", "#common/pb_encode.o"])
|
||||
env.Program(["decode_alltypes.c", "alltypes.pb.c", "#common/pb_decode.o"])
|
||||
enc = env.Program(["encode_alltypes.c", "alltypes.pb.c", "#common/pb_encode.o"])
|
||||
dec = env.Program(["decode_alltypes.c", "alltypes.pb.c", "#common/pb_decode.o"])
|
||||
|
||||
env.RunTest("encode_alltypes")
|
||||
env.RunTest(["decode_alltypes", "encode_alltypes.output"])
|
||||
env.RunTest(enc)
|
||||
env.RunTest([dec, "encode_alltypes.output"])
|
||||
|
||||
|
||||
@@ -113,18 +113,20 @@ 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: %s\n", PB_GET_ERROR(&stream));
|
||||
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))
|
||||
{
|
||||
fwrite(buffer, 1, stream.bytes_written, stdout);
|
||||
return 0; /* Success */
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Encoding failed: %s\n", PB_GET_ERROR(&stream));
|
||||
return 1; /* Failure */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user