platform/upstream/flatbuffers.git
8 years agoMerge pull request #3706 from evolutional/fix-3506
Wouter van Oortmerssen [Tue, 19 Jan 2016 19:10:07 +0000 (11:10 -0800)]
Merge pull request #3706 from evolutional/fix-3506

Check (& skip) of the utf-8 byte order mark

8 years agoMerge pull request #3513 from evolutional/fix-3500
Wouter van Oortmerssen [Tue, 19 Jan 2016 18:40:02 +0000 (10:40 -0800)]
Merge pull request #3513 from evolutional/fix-3500

Java/C#: generation of typed helpers when using nested_flatbuffers

8 years agoMerge pull request #3498 from ncpenke/gcc-4.4.3-support
Wouter van Oortmerssen [Tue, 19 Jan 2016 18:27:57 +0000 (10:27 -0800)]
Merge pull request #3498 from ncpenke/gcc-4.4.3-support

Gcc 4.4.3 support

8 years agoAdded check (& skipping) of the utf-8 byte order mark (0xEF BB BF) at the beginning...
Oli Wilkinson [Mon, 18 Jan 2016 18:58:53 +0000 (18:58 +0000)]
Added check (& skipping) of the utf-8 byte order mark (0xEF BB BF) at the beginning of the file

8 years agoAdded generation of typed helpers when using nested_flatbuffers in Java/C#. Fixes...
Oli Wilkinson [Mon, 18 Jan 2016 15:23:14 +0000 (15:23 +0000)]
Added generation of typed helpers when using nested_flatbuffers in Java/C#. Fixes #3500

8 years agoFix #3497: Add support for compiling in g++ 4.4 and 4.5
Chandra Penke [Wed, 6 Jan 2016 16:31:53 +0000 (08:31 -0800)]
Fix #3497: Add support for compiling in g++ 4.4 and 4.5

- Removed uses of lambda expressions

- Added custom defines for constexpr and nullptr

- Removed trailing comma of last value from generated enums

8 years agoEnsured code is not generated directly from .proto files.
Wouter van Oortmerssen [Fri, 8 Jan 2016 19:39:56 +0000 (11:39 -0800)]
Ensured code is not generated directly from .proto files.

The parser state generated from the .proto conversion process is
not exactly the same as what you get by parsing the generated
schema, which can cause problems. This check enforces that you
first convert the .proto, then generate code from the new schema.

Change-Id: I04b53af9288d87e256d1cc109388332fefb3a09f
Tested: on Linux.

8 years agoAdded android static library target for text parsing/generation etc.
Wouter van Oortmerssen [Thu, 7 Jan 2016 01:48:19 +0000 (17:48 -0800)]
Added android static library target for text parsing/generation etc.

Change-Id: If24e3eea90cef2a0d6a9d98fb503d2e3ec34ceed
Tested: on Linux.

8 years agoUpdated docs to point to benchmark source code location.
Wouter van Oortmerssen [Thu, 7 Jan 2016 00:51:00 +0000 (16:51 -0800)]
Updated docs to point to benchmark source code location.

Change-Id: If4c8fac6a421ac6436cab0dd7a0ae822a32e90bf

8 years agoMerge pull request #2098 from faizanrashid/issue-1741
Robert [Thu, 7 Jan 2016 00:13:59 +0000 (16:13 -0800)]
Merge pull request #2098 from faizanrashid/issue-1741

[BUG] [MINOR] Use buffer for specific py versions

8 years agoMerge pull request #3494 from parnic/fix-vs2012-static-analysis
Wouter van Oortmerssen [Wed, 6 Jan 2016 20:34:08 +0000 (12:34 -0800)]
Merge pull request #3494 from parnic/fix-vs2012-static-analysis

Fixed MS static analysis warnings

8 years agoChanged how the SA warning is suppressed to avoid pragma stuff
Chris Pickett [Wed, 6 Jan 2016 20:21:18 +0000 (14:21 -0600)]
Changed how the SA warning is suppressed to avoid pragma stuff

8 years agoMerge pull request #3495 from parnic/fix-reflection-vs2012-warnings
Wouter van Oortmerssen [Wed, 6 Jan 2016 20:03:40 +0000 (12:03 -0800)]
Merge pull request #3495 from parnic/fix-reflection-vs2012-warnings

Fixed warning building in VS2012

8 years agoMerge pull request #3493 from parnic/support-platforms-without-realpath
Wouter van Oortmerssen [Wed, 6 Jan 2016 19:52:37 +0000 (11:52 -0800)]
Merge pull request #3493 from parnic/support-platforms-without-realpath

Fix build for platforms not supporting realpath

