Commit Graph

104 Commits

Author SHA1 Message Date
Wouter van Oortmerssen 0a549e3875 Added missing assert.h to util.h.
This was only causing compiler errors on certain compiler configurations.

Change-Id: I110fb8c896f74aae7ef739e9a29c636393dbbde2
Tested: on Linux and Windows.
2014-09-15 16:27:21 -07:00
Wouter van Oortmerssen e57b86bb9f The parser and flatc now allow include directories to be specified.
Bug: 17139854
Change-Id: I0eac65d054951e00a8811ad1d80ba8c37012dbf0
Tested: on Linux.
2014-09-15 16:19:27 -07:00
Wouter van Oortmerssen cb58fc6fa1 Added convenient vector from array construction for Java.
Change-Id: Ib3fd576cf9fa4b4058a9fd1bbe24a0859bc3917a
Tested: on Linux.
2014-09-15 16:19:27 -07:00
Wouter van Oortmerssen 858e9961e2 Added accessor in Java to get vectors as ByteBuffers.
Also cleaned up ByteBuffer usage in general: ByteBuffer.position
now universally indicates the start of a ByteBuffer.

Change-Id: Ic4bfb98f9df9501b8fc82de2c45db7d7311135ac
Tested: on Linux.
2014-09-15 16:19:26 -07:00
Wouter van Oortmerssen 32f2c1c3b9 Fixed test that was incompatible with 64bit offsets.
Change-Id: I35984d0ab3e849bec6cdaa364a39f66f2c37b4d0
Tested: on Linux.
2014-09-15 16:13:49 -07:00
bml13 e14bc1d9ac Removed the use of b.array() to support DirectBuffers.
Also removed Table extend Constants.

Change-Id: I1770b613c58094fa572a3b26a31f01bd5fb8fdbf
2014-09-15 16:13:49 -07:00
evolutional 9a1f7be6fd Initial commit of .NET port of FlatBuffers
Include C# codegen in flatc and .NET FlatBuffer access via the
FlatBufferBuilder class

Tested: on Windows.

Change-Id: If5228a8df60a10e0751b245c6c64530264ea2d8a
2014-09-15 16:13:27 -07:00
Stewart Miles 3f85183c88 Added option to disable build of tests and samples.
Added FLATBUFFERS_BUILD_TESTS option which can be used to disable
the build of flatbuffers tests and samples.

Tested:
Verified tests and samples are no longer built on Linux when
FLATBUFFERS_BUILD_TESTS=OFF.

Change-Id: Ic23ab827849ba2c4481de9ca86adc1ab8e6b828c
2014-09-10 16:01:13 -07:00
Wouter van Oortmerssen 354aad4bc5 Made FlatBufferBuilder.java require ByteBuffers that have an array.
Readonly ByteBuffers and Direct ByteBuffers don't have a backing
array, and thus can't be used for writing FlatBuffers (though
they are fine for reading).

Change-Id: I4d7b9cc222b96161d0f8e92f34588bd3e0e38034
Tested: on Linux.
2014-09-05 13:48:02 -07:00
Wouter van Oortmerssen f57d012a21 Non-alpha-numeric characters are filtered out of include guards
Since part of it is based on the filename, which may contain
characters that are not legal identifiers.

Change-Id: I62b8fe228a434a2040fd4ce47d220fc4d3398b41
Tested: on Linux.
2014-09-05 11:27:03 -07:00
Wouter van Oortmerssen f5e343efba A generated C++ function was missing "inline".
This would cause double definition linker errors when included in
multiple compilation units.

Change-Id: Ie6fd4af018055a099343182a92a7776f2fea4725
Tested: on Linux.
2014-09-05 10:56:16 -07:00
Wouter van Oortmerssen b5edc2dea5 Fixed JSON text output not finding symbolic names for enum value 1.
Change-Id: If3a062926dd86b95fa68ed64fc7ee2de7bc0d930
Tested: on Linux
2014-09-05 10:54:52 -07:00
Wouter van Oortmerssen 09a2999c66 Implemented the file identifier functionality for Java.
Also fixed flatc not outputting these identifiers for files
compiled on the command-line.

Bug: 16983987
Change-Id: I8b714cfea3a8e144fa52133f62b2f7eda6eb044a
Tested: on Linux
2014-09-05 10:54:52 -07:00
Wouter van Oortmerssen 96592d5dbb Made Vector have a size() function, to make it more STL-alike.
Bug: 17316346
Change-Id: I52377b7fa51adccadc4e867d45666e683bc2c1ae
Tested: on Linux.
2014-09-04 17:35:24 -07:00
Wouter van Oortmerssen 84f86be700 Changed hard-coded constant in JavaTest to enum value.
Change-Id: I7d2eac7fed6c36c966670a3e58f4dae7dff25029
Tested: on Linux.
2014-09-04 17:35:24 -07:00
rw 417cb878c3 Fixed possible alignment issue in Go
Java patch with same purpose:
cdb0dca39d

