456 Commits

Author SHA1 Message Date
Ilya Lipnitskiy
6fc4e97bf0 protobuf-c.c: Replace other bitwise shifts with 1UL
This change helps keep protobuf-c compatible with systems where int is
less than 4 bytes long. This change also makes left shifts more
consistent.
2015-12-12 21:55:32 -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
e2d45cbe84 protobuf-c.c: Fix undefined code in zigzag functions 2015-12-12 17:41:38 -08:00
Ilya Lipnitskiy
565f42d300 .travis.yml: Add sanitizer checks
Add support for multiple versions of GCC and clang by using a build
matrix. Switch Travis VM to be based on Ubuntu 14.04
2015-12-12 17:05:05 -08:00
Ilya Lipnitskiy
0e2d3c09e2 Rename LITE_RUNTIME to CODE_SIZE 2015-10-30 15:54:00 -07:00
Ilya Lipnitskiy
4eb49206ff protobuf-c.h: Document the new LITE_RUNTIME behavior 2015-03-15 20:01:03 -07:00
Ilya Lipnitskiy
be99a7ac31 t: Add tests for the LITE_RUNTIME optimization option 2015-03-15 20:01:03 -07:00
Ilya Lipnitskiy
603e431864 protoc-c: Support the optimize_for = LITE_RUNTIME file option
Adds support for the LITE_RUNTIME optimization option to the protobuf-c
compiler. Enabling this option would generate lighter weight message,
enum, and service descriptors that contain NO strings. As a result,
calls to lookup descriptors via the *_get_{field,value,method}_by_name
API will return NULL.

Default compiler behavior (when optimize_for is not specified or is not
set to LITE_RUNTIME) is unchanged.
2015-03-15 20:01:03 -07:00
Ilya Lipnitskiy
8601458e5c protobuf-c.c: Don't crash when *_by_name fields in descriptors are NULL 2015-03-15 20:00:11 -07:00
Robert Edmonds
3b7d27a462 ChangeLog: 1.1.1 v1.1.1 2015-03-14 17:00:57 -04:00
Robert Edmonds
9983a190a0 Bump version to 1.1.1 2015-03-14 17:00:57 -04:00
Robert Edmonds
21dead9e19 Bump copyright year to 2015 2015-03-14 17:00:57 -04:00
Robert Edmonds
a5a802641a .travis.yml: Update protobuf dependency to 2.6.1 2015-03-14 16:08:10 -04:00
Andrey Myznikov
812ecf9326 Fix incorrect 'Short version of service name' generation for ProtobufCServiceDescriptor 2015-03-14 16:00:28 -04:00
Robert Edmonds
cbe7b84a14 Merge remote-tracking branch 'github/protoc_c_comments' into next 2015-03-13 12:42:51 -04:00
Ilya Lipnitskiy
c89cd01189 .travis.yml: Exclude protoc-c from the coveralls report 2015-02-14 20:45:04 -08:00
Oleg Efimov
0a29317348 .travis.yml: exclude downloaded protobuf sources from coveralls report 2015-02-14 20:40:07 -08:00
Ilya Lipnitskiy
ce6cc2350f TODO: Remove items that have been completed 2015-02-14 19:32:54 -08:00
Ilya Lipnitskiy
b64f6c1f68 protoc-c/c_enum.cc: Make enum_values_{by_name,by_number} structs static 2015-02-14 19:21:29 -08:00
Ilya Lipnitskiy
617fa7ef6f test-generated-code2.c: Cosmetic change 2015-02-14 17:28:36 -08:00
Ilya Lipnitskiy
8f42a69f86 protoc-c/c_helpers.cc: Enhance comment string parsing
Certain protobuf comments could generate invalid C comments
and inadvertently close the comment block. This commit removes '/'
signs in such comments.

