aboutsummaryrefslogtreecommitdiffstats
path: root/example/common.c
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-05-19 21:15:52 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-05-19 21:17:24 +0300
commitb94329088691538004f745a28e568d5ae1fba456 (patch)
treef3415c784fb28f4cc8dc7de62afc2e17a91fb6f7 /example/common.c
parentd1ca88d20ec1b205752546a40ef520a392d0002f (diff)
Fix 64-bitness warnings in the example.
Fixes issues 9 and 10.
Diffstat (limited to 'example/common.c')
-rw-r--r--example/common.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/example/common.c b/example/common.c
index 9d93219..b27ccae 100644
--- a/example/common.c
+++ b/example/common.c
@@ -10,13 +10,13 @@
static bool write_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count)
{
- int fd = (int)stream->state;
+ int fd = (intptr_t)stream->state;
return send(fd, buf, count, 0) == count;
}
static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count)
{
- int fd = (int)stream->state;
+ int fd = (intptr_t)stream->state;
int result;
if (buf == NULL)
@@ -38,12 +38,12 @@ static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t count)
pb_ostream_t pb_ostream_from_socket(int fd)
{
- pb_ostream_t stream = {&write_callback, (void*)fd, SIZE_MAX, 0};
+ pb_ostream_t stream = {&write_callback, (void*)(intptr_t)fd, SIZE_MAX, 0};
return stream;
}
pb_istream_t pb_istream_from_socket(int fd)
{
- pb_istream_t stream = {&read_callback, (void*)fd, SIZE_MAX};
+ pb_istream_t stream = {&read_callback, (void*)(intptr_t)fd, SIZE_MAX};
return stream;
}