From 391bfce39b19b3f46967708e300d263053a9e54d Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Wed, 21 Dec 2016 06:39:13 -0500 Subject: [PATCH] Added method to keep the interface consistent --- protobuf.c | 5 +++++ protobuf.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/protobuf.c b/protobuf.c index b2012ba..d80383f 100644 --- a/protobuf.c +++ b/protobuf.c @@ -97,6 +97,11 @@ int protobuf_encode_varint(int field_number, enum WireType field_type, unsigned } +int protobuf_decode_varint(const unsigned char* buffer, size_t buffer_length, unsigned long long* results, size_t* bytes_read) { + *results = varint_decode(buffer, buffer_length, bytes_read); + return 1; +} + /** * Pull a string from the protobuf buffer * @param the buffer, positioned at the field size diff --git a/protobuf.h b/protobuf.h index 0aa1d73..c62573b 100644 --- a/protobuf.h +++ b/protobuf.h @@ -71,6 +71,8 @@ int protobuf_decode_string(const unsigned char* buffer, size_t buffer_length, ch int protobuf_encode_varint(int field_number, enum WireType field_type, unsigned long long incoming, unsigned char* buffer, size_t max_buffer_length, size_t* bytes_written); +int protobuf_decode_varint(const unsigned char* buffer, size_t buffer_length, unsigned long long* results, size_t* bytes_read); + /*** * retrieve field number and field type from current buffer at position 0 * @param buffer the incoming buffer