summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-01-21Clarify that FlatBuffers unions do not support scalars (#6416)Juan Cruz Viotti1-3/+5
I mention that a common practice is to wrap the scalar value in a table or a struct. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-21Explain how FlatBuffers encodes unions (#6414)Juan Cruz Viotti1-0/+7
This is an attempt to explain how FlatBuffers encodes union types as an extra section in the "FlatBuffers internals" document. Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-21dart Builder - expose finished buffer size (#6403)Ivan Dlugos2-6/+9
2021-01-21Remove invalid claim that Protocol Buffers does not support unions (#6413)Juan Cruz Viotti1-2/+2
Protocol Buffers v3 supports the `oneof` operator: https://developers.google.com/protocol-buffers/docs/proto3#oneof Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2021-01-19[TS/JS] New gen TS code gen (#6302)Björn Harrtell56-4045/+3880
* TS/ES6 modules spike iteration 1 * Initial modularized dasherized output * Remove obsoleted parts and namespace wrapping * Use _flatbuffers_ prefix * First part of imports logic * Second part of imports logic * Fix TS/JS code removal mixup * Alias imported symbols if same name from different namespaces and some fixes * Use star import for bare imports * Fix messed up string concat * var to const and remove not needed semi * Remove some cases of ns prefixing * Add missing space * Cleanups * Completed initial import tracking logic * Compilable output * Adjust TypeScriptTest and dependents to work * Use local flatbuffers package for tests * Refactor away use of any * Remove obsolete imported_fileset and reexport_map * Still need any and fix JavaScriptTest.sh * Fix test runs out of the box * Temp add generated files * TypeScriptTest replaces JavaScriptTest and cleanups * Also remove reference to JavaScriptTest in TestAll.sh * Remove old generated ts/js files * Remove use of --js in generate_code scripts * idl_gen_js_ts to idl_gen_ts and removal of js gen * Remove obsoleted options * Fix obsolete ts test detection * Tweak ts compilation be as strict as possible * Remove jsdoc type annotation generation * Generated test ts files * Fix search and replace messup * Regenerated ts test output * Use CharToLower * Use normal for loop * Rework namespacedir * Revert "Rework namespacedir" This reverts commit 6f4eb0104ceeb86011bb076ebca901138c48e068. * Revert "Use normal for loop" This reverts commit 676b2135bfaa1853dfbb06c92b5c16a0d81bb13a. * Revert "Use CharToLower" This reverts commit 2d08648d0d72d0af201fad80d54cdc76412b35e9. * Again do rework but correct * Avoid runtime cast * Fix test runs * Also add npm install to get tsc * Bump node test versions * for range to std for loop * Clang format * Missed one clang format * Move accessor to later * Attempt to make windows version of TypeScriptTest * Want to see the output * Try to get newer node at appveyor * Style changes
2021-01-19[idl_parser] Improve symbols lookup thru parent namespaces (#6407)Vladimir Glavnyy2-16/+37
Added the new method LookupTableByName for searching symbols in parent namespaces. This method speedup (x50 or greater) symbol resolution (enum or struct) in parent namespaces. The speedup was measured without `table.empty()` guard condition. This method should suppress fuzzer timeout issue without artificial limits for nested namespaces (https://oss-fuzz.com/testcase-detail/6244168439169024). Additionally, this commit speedup (x5) the GetFullyQualifiedName method by removing unnecessary temporary std::string object.
2021-01-19Search for includes in the directory containg the current file (#6371)Mark Spatz1-4/+12
* [codegen] Search for includes in the directory containg the current file This matches the behavior of a C preprocessor, see: https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html * Skip FileExists() when file is guaranteed to not exist * end comment with period to match others
2021-01-19Upgrade Rust dependencies (#6406)Casper2-9/+9
Co-authored-by: Casper Neo <cneo@google.com>
2021-01-14[TS/JS] New gen TS code gen prequel to preserve history (#6404)Björn Harrtell4-4/+4
* Rename idl_gen_js_ts to idl_gen_ts to preserve history * Change build related files
2021-01-12Unset FieldDef.optional if its key (#6402)Casper4-178/+177
* Unset FieldDef.optional if its key * removed StringKey table, just removed an extra "required, key" * removed extra newline Co-authored-by: Casper Neo <cneo@google.com>
2021-01-12[fuzzer] Fix the binary schema loading in the monster_fuzzer (#6396)Vladimir Glavnyy1-18/+26
This commit should fix issue 29374 in oss-fuzz.
2021-01-11Fix Rust UB problems (#6393)Casper17-197/+540
* Fix miri problems by assuming alignment is 1 in rust * Removed is_aligned fn from rust verifier. * Add back is_aligned, but make it w.r.t. buffer[0] * touch unused variable * touch unused variable * +nightly * Move Rust miri testing into its own docker * fix bash * missing one endian conversion * fix endianness2 * format stuff Co-authored-by: Casper Neo <cneo@google.com>
2021-01-08Define Vector::value_type for STL compatibility (#6394)brian-brt1-0/+1
Specifically, this lets the googlemock container matchers work with a flatbuffers::Vector. https://github.com/google/googletest/blob/master/googlemock/docs/cheat_sheet.md#container-matchers
2021-01-08[fuzzer] Debug the monster_tets.bfbs on clusterfuzz server (#6392)Vladimir Glavnyy1-10/+28
For some reason, this fuzzer failed to load the binary schema file when run on the `/clusterfuzz` server. Issue: https://oss-fuzz.com/testcase-detail/6215075358703616 This issue doesn't reproduce locally with the latest oss-fuzz docker image.
2021-01-07Fix up scripts, fix generated enum value for strong mode, regenerate files ↵Dan Field9-31/+58
(#6389) * Fix up scripts, fix generated enum value for strong mode, regenerate files * missing files * GH action * remove action
2021-01-07[go] tests/GoTest.sh: Fix flags.Parse location to work on new go SDKs. (#6388)Aaron Son4-20/+23
* tests/GoTest.sh: Fix flags.Parse location to work on new go SDKs. Calling flags.Parse() within init() races with other packages which register flags in their init(), and in particular with the testing package itself. It is more reliable to call flags.Parse() from a TestMain implementation. See https://github.com/golang/go/issues/31859, https://github.com/golang/go/issues/33869. * .github: Enable build-go action in build.yaml workflow.
2021-01-07fix Dart Builder._writeString() - always write trailing zero byte (#6390)Ivan Dlugos1-0/+1
2021-01-07fix Dart Builder.reset() - clear vTables (#6386)Ivan Dlugos1-0/+1
2021-01-07[C++, JSON] Fix nullptr access when reading a key with a default value. (#6375)Vladimir Glavnyy28-574/+1238
This commit fixes handling of default and NULL `key` fields in `Parser::ParseVector` (#5928). The JSON generator updated. It outputs `key` fields even if the `--force-defaults` option is inactive. Additional test cases for `key` added.
2021-01-05Fix generated EndVector. (#6385)Richard A Hofer2-3/+3
2021-01-05Implements type promotion for Java enum (#6382)Stefan de Konink2-4/+4
* Implements type promotion for Java enum as suggested in #3890, #5111, #6369 * After generate_code.sh
2021-01-05Delete label_notify.ymlDerek Bailey1-17/+0
Removing this workflow as it isn't used.
2021-01-04Disabled PHP CI (#6381)Wouter van Oortmerssen1-13/+13
It errors with "Fatal error: Uncaught exception 'InvalidArgumentException' with message 'bad number for type byte.. in /home/runner/work/flatbuffers/flatbuffers/php/ByteBuffer.php:490" which I can't reproduce locally, and trying to fix it on CI runs into PHP's insane handling of numbers vs strings.
2021-01-04fixed warnings (#6355)Kamil Rojewski8-106/+113
* semver-compatible deprecations * removed unneeded lifetimes (+ clippy warnings) * silenced too many args warning
2021-01-04Fix multiple fbs code generation failure (#6365)Bruno ZIKI Kongawi1-2/+10
2021-01-04[idl_parser] Improve stack overflow protection (#6364)Vladimir Glavnyy6-58/+84
* [idl_parser] Improve stack overflow protection Add stack overflow protection for Flexbuffer and nested Flatbuffer parsers. Replaces the `Recurse()` method by the new ParseDepthGuard RAII class. * Remove move operator from Parser. It was wrong decision to add move ctor and assignment into Parser class. These operators will make it extremely difficult to add constant or reference fields in the future. * Remove ';' from definition of FLATBUFFERS_DELETE_FUNC * Format code * Make this PR compatible with MSVC2010 (it doesn't support inherited ctor)
2021-01-04[idl_parser] Check the range of explicitly set field's id value (#6363)Vladimir Glavnyy2-9/+53
* [idl_parser] Check the range of explicitly set field's id value The explicitly set `id` attribute should be a non-negative value of the `voffset_t` type. * Format FieldIdentifierTest()
2021-01-04Generate code to encode and decode nested flatbuffers in Python. (#6354)Richard A Hofer3-0/+127
* Generate code to encode and decode nested flatbuffers in Python. * Delete accidental trailing whitespace. * Fully delete trailing whitespace.
2021-01-04[Rust] Shared String (#6367)mustiikhalil3-0/+92
* Adds shared strings and tests for shared strings * Adds resets on string_map * Moved shared strings to use vector instead of hashmap * Addresses all the issues * Resolves some comments
2021-01-02Updates license date to 2021 (#6378)mustiikhalil25-25/+25
2020-12-30include_prefix support for rust (#6330)Kamil Rojewski1-2/+10
* include_prefix support for rust * include_prefix support for java * formatting fixes * Revert "include_prefix support for java" * style fix
2020-12-17[Swift] Rebuild the way swift handles structs from scratch (#6326)mustiikhalil21-718/+1049
* Rebuild the way swift handles structs from scratch * Updates docs, and sample binary * Replaces InMemory to Mutable * Migrates docs from inmemory * use inline for some functions * Renamed Mutable objects * Updates documentation
2020-12-17Fix typos in usage/comments; Make rust generator respect to --filenam… (#6342)mqy3-6/+7
* Fix typos in usage/comments; Make rust generator respect to --filename-suffix * run clang format
2020-12-17Renaming infinity variables in test.cpp (#6340)Kjetil Østerås1-26/+26
The infinityf symbol is causing a conflict when building for cygwin. In the cygwin math.h header there is also a symbol called infinityf. So this patch is needed to be able to build the flatbuffer tests in a cygwin environment.
2020-12-14Add vectorNumElements attribute to Builder for simpler vector creation. (#6328)Richard A Hofer7-64/+61
* Add vectorNumElements attribute to Builder for simpler vector creation. This adds a default to EndVector which should simplify its use. * Update tutorial to reflect new default arg in Python EndVector. * Remove optional argument to Python EndVector. * Add generated files. * Unset Builder.vectorNumElems when not in use.
2020-12-11[CI] Adds formatter to CI (#6272)mustiikhalil4-0/+154
* Adds formatters CI Adds Error message & setup formatting like cpp Adds Swift Adds typescript Adds python tests yarn Adds format.md * Removes unneeded scripts + moves install script to install phase * Adds format.md content * Adds cpp to the formatter.md and fixes ci * Adds cpp to formatter ci
2020-12-11Fix Max CI build path (#6333)Wouter van Oortmerssen1-4/+5
apparently the default xcodebuild path of ./build clashes with the BUILD file present (case insensitive file system?)
2020-12-10Generate nullable properties in C# object-based API for optional scalars. ↵Stefan F4-2/+176
(without -gen-mutable) (#6273) * Added missing EndTable() call to VerifyObject() VerifyObject called VerifyTableStart() but not EndTable(). This made Verifier::VerifyComplexity() increase depth_ with each table, not with the depth of tables. https://groups.google.com/forum/#!topic/flatbuffers/OpxtW5UFAdg * Added Check to VerifyAlignment https://stackoverflow.com/questions/59376308/flatbuffers-verifier-returns-false-without-any-assertion-flatbuffers-debug-veri * Add GetStringView (Convenience function to get string_view from a String returning an empty string_view on null pointer) like GetString, GetCstring * flatc should warn, when an attribute is attached more than once. flatc.exe -b duplicate.fbs warning: duplicate.fbs(5, 36): warning: attribute already found: priority duplicate.fbs: namespace MyGame; attribute "priority"; table Monster (priority:1, priority:2) { } root_type Monster; * flatc should support --binary --schema with optional scalar fields. This fixes 'error: Optional scalars are not yet supported in at least one the of the specified programming languages.' when calling flatc.exe --binary --schema with a schema containing optional scalars. * Generate nullable properties in C# object-based API for optional scalars. tests\generate_code.bat extended to test this. Ran tests\generate_code.bat Ran tests\Flatbuffers.Test\NetTest.bat * %TEST_BASE_FLAGS% replaced with --gen-object-api in generate_code.bat, because only this is part of this PR. Added this same flag to generate_code.sh * generate_code.bat and generate_code.sh changed to only test c# with object based api.
2020-12-10[Python] Commit some orphan python genfile diffs. (#6325)David P. Sicilia13-13/+13
2020-12-10Fixed missing ending quotes in labeller (#6327)Derek Bailey1-2/+2
2020-12-10Add flatc option to inhibit all warnings #6005 (#6301)tira-misu4-1/+14
* Fix C/C++ Create<Type>Direct with sorted vectors If a struct has a key the vector has to be sorted. To sort the vector you can't use "const". * Changes due to code review * Improve code readability * Add generate of JSON schema to string to lib * option indent_step is supported * Remove unused variables * Fix break in test * Fix style to be consistent with rest of the code * Add option --no-warnings to inhibit all warnings * Fix order of member initialization * Add documentation for --no-warnings
2020-12-10[fuzzer] Rename fuzzing dictionaries for `oss-fuzz` (#6318)Vladimir Glavnyy7-4/+26
This commit makes the names of fuzzing dictionaries the same as the target binary names. Also it explicitly limits size of test inputs to prevent failures in `regex` and fuzzing time-outs.
2020-12-09bumprust (#6322)Casper1-1/+1
Co-authored-by: Casper Neo <cneo@google.com>
2020-12-07Set default initialSize for Builder to 0 (#6310)Richard A Hofer1-1/+1
* Set default initialSize for Builder to 0 * Change default size of builder to 1024. This matches what the C++ and Java versions do.
2020-12-07Rust Flatbuffers Verifier (#6269)Casper21-301/+1857
* Updated comments and fixed a fundemental type error. * bump rust flatbuffers semver * Initial commit with verifier, need to clean up * Verifier tested. Needs clean up and refactoring. * Display for InvalidFlatbuffer and better errors for strings * SimpleToVerify, some refactoring * Combined VerifierType TableAccessorFuncBody into FollowType * scrub todos * Update Rust get_root functions. There are 6 variants, with verifier options, default verifier options and no verification "fast". * Rename root fns * inline * Update to use thiserror * fix for bad compiler * improve error formatting * Replace multiply with saturating_multiply * saturating adds too * Add docs disclaiming experimental verification system Co-authored-by: Casper Neo <cneo@google.com>
2020-12-07Version message should be a "STATUS" to avoid going to stderr. (#6316)David P. Sicilia1-1/+1
2020-12-07Replace std::string and const char* CreateSharedString with string_view (#6315)Austin Schuh1-0/+11
It is useful to be able to call CreateSharedString with a string_view. A string_view can be implicitly converted from a std::string or a const char*. This means if string_view is available, we can use it instead of both other functions and get all 3.
2020-12-07[fuzzer] Fix mistakes in the `parser` and `scalar` fuzzers. (#6314)Vladimir Glavnyy2-22/+10
The flatbuffers::Parser::Parse() isn't an idempotent method for schema parsing. This commit removes a wrong for-loop that tried to check the same schema twice.
2020-12-07Add default to offset param of Python generated GetRootAs (#6312)Richard A Hofer1-1/+1
2020-12-07[fuzzer] Fix loading of schema in monster_fuzzer (#6308)Vladimir Glavnyy2-33/+21
This is fix for (https://oss-fuzz.com/testcase-detail/6251772204810240)