diff --git a/src/external/nanopb/AUTHORS.txt b/src/external/nanopb/AUTHORS.txt index d966e4c12..c079cb009 100644 --- a/src/external/nanopb/AUTHORS.txt +++ b/src/external/nanopb/AUTHORS.txt @@ -63,9 +63,7 @@ Joshua Salzedo Adam Klama Anton Matosov berni155 -bolind David Lin -dch devjoa Evan Fisher Fay @@ -100,7 +98,7 @@ Jakub Tymejczyk Matthew Simmons Anthony Pesch Avik De -ConradWood +Conrad Wood David Sabatie Sebastian Stockhammer Gil Shapira @@ -114,3 +112,12 @@ Oleg Dolgy <60554929+odolgy@users.noreply.github.com> Pavel Sokolov Slavey Karadzhov Tobias Nießen +Christian Balcom +Christopher Hughes <67643395+chughes-pika@users.noreply.github.com> +Greg Balke +Jussi Keränen +Krzysztof Rosinski +Nathaniel Brough +Sean Kahler +Valerii Koval +Gediminas Žukaitis diff --git a/src/external/nanopb/COMMIT.txt b/src/external/nanopb/COMMIT.txt index 1c2f10fde..2aee99f34 100644 --- a/src/external/nanopb/COMMIT.txt +++ b/src/external/nanopb/COMMIT.txt @@ -1 +1 @@ -nanopb-0.4.6-20-g23993cf +nanopb-0.4.7 diff --git a/src/external/nanopb/pb.h b/src/external/nanopb/pb.h index a180379c8..5b3e1efa5 100644 --- a/src/external/nanopb/pb.h +++ b/src/external/nanopb/pb.h @@ -65,7 +65,7 @@ /* Version of the nanopb library. Just in case you want to check it in * your own program. */ -#define NANOPB_VERSION "nanopb-0.4.7-dev" +#define NANOPB_VERSION "nanopb-0.4.7" /* Include all the system headers needed by nanopb. You will need the * definitions of the following: @@ -178,9 +178,6 @@ extern "C" { # elif defined(__cplusplus) /* C++11 standard static_assert mechanism */ # define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); -# elif defined(_MSC_VER) - /* Required to work on MSVC */ -# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); # else /* C11 standard _Static_assert mechanism */ # define PB_STATIC_ASSERT(COND,MSG) _Static_assert(COND,#MSG); @@ -905,10 +902,13 @@ struct pb_extension_s { #define PB_INLINE_CONSTEXPR PB_CONSTEXPR #endif // __cplusplus >= 201703L +extern "C++" +{ namespace nanopb { // Each type will be partially specialized by the generator. template struct MessageDescriptor; } // namespace nanopb +} #endif /* __cplusplus */ #endif diff --git a/src/external/nanopb/pb_decode.c b/src/external/nanopb/pb_decode.c index 5405c87dd..788998eb9 100644 --- a/src/external/nanopb/pb_decode.c +++ b/src/external/nanopb/pb_decode.c @@ -111,7 +111,11 @@ bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) return false; #endif - stream->bytes_left -= count; + if (stream->bytes_left < count) + stream->bytes_left = 0; + else + stream->bytes_left -= count; + return true; } @@ -1327,6 +1331,13 @@ void pb_release(const pb_msgdesc_t *fields, void *dest_struct) pb_release_single_field(&iter); } while (pb_field_iter_next(&iter)); } +#else +void pb_release(const pb_msgdesc_t *fields, void *dest_struct) +{ + /* Nothing to release without PB_ENABLE_MALLOC. */ + PB_UNUSED(fields); + PB_UNUSED(dest_struct); +} #endif /* Field decoders */ diff --git a/src/external/nanopb/pb_decode.h b/src/external/nanopb/pb_decode.h index 824acd4ea..ae1d3ccf2 100644 --- a/src/external/nanopb/pb_decode.h +++ b/src/external/nanopb/pb_decode.h @@ -107,17 +107,11 @@ bool pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_s #define pb_decode_delimited_noinit(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_DELIMITED | PB_DECODE_NOINIT) #define pb_decode_nullterminated(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_NULLTERMINATED) -#ifdef PB_ENABLE_MALLOC /* Release any allocated pointer fields. If you use dynamic allocation, you should * call this for any successfully decoded message when you are done with it. If * pb_decode() returns with an error, the message is already released. */ void pb_release(const pb_msgdesc_t *fields, void *dest_struct); -#else -/* Allocation is not supported, so release is no-op */ -#define pb_release(fields, dest_struct) PB_UNUSED(fields); PB_UNUSED(dest_struct); -#endif - /************************************** * Functions for manipulating streams *