Commit Graph

232 Commits

Author SHA1 Message Date
Petteri Aimonen
8e840cc81a Put previous commit (issue 52) inside #ifndef 2013-01-16 16:31:45 +02:00
Petteri Aimonen
88eba4bc27 Fix bug with error messages.
Update issue 52
Status: FixedInGit
2013-01-16 16:28:51 +02:00
Petteri Aimonen
d32d322658 Add field type FT_IGNORE to generator.
This allows ignoring fields that are unnecessary or too large for an
embedded system using nanopb, while allowing them to remain in the .proto
for other platforms.

Update issue 51
Status: FixedInGit
2013-01-14 17:30:49 +02:00
Petteri Aimonen
b9baec6b4c Add a test for the backwards compatibility of generated files.
It is not necessary to maintain full compatibility of generated files
for all of eternity, but this test will warn us if there is
a need to regenerate the files.
2013-01-13 18:44:15 +02:00
Petteri Aimonen
d2c1604d6d Add generator option for packed structs.
Usage is:
message Foo
{
   option (nanopb_msgopt).packed_struct = true;
   ...
}

Valid also in file scope.

Update issue 49
Status: FixedInGit
2013-01-10 17:32:27 +02:00
Petteri Aimonen
93ffe14a0a Cleanup: get rid of unnecessary spaces 2013-01-10 17:31:33 +02:00
Petteri Aimonen
bb5dc04584 Setting version to 0.1.9-dev 2012-12-13 21:32:37 +02:00
Petteri Aimonen
09ec60cadf Publishing nanopb-0.1.8 nanopb-0.1.8 2012-12-13 21:29:57 +02:00
Petteri Aimonen
871e5be9dd Fix small error in field callback documentation.
Update issue 44
Status: FixedInGit
2012-12-06 11:13:53 +02:00
Jens Steinhauser
068de05c51 Complete initialization of pb_istream_t.
Because PB_RETURN_ERROR checks if the 'errmsg' member is NULL before
assigning to it, error messages would get lost.
2012-11-27 19:55:21 +02:00
Steffen Siering
1f8fb1f1ed Use TESTS variable to define dependencies for run_unittests 2012-11-16 09:59:04 +02:00
Petteri Aimonen
434dcbb2ee Select compilation options based on $(CC) in tests/Makefile.
Makes 'make CC=clang' work.

Based on patch submitted by Steffen Siering.

Update issue 40:
Status: FixedInGit
2012-11-16 09:51:23 +02:00
Petteri Aimonen
59788e2aab Rename test_compiles.c to test_multiple_files.c 2012-11-16 09:33:11 +02:00
Steffen Siering
cc29958d34 Fix STATIC_ASSERT macro when using multiple .proto files.
The __COUNTER__ macro (used for generating unique names) is at least supported
by gcc, clang and Visual Studio. With this change test_compiles.c is
compilable, since no more typedefs are redefined.

Compilers/Preprocessors not supporting __COUNTER__ error's are still possible
which are hopfully handled by the usage of __LINE__ in most sittuations.

Added unit test for the problem.
2012-11-16 09:24:39 +02:00
Petteri Aimonen
0abb764b18 Fix naming of nested Enums with short names 2012-11-14 00:43:51 +02:00
Petteri Aimonen
02ecee2de8 Fix naming of enums when long_names=false.
Modify test case to check that options.pb.o compiles.

Update issue 42
Status: FixedInGit

Update issue 43
Status: FixedInGit
2012-11-14 00:36:16 +02:00
Petteri Aimonen
332a9ee95c Fix changelog 2012-11-11 11:20:34 +02:00
Petteri Aimonen
fc6f56b2bd Setting version to 0.1.8-dev 2012-11-11 11:19:17 +02:00
Petteri Aimonen
92bb37b074 Publishing nanopb-0.1.7 nanopb-0.1.7 2012-11-11 11:16:01 +02:00
Petteri Aimonen
ad9a885644 Document new generator options 2012-10-29 19:33:33 +02:00
Petteri Aimonen
08391f35ee Add nanopb version number to generated files.
tools/set_version.sh is used to update the values.

Update issue 36
Status: FixedInGit
2012-10-29 19:15:34 +02:00
Petteri Aimonen
3aaa4ad8c2 Add extern "C" to header files.
Update issue 35
Status: FixedInGit
2012-10-29 19:03:19 +02:00
Petteri Aimonen
db1eefc24b Add option to use short names for enum values.
Update issue 38
Status: FixedInGit
2012-10-29 18:55:49 +02:00
Petteri Aimonen
0ee4bb96b1 Allow defining field type in .proto.
Update issue 30
Status: FixedInGit
2012-10-29 18:34:24 +02:00
Petteri Aimonen
28b0136ea4 Improve .proto options parsing.
Options can now be defined on command line, file, message or in field
scope.