One example of a .proto file containing such comments is a commonly
included descriptor.proto from the protobuf library.
2015-01-30 20:11:34 -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
Robert Edmonds
b0b0e874a4 ChangeLog: 1.1.0 v1.1.0 2015-01-05 16:25:09 -05:00
Robert Edmonds
287c916f9d bump version to 1.1.0 2015-01-05 15:54:02 -05:00
Robert Edmonds
a57204d867 ChangeLog: Document recent changes 2015-01-05 15:36:28 -05:00
Ilya Lipnitskiy
35ec2e2f9c protoc-c: Print comments for generated enum, message, and field definitions 2014-12-16 18:12:54 -08:00
Ilya Lipnitskiy
8eec9c90e6 protobuf-c.h: Add docs for generated message init macro and function 2014-12-06 22:53:05 -08:00
Robert Edmonds
c23348a14e Fix PROTOBUF_C_VERSION, PROTOBUF_C_VERSION_NUMBER 2014-11-24 16:38:22 -05:00
Robert Edmonds
e0841a957e configure.ac: next has 1.1.0 in development 2014-11-24 16:23:08 -05:00
Robert Edmonds
0ba0fe6aab ChangeLog: oneof support 2014-11-24 16:20:23 -05:00
Robert Edmonds
453f39e692 Merge oneof support 2014-11-24 16:18:56 -05:00
Robert Edmonds
8f23163f68 ChangeLog: Document fix in previous commit 2014-11-24 16:18:04 -05: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
Ilya Lipnitskiy
9db84a3b90 protoc-c: Implement oneofs 2014-11-19 23:07:23 -08:00
Ilya Lipnitskiy
2e465cfdc7 configure.ac: Bump min protobuf version to 2.6.0 for oneof parsing support 2014-11-19 22:06:21 -08:00
Ilya Lipnitskiy
791b0458bf protobuf-c.{c,h}: Implement oneof support
Add a field flag and functions to pack/unpack oneofs
Add logic to parse multiple fields for the same oneof
Add logic for merging submessages that contain oneofs
2014-11-19 22:06:21 -08:00
Ilya Lipnitskiy
060c071209 protobuf-c.c: Fix a bug when merging optional byte fields 2014-11-18 23:52:15 -08:00
Ilya Lipnitskiy
c6a950c53c README.md: Add a Documentation section 2014-11-15 01:00:43 -08:00
Ilya Lipnitskiy
24dd502094 .commit_docs.sh: initial version of the documentation update script 2014-11-15 00:27:50 -08:00
Robert Edmonds
0481c71e06 ChangeLog: finalize 1.0.2 v1.0.2 2014-09-12 16:32:42 -04:00
Robert Edmonds
57bdb38886 ChangeLog: alex85k -> Alexei Kasatkin 2014-09-10 14:33:20 -04:00
Robert Edmonds
151d48d956 ChangeLog: 1.0.2 2014-09-08 17:48:31 -04:00
Robert Edmonds
58f764ecfe bump version to 1.0.2 2014-09-08 17:07:47 -04:00
Robert Edmonds
cb7498b0a7 Makefile.am: distribute build-cmake/CMakeLists.txt
Ironically, we need to tell automake to distribute the CMakeLists.txt
file in the tarball...
2014-09-08 17:05:05 -04:00
Robert Edmonds
b0e0430d57 build-cmake/: add a new CMakeLists.txt file as a fallback
For certain platforms where autotools is not the preferred build system,
provide a fallback cmake file that can compile protoc-c and a static
library of libprotobuf-c.

Based on the file from alex85k's protobuf-c repository.

