Commit Graph

1831 Commits

Author SHA1 Message Date
Morten Grouleff cb35d3a0e5 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) 2019-09-03 11:13:32 -07:00
Paulo Pinheiro 8e6cabb31b [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
2019-08-29 15:06:24 -07:00
Wouter van Oortmerssen bd31dd2425 Clarified value reuse in FlexBuffers
Change-Id: Ib771bfa46ccdf38eff25be857b1b73f8b300c649
2019-08-26 14:59:21 -07:00
Wouter van Oortmerssen 65b67d2132 Fixed test build invocation of arrays_test.fbs
Change-Id: Idfc8d9cfbdefda44f803a6232700842ee6b6bffd
2019-08-26 14:33:38 -07:00
Wouter van Oortmerssen 1fbb711324 FlexBuffers: allow any values to be shared.
(see comments in the code).

Change-Id: I5603abb0db436145739653692644bbcfd3c946e3
2019-08-26 14:17:52 -07:00
Wouter van Oortmerssen cd75a36587 Android: remove app_dummy() calls
Change-Id: I0ebd4502f98d009ce5afe8c8bafb629284f0366c
2019-08-23 14:33:16 -07:00
Wouter van Oortmerssen ec6b0bf297 Fixed STLPort Android compile error
Change-Id: I3595b9c6803718f34ce61fdfc367da97b50dc444
2019-08-23 14:17:33 -07:00
Earlonus c11b5d7447 [bugfix]flexbuffers isvector bugfix (#5488)
* commit isvector bugfix (change email recommit to pass cla)

* commit IsUntypedVector

* delete isvectorormap function
2019-08-23 10:51:36 -07:00
svenk177 4525c91be3 Fix incorrect padding in arrays of structs (Issue #5484) (#5491) 2019-08-23 10:46:47 -07:00
Wouter van Oortmerssen b97b342f59 Fixed missing generated code.
Change-Id: Iaa0633167c2a4d4543fc4de2af58112d60d5d1e6
2019-08-19 17:57:23 -07:00
Wes McKinney c1058a903b 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
2019-08-19 17:49:37 -07:00
Tsingson 3030449348 [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
2019-08-19 15:32:04 -07:00
Mark Nauwelaerts a2485d4ecc reflection: check for valid union enum value during object verification (#5475)
... to avoid assertion failure or invalid access due to invalid vector index
2019-08-19 12:48:25 -07:00
Edward a20e71ac96 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
2019-08-19 12:46:48 -07:00
Max Burke acc9990abd Fix compilation error in tests. (#5472)
Local variables were shadowing member fields, causing errors.
2019-08-05 11:57:54 -07:00
Alexey Geraskin 2d5315ff0e [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 d61f4d6628.

* [C++] Fix Android.mk
2019-08-01 14:31:48 -07:00
ll-antn 7de1a5e347 [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
2019-08-01 14:16:44 -07:00
Derek Bailey a4e3ad808e 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.
2019-08-01 10:28:54 -07:00
Wouter van Oortmerssen c953fa572b Renamed stale label from "wontfix" to "stale".
Change-Id: Iea88624d9d90e029a64cab9edf4e7c1cfc005e4a
2019-07-29 11:43:54 -07:00
Vladimir Glavnyy 0c86085a5b Replace '--cpp-include' brackets to quotes (#5438) (#5464) 2019-07-29 11:38:52 -07:00
Wouter van Oortmerssen a1f7ecd148 Made stale.yml friendlier. 2019-07-26 18:56:56 -07:00
Vladimir Glavnyy a20c55bea5 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
2019-07-26 17:56:41 -07:00
Wouter van Oortmerssen d7c2b388ef Add .github/stale.yml to auto close stale issues and PRs.
See https://probot.github.io/apps/stale/

Change-Id: I8176eeb21dbcd516f1d6f7b1e8c28602cdd9332a
2019-07-26 17:49:40 -07:00
Joseph Pyott 9fa8245e81 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
2019-07-26 11:06:25 -07:00
ll-antn a5ca8bee4d Fix numeric_limits<T>::max() to avoid conflict with windows.h header (#5462) 2019-07-26 09:14:05 -07:00
ll-antn 09dea79a22 Support nested_flatbuffer attribute when parsing bfbs schema (#5448) 2019-07-26 09:13:11 -07:00
Stewart Miles b632061eff 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.
2019-07-25 17:58:02 -07:00
Jason Monschke da88be05e1 Change deprecated vector Length() to size() in tutorial (#5450) 2019-07-25 11:09:40 -07:00
Wouter van Oortmerssen d4fa984f1d Added missing Kotlin generated code change.
Change-Id: I7eeee6519b6dc619691437e44272cf5424d0d4ca
2019-07-25 11:08:06 -07:00
Uilian Ries a0c0131e36 #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>
2019-07-25 11:06:40 -07:00
Paulo Pinheiro de9aa0cdee 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.
2019-07-22 16:05:15 -07:00
Alexey Geraskin a752d1b88c [C++] fix static_cast expression (#5441) 2019-07-18 11:51:12 -07:00
jean-airoldie db972be264 [rust] Ran rustfmt against library code (#5389) 2019-07-09 13:41:51 -07:00
Vladimir Glavnyy e304f8c115 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
2019-07-08 11:22:56 -07:00
Thanabodee Charoenpiriyakij 47c7aa0361 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.
2019-07-01 11:42:00 -07:00
Vladimir Glavnyy 7a63792929 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
2019-07-01 11:38:21 -07:00
Andrew Noyes 7d7d796cd0 Fix undefined behavior. Closes #5422 (#5423)
* Fix undefined behavior. Closes #5422

* Move check into callers of make_space
2019-06-27 14:11:31 -07:00
Edward 550b386995 Update Utf8.java: more detailed exception message (#5421)
Provide more detailed exception message for malformed 2 byte utf8 character
2019-06-27 12:19:57 -07:00
Adrian Perez 5479adc80f Fix for FLATBUFFERS_PREFER_PRINTF writing zero-length strings (#5418) 2019-06-27 09:23:13 -07:00
Vladimir Glavnyy b7012484f3 Set C# Struct/Table visibility to public (#5381) (#5416) 2019-06-24 17:51:04 -07:00
Bryan Furia 92e9f33036 Don't check ForceDefaults when adding Offfset values (#5415) 2019-06-24 17:49:53 -07:00
Wouter van Oortmerssen ff1a22a05f Fixed broken Utf8Old.java
This would not correctly encode/decode strings when substituted for
the default Utf8Safe.java

Change-Id: Ib303697663b5b8cbf6888492f5255b2a45384c04
2019-06-24 16:54:28 -07:00
Bryan Furia 9fb195cce8 Fix generating nested Flatbuffer accessors when they cross namespaces (#5414) 2019-06-24 11:46:00 -07:00
Austin Schuh 7836e65dd4 Fix compatability with Bazel 0.27 (#5412)
rules_go was too old and using deprecated features.  Upgrade it.
2019-06-20 10:25:41 -07:00
Wouter van Oortmerssen 123c7a4890 Updated missing generated code for PR #5313 (fixed arrays)
Change-Id: I249140119e6241beb5aec5670d0e5ccddc8f5251
2019-06-20 10:21:10 -07:00
svenk177 e635141d5b Add support for fixed-size arrays (#5313) 2019-06-18 00:15:13 +02:00
Vladimir Glavnyy 0d2cebccfe 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
2019-06-17 19:16:21 +02:00
John Luxford a80db8538c [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
2019-06-14 17:47:07 +02:00
John Luxford a6be1d0d74 [Go] Fix namespaces on enums (#5406) 2019-06-13 20:25:03 -07:00
Tiger Caldwell a7e20b1996 Excluded crtdbg.h from non-MSVC compilation (#5401) 2019-06-13 11:58:40 +02:00