Merge branch 'master' of https://code.google.com/p/nanopb
This commit is contained in:
@@ -30,7 +30,7 @@ bool printfile_callback(pb_istream_t *stream, const pb_field_t *field, void *arg
|
|||||||
if (!pb_decode(stream, FileInfo_fields, &fileinfo))
|
if (!pb_decode(stream, FileInfo_fields, &fileinfo))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
printf("%-10lld %s\n", fileinfo.inode, fileinfo.name);
|
printf("%-10lld %s\n", (long long)fileinfo.inode, fileinfo.name);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
static bool write_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count)
|
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;
|
return send(fd, buf, count, 0) == count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool read_callback(pb_istream_t *stream, uint8_t *buf, size_t 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;
|
int result;
|
||||||
|
|
||||||
if (buf == NULL)
|
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 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;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
pb_istream_t pb_istream_from_socket(int fd)
|
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;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user