Commit Graph

44 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 cdb0dca39d Fixed possible alignment issue in Java
Tested: on Linux

Change-Id: Ie80aa19ed13ac4fa15cd3fd768f1a35526bdc607
2014-08-13 11:50:54 -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
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 7057033116 Enum definitions are generated without a trailing comma (-pedantic).
Change-Id: I07cd28e5915a0526614db85f894f27a5bd27f3bb
Tested: on Windows.
2014-07-28 17:03:08 -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
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 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
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
Wouter van Oortmerssen df2e0db63d flatc can now convert flatbuffer binary files into json.
Also removed it appending _wire to filenames, renamed the json golden
file to .golden to not clash with generated files.

Bug: 15781201
Change-Id: I8322861e50d1e5b6a5ab5e4b5e5d8ae13c356eb2
Tested: on Windows and Linux
2014-07-11 14:49:43 -07:00
Wouter van Oortmerssen cc112ce96f Made Java argument names help remind the user when something is an offset.
Bug: 15856217
Change-Id: I9163d13ca26c2d53064f5289c993692be711685f
Tested: on Windows
2014-07-10 17:46:45 -07:00
Wouter van Oortmerssen d1efa95369 The generated CreateX() calls now come with default values for args.
bug: 15777627
Change-Id: I9389de46ea883ab0ef1beab9370e5c8e96b4d0b5
Tested: on Windows and Linux
2014-07-10 17:26:28 -07:00
Wouter van Oortmerssen 93df5697a0 Parser now correctly reads floats in scientific notation.
Change-Id: I7abb14a4b6c596674d6aff2b9de6e63603c0d2dc
Tested: on Windows and Linux.
2014-07-10 14:19:46 -07:00
Wouter van Oortmerssen 75349ae8c3 Fixed incorrect verifier code for nested tables.
It was outputting the type instead of the field name, and didn't deal
with NULL fields. Added test case.

Also fixed token enums having the wrong value, resulting in
unreadable error messages.

Change-Id: Icd9b4d22f417bfad5824c0f58e067ce3f2e2dc6f
Tested: on Windows and Linux.
2014-07-09 17:13:03 -07:00
Wouter van Oortmerssen b3ee52c0a7 Fixed vectors reserving wrong amount of space in Java.
In the generated code, the type of the vector was used for
the element size, instead of the vector element type.

Change-Id: Ie16d5221a61474365292c948fd3af99e2a7716c7
Tested: on Windows.
2014-07-09 11:43:30 -07:00
Wouter van Oortmerssen 7fcbe723fc Added a "strict JSON" mode to the text generator and compiler
This will add quotes around field names, as required by the official
standard. By default it will leave quotes out, as it is more readable,
more compact, and is accepted by almost all JSON parsers.
The -S switch to flatc turns on strict mode.

As per rfc 7159.

Change-Id: Ibabe9c8162c47339d00ec581d18721a2ba40c6d0
Tested: on Windows.
2014-07-09 11:43:30 -07:00
Wouter van Oortmerssen 9140144d51 Added functionality to assign field ids manually in a schema
New attribute:

-   `id: n` (on a table field): manually set the field identifier to `n`.
    If you use this attribute, you must use it on ALL fields of this table,
    and the numbers must be a contiguous range from 0 onwards.
    Additionally, since a union type effectively adds two fields, its
    id must be that of the second field (the first field is the type
    field and not explicitly declared in the schema).
    For example, if the last field before the union field had id 6,
    the union field should have id 8, and the unions type field will
    implicitly be 7.
    IDs allow the fields to be placed in any order in the schema.
    When a new field is added to the schema is must use the next available ID.

Change-Id: I8690f105f3a2d31fdcb75a4fab4130692b12c62f
Tested: on Windows
2014-07-08 11:12:33 -07:00
Wouter van Oortmerssen 350011f581 Fixed a bugs in the Java runtime that could cause an index out of bounds exception.
Tested: on Windows.

Change-Id: I0d4cdafc21690eb9a509ba31f21e80dacfb602ff
2014-07-02 14:39:58 -07:00
Wouter van Oortmerssen 1256307a38 Switched VS build to -W4, and fixed all resulting warnings.
Change-Id: I654217cbd01a3a449503d95753e19b672ec7ec23
Tested: on Windows, Linux
2014-07-02 14:39:58 -07:00
Wouter van Oortmerssen a0b6ffc25b Add buffer verification functionality to FlatBuffers
Bug: 15732628
Change-Id: I0b7cb65982d6b8957d5a899cca7d2b5d2ef53206
Tested: On Windows, OS X and Linux
2014-07-01 17:52:16 -07:00
Wouter van Oortmerssen 59043114ac Generated C++ headers now have include guards.
Bug: 15700355
Change-Id: Iceccb5b344e394e399092ffaa81f9cad2f0418ab
Tested: on Windows
2014-06-23 17:06:16 -07:00
rw e2c02b833e license is a comment, not an echo 2014-06-23 13:37:32 -07:00
rw 0b60ece438 show absolute path to user when aborting 2014-06-20 16:51:32 -07:00
rw 69dc8cbbc3 sh script for JavaTest 2014-06-20 16:21:49 -07:00
Wouter van Oortmerssen aab06c6bea Fixed various compiler warnings (most related to a 64bit size_t).
Change-Id: Ic2e0565ebc5243fc0be780bfbcb221d5170569fd
Tested: on VS2010
2014-06-19 12:04:39 -07:00
Wouter van Oortmerssen 3bcab16e91 Added project files for Visual Studio and Xcode.
Change-Id: Ife9775fdedc9e084c1e826ef13dff06a1b1b2ec2
Tested: on Windows and OS X.
2014-06-11 15:19:12 -07:00
Wouter van Oortmerssen 26a30738a4 Initial commit of the FlatBuffers code.
Change-Id: I4c9f0f722490b374257adb3fec63e44ae93da920
Tested: using VS2010 / Xcode / gcc on Linux.
2014-06-10 13:53:28 -07:00