429 Commits

Author SHA1 Message Date
Petteri Aimonen
9ada7e7525 Fine-tune the naming of new macros before merging into master.
Requires re-generation of files generated with dev_get_rid_of_ternary_operator.
2013-09-13 11:30:58 +03:00
Petteri Aimonen
59cba0beea Expand extra_fields test to cover field skipping in case of streams. 2013-09-11 17:33:50 +03:00
Petteri Aimonen
152c2c910c Disable warning about uint64_t (long long) 2013-09-11 16:51:53 +03:00
Petteri Aimonen
2b72815036 Fix build error when path contains spaces 2013-09-11 16:45:52 +03:00
Petteri Aimonen
61ad04afd5 Merge branch 'dev_tests_using_scons' 2013-09-11 16:13:19 +03:00
Petteri Aimonen
9f93d39f72 Add tests for different compilation options 2013-09-11 14:55:56 +03:00
Petteri Aimonen
d395768c8d Windows build fixes 2013-09-11 13:42:56 +03:00
Petteri Aimonen
b9f14bddf7 Make all the tests ANSI C compatible. 2013-09-11 13:16:20 +03:00
Petteri Aimonen
840e213b9f Get rid of the ternary operator in the pb_field_t initialization.
Some compilers where unable to detect that the ternary operator
can be evaluated at the compile time. This commit does the evaluation
on the Python side, which should fix the problem.

The new .pb.c files are generated using PB_FIELD2() macro. The old
PB_FIELD() macro remains, so that previously generated files keep
working.
2013-09-11 09:53:51 +03:00
Petteri Aimonen
e2e9980627 Move the rest of the tests to scons 2013-09-10 22:34:54 +03:00
Petteri Aimonen
0bbcb7b367 Compiler options for GCC, clang and tcc 2013-09-10 20:54:29 +03:00
Petteri Aimonen
696a01bf14 Move the declarations of _pb_ostream_t and _pb_istream_t before first use.
Otherwise Microsoft Visual C++ threats them as C++ classes instead of plain
structs, forbidding use in C linkage functions.

Thanks to Markus Schwarzenberg for the patch.

Update issue 84
Status: Started
2013-09-10 17:53:21 +03:00
Petteri Aimonen
f04ab838ab Build fixes for Windows/Visual C++ 2013-09-10 17:53:07 +03:00
Petteri Aimonen
e681dd0d75 Add an example pb_syshdr.h file for platforms without C99.
This allows building the tests easily on Visual C++ in C mode.

Also add checks to pb.h that the defined integer types are of
the proper sizes. This may prevent some difficult to debug problems
later..
2013-09-10 12:39:39 +03:00
Petteri Aimonen
4dccf28ba9 Convert more test cases to scons 2013-09-10 11:34:57 +03:00
Petteri Aimonen
5b9ad17dc2 Move the declarations of _pb_ostream_t and _pb_istream_t before first use.
Otherwise Microsoft Visual C++ threats them as C++ classes instead of plain
structs, forbidding use in C linkage functions.

Thanks to Markus Schwarzenberg for the patch.

Update issue 84
Status: Started
2013-09-09 10:53:04 +03:00
Petteri Aimonen
4821e7f457 Add support for running the nanopb generator as protoc plugin.
Will be used to implement issue 47.

For now, symlink nanopb_generator.py as protoc-gen-nanopb and
use protoc --nanopb_out=. to call it.
2013-09-08 19:55:05 +03:00
Petteri Aimonen
262c62676c Start moving the tests into subfolders. Transition to SCons for build system for the tests.
Only a few tests updated so far. Have to include all the rest before merging to mainline.

Update issue 63
Status: Started
2013-09-08 17:52:03 +03:00
Petteri Aimonen
d7f3a74388 Handle unsupported extension field types more gracefully.
Previously the generator would stop with NotImplementedException as
soon as a required or repeated extension field is found. New behaviour
is to just ignore the unsupported field and note that in a comment
in the generated file.

Furthermore, allow skipping of extension fields using the generator
option (nanopb).type = FT_IGNORE.

