28 Commits

Author SHA1 Message Date
Robert Edmonds
de5ea41b4f t/: Use "int main(void)" for the main C signature
This commit updates a few tests where we aren't using the correct C
signature for main() or are not using any of its parameters (in the
case of t/version/version.c.)
2023-07-08 20:52:09 -04:00
Ilya Lipnitskiy
dfb6e300fa
protoc-c: add const_strings option
Keep default as false to preserve backwards compatibility.

Fixes #239
2021-03-21 21:11:50 -07:00
Ilya Lipnitskiy
baa860ff97
protoc-c: add options for function generation
Add options controller helper function generation. Preserve existing
behavior of not generating pack/unpack functions for sub-messages if
option is not explicitly set.

Fixes #240
Fixes #442
2021-03-21 21:11:49 -07:00
Adam Cozzette
5ee9afdc15 Fixed some test assertions in test-generated-code2.c
I fixed a couple test assertions here that seemed to be accidentally
using assignment (=) instead of equality (==).
2019-08-27 11:07:26 -07:00
Hayri Ugur Koltuk
ad6952d9f2 Add test case for protobuf_c_check SEGV on unpopulated oneof member
Signed-off-by: Hayri Ugur Koltuk <ugur.koltuk@adyen.com>
2019-04-16 09:30:08 +02:00
Richard Kettlewell
c23065e4b1 Allowing <type>__free_unpacked(NULL, ...)
This makes __free_unpacked() consistent with free(), and simplifies
callers by allowing them to indiscriminately free message objects
without regard to whether they have been allocated or not.
2017-02-25 19:59:17 +00:00
Ilya Lipnitskiy
2ea8fc7087 test-generated-code2.c: Add default value test 2016-04-22 11:35:14 -07:00
Ilya Lipnitskiy
a8d746a27c t: Add coverage
Remove a redundant test and add two large number test cases.
2015-12-12 22:06:41 -08:00
Peter Leschev
7b4c18a082 Fixes #196 2015-12-12 20:36:35 -08:00
Ilya Lipnitskiy
7634c0e6e6 protobuf-c.c: Pack negative enum values correctly
Fix a few casts where ints were cast to uints unnecessarily

Fixes #199. Previously, enums were treated as uint32's, but they need to
be treated as int32's instead.

t: Add a few test cases with negative enum values
2015-12-12 20:36:35 -08:00
Ilya Lipnitskiy
8debedbc3c test-generated-code2.c: Don't call memcmp with a NULL pointer 2015-12-12 17:43:01 -08:00
Ilya Lipnitskiy
be99a7ac31 t: Add tests for the LITE_RUNTIME optimization option 2015-03-15 20:01:03 -07:00
Ilya Lipnitskiy
617fa7ef6f test-generated-code2.c: Cosmetic change 2015-02-14 17:28:36 -08:00
Oleg Efimov
5238d655b9 protobuf-c.c: Better input checks in protobuf_c_message_free_unpacked
Check for NULL pointer for repeated fields passed to protobuf_c_message_free_unpacked

Closes #177
2015-01-18 22:09:15 +03:00
Oleg Efimov
24182d859f protobuf-c.c: Better input checks in protobuf_c_message_free_unpacked
Check for NULL message pointer passed to protobuf_c_message_free_unpacked

Closes #177
2015-01-18 22:09:15 +03:00
Oleg Efimov
f49fabead4 t: fix compile warnings about pointers of different types assignments
warning: assigning to 'uint8_t *' (aka 'unsigned char *')
from 'char *' converts between pointers to integer types
with different sign [-Wpointer-sign]
2015-01-06 22:48:00 +03:00
Ilya Lipnitskiy
6090d9a924 t: Add tests for oneoffs
Add test cases for parsing multiple fields of the same oneof from the wire
Add more tests for submessage merging, including oneofs
2014-11-19 23:07:23 -08:00
Andrei Nigmatulin
6136f54b22 added check for PROTOBUF_C_TYPE_BYTES fields, including repeated
added check that repeated fields vectors are not NULL
fixed repeated field quantity type: it's "size_t", not "unsigned"
cleaner code, no cast porn
all covered with tests
2014-06-30 19:28:04 +01:00
Ilya Lipnitskiy
a2100d1f39 protobuf-c.c: Fix repeated field concatenation order in merge_messages (fixes #147) 2014-06-27 17:32:32 -04:00
Robert Edmonds
3fccff9381 t/: add test case test_field_flags 2014-04-03 12:09:54 -04:00
Robert Edmonds
ec961cb007 t/: rename the required fields bitmap test case 2014-03-31 16:14:33 -04:00
Andrei Nigmatulin
cfb919f100 added unit test for required_fields_bitmap hashing issue 2014-03-31 16:10:41 -04:00
Oleg Efimov
9c7f8ce798 t/: add test case for Issue #129 from Oleg Efimov 2014-03-24 18:07:04 -04:00
Robert Edmonds
8cd5f6764b protobuf-c: remove tmp_alloc and max_alloca fields of ProtobufCAllocator
i'm confused as to why these fields exist, since the typical
implementation of a "temporary alloc" would be something like alloca(),
and alloca() is usually just inlined code that adjusts the stack
pointer, which is not a function whose address could be taken.

this breaks the API/ABI and will require a note in the ChangeLog.

possibly we could revisit the idea of "temporary allocations" by using
C99 variable length arrays. this would have the advantage of being
standardized, unlike alloca().
2014-01-13 15:35:42 -05:00
Ilya Lipnitskiy
b00f6d221c t/generated-code2/test-generated-code2.c: Rename test_optional_merge to
test_field_merge
2013-11-22 16:35:19 -08:00
Ilya Lipnitskiy
f4b9fd20a5 protobuf-c/protobuf-c.c: add functionality to merge multiple instances
of the same field on the wire (Fixes #91)
t/generated-code2/test-generated-code2.c: add a test case for merging
messages
t/test-full.proto: expand message definitions to test for merging nested
messages
2013-11-22 15:34:07 -08:00
Robert Edmonds
43b94a4bc4 fix VPATH builds
this commit fixes VPATH builds where the build tree is separate from the
source tree. this will allow us to run "make distcheck".
2013-11-18 13:53:28 -05:00
Robert Edmonds
cd2c8a5835 t/: fix paths to generated protobuf code 2013-11-16 17:32:26 -05:00