Update issue 12
Status: Started
2012-10-29 18:20:15 +02:00
Petteri Aimonen
9e0ee92f0a Use optparse in nanopb_generator.py 2012-10-29 17:25:16 +02:00
Petteri Aimonen
c3fa362653 Give names to generated structures to allow forward declaration.
Update issue 39
Status: FixedInGit
2012-10-29 16:56:45 +02:00
Petteri Aimonen
bffd3a9acc Improve the person_with_extra_field test.
Added a field after the extra field to verify it's also ok.
2012-10-21 21:31:20 +03:00
Petteri Aimonen
dcab39a41c Remove the "buf = NULL" => skip requirement from pb_istream_t callbacks.
Rationale: it's easy to implement the callback wrong. Doing so introduces
io errors when unknown fields are present in the input. If code is not
tested with unknown fields, these bugs can remain hidden for long time.

Added a special case for the memory buffer stream, where it gives a small
speed benefit.

Added testcase for skipping fields with test_decode2 implementation.

Update issue 37
Status: FixedInGit
2012-10-18 19:45:28 +03:00
Petteri Aimonen
900c8dd125 Add tests for negative values in the alltypes testcase. 2012-10-14 12:27:08 +03:00
Petteri Aimonen
3f563792ad Add buffer size check in test_decode1.c example.
This check gives a better error message in case you test stuff
and have a message longer than 512 bytes.

Update issue 34
Status: FixedInGit
2012-09-18 16:51:22 +03:00
Petteri Aimonen
b214de4e1e Enable -Wconversion for core and fix the warnings.
This should help avoid issue 33 in the future.
2012-09-03 17:35:14 +03:00
dch
be78e3b4d0 Fix build warnings on MS compilers
Update issue 33
Status: FixedInGit
2012-09-03 17:18:49 +03:00
Petteri Aimonen
11e0918b5e Created a CHANGELOG file for easy reference. nanopb-0.1.6 2012-09-02 20:49:08 +03:00
Petteri Aimonen
07d44cf632 Clean up one (uint64_t) cast. 2012-09-02 20:14:22 +03:00
Petteri Aimonen
f187aad63d Fix -Wextra warning in generated .pb.c files.
Compile the generated files with the same extra-strict
settings as the core, in order to detect problems in tests.

Update issue 32
Status: FixedInGit
2012-09-02 19:54:35 +03:00
Petteri Aimonen
a06dba6e49 Fix warnings with -Wcast-qual. Add test for C++ compile.
Update issue 27
Status: FixedInGit
2012-08-26 15:21:20 +03:00
Petteri Aimonen
160f02e4d0 Add pb_decode_noinit and use it from pb_dec_submessage.
This avoids double initialization when decoding nested submessages.
Fixes an issue with submessage arrays that was present in previous
version of this patch.

Update issue 28
Status: FixedInGit
2012-08-26 11:04:55 +03:00
Petteri Aimonen
a7a6cdad88 Added alltypes-testcases for optional fields and default values. 2012-08-26 10:57:51 +03:00
Petteri Aimonen
1463e687e3 Revert "Add pb_decode_noinit and use it from pb_dec_submessage."
The patch breaks default values inside submessage arrays (I think).
Have to add test cases and check back.

This reverts commit f1d7640fe1.
2012-08-26 10:05:46 +03:00
Petteri Aimonen
f1d7640fe1 Add pb_decode_noinit and use it from pb_dec_submessage.
This avoids double initialization when decoding nested submessages.

Update issue 28
Status: FixedInGit
2012-08-26 09:56:11 +03:00
Petteri Aimonen
440da6959f Add note that stream callbacks must read the whole requested length.
Fixes issue #22.
2012-08-24 21:32:42 +03:00
Petteri Aimonen
0fb5e5e068 Implement error messages in the decoder side.
Update issue 7
Status: Started
2012-08-24 21:22:20 +03:00
Petteri Aimonen
ea57f74741 Document pb_close_string_substream. 2012-08-24 20:51:29 +03:00
Petteri Aimonen
9383f305dc Revert "Change the substream implementation in pb_decode."
This reverts commit dc2da0edc5.

Add pb_close_string_substream() for copying back the state.
This makes adding error messages easier in the future, as also
them need to be propagated back from the substream.
2012-08-24 20:43:39 +03:00
Petteri Aimonen
2941e90e04 Reorganize the field decoder interface.
This makes the field decoding functions more intuitive to use.
The old interface is still present if you specify NANOPB_INTERNALS.

Update issue 2
Status: FixedInGit
2012-08-24 20:23:25 +03:00
Petteri Aimonen
dc2da0edc5 Change the substream implementation in pb_decode.
This makes it unnecessary to copy back the state, and also relaxes
the requirements on callbacks (bytes_left will always be valid).
It decreases code size by a few bytes, but may be just slightly slower.
2012-08-24 19:35:17 +03:00
Petteri Aimonen
86257a2a70 Fix a confusing statement in a comment. 2012-08-24 19:25:29 +03:00
Stan Hu
07f24f9b70 Fix casting issues 2012-08-16 22:06:19 +03:00
Petteri Aimonen
8d5086f052 Declare warn_unused_result only on GCC >= 3.4.0.
Thanks to cea.max.simoes for bug report & fix.

Update issue 25
Status: FixedInGit
2012-08-09 16:15:23 +03:00