summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-25 21:47:24 +0200
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2017-02-25 21:47:24 +0200
commit019d7bf948fc0d14b310fa397948ac550858af77 (patch)
tree24565349e6106bc6201650ab477facc7b8f184df
parente5f420cf768becd1f7b2dd591151bb6f948023b3 (diff)
Fix build failure (const_cast name conflict)
Thought I was cleaning up the naming by calling the function const_cast(), because that's what it does. But of course it conflicts with the C++ builtin, so renaming it to pb_const_cast() now.
-rw-r--r--pb_encode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/pb_encode.c b/pb_encode.c
index e1f37f6d..30f60d83 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -27,7 +27,7 @@ static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *fie
static bool checkreturn encode_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData);
static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *extension);
static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData);
-static void *const_cast(const void *p);
+static void *pb_const_cast(const void *p);
static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src);
static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src);
static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src);
@@ -230,7 +230,7 @@ static bool pb_check_proto3_default_value(const pb_field_t *field, const void *p
* be skipped.
*/
pb_field_iter_t iter;
- if (pb_field_iter_begin(&iter, (const pb_field_t*)field->ptr, const_cast(pData)))
+ if (pb_field_iter_begin(&iter, (const pb_field_t*)field->ptr, pb_const_cast(pData)))
{
do
{
@@ -436,7 +436,7 @@ static bool checkreturn encode_extension_field(pb_ostream_t *stream,
* Encode all fields *
*********************/
-static void *const_cast(const void *p)
+static void *pb_const_cast(const void *p)
{
/* Note: this casts away const, in order to use the common field iterator
* logic for both encoding and decoding. */
@@ -451,7 +451,7 @@ static void *const_cast(const void *p)
bool checkreturn pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct)
{
pb_field_iter_t iter;
- if (!pb_field_iter_begin(&iter, fields, const_cast(src_struct)))
+ if (!pb_field_iter_begin(&iter, fields, pb_const_cast(src_struct)))
return true; /* Empty message type */
do {