From 72c333eb037da6fe63358efe9c6dc29547b0ab49 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 19 Jul 2017 01:05:25 +0200 Subject: [PATCH] Fixed amalgamated build. --- upb/decode.c | 12 ++++++------ upb/encode.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/upb/decode.c b/upb/decode.c index 3f0b6d16f7..3c76e0f2e5 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -104,11 +104,11 @@ static bool upb_decode_tag(const char **ptr, const char *limit, return true; } -static int32_t upb_zzdec_32(uint32_t n) { +static int32_t upb_zzdecode_32(uint32_t n) { return (n >> 1) ^ -(int32_t)(n & 1); } -static int64_t upb_zzdec_64(uint64_t n) { +static int64_t upb_zzdecode_64(uint64_t n) { return (n >> 1) ^ -(int64_t)(n & 1); } @@ -317,12 +317,12 @@ static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame, break; } case UPB_DESCRIPTOR_TYPE_SINT32: { - int32_t decoded = upb_zzdec_32(val); + int32_t decoded = upb_zzdecode_32(val); memcpy(field_mem, &decoded, sizeof(decoded)); break; } case UPB_DESCRIPTOR_TYPE_SINT64: { - int64_t decoded = upb_zzdec_64(val); + int64_t decoded = upb_zzdecode_64(val); memcpy(field_mem, &decoded, sizeof(decoded)); break; } @@ -443,9 +443,9 @@ static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame, case UPB_DESCRIPTOR_TYPE_BOOL: VARINT_CASE(bool, bool); case UPB_DESCRIPTOR_TYPE_SINT32: - VARINT_CASE(int32_t, upb_zzdec_32); + VARINT_CASE(int32_t, upb_zzdecode_32); case UPB_DESCRIPTOR_TYPE_SINT64: - VARINT_CASE(int64_t, upb_zzdec_64); + VARINT_CASE(int64_t, upb_zzdecode_64); case UPB_DESCRIPTOR_TYPE_MESSAGE: CHK(val.size <= (size_t)(frame->limit - val.data)); return upb_decode_submsg(d, frame, val.data + val.size, field, 0); diff --git a/upb/encode.c b/upb/encode.c index d41b0edbf0..5acb492afa 100644 --- a/upb/encode.c +++ b/upb/encode.c @@ -8,7 +8,7 @@ #define CHK(x) do { if (!(x)) { return false; } } while(0) /* Maps descriptor type -> upb field type. */ -static const uint8_t upb_desctype_to_fieldtype[] = { +static const uint8_t upb_desctype_to_fieldtype2[] = { UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */ UPB_TYPE_DOUBLE, /* DOUBLE */ UPB_TYPE_FLOAT, /* FLOAT */ @@ -43,8 +43,8 @@ static size_t upb_encode_varint(uint64_t val, char *buf) { return i; } -static uint32_t upb_zzenc_32(int32_t n) { return (n << 1) ^ (n >> 31); } -static uint64_t upb_zzenc_64(int64_t n) { return (n << 1) ^ (n >> 63); } +static uint32_t upb_zzencode_32(int32_t n) { return (n << 1) ^ (n >> 31); } +static uint64_t upb_zzencode_64(int64_t n) { return (n << 1) ^ (n >> 63); } typedef struct { upb_env *env; @@ -162,7 +162,7 @@ static bool upb_encode_array(upb_encstate *e, const char *field_mem, return true; } - UPB_ASSERT(arr->type == upb_desctype_to_fieldtype[f->type]); + UPB_ASSERT(arr->type == upb_desctype_to_fieldtype2[f->type]); #define VARINT_CASE(ctype, encode) { \ ctype *start = arr->data; \ @@ -202,9 +202,9 @@ do { ; } while(0) case UPB_DESCRIPTOR_TYPE_BOOL: VARINT_CASE(bool, *ptr); case UPB_DESCRIPTOR_TYPE_SINT32: - VARINT_CASE(int32_t, upb_zzenc_32(*ptr)); + VARINT_CASE(int32_t, upb_zzencode_32(*ptr)); case UPB_DESCRIPTOR_TYPE_SINT64: - VARINT_CASE(int64_t, upb_zzenc_64(*ptr)); + VARINT_CASE(int64_t, upb_zzencode_64(*ptr)); case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { upb_stringview *start = arr->data; @@ -288,9 +288,9 @@ static bool upb_encode_scalarfield(upb_encstate *e, const char *field_mem, case UPB_DESCRIPTOR_TYPE_BOOL: CASE(bool, varint, UPB_WIRE_TYPE_VARINT, val); case UPB_DESCRIPTOR_TYPE_SINT32: - CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzenc_32(val)); + CASE(int32_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_32(val)); case UPB_DESCRIPTOR_TYPE_SINT64: - CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzenc_64(val)); + CASE(int64_t, varint, UPB_WIRE_TYPE_VARINT, upb_zzencode_64(val)); case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { upb_stringview view = *(upb_stringview*)field_mem;