diff options
author | Christopher Ferris <cferris@google.com> | 2018-07-27 19:17:07 +0000 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-07-27 12:33:26 -0700 |
commit | 72d4ea3f96eab1930d75891cb5df15ea7fb0e614 (patch) | |
tree | c28e65883c2587f3f19a80e40020ad89ba49dabd /pb_common.c | |
parent | 798b76ea4d3564d2b92fc84da3cbedf0fbdba580 (diff) | |
download | nanopb-c-72d4ea3f96eab1930d75891cb5df15ea7fb0e614.tar.gz |
Revert "Upgrade nanopb to 0.3.9.1"android-n-iot-release-smart-display-r2
This reverts commit 56ebba603b8b913261a40f3f61561bb728e3eaa5.
Reason for revert: Caused build failures.
Examples of build failures:
FAILED: out/target/product/vsoc_x86/gen/STATIC_LIBRARIES/librilutils_static_intermediates/proto/hardware/ril/librilutils/proto/sap-api.pb.c
/bin/bash -c "(PATH=\$PATH:out/host/linux-x86/bin out/host/linux-x86/bin/aprotoc --proto_path=. --nanopb_out=out/target/product/vsoc_x86/gen/STATIC_LIBRARIES/librilutils_static_intermediates/proto --plugin=external/nanopb-c/generator/protoc-gen-nanopb hardware/ril/librilutils/proto/sap-api.proto )"
[libprotobuf WARNING external/protobuf/src/google/protobuf/compiler/parser.cc:547] No syntax specified for the proto file: hardware/ril/librilutils/proto/sap-api.proto. Please use 'syntax = "proto2";' or 'syntax = "proto3";' to specify a syntax version. (Defaulted to proto2 syntax.)
Change-Id: Id862b050b2de4410bc9facf6d9920d3e878b227e
Diffstat (limited to 'pb_common.c')
-rw-r--r-- | pb_common.c | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/pb_common.c b/pb_common.c deleted file mode 100644 index 4fb7186..0000000 --- a/pb_common.c +++ /dev/null @@ -1,97 +0,0 @@ -/* pb_common.c: Common support functions for pb_encode.c and pb_decode.c. - * - * 2014 Petteri Aimonen <jpa@kapsi.fi> - */ - -#include "pb_common.h" - -bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct) -{ - iter->start = fields; - iter->pos = fields; - iter->required_field_index = 0; - iter->dest_struct = dest_struct; - iter->pData = (char*)dest_struct + iter->pos->data_offset; - iter->pSize = (char*)iter->pData + iter->pos->size_offset; - - return (iter->pos->tag != 0); -} - -bool pb_field_iter_next(pb_field_iter_t *iter) -{ - const pb_field_t *prev_field = iter->pos; - - if (prev_field->tag == 0) - { - /* Handle empty message types, where the first field is already the terminator. - * In other cases, the iter->pos never points to the terminator. */ - return false; - } - - iter->pos++; - - if (iter->pos->tag == 0) - { - /* Wrapped back to beginning, reinitialize */ - (void)pb_field_iter_begin(iter, iter->start, iter->dest_struct); - return false; - } - else - { - /* Increment the pointers based on previous field size */ - size_t prev_size = prev_field->data_size; - - if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF && - PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF && - iter->pos->data_offset == PB_SIZE_MAX) - { - /* Don't advance pointers inside unions */ - return true; - } - else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC && - PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED) - { - /* In static arrays, the data_size tells the size of a single entry and - * array_size is the number of entries */ - prev_size *= prev_field->array_size; - } - else if (PB_ATYPE(prev_field->type) == PB_ATYPE_POINTER) - { - /* Pointer fields always have a constant size in the main structure. - * The data_size only applies to the dynamically allocated area. */ - prev_size = sizeof(void*); - } - - if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED) - { - /* Count the required fields, in order to check their presence in the - * decoder. */ - iter->required_field_index++; - } - - iter->pData = (char*)iter->pData + prev_size + iter->pos->data_offset; - iter->pSize = (char*)iter->pData + iter->pos->size_offset; - return true; - } -} - -bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag) -{ - const pb_field_t *start = iter->pos; - - do { - if (iter->pos->tag == tag && - PB_LTYPE(iter->pos->type) != PB_LTYPE_EXTENSION) - { - /* Found the wanted field */ - return true; - } - - (void)pb_field_iter_next(iter); - } while (iter->pos != start); - - /* Searched all the way back to start, and found nothing. */ - return false; -} - - |