aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2016-01-27Replace uint8_t with a pb_byte_t typedef.Petteri Aimonen6-92/+111
This supports platforms where uint8_t does not exist. If you are using a custom pb_syshdr.h, this may require adding definitions for uint_least8_t etc.
2016-01-27Modify the int size STATIC_ASSERTS to work with CHAR_BITS!=8.Petteri Aimonen1-9/+3
This will still catch the most common bug of long int vs. long long int. The uint8_t checks do not seem necessary, test for this will be added in later commit.
2016-01-26Get rid of type punning in pb_encode_fixedXX().Petteri Aimonen2-54/+37
This was never very clean code, but it was fast. Hopefully compilers are smart enough to optimize it away, or the speed difference is not very large. This should be checked. However working code is always more important than fast code, and the previous way couldn't really work for platforms that do not have byte-sized memory access. Related to PR #191.
2015-12-16Merge pull request #190 from aeruder/masterPetteri Aimonen2-6/+14
pb_istream_from_buffer: add const to prototype
2015-12-16pb_istream_from_buffer: add const to prototypeAndrew Ruder2-6/+14
This commit changes the prototype for pb_istream_from_buffer from: pb_istream_t pb_istream_from_buffer(uint8_t *buf, size_t bufsize); to pb_istream_t pb_istream_from_buffer(const uint8_t *buf, size_t bufsize); This allows pb_istream_from_buffer users to point to const buffers without having to inspect code (to ensure practical const-ness) and then be forced to manually cast away const. In order to not break compatibility with existing programs (by introducing a const/non-const union in the pb_istream_t state) we simply cast away the const in pb_istream_from_buffer and re-apply it when possible in the callbacks. Unfortunately we lose any compiler help in the callbacks to ensure we are treating the buffer as const but manual inspection is easy enough.
2015-11-21Fix mistake in previous commitPetteri Aimonen1-1/+2
2015-11-20Fix generator crash with Enum inside Oneof (issue #188).Petteri Aimonen3-6/+45
Add testcase for the same.
2015-11-15Second fix for -pedantic build issue in testsPetteri Aimonen1-1/+2
2015-11-14Fix -Wno-pedantic on old GCCPetteri Aimonen1-1/+1
2015-11-14Add testcase for anonymous unions + few fixes.Petteri Aimonen5-7/+153
Fixes compilation error with anonymous unions when it is not the last field in message. Also fixes extraneous newlines in header file. Cleanup the pb.h extraneous use of ##.
2015-11-10Add option to allow for anonymous unionsBenjamin Kamath3-4/+35
2015-10-25Ignore null pointers in pb_release() (issue #183).Petteri Aimonen1-0/+3
2015-10-24Add contributing.md to provide issue templates on githubPetteri Aimonen1-0/+32
2015-10-17Merge pull request #181 from kylemanna/cmakePetteri Aimonen2-13/+31
Cmake updates
2015-10-15examples: cmake_simple: Use auto discovered pathKyle Manna1-2/+1
* No need to specify the src path and the module path. Let cmake do it.
2015-10-15cmake: Auto discover NANOPB_SRC_ROOT_FOLDERKyle Manna1-4/+6
* Use CMAKE_CURRENT_LIST_DIR to learn the path of the currently running file to determine location of NanoPB. * Simplifies use in other projects.
2015-10-15cmake: Build generator files in build directoryKyle Manna1-7/+24
Treat the source directory as immutable. Copy the generator directory which previously generated files in-tree to the build directory and then generate files. Many emerging continuous integration build systems test builds across multiple versions of dependencies protobuf and python versions in particular. The previous source tree builds resulted in stale files from the last build breaking the current build. By placing the build files in the build directory, the build system automatically removes stale files (removes output build directory) and regenerates them as necessary.
2015-10-08Merge pull request #176 from kylemanna/whitespacePetteri Aimonen1-137/+137
generator: Remove trailing whitespace
2015-10-07generator: Remove trailing whitespaceKyle Manna1-137/+137
* Remove trailing whitespace * No functional changes
2015-10-05Fix regression in generating message size defines (issue #172).Petteri Aimonen6-9/+45
This bug was triggered when: 1. A .proto file included another .proto from a different directory. 2. The another .proto has an associated .options file. Added regression test for the same.
2015-10-05Add random message generator to help with fuzz testingPetteri Aimonen2-0/+105
2015-10-01Fix bug in fuzzstub.Petteri Aimonen1-1/+1
The fread call always returned a message length of 1 byte, making the fuzz stub used for external fuzzers useless. The normal fuzztest.c was unaffected. Bug found using afl-fuzz.
2015-09-26Fix list formatting in readmePetteri Aimonen1-2/+2
2015-09-26Add documentation link to readmePetteri Aimonen1-1/+2
2015-09-26Fine-tune the readmePetteri Aimonen1-6/+11
2015-09-26Clean up the python2/python3 string type handlingPetteri Aimonen1-10/+9
2015-09-26Merge pull request #170 from kylemanna/travis-ciPetteri Aimonen1-0/+54
Add Travis CI Support
2015-09-26Merge pull request #169 from kylemanna/python3Petteri Aimonen3-51/+67
Add proper Python3 support to the generator
2015-09-26Setting version to 0.3.5-devPetteri Aimonen2-2/+2
2015-09-26Publishing nanopb-0.3.4Petteri Aimonen3-3/+4
2015-09-24Add initialization to examples/simplePetteri Aimonen2-6/+12
2015-09-22Merge pull request #171 from kylemanna/miscPetteri Aimonen1-1/+2
decode: Fix compiler issue with gcc-5
2015-09-21decode: Fix compiler issue with gcc-5Kyle Manna1-1/+2
* gcc 5.0 and 5.1 appear to take issue with this line and generates the following error: /home/nitro/tmp/nanopb/pb_decode.c: In function ‘pb_decode_noinit’: /home/nitro/tmp/nanopb/pb_decode.c:889:60: error: conversion to ‘uint8_t {aka unsigned char}’ from ‘int’ may alter its value [-Werror=conversion] fields_seen[iter.required_field_index >> 3] |= (uint8_t)(1 << (iter.required_field_index & 7)); ^ * This seems like a compiler bug, but this workaround is harmless.
2015-09-21travis-ci: Use protobuf v3 as it adds python3Kyle Manna1-5/+3
* Still in testing currently.
2015-09-21travis-ci: Build C/C++/Python matrixKyle Manna1-10/+38
* Test a number of C compilers * Travis CI can't handle three languages (C, C++, Python) * Add support for swapping python2/3 binaries * Scons has made no attempts to support python3 yet: * Build the matrix manually * Scons doesn't inherit $CC/$CXX from parent environement, so pass compiler flags directly
2015-09-21generator: Use search $PATH for pythonKyle Manna1-1/+1
* Search $PATH for the python binary so that this works better with things like virtualenv as used on Travis CI
2015-09-20travis-ci: Initial working buildKyle Manna1-0/+28
* Initial working build for Travis CI build system.
2015-09-20generator: Fix strange unicode/str issue in python2Kyle Manna1-1/+8
* Work around this by checking the appropriate class for the given * environment.
2015-09-20generator: Attempt to simplify the str/unicode madnessKyle Manna1-0/+2
* This is a shot in the dark.
2015-09-20generator: Strings are utf-8 by default in python3Kyle Manna1-4/+2
* Not sure how to handle this case in python2, seems to work * Python 3 doesn't need this since all strings are utf-8
2015-09-20generator: Remove cmp() to work with Python3Kyle Manna1-5/+2
* Python3 ignores cmp() and __cmp__() and only needs __lt__() for sorting. Delete and update as appropriate. * Ref: https://docs.python.org/3.0/whatsnew/3.0.html#ordering-comparisons
2015-09-20generator: More exhaustive field size checkingKyle Manna1-15/+36
Create a FieldMaxSize class that: * Accumlates all C assertions * Handles the checking of the longest simple field * Also python3 doesn't support max(None)
2015-09-20generator: Use python2/3 binary read/write methodKyle Manna1-3/+4
* This works with python2 and python3
2015-09-20generator: Run python's 2to3 converterKyle Manna1-10/+11
* Invoked with `2to3 -w nanopb_generator.py` * No other changes.
2015-09-20cmake: Don't explicitly look for python2Kyle Manna1-12/+2
* Use the system python binary and make sure the generator works with both instead.
2015-09-20generator: Don't force python2Kyle Manna1-2/+1
Python2 is being phased out of the default python interpreter. Arch Linux has moved some time ago and upcoming Debian realeases will follow. My distro, Arch, doesn't have a python2-protobuf version, but does have a python3 version. With a python 2 & 3 compatible generator the exact interpreter can be ignored and can use the system default as most users expect. Update issue #155
2015-09-20Update changelogPetteri Aimonen1-1/+9
2015-09-20Add syntax specification to .proto files (issue #167)Petteri Aimonen33-13/+80
Eliminates a warning on protoc 3.0.
2015-09-13Fix maximum encoded size for negative enums (issue #166).Petteri Aimonen4-1/+87
2015-09-12Make the generator understand included files (issue #165).Petteri Aimonen6-36/+70
This will allow message sizes and enum options to be available across the include files. Currently searching for .options files for included files may not work for all path combinations, this is related to issue #116. Should probably make a pull request to protoc about that.