diff options
author | Joshua Haberman <jhaberman@gmail.com> | 2018-03-06 17:31:39 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-06 17:31:39 -0800 |
commit | a66159a384dba6273ebdfd04ce6623d4b7e0a75e (patch) | |
tree | be9f5460fa96e5e8690f5230a779d64c74e6abd8 /upb/decode.c | |
parent | bcb62b7fbfb0c959f7d3671b40c1b7efbb3a4156 (diff) | |
parent | cafebf6beede670a10535809667ac9b9f3033091 (diff) |
Merge pull request #96 from TeBoring/php-change
For encoding upb needs descriptor type instead of type.
Diffstat (limited to 'upb/decode.c')
-rw-r--r-- | upb/decode.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/upb/decode.c b/upb/decode.c index 3e782d7..a4da9a9 100644 --- a/upb/decode.c +++ b/upb/decode.c @@ -4,7 +4,7 @@ #include "upb/structs.int.h" /* Maps descriptor type -> upb field type. */ -static const uint8_t upb_desctype_to_fieldtype[] = { +const uint8_t upb_desctype_to_fieldtype[] = { UPB_WIRE_TYPE_END_GROUP, /* ENDGROUP */ UPB_TYPE_DOUBLE, /* DOUBLE */ UPB_TYPE_FLOAT, /* FLOAT */ @@ -216,7 +216,7 @@ static upb_array *upb_getorcreatearr(upb_decstate *d, if (!arr) { return NULL; } - upb_array_init(arr, upb_desctype_to_fieldtype[field->type], + upb_array_init(arr, upb_desctype_to_fieldtype[field->descriptortype], upb_arena_alloc(upb_env_arena(d->env))); *(upb_array**)&frame->msg[field->offset] = arr; } @@ -299,7 +299,7 @@ static bool upb_decode_varintfield(upb_decstate *d, upb_decframe *frame, CHK(field_mem); CHK(upb_decode_varint(&d->ptr, frame->limit, &val)); - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_INT64: case UPB_DESCRIPTOR_TYPE_UINT64: memcpy(field_mem, &val, sizeof(val)); @@ -344,7 +344,7 @@ static bool upb_decode_64bitfield(upb_decstate *d, upb_decframe *frame, CHK(field_mem); CHK(upb_decode_64bit(&d->ptr, frame->limit, &val)); - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_DOUBLE: case UPB_DESCRIPTOR_TYPE_FIXED64: case UPB_DESCRIPTOR_TYPE_SFIXED64: @@ -368,7 +368,7 @@ static bool upb_decode_32bitfield(upb_decstate *d, upb_decframe *frame, CHK(field_mem); CHK(upb_decode_32bit(&d->ptr, frame->limit, &val)); - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_FLOAT: case UPB_DESCRIPTOR_TYPE_FIXED32: case UPB_DESCRIPTOR_TYPE_SFIXED32: @@ -416,7 +416,7 @@ static bool upb_decode_toarray(upb_decstate *d, upb_decframe *frame, return true; \ } - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { void *field_mem = upb_array_add(arr, 1); @@ -466,7 +466,7 @@ static bool upb_decode_delimitedfield(upb_decstate *d, upb_decframe *frame, if (field->label == UPB_LABEL_REPEATED) { return upb_decode_toarray(d, frame, field_start, field, val); } else { - switch ((upb_descriptortype_t)field->type) { + switch ((upb_descriptortype_t)field->descriptortype) { case UPB_DESCRIPTOR_TYPE_STRING: case UPB_DESCRIPTOR_TYPE_BYTES: { void *field_mem = upb_decode_prepareslot(d, frame, field); @@ -520,7 +520,7 @@ static bool upb_decode_field(upb_decstate *d, upb_decframe *frame) { case UPB_WIRE_TYPE_DELIMITED: return upb_decode_delimitedfield(d, frame, field_start, field); case UPB_WIRE_TYPE_START_GROUP: - CHK(field->type == UPB_DESCRIPTOR_TYPE_GROUP); + CHK(field->descriptortype == UPB_DESCRIPTOR_TYPE_GROUP); return upb_decode_submsg(d, frame, frame->limit, field, field_number); case UPB_WIRE_TYPE_END_GROUP: CHK(frame->group_number == field_number) |