Change-Id: I57d268cc0064843779eb7812a9e69326d9ab2498
Tested: on Darwin
2014-09-04 17:35:08 -07:00
Wouter van Oortmerssen 11f2538610 Made "field set more than once" check in JSON parser faster.
Change-Id: I3ecc1aa610526c270faa56cc5266f14cd81db247
Tested: on Linux.
2014-09-04 16:36:41 -07:00
Wouter van Oortmerssen ea57dfe897 Fixed missing <functional> header (VS).
Change-Id: I89d0f9b18bfe4d27be325c7f7205dee14bc7e1be
Tested: on Windows.
2014-09-03 16:39:22 -07:00
Wouter van Oortmerssen 9f506f57c0 Made sure GetRootAs..() functions are generated for all Java tables.
Previously they were only generated for the root_type, making it
impossible to use the other types in the file as the root of a buffer.

Bug: 17206174
Change-Id: Ie71bed42ac3b22dcceae6385cbd5846c37e5f1b8
Tested: on Linux
2014-09-03 15:34:40 -07:00
Wouter van Oortmerssen 57b614587c Setting a field twice in a JSON object now gives error.
Before, it would crash in FlatBufferBuilder.

Bug: 17357164
Change-Id: I6e6dbada5261745220345379eb53eb3eb113e8f8
Tested: on Linux.
2014-09-03 14:48:37 -07:00
Wouter van Oortmerssen 15dc1a86cd Fixed flatc silently accepting non-scalars as default values.
Bug: 17304016
Change-Id: I4873f8ef32fbb2657f15fc53a2c8f767e10f2d96
Tested: on Linux
2014-09-03 12:23:15 -07:00
Wouter van Oortmerssen 766d0df797 Fixed C++ codegen ignoring multiple padding scalars per field.
Bug: 17373251, 17221979
Change-Id: Ib8b77835f0acd3290f0a5e7d0f683d9fdcbf7230
Tested: on Linux
2014-09-03 11:34:47 -07:00
Wouter van Oortmerssen 4507594812 Made reading read-only ByteBuffers work.
Also added new constructor that allows ByteBuffer reuse.

Change-Id: I9c20ea96c67533066461f4e23b0d03b9b47cd068
Tested: on OS X.
2014-09-03 11:03:02 -07:00
Wouter van Oortmerssen 8e40902d52 Fixed compiler warning for int to char conversion.
Change-Id: Idc6c152ebf9e733ac72c01f3888b69e3b5f33aa9
Tested: on Linux.
2014-09-02 17:32:12 -07:00
Wouter van Oortmerssen bc5fa9d52f Fixed compile errors in VS / gcc for recent commits.
Tested: on Windows & Linux.

Change-Id: I90e18c448fc2fafeb83a6cdc3776174479874562
2014-08-25 10:42:38 -07:00
Wouter van Oortmerssen 11b743688c Improved the verifier to be even more resilient.
Theoretically, an attacker could construct a FlatBuffer with the
sole purpose of making verification really expensive, essentially
DOS-ing a server that uses verification on FlatBuffers. This adds
a max table depth and max table amount at which point the
verifier declares the buffer malformed.

Bug: 16301336
Change-Id: I6b098c31d030d24c19e852b33609110658e66aa9
Tested: on OS X
2014-08-22 14:14:32 -07:00
Wouter van Oortmerssen ffb3dec573 Prefixing of enum value identifiers in C++ is now optional.
See -P option to flatc.

Bug: 16814856
Change-Id: I855973df6afa27e0efa27cf9c4b4aee8a1fcdd22
Tested: on OS X.
2014-08-22 14:02:32 -07:00
Wouter van Oortmerssen 51ba48ae40 flatc now outputs the filename with error messages.
Bug: 16683956
Change-Id: Id8435e868899ca0bbf0add84852a54bfaea63b4a
Tested: on OS X.
2014-08-22 14:02:32 -07:00
Wouter van Oortmerssen c553b6b950 The list of enum values is now allowed to end in a comma.
Bug: 16490424
Change-Id: Ic3dd5f06efb5cf2dc4aefbd3f2db64c7b59b6b93
Tested: on OS X.
2014-08-22 14:02:32 -07:00
Wouter van Oortmerssen 541b06759f Checking for clashes between field names and generated field names.
This happens when the schema is parsed, to avoid compile time errors
later, which would be harder to understand.

Bug: 16325216
Change-Id: I24cabf1adaf1700796b91e3a9641bca43a68bfbd
Tested: on OS X.
2014-08-22 14:02:32 -07:00
Wouter van Oortmerssen 30af866e5a flatc now creates the output directory if it doesn't exist yet.
Also cleaned up the general mkdir functionality.

Tested: on OS X.

