platform/upstream/flatbuffers.git
4 years ago[C++] Refactor to conform to Google C++ style guide (#5608)
Derek Bailey [Thu, 7 Nov 2019 20:22:54 +0000 (12:22 -0800)]
[C++] Refactor to conform to Google C++ style guide (#5608)

* Automatic refractor of C++ headers to Google C++ style guide

* Automatic refractor of C++ source to Google C++ style guide

* Automatic refractor of C++ tests to Google C++ style guide

* Fixed clang-format issues by running clang-format twice to correct itself. Kotlin was missing clang-format on after turning it off, so it was changed,

4 years agoFixed deprecated method in GRPC Java test.
Wouter van Oortmerssen [Tue, 5 Nov 2019 01:23:01 +0000 (17:23 -0800)]
Fixed deprecated method in GRPC Java test.

Change-Id: Iccae8fe9409adbf3cd3013a5cf3368e068175ad3

4 years agoFixed Apache license not using canonical version.
Wouter van Oortmerssen [Tue, 5 Nov 2019 01:15:56 +0000 (17:15 -0800)]
Fixed Apache license not using canonical version.

Now identical to https://www.apache.org/licenses/LICENSE-2.0.txt

Change-Id: I6eab8bdee2472107dfc72265e204fdd16f3abc2e

4 years agoinclude/flatbuffers/base.h: fix no_sanitize issue with old clang (#5610)
Even Rouault [Mon, 4 Nov 2019 22:58:51 +0000 (23:58 +0100)]
include/flatbuffers/base.h: fix no_sanitize issue with old clang (#5610)

Older clang versions raise:
```
./flatbuffers/base.h:365:1: error: unknown attribute 'no_sanitize' ignored [-Werror,-Wattributes]
__supress_ubsan__("alignment")
^
./flatbuffers/base.h:246:50: note: expanded from macro '__supress_ubsan__'
  #define __supress_ubsan__(type) __attribute__((no_sanitize(type)))
                                                 ^
```

Comparing https://releases.llvm.org/3.6.0/tools/clang/docs/AttributeReference.html
with https://releases.llvm.org/3.7.0/tools/clang/docs/AttributeReference.html
shows that __attribute__((no_sanitize(type))) is available since 3.7.0

4 years ago[C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (...
Derek Bailey [Mon, 4 Nov 2019 22:54:44 +0000 (14:54 -0800)]
[C++, Java, C#, TypeScript, JavaScript] Skip generation of mutable union types (#5599)

* Skip generation of mutable union types

* Removed C# and Java unit tests that mutated a Union type

4 years agoflatbuffers.h: fix documentation warning (#5607)
Even Rouault [Mon, 4 Nov 2019 22:28:33 +0000 (23:28 +0100)]
flatbuffers.h: fix documentation warning (#5607)

Fixes following clang -Wdocumentation warning:
```
flatbuffers.h:1762:17: error: parameter ']' not found in the function declaration [-Werror,-Wdocumentation]
  /// @param[in]] v A const reference to the `std::vector` of structs to
```

4 years agoAdd Lua FlatbufferBuilder Clean() method to enable reuseable builders (#5606)
Derek Bailey [Mon, 4 Nov 2019 22:27:59 +0000 (14:27 -0800)]
Add Lua FlatbufferBuilder Clean() method to enable reuseable builders (#5606)

4 years ago[Kotlin] Fix union vector accessor after change in Java API (#5605)
Paulo Pinheiro [Mon, 4 Nov 2019 22:25:07 +0000 (23:25 +0100)]
[Kotlin] Fix union vector accessor after change in Java API (#5605)

Kolin uses java library as dependency, which changed the way it access union vector recently
(e365c502ffc659752f9b7a8d60b0052a07e33659).

This changes updates kotlin code generation to match Java's changes.

4 years ago[flatc] Remove an always true condition for flexbuffers (#5604)
Paulo Pinheiro [Mon, 4 Nov 2019 22:23:15 +0000 (23:23 +0100)]
[flatc] Remove an always true condition for flexbuffers (#5604)

The condition was unnecessary and Detected by

PVS-Studio
V560 [CWE-571] A part of conditional expression is always true: !opts.use_flexbuffers. flatc.cpp 438

4 years ago[Go] Add UnPackTo functions (#5598)
Lawrence Chan [Mon, 4 Nov 2019 20:12:25 +0000 (14:12 -0600)]
[Go] Add UnPackTo functions (#5598)

4 years ago[Go] Object API support (#5339)
iceboy [Thu, 31 Oct 2019 18:13:45 +0000 (11:13 -0700)]
[Go] Object API support (#5339)

* start

* works for current usages!

* unpack: vector of struct

* optimize byte slice

* support nested struct

* support null table

* support struct

* support union

* update generated code

* grumble

* fix compiler warning

* update generated code

* wrap type in namespace

* bug

* wrap in namespace

* enum byte arrays

* generate struct for unions

* basic testing

* remove branching

* fix assert

* pack vector of fixed structs correctly

* omit null vectors

* Refactor Union Pack and UnPack methods

Remove append usage to increase code efficiency when dealing with large vectors

* generate goldens

4 years agoRust: Add idiomatic iterator for Vector type (#5579)
Mathias Svensson [Mon, 28 Oct 2019 18:19:47 +0000 (19:19 +0100)]
Rust: Add idiomatic iterator for Vector type (#5579)

* Rust: Add idiomatic iterator for Vector type

* Add comments explaining some implementation details

4 years agoFix typos in comments (#5590)
Even Rouault [Mon, 28 Oct 2019 17:02:46 +0000 (18:02 +0100)]
Fix typos in comments (#5590)

Found by the https://github.com/OSGeo/gdal/blob/master/gdal/scripts/fix_typos.sh
script on the internal copy of flatbuffers inside GDAL

4 years agoC++ verifier for evolved union fields should return true (#5586)
Derek Bailey [Mon, 28 Oct 2019 16:43:33 +0000 (09:43 -0700)]
C++ verifier for evolved union fields should return true (#5586)

4 years agoAdd ByteBuffer copy for vector of bytes in Java (#5587)
Derek Bailey [Mon, 28 Oct 2019 16:30:31 +0000 (09:30 -0700)]
Add ByteBuffer copy for vector of bytes in Java (#5587)

4 years agoRust: Fix Copy and Clone impls for a few generic types (#5577)
Mathias Svensson [Mon, 28 Oct 2019 04:20:29 +0000 (05:20 +0100)]
Rust: Fix Copy and Clone impls for a few generic types (#5577)

* Rust: Fix Copy and Clone impls for a few generic types

* Add tests for Copy+Clone

* Wrap Copy+Clone checks in a #[test] function

4 years agoAdd `--clean-first` to the cmake-build command (travis) (#5574)
Vladimir Glavnyy [Mon, 21 Oct 2019 17:11:32 +0000 (00:11 +0700)]
Add `--clean-first` to the cmake-build command (travis) (#5574)

- `--clean-first` runs `clean` target to remove previously generated files
- missed `monster_extra_generated.h` file added to the `flattests` target

4 years agoFix Follow implementation for bool (#5554)
StackDoubleFlow [Sun, 20 Oct 2019 03:24:13 +0000 (22:24 -0500)]
Fix Follow implementation for bool (#5554)

4 years agoFix issue #5557 (#5573)
Vladimir Glavnyy [Fri, 18 Oct 2019 17:16:55 +0000 (00:16 +0700)]
Fix issue #5557 (#5573)

- remove not necessary file `monster_test_generated.h` from sample_bfbs.cpp

4 years agoAvoid intentional unsigned integer overflow getting caught by sanitizers (#5572)
Björn Harrtell [Thu, 17 Oct 2019 22:47:51 +0000 (00:47 +0200)]
Avoid intentional unsigned integer overflow getting caught by sanitizers (#5572)

* Avoid intentional unsigned integer overflow getting caught by sanitizers

* Adapt from suggested compiler compatible solution

* And a third way :)

4 years agoPython: Add forceDefaults opt to python Builder (#5564)
Bharat Tak [Thu, 17 Oct 2019 22:25:05 +0000 (00:25 +0200)]
Python: Add forceDefaults opt to python Builder (#5564)

* Add forceDefaults opt to python Builder

* Add test functions for force_default option for python builder

* Simplify

* Add force default test for UOffsetTFlags

4 years agoJava: Don't annotate vector-of-tables item getters with @nullable. (#5562)
Jacek Surazski [Thu, 17 Oct 2019 22:23:15 +0000 (15:23 -0700)]
Java: Don't annotate vector-of-tables item getters with @nullable. (#5562)

* Annotate getters with @Pure when --java-checkerframework is specified.

Together with @Nullable, this allows users to use static analysis tools
like CheckerFramework to catch NPEs caused by unset fields.

* Don't annotate vector-of-tables item getters with @Nullable.

Since Flatbuffers don't support null items in vectors of tables.

4 years agoFixed warnings generated by recent JSON sorting feature.
Wouter van Oortmerssen [Thu, 17 Oct 2019 22:16:00 +0000 (15:16 -0700)]
Fixed warnings generated by recent JSON sorting feature.

Change-Id: I6fd6283b616c7a39bb878b1610e4ddf6e208fa0a

4 years ago[Java] byte buffer factory returned buffer capcity is used instead of the requested...
Idan Sheinberg [Thu, 17 Oct 2019 22:11:33 +0000 (01:11 +0300)]
[Java] byte buffer factory returned buffer capcity is used instead of the requested size (#5558)

* byte buffer factory returned buffer is used instead of the requested capacity

* byte buffer factory returned buffer is used instead of the requested capacity

* Comment fix

4 years ago#5544 Fix of Array of table is not sorted if Create<type>Direct() is used (#5546)
tira-misu [Thu, 17 Oct 2019 21:22:21 +0000 (23:22 +0200)]
#5544 Fix of Array of table is not sorted if Create<type>Direct() is used (#5546)

* 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

4 years agoFix build with gcc version 7.4.0 (#5570)
Brian Harris [Tue, 15 Oct 2019 17:56:58 +0000 (12:56 -0500)]
Fix build with gcc version 7.4.0 (#5570)

4 years agoFixed JSON parser not sorting vectors of tables/structs with key.
Wouter van Oortmerssen [Thu, 10 Oct 2019 22:24:54 +0000 (15:24 -0700)]
Fixed JSON parser not sorting vectors of tables/structs with key.

Change-Id: Iacc0c8513af80a736700e6cbaf513ebdf8e3ac89

4 years ago[FlexBuffers][Java] Cache size of Sized objects in FlexBuffers (#5551)
Paulo Pinheiro [Thu, 3 Oct 2019 22:56:29 +0000 (00:56 +0200)]
[FlexBuffers][Java] Cache size of Sized objects in FlexBuffers (#5551)

In my benchmarks it shows deserialization performance improvements of
around 7%

4 years agoFix issue #5542 (#5543)
Paulo Pinheiro [Mon, 30 Sep 2019 21:05:19 +0000 (23:05 +0200)]
Fix issue #5542 (#5543)

Empty objects that inherit from Sized would try to access internal
ByteBuffer when Sized::size was called. So we add a single byte in
the empty buffer, so when size() is called it would return 0

4 years agoFixed Android STLPort related error.
Wouter van Oortmerssen [Mon, 30 Sep 2019 19:12:36 +0000 (12:12 -0700)]
Fixed Android STLPort related error.

Change-Id: I59ff072e526fc63b3215767a4d4a2a8944b65654

4 years agoFix namespaced struct/field name collision detection (#5540) (#5545)
Jack Zhou [Mon, 30 Sep 2019 18:50:03 +0000 (14:50 -0400)]
Fix namespaced struct/field name collision detection (#5540) (#5545)

Changes the use of `LookupStruct` to `LookupCreateStruct` in
`ParseField` to also detect when collisions happen in namespaces.

4 years ago[flac] Add FlexBuffers option for generating data (#5519)
Paulo Pinheiro [Thu, 26 Sep 2019 22:06:11 +0000 (00:06 +0200)]
[flac] Add FlexBuffers option for generating data (#5519)

Alongside --binary and --json, an additional
switch (--flexbuffers) can be passed to convert
data using FlexBuffers

4 years agoUpdate Rust versions under test from 1.30.1 to 1.37.0 (#5538)
Robert Winslow [Thu, 26 Sep 2019 21:31:11 +0000 (14:31 -0700)]
Update Rust versions under test from 1.30.1 to 1.37.0 (#5538)

Fixes build errors from using newer crate versions with an old Rust version.

4 years agoAdds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat (#5529)
mjvk [Thu, 26 Sep 2019 16:40:14 +0000 (18:40 +0200)]
Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat (#5529)

* Adds XOPEN_SOURCE for PATH_MAX and POSIX 1993 for stat

These are the only two required extension for compilation of
flatbuffers using -std=c++11 instead of gnu++11.

* Sets _XOPEN_SOURCE to 600 and enable POSIX2001 for fseeko

4 years ago[FlexBuffers][Java] Add override Key::toString (#5533)
Paulo Pinheiro [Wed, 25 Sep 2019 21:14:39 +0000 (23:14 +0200)]
[FlexBuffers][Java] Add override Key::toString (#5533)

4 years ago[FlexBuffers][Java] Fix wrong access to a string using Reference::asString(). (#5532)
Paulo Pinheiro [Wed, 25 Sep 2019 18:59:10 +0000 (20:59 +0200)]
[FlexBuffers][Java] Fix wrong access to a string using Reference::asString(). (#5532)

The real position of a string is  calculated by using the indirect() method,
which should be based on parentWidth and not byteWidth, as it was implemented.

We are also fixing the flag BUILDER_FLAG_SHARE_STRINGS on FlexBuffersBuilder
that was set as '1', same value as BUILDER_FLAG_SHARE_KEYS.

4 years agoFix Mutate() methods of Array<scalar/struct> (override 5508) (#5526)
Vladimir Glavnyy [Mon, 23 Sep 2019 16:31:51 +0000 (23:31 +0700)]
Fix Mutate() methods of Array<scalar/struct> (override 5508) (#5526)

* Draft with Array specialization (#5508)

* Array specialization + SFINAE to fold copy-paste (#5508)

* Add implicit specialization of Array<scalar> and Array<struct> (#5508)

- Tag dispatching is used for implicit specialization
- Array<scalar> and Array<struct> have different iterators and accessors
- Array<scalar> and Array<struct> have different Mutate() methods

* Add implicit specialization of Array<scalar> and Array<struct> (#5508)

- Tag dispatching is used for implicit specialization
- Array<scalar> and Array<struct> have different iterators and accessors
- Array<scalar> and Array<struct> have different Mutate() methods

4 years agoJava: Added access object for vector of struct and vector of tables. (#5233)
Kulikov Alexey [Mon, 23 Sep 2019 16:22:43 +0000 (23:22 +0700)]
Java: Added access object for vector of struct and vector of tables. (#5233)

* Java: Added access object for vector of struct and vector of tables.

* Java: Workarounds removed when accessing the union vector.

4 years agoFixed DetachedBuffer self move assignment (#5521)
mmoscicki2 [Thu, 19 Sep 2019 17:32:24 +0000 (19:32 +0200)]
Fixed DetachedBuffer self move assignment (#5521)

4 years agoFix buildifier warnings found in new bazel (#5517)
Austin Schuh [Thu, 19 Sep 2019 16:58:36 +0000 (09:58 -0700)]
Fix buildifier warnings found in new bazel (#5517)

Fixes warnings caught in:
https://buildkite.com/bazel/flatbuffers/builds/863#cff87e1d-b976-4734-8157-4b6d88c7b5e1

4 years agoFixed Reflection Verifier not handling vectors of unions.
Wouter van Oortmerssen [Tue, 17 Sep 2019 00:48:54 +0000 (17:48 -0700)]
Fixed Reflection Verifier not handling vectors of unions.

Change-Id: Ie94386ff8e10fd2a964bd9155139b50953746a37

4 years agoFixed GenerateText not handling vectors of unions.
Wouter van Oortmerssen [Mon, 16 Sep 2019 21:43:35 +0000 (14:43 -0700)]
Fixed GenerateText not handling vectors of unions.

Change-Id: Ie82abaf178495c4692e7d10be6b4a13f2fa1bee6

4 years agoAdd element size parameter to __vector_as_arraysegment [c#] (#5512)
Kevin Fort [Wed, 11 Sep 2019 00:07:46 +0000 (19:07 -0500)]
Add element size parameter to __vector_as_arraysegment [c#] (#5512)

* Add element size parameter to __vector_as_arraysegment

Add element size parameter to __vector_as_arraysegment fixing issue where VectorAsBytes returns incorrect size span for multibyte element types.

* Update codegen

Update codegen and Table to return typed span.

* update test files

update test files

4 years ago[Java][FlexBuffers] Improve documentation for FlexBuffers in Java. (#5506)
Paulo Pinheiro [Tue, 10 Sep 2019 17:06:47 +0000 (19:06 +0200)]
[Java][FlexBuffers] Improve documentation for FlexBuffers in Java. (#5506)

Also add a FlexBuffer constructor to simplify usage

4 years agoAnnotate getters with @Pure when --java-checkerframework is specified. (#5510)
jaceksur [Tue, 10 Sep 2019 17:01:27 +0000 (10:01 -0700)]
Annotate getters with @Pure when --java-checkerframework is specified. (#5510)

Together with @Nullable, this allows users to use static analysis tools
like CheckerFramework to catch NPEs caused by unset fields.

4 years ago[Dart]fix: segment fault with empty namespace when generating dart file (#5507)
Edward [Mon, 9 Sep 2019 21:40:33 +0000 (05:40 +0800)]
[Dart]fix: segment fault with empty namespace when generating dart file (#5507)

* fix: segment fault with empty namespace when generating dart file

* fix: compile err

* fix: compile err

* fix: imported file names

* fix test issues

* fix some language style issues

4 years agoRust: Fixed cargo clippy on non-generated code (#5485)
Casper [Mon, 9 Sep 2019 20:02:43 +0000 (13:02 -0700)]
Rust: Fixed cargo clippy on non-generated code (#5485)

* Cargo clippy lints

* more lints

* more lints

* Restored a doc comment

* Comment on float eps-eq and adjusted casting

4 years ago[Javascript] Fix syntax error for signed enum (#5503)
Jaemin Park [Thu, 5 Sep 2019 17:22:04 +0000 (02:22 +0900)]
[Javascript] Fix syntax error for signed enum (#5503)

* wrap quotes to enum name map to prevent syntax errorn when enum value is negative

* Add a test that covers signed enum case

4 years ago[C#] Fix retrieving enumeration vectors as arrays (#5457)
Nathan Williams [Tue, 3 Sep 2019 21:10:54 +0000 (07:10 +1000)]
[C#] Fix retrieving enumeration vectors as arrays (#5457)

* [C#] Fix retrieving enumeration vectors as arrays

* [C#] Don't generate CreateVectorBlock for enums

4 years agoDoc typo fixes (#5505)
Björn Harrtell [Tue, 3 Sep 2019 18:50:42 +0000 (20:50 +0200)]
Doc typo fixes (#5505)

4 years agoUse all of the available space in the buffer returned by ByteBufferFactory to allow...
Morten Grouleff [Tue, 3 Sep 2019 18:13:32 +0000 (20:13 +0200)]
Use all of the available space in the buffer returned by ByteBufferFactory to allow the factory to keep a pool of larger than initialsize sized buffers. (#5500)

4 years ago[FlexBuffers][Java] Implementation of FlexBuffers API (#5476)
Paulo Pinheiro [Thu, 29 Aug 2019 22:06:24 +0000 (00:06 +0200)]
[FlexBuffers][Java] Implementation of FlexBuffers API (#5476)

* [FlexBuffers][Java] Implementation of FlexBuffers API

This is the initial attemp to implement FlexBuffer on Java.

There is some limitations as compared to the C++ implementation:
  1 - No mutations implemented yet
  2 - Does not parse from json

Also, this initial implementation is not focused and performance, but
get the basics write. So there is many opportunities for optimization, for instance,
remove all enums, return CharSequence instead of Strings and object pooling.

* [FlexBuffers][Java] Optimizations and simplification of the Builder  API.

This change removes BitWidth enum in favor of static ints. Also
make all "reads" APIs closer to C++ implementation (try to cast or convert
as much as possible, assuming user knows what he is doing). Finally,
we remove the helper classes for building vectors and maps.

There is no official benchmarks, but the unit tests are running in less
than 50% for previous runs, which mean those optimizations are worth it.

* [FlexBuffers][Java] Fix Reference::asString behavior

There was a incorrect assumption that strings would be null-terminated, which
could lead to truncated strings. S now it relies size instead of null-termination.

Other minor improvements

4 years agoClarified value reuse in FlexBuffers
Wouter van Oortmerssen [Mon, 26 Aug 2019 21:59:21 +0000 (14:59 -0700)]
Clarified value reuse in FlexBuffers

Change-Id: Ib771bfa46ccdf38eff25be857b1b73f8b300c649

4 years agoFixed test build invocation of arrays_test.fbs
Wouter van Oortmerssen [Mon, 26 Aug 2019 21:33:38 +0000 (14:33 -0700)]
Fixed test build invocation of arrays_test.fbs

Change-Id: Idfc8d9cfbdefda44f803a6232700842ee6b6bffd

4 years agoFlexBuffers: allow any values to be shared.
Wouter van Oortmerssen [Mon, 26 Aug 2019 18:54:38 +0000 (11:54 -0700)]
FlexBuffers: allow any values to be shared.

(see comments in the code).

Change-Id: I5603abb0db436145739653692644bbcfd3c946e3

4 years agoAndroid: remove app_dummy() calls
Wouter van Oortmerssen [Fri, 23 Aug 2019 21:31:31 +0000 (14:31 -0700)]
Android: remove app_dummy() calls

Change-Id: I0ebd4502f98d009ce5afe8c8bafb629284f0366c

4 years agoFixed STLPort Android compile error
Wouter van Oortmerssen [Fri, 23 Aug 2019 21:17:33 +0000 (14:17 -0700)]
Fixed STLPort Android compile error

Change-Id: I3595b9c6803718f34ce61fdfc367da97b50dc444

4 years ago[bugfix]flexbuffers isvector bugfix (#5488)
Earlonus [Fri, 23 Aug 2019 17:51:36 +0000 (01:51 +0800)]
[bugfix]flexbuffers isvector bugfix (#5488)

* commit isvector bugfix (change email recommit to pass cla)

* commit IsUntypedVector

* delete isvectorormap function

4 years agoFix incorrect padding in arrays of structs (Issue #5484) (#5491)
svenk177 [Fri, 23 Aug 2019 17:46:47 +0000 (19:46 +0200)]
Fix incorrect padding in arrays of structs (Issue #5484) (#5491)

4 years agoFixed missing generated code.
Wouter van Oortmerssen [Tue, 20 Aug 2019 00:57:23 +0000 (17:57 -0700)]
Fixed missing generated code.

Change-Id: Iaa0633167c2a4d4543fc4de2af58112d60d5d1e6

4 years agoC++ IDL generation adds superfluous semicolon in GenTablePost, causing (#5483)
Wes McKinney [Tue, 20 Aug 2019 00:49:37 +0000 (19:49 -0500)]
C++ IDL generation adds superfluous semicolon in GenTablePost, causing (#5483)

-Wextra-semi-stmt warning when building with Clang 8.0.0. Update generated
files for testing

4 years ago[go]add Name() for ForceCodec interface (#5486)
Tsingson [Mon, 19 Aug 2019 22:32:04 +0000 (06:32 +0800)]
[go]add Name() for ForceCodec  interface (#5486)

* add Name() for ForceCodec  interface

// ForceCodec returns a CallOption that will set the given Codec to be
// used for all request and response messages for a call. The result of calling
// String() will be used as the content-subtype in a case-insensitive manner.
//

* Update grpc.go

4 years agoreflection: check for valid union enum value during object verification (#5475)
Mark Nauwelaerts [Mon, 19 Aug 2019 19:48:25 +0000 (21:48 +0200)]
reflection: check for valid union enum value during object verification (#5475)

... to avoid assertion failure or invalid access due to invalid vector index

4 years agohas_method support for primitive fields in java runtime. Changed: idl.h, FlatBufferBu...
Edward [Mon, 19 Aug 2019 19:46:48 +0000 (12:46 -0700)]
has_method support for primitive fields in java runtime. Changed: idl.h, FlatBufferBuilder.java ,  idl_gen_general.cpp, idl_parser.cpp, flatc.cpp (#5468)

* has_method support for primitive fields in java runtime

* adding the new flag to flatc

* addressing the review comments

4 years agoFix compilation error in tests. (#5472)
Max Burke [Mon, 5 Aug 2019 18:57:54 +0000 (11:57 -0700)]
Fix compilation error in tests. (#5472)

Local variables were shadowing member fields, causing errors.

4 years ago[C++] remove static_cast expression (#5440)
Alexey Geraskin [Thu, 1 Aug 2019 21:31:48 +0000 (00:31 +0300)]
[C++] remove static_cast expression (#5440)

* [C++] remove static_cast expression

* [C++] Add unit test for native_type usage

* [C++] Add flatc compilation for native_type_test.fbs

* [C++] update CMakeLists to compile native_type_test.fbs properly

* Update BUILD file for bazel

* [C++] Add generated native_type_test_generated.h and fix arguments for flatc according to CMakeList

* [C++] remove "= default" from constructor to support old compilers

* Update BUILD file for bazel, attempt 2

* [C++] Workaround for MSVC 2010 for the issue with std::vector and explicitly aligned custom data types

* Update BUILD file for bazel, attempt 3

* Update BUILD file for bazel, attempt 4

* Update BUILD file for bazel, attempt 5

* Update BUILD file for bazel, attempt 6

* [C++] Workaround for MSVC 2010 for the issue with std::vector and explicitly aligned custom data types Part 2

* [C++] Keep only one optional parameter to compile_flatbuffers_schema_to_cpp_opt

* native_type_test.fbs style corrected

* [C++] Code style modifications

* [C++] Fix flatc arguments in CMakeLists

* [C++] Remove --gen-compare from default parameters for flatc in CMakeLists

* [C++] Change Vector3D fields from double to float, to have alignment eq. 4 (to support MSVC 2010), plus minor review fix

* [C++] Remove one more #if !defined

* [C++] Restore version with correct static_cast, add the same fix for SortedStructs

* Revert "[C++] Restore version with correct static_cast, add the same fix for SortedStructs"

This reverts commit d61f4d6628cfce530c8b9a4c9e7af368d599f99f.

* [C++] Fix Android.mk

4 years ago[C++ ] Correctly serialize bit_flags enums to JSON with output_enum_identifiers optio...
ll-antn [Thu, 1 Aug 2019 21:16:44 +0000 (00:16 +0300)]
[C++ ] Correctly serialize bit_flags enums to JSON with output_enum_identifiers option (#5454)

* Support output_enum_identifiers for enums with multiple bit values

* Cast bit_flag enum val to uint64_t instead of int64_t

4 years agoFix for Boolean types (#5379) (#5466)
Derek Bailey [Thu, 1 Aug 2019 17:28:54 +0000 (10:28 -0700)]
Fix for Boolean types (#5379) (#5466)

The packing/unpacking steps for Boolean values was failing because the
code expected numerical values. I overrode the functions for the Boolean
metatable to account for this. I also had to exclude the Boolean
metatable from the GenerateTypes helper function, as that was overriding
the Pack/Unpack functions defined in its metatable.

Added Linux bash script to run Lua tests from the command line.

Bug: google/flatbuffers#5379

Tested: Added Lua tests that were failing and are now fixed with the
code changes.

4 years agoRenamed stale label from "wontfix" to "stale".
Wouter van Oortmerssen [Mon, 29 Jul 2019 18:43:28 +0000 (11:43 -0700)]
Renamed stale label from "wontfix" to "stale".

Change-Id: Iea88624d9d90e029a64cab9edf4e7c1cfc005e4a

4 years agoReplace '--cpp-include' brackets to quotes (#5438) (#5464)
Vladimir Glavnyy [Mon, 29 Jul 2019 18:38:52 +0000 (01:38 +0700)]
Replace '--cpp-include' brackets to quotes (#5438) (#5464)

4 years agoMade stale.yml friendlier.
Wouter van Oortmerssen [Sat, 27 Jul 2019 01:56:56 +0000 (18:56 -0700)]
Made stale.yml friendlier.

4 years agoExtend the error message if base type of parsed scalar not resolved (#5456)
Vladimir Glavnyy [Sat, 27 Jul 2019 00:56:41 +0000 (07:56 +0700)]
Extend the error message if base type of parsed scalar not resolved (#5456)

* Extend the error message if base type of parsed scalar not resolved #5447

* Resolve PR notes

4 years agoAdd .github/stale.yml to auto close stale issues and PRs.
Wouter van Oortmerssen [Sat, 27 Jul 2019 00:48:21 +0000 (17:48 -0700)]
Add .github/stale.yml to auto close stale issues and PRs.

See https://probot.github.io/apps/stale/

Change-Id: I8176eeb21dbcd516f1d6f7b1e8c28602cdd9332a

4 years agoPython: Added support for file_identifiers (#5123)
Joseph Pyott [Fri, 26 Jul 2019 18:06:25 +0000 (14:06 -0400)]
Python: Added support for file_identifiers (#5123)

* Python: Added support for file_identifiers

* Added tests. Fixed file_identifier code.

* Python: Fixed excessive padding of file_identifier. Repaired tests.

* Python: Made code compatible with python2.7

* Python: Typo fix in @endcond

* whitespace normaalization

* Stylistic change from if(not X is None) to if(X is not None). Added comment to type string.

* Python: Added support for automatic code generation of file_identifiers. Added tests for said code generation.

* converted sprintf to snprintf

* Bugfix, added snprint deffinition for MSVC

* changed snprint deffinition for MSVC to sprint_s

* changed scanf to IntToStringHex. Renamed HasFileIdentifier to GenHasFileIdentifier.

* Added updated genereated code to commit

* Python bugix: flatc no longer produces HasFileIdentfier for shcemas with no file identifier

* Added tests to verify `MonsterBufferHasIdentifier` returns false on no Identifier

* Python: added tests for GetBufferIdentifier and BufferHasIdentifier
Python: removed unessasary parenethesis in if statements
Minor format changes.

* Python : correceted instances of keyword arguments being called as positional arguments

* fixed typos and grammer in comments

* Minor style fixes

* Indentation fix

* Equals style changes

* Python: Fixed Alignment Issues. Changed test code to test against atual output

* Ran make(forgot to run make last commit)

* Python: Style changes

* Style changes

* indentation and style

* readded CONTRIBUTING.md

* Formatting tweak

Mostly to make CI run again

* More formatting fixes

* More formatting fixes

* More formatting fixes

* More formatting fixes

* Formatting fix

* More formatting fixes

* Formatting

* ran generate_code.sh

4 years agoFix numeric_limits<T>::max() to avoid conflict with windows.h header (#5462)
ll-antn [Fri, 26 Jul 2019 16:14:05 +0000 (19:14 +0300)]
Fix numeric_limits<T>::max() to avoid conflict with windows.h header (#5462)

4 years agoSupport nested_flatbuffer attribute when parsing bfbs schema (#5448)
ll-antn [Fri, 26 Jul 2019 16:13:11 +0000 (19:13 +0300)]
Support nested_flatbuffer attribute when parsing bfbs schema (#5448)

4 years agoPin FlatBuffers Android Travis builds to NDK r17c (#5460)
Stewart Miles [Fri, 26 Jul 2019 00:58:02 +0000 (17:58 -0700)]
Pin FlatBuffers Android Travis builds to NDK r17c (#5460)

r17c is the last Android NDK to include stlport and gnustl.
We want to continue to support these deprecated STLs until we have
confidence few enough customers are using them.

4 years agoChange deprecated vector Length() to size() in tutorial (#5450)
Jason Monschke [Thu, 25 Jul 2019 18:09:40 +0000 (18:09 +0000)]
Change deprecated vector Length() to size() in tutorial (#5450)

4 years agoAdded missing Kotlin generated code change.
Wouter van Oortmerssen [Thu, 25 Jul 2019 18:08:06 +0000 (11:08 -0700)]
Added missing Kotlin generated code change.

Change-Id: I7eeee6519b6dc619691437e44272cf5424d0d4ca

4 years ago#4590 Fix Conan build (#5449)
Uilian Ries [Thu, 25 Jul 2019 18:06:40 +0000 (15:06 -0300)]
#4590 Fix Conan build (#5449)

* #4590 Fix Conan build

- Create separated build for Conan on master branch
- Add Clang 7,8
- Add Gcc 9

Signed-off-by: Uilian Ries <uilianries@gmail.com>
* #4590 Do not build Conan for PRs

Signed-off-by: Uilian Ries <uilianries@gmail.com>
4 years agoAdd basic Kotlin support (#5409)
Paulo Pinheiro [Mon, 22 Jul 2019 23:05:15 +0000 (20:05 -0300)]
Add basic Kotlin support (#5409)

* [Kotlin] Add kotlin generate code for tests and add
kotlin test to TestAll.sh

* [Kotlin] Add Kotlin generator

This change adds support for generating Kotlin classes.

The approach of this generator is to keep it as close
as possible to the java generator for now, in order
to keep the change simple.

It uses the already implemented java runtime,
so we don't support cross-platform nor js Kotlin yet.

Kotlin tests are just a copy of the java tests.

* Add optional ident support for CodeWriter

Identation is important for some languages and
different projects have different ways of ident
code, e.g. tabs vs spaces, so we are adding optional
support on CodeWriter for identation.

* [Kotlin] Add Documentation for Kotlin

* [Kotlin] Modify generated code to use experimental Unsigned types.

5 years ago[C++] fix static_cast expression (#5441)
Alexey Geraskin [Thu, 18 Jul 2019 18:51:12 +0000 (21:51 +0300)]
[C++] fix static_cast expression (#5441)

5 years ago[rust] Ran rustfmt against library code (#5389)
jean-airoldie [Tue, 9 Jul 2019 20:41:51 +0000 (16:41 -0400)]
[rust] Ran rustfmt against library code (#5389)

5 years agoExtend the test of MonsterExtra (#5428)
Vladimir Glavnyy [Mon, 8 Jul 2019 18:22:56 +0000 (01:22 +0700)]
Extend the test of MonsterExtra (#5428)

* Extend the test of MonsterExtra

- Extend C++ test of MonsterExtra
- Add conversion of fbs/json NaNs to unsigned quiet-NaN
- Update documentation (cross-platform interoperability)

* Fix declaration of infinity constants int the test

5 years agoFix echo not interpret \n in GoTest.sh (#5426)
Thanabodee Charoenpiriyakij [Mon, 1 Jul 2019 18:42:00 +0000 (01:42 +0700)]
Fix echo not interpret \n in GoTest.sh (#5426)

When running GoTest.sh, the last step that checking go format files
are print \n instead of new line:

These files are not well gofmt'ed:\n\nMyGame/Example/Color.go
MyGame/Example/MonsterStorage_grpc.go

This changes fix it by echo NOT_FMT_FILES in separate line.

5 years agoRemove unused variables (#5382)
Vladimir Glavnyy [Mon, 1 Jul 2019 18:38:21 +0000 (01:38 +0700)]
Remove unused variables (#5382)

- Fix GenerateTextFromTable (aliasing typo)
- Fix unused variable in idl_gen_dart.cpp
- Fix std::string passing (should be non-const value or const-reference)
- Remove unused variables

5 years agoFix undefined behavior. Closes #5422 (#5423)
Andrew Noyes [Thu, 27 Jun 2019 21:11:31 +0000 (14:11 -0700)]
Fix undefined behavior. Closes #5422 (#5423)

* Fix undefined behavior. Closes #5422

* Move check into callers of make_space

5 years agoUpdate Utf8.java: more detailed exception message (#5421)
Edward [Thu, 27 Jun 2019 19:19:57 +0000 (12:19 -0700)]
Update Utf8.java: more detailed exception message (#5421)

Provide more detailed exception message for malformed 2 byte utf8 character

5 years agoFix for FLATBUFFERS_PREFER_PRINTF writing zero-length strings (#5418)
Adrian Perez [Thu, 27 Jun 2019 16:23:13 +0000 (09:23 -0700)]
Fix for FLATBUFFERS_PREFER_PRINTF writing zero-length strings (#5418)

5 years agoSet C# Struct/Table visibility to public (#5381) (#5416)
Vladimir Glavnyy [Tue, 25 Jun 2019 00:51:04 +0000 (07:51 +0700)]
Set C# Struct/Table visibility to public (#5381) (#5416)

5 years agoDon't check ForceDefaults when adding Offfset values (#5415)
Bryan Furia [Tue, 25 Jun 2019 00:49:53 +0000 (20:49 -0400)]
Don't check ForceDefaults when adding Offfset values (#5415)

5 years agoFixed broken Utf8Old.java
Wouter van Oortmerssen [Mon, 24 Jun 2019 23:53:50 +0000 (16:53 -0700)]
Fixed broken Utf8Old.java

This would not correctly encode/decode strings when substituted for
the default Utf8Safe.java

Change-Id: Ib303697663b5b8cbf6888492f5255b2a45384c04

5 years agoFix generating nested Flatbuffer accessors when they cross namespaces (#5414)
Bryan Furia [Mon, 24 Jun 2019 18:46:00 +0000 (14:46 -0400)]
Fix generating nested Flatbuffer accessors when they cross namespaces (#5414)

5 years agoFix compatability with Bazel 0.27 (#5412)
Austin Schuh [Thu, 20 Jun 2019 17:25:41 +0000 (10:25 -0700)]
Fix compatability with Bazel 0.27 (#5412)

rules_go was too old and using deprecated features.  Upgrade it.

5 years agoUpdated missing generated code for PR #5313 (fixed arrays)
Wouter van Oortmerssen [Thu, 20 Jun 2019 17:21:10 +0000 (10:21 -0700)]
Updated missing generated code for PR #5313 (fixed arrays)

Change-Id: I249140119e6241beb5aec5670d0e5ccddc8f5251

5 years agoAdd support for fixed-size arrays (#5313)
svenk177 [Mon, 17 Jun 2019 22:15:13 +0000 (00:15 +0200)]
Add support for fixed-size arrays (#5313)

5 years agoAdd FLATBUFFERS_COMPATIBILITY string (#5381)
Vladimir Glavnyy [Mon, 17 Jun 2019 17:16:21 +0000 (00:16 +0700)]
Add FLATBUFFERS_COMPATIBILITY string (#5381)

* Add FLATBUFFERS_COMPATIBILITY string

- Add a new __reset method NET/JAVA which hides internal state

* Resolve PR notes

* Use operator new() to __init of Struct and Table

* Restrict visibility of C# Table/Struct to internal level

5 years ago[C#, Java, C++] Fixes issue #5399 by always including namespaces (#5404)
John Luxford [Fri, 14 Jun 2019 15:47:08 +0000 (10:47 -0500)]
[C#, Java, C++] Fixes issue #5399 by always including namespaces (#5404)

* [C#] Fixes issue #5399 by always including namespaces

* Updated tests for code generator changes

* Fixed 'As' method names

5 years ago[Go] Fix namespaces on enums (#5406)
John Luxford [Fri, 14 Jun 2019 03:25:03 +0000 (22:25 -0500)]
[Go] Fix namespaces on enums (#5406)

5 years agoExcluded crtdbg.h from non-MSVC compilation (#5401)
Tiger Caldwell [Thu, 13 Jun 2019 09:58:40 +0000 (02:58 -0700)]
Excluded crtdbg.h from non-MSVC compilation (#5401)