8 years agoFixed warning building in VS2012
Chris Pickett [Wed, 6 Jan 2016 18:33:19 +0000 (12:33 -0600)]
Fixed warning building in VS2012

src\reflection.cpp(297): warning C4267: 'argument' : conversion from 'size_t' to 'flatbuffers::uoffset_t', possible loss of data

sizeof() was promoting the type from uoffset_t to size_t.

8 years agoUpdated comment on endif for new name
Chris Pickett [Wed, 6 Jan 2016 18:21:17 +0000 (12:21 -0600)]
Updated comment on endif for new name

8 years agoMade requested revisions for naming and spacing
Chris Pickett [Wed, 6 Jan 2016 18:20:38 +0000 (12:20 -0600)]
Made requested revisions for naming and spacing

8 years agoDocumented what the suppressed warning is about
Chris Pickett [Wed, 6 Jan 2016 18:04:46 +0000 (12:04 -0600)]
Documented what the suppressed warning is about

8 years agoMerge pull request #3492 from parnic/fix-vs2012-warnings
Wouter van Oortmerssen [Wed, 6 Jan 2016 17:39:23 +0000 (09:39 -0800)]
Merge pull request #3492 from parnic/fix-vs2012-warnings

Fix vs2012 warnings

8 years agoMerge pull request #3 from google/master
ncpenke [Wed, 6 Jan 2016 16:18:04 +0000 (10:18 -0600)]
Merge pull request #3 from google/master

Catchup

8 years agoFixed MS static analysis warnings
Chris Pickett [Tue, 5 Jan 2016 19:38:03 +0000 (13:38 -0600)]
Fixed MS static analysis warnings

Cleaned up a few warnings to allow VS2012 to compile idl_parser and idl_gen_text (for exporting binary protobuf blobs as JSON) cleanly under static analysis.

8 years agoFix build for platforms not supporting realpath
Chris Pickett [Tue, 5 Jan 2016 16:58:46 +0000 (10:58 -0600)]
Fix build for platforms not supporting realpath

Added a check for a preprocessor definition that can be set if the platform you're building for doesn't support any notion of absolute path resolution/realpath()/etc.

8 years agoFixed compile warning with VS2012
Chris Pickett [Tue, 5 Jan 2016 16:58:40 +0000 (10:58 -0600)]
Fixed compile warning with VS2012

flatbuffers\src\idl_parser.cpp(1516): warning C4244: 'argument' : conversion from 'int' to 'char', possible loss of data

8 years agoFixed compile warning with VS2012
Chris Pickett [Tue, 5 Jan 2016 16:58:21 +0000 (10:58 -0600)]
Fixed compile warning with VS2012

flatbuffers\src\idl_parser.cpp(1525): warning C4127: conditional expression is constant
flatbuffers\src\idl_parser.cpp(1546): warning C4127: conditional expression is constant

8 years agoMerge branch 'master' of https://github.com/google/flatbuffers
Wouter van Oortmerssen [Mon, 4 Jan 2016 21:06:19 +0000 (13:06 -0800)]
Merge branch 'master' of https://github.com/google/flatbuffers

Fixed conflicts and added missing generated files.

Change-Id: I4321c798543292d814c2c9e8b238c203b7526c7b

8 years agoClarified binary encoding with an example.
Wouter van Oortmerssen [Wed, 30 Dec 2015 01:05:18 +0000 (17:05 -0800)]
Clarified binary encoding with an example.

Change-Id: I60c900a2f7cbd88fe264f7b0dc78ef86b1580655
Tested: in Chrome.

8 years agoMerge pull request #2 from google/master
ncpenke [Sat, 2 Jan 2016 06:59:41 +0000 (06:59 +0000)]
Merge pull request #2 from google/master

Catchup

8 years agoMade error checking macros less prone to clashes.
Wouter van Oortmerssen [Wed, 30 Dec 2015 00:33:00 +0000 (16:33 -0800)]
Made error checking macros less prone to clashes.

Change-Id: Ieb252ce01446551699d935507bc95ee286fe1ddd
Tested: on Linux.

8 years agoMerge pull request #2776 from ncpenke/skip-unknown-json-fields
Wouter van Oortmerssen [Tue, 29 Dec 2015 18:29:11 +0000 (10:29 -0800)]
Merge pull request #2776 from ncpenke/skip-unknown-json-fields

Fix #2775: Add parser option to skip unknown JSON fields

8 years agoMerge pull request #2790 from chobie/php-table-fix
Wouter van Oortmerssen [Tue, 29 Dec 2015 18:25:21 +0000 (10:25 -0800)]
Merge pull request #2790 from chobie/php-table-fix

(PHP) fixes getting indirect table, also fixes getInt method on 32bit machine