Tested that a command line like: ./flatc -j -o foo/bar/baz tests/monster_test.fbs
generates files in foo/bar/baz/MyGame/Example/*.java which previously didn't exist.

Windows code was previously tested but has been moved, so needs to be tested again.

Change-Id: Iee943121b3be4f92961a3ec94c2cb578165f114a
2014-08-22 14:02:31 -07:00
Wouter van Oortmerssen ebac1e1940 Support all JSON escape codes (including \u) for parsing & text gen.
Bug: 16624362
Change-Id: Ia09ea404c0c11dd1dc6993a8cbd155bf8152b65f
Tested: on Windows & Linux.
2014-08-22 14:02:31 -07:00
Wouter van Oortmerssen f7b0d130b6 Fixed warnings for unused variables in Visual Studio.
Change-Id: I51eeed20c3e0a4914280bf33585ca03b9a9952aa
Tested: on Windows.
2014-08-20 11:25:58 -07:00
Wouter van Oortmerssen c2ba7fd251 Referring to types from other namespaces in C++ now works correctly.
Previously, it would ignore the fact that the type comes from a
different namespace. Now they are pre-declared in their own namespace,
and referenced with a qualified name if necessary.

Bug: 16851682
Change-Id: I5cb625b86d28e7436b9e93c70a0fa16a600d9884
Tested: on Linux
2014-08-19 17:20:08 -07:00
Wouter van Oortmerssen be894f09df Schemas now support include files.
Bug: 15521443
Change-Id: I2e1ef97e7225a1a0ecf2ca65e31d49d443003747
Tested: on Linux.
2014-08-19 16:44:14 -07:00
Wouter van Oortmerssen 293a8110c4 Fixed "unused private field" warning for clang.
Bug: 17095037
Change-Id: Iedbe56f6ddc0ba7876896b0bb7ed9da8e6a85f7e
Tested: on Linux & OS X.
2014-08-19 14:25:55 -07:00
Wouter van Oortmerssen 8c5d7f7dea Clarified a documentation statement about circular references.
Change-Id: I8f3c50085f89037995ab9f26b28d3c83667e9d6f
2014-08-19 14:25:55 -07:00
Wouter van Oortmerssen cdb0dca39d Fixed possible alignment issue in Java
Tested: on Linux

Change-Id: Ie80aa19ed13ac4fa15cd3fd768f1a35526bdc607
2014-08-13 11:50:54 -07:00
Wouter van Oortmerssen f2908b7787 Made the assert in the verifier optional
Change-Id: Ie6b0a8e137a0743bbf18531f29712cf5f11bf34f
Tested: on Linux
2014-08-13 11:44:20 -07:00
Wouter van Oortmerssen 0b47e69d4d Parser now allows empty tables in JSON
Bug: 16870719
Change-Id: Ia5fdce49a67b1aa621ab1e37a815e2a3293257b6
Tested: on Linux
2014-08-13 11:44:20 -07:00
Wouter van Oortmerssen 620d8d6f7c Fixed compile warning related to file identification feature.
Change-Id: Id33cf778caa818c7d3988edee82058e63bfecbf0
Tested: on Linux
2014-08-12 16:29:20 -07:00
Bob Potter 39d4b7e2bf Fix vector of strings for Java
Change-Id: If032b450230b15224b2661836c8a740398d207c5
2014-08-12 15:12:51 -07:00
Wouter van Oortmerssen 5da7bda826 File identifier feature.
Allows you to add, and test for the presence of a magic 4-char
string in a FlatBuffer.

Tested: on OS X.

Change-Id: I090692a9e4fb53bed3543279a28563e67132cba0
2014-08-12 14:37:06 -07:00
Wouter van Oortmerssen be3c874258 Fixed bugs that could cause struct values not to be stored or misaligned
Change-Id: Ie36fe581c000fa4571c96fafd39a9e12fa29e1ca
Tested: on Linux
2014-08-11 17:42:55 -07:00
Wouter van Oortmerssen d8a173ddc7 A few document clarifications for Java & Internals.
Change-Id: I770b53cf7d82c860422c1fe6193fb597d9c9495c
2014-07-31 14:58:19 -07:00
Wouter van Oortmerssen 8f80fecc44 Made FlatBuffers compile correctly with -pedantic
Change-Id: I88b5993219e10e2dfb60ff98d6594d19871988fc
Tested: on Linux
2014-07-29 13:51:22 -07:00
Wouter van Oortmerssen 7057033116 Enum definitions are generated without a trailing comma (-pedantic).
Change-Id: I07cd28e5915a0526614db85f894f27a5bd27f3bb
Tested: on Windows.
2014-07-28 17:03:08 -07:00
Stefan Eilemann 15b10dd9f3 Add CMake finder for downstream projects
Change-Id: Ife37f7ead18ee28f8f4fd5e29caeee5e825defd4
2014-07-28 16:17:46 -07:00
Stefan Eilemann 52f4f4573e Fix OS X build
Change-Id: If0465b73843ad1a489fa66318a689801def3f0f0
2014-07-28 10:36:40 -07:00
Daniel Nachbaur 7a99b3c7cb Add install step
Change-Id: Ie863ddcf73653d1404a1e84109ebdf66af5dff26
2014-07-25 16:08:20 -07:00