Commit Graph

91 Commits

Author SHA1 Message Date
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
rw 0477a54f65 Tweak Go test.
Add more comments explaining the tests. Remove the extraneous 'superFuzz'
functionality. By default, do not compare to generated Java files.

Change-Id: Icb0aa8262e10035958639f9a88ca666694a2ce73
2014-07-25 15:26:00 -07:00
Wouter van Oortmerssen 9c3de1e2a0 Extended symbolic enum parsing in JSON for integers and OR-ing.
Change-Id: Iedbd9914a1ca3897776fb92aa9a1fdfc4603da3c
Tested: on Windows and Linux
2014-07-25 15:20:24 -07:00
Wouter van Oortmerssen bba042d723 Fixed possible compile error in CreateVector* functions.
Change-Id: I3b1fca2ea536349240b7bee35eff360f3acbb539
Tested: on Windows and Linux.
2014-07-24 16:58:30 -07:00
Stewart Miles 63f21cb2a5 Merge "Terminate the output directory argument of flatc." into ub-games-master 2014-07-20 04:41:30 +00:00
Stewart Miles 60acef94e1 Terminate the output directory argument of flatc.
Given the command

flatc -o . -c test.fbs

it would generate header file

.test_generated.h

rather than

./test_generated.h

This fixes this issue.

Tested:
Manually verified that flatc generates the correct output files given output
paths ending with and without '/' on Linux and Windows.

Bug: 16464827
Change-Id: I854cb881286f22690f1885f942cf3fd2fc59ca8d
2014-07-21 18:00:18 -07:00
Alex Ames 3f53f73c63 Corrected the order of the comments on namespace close parens
Also removed the semicolon on the bracket. It makes -pedanic unhappy.

Bug: 16399323
Change-Id: I16ec0d67af13c3ca0bc6285741f5a95658d262bd
2014-07-21 17:14:34 -07:00
Wouter van Oortmerssen d03ba640be Updated benchmark chart with stats for pugixml.
Change-Id: I23d7db5b62ca52fee49e1bedcf7d7d8d74957cf8
Tested: on Windows.
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 127d35085a Added a `bit_flags` attribute to enum declarations that 1<<N every value.
Change-Id: Ib9ec0cb3ddec60b1ca124eaf815fb1ae0cc53e1c
Tested: on Windows and Linux
Bug: 16186562
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen bd86bf60ec Made sure tests.cpp is testing the new vector iterator functionality.
Also fixes a potential big-endian bug, and makes iterators work
correctly with pointer types.

Change-Id: Ib7f88fe9e6053d1a9afa7895fba0695627c158b1
Tested: on Windows and Linux
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 3e201a99b2 A feature that officially supports nested FlatBuffers.
Generates convenient accessors for the nested root.

Change-Id: Ic0b1531de7ace475ff2a7b1f430d27f41c838430
Tested: on Windows.
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 9143a93312 Small fixes to the core C++ FlatBuffers implementation.
- Ensured weak linkage with the version string is not used on Windows,
  especially cygwin (which throws a linker error).
- Avoided a VS debug error for taking the address of the first element
  of an empty vector.
- Made copy/assignment constructors for downward_vector and
  FlatBufferBuilder private, to avoid people unintentionally making
  expensive copies.
- Using the more correct _WIN32 instead of WIN32

Change-Id: I801b5c8b159e3721af6d1ef0978a3247ba168bab
Tested: on Windows (VS + Cygwin) and Linux.
2014-07-21 16:40:39 -07:00
rw 74d5f3701f Port FlatBuffers to Go.
Implement code generation and runtime library for Go, derived from the
Java implementation. Additionally, the test suite verifies:

 - the exact bytes in the Builder buffer during object construction,
 - vtable deduplication, and
 - table construction, via a fuzzer derived from the C++ implementation.

Change-Id: Ib95a019c684891def2b50281e570b4843fea7baa
2014-07-21 16:40:39 -07:00
Wouter van Oortmerssen 3fb6a86d02 JSON parsing & text generation is now enum-identifier aware.
When Parsing JSON, it will read enums either as int values, identifiers
specific to the enum type, or strings containing those identifiers.

When generating text, it will output enum identifiers by default
(this can be turned off in favor of integers, like before).

Change-Id: If28b0a1f8f27de79aff3e626f40c0c0b271c325a
Tested: on Windows and Linux
Bug: 16214968
2014-07-15 11:45:00 -07:00