platform/upstream/flatbuffers.git
3 years agoWrap verify file id condition in Check call (#6085)
Navin Mohan [Mon, 31 Aug 2020 18:32:13 +0000 (00:02 +0530)]
Wrap verify file id condition in Check call (#6085)

Run clang-format

Update testcase

3 years ago+ Add `removable-media` plug to the snapcraft config (#6083)
Wybe Westra [Mon, 24 Aug 2020 16:55:38 +0000 (18:55 +0200)]
+ Add `removable-media` plug to the snapcraft config (#6083)

3 years agoAdds proper access types for swift object api & flatbuffers & grpc (#6081)
mustiikhalil [Sat, 22 Aug 2020 19:39:09 +0000 (22:39 +0300)]
Adds proper access types for swift object api & flatbuffers & grpc (#6081)

Fixes accessor in greeter.swift

Small fix for ci

3 years ago[Lobster] missed a test
Wouter van Oortmerssen [Tue, 18 Aug 2020 21:29:44 +0000 (14:29 -0700)]
[Lobster] missed a test

3 years ago[CMake] enabled multi-core builds in VS projects
Wouter van Oortmerssen [Tue, 18 Aug 2020 21:00:22 +0000 (14:00 -0700)]
[CMake] enabled multi-core builds in VS projects

3 years ago[Lobster] optional scalars support
Wouter van Oortmerssen [Tue, 18 Aug 2020 21:00:02 +0000 (14:00 -0700)]
[Lobster] optional scalars support

3 years ago[Kotlin] Attach JvmStatic annotation to each method in companion object (#6052)
Yoon Kyong Sik [Tue, 18 Aug 2020 16:44:43 +0000 (01:44 +0900)]
[Kotlin] Attach JvmStatic annotation to each method in companion object (#6052)

* Attach JvmStatic annotation to each method of companion object

Kotlin does not have static accessor so companion object used instead of static.
It's so natural. But when use kotlin companion object methods on java it is very inconvenient.
```java
GeneratedClassByFlatBuffer.Companion.someMethod()
```

If use @JvmStatic annotation it can be shorten like below.
```java
GeneratedClassByFlatBuffer.someMethod()
```

* Formatting by Idea Google C++ style

* Add comments - Commit for missing cla

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Add comments - Commit for missing cla

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Reset code formatting except modified lines

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Pass missing flag to validateVersion method

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Add annotations to missing method in companion object

* addVector
* createVector
* endVector
* tableCreator

And also I tried add compiler option for generate annotation who don't like this operation.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Modify unmatched option name in compiler usage

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Add missing operation for finishSizePrefixed and finishStructBuffer method.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Add compiled example with --kotlin-gen-jvmstatic option.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Fix Compiler.md

Change option name from --gen-jvm-static-annotation to --kotlin-gen-jvmstatic

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Use IDLOptions reference instead of bool parameter.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Change option name - kotlin_gen_jvmstatic to gen_jvmstatic

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Use IDLOptions reference instead of bool parameter and missing process @JvmStatic as suffix.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Add code generation for --gen-jvmstatic option

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Miss typo directory for including.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Miss typo variable suffix for including.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Fix camel case to snake case.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Rollback generate code for gen_jvmstatic option.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Delete generated test files.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* add missing new line at end of file.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
* Remove generated test file by command line.

Signed-off-by: Yoon KyongSik <sam1287@gmail.com>
Co-authored-by: sam <sam@jennifersoft.com>
3 years ago[C#] Cleaned up .NET testing script for Mono (#6016)
Derek Bailey [Mon, 17 Aug 2020 20:10:10 +0000 (13:10 -0700)]
[C#] Cleaned up .NET testing script for Mono (#6016)

* Cleaned up .NET testing script for Mono

Cleaned up the .NET testing script to make it a little better. It
purposefully doesn't delete the .NET installer and SDk after running the
script, so that they can be used in subsequent invocations. This greatly
speeds up the script.

The downloaded files are ignored by git by default. They can be
explicitly cleaned up by runnning the clean script (clean.sh).

* Trying using older Version indicator

* Remove lins to monsterdata and reference it directly.

* Updated appveryor script to remove copying of files no longer needed

* Continue to update appveyor script to work. Disabled CS0169 in ByteBufferTest

3 years agoAdds a serialize helper function to native table (#6059)
mustiikhalil [Tue, 4 Aug 2020 10:53:40 +0000 (13:53 +0300)]
Adds a serialize helper function to native table (#6059)

* Adds a serialize helper function to native table
* Updated version

3 years ago[TS] Fix four bugs with imported types in TypeScript. (#6054)
Max Burke [Mon, 3 Aug 2020 19:08:52 +0000 (12:08 -0700)]
[TS] Fix four bugs with imported types in TypeScript. (#6054)

* [TS] Fix four bugs with imported types in TypeScript.

* When a type had a vector of imported enums:

1) the enum type's file wasn't added to the generated code's list of
imports; and

2) the enum wasn't prefixed with the NS<hash> prefix and wasn't getting
resolved; but

3) non-enum types (ie, "flatbuffers.Offset") were getting the NS<hash>
prefix when they weren't.

* Also, type name prefixes weren't properly attributed with imported
structs in unions because the source definition passed to the typename
prefixing method was for the union, not for the location of the imported
struct.

* clang fmt

* Use of enum_def / struct_def for prefixing types needs to have the files
added to imported files when not generating all types.

* clang fmt

3 years ago[Swift] Append namespace for Swift Grpc implementation (#6049)
Liu Liu [Fri, 31 Jul 2020 07:07:45 +0000 (00:07 -0700)]
[Swift] Append namespace for Swift Grpc implementation (#6049)

* [Swift] Append namespace for Swift Grpc implementation
* Separate ServiceName from ServiceQualifiedName.

3 years agoexport a __version__ variable for python module (#5309)
Omer Akram [Thu, 30 Jul 2020 22:56:21 +0000 (03:56 +0500)]
export a __version__ variable for python module (#5309)

* export a __version__ variable for python module

* assign version to be used below

* better support python2

* Add copyright header

3 years agoadding fb import when no other imports are present (#6030)
Kamil Rojewski [Thu, 30 Jul 2020 22:55:11 +0000 (00:55 +0200)]
adding fb import when no other imports are present (#6030)

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
3 years ago[Feature] Checks for Nullable strings (#6050)
mustiikhalil [Mon, 27 Jul 2020 16:57:50 +0000 (19:57 +0300)]
[Feature] Checks for Nullable strings (#6050)

* Allows null strings in createString method c#

* Adds nullable strings to JS and swift

* Changes js checks

* Fixes typo

3 years ago[Swift] RFC: Switch Swift namespace from public enum to ordinary concat with _ (...
Liu Liu [Mon, 27 Jul 2020 08:06:11 +0000 (01:06 -0700)]
[Swift] RFC: Switch Swift namespace from public enum to ordinary concat with _ (#6045)

This PR attempts to switch namespace from public enum back to ordinary
concat with _ in Swift. This kept style similar with protobuf, but
different from other popular style guide in Swift.

This is needed because previously, when we do `public enum`, we don't
really know when to declare and when to extend (extension). With namespace
implementation in this PR, there is no such ambiguity.

3 years agoRust codegen improvements and lint fixes (#6046)
Casper [Sat, 25 Jul 2020 20:46:20 +0000 (13:46 -0700)]
Rust codegen improvements and lint fixes (#6046)

* Improve rust codegen

* one more unneeded lifetime

* Added a derive default

Co-authored-by: Casper Neo <cneo@google.com>
3 years agoadds code gen for optional scalars in swift (#6038)
mustiikhalil [Sat, 25 Jul 2020 14:59:34 +0000 (17:59 +0300)]
adds code gen for optional scalars in swift (#6038)

Adds swift test code

Replaces if statments

Adds swift to supported languages for optionals

Moved std::string to auto

Adds nullable scalars support in object api

3 years ago[C++] Fix compiler error from deleted assignment operator (#6036) (#6047)
jdess [Fri, 24 Jul 2020 17:35:27 +0000 (19:35 +0200)]
[C++] Fix compiler error from deleted assignment operator (#6036) (#6047)

* [C++] Fix compiler error from deleted assignment operator (#6036)

The assignment operator of the `buf_` member is deleted, we cannot call it from the assignment operator of the `TableKeyComparator` struct.

=> Also delete the assignment operator of the `TableKeyComparator` struct (already private anyhow).

* [C++] Fix compiler error from deleted assignment operator (#6036) - fix extraneous semicolon

The assignment operator of the `buf_` member is deleted, we cannot call it from the assignment operator of the `TableKeyComparator` struct.

=> Also delete the assignment operator of the `TableKeyComparator` struct (already private anyhow).

3 years agoOptional Scalars support for Rust (#6034)
Casper [Thu, 23 Jul 2020 23:30:27 +0000 (16:30 -0700)]
Optional Scalars support for Rust (#6034)

* First draft of rust optionals

* Code cleanup around ftBool and ftVectorOfBool

* Tests for Rust optional scalars

* test bools too

Co-authored-by: Casper Neo <cneo@google.com>
3 years agoAllow to run cpp tests under grpc/tests/ using bazel. (#6040)
Shengzhe [Tue, 21 Jul 2020 18:08:01 +0000 (11:08 -0700)]
Allow to run cpp tests under grpc/tests/ using bazel. (#6040)

This is the first step to upgrade grpc dependency to the latest version.

- Patch protobuf 3.6.1. and grpc 1.15.1 to fix build errors when using the latest Bazel version (3.4.1).
- Add grpc/tests:grpc_test. One can kick off tests in Bazel by calling `bazel test grpc/tests/...`.
- Add missing build targets in tests/BUILD in order to support grpc/tests/BUILD

3 years agoFix git command executed in wrong folder when doing cmake superbuild (#6039)
Olivier Le Doeuff [Mon, 20 Jul 2020 19:26:01 +0000 (21:26 +0200)]
Fix git command executed in wrong folder when doing cmake superbuild (#6039)

3 years ago[Swift] Optional Scalars Preparation (#6028)
mustiikhalil [Mon, 20 Jul 2020 17:38:50 +0000 (20:38 +0300)]
[Swift] Optional Scalars Preparation (#6028)

* Perpares swift to take optional scalars + adds optional string helper method + disables linters in generated code

* Small fix for generated code

* Update grpc support to alpha 17 for swift

3 years agotests: Check for both quiet and signaling NaN on mipsel/hppa (#6029)
Vasyl Gello [Mon, 20 Jul 2020 17:18:02 +0000 (20:18 +0300)]
tests: Check for both quiet and signaling NaN on mipsel/hppa (#6029)

MIPSEL, MIPS64EL and HP-PA architectures have quiet and
signaling NaNs swapped. The test assumes correct values
for i386 / amd64 but obviously fails on these architectures.
It is documented in many places, like

https://software.llnl.gov/yorick-doc/stdlib/ieee.html :

Warning-- apparently there is no universal standard for what
  constitutes signalling versus quiet NaN
  on MIPS and HPPA architectures, qNaN and sNaN are reversed

https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html :

  -mnan=2008
  -mnan=legacy

  These options control the encoding of the special
  not-a-number (NaN) IEEE 754 floating-point data.

  The -mnan=legacy option selects the legacy encoding.
  In this case quiet NaNs (qNaNs) are denoted by the first
  bit of their trailing significand field being 0, whereas
  signaling NaNs (sNaNs) are denoted by the first bit of
  their trailing significand field being 1.

  The -mnan=2008 option selects the IEEE 754-2008 encoding.
  In this case qNaNs are denoted by the first bit of their
  trailing significand field being 1, whereas sNaNs are
  denoted by the first bit of their trailing significand
  field being 0.

  The default is -mnan=legacy unless GCC has been configured
  with --with-nan=2008.

The behavior mentioned above causes FTBFS in Debian starting
with 1.12.0:

https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mips64el&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830681&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mipsel&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594832647&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=hppa&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830726&raw=0

For HP-PA (PA-RISC) there is no way to override the reversal,
and for MIPSEL/MIPS64EL there is no macro defining the '-mnan'
choice, so both variants were added with OR boolean operator.

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
4 years agosupport deprecated flag in json schema (#6022)
Dmitry [Thu, 16 Jul 2020 20:49:42 +0000 (23:49 +0300)]
support deprecated flag in json schema (#6022)

4 years agoFlatc parser support for nullable scalars (#6026)
Casper [Thu, 16 Jul 2020 20:43:47 +0000 (13:43 -0700)]
Flatc parser support for nullable scalars (#6026)

* Parser support for nullable scalars

* Use older C++ features

* use default element

* Add a test for json, flexbuffers, and null

* test comments and names

Co-authored-by: Casper Neo <cneo@google.com>
4 years ago[Dart] Generate constant values map for enums (#6025)
Zhaoxuan Jiang [Sat, 11 Jul 2020 00:42:22 +0000 (08:42 +0800)]
[Dart] Generate constant values map for enums (#6025)

Dart schema compiler generated a static getter for enum values, which
always created a new map instance for its callers. See #5819.
Now it generates const map for better performance
and readability.

4 years agoUsing proper symbol name for reexport (#6021)
Kamil Rojewski [Mon, 6 Jul 2020 15:40:56 +0000 (17:40 +0200)]
Using proper symbol name for reexport (#6021)

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years agoSilence false positive "-Wstringop-overflow" on GCC 10.0 to 11.0 (#6020)
Vasyl Gello [Mon, 6 Jul 2020 15:38:06 +0000 (18:38 +0300)]
Silence false positive "-Wstringop-overflow" on GCC 10.0 to 11.0 (#6020)

4 years agoUpdated FB import (#6019)
Kamil Rojewski [Thu, 2 Jul 2020 19:44:55 +0000 (21:44 +0200)]
Updated FB import (#6019)

Previous FB import was based on the original early TS implementation
and did not take into accout NPM. There doesn't seem to be a use
for current implemenentation anymore, while NPM compatibility is
needed.

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years ago[Java] Add support for shared strings on FlatBufferBuilder. (#6012)
Paulo Pinheiro [Thu, 2 Jul 2020 19:40:56 +0000 (21:40 +0200)]
[Java] Add support for shared strings on FlatBufferBuilder. (#6012)

Added a method FlatBufferBuilder::createSharedString that
enable string sharing for building messages on java.

The shared pool will only contains strings inserted by
this methods.

4 years agoNot using non-existent create method for obj api (#6015)
Kamil Rojewski [Thu, 2 Jul 2020 19:18:21 +0000 (21:18 +0200)]
Not using non-existent create method for obj api (#6015)

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years agoCode cleanup + updates test and readme (#6004)
mustiikhalil [Tue, 30 Jun 2020 18:37:43 +0000 (21:37 +0300)]
Code cleanup + updates test and readme (#6004)

Updates Readme + adds asserts

Fixes documentation

4 years agoSerde with bytes maps to Blob (#6009)
Casper [Mon, 29 Jun 2020 02:58:08 +0000 (19:58 -0700)]
Serde with bytes maps to Blob (#6009)

* Serde with_bytes maps to Blob

* Bump rust flexbuffers minor version number

Co-authored-by: Casper Neo <cneo@google.com>
4 years ago[Swift] FlatBuffers createMonster method doesn't treat struct properly (#5992)
Liu Liu [Sun, 28 Jun 2020 09:36:55 +0000 (02:36 -0700)]
[Swift] FlatBuffers createMonster method doesn't treat struct properly (#5992)

* [Swift] FlatBuffers createMonster method doesn't treat struct properly

This PR fixed a issue where a struct is not treated properly when use
create inside.

A example would be the pos inside Monster. The createMonster method
takes an Offset for pos. However, FlatBuffersBuilder.add(struct:)
doesn't really take Offset argument. That means we don't really add a
struct at all for Monster.

It will show up as the pos never set.

This doesn't show up in FlatBuffersMonsterWriterTests.swift because it
implements its own createMonster method, which happens do the dance
properly (i.e. first call create(struct) and then immediately call
add:).

This PR modified the `add(pos:)` interface such that it takes the
UnsafeMutableRawPointer directly, calling `create(struct:)` under the hood.

I can add unit tests once the direction of this PR approved.

* Fix object api pack method codegen.

* Add unit tests that uses Monster.createMonster method to serialize.

* Updated sample_binary.swift

4 years agoManage grpc dependency in Bazel's WORKSPACE file. (#5995)
Shengzhe [Fri, 26 Jun 2020 22:39:23 +0000 (15:39 -0700)]
Manage grpc dependency in Bazel's WORKSPACE file. (#5995)

flatbuffers project currently depends on an old version of GRPC library and has known issues working with the latest version (issue #5836). Therefore, a patch file is created and put under bazel/ directory before supporting the latest GRPC version.

4 years agoAdd warning to schema parser if field name is not snake_case. (#6005)
Derek Bailey [Fri, 26 Jun 2020 18:16:02 +0000 (11:16 -0700)]
Add warning to schema parser if field name is not snake_case. (#6005)

* Added code gen for evolution tests back in.

* General generate code and clang format

* Added code gen for evolution tests back in.

* General generate code and clang format

* reran generate_code.sh

* Added code gen for evolution tests back in.

* General generate code and clang format

* Added code gen for evolution tests back in.

* General generate code and clang format

* Enforce snake_case for schema field names

* Switched to basic for loop, Fixed warning message

4 years ago[Rust] Flexbuffers dependency cleanup and fixes (#5998)
Johan Andersson [Fri, 26 Jun 2020 00:12:10 +0000 (02:12 +0200)]
[Rust] Flexbuffers dependency cleanup and fixes (#5998)

* Fix doc comment warnings

Can't use doc comment "///" syntax on macros, that generates the following warning:

warning: unused doc comment
   --> src\flexbuffer_type.rs:236:5
    |
236 |     /// returns true if and only if the flexbuffer type is `VectorFloat4`.
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macros
    |
    = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion

So switched to just use ordinary "//" comments on these to be warning free

* Upgrade num_enum 0.4.1 -> 0.5.0

* Remove unused and non-working usage of test crates

* Remove usage of abandoned debug_stub_derive crate

Which brought in old pre-v1 syn and quote crates.

This replaces it with just manual Debug trait implementation instead for the 2 cases

4 years agoRe-added Evolution Schema Code Generation Command (#5999)
Derek Bailey [Thu, 25 Jun 2020 22:35:23 +0000 (15:35 -0700)]
Re-added Evolution Schema Code Generation Command (#5999)

* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.

* Fixed Dart Tests by removing code-gen for included files.

* Added code gen for evolution tests back in.

* General generate code and clang format

* Added evolution schema generation to .bat file

* Added code gen for evolution tests back in.

* General generate code and clang format

* Added evolution schema generation to .bat file

* reran generate_code.sh

* Removed wildcard from generate_code.bat that doesn't work

4 years agoFix RPM install conflict (#6003)
martind1111 [Thu, 25 Jun 2020 22:33:58 +0000 (17:33 -0500)]
Fix RPM install conflict (#6003)

4 years ago[Swift] Initialize memory when clear ByteBuffer (#5982)
Liu Liu [Thu, 25 Jun 2020 22:11:38 +0000 (15:11 -0700)]
[Swift] Initialize memory when clear ByteBuffer (#5982)

* Initialize memory when clear ByteBuffer

It seems (based on my limited understanding) that FlatBuffers requires
the writable area to be 0 initialized. However, we missed it when clear
the buffer to reinitialize it.

This PR fixed that by calling initialize (also fixed the typo)
explicitly.

* Update version to 0.5.3

4 years ago[TS] Use proper TypedArray in create*Vector (#5991)
hanstzou [Thu, 25 Jun 2020 21:42:47 +0000 (05:42 +0800)]
[TS] Use proper TypedArray in create*Vector (#5991)

* [TS] Use proper TypedArray in create*Vector

This commit adds TypeScript function overloads to create*Vector for
proper TypedArray types, effectively resolves #5373.

* Add @deprecated to old Uint8Array overloads

4 years ago[C++] Updates real_path to be truly portable (#5787)
mjvankampen [Thu, 25 Jun 2020 21:40:10 +0000 (23:40 +0200)]
[C++] Updates real_path to be truly portable (#5787)

* Removes posix definition

stat and fseeko are not used. Tested on QNX (GCC 5.4.0) and MinGw

* Updates realpath to more modern (2008) version

* Removes unix specific headers

* Adds detection of strtoll_l as android API < 21 does not provide it

* Includes cstdlib and formatting

Removes cmakelist alterations as not necessary. Formatting not complete.

* Stdlib outside if

Stdlib is available on all platforms

* Fixes indentation

* Adds locale check to android build

* Adds missing brace

* full names

* Removes again, no clue

* Updates base to check for locale independent android

Cmake already checks for others, also MSC?

* Changes to test on available and not requested

* Fixes android bad xopen_version define

* Removes warning

4 years ago[C++] Generate default member initializers for >= C++11 (#5989)
Jean-François Roy [Tue, 23 Jun 2020 01:06:15 +0000 (18:06 -0700)]
[C++] Generate default member initializers for >= C++11 (#5989)

In >= C++11 mode, generate default member initializers instead of a
default constructor.

The new code is semantically equivalent, but will allow aggregate
initialization in C++20.

This is a different take on #5951.

4 years ago[Kotlin] Fix Access to union of vector element (#5994)
Paulo Pinheiro [Tue, 23 Jun 2020 00:08:35 +0000 (02:08 +0200)]
[Kotlin] Fix Access to union of vector element (#5994)

Kotlin code generation was producing wrong logic for accessors
of vector of union elements. This was shadowed by the fact[1] that asserts
in Kotlin are silently ignored unless the flag "-ea" is passed to the JVM.

The tests are also updated to enable asserts.

1 - https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/assert.html

4 years ago[Swift] Add parsing from unowned UnsafeMutableRawPointer for ByteBuffer (#5981)
Liu Liu [Tue, 23 Jun 2020 00:05:36 +0000 (17:05 -0700)]
[Swift] Add parsing from unowned UnsafeMutableRawPointer for ByteBuffer (#5981)

* RFC: Add ExternalStorage for ByteBuffer in Swift implementation

This PR proposed one more API for ByteBuffer such that no copy is
required to parse FlatBuffers content. This API has limited use, but for
cases that you need to read part of the flatbuffers' data to decide
whether you want to parse / copy the full buffer out, it is useful.

* Use a variable rather than protocol.

* Revert grouping changes from the other PR.

* Add unit test to read from unowned UnsafePointer.

* Manifest changed.

4 years agoRemoved requirement that enums be declared in ascending order. (#5887)
Alex Ames [Tue, 23 Jun 2020 00:02:15 +0000 (17:02 -0700)]
Removed requirement that enums be declared in ascending order. (#5887)

4 years agoDo not remove the last digit from float values (#5974)
Javier Serrano [Mon, 22 Jun 2020 23:57:45 +0000 (01:57 +0200)]
Do not remove the last digit from float values (#5974)

Trailing zeros are already removed inside the function FloatToString,
that is called immediately before the lines deleted by this commit.

4 years agoMark GetBufferMinAlignment() const (#5985)
Gleb Mazovetskiy [Thu, 18 Jun 2020 18:51:43 +0000 (19:51 +0100)]
Mark GetBufferMinAlignment() const (#5985)

Like GetBufferPointer() and GetSize(), marks GetBufferMinAlignment function as const

4 years agoTypeScript/JavaScript docs improvements (#5984)
Dimitri Mitropoulos [Thu, 18 Jun 2020 17:23:32 +0000 (13:23 -0400)]
TypeScript/JavaScript docs improvements (#5984)

* use correct language formatter for TypeScript examples

* fixes typo in JS/TS copied from PHP (apparently)

the variables are not named with a prefixed `$`

* fixes bizarre line breaks in markdown examples

* fixes snake case typo to fit JS/TS conventions

* makes example of Uint8Array usage explicit

* removes random extra lines between language blocks

* adds simple example for writing to file in node

* typo: flabuffers => flatbuffers

* adds (previously missing) code blocks to TypeScript code block

* adds context about where `monster_generated` comes from

to the uninitiated, a bit of help like this is welcome

4 years ago[Swift] Internal library improvements (#5965)
mustiikhalil [Thu, 18 Jun 2020 17:14:38 +0000 (20:14 +0300)]
[Swift] Internal library improvements (#5965)

* Moves addition to overflow addition in swift by using &+

Moves code to use Int instead of UInt32 & fixes functions

Updates swift performance to great

Updated version to 0.5.2

Updated swift package version to 5.2

Updated docker to swift 5.2

Removed all none & arithmetic operations

* Small refactoring

4 years ago[Doc] Added missing letters to compiler options (#5976)
laurens-dg [Thu, 18 Jun 2020 17:02:00 +0000 (19:02 +0200)]
[Doc] Added missing letters to compiler options (#5976)

These are correct in the help section of compiler, but missing some letters here.

4 years agoRust Flexbuffers Documentation update (#5979)
Casper [Thu, 18 Jun 2020 07:01:48 +0000 (00:01 -0700)]
Rust Flexbuffers Documentation update (#5979)

* Update samples and docs

* Fixed a line of documentation

Co-authored-by: Casper Neo <cneo@google.com>
4 years ago[docs] typo: updates monsterdata.json to be valid json (#5978)
Dimitri Mitropoulos [Thu, 18 Jun 2020 05:35:24 +0000 (01:35 -0400)]
[docs] typo: updates monsterdata.json to be valid json (#5978)

* updates monsterdata.json to be valid json

the same monster.json file was not valid json

* updates reference to monsterdata.json in docs to also be valid json

4 years ago[idl_parser] Mark typefield as deprecated (#5958)
Liu Liu [Tue, 16 Jun 2020 06:18:12 +0000 (23:18 -0700)]
[idl_parser] Mark typefield as deprecated (#5958)

* Mark typefield as deprecated

* Add UnionDeprecation Test.

* Update to use evolution schema instead.

* Use --scoped-enums to compile.

4 years agoDeleted old stale bot
Derek Bailey [Mon, 15 Jun 2020 20:39:46 +0000 (13:39 -0700)]
Deleted old stale bot

The new stale action replaces the function of this bot, so removing the old one.

It also prevents the two bots from battling each other :)

4 years agoIncreased Operations per run in stale.yml
Derek Bailey [Mon, 15 Jun 2020 17:05:53 +0000 (10:05 -0700)]
Increased Operations per run in stale.yml

The default operations per run is 30 which would be consumed on the reprocessing already-marked issues. Greatly increased the operations per run to process all issues and pull request (~200 + 83 * 5).

4 years agoAdding Stale Action to clean up PR and Issues
Derek Bailey [Fri, 12 Jun 2020 20:15:11 +0000 (13:15 -0700)]
Adding Stale Action to clean up PR and Issues

Uses the Stale action (https://github.com/actions/stale) to help clean up older Issues and PR. Set to 6 months to mark as stale, and 14 days to close stale.

4 years ago[C++] Fixed/Enabled --cpp-ptr-type std::shared_ptr [#5813] (#5959)
volkan-ozdemir [Thu, 11 Jun 2020 23:38:40 +0000 (19:38 -0400)]
[C++] Fixed/Enabled --cpp-ptr-type std::shared_ptr [#5813] (#5959)

4 years agoPropagate boolean default values from proto to fbs (#5964)
Mika Raento [Thu, 11 Jun 2020 17:15:19 +0000 (20:15 +0300)]
Propagate boolean default values from proto to fbs (#5964)

4 years ago[Swift] Improving reallocation time by using memcpy and moving reallocation code...
mustiikhalil [Thu, 11 Jun 2020 15:53:32 +0000 (18:53 +0300)]
[Swift] Improving reallocation time by using memcpy and moving reallocation code to storage (#5960)

Removes stride

Use capacity - current size to initialize

Fixes memory leak

Updated test code for linux

4 years agoFix error in SimpleQSort (#5955)
Vladimir Glavnyy [Wed, 10 Jun 2020 06:35:07 +0000 (13:35 +0700)]
Fix error in SimpleQSort (#5955)

4 years agofix error on GRPC Python - ignore namespace tree if not specified (#5862) (#5922)
Malar Kannan [Mon, 8 Jun 2020 17:18:46 +0000 (22:48 +0530)]
fix error on GRPC Python - ignore namespace tree if not specified (#5862) (#5922)

4 years agoRequired is now implemented in swift (#5952)
mustiikhalil [Mon, 8 Jun 2020 17:08:16 +0000 (20:08 +0300)]
Required is now implemented in swift (#5952)

4 years agoFixed: Access violation and ASAN/UNSAN failures with sorted tables
Wouter van Oortmerssen [Mon, 8 Jun 2020 16:49:49 +0000 (09:49 -0700)]
Fixed: Access violation and ASAN/UNSAN failures with sorted tables

https://github.com/google/flatbuffers/issues/5945

4 years ago[rust] Add FlatBufferBuilder::force_defaults API (#5946)
Matt Brubeck [Mon, 8 Jun 2020 16:47:36 +0000 (09:47 -0700)]
[rust] Add FlatBufferBuilder::force_defaults API (#5946)

* [rust] Add force_defaults method FlatBufferBuilder

This works just like the same method already available in other
languages.

* Add binary format test for force_defaults

4 years ago[FlexBuffer][Java] ReadWriteBuf and ReadBuf interface public (#5948)
Paulo Pinheiro [Mon, 8 Jun 2020 16:35:51 +0000 (18:35 +0200)]
[FlexBuffer][Java] ReadWriteBuf and ReadBuf interface public (#5948)

Those interfaces need to be public for use cases where the user pass a buffer to FlexBuffers class that is not a ByteBuffer.

This will fix #5944

4 years ago[Java] Grow ArrayReadWriteBuf enough to match requested capacity. (#5921)
greenrobot Team [Fri, 5 Jun 2020 02:48:25 +0000 (04:48 +0200)]
[Java] Grow ArrayReadWriteBuf enough to match requested capacity. (#5921)

* [Java] Grow ArrayReadWriteBuf enough to match requested capacity.

Also handle requested capacity overflowing.

* [Java] Improve readability of ArrayReadWriteBuf.requestCapacity()

* [Java] prepare testBuilderGrowth() to fail again once FlexBuffersBuilder uses ByteBufferReadWriteBuf internally, add TestFail() as a better alternative to a plain "assert false"

* [Java] Revert some test changes and extract a small string that was used more than once; one could say three times, however, it might be worthy of a discussion if the third occasion also falls into this category, as it is an independent use case and thus would work in the same way even if the value changed.

Co-authored-by: Markus <markus@greenrobot>
4 years agoAdds bool support in structs + updates grpc support + CI upgrades (#5943)
mustiikhalil [Thu, 4 Jun 2020 16:14:18 +0000 (19:14 +0300)]
Adds bool support in structs + updates grpc support + CI upgrades (#5943)

4 years agofixed mutating inline values (#5942)
Kamil Rojewski [Thu, 4 Jun 2020 16:08:41 +0000 (18:08 +0200)]
fixed mutating inline values (#5942)

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years agoAdd static asserts to ensure that reflection API arrays are kept in sync (#5934)
Laurentiu Cristofor [Tue, 2 Jun 2020 16:50:56 +0000 (09:50 -0700)]
Add static asserts to ensure that reflection API arrays are kept in sync (#5934)

* Add static asserts to ensure that reflection API arrays are kept in sync

* Move changes from generated file into source fbs file

* Rename enum value and regenerate reflection_generated.h

* Add comments to each entries of type sizes array

4 years ago[C++] Got rid of memset's in constructors (#5938)
bakinovsky-m [Tue, 2 Jun 2020 00:58:52 +0000 (03:58 +0300)]
[C++] Got rid of memset's in constructors (#5938)

* [C++] removed array's memsets from struct parametrized constructor

now POD-typed arrays are zero-initialized
and class-typed arrays are default-initialized

* [C++] memset -> zero/default initialization in default constructor

* [C++] Struct-type and array default initialization

* [C++] Newly generated tests

* [C++] forgotten test

* [C++] curly brace by code style

* [C++] test if memory is 0's after placement new

* [C++] memory leak fix

* [C++] simplifying and non-dynamic memory in test

* [C++] code cleanup

* [C++] disable old-compiler warning

* [C++] windows build fix (try)

* [C++] debug-new win build fix

4 years agoGeneral Codebase clean up (#5939)
Derek Bailey [Mon, 1 Jun 2020 15:40:55 +0000 (08:40 -0700)]
General Codebase clean up (#5939)

* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.

* Ensuring test/generate_code.sh was ran

* Fixed Dart Tests by removing code-gen for included files.

* General cleanup of codebase.

4 years agoAdd GetStringView like GetString, GetCstring (#5937)
stefan301 [Fri, 29 May 2020 17:00:46 +0000 (19:00 +0200)]
Add GetStringView like GetString, GetCstring (#5937)

* 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

Co-authored-by: stefan301 <Stefan.Felkel@de.Zuken.com>
4 years ago[C#] Add file identifier to ObjectAPI Serialization Utility. (#5920)
mugisoba [Thu, 21 May 2020 16:14:20 +0000 (01:14 +0900)]
[C#] Add file identifier to ObjectAPI Serialization Utility. (#5920)

* use Finish***Buffer instead.

* add file_identifier test.

4 years agonot creating creation methods when using structs (#5919)
Kamil Rojewski [Mon, 18 May 2020 16:39:19 +0000 (18:39 +0200)]
not creating creation methods when using structs (#5919)

* not creating creation methods when using structs

* vs2015 build fix

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years ago[Dart] Adding FlexBuffers support (#5853)
Maxim Zaks [Mon, 18 May 2020 14:50:39 +0000 (16:50 +0200)]
[Dart] Adding FlexBuffers support (#5853)

* Adding FlexBuffers support for Dart language

4 years ago[Dart] Getting tests/DartTest.sh to work on master. (#5915)
Derek Bailey [Sat, 16 May 2020 01:13:29 +0000 (18:13 -0700)]
[Dart] Getting tests/DartTest.sh to work on  (#5915)

* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.

* Fixed Dart Tests by removing code-gen for included files.

4 years agoSchema parser: prohibit declaration of an array of pointers inside structs (#5907)
Vladimir Glavnyy [Thu, 14 May 2020 18:39:58 +0000 (01:39 +0700)]
Schema parser: prohibit declaration of an array of pointers inside structs (#5907)

* Fix issue #5906, Prohibit declaration of an array of pointers inside structs

- idl_parser.cpp: Prohibit declaration of an array of pointers inside structs
- idl_gen_cpp.cpp: Extract GenStructConstructor() method from GenStruct() to simplify future modification
- idl_gen_cpp.cpp: Add assert for checking of Array fields in structs on code-generation stage

* Fix the error 'unused local variable' in release build

* Fix: format the PR code according to coding rules

* Add test-case and fix review notes

4 years agoFix Cargo.toml dependencies (#5911)
Casper [Wed, 13 May 2020 18:24:32 +0000 (11:24 -0700)]
Fix Cargo.toml dependencies (#5911)

* Fix Cargo.toml dependencies

* less specific serde dependency

Co-authored-by: Casper Neo <cneo@google.com>
4 years agofix union type names (#5902)
Dan Field [Wed, 13 May 2020 17:26:32 +0000 (10:26 -0700)]
fix union type names (#5902)

* fix union type names

* fix up generation and test

* format

* update codegen

4 years agoUpdate Rust Flexbuffers metadata before publishing (#5905)
Casper [Tue, 12 May 2020 02:46:37 +0000 (19:46 -0700)]
Update Rust Flexbuffers metadata before publishing (#5905)

Co-authored-by: Casper Neo <cneo@google.com>
4 years ago[TS] Make Obj-API work with --short-names (#5898)
Khoi Dinh Trinh [Mon, 11 May 2020 21:55:57 +0000 (14:55 -0700)]
[TS] Make Obj-API work with --short-names (#5898)

* changed function used for getting struct name

* re-generated code

4 years agofixed invalid imports with --gen-all (#5895)
Kamil Rojewski [Thu, 7 May 2020 23:21:30 +0000 (01:21 +0200)]
fixed invalid imports with --gen-all (#5895)

* fixed invalid imports with --gen-all

* only excluding crate imports

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years ago[C#] Thread safe reads of Double and Float values from a ByteBuffer (#5900)
Derek Bailey [Thu, 7 May 2020 21:33:29 +0000 (14:33 -0700)]
[C#] Thread safe reads of Double and Float values from a ByteBuffer (#5900)

* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case.

* Thread safe reads of Double and Floats from ByteBuffer

4 years agoImplement flexbuffers in python (#5880)
Dmitriy Kovalev [Thu, 7 May 2020 21:26:33 +0000 (14:26 -0700)]
Implement flexbuffers in python (#5880)

4 years agoRust Flexbuffers (#5669)
Casper [Thu, 7 May 2020 21:11:26 +0000 (14:11 -0700)]
Rust Flexbuffers (#5669)

* Cargo clippy lints

* more lints

* more lints

* Restored a doc comment

* Comment on float eps-eq and adjusted casting

* Rust Flexbuffers

* more serde tests, removed some unsafe

* Redid serde to be map-like and Reader is Display

* Moved iter from Reader to VectorReader

* Serious quickcheck + bugs

* wvo api

* Made types smaller for a reasonable speedup

* redid reading in a way that's a bit faster.

Profiling shows the rust slowdown as building +10%, reading +20%

* src/bin are developer binaries in rust

* Root and Map width are not packed

* key null check is debug only + doc changes

* BuilderOptions

* Documentation

* Documentation

* Moved tests to rust_usage_test

* Moved rust flexbuffers samples to Flatbuffers/samples

* Fixed RustTest

* Fixed for Rust 1.37.0

* Upgraded to rust 1_40_0

* fixed a little-endian-only feature in a test

* 1.40.0

* fixed some benchmarks for bigendian

* Updated .bat file

* misspelling

* Gold Flexbuffer test.

* Serialize,Deserialize, std::error::Error for Errors.

* Undo rustfmt in integration_test.rs

* from_slice instead of from_vec

* Added comments to unsafe blocks

* expanded on comment

* bump

Co-authored-by: CasperN <cneo@google.com>
4 years ago[swift] Moves code to use VTablesStorage (#5888)
mustiikhalil [Thu, 7 May 2020 19:28:42 +0000 (22:28 +0300)]
[swift] Moves code to use VTablesStorage (#5888)

* Moves the code to use _vtablestorage

Rebuilt the test to confirm to the new API

Adds documentation + generates code for grpc

Reverts indentation

v0.4.0

Updated swift/readme.md

Updates VtableStorage to ensure space instead of reallocating each time

Fixes str count not being correct

* Fixes issue with boolean constant not being set + removes unused function

4 years ago[Java][FlexBuffers] Make FlexBuffersBuilder reusable by adding clear() (#5889) (...
Markus Junginger [Thu, 7 May 2020 19:26:55 +0000 (21:26 +0200)]
[Java][FlexBuffers] Make FlexBuffersBuilder reusable by adding clear() (#5889) (#5890)

4 years agoAlign package name to FindFlatBuffers.cmake (#5899)
Adam Oleksy [Thu, 7 May 2020 19:22:12 +0000 (21:22 +0200)]
Align package name to FindFlatBuffers.cmake (#5899)

This change is for fix warning:
```
CMake Warning (dev) at /home/aoleksy/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args`
  (flatbuffers) does not match the name of the calling package (FlatBuffers).
  This can lead to problems in calling code that expects `find_package`
  result variables (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  FindFlatBuffers.cmake:33 (find_package_handle_standard_args)
  CMakeLists.txt:6 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.
```

4 years agoSmall tutorial improvements - documentation only (#5894)
Carol (Nichols || Goulding) [Thu, 7 May 2020 19:15:11 +0000 (15:15 -0400)]
Small tutorial improvements - documentation only (#5894)

* Use code formatting for a code snippet

* Minor grammar, spelling, and Markdown fixes

4 years agoAttempt at adding Github Actions CI
Wouter van Oortmerssen [Tue, 5 May 2020 17:47:29 +0000 (10:47 -0700)]
Attempt at adding Github Actions CI

4 years agoHandle git program or .git folder absence (#5878)
Dmitry Volosnykh [Mon, 4 May 2020 20:23:41 +0000 (23:23 +0300)]
Handle git program or .git folder absence (#5878)

Assume version is 0.0.0.0 in such cases.

4 years agoonly add native_include_files if object based api is enabled (#5886)
Thomas [Mon, 4 May 2020 19:27:50 +0000 (21:27 +0200)]
only add native_include_files if object based api is enabled (#5886)

The native include files tag is intended to be used together with the object based api. A client which does not use the object based api should have no need to know about the additional include files needed for the object based api. The generated flatbuffers code without object api enabled should compile without the additional header files.

4 years agoRespect shared attribute in Parser (#5885)
Mika Raento [Mon, 4 May 2020 17:33:11 +0000 (20:33 +0300)]
Respect shared attribute in Parser (#5885)

Respects the 'shared' field attribute when reading data with Parser.

4 years agoinclude/flatbuffers: typo fixes in comments (#5884)
Even Rouault [Mon, 4 May 2020 17:21:57 +0000 (19:21 +0200)]
include/flatbuffers: typo fixes in comments (#5884)

4 years agoUpdates swift docs for package management (#5883)
mustiikhalil [Mon, 4 May 2020 17:18:38 +0000 (20:18 +0300)]
Updates swift docs for package management (#5883)

Small fix for the clear function

4 years ago[Rust] idl_gen_rust.cpp: (Option/required-aware codegen for unions) (#5850)
jrop [Mon, 4 May 2020 07:16:57 +0000 (01:16 -0600)]
[Rust] idl_gen_rust.cpp: (Option/required-aware codegen for unions) (#5850)

* idl_gen_rust.cpp: Fix google/flatbuffers#5849 (Option/required-aware
codegen for unions)

The generated code was assuming that an Option is always returned by the
union-getter method: however, this is only true if the field is not
marked as `(required)`.

* idl_gen_rust.cpp: flip conditional

* idl_gen_rust.cpp: Add comment, as requested in review

The code added is not covered by the integration test

4 years agoPropagate use_string_pooling in CopyTable (#5879)
Mika Raento [Thu, 30 Apr 2020 15:58:43 +0000 (18:58 +0300)]
Propagate use_string_pooling in CopyTable (#5879)

This allows using CopyTable for deduplicating strings.

4 years agoNot using reexports with --gen-all (#5873)
Kamil Rojewski [Mon, 27 Apr 2020 19:35:42 +0000 (21:35 +0200)]
Not using reexports with --gen-all (#5873)

Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
4 years agoAdded INCLUDE_PREFIX option for flatbuffers_generate_headers (#5866)
Alex Ames [Thu, 23 Apr 2020 17:09:19 +0000 (10:09 -0700)]
Added INCLUDE_PREFIX option for flatbuffers_generate_headers (#5866)

This option was in an earlier revision of flatbuffers_generate_headers
but was lost while refactoring by mistake. We have it as a function
argument rather than one of the optional flags so that we can use it to
inform the rule where to place the generated headers, so that the file
location matches the prefix that will be added to the filenames in the
generated files.

Also fixed some of the documentation in the file.