Update issue 83
Status: FixedInGit
2013-09-08 11:05:20 +03:00
Petteri Aimonen
4aef194a99 Setting version to 0.2.3-dev 2013-08-18 22:12:31 +03:00
Petteri Aimonen
81cf30034b Publishing nanopb-0.2.2 nanopb-0.2.2 2013-08-18 22:11:38 +03:00
Petteri Aimonen
dd72698508 Update changelog 2013-08-08 20:45:30 +03:00
Petteri Aimonen
f15093e8bd Document field extensions support
Update issue 17
Status: FixedInGit
2013-08-08 20:42:46 +03:00
Petteri Aimonen
b663909fb6 Document PB_SYSTEM_HEADER 2013-08-08 20:05:30 +03:00
Petteri Aimonen
ba40cacd3c Finish the testcase for extensions 2013-07-22 19:00:04 +03:00
Petteri Aimonen
1f13e8cd2c Fix bugs in extension support when multiple extension fields are present. 2013-07-22 18:59:15 +03:00
Petteri Aimonen
64947cb382 Extension support implemented for decoder.
Testing is still needed. Also only 'optional' extension fields
are supported now, 'repeated' fields are not yet supported.
2013-07-17 20:21:51 +03:00
Petteri Aimonen
0343e2bcfe Add test case for extensions decoding 2013-07-17 19:29:06 +03:00
Petteri Aimonen
ebddda9b5c Implement extension support for the encoder 2013-07-17 19:23:19 +03:00
Petteri Aimonen
7c5e184c26 Implement generator support for extension fields (no encoder/decoder support yet) 2013-07-17 00:06:54 +03:00
Petteri Aimonen
f064c2c48a Fix formatting in documentation 2013-07-16 11:31:38 +03:00
Kent Ryhorchuk
3c10e6fa71 Check for empty message type before incrementing required_field_index.
If you have a message that defined as empty, but attempt to decode a
message that has one or more unknown fields then pb_decode fails. The
method used to count the number of required fields counts 1 required
field because the default type of PB_LAST_FIELD is PB_HTYPE_REQUIRED.
2013-07-16 11:07:48 +03:00
Petteri Aimonen
a01856f4ab Add test case for extra fields in AllTypes 2013-07-16 11:07:34 +03:00
Petteri Aimonen
bb985e9927 Add pb_decode_delimited and pb_encode_delimited wrapper functions.
Update issue 74
Status: FixedInGit
2013-07-06 16:16:00 +03:00
Petteri Aimonen
314460c2a5 Clean up the comments in pb_encode.h and pb_decode.h 2013-07-06 15:55:15 +03:00
Petteri Aimonen
0ed3158560 Add section in pb.h for changing compilation settings.
Update issue 76
Status: FixedInGit
2013-07-06 15:27:31 +03:00
Petteri Aimonen
4b705bf64b Add error message macros to API reference. 2013-07-06 15:25:42 +03:00
Petteri Aimonen
6e9e532927 Document the .options file usage.
Also add note about the 'packed' message option being incompatible
with CPUs that do not support unaligned access.

Update issue 12
Status: FixedInGit

Update issue 77
Status: FixedInGit
2013-07-06 13:49:47 +03:00
Petteri Aimonen
68dd0171bc Switch the example project to use the new .options file 2013-07-06 13:01:21 +03:00
Petteri Aimonen
a1cec46b3e Include the field tags in the generated .pb.h file.
Patch from Michael Haberler.
2013-06-03 22:46:19 +03:00
Petteri Aimonen
bfd7cb36b9 Setting version to 0.2.2-dev 2013-04-14 10:07:46 +03:00
Petteri Aimonen
ef741ea530 Publishing nanopb-0.2.1 nanopb-0.2.1 2013-04-14 10:06:47 +03:00
Petteri Aimonen
26b52b79ad Update changelog 2013-04-14 10:04:46 +03:00
Petteri Aimonen
d2063ff0b6 Handle unterminated strings when encoding.
If the null terminator is not present, string will be limited to the
data size of the field.

If you are still using the pb_enc_string (deprecated since 0.1.3) from
callbacks, now would be an excellent time to stop. The pb_field_t for
the callback will not contain proper data_size. Use pb_encode_string()
instead.

Update issue 68
Status: FixedInGit
2013-04-14 09:46:39 +03:00
Petteri Aimonen
9939910833 Fix bug with empty strings in repeated string callbacks.
Fix suggested by Henrik Carlgren. Added also unit test for the bug.

Update issue 73
Status: FixedInGit
2013-04-14 09:26:42 +03:00
Petteri Aimonen
6a02298584 Avoid maybe-uninitialized warning
Patch from dch.
2013-04-08 11:00:28 +03:00
dch
a968233777 No need to include stdbool.h separately 2013-04-08 10:56:23 +03:00
dch
710465a8e0 __pragma keyword is only supported by recent Microsoft compilers 2013-04-08 10:56:13 +03:00
Petteri Aimonen
384e686fe6 Do not generate has_ fields for callback fields.
The arg field can be used to store the field presence from inside
the callback. Furthermore, having the has_ field for encoding callbacks
would be more annoying than useful.

Update issue 70
Status: FixedInGit
2013-04-02 20:01:31 +03:00
Petteri Aimonen
214b0eae8a Change the callback function to use void**.
NOTE: This change breaks backwards-compatibility by default.
If you have old callback functions, you can define PB_OLD_CALLBACK_STYLE
to retain the old behaviour.

If you want to convert your old callbacks to new signature, you need
to do the following:

1) Change decode callback argument to   void **arg
      and encode callback argument to   void * const *arg.

2) Change any reference to arg into *arg.

The rationale for making the new behaviour the default is that it
simplifies the common case of "allocate some memory in decode callback".

Update issue 69
Status: FixedInGit
2013-04-02 19:55:21 +03:00