(Issue #168.)
2014-09-08 17:05:05 -04:00
Natanael Copa
b0bb563033 Makefile.am: fix parallel build of t/generated-code2/cxx-generate-packed-data
The object file name is not what is expected when building with
automake's "subdir-objects" option. Rather than expecting automake to
generate a specific filename, we simply make the generated header a
dependency of all objects for cxx-generate-packed-data.

(Issue #156, #169.)
2014-09-08 17:04:39 -04:00
Robert Edmonds
d80856c3f5 protobuf-c: 'inline' workaround for microsoft compilers
Per http://msdn.microsoft.com/en-us/library/z8y1yy88(v=vs.71).aspx,
Microsoft compilers do not support the Standard C keyword 'inline',
instead preferring the implementation-specific '__inline', so add a
workaround for these specific compilers.

Based on a patch from alex85k (#167).
2014-09-08 16:00:38 -04:00
Robert Edmonds
faf6244ef5 .travis.yml: fetch the protobuf tarball from GitHub instead of Google Code
Per the protobuf developers,

    We will from everything away from Google Code eventually. We haven't
    decided where to put future release packages yet but as it seems github
    supports this well chances are we'll use github as the canonical location
    for all downloads.
2014-09-05 17:18:18 -04:00
Robert Edmonds
51b8da1589 .travis.yml: bump protobuf version to 2.6.0
Build with the latest protobuf release, in preparation for adding
"oneof" support.
2014-09-05 17:17:24 -04:00
Robert Edmonds
6d275c5691 protobuf-c: eliminate void pointer arithmetic
gcc silently treats arithmetic on a void pointer as char pointer
arithmetic without -pedantic. Other compilers do not. Make it explicit
that we are doing arithmetic on a pointer with object size 1.

This eliminates the following diagnostic:

    protobuf-c/protobuf-c.c: In function 'parse_packed_repeated_member':
    protobuf-c/protobuf-c.c:2404:34: warning: pointer of type 'void *' used in arithmetic [-Wpedantic]
      void *array = *(void **) member + siz * (*p_n);

(I did not find any other instances of 'void *' arithmetic when
compiling with -pedantic.)

Based on a patch from alex85k (#167).
2014-09-05 16:35:03 -04:00
Robert Edmonds
7e5c09ea6b protobuf-c: always define PROTOBUF_C__DEPRECATED
If we are not building on gcc, PROTOBUF_C__DEPRECATED needs to be
defined but empty. Previously we were not defining it at all in certain
situations, which would cause build failures.

Based on a patch from alex85k (#167).
2014-09-05 16:05:45 -04:00
Robert Edmonds
3ba170ccc7 .travis.yml: try to speed up the build a bit with "make -j2"
According to the travis-ci documentation, VMs are executed with 1.5
virtual CPU cores, so this should speed up our builds a little bit.
2014-09-05 15:44:47 -04:00
Robert Edmonds
c4a0e69337 t/test-full.proto: add 'allow_alias' option to TestEnumDupValues
protobuf 2.5.0 started warning that we would need to enable the
'allow_alias' option on this enum due to the duplicate enum values, and
protobuf 2.6.0 turned this into an error. Turn this option on, now that
protobuf 2.5.0 is more common (e.g., it's now in Ubuntu 14.04 LTS). This
will break with older protobuf versions, so we now require >= 2.5.0.

We should now see diagnostics like these disappear from the build log:

    [libprotobuf ERROR google/protobuf/descriptor.cc:4153] "foo.VALUE_B" uses the same enum value as "foo.VALUE_A". If this is intended, set 'option allow_alias = true;' to the enum definition.

Based on a patch from Ilya Lipnitskiy.
2014-09-05 15:38:26 -04:00
Robert Edmonds
f25a0f4e58 configure.ac: require protobuf >= 2.5.0
In order to add compatibility with the latest protobuf 2.6.0 release, we
need to add an option to the t/test-full.proto schema that was
introduced in protobuf 2.5.0, so we need to depend on protobuf 2.5.0 or
higher now.
2014-09-05 15:16:06 -04:00
Robert Edmonds
11326ce7f3 .travis.yml: run 'ldconfig' after installing protobuf
This should fix the following build failure.

    ./protoc-c/protoc-c: error while loading shared libraries: libprotobuf.so.8: cannot open shared object file: No such file or directory
    make: *** [t/test.pb-c.c] Error 127
2014-09-05 15:03:24 -04:00
Robert Edmonds
7a2947401f README.md: Contributing: add note about master/next branches 2014-09-05 14:41:50 -04:00
Robert Edmonds
61e5bee03d .travis.yml: fix 'language' declaration
It turns out that in YAML,

    language: c
    language: cpp

Actually means:

    language: cpp

I'm not sure if travis-ci actually supports providing a list of values
for the 'language' parameter, but let's try it anyway.
2014-09-05 14:35:50 -04:00
Robert S. Edmonds
1ccc5d4239 .travis.yml: install protobuf 2.5.0 from source
The travis-ci environment is based on Ubuntu 12.04 LTS, which has an
older protobuf version (2.4.1). We need to depend on features that are
only available in 2.5.0 (and, later, 2.6.0), so instead of satisfying
the protobuf build dependencies from the Ubuntu repository, download and
install our own copy of protobuf.

The travis-ci build from this commit should succeed, since we are
compatible with protobuf 2.5.0.

Based on a patch from Ilya Lipnitskiy.
2014-09-05 14:00:45 -04:00
Robert S. Edmonds
0c774499ef README.md: update protobuf URL to point to the new github location 2014-09-03 14:11:01 -04:00
Robert Edmonds
ce90c3be88 ChangeLog: 1.0.1 v1.0.1 2014-08-05 14:35:02 -04:00
Robert Edmonds
5c3a7b9464 bump version to 1.0.1 2014-08-05 14:30:33 -04:00
Robert Edmonds
108635a35f protobuf-c: parse_required_member(): zero bd->data in 0-length byte string case
in the case that we are unpacking a 0-length byte string, we need to
explicitly set bd->data to NULL, otherwise we may try to free() a stray
pointer when protobuf_c_message_free_unpacked() is called on the
containing message.

(Issue #157.)
2014-08-05 14:20:29 -04:00
Robert Edmonds
4c2225d0a7 ChangeLog: finalize for 1.0.0 v1.0.0 2014-07-22 19:19:46 -04:00
Robert Edmonds
b1c2ca4cf1 configure.ac: bump version to 1.0.0 2014-07-22 19:19:38 -04:00
Robert Edmonds
94ee39c8cb bump PROTOBUF_C_VERSION to 1.0.0 2014-07-22 19:19:13 -04:00
Robert Edmonds
a2fb491088 README.md: add details to the Versioning section 2014-07-15 00:14:27 -04: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
Robert Edmonds
93b9674e93 configure.ac: bump version to 1.0.0-rc2 v1.0.0-rc2 2014-06-27 17:59:43 -04:00
Robert Edmonds
448f04acd1 protobuf-c: bump PROTOBUF_C_VERSION to 1.0.0-rc2 2014-06-27 17:59:07 -04:00
Robert Edmonds
aa2f8697d8 Revert "protobuf-c: Add vim modeline magic at the end of the files"
This reverts commit e7dc76c54bf5869247ec0a330ae9cf7f5499154d.

i really dislike cluttering up files with editor-specific modelines, and
anyway the //-comments run afoul of #124.
2014-06-27 17:34:30 -04: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
Ilya Lipnitskiy
e7dc76c54b protobuf-c: Add vim modeline magic at the end of the files 2014-06-19 16:12:10 -07:00
Ilya Lipnitskiy
cc2506b948 protobuf-c.c: Fix compiler warnings 2014-06-19 16:12:10 -07:00
Robert Edmonds
713a748e62 ChangeLog: document the removal of protobuf_c_default_allocator and protobuf_c_system_allocator 2014-06-09 18:52:35 -04:00
Robert Edmonds
3decba7a16 remove protobuf_c_default_allocator
"protobuf_c_default_allocator" is the last bit of global data in
libprotobuf-c, and it can be hidden with some relatively easy (though
API/ABI-breaking) changes to ProtobufCBufferSimple.

all exported functions that take a ProtobufCAllocator either use the
provided allocator (if non-NULL), or switch to the default allocator (if
NULL). there are now two relatively unambiguous choices when a
ProtobufCAllocator is required by an exported function:

    1) use NULL. the vast majority of callers should pick this option.

    2) implement your own allocation functions, and enclose these in a
    ProtobufCAllocator struct.

in previous versions of protobuf-c there were two other possibilities:

    3) maybe use &protobuf_c_system_allocator?

    4) maybe use &protobuf_c_default_allocator?

this was relatively confusing, and by removing these latter two options
we can avoid having global library state.
2014-06-09 18:18:24 -04:00
Robert Edmonds
17d26c0af5 ChangeLog: doc updates 2014-06-09 16:49:58 -04:00
Robert Edmonds
cbb0f3dd0d doc/c-code-generator.{html,xml}: delete
most of the relevant material has now been updated and incorporated into
the doxygen documentation.
2014-06-09 16:31:53 -04:00
Robert Edmonds
3e126545b1 protobuf-c: add doxygen documentation derived from doc/c-code-generator.xml 2014-06-09 16:31:41 -04:00
Robert Edmonds
fc266579b8 add doxygen documentation for the protobuf-c implementation
based heavily on kevin lyda's work in PR #140.
2014-06-07 14:40:41 -04:00
Robert Edmonds
21382d1fca protobuf-c: consistently use TRUE and FALSE instead of 1 and 0
partially based on hunks split out of kevin lyda's PR #140.
2014-06-07 14:40:03 -04:00
Robert Edmonds
d14bb42d40 add doxygen documentation for the public header file
this also significantly reorganizes the header file.

based heavily on kevin lyda's work in PR #140.
2014-06-07 14:40:03 -04:00
Robert Edmonds
8655ca076d PROTOBUF_C_{NO_,}DEPRECATED -> PROTOBUF_C__{NO_,}DEPRECATED
these identifiers aren't intended for use by client code. add a double
underscore to indicate this.
2014-06-06 14:55:11 -04:00
Robert Edmonds
d05795c335 PROTOBUF_C_API -> PROTOBUF_C__API
this identifier isn't intended for use by client code. add a double
underscore to indicate this.
2014-06-06 14:52:29 -04:00
Robert Edmonds
af5120e678 PROTOBUF_C_{BEGIN,END}_DECLS -> PROTOBUF_C__{BEGIN,END}_DECLS
these identifiers aren't intended for use by client code. add a double
underscore to indicate this.
2014-06-06 14:50:14 -04:00
Andrei Nigmatulin
94e7cde263 cosmetics 2014-06-06 14:48:59 -04:00
Robert Edmonds
c96fee16c2 PROTOBUF_C_OFFSETOF -> offsetof
offsetof() conforms to the C89 standard, just call it directly.
2014-06-04 17:28:51 -04:00
Robert Edmonds
a1fa70c9b7 'struct _ProtobufC' -> 'struct ProtobufC'
identifiers in any scope that begin with an underscore and a capital
letter are reserved in C.
2014-06-04 17:25:45 -04:00
Robert Edmonds
97b6aa368b use double underscores in the MAGIC identifiers
these magic constants aren't intended for use by client code. add a
double underscore to indicate this.
2014-06-04 17:17:15 -04:00
Robert Edmonds
d0cadf1a4a PROTOBUF_C_ASSERT -> assert
assert() conforms to the C89 standard, just call it directly.
2014-06-04 17:14:44 -04:00
Robert Edmonds
298066893e remove PROTOBUF_C_ASSERT_NOT_REACHED from the public API
this macro isn't used anywhere except in the libprotobuf-c
implementation.
2014-06-04 17:11:49 -04:00
Robert Edmonds
6df737e0ca Doxyfile.in: enable MACRO_EXPANSION
this avoids littering function definitions in the documentation with
"PROTOBUF_C_API".
2014-06-03 17:57:27 -04:00
Robert Edmonds
ecc4febaba _PROTOBUF_C_FORCE_ENUM_TO_BE_INT_SIZE -> PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE
identifiers that begin with an underscore are reserved. instead, use a
double underscore in the *middle* of the identifier to indicate that
it's an "internal" identifier.
2014-06-03 17:43:21 -04:00
Robert Edmonds
de041d44ff protobuf-c: __PROTOBUF_C_RUNTIME_H_ -> PROTOBUF_C_H
identifiers that begin with a double underscore are reserved.
2014-06-03 17:39:49 -04:00
Robert Edmonds
0df53ea0c5 switch to a more automake-ish method of generating the html doxygen documentation 2014-06-03 17:30:13 -04:00
Robert Edmonds
e38b90f52b DoxygenLayout.xml: initial customizations 2014-06-03 17:29:22 -04:00
Robert Edmonds
aa5617bc1f Doxyfile.in: initial customizations 2014-06-03 17:29:22 -04:00