1*c8d645caSAndroid Build Coastguard Worker===================================== 2*c8d645caSAndroid Build Coastguard WorkerNanopb: Migration from older versions 3*c8d645caSAndroid Build Coastguard Worker===================================== 4*c8d645caSAndroid Build Coastguard Worker 5*c8d645caSAndroid Build Coastguard Worker.. include :: menu.rst 6*c8d645caSAndroid Build Coastguard Worker 7*c8d645caSAndroid Build Coastguard WorkerThis document details all the breaking changes that have been made to nanopb 8*c8d645caSAndroid Build Coastguard Workersince its initial release. For each change, the rationale and required 9*c8d645caSAndroid Build Coastguard Workermodifications of user applications are explained. Also any error indications 10*c8d645caSAndroid Build Coastguard Workerare included, in order to make it easier to find this document. 11*c8d645caSAndroid Build Coastguard Worker 12*c8d645caSAndroid Build Coastguard Worker.. contents :: 13*c8d645caSAndroid Build Coastguard Worker 14*c8d645caSAndroid Build Coastguard WorkerNanopb-0.3.9.4, 0.4.0 (2019-xx-xx) 15*c8d645caSAndroid Build Coastguard Worker================================== 16*c8d645caSAndroid Build Coastguard Worker 17*c8d645caSAndroid Build Coastguard WorkerFix generation of min/max defines for enum types 18*c8d645caSAndroid Build Coastguard Worker------------------------------------------------ 19*c8d645caSAndroid Build Coastguard Worker 20*c8d645caSAndroid Build Coastguard Worker**Rationale:** Nanopb generator makes #defines for enum minimum and maximum 21*c8d645caSAndroid Build Coastguard Workervalue. Previously these defines incorrectly had the first and last enum value, 22*c8d645caSAndroid Build Coastguard Workerinstead of the actual minimum and maximum. (issue #405) 23*c8d645caSAndroid Build Coastguard Worker 24*c8d645caSAndroid Build Coastguard Worker**Changes:** Minimum define now always has the smallest value, and maximum 25*c8d645caSAndroid Build Coastguard Workerdefine always has the largest value. 26*c8d645caSAndroid Build Coastguard Worker 27*c8d645caSAndroid Build Coastguard Worker**Required actions:** If these defines are used and enum values in .proto file 28*c8d645caSAndroid Build Coastguard Workerare not defined in ascending order, user code behaviour may change. Check that 29*c8d645caSAndroid Build Coastguard Workeruser code doesn't expect the old, incorrect first/last behaviour. 30*c8d645caSAndroid Build Coastguard Worker 31*c8d645caSAndroid Build Coastguard WorkerFix undefined behavior related to bool fields 32*c8d645caSAndroid Build Coastguard Worker--------------------------------------------- 33*c8d645caSAndroid Build Coastguard Worker 34*c8d645caSAndroid Build Coastguard Worker**Rationale:** In C99, `bool` variables are not allowed to have other values 35*c8d645caSAndroid Build Coastguard Workerthan `true` and `false`. Compilers use this fact in optimization, and constructs 36*c8d645caSAndroid Build Coastguard Workerlike `int foo = msg.has_field ? 100 : 0` will give unexpected results otherwise. 37*c8d645caSAndroid Build Coastguard WorkerPreviously nanopb didn't enforce that decoded bool fields had valid values. 38*c8d645caSAndroid Build Coastguard Worker 39*c8d645caSAndroid Build Coastguard Worker**Changes:** Bool fields are now handled separately as `PB_LTYPE_BOOL`. The 40*c8d645caSAndroid Build Coastguard Worker`LTYPE` descriptor numbers for other field types were renumbered. 41*c8d645caSAndroid Build Coastguard Worker 42*c8d645caSAndroid Build Coastguard Worker**Required actions:** Source code files must be recompiled, but regenerating 43*c8d645caSAndroid Build Coastguard Worker`.pb.h`/`.pb.c` files from `.proto` is not required. If user code directly uses 44*c8d645caSAndroid Build Coastguard Workerthe nanopb internal field representation (search for `PB_LTYPE_VARINT` in source), 45*c8d645caSAndroid Build Coastguard Workerit may need updating. 46*c8d645caSAndroid Build Coastguard Worker 47*c8d645caSAndroid Build Coastguard WorkerNanopb-0.3.9.1, 0.4.0 (2018-04-14) 48*c8d645caSAndroid Build Coastguard Worker================================== 49*c8d645caSAndroid Build Coastguard Worker 50*c8d645caSAndroid Build Coastguard WorkerFix handling of string and bytes default values 51*c8d645caSAndroid Build Coastguard Worker----------------------------------------------- 52*c8d645caSAndroid Build Coastguard Worker 53*c8d645caSAndroid Build Coastguard Worker**Rationale:** Previously nanopb didn't properly decode special character 54*c8d645caSAndroid Build Coastguard Workerescapes like \\200 emitted by protoc. This caused these escapes to end up 55*c8d645caSAndroid Build Coastguard Workerverbatim in the default values in .pb.c file. 56*c8d645caSAndroid Build Coastguard Worker 57*c8d645caSAndroid Build Coastguard Worker**Changes:** Escapes are now decoded, and e.g. "\\200" or "\\x80" results in 58*c8d645caSAndroid Build Coastguard Worker{0x80} for bytes field and "\\x80" for string field. 59*c8d645caSAndroid Build Coastguard Worker 60*c8d645caSAndroid Build Coastguard Worker**Required actions:** If code has previously relied on '\\' in default value 61*c8d645caSAndroid Build Coastguard Workerbeing passed through verbatim, it must now be changed to '\\\\'. 62*c8d645caSAndroid Build Coastguard Worker 63*c8d645caSAndroid Build Coastguard WorkerNanopb-0.3.8 (2017-03-05) 64*c8d645caSAndroid Build Coastguard Worker========================= 65*c8d645caSAndroid Build Coastguard Worker 66*c8d645caSAndroid Build Coastguard WorkerFully drain substreams before closing 67*c8d645caSAndroid Build Coastguard Worker------------------------------------- 68*c8d645caSAndroid Build Coastguard Worker 69*c8d645caSAndroid Build Coastguard Worker**Rationale:** If the substream functions were called directly and the caller 70*c8d645caSAndroid Build Coastguard Workerdid not completely empty the substring before closing it, the parent stream 71*c8d645caSAndroid Build Coastguard Workerwould be put into an incorrect state. 72*c8d645caSAndroid Build Coastguard Worker 73*c8d645caSAndroid Build Coastguard Worker**Changes:** *pb_close_string_substream* can now error and returns a boolean. 74*c8d645caSAndroid Build Coastguard Worker 75*c8d645caSAndroid Build Coastguard Worker**Required actions:** Add error checking onto any call to 76*c8d645caSAndroid Build Coastguard Worker*pb_close_string_substream*. 77*c8d645caSAndroid Build Coastguard Worker 78*c8d645caSAndroid Build Coastguard WorkerChange oneof format in .pb.c files 79*c8d645caSAndroid Build Coastguard Worker---------------------------------- 80*c8d645caSAndroid Build Coastguard Worker 81*c8d645caSAndroid Build Coastguard Worker**Rationale:** Previously two oneofs in a single message would be erroneously 82*c8d645caSAndroid Build Coastguard Workerhandled as part of the same union. 83*c8d645caSAndroid Build Coastguard Worker 84*c8d645caSAndroid Build Coastguard Worker**Changes:** Oneofs fields now use special *PB_DATAOFFSET_UNION* offset type 85*c8d645caSAndroid Build Coastguard Workerin generated .pb.c files to distinguish whether they are the first or following 86*c8d645caSAndroid Build Coastguard Workerfield inside an union. 87*c8d645caSAndroid Build Coastguard Worker 88*c8d645caSAndroid Build Coastguard Worker**Required actions:** Regenerate *.pb.c/.pb.h* files with new nanopb version if 89*c8d645caSAndroid Build Coastguard Workeroneofs are used. 90*c8d645caSAndroid Build Coastguard Worker 91*c8d645caSAndroid Build Coastguard WorkerNanopb-0.3.5 (2016-02-13) 92*c8d645caSAndroid Build Coastguard Worker========================= 93*c8d645caSAndroid Build Coastguard Worker 94*c8d645caSAndroid Build Coastguard WorkerAdd support for platforms without uint8_t 95*c8d645caSAndroid Build Coastguard Worker----------------------------------------- 96*c8d645caSAndroid Build Coastguard Worker**Rationale:** Some platforms cannot access 8-bit sized values directly, and 97*c8d645caSAndroid Build Coastguard Workerdo not define *uint8_t*. Nanopb previously didn't support these platforms. 98*c8d645caSAndroid Build Coastguard Worker 99*c8d645caSAndroid Build Coastguard Worker**Changes:** References to *uint8_t* were replaced with several alternatives, 100*c8d645caSAndroid Build Coastguard Workerone of them being a new *pb_byte_t* typedef. This in turn uses *uint_least8_t* 101*c8d645caSAndroid Build Coastguard Workerwhich means the smallest available type. 102*c8d645caSAndroid Build Coastguard Worker 103*c8d645caSAndroid Build Coastguard Worker**Required actions:** If your platform does not have a standards-compliant 104*c8d645caSAndroid Build Coastguard Worker*stdint.h*, it may lack the definition for *[u]int_least8_t*. This must be 105*c8d645caSAndroid Build Coastguard Workeradded manually, example can be found in *extra/pb_syshdr.h*. 106*c8d645caSAndroid Build Coastguard Worker 107*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler error: "unknown type name 'uint_least8_t'". 108*c8d645caSAndroid Build Coastguard Worker 109*c8d645caSAndroid Build Coastguard WorkerNanopb-0.3.2 (2015-01-24) 110*c8d645caSAndroid Build Coastguard Worker========================= 111*c8d645caSAndroid Build Coastguard Worker 112*c8d645caSAndroid Build Coastguard WorkerAdd support for OneOfs 113*c8d645caSAndroid Build Coastguard Worker---------------------- 114*c8d645caSAndroid Build Coastguard Worker**Rationale:** Previously nanopb did not support the *oneof* construct in 115*c8d645caSAndroid Build Coastguard Worker*.proto* files. Those fields were generated as regular *optional* fields. 116*c8d645caSAndroid Build Coastguard Worker 117*c8d645caSAndroid Build Coastguard Worker**Changes:** OneOfs are now generated as C unions. Callback fields are not 118*c8d645caSAndroid Build Coastguard Workersupported inside oneof and generator gives an error. 119*c8d645caSAndroid Build Coastguard Worker 120*c8d645caSAndroid Build Coastguard Worker**Required actions:** The generator option *no_unions* can be used to restore old 121*c8d645caSAndroid Build Coastguard Workerbehaviour and to allow callbacks to be used. To use unions, one change is 122*c8d645caSAndroid Build Coastguard Workerneeded: use *which_xxxx* field to detect which field is present, instead 123*c8d645caSAndroid Build Coastguard Workerof *has_xxxx*. Compare the value against *MyStruct_myfield_tag*. 124*c8d645caSAndroid Build Coastguard Worker 125*c8d645caSAndroid Build Coastguard Worker**Error indications:** Generator error: "Callback fields inside of oneof are 126*c8d645caSAndroid Build Coastguard Workernot supported". Compiler error: "Message" has no member named "has_xxxx". 127*c8d645caSAndroid Build Coastguard Worker 128*c8d645caSAndroid Build Coastguard WorkerNanopb-0.3.0 (2014-08-26) 129*c8d645caSAndroid Build Coastguard Worker========================= 130*c8d645caSAndroid Build Coastguard Worker 131*c8d645caSAndroid Build Coastguard WorkerSeparate field iterator logic to pb_common.c 132*c8d645caSAndroid Build Coastguard Worker-------------------------------------------- 133*c8d645caSAndroid Build Coastguard Worker**Rationale:** Originally, the field iteration logic was simple enough to be 134*c8d645caSAndroid Build Coastguard Workerduplicated in *pb_decode.c* and *pb_encode.c*. New field types have made the 135*c8d645caSAndroid Build Coastguard Workerlogic more complex, which required the creation of a new file to contain the 136*c8d645caSAndroid Build Coastguard Workercommon functionality. 137*c8d645caSAndroid Build Coastguard Worker 138*c8d645caSAndroid Build Coastguard Worker**Changes:** There is a new file, *pb_common.c*, which must be included in 139*c8d645caSAndroid Build Coastguard Workerbuilds. 140*c8d645caSAndroid Build Coastguard Worker 141*c8d645caSAndroid Build Coastguard Worker**Required actions:** Add *pb_common.c* to build rules. This file is always 142*c8d645caSAndroid Build Coastguard Workerrequired. Either *pb_decode.c* or *pb_encode.c* can still be left out if some 143*c8d645caSAndroid Build Coastguard Workerfunctionality is not needed. 144*c8d645caSAndroid Build Coastguard Worker 145*c8d645caSAndroid Build Coastguard Worker**Error indications:** Linker error: undefined reference to 146*c8d645caSAndroid Build Coastguard Worker*pb_field_iter_begin*, *pb_field_iter_next* or similar. 147*c8d645caSAndroid Build Coastguard Worker 148*c8d645caSAndroid Build Coastguard WorkerChange data type of field counts to pb_size_t 149*c8d645caSAndroid Build Coastguard Worker--------------------------------------------- 150*c8d645caSAndroid Build Coastguard Worker**Rationale:** Often nanopb is used with small arrays, such as 255 items or 151*c8d645caSAndroid Build Coastguard Workerless. Using a full *size_t* field to store the array count wastes memory if 152*c8d645caSAndroid Build Coastguard Workerthere are many arrays. There already exists parameters *PB_FIELD_16BIT* and 153*c8d645caSAndroid Build Coastguard Worker*PB_FIELD_32BIT* which tell nanopb what is the maximum size of arrays in use. 154*c8d645caSAndroid Build Coastguard Worker 155*c8d645caSAndroid Build Coastguard Worker**Changes:** Generator will now use *pb_size_t* for the array *_count* fields. 156*c8d645caSAndroid Build Coastguard WorkerThe size of the type will be controlled by the *PB_FIELD_16BIT* and 157*c8d645caSAndroid Build Coastguard Worker*PB_FIELD_32BIT* compilation time options. 158*c8d645caSAndroid Build Coastguard Worker 159*c8d645caSAndroid Build Coastguard Worker**Required actions:** Regenerate all *.pb.h* files. In some cases casts to the 160*c8d645caSAndroid Build Coastguard Worker*pb_size_t* type may need to be added in the user code when accessing the 161*c8d645caSAndroid Build Coastguard Worker*_count* fields. 162*c8d645caSAndroid Build Coastguard Worker 163*c8d645caSAndroid Build Coastguard Worker**Error indications:** Incorrect data at runtime, crashes. But note that other 164*c8d645caSAndroid Build Coastguard Workerchanges in the same version already require regenerating the files and have 165*c8d645caSAndroid Build Coastguard Workerbetter indications of errors, so this is only an issue for development 166*c8d645caSAndroid Build Coastguard Workerversions. 167*c8d645caSAndroid Build Coastguard Worker 168*c8d645caSAndroid Build Coastguard WorkerRenamed some macros and identifiers 169*c8d645caSAndroid Build Coastguard Worker----------------------------------- 170*c8d645caSAndroid Build Coastguard Worker**Rationale:** Some names in nanopb core were badly chosen and conflicted with 171*c8d645caSAndroid Build Coastguard WorkerISO C99 reserved names or lacked a prefix. While they haven't caused trouble 172*c8d645caSAndroid Build Coastguard Workerso far, it is reasonable to switch to non-conflicting names as these are rarely 173*c8d645caSAndroid Build Coastguard Workerused from user code. 174*c8d645caSAndroid Build Coastguard Worker 175*c8d645caSAndroid Build Coastguard Worker**Changes:** The following identifier names have changed: 176*c8d645caSAndroid Build Coastguard Worker 177*c8d645caSAndroid Build Coastguard Worker * Macros: 178*c8d645caSAndroid Build Coastguard Worker 179*c8d645caSAndroid Build Coastguard Worker * STATIC_ASSERT(x) -> PB_STATIC_ASSERT(x) 180*c8d645caSAndroid Build Coastguard Worker * UNUSED(x) -> PB_UNUSED(x) 181*c8d645caSAndroid Build Coastguard Worker 182*c8d645caSAndroid Build Coastguard Worker * Include guards: 183*c8d645caSAndroid Build Coastguard Worker 184*c8d645caSAndroid Build Coastguard Worker * _PB_filename_ -> PB_filename_INCLUDED 185*c8d645caSAndroid Build Coastguard Worker 186*c8d645caSAndroid Build Coastguard Worker * Structure forward declaration tags: 187*c8d645caSAndroid Build Coastguard Worker 188*c8d645caSAndroid Build Coastguard Worker * _pb_field_t -> pb_field_s 189*c8d645caSAndroid Build Coastguard Worker * _pb_bytes_array_t -> pb_bytes_array_s 190*c8d645caSAndroid Build Coastguard Worker * _pb_callback_t -> pb_callback_s 191*c8d645caSAndroid Build Coastguard Worker * _pb_extension_type_t -> pb_extension_type_s 192*c8d645caSAndroid Build Coastguard Worker * _pb_extension_t -> pb_extension_s 193*c8d645caSAndroid Build Coastguard Worker * _pb_istream_t -> pb_istream_s 194*c8d645caSAndroid Build Coastguard Worker * _pb_ostream_t -> pb_ostream_s 195*c8d645caSAndroid Build Coastguard Worker 196*c8d645caSAndroid Build Coastguard Worker**Required actions:** Regenerate all *.pb.c* files. If you use any of the above 197*c8d645caSAndroid Build Coastguard Workeridentifiers in your application code, perform search-replace to the new name. 198*c8d645caSAndroid Build Coastguard Worker 199*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler errors on lines with the macro/type names. 200*c8d645caSAndroid Build Coastguard Worker 201*c8d645caSAndroid Build Coastguard WorkerNanopb-0.2.9 (2014-08-09) 202*c8d645caSAndroid Build Coastguard Worker========================= 203*c8d645caSAndroid Build Coastguard Worker 204*c8d645caSAndroid Build Coastguard WorkerChange semantics of generator -e option 205*c8d645caSAndroid Build Coastguard Worker--------------------------------------- 206*c8d645caSAndroid Build Coastguard Worker**Rationale:** Some compilers do not accept filenames with two dots (like 207*c8d645caSAndroid Build Coastguard Workerin default extension .pb.c). The *-e* option to the generator allowed changing 208*c8d645caSAndroid Build Coastguard Workerthe extension, but not skipping the extra dot. 209*c8d645caSAndroid Build Coastguard Worker 210*c8d645caSAndroid Build Coastguard Worker**Changes:** The *-e* option in generator will no longer add the prepending 211*c8d645caSAndroid Build Coastguard Workerdot. The default value has been adjusted accordingly to *.pb.c* to keep the 212*c8d645caSAndroid Build Coastguard Workerdefault behaviour the same as before. 213*c8d645caSAndroid Build Coastguard Worker 214*c8d645caSAndroid Build Coastguard Worker**Required actions:** Only if using the generator -e option. Add dot before 215*c8d645caSAndroid Build Coastguard Workerthe parameter value on the command line. 216*c8d645caSAndroid Build Coastguard Worker 217*c8d645caSAndroid Build Coastguard Worker**Error indications:** File not found when trying to compile generated files. 218*c8d645caSAndroid Build Coastguard Worker 219*c8d645caSAndroid Build Coastguard WorkerNanopb-0.2.7 (2014-04-07) 220*c8d645caSAndroid Build Coastguard Worker========================= 221*c8d645caSAndroid Build Coastguard Worker 222*c8d645caSAndroid Build Coastguard WorkerChanged pointer-type bytes field datatype 223*c8d645caSAndroid Build Coastguard Worker----------------------------------------- 224*c8d645caSAndroid Build Coastguard Worker**Rationale:** In the initial pointer encoding support since nanopb-0.2.5, 225*c8d645caSAndroid Build Coastguard Workerthe bytes type used a separate *pb_bytes_ptr_t* type to represent *bytes* 226*c8d645caSAndroid Build Coastguard Workerfields. This made it easy to encode data from a separate, user-allocated 227*c8d645caSAndroid Build Coastguard Workerbuffer. However, it made the internal logic more complex and was inconsistent 228*c8d645caSAndroid Build Coastguard Workerwith the other types. 229*c8d645caSAndroid Build Coastguard Worker 230*c8d645caSAndroid Build Coastguard Worker**Changes:** Dynamically allocated bytes fields now have the *pb_bytes_array_t* 231*c8d645caSAndroid Build Coastguard Workertype, just like statically allocated ones. 232*c8d645caSAndroid Build Coastguard Worker 233*c8d645caSAndroid Build Coastguard Worker**Required actions:** Only if using pointer-type fields with the bytes datatype. 234*c8d645caSAndroid Build Coastguard WorkerChange any access to *msg->field.size* to *msg->field->size*. Change any 235*c8d645caSAndroid Build Coastguard Workerallocation to reserve space of amount *PB_BYTES_ARRAY_T_ALLOCSIZE(n)*. If the 236*c8d645caSAndroid Build Coastguard Workerdata pointer was begin assigned from external source, implement the field using 237*c8d645caSAndroid Build Coastguard Workera callback function instead. 238*c8d645caSAndroid Build Coastguard Worker 239*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler error: unknown type name *pb_bytes_ptr_t*. 240*c8d645caSAndroid Build Coastguard Worker 241*c8d645caSAndroid Build Coastguard WorkerNanopb-0.2.4 (2013-11-07) 242*c8d645caSAndroid Build Coastguard Worker========================= 243*c8d645caSAndroid Build Coastguard Worker 244*c8d645caSAndroid Build Coastguard WorkerRemove the NANOPB_INTERNALS compilation option 245*c8d645caSAndroid Build Coastguard Worker---------------------------------------------- 246*c8d645caSAndroid Build Coastguard Worker**Rationale:** Having the option in the headers required the functions to 247*c8d645caSAndroid Build Coastguard Workerbe non-static, even if the option is not used. This caused errors on some 248*c8d645caSAndroid Build Coastguard Workerstatic analysis tools. 249*c8d645caSAndroid Build Coastguard Worker 250*c8d645caSAndroid Build Coastguard Worker**Changes:** The *#ifdef* and associated functions were removed from the 251*c8d645caSAndroid Build Coastguard Workerheader. 252*c8d645caSAndroid Build Coastguard Worker 253*c8d645caSAndroid Build Coastguard Worker**Required actions:** Only if the *NANOPB_INTERNALS* option was previously 254*c8d645caSAndroid Build Coastguard Workerused. Actions are as listed under nanopb-0.1.3 and nanopb-0.1.6. 255*c8d645caSAndroid Build Coastguard Worker 256*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler warning: implicit declaration of function 257*c8d645caSAndroid Build Coastguard Worker*pb_dec_string*, *pb_enc_string*, or similar. 258*c8d645caSAndroid Build Coastguard Worker 259*c8d645caSAndroid Build Coastguard WorkerNanopb-0.2.1 (2013-04-14) 260*c8d645caSAndroid Build Coastguard Worker========================= 261*c8d645caSAndroid Build Coastguard Worker 262*c8d645caSAndroid Build Coastguard WorkerCallback function signature 263*c8d645caSAndroid Build Coastguard Worker--------------------------- 264*c8d645caSAndroid Build Coastguard Worker**Rationale:** Previously the auxilary data to field callbacks was passed 265*c8d645caSAndroid Build Coastguard Workeras *void\**. This allowed passing of any data, but made it unnecessarily 266*c8d645caSAndroid Build Coastguard Workercomplex to return a pointer from callback. 267*c8d645caSAndroid Build Coastguard Worker 268*c8d645caSAndroid Build Coastguard Worker**Changes:** The callback function parameter was changed to *void\*\**. 269*c8d645caSAndroid Build Coastguard Worker 270*c8d645caSAndroid Build Coastguard Worker**Required actions:** You can continue using the old callback style by 271*c8d645caSAndroid Build Coastguard Workerdefining *PB_OLD_CALLBACK_STYLE*. Recommended action is to: 272*c8d645caSAndroid Build Coastguard Worker 273*c8d645caSAndroid Build Coastguard Worker * Change the callback signatures to contain *void\*\** for decoders and 274*c8d645caSAndroid Build Coastguard Worker *void \* const \** for encoders. 275*c8d645caSAndroid Build Coastguard Worker * Change the callback function body to use *\*arg* instead of *arg*. 276*c8d645caSAndroid Build Coastguard Worker 277*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler warning: assignment from incompatible 278*c8d645caSAndroid Build Coastguard Workerpointer type, when initializing *funcs.encode* or *funcs.decode*. 279*c8d645caSAndroid Build Coastguard Worker 280*c8d645caSAndroid Build Coastguard WorkerNanopb-0.2.0 (2013-03-02) 281*c8d645caSAndroid Build Coastguard Worker========================= 282*c8d645caSAndroid Build Coastguard Worker 283*c8d645caSAndroid Build Coastguard WorkerReformatted generated .pb.c file using macros 284*c8d645caSAndroid Build Coastguard Worker--------------------------------------------- 285*c8d645caSAndroid Build Coastguard Worker**Rationale:** Previously the generator made a list of C *pb_field_t* 286*c8d645caSAndroid Build Coastguard Workerinitializers in the .pb.c file. This led to a need to regenerate all .pb.c 287*c8d645caSAndroid Build Coastguard Workerfiles after even small changes to the *pb_field_t* definition. 288*c8d645caSAndroid Build Coastguard Worker 289*c8d645caSAndroid Build Coastguard Worker**Changes:** Macros were added to pb.h which allow for cleaner definition 290*c8d645caSAndroid Build Coastguard Workerof the .pb.c contents. By changing the macro definitions, changes to the 291*c8d645caSAndroid Build Coastguard Workerfield structure are possible without breaking compatibility with old .pb.c 292*c8d645caSAndroid Build Coastguard Workerfiles. 293*c8d645caSAndroid Build Coastguard Worker 294*c8d645caSAndroid Build Coastguard Worker**Required actions:** Regenerate all .pb.c files from the .proto sources. 295*c8d645caSAndroid Build Coastguard Worker 296*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler warning: implicit declaration of function 297*c8d645caSAndroid Build Coastguard Worker*pb_delta_end*. 298*c8d645caSAndroid Build Coastguard Worker 299*c8d645caSAndroid Build Coastguard WorkerChanged pb_type_t definitions 300*c8d645caSAndroid Build Coastguard Worker----------------------------- 301*c8d645caSAndroid Build Coastguard Worker**Rationale:** The *pb_type_t* was previously an enumeration type. This 302*c8d645caSAndroid Build Coastguard Workercaused warnings on some compilers when using bitwise operations to set flags 303*c8d645caSAndroid Build Coastguard Workerinside the values. 304*c8d645caSAndroid Build Coastguard Worker 305*c8d645caSAndroid Build Coastguard Worker**Changes:** The *pb_type_t* was changed to *typedef uint8_t*. The values 306*c8d645caSAndroid Build Coastguard Workerwere changed to *#define*. Some value names were changed for consistency. 307*c8d645caSAndroid Build Coastguard Worker 308*c8d645caSAndroid Build Coastguard Worker**Required actions:** Only if you directly access the `pb_field_t` contents 309*c8d645caSAndroid Build Coastguard Workerin your own code, something which is not usually done. Needed changes: 310*c8d645caSAndroid Build Coastguard Worker 311*c8d645caSAndroid Build Coastguard Worker * Change *PB_HTYPE_ARRAY* to *PB_HTYPE_REPEATED*. 312*c8d645caSAndroid Build Coastguard Worker * Change *PB_HTYPE_CALLBACK* to *PB_ATYPE()* and *PB_ATYPE_CALLBACK*. 313*c8d645caSAndroid Build Coastguard Worker 314*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler error: *PB_HTYPE_ARRAY* or *PB_HTYPE_CALLBACK* 315*c8d645caSAndroid Build Coastguard Workerundeclared. 316*c8d645caSAndroid Build Coastguard Worker 317*c8d645caSAndroid Build Coastguard WorkerNanopb-0.1.6 (2012-09-02) 318*c8d645caSAndroid Build Coastguard Worker========================= 319*c8d645caSAndroid Build Coastguard Worker 320*c8d645caSAndroid Build Coastguard WorkerRefactored field decoder interface 321*c8d645caSAndroid Build Coastguard Worker---------------------------------- 322*c8d645caSAndroid Build Coastguard Worker**Rationale:** Similarly to field encoders in nanopb-0.1.3. 323*c8d645caSAndroid Build Coastguard Worker 324*c8d645caSAndroid Build Coastguard Worker**Changes:** New functions with names *pb_decode_\** were added. 325*c8d645caSAndroid Build Coastguard Worker 326*c8d645caSAndroid Build Coastguard Worker**Required actions:** By defining NANOPB_INTERNALS, you can still keep using 327*c8d645caSAndroid Build Coastguard Workerthe old functions. Recommended action is to replace any calls with the newer 328*c8d645caSAndroid Build Coastguard Worker*pb_decode_\** equivalents. 329*c8d645caSAndroid Build Coastguard Worker 330*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler warning: implicit declaration of function 331*c8d645caSAndroid Build Coastguard Worker*pb_dec_string*, *pb_dec_varint*, *pb_dec_submessage* or similar. 332*c8d645caSAndroid Build Coastguard Worker 333*c8d645caSAndroid Build Coastguard WorkerNanopb-0.1.3 (2012-06-12) 334*c8d645caSAndroid Build Coastguard Worker========================= 335*c8d645caSAndroid Build Coastguard Worker 336*c8d645caSAndroid Build Coastguard WorkerRefactored field encoder interface 337*c8d645caSAndroid Build Coastguard Worker---------------------------------- 338*c8d645caSAndroid Build Coastguard Worker**Rationale:** The old *pb_enc_\** functions were designed mostly for the 339*c8d645caSAndroid Build Coastguard Workerinternal use by the core. Because they are internally accessed through 340*c8d645caSAndroid Build Coastguard Workerfunction pointers, their signatures had to be common. This led to a confusing 341*c8d645caSAndroid Build Coastguard Workerinterface for external users. 342*c8d645caSAndroid Build Coastguard Worker 343*c8d645caSAndroid Build Coastguard Worker**Changes:** New functions with names *pb_encode_\** were added. These have 344*c8d645caSAndroid Build Coastguard Workereasier to use interfaces. The old functions are now only thin wrappers for 345*c8d645caSAndroid Build Coastguard Workerthe new interface. 346*c8d645caSAndroid Build Coastguard Worker 347*c8d645caSAndroid Build Coastguard Worker**Required actions:** By defining NANOPB_INTERNALS, you can still keep using 348*c8d645caSAndroid Build Coastguard Workerthe old functions. Recommended action is to replace any calls with the newer 349*c8d645caSAndroid Build Coastguard Worker*pb_encode_\** equivalents. 350*c8d645caSAndroid Build Coastguard Worker 351*c8d645caSAndroid Build Coastguard Worker**Error indications:** Compiler warning: implicit declaration of function 352*c8d645caSAndroid Build Coastguard Worker*pb_enc_string*, *pb_enc_varint, *pb_enc_submessage* or similar. 353*c8d645caSAndroid Build Coastguard Worker 354