8 years ago(PHP) remove duplicate test
Shuhei Tanuma [Thu, 24 Dec 2015 06:50:03 +0000 (15:50 +0900)]
(PHP) remove duplicate test

8 years ago(PHP) improve indirect buffer test
Shuhei Tanuma [Thu, 24 Dec 2015 06:35:28 +0000 (15:35 +0900)]
(PHP) improve indirect buffer test

8 years agoFix #2775: Add option to flatc to skip unknown fields in JSON
Nalinichandra Penke [Tue, 22 Dec 2015 08:13:22 +0000 (00:13 -0800)]
Fix #2775: Add option to flatc to skip unknown fields in JSON

8 years agoFix #2775: Add parser option to skip unknown JSON fields
Nalinichandra Penke [Tue, 22 Dec 2015 08:02:19 +0000 (00:02 -0800)]
Fix #2775: Add parser option to skip unknown JSON fields

8 years agoMerge pull request #1 from google/master
ncpenke [Tue, 22 Dec 2015 06:56:49 +0000 (22:56 -0800)]
Merge pull request #1 from google/master

Catchup

8 years agoFixed reflection setting string not changing size field.
Wouter van Oortmerssen [Tue, 22 Dec 2015 00:17:50 +0000 (16:17 -0800)]
Fixed reflection setting string not changing size field.

Change-Id: I3c3e88a79667d1733b6c47e43b55d8b2604ca8e2
Tested: on Linux.

8 years agoMerge branch 'master' of https://github.com/google/flatbuffers
Wouter van Oortmerssen [Mon, 21 Dec 2015 22:43:48 +0000 (14:43 -0800)]
Merge branch 'master' of https://github.com/google/flatbuffers

8 years agoAdded an IsFieldPresent helper function.
Wouter van Oortmerssen [Sat, 19 Dec 2015 01:01:34 +0000 (17:01 -0800)]
Added an IsFieldPresent helper function.

This is implemented as a template function, since Table::CheckField
is not reachable by subclasses of Table (private base class).

Change-Id: I1ed4d47ce7cb672460ccab61cf7442eb9136b0f1
Tested: on Linux.
Bug: 26273432

8 years agoReplaced exception handling in the parser with error checking.
Wouter van Oortmerssen [Thu, 10 Dec 2015 02:06:56 +0000 (18:06 -0800)]
Replaced exception handling in the parser with error checking.

This to allow the code to run on a greater range of build
configurations (that don't allow exceptions/RTTI).

If anyone ever doubts the usefulness of exception handling,
please show them this commit.

Change-Id: If7190babdde93c3f9cd97b8e1ab447bf0c81696d
Tested: on Linux.

8 years ago(PHP) fixes getting indirect table, also fixes getInt method on 32bit machine.
Shuhei Tanuma [Thu, 17 Dec 2015 02:35:31 +0000 (11:35 +0900)]
(PHP) fixes getting indirect table, also fixes getInt method on 32bit machine.

8 years agoMerge pull request #2601 from AaronCritchley/patch-1
Wouter van Oortmerssen [Wed, 16 Dec 2015 17:59:22 +0000 (09:59 -0800)]
Merge pull request #2601 from AaronCritchley/patch-1

Improving the README by linking to the SO tag, and changing SO wording.

8 years agoLinking to SO tag and improving readability
Aaron Critchley [Tue, 15 Dec 2015 21:06:01 +0000 (21:06 +0000)]
Linking to SO tag and improving readability

8 years agoMade sure all namespace test files get generated.
Wouter van Oortmerssen [Thu, 10 Dec 2015 01:06:11 +0000 (17:06 -0800)]
Made sure all namespace test files get generated.

Also included them in the C++ test.

Change-Id: Ib0c8470f0aacdf16616c27494abdda57a010195d
Tested: on Linux.

8 years agoMerge pull request #2090 from evolutional/cs-perf-string
Wouter van Oortmerssen [Mon, 14 Dec 2015 23:16:46 +0000 (15:16 -0800)]
Merge pull request #2090 from evolutional/cs-perf-string

C# - Performance optimizations

8 years ago[BUG] [MINOR] Use buffer for specific py versions
Faizan Rashid [Sun, 13 Dec 2015 07:55:16 +0000 (02:55 -0500)]
[BUG] [MINOR] Use buffer for specific py versions

Fix for Issue 1741
Minor bug where python versions 2.7.x where x < 5 do not support
unpacking from memoryview objects. Versions 2.7.5 and above will
use memoryview while 2.7 versions below 2.7.5  will use buffer
objects.

Manual testing was performed on versions 2.7.5 and 2.7.2 to
confirm both worked correctly.

8 years agoC# performance optimization to Pad/Prep methods
Oli Wilkinson [Sat, 12 Dec 2015 16:39:57 +0000 (11:39 -0500)]
C# performance optimization to Pad/Prep methods

8 years agoPerformance tweak to FlatBufferBuilder.CreateString method to remove the unnecessary...
Oli Wilkinson [Fri, 11 Dec 2015 19:57:59 +0000 (14:57 -0500)]
Performance tweak to FlatBufferBuilder.CreateString method to remove the unnecessary byte buffer allocation

(See https://github.com/google/flatbuffers/issues/55#issuecomment-164031718 for stats)

8 years agoFixed root_type not accepting namespaced types.
Wouter van Oortmerssen [Thu, 10 Dec 2015 00:41:12 +0000 (16:41 -0800)]
Fixed root_type not accepting namespaced types.

Change-Id: I272f377742cc0a2c1bfccaa641b54eb9a8c762b6
Tested: on Linux.

8 years agoMerge branch 'master' of https://github.com/google/flatbuffers
Wouter van Oortmerssen [Wed, 9 Dec 2015 20:57:12 +0000 (12:57 -0800)]
Merge branch 'master' of https://github.com/google/flatbuffers

8 years agoFixed compiler warnings for cast to bool in generated code.
Wouter van Oortmerssen [Wed, 9 Dec 2015 20:56:24 +0000 (12:56 -0800)]
Fixed compiler warnings for cast to bool in generated code.

Change-Id: I7727aeb478feb23d8ef66fd1ba9499b142b3ea7d
Tested: on Linux.

8 years agoMerge pull request #288 from mfcollins3/csharp-byte-buffer
Wouter van Oortmerssen [Tue, 8 Dec 2015 01:35:57 +0000 (17:35 -0800)]
Merge pull request #288 from mfcollins3/csharp-byte-buffer

Add Get Bytes Method Generator for C#

8 years agoMerge pull request #776 from belldon/bytebuffer_pos_fix
Wouter van Oortmerssen [Tue, 8 Dec 2015 00:19:05 +0000 (16:19 -0800)]
Merge pull request #776 from belldon/bytebuffer_pos_fix

Extend C# ByteBuffer Put method fix to unsafe methods

8 years agoMerge pull request #1029 from belldon/vtable_reuse
Wouter van Oortmerssen [Mon, 7 Dec 2015 22:42:04 +0000 (14:42 -0800)]
Merge pull request #1029 from belldon/vtable_reuse

Update C# FlatBufferBuilder to reuse vtable array

8 years agoExtend C# ByteBuffer Put method fix to unsafe methods
belldon [Thu, 3 Dec 2015 21:11:27 +0000 (16:11 -0500)]
Extend C# ByteBuffer Put method fix to unsafe methods

Fixes issue #243.  Extends the initial C# ByteBuffer fix
(e4c3bf3d2cec00522fd1a8edd8704413cdc1303b) to Put methods
used when UNSAFE_BYTEBUFFER is defined.

8 years agoUpdate C# FlatBufferBuilder to reuse vtable array
belldon [Fri, 4 Dec 2015 15:49:03 +0000 (10:49 -0500)]
Update C# FlatBufferBuilder to reuse vtable array

This commit updates the FlatBufferBuilder class to reuse the vtable
array instead of creating a new array with every StartObject() call.

8 years agoMerge pull request #608 from evolutional/master
Wouter van Oortmerssen [Mon, 7 Dec 2015 18:33:38 +0000 (10:33 -0800)]
Merge pull request #608 from evolutional/master

Fix to #360 - Fully qualified names outside of current NS

8 years agoMerge pull request #778 from armen/master
Wouter van Oortmerssen [Mon, 7 Dec 2015 18:27:27 +0000 (10:27 -0800)]
Merge pull request #778 from armen/master

Correct the max/min signed/unsigned 32-bit int

8 years agoFixed language for generators not being set correctly.
Wouter van Oortmerssen [Mon, 7 Dec 2015 17:53:04 +0000 (09:53 -0800)]
Fixed language for generators not being set correctly.

Change-Id: I36c1f05efa836b32635e3274ac0ba976a8961bdd
Tested: on Linux.

8 years agoOptimize get* operation
Armen Baghumian [Fri, 4 Dec 2015 06:10:11 +0000 (06:10 +0000)]
Optimize get* operation

It's slightly faster to convert the value to signed value in PHP as
opposed to use pack and unpack.

For 1M get operation the difference is:

    getShort in 3.3272678852081 seconds
    getInt in 3.8338589668274 seconds
    getLong in 5.6381590366364 seconds
    getLong (neg) in 5.6149101257324 seconds

vs

    getShort in 2.7564418315887 seconds
    getInt in 3.1612701416016 seconds
    getLong in 3.1369340419769 seconds
    getLong (neg) in 3.1478710174561 seconds

And since pack("P") and unpack("q") has been removed now ByteBuffer
works for PHP >= 5.4

8 years agoCorrect the max/min signed/unsigned 32-bit int
Armen Baghumian [Fri, 4 Dec 2015 03:05:42 +0000 (03:05 +0000)]
Correct the max/min signed/unsigned 32-bit int

The test was trying to pack an unsigned int which couldn't fit as a
signed int and putInt() wasn't doing the validation in the correct range

8 years agoFix to #360 - Updated the general generator (Java/C#) to emit fully qualified names...
Oli Wilkinson [Sun, 29 Nov 2015 20:31:55 +0000 (15:31 -0500)]
Fix to #360 - Updated the general generator (Java/C#) to emit fully qualified names where the referenced object isn't directly in this namespace. Added test fbs files to verify compilation.

8 years agoAdd Get Bytes Method Generator for C#
Michael Collins [Mon, 5 Oct 2015 02:57:39 +0000 (19:57 -0700)]
Add Get Bytes Method Generator for C#

I updated idl_gen_general.cpp to add support for generating a Get Bytes
method for a vector to the generated C# source code. Given a byte vector
field named Foo, a method named GetFooBytes() will be generated in the
C# source code that will return an ArraySegment<byte> value referencing
the vector data in the underlying ByteBuffer.

I added a method to Table.cs named __vector_as_arraysegment that is used
by the code generated by the change to the C# generator.
__vector_as_arraysegment will take the offset of the vector and will
return the ArraySegment<byte> value corresponding to the bytes that
store the vector data.

I updated FlatBuffersExampleTests.cs to add tests to validate my
implementation of Table.__vector_as_arraysegment. I added tests to
demonstrate that the bytes for the monster's name can be extracted from
the underlying byte array. I also added tests to show that
Table.__vector_as_arraysegment returns a null value if the vector is not
present in the FlatBuffer.

I used the updated flatc.exe program to regenerate the C# source files
for the MyGame example. The new Monster class includes the GetXXXBytes
methods to return the byte arrays containing data for vectors.

8 years agoDo not create empty enums.
Jason Sanmiya [Fri, 4 Dec 2015 15:09:16 +0000 (07:09 -0800)]
Do not create empty enums.

Mac build issued a warning for enum{}.

Change-Id: I9cab958538ac3cec61aeae289d1da0118ecac15f
Tested: Mac build no longer issues warnings.

8 years agoAdded --gen-all to generate code for a schema and all its includes.
Wouter van Oortmerssen [Tue, 1 Dec 2015 01:42:19 +0000 (17:42 -0800)]
Added --gen-all to generate code for a schema and all its includes.

Also refactored the way options are stored.

Change-Id: I709ac908cd2aba396c9c282725cf1d42ccce0882
Tested: on Linux.

8 years agoFixed implicit dereference in flatc.
Wouter van Oortmerssen [Tue, 1 Dec 2015 01:49:51 +0000 (17:49 -0800)]
Fixed implicit dereference in flatc.

Change-Id: If2e62a325b47399561b4c20d2def55ede4831d19
Tested: on Linux.

8 years agoLink clang builds against libc++abi on Linux
Perry Hung [Tue, 1 Dec 2015 00:41:54 +0000 (19:41 -0500)]
Link clang builds against libc++abi on Linux

Simply running clang with -stdlib=libc++ requires a manual link against
libc++abi on Linux. This is documented in the libc++ documentation:
    http://libcxx.llvm.org/

Tested on Arch Linux, using clang 3.7.0 RELEASE.

Signed-off-by: Perry Hung <iperry@gmail.com>
8 years agoMultiple schemas parsed by flatc are now parsed independently.
Wouter van Oortmerssen [Tue, 1 Dec 2015 00:42:48 +0000 (16:42 -0800)]
Multiple schemas parsed by flatc are now parsed independently.

It used to be such that later schemas could depend on earlier
schemas. This was a convenience from days before include files
were implemented. Nowadays they cause subtle bugs rather than being
useful, so this functionality has been removed.

You now need to explicitly include files you depend upon.

Change-Id: Id8292c3c621fc38fbd796da2d2cbdd63efc230d1
Tested: on Linux.

8 years agoC++ generated code now has constants for vtable offsets.
Wouter van Oortmerssen [Mon, 30 Nov 2015 22:27:47 +0000 (14:27 -0800)]
C++ generated code now has constants for vtable offsets.

Besides making the generated code looking a lot more readable,
it also allows you to use these offsets in calls to
Table::CheckField, to see if a field is present in a table.

Change-Id: I1b4cc350c4f27c4e474c31add40c701ef4ae63b2
Tested: On Linux.

8 years agoMade C++ generated code use "bool" instead of uint8_t wire type.
Wouter van Oortmerssen [Mon, 30 Nov 2015 21:54:24 +0000 (13:54 -0800)]
Made C++ generated code use "bool" instead of uint8_t wire type.

Change-Id: I5756d15a758429ca67456264842017063d1f755e
Tested: on Linux.

8 years agoAllow vectors to be aligned beyond their natural type.
Wouter van Oortmerssen [Mon, 30 Nov 2015 19:50:09 +0000 (11:50 -0800)]
Allow vectors to be aligned beyond their natural type.

Change-Id: I09ade6b688a6b97d65fd832558917225d86c9118

8 years agoJava builder now checks if buffer was finished upon access.
Wouter van Oortmerssen [Mon, 30 Nov 2015 19:25:21 +0000 (11:25 -0800)]
Java builder now checks if buffer was finished upon access.

Also checks for nesting of objects in vector construction.

This avoids common errors in FlatBuffer construction.

Change-Id: I5507c5d767684e20e94883a92448f05acefba4d6
Tested: on Linux.

8 years agoFix use of std::max when Windows.h is imported.
Chris [Fri, 27 Nov 2015 20:06:41 +0000 (20:06 +0000)]
Fix use of std::max when Windows.h is imported.

8 years agoReturn the full string when requested from a flatbuffers::String, even if it contains...
Chris [Fri, 27 Nov 2015 20:05:48 +0000 (20:05 +0000)]
Return the full string when requested from a flatbuffers::String, even if it contains a NULL byte.

8 years agoAdded long form options for all generators (--cpp etc.)
Wouter van Oortmerssen [Thu, 26 Nov 2015 01:26:34 +0000 (17:26 -0800)]
Added long form options for all generators (--cpp etc.)

Short-form versions are still supported, but are deprecated.

Change-Id: I15f70ca8d69ba5790368205caa9603b65e1b7fff
Tested: on Linux.

8 years agoMade generated C++ code respect gcc -Werror=shadow.
Wouter van Oortmerssen [Thu, 26 Nov 2015 00:48:28 +0000 (16:48 -0800)]
Made generated C++ code respect gcc -Werror=shadow.

Change-Id: I17de0bcc462770124227a9967e2aab620467f6eb
Tested: on Linux.

8 years agoFixed crash related to flatc parsing duplicate input files.
Wouter van Oortmerssen [Wed, 25 Nov 2015 23:50:30 +0000 (15:50 -0800)]
Fixed crash related to flatc parsing duplicate input files.

Thanks @Chaosvex for reporting.

Change-Id: I73f60ab0bf875a3e0849eaec5f42f6d036881094
Tested: on Linux.

8 years agoMerge pull request #353 from takaken1994/master
Wouter van Oortmerssen [Wed, 25 Nov 2015 21:40:00 +0000 (13:40 -0800)]
Merge pull request #353 from takaken1994/master

C++: Fixed generated header file cannot be compiled when the type of key is enum class

8 years agoMerge pull request #349 from belldon/enum-fix
Wouter van Oortmerssen [Wed, 25 Nov 2015 21:14:28 +0000 (13:14 -0800)]
Merge pull request #349 from belldon/enum-fix

Fixes issue #348: C# vector of enums doesn't compile

8 years agoFix C# vector of enum code generation
Donnell [Sat, 14 Nov 2015 04:39:46 +0000 (23:39 -0500)]
Fix C# vector of enum code generation

Fixes a bug where the logic to determine when to use a C# enum flags
both enums and vectors of enums.  This causes the C# generator to
generate code that doesn't compile for tables that contain vectors of
enums.

The fix also consolidates type generation functions a bit and adds
some additional casting functions for clarity.

8 years agoMerge pull request #362 from chobie/fix-projectfile
Wouter van Oortmerssen [Fri, 20 Nov 2015 21:43:57 +0000 (13:43 -0800)]
Merge pull request #362 from chobie/fix-projectfile

Fix projectfile (VisualStudio, XCode) for development

8 years agoalso, fix xcode project
Shuhei Tanuma [Fri, 20 Nov 2015 20:38:57 +0000 (05:38 +0900)]
also, fix xcode project

8 years agoAdd missing idl_gen_php.cpp to VisualStudio project
Shuhei Tanuma [Fri, 20 Nov 2015 20:33:30 +0000 (05:33 +0900)]
Add missing idl_gen_php.cpp to VisualStudio project

8 years agoMerge remote-tracking branch internal into fb_upstream
Stewart Miles [Thu, 19 Nov 2015 11:07:49 +0000 (03:07 -0800)]
Merge remote-tracking branch internal into fb_upstream

8 years agoFixed typo in cmake build rule for Linux.
Stewart Miles [Thu, 19 Nov 2015 11:02:58 +0000 (03:02 -0800)]
Fixed typo in cmake build rule for Linux.

Tested:
Verified it's possible to build generated headers on Linux for Android.

Change-Id: I82249a252cb851b978a177f4a4b92b527cc2bfd9

8 years agoWorkaround broken gnumake realpath on Windows.
Stewart Miles [Thu, 19 Nov 2015 05:02:13 +0000 (21:02 -0800)]
Workaround broken gnumake realpath on Windows.

Also, added missing build scripts for flatc on Windows and fixed
numerous issues in the flatbuffers/android/jni/include.mk makefile.

Tested:
Verified dependent project (motive) can generate flatbuffers headers
with these changes on Android.

Bug: 25780616

Change-Id: I73f0dec8f7a6a7eb4e71951a8f1cd3e0d343a9ff

8 years agoMerge pull request #359 from proppy/move-build-fb
Wouter van Oortmerssen [Wed, 18 Nov 2015 18:10:07 +0000 (10:10 -0800)]
Merge pull request #359 from proppy/move-build-fb

flatbuffers/cmake: move build_flatbuffers to a standalone file

8 years agoMerge pull request #308 from chobie/php
Wouter van Oortmerssen [Wed, 18 Nov 2015 17:31:17 +0000 (09:31 -0800)]
Merge pull request #308 from chobie/php

Add support for PHP code.

8 years agoMerge pull request #312 from chobie/unity-fix
Wouter van Oortmerssen [Wed, 18 Nov 2015 17:28:00 +0000 (09:28 -0800)]
Merge pull request #312 from chobie/unity-fix

C# Unity (.NET 3.5) can't cast enum default value.

8 years agoflatbuffers/cmake: move build_flatbuffers to a standalone file
Johan Euphrosine [Tue, 17 Nov 2015 21:39:37 +0000 (13:39 -0800)]
flatbuffers/cmake: move build_flatbuffers to a standalone file

So that it could be included from both flatbuffers CMakeLists.txt and
FindFlatBuffers.cmake.

Change-Id: Ie16a879beef9367cd6fd9b2d2157044841a7cdbc

8 years ago(PHP) add experimental support for PHP language.
Shuhei Taunma [Thu, 5 Nov 2015 07:19:28 +0000 (16:19 +0900)]
(PHP) add experimental support for PHP language.

* codegen for all basic features: WIP (probably implemented all basic feature)
* JSON parsing: NO
* Simple mutation: NO
* Reflection: NO
* Buffer verifier: NO (will be add later)
* Testing: basic: Yes
* Testing: fuzz: Yes
* Performance: Not bad
* Platform: Supported Linux, OS X, Windows (has 32bit integer limitation)
* Engine Unity: No

flatc --php monster_test.fbs

  <?php
  //include neccessary files.
  $fbb = new Google\FlatBuffers\FlatBufferBuilder(1);
  $str = $fbb->createString("monster");
  \MyGame\Example\Monster::startMonster($fbb);
  \MyGame\Example\Monster::addHp($fbb, 80);
  \MyGame\Example\Monster::addName($fbb, $str);
  $mon = \MyGame\Example\Monster::endMonster($fbb);
  $fbb->finish($mon);
  echo $fbb->sizedByteArray();

PHP 5.4 higher

Currently, we do not register this library to packagist as still experimental and versioning problem.
If you intended to use flatbuffers with composer. add repostiories section to composer.json like below.

  "repositories": [{
    "type": "vcs",
    "url": "https://github.com/google/flatbuffers"
  }],

 and just put google/flatbuffers.

  "require": {
    "google/flatbuffers": "*"
  }

* PHP's integer is platform dependant. we strongly recommend use 64bit machine
  and don't use uint, ulong types as prevent overflow issue.
  ref: http://php.net/manual/en/language.types.integer.php

* php don't support float type. floating point numbers are always parsed as double precision internally.
  ref: http://php.net/manual/en/language.types.float.php

* ByteBuffer is little bit slow implemnentation due to many chr/ord function calls. Especially encoding objects.
  This is expected performance as PHP5 has parsing arguments overhead. probably we'll add C-extension.

Basically, PHP implementation respects Java and C# implementation.

Note: ByteBuffer and FlatBuffersBuilder class are not intended to use other purposes.
      we may change internal API foreseeable future.

PSR-2, PSR-4 standards.

Implemented simple assertion class (respect JavaScript testcase implementation) as we prefer small code base.
this also keeps CI iteration speed.

we'll choose phpunit or something when the test cases grown.

8 years agoC# Unity can't cast integer represented enum value.
Shuhei Tanuma [Thu, 5 Nov 2015 22:47:39 +0000 (07:47 +0900)]
C# Unity can't cast integer represented enum value.

```
namespace MyGame;

enum CommandType : byte {
None = 0,
}

table Command {
id:int;
type:CommandType;
}
```

then generate c# files. it'll output compile error like these.

```
Assets/MyGame/Command.cs(18,39): error CS1041: Identifier expected
Assets/MyGame/Command.cs(18,39): error CS1737: Optional parameter cannot precede required parameters

16:   public static Offset<Command> CreateCommand(FlatBufferBuilder builder,
17:   int id = 0,
18:   CommandType type = (CommandType)0) {
```

8 years agoMerge branch 'master' of https://github.com/google/flatbuffers
Wouter van Oortmerssen [Mon, 16 Nov 2015 22:10:16 +0000 (14:10 -0800)]
Merge branch 'master' of https://github.com/google/flatbuffers

8 years agoMerge pull request #343 from rw/go-builder-ergonomics
Robert [Mon, 16 Nov 2015 20:18:30 +0000 (12:18 -0800)]
Merge pull request #343 from rw/go-builder-ergonomics

Go: Improve Builder user interface.

8 years agoMerge pull request #344 from rw/py-builder-ergonomics
Wouter van Oortmerssen [Mon, 16 Nov 2015 17:07:31 +0000 (09:07 -0800)]
Merge pull request #344 from rw/py-builder-ergonomics

Python: Improve Builder user interface.

8 years agoC++: Fixed generated header file cannot be compiled when the type of key is enum...
takaken1994 [Sat, 14 Nov 2015 13:25:35 +0000 (22:25 +0900)]
C++: Fixed generated header file cannot be compiled when the type of key is enum class

8 years agoStore the dirs you pass into build_flatbuffers as properties.
Jon Simantov [Sat, 14 Nov 2015 02:04:41 +0000 (18:04 -0800)]
Store the dirs you pass into build_flatbuffers as properties.

This allows you to query the generated target for those properties
later, so dependent modules can refer to the directories to, for example,
add them to the include_directories.

Change-Id: I7a6bd34c5c1d08e2ea69b5ad845223297cad1159

8 years agoAdded build_flatbuffers function to CMake.
Jon Simantov [Thu, 12 Nov 2015 00:29:26 +0000 (16:29 -0800)]
Added build_flatbuffers function to CMake.

This function is designed to be called by projects that use FlatBuffers.
It takes a list of FlatBuffers schemas and a list of schema include
directories, and generates build rules to create generated headers
and/or binary schemas for those files, as well as optionally copying
all of the text schemas into a directory for your use (for example if
you need to parse text schemas within your app).

See function comments for more details.

Change-Id: I181684b916e91d965e14849d8f83ec2c83e9a4a4

8 years agoExpand local file path to allow users to fix ndk-build
Stewart Miles [Fri, 13 Nov 2015 05:12:18 +0000 (21:12 -0800)]
Expand local file path to allow users to fix ndk-build

local-source-file-path does not expand to correct file paths in
some circumstances so some users override it.  Therefore
flatbuffers_header_build_rules has been modified to generate rules
that expand LOCAL_SRC_FILES values with flatbuffers_header_build_rules.

Also, this overrides local-source-file-path to allow nest projects
to build when NDK_OUT is set.

Tested:
Verified a dependent project continues to build.

Bug: 25673744
Change-Id: Ic90186fe96d6e4533f9f3b7ca9ef78084de08a7e

8 years agoPass job server arguments (-jX) to make.
Stewart Miles [Fri, 13 Nov 2015 02:16:45 +0000 (18:16 -0800)]
Pass job server arguments (-jX) to make.

When $(MAKE) is expanded via a macro "make" doesn't know whether
$(MAKE) refers to an instance of the make app and therefore doesn't
pass job server arguments down.  This change adds the + prefix to the
command in the receipe in order to indicate $(MAKE) is another instance of
make.

Tested:
Verified flatc builds in parallel from Android builds.

Change-Id: I9f2f4f9680b818fdda7420a75a8bfa995b4644db

8 years agoPython: Improve Builder user interface.
rw [Thu, 12 Nov 2015 03:43:53 +0000 (19:43 -0800)]
Python: Improve Builder user interface.

+ Add state to the Builder object to track if we are inside a table,
  and if we are finished building the buffer.
+ Use this data to check that a buffer is being built correctly.
+ Raise an exception if a buffer is not being built correctly.
+ Test that the exceptions happen as expected.

Based on d236dea.