platform/upstream/flatbuffers.git
7 years agoidl_parser.cpp ignores $schema in input json (#4382)
schoetbi [Wed, 19 Jul 2017 15:58:48 +0000 (17:58 +0200)]
idl_parser.cpp ignores $schema in input json (#4382)

* idl_parser.cpp ignores $schema in input json
#4381

* idl_parser.cpp: Fixed ci error signed unsigned comparison

* idl_parser.cpp: replaced case insensitive search for $schema with case sensitive search

* idl_parser.cpp: Expecting a string constant after $schema
#4382

7 years agoJava: Added ByteBufferFactory interface and sizedInputStream method. (#4379)
Alex Wasserman [Thu, 13 Jul 2017 15:33:32 +0000 (10:33 -0500)]
Java: Added ByteBufferFactory interface and sizedInputStream method. (#4379)

The ByteBufferFactory interface gives the user an option to specify
the method in which the internal ByteBuffer is allocated. This provides
flexibility in the type of ByteBuffer that can be used.
The sizedInputStream method is an alternative to sizedByteArray that
does not make a copy of the data in memory.

7 years agoJson schema (#4369)
schoetbi [Mon, 10 Jul 2017 15:05:59 +0000 (17:05 +0200)]
Json schema (#4369)

* Added empty generator for json schema (idl_gen_json_schema.cpp)
#4360

* JsonSchemaGenerator: output of tables implemented

current problems:
- typenames are not correct
- array types need to be deduced

#4360

* JsonSchemaGenerator: Corrected generation of typenames
Current problems: enum types not written correctly
#4360

* JsonSchemaGenerator: Added generation of enum types
#4360

* idl_gen_json_schema.cpp: Write required properties to schema
#4360

* idl_gen_json_schema.cpp: Export Types including namespace
#4360

* idl_gen_json_schema.cpp: Fixed Json format
#4360

* idl_gen_json_schema.cpp: Formatted according to google code style
#4360

* Checked in monster_test.bfbs with changes from master

* Added idl_gen_json_schema.cpp in CMakeLists.txt

* generate_code.bat: Added generation of json schema

* Added todo.md

* generate_code.sh: Added generation of json schema

* Addressed some review issues
- removed command line arg -S
- removed new lines
- fixed codestyle in template functions
- removed usage of stringstream
- idented json schema
#4360

* removed auto in idl_gen_json_schema.cpp

* idl_gen_json_schema.cpp: changed iterator declarations to auto
#4360

* deleted todo.md

* idl_gen_json_schema.cpp: Removed keyword "override" so that vs2010 can compile

* idl_gen_json_schema.cpp: switch statement in GenType handeles all enum-members

* idl_gen_json_schema.cpp: Removed cerr output

* idl_gen_json_schema.cpp: Avoid vector copying

* idl_gen_json_schema.cpp: Fixed identation of json schema output

* idl_gen_json_schema.cpp: Do not output empty descriptions

7 years agoMake inter-file cycles compile (#4364)
Robbie McElrath [Mon, 26 Jun 2017 16:07:02 +0000 (09:07 -0700)]
Make inter-file cycles compile (#4364)

7 years agoMake flatbuffers work with ArduinoSTL (#4357) (#4361)
Andrei Stoica [Wed, 21 Jun 2017 15:26:37 +0000 (17:26 +0200)]
Make flatbuffers work with ArduinoSTL (#4357) (#4361)

*Keep legacy compatibility with StandardCplusplus lib (utility.h)

7 years agoAvoiding wrong template specialization on new CreateVector v1.7.1
Wouter van Oortmerssen [Tue, 20 Jun 2017 16:40:10 +0000 (09:40 -0700)]
Avoiding wrong template specialization on new CreateVector

Change-Id: I0da57cc71318ea13c10b547e2dfe3a2d4f32b4d9
Tested: on OS X.

7 years agoUpdated version numbers to 1.7.0 v1.7.0
Wouter van Oortmerssen [Fri, 16 Jun 2017 23:15:02 +0000 (16:15 -0700)]
Updated version numbers to 1.7.0

Change-Id: If2802ca48b61cfa7e5ec131e2a268400523217e2

7 years agoOptimize CreateVector for types > 1 byte on little endian (#4355)
Christopher Berner [Fri, 16 Jun 2017 22:29:47 +0000 (15:29 -0700)]
Optimize CreateVector for types > 1 byte on little endian (#4355)

This gives a 10x speed up in my test, when creating a Vector of floats

7 years agoAdded move assignment operator to DetachedBuffer.
Wouter van Oortmerssen [Fri, 16 Jun 2017 22:04:42 +0000 (15:04 -0700)]
Added move assignment operator to DetachedBuffer.

Change-Id: I4610946ac27d9d0d73c2fc2e4834bd2cfed88cdc
Tested: on Linux.

7 years agoAdding a method to get the file identifier from a flatbuffer.
Wouter van Oortmerssen [Fri, 16 Jun 2017 19:30:36 +0000 (12:30 -0700)]
Adding a method to get the file identifier from a flatbuffer.

Change-Id: Ie28fd1f0b463aac23647d38921600f15c8b7c10a

7 years agoInitial support for parsing (and generating) Protobuf ASCII.
Wouter van Oortmerssen [Fri, 16 Jun 2017 18:57:58 +0000 (11:57 -0700)]
Initial support for parsing (and generating) Protobuf ASCII.

Change-Id: I955b4b3eed27f26773d7dc0acceff13c88d1333d
Tested: on Linux.

7 years agoAdded convenient schema registry.
Wouter van Oortmerssen [Fri, 16 Jun 2017 03:54:04 +0000 (20:54 -0700)]
Added convenient schema registry.

Change-Id: I9d71375059369fbc538d0d051d8d2885e467bf29
Tested: on Mac OS X.

7 years agoFixed missing lambda return type.
Wouter van Oortmerssen [Fri, 16 Jun 2017 16:52:59 +0000 (09:52 -0700)]
Fixed missing lambda return type.

Change-Id: I48d41a240c8bf362b1f931f20a3ed9ae64f2d295

7 years agoFixed build error in Visual Studio 2017 (#4353)
Stephen Lane-Walsh [Fri, 16 Jun 2017 16:53:53 +0000 (12:53 -0400)]
Fixed build error in Visual Studio 2017 (#4353)

flatbuffers.h(591): error C2220: warning treated as error - no 'object' file generated
flatbuffers.h(591): warning C4267: 'return': conversion from 'size_t' to 'flatbuffers::uoffset_t', possible loss of data

7 years agogRPC: fix memory leak (#4351)
Lawrence Chan [Tue, 13 Jun 2017 15:50:27 +0000 (10:50 -0500)]
gRPC: fix memory leak (#4351)

SerializationTraits<T>::Deserialize _transfers_ ownership of the buffer,
so we must destroy it.

This commit also includes some misc fixes:
- Use grpc::Status::OK rather than default ctor for clarity.
- Check for a null buffer passed into Deserialize, and handle it the
  same way as the protobuf deserializer.

7 years agoAdded (nested) FlexBuffer JSON parsing and output.
Wouter van Oortmerssen [Tue, 6 Jun 2017 00:45:44 +0000 (17:45 -0700)]
Added (nested) FlexBuffer JSON parsing and output.

FlexBuffer parser is just 40 lines of code (on top of existing parser!).

Change-Id: Idebebadafb661ca5333f5621139031f6df3c3e1a
Tested: on Linux.

7 years agoAdded nested FlexBuffer parsing
Wouter van Oortmerssen [Fri, 2 Jun 2017 23:41:22 +0000 (16:41 -0700)]
Added nested FlexBuffer parsing

Change-Id: I918b66eb5646d035e3aae675f745802eb54b03ea

7 years agoFix memory leak in Message move operator (#4344)
Christopher Berner [Mon, 12 Jun 2017 18:23:55 +0000 (11:23 -0700)]
Fix memory leak in Message move operator (#4344)

7 years ago[cpp] Json parsing: adding support for parsing nested lists and top level lists ...
Guillaume Giraud [Wed, 7 Jun 2017 23:58:19 +0000 (01:58 +0200)]
[cpp] Json parsing: adding support for parsing nested lists and top level lists (#4338)

* Extended json parsing capability: add support for parsing nested lists and top level lists

* Stylistic conformance with surrounding code + generalized comments

* More code tidy-up for stylistic conformance with surrounding code

* Blank lines

* Reverted changes related to top-level list parsing

* Styling: newline before else

* Taking out ProcessTableFields which is no longer needed as the top level list change was reverted.

7 years ago[C++] Remove std::iterator usage (#4340) (#4341)
Stephan T. Lavavej [Wed, 7 Jun 2017 23:26:06 +0000 (16:26 -0700)]
[C++] Remove std::iterator usage (#4340) (#4341)

* [C++] Remove std::iterator usage (#4340)

Inheriting from std::iterator has never been required, and it's
deprecated in C++17. It can be replaced by directly providing typedefs.

Include <iterator> for std::random_access_iterator_tag.

Note that structs default to public access control.

* [C++] Change whitespace style in typedefs.

7 years ago[C++] Improve flatbuffers + gRPC integration (#4310)
Lawrence Chan [Wed, 7 Jun 2017 20:56:49 +0000 (15:56 -0500)]
[C++] Improve flatbuffers + gRPC integration (#4310)

* Rework flatbuffers + gRPC integration

- Introduce `flatbuffers::grpc::Message<T>`, a `grpc_slice`-backed
message buffer that handles refcounting and allows flatbuffers to
transfer ownership to gRPC efficiently. This replaces
`flatbuffers::BufferRef<T>`, which required a copy call and was also
unsafe w.r.t. buffer lifetime.
- Introduce `flatbuffers::grpc::MessageBuilder`, a gRPC-specific builder
that forces a `grpc_slice`-backed allocator and also adds some helpful
`Message<T>`-related methods.
- Update serializers accordingly (now zero-copy between flatbuffers and
gRPC).

* gRPC: verify messages by default, but allow user to override

* gRPC: fix some formatting issues

* Disable verification by default, but add helper method

* Make FlatBufferBuilder fields protected + remove vec accessor

* Use bool add_ref parameter to toggle refcount incr

* Remove unnecessary inline specifiers

* Fix formatting

* Use auto

* Remove empty lines

* Use grpc_slice helper macros

* Simplify reset code

* Disable Message copy ctor and assignment by default

* Remove unused member

* Enable gRPC verification by default

* Use auto

* Bake in message verification (remove template specialization)

* Add RoundUp func

* Consolidate gRPC message copy flag

* Make vector_downward allocations fully lazy

* Test message verification failure code/message

* Add grpctest verification test comments

* Simplify reallocate implementation

* Make initial_size a size_t

* Use ternary op for growth_policy

* Use truthiness rather than dont explicit nullptr check

* Indent preprocessor directives

* Remove grpc message copy/assignment

* Fix a few bugs

* Add gRPC example

* Add basic gRPC docs

* Use doxygen EXAMPLE_PATH + @include

* Reference example fbs in grpc docs

* Move gRPC examples into grpc/samples

* Fix pointer/reference formatting

* Use std::function rather than templated callback func

* Create fresh message builder for each request

* Use Clear() in Reset() impl

* Use FLATBUFFERS_CONSTEXPR

7 years agoGenerate a C++ function for EnumValues{{ENUM_NAME}} (#4337)
rufeooo [Wed, 7 Jun 2017 20:49:56 +0000 (13:49 -0700)]
Generate a C++ function for EnumValues{{ENUM_NAME}} (#4337)

* enables "for each" logic on enumeration types

7 years ago[C++] Remove std::move around a raw pointer in flatbuffers.h (#4339)
vabr-g [Mon, 5 Jun 2017 17:33:04 +0000 (19:33 +0200)]
[C++] Remove std::move around a raw pointer in flatbuffers.h (#4339)

* Remove std::move around a raw pointer

Calling std::move on a raw pointer has no advantage to just copying its value. Moreover, it is confusing, because it indicates that the argument is movable in some non-trivial way (e.g., is it actually meant to be a smart pointer?). More context in https://crbug.com/729393.

* Remove the move constructor altogether

7 years agoDisallowing field name same as table name.
Wouter van Oortmerssen [Fri, 2 Jun 2017 22:55:02 +0000 (15:55 -0700)]
Disallowing field name same as table name.

Change-Id: I4b5d822cc4eda975949d1b7cf33674c5bbf9d4b1
Tested: on Linux.

7 years agoAdded test for nested FlatBuffers functionality.
Wouter van Oortmerssen [Fri, 2 Jun 2017 18:26:37 +0000 (11:26 -0700)]
Added test for nested FlatBuffers functionality.

Also fixed that the parsing test wasn't calling the buffer
testing function.

Change-Id: I5baae071bf0832c7797b4ef1d19d9b015e3ff5bc
Tested: on Linux.

7 years agorefactor flatbuffers.h and util.h so FlexBuffers do not depend on flatbuffers.h ...
AntonYudintsev [Fri, 2 Jun 2017 17:26:11 +0000 (20:26 +0300)]
refactor flatbuffers.h and util.h so FlexBuffers do not depend on flatbuffers.h (#4331)

FlexBuffers are actually completely unrelated to FlatBuffers and can be used separately.
However, since they utilize several utility functions from flatbuffer.h, they require this header file, which creates unreasonable dependency.
By moving those utility functions to separate base header, both libraries can use same code but still be independent

7 years agoTrack included files in PATH-agnostic way. (#4329)
Pavel Kalinnikov [Fri, 2 Jun 2017 15:50:18 +0000 (17:50 +0200)]
Track included files in PATH-agnostic way. (#4329)

* Track included files in PATH-agnostic way.

Use full paths as keys in the map of included files. Store logical
include path as a value, in order to put it to the generated file.

* Fix tests by accepting null |include_filename|.

* Fix self-includes code generators.

7 years agoFixed --keep-prefix functionality.
Wouter van Oortmerssen [Wed, 24 May 2017 22:21:26 +0000 (15:21 -0700)]
Fixed --keep-prefix functionality.

Changing to keep include prefixes had two side effects: the main
file being parsed wasn't filtered out anymore, and include directory
paths would be added to the path in the include statement.

Also moved the include_test*.fbs files to sub directories so we
can actually test the handling of -I etc.

tested: on Linux.

Change-Id: Ibae095cea7ab0cccbac15cfb5171719f6b5cad8c

7 years ago[C++] Improve Allocator handling (#4312)
Lawrence Chan [Wed, 24 May 2017 20:55:15 +0000 (15:55 -0500)]
[C++] Improve Allocator handling (#4312)

* Improve Allocator handling

- Templatize Allocator on vector_downward, and make it own the allocator
instance so it can manage lifetimes.
- Templatize + rename FlatBufferBuilderT accordingly, and add a typedef
to FlatBufferBuilder so old code continues to work.
- Fix some issues with the release deleter
- More details in github issue #4311

* Fix constexpr for older MSVC

* Reimplement allocator improvements via inheritance

Instead of templates, use an abstract base class and some unique_ptrs to
implement the new and improved allocator.

* Fix misplaced newline

* Add missing override keyword

* Add macro for func delete to support older compilers

* Explicitly move BufferDeleter (maybe fixes VS 10?)

* Revert previous attempt at VS10 fix

* Try yet another workaround for MS 10

* Use FLATBUFFERS_NOEXCEPT macro

* Add FLATBUFFERS_OVERRIDE macro

* Fix some issues with MSVC 16 hack

* Remove dep on unique_ptr

* Update DEPRECATED macro with a message

* Sigh, no delegating ctors before c++11

* Fix simple_allocator stub

* Relax FlatBufferBuilder ctor

* Add vector_downward reset + assert in clear

* Rename DetachedBuffer to FlatBuffer + remove unnecessary deprecations

* Add flatbuffers::FlatBufferBuilder::Release()

* Address remaining allocator-improvements comments

7 years agoSome code in the samples and docs still used old C# API.
Wouter van Oortmerssen [Mon, 22 May 2017 22:13:20 +0000 (15:13 -0700)]
Some code in the samples and docs still used old C# API.

Change-Id: I7914c88ad7b31baa7586771423069dc2b90d534f
Tested: on Linux.

7 years agoStandardized internal path handling on Posix separators.
Wouter van Oortmerssen [Fri, 19 May 2017 00:18:43 +0000 (17:18 -0700)]
Standardized internal path handling on Posix separators.

There were several possible bugs involving paths not being
recognized as being the same on Windows. Rather than trying
to ensure all code deals with / and \ correctly, paths now
get transformed to / on input, fixing all current and
future such bugs.

Tested: on OS X.

7 years agoFix for invalid null returns (#4318)
Kamil Rojewski [Thu, 18 May 2017 17:30:30 +0000 (19:30 +0200)]
Fix for invalid null returns (#4318)

* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

7 years agoadded check for presence of required fields. (flatc) c++ (#4316)
sfariv [Thu, 18 May 2017 16:32:04 +0000 (09:32 -0700)]
added check for presence of required fields. (flatc) c++ (#4316)

* added check for presence of required fields.

* updates to resolve Travis CI build error.

* fixes for resolving appveyor build errors.

* fixes for resolving appveyor build errors.

* fixes for resolving appveyor build errors.

* updates per aardappel's comments.

* updated a variable's name.

* updates per aardappel's comments.

7 years agoC#: Added <autogenerated> in cs generator file header comment (#4291)
schoetbi [Tue, 16 May 2017 21:28:34 +0000 (23:28 +0200)]
C#: Added <autogenerated> in cs generator file header comment (#4291)

* Added <autogenerated> in cs generator file header comment
#4287

* CS: Added xml-correct file header comment including "<auto-generated>...</auto-generated>"
code_generators.cpp: FlatBuffersGeneratedWarning() function replaced by compile time constant "GeneratedWarning"
 also removed extra newlines at end of GeneratedWarning to be able to generate a xml well formed file comment for cs files
#4291

* code_generators: Changed static string GeneratedWarning back to function FlatBuffersGeneratedWarning()
#4291

* Added modified Unit-Test files
#4291

* idl_gen_general: Add autogenerated only in C# code
#4291

7 years agoMade root test path configurable.
Wouter van Oortmerssen [Mon, 15 May 2017 23:57:39 +0000 (16:57 -0700)]
Made root test path configurable.

Change-Id: I9629a7648f0c3346c4724ca8938fed47d7828018
Tested: on Linux.

7 years agoUpdated tutorial with a vector of structs example.
Wouter van Oortmerssen [Mon, 15 May 2017 20:40:19 +0000 (13:40 -0700)]
Updated tutorial with a vector of structs example.

Since it wasn't documented and very different from a vector of
tables, this has caused a lot of confusion in the past.

Change-Id: Iab47c61b55c19abe5c4f25c86d71335a6b6321ca

7 years agoMade codegen always output a file, even on an empty schema.
Wouter van Oortmerssen [Fri, 12 May 2017 22:58:26 +0000 (15:58 -0700)]
Made codegen always output a file, even on an empty schema.

Previously, we had a check to simply skip such files, but this
tends to make build systems unhappy.

This only affects C++ and JS, since other language output per-class
files.

Change-Id: I54224642725bbafb9f6e1654ed3693e62ca9f7d7
Tested: on Linux.

7 years ago[C++] Fix code gen indentation when empty Print (#4313)
Lawrence Chan [Fri, 12 May 2017 21:36:35 +0000 (16:36 -0500)]
[C++] Fix code gen indentation when empty Print (#4313)

* Fix C++ code gen indentation when empty Print

* Also commit modified tests/monster_test.bfbs

7 years agoAdding support for s390x (#4297)
akamat-ibm [Fri, 12 May 2017 17:12:19 +0000 (22:42 +0530)]
Adding support for s390x (#4297)

* changes to support s390x

* added flag for s390x

* Adding support for Linux s390x

7 years agoC++/Go: Update gRPC related code to work with gRPC 1.3+ (#4305)
Per Grön [Fri, 12 May 2017 16:48:17 +0000 (18:48 +0200)]
C++/Go: Update gRPC related code to work with gRPC 1.3+ (#4305)

* Don't fail the build on unused parameters

gRPC headers have unused parameters so this breaks the test build.

* Pull in updated compiler files from gRPC

There have been some API breaks in gRPC lately. This commit
pulls in the most recent version of the files in this repo
that are just copied from gRPC.

* Modify the gRPC files so that they can work with Flatbuffers

The files taken from gRPC do not work out-of-the-box with Flatbuffers.
This commit modifies them so that they work. Hopefully this commit
will be able to serve as a guide or maybe even be cherry-picked on
top of new versions of those files as newer versions from gRPC are
pulled in.

* Adjust the rest of Flatbuffers to work with the new gRPC

* Change idl_gen_grpc.cpp to work with the new API
* Add missing #include in flatbuffers/grpc.h
* Run tests/generate_code.sh and check in the results
* Don't link with grpc++_unsecure and (secure) grpc. That's just weird

* Revert unrelated JS/TS test changes

* Simplify compiler/config.h

There is no need to import this file from gRPC. In fact, it probably
makes sense to not do so, since it seems to be intended to have
project specific configuration in it.

* Don't emit C++ types in the Go gRPC code generator

* Don't emit C++ #includes in generated gRPC code

Before this PR, there was a Go-specific additional_includes method
in schema_interface.h, which is shared with the gRPC repo. The
additional parameter to FlatBufFile in idl_gen_grpc.cpp makes that
unnecessary, which means we need less Flatbuffer-specific changes
in gRPC.

7 years agoReverting part of PR #4286
Wouter van Oortmerssen [Thu, 11 May 2017 01:04:53 +0000 (18:04 -0700)]
Reverting part of PR #4286

This is because it trips up the Closure compiler with errors like:

ERROR - assignment to property bb of SomeTable
found : undefined
required: (flatbuffers.ByteBuffer|null)
this.bb = undefined;
^^^^^^^^^^^^^^^^^^^

Change-Id: Iaf032b5249ec655e151331e81532e549c12bcd78

7 years agoRemoved unnecessary check for Offset in AssertScalarT()
Wouter van Oortmerssen [Thu, 11 May 2017 01:00:27 +0000 (18:00 -0700)]
Removed unnecessary check for Offset in AssertScalarT()

This will avoid it accidentally accepting structs of size 4.

Change-Id: I251285ae1e4bffb859367dcf89562741a3980bba
Tested: on Linux.

7 years agoAdded error message for union values out of range.
Wouter van Oortmerssen [Thu, 11 May 2017 00:21:47 +0000 (17:21 -0700)]
Added error message for union values out of range.

Change-Id: I481afcde6a554d1cad519ff95acac7f38a7f4ee5
Tested: on Linux.

7 years agocleaning up JavaTest.sh - quote paths, and less error-prone deletion (#4301)
Travis Wellman [Wed, 10 May 2017 23:45:08 +0000 (16:45 -0700)]
cleaning up JavaTest.sh - quote paths, and less error-prone deletion (#4301)

7 years agoEnsured flatc.exe is statically linked on Windows
Wouter van Oortmerssen [Wed, 10 May 2017 22:42:23 +0000 (15:42 -0700)]
Ensured flatc.exe is statically linked on Windows

7 years agoClarified the semantics of the Offset type.
Wouter van Oortmerssen [Wed, 10 May 2017 21:55:11 +0000 (14:55 -0700)]
Clarified the semantics of the Offset type.

Change-Id: Iccc36d24321ac4d556692ac715c0cc69a2c9e09e
Tested: on Linux.

7 years agoAdded missing js/ts generated code.
Wouter van Oortmerssen [Wed, 10 May 2017 20:25:51 +0000 (13:25 -0700)]
Added missing js/ts generated code.

Change-Id: I146e9e1b8f997c11d1675dbef1b958ddbd181092

7 years agoAdded --keep-prefix to not strip schema include path in C++ includes.
Wouter van Oortmerssen [Wed, 10 May 2017 20:21:20 +0000 (13:21 -0700)]
Added --keep-prefix to not strip schema include path in C++ includes.

Change-Id: I3c6356fc6664072796f273096df64829108b4a34
Tested: on Linux.

7 years agoAdded more test scripts: Mono on Linux, and one for all.
Wouter van Oortmerssen [Wed, 10 May 2017 19:54:22 +0000 (12:54 -0700)]
Added more test scripts: Mono on Linux, and one for all.

Change-Id: Ia107557225db27b396f0d666c5c5b1b324ea22fa
Tested: on Linux.

7 years agoFixed LookupByKey for Java & C#
Wouter van Oortmerssen [Tue, 9 May 2017 01:24:47 +0000 (18:24 -0700)]
Fixed LookupByKey for Java & C#

Change-Id: I05c02223675dee241d1ae8cb466e5186444058c8
Tested: on Linux.

7 years ago[C++] Add grpc/streaming test and fix Deserialize (#4296)
水樹素子 [Mon, 8 May 2017 20:49:34 +0000 (05:49 +0900)]
[C++] Add grpc/streaming test and fix Deserialize (#4296)

* [C++] Add delete msg->buf

* [C++] Add grpc streaming test

* Use free instead of delete

* Refactoring grpctest

7 years agoTweak fallthrough comments to get recognized by gcc7 (#4298)
Heiko Becker [Mon, 8 May 2017 20:35:55 +0000 (22:35 +0200)]
Tweak fallthrough comments to get recognized by gcc7 (#4298)

GCC gained a new warning, -Wimplicit-fallthrough, which warns about
implicitly falling through a case statement. The regular expressions
used at the default level (-Wimplicit-fallthrough=3) don't match with
a colon at the end. The comment also needs to be followed (after
optional whitespace and other comments) by a 'case' or 'default'
keyword, i.e. it will not be recognized with a '}' between the comment
and the keyword.

7 years ago[C++] Add grpc_slice_unref(slice) (#4294)
moti [Thu, 4 May 2017 22:44:31 +0000 (07:44 +0900)]
[C++] Add grpc_slice_unref(slice) (#4294)

7 years agoGenerating the most strict TS code possible (#4286)
Kamil Rojewski [Mon, 1 May 2017 23:05:53 +0000 (01:05 +0200)]
Generating the most strict TS code possible (#4286)

* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

7 years agoMade the verifier catch zero-offsets.
Wouter van Oortmerssen [Wed, 26 Apr 2017 21:26:18 +0000 (14:26 -0700)]
Made the verifier catch zero-offsets.

Zero offsets are non-sensical in FlatBuffers (since offsets are
relative to themselves) but were allowed by the verifier. This could
cause buffers made up of all zeroes to be interpreted as correct
buffers with an empty root object.

Generally, not allowing such offsets will make the verifier more
likely to catch problems earlier.

Change-Id: I54010bea29721b326ff8e5348fcd9fe78e5e7506
Tested: on Linux.

7 years agoFixes for VS 2015 build.
Wouter van Oortmerssen [Mon, 24 Apr 2017 17:29:25 +0000 (10:29 -0700)]
Fixes for VS 2015 build.

Change-Id: I23280e611163a89b8eba7b9b0016c297fea2396e

7 years agoAdded VS 2015 test to AppVeyor CI.
Wouter van Oortmerssen [Mon, 24 Apr 2017 17:04:34 +0000 (10:04 -0700)]
Added VS 2015 test to AppVeyor CI.

Change-Id: I354c13fbe6f159058fbeff47100ef357e99c6cd5

7 years agoFix Android STLPort build.
Wouter van Oortmerssen [Fri, 21 Apr 2017 17:49:07 +0000 (10:49 -0700)]
Fix Android STLPort build.

Change-Id: Iceca7b8b455c8463d9b82b928332a875dee3d19e

7 years agoTS tests fixes (#4265)
Kamil Rojewski [Fri, 21 Apr 2017 16:29:42 +0000 (18:29 +0200)]
TS tests fixes (#4265)

* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

7 years agoFix FlexBuffers writing incomplete length for 64-bit vectors.
Wouter van Oortmerssen [Thu, 20 Apr 2017 00:41:53 +0000 (17:41 -0700)]
Fix FlexBuffers writing incomplete length for 64-bit vectors.

7 years agoAdded a clear function for purging all data that is holded by the FlatBuffer. (#4259)
Carlos Sanchez [Thu, 20 Apr 2017 00:06:33 +0000 (02:06 +0200)]
Added a clear function for purging all data that is holded by the FlatBuffer. (#4259)

7 years agoSpecify `std' namespace for remove function (#4268)
Dmitry Ermolov [Wed, 19 Apr 2017 23:55:41 +0000 (02:55 +0300)]
Specify `std' namespace for remove function (#4268)

7 years agoFixed CreateVectorOfStructs for native_type (2nd try) (#4276)
Christian Helmich [Wed, 19 Apr 2017 17:14:31 +0000 (02:14 +0900)]
Fixed CreateVectorOfStructs for native_type (2nd try) (#4276)

* Added support for serializing native_type with CreateVectorOfNativeStructs

* Added support for serializing native_type with CreateVectorOfSortedNativeStructs

* Added C++ code generation for vectors of native_types

7 years agoFix minor const correctness issue (#4271)
Per Eckerdal [Wed, 19 Apr 2017 15:56:55 +0000 (17:56 +0200)]
Fix minor const correctness issue (#4271)

7 years agoVS fix for ambiguous union assignment operator.
Wouter van Oortmerssen [Tue, 18 Apr 2017 01:00:41 +0000 (18:00 -0700)]
VS fix for ambiguous union assignment operator.

Change-Id: I1c37db1ced462fd558d3e893a501341f3eca6379

7 years agoFixed hashed values in JSON for signed ints.
Wouter van Oortmerssen [Tue, 18 Apr 2017 00:40:02 +0000 (17:40 -0700)]
Fixed hashed values in JSON for signed ints.

Change-Id: Iae389c6dc9776058b39f4017d30efbf9580aced1
Tested: on Linux.

7 years agoUndo PR: make flatbuffers.js into a UMD module (#4228)
Wouter van Oortmerssen [Tue, 18 Apr 2017 00:31:03 +0000 (17:31 -0700)]
Undo PR: make flatbuffers.js into a UMD module (#4228)

This PR did not work in all JS environments and caused
downstream breakage.

Change-Id: Ib565129e26622d02bad2d45816bd05f6b961b994

7 years agoImproved union copy constructor.
Wouter van Oortmerssen [Tue, 18 Apr 2017 00:27:20 +0000 (17:27 -0700)]
Improved union copy constructor.

It now at least works in simple cases.

Change-Id: I3af0738e676e62166b69accaa6bd19f531fbe5ee
Tested: on Linux.

7 years agoFixed clang needing union copy constructor.
Wouter van Oortmerssen [Mon, 17 Apr 2017 20:45:50 +0000 (13:45 -0700)]
Fixed clang needing union copy constructor.

Move constructors are present, which it should use instead.

This is a temp fix to make it compile, but eventually we should
generate a proper copy constructor just in-case people want to
copy objects with unions.

Tested on: Linux, OS X.

Change-Id: Idf85419995c96f5959061882157541573e306083

7 years ago[C++] fix bounds checking on integer parsing (#4250)
Jason Stubbs [Mon, 17 Apr 2017 18:19:43 +0000 (04:19 +1000)]
[C++] fix bounds checking on integer parsing (#4250)

* fix bounds checking on integer parsing

the previous code was allowing 255 for int8_t, similar for int16_t
and int32_t, and even negative values for unsignd types.

this patch fixes bounds checking for 8-bit, 16-bit and 32-bit types.
testing for both acceptable values and unacceptable values at the
boundaries are also improved.

bounds checking on 64-bit types isn't addressed by this patch.

* fix 'unary minus operator applied to unsigned type, result still unsigned'

* fix & placement

7 years agoVS warning fixes.
Wouter van Oortmerssen [Thu, 13 Apr 2017 00:56:19 +0000 (17:56 -0700)]
VS warning fixes.

Change-Id: I19662241d56560c064cff73dbebfb2a81d226934

7 years agoAdded support for structs and strings in unions.
Wouter van Oortmerssen [Mon, 10 Apr 2017 22:56:51 +0000 (15:56 -0700)]
Added support for structs and strings in unions.

(C++ only for now).
Also fixed vector of union support in the object API.

Bug: 36902939
Change-Id: I935f4cc2c303a4728e26c7916a8ec0adcd6f84cb
Tested: on Linux.

7 years agoC++ fixed compile error C2678 with msvc when using std::find_if on vectors (#4262)
schoetbi [Wed, 12 Apr 2017 23:37:22 +0000 (01:37 +0200)]
C++ fixed compile error C2678 with msvc when using std::find_if on vectors (#4262)

In Debug mode it is checked that iterator begin is less than end
therefore the operator< in class VectorIterator is needed

7 years agoFix Visual Studio 2017 new warning (C4244: 'argument': conversion fro… (#4261)
chronoxor [Wed, 12 Apr 2017 20:13:10 +0000 (23:13 +0300)]
Fix Visual Studio 2017 new warning (C4244: 'argument': conversion fro… (#4261)

* Fix Visual Studio 2017 new warning (C4244: 'argument': conversion from 'int' to 'const char', possible loss of data)

* Fix Visual Studio 2017 pedantic warnings

* Fix Visual Studio 2017 pedantic warnings

7 years agoTypeScript support (#4232)
Kamil Rojewski [Mon, 10 Apr 2017 17:01:13 +0000 (19:01 +0200)]
TypeScript support (#4232)

* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

7 years agomake flatbuffers.js into a UMD module (#4228)
Iain van der Bloat [Sat, 8 Apr 2017 00:14:01 +0000 (09:14 +0900)]
make flatbuffers.js into a UMD module (#4228)

7 years ago[C++]Use noexcept in union type move ctor/Add move assingment (#4249)
moti [Thu, 30 Mar 2017 01:00:20 +0000 (10:00 +0900)]
[C++]Use noexcept in union type move ctor/Add move assingment (#4249)

* Use noexcept in union type move ctor/Add move assingment

* Add NOEXCEPT macro to deal with _MS_VER/Remove delegating ctor in union type class

* Add FLATBUFFERS_NOEXCEPT to generated union class

7 years agoSuppress warning in Flatbuffer VS2010 builds.
Wouter van Oortmerssen [Wed, 29 Mar 2017 19:01:11 +0000 (12:01 -0700)]
Suppress warning in Flatbuffer VS2010 builds.

Change-Id: I4f66a96ba581704c1a384cc700b8fb731d3eeed4

7 years agoUpdate StackOverflow links to have relevant queries.
Wouter van Oortmerssen [Wed, 29 Mar 2017 18:58:42 +0000 (11:58 -0700)]
Update StackOverflow links to have relevant queries.

Change-Id: I59159fb7205e4802f041b749d502a8f305d4176c

7 years agoUpdated .gitignore for C#
Wouter van Oortmerssen [Wed, 29 Mar 2017 18:55:20 +0000 (11:55 -0700)]
Updated .gitignore for C#

Change-Id: I6c253b0ded187a4945f5e862aae721cf4fda6398

7 years agoFix flatc code gen.
Wouter van Oortmerssen [Wed, 29 Mar 2017 18:51:20 +0000 (11:51 -0700)]
Fix flatc code gen.

Mutable functions should return a non-const reference to the member variable.

Change-Id: I833077d2c9a38a5d71868e43aca6b250d79b6625

7 years agoAdded missing generated code for C#
Wouter van Oortmerssen [Wed, 29 Mar 2017 18:51:02 +0000 (11:51 -0700)]
Added missing generated code for C#

Change-Id: I1affced255eb96977119d8480793b5bba42f065f

7 years agoC#: Fixed possible conflicts between usings and user-supplied namespace (#4247)
Spencer Bench [Wed, 29 Mar 2017 18:09:25 +0000 (12:09 -0600)]
C#: Fixed possible conflicts between usings and user-supplied namespace (#4247)

* C#: Fixed possible conflicts between usings and user-supplied namespace

C#: Added the global qualifier to using directives to prevent possible conflicts with the user-supplied namespace. Also prevents unintentional type hiding. Resolves issue #4242.

* Updated C# generated code files

7 years agoSupport binary search for struct in cpp (#4245)
tianyapiaozi [Wed, 29 Mar 2017 16:51:12 +0000 (00:51 +0800)]
Support binary search for struct in cpp (#4245)

* Support binary search for struct in cpp

CreateVectorOfSortedStruct is provided for convenience.

* fix continuous-integration error

* add generated files

* compile Ability.cs in csharp test

* compile Ability.cs in csharp

* modify according to code review

7 years agoAdd a VectorCast function that safely casts from
Wouter van Oortmerssen [Tue, 28 Mar 2017 00:46:34 +0000 (17:46 -0700)]
Add a VectorCast function that safely casts from
Vector<Offset<T>> to Vector<Offset<U>> if U is a base
class of T.

This is useful for when you want to generically
iterate over a vector of objects that derive from
flatbuffers::Table.

Change-Id: I59161e3b9f40501f72e02b46509be9dc8ab86c6b

7 years agoFixing closure compile compatibility when --gen-mutable is used.
Wouter van Oortmerssen [Tue, 28 Mar 2017 00:44:33 +0000 (17:44 -0700)]
Fixing closure compile compatibility when --gen-mutable is used.

Change-Id: I8bf575ba6dc795d2d2eec02fa8977dcc2594eaa6

7 years agoFixed building and warnings on Arduino (16 bit platform). (#4197)
Jesper Stemann Andersen [Mon, 27 Mar 2017 16:38:04 +0000 (18:38 +0200)]
Fixed building and warnings on Arduino (16 bit platform). (#4197)

Building on Arduino fixed by conditional includes of cstdint and utility. In the Standard C++ for Arduino (port of uClibc++):
* cstdint is not present.
* utility is named utility.h.

Replaced size_t with uoffset_t for Verifier::max_tables_, max_depth_, depth_, and num_tables_ to ensure 32-bit values are used (and not 16-bit) - gave rise to a warning.

7 years agoC++: Add default value handling to mutation/SetField code (#4230)
Lawrence Chan [Tue, 21 Mar 2017 00:36:27 +0000 (19:36 -0500)]
C++: Add default value handling to mutation/SetField code (#4230)

* Add default value handling to mutation/SetField code

* Shorten reflection SetField impl

* Modify impl to work with C++03

* Add more mutation tests

* Fail SetField if non-scalar

* Add IsScalar/IsInteger/IsFloat for reflection::BaseType

* Use new IsScalar/IsInteger/IsFloat in reflection SetField

* Assume scalar is either int or float

7 years agoadd command line argument for go namespace (#4222)
Flier Lu [Mon, 20 Mar 2017 23:08:35 +0000 (07:08 +0800)]
add command line argument for go namespace (#4222)

7 years agoAdd arbitrary string type to the native object API (#4218)
Alexander Gallego [Mon, 20 Mar 2017 23:02:04 +0000 (19:02 -0400)]
Add arbitrary string type to the native object API (#4218)

* Custom strings are very common for optimizations around small objects
  or growth style optimizations, i.e.: grow at 1.57 times vs doubling vs..

  A second common strategy is to cooperate w/ the memory allocator
  see FBString[1] and seastar[2] string for examples.

[1] fbstring: https://github.com/facebook/folly/blob/master/folly/docs/FBString.md
[2] sstring: https://github.com/scylladb/seastar/blob/master/core/sstring.hh

7 years agoC++: add String::str() function (#4234)
Jun Hyeon, Nam [Sat, 18 Mar 2017 17:09:56 +0000 (02:09 +0900)]
C++: add String::str() function (#4234)

for convenience

7 years agofixed duplicate symbol error in flexbuffers.h (#4233)
Jun Hyeon, Nam [Sat, 18 Mar 2017 17:08:39 +0000 (02:08 +0900)]
fixed duplicate symbol error in flexbuffers.h (#4233)

1. modified the function that omitted inline.
2. changed the static global functions to inline functions.

7 years agoGO: add _ postfix to identiy conflict golang keyword (#4221)
Flier Lu [Thu, 16 Mar 2017 01:34:53 +0000 (09:34 +0800)]
GO: add _ postfix to identiy conflict golang keyword (#4221)

* add _ postfix to identiy conflict golang keyword

* make VS2010 happy

7 years agofixed flag for javascript (#4223)
Aaron Hudon [Wed, 15 Mar 2017 22:16:43 +0000 (15:16 -0700)]
fixed flag for javascript (#4223)

--javascript flag does not work in the 1.6 flatc.exe, changed to --js

7 years agotests: update monster_test.bfbs binary file with generate_code.sh (#4220)
Koichi Shiraishi [Wed, 15 Mar 2017 21:53:37 +0000 (06:53 +0900)]
tests: update monster_test.bfbs binary file with generate_code.sh (#4220)

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
7 years agosample: update auto-generated monster_generated.h (#4219)
Koichi Shiraishi [Wed, 15 Mar 2017 21:52:47 +0000 (06:52 +0900)]
sample: update auto-generated monster_generated.h (#4219)

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
7 years agoPrevent flatbuffers::Vector and flatbuffers::VectorOfAny to be copied (#4217)
Alexander Theißen [Mon, 13 Mar 2017 15:53:30 +0000 (16:53 +0100)]
Prevent flatbuffers::Vector and flatbuffers::VectorOfAny to be copied (#4217)

7 years agoPedantic Visual Studio build (/W4 /WX) (#4214)
chronoxor [Fri, 10 Mar 2017 18:27:30 +0000 (21:27 +0300)]
Pedantic Visual Studio build (/W4 /WX) (#4214)

* Pedantic Visual Studio build (/W4 /WX)

* Pedantic Visual Studio build (/W4 /WX)

* Pedantic Visual Studio build (/W4 /WX)

* Remove /wd4512 from CMakeLists.txt

* Suppress Visual Studio 4512 warning ('class' : assignment operator could not be generated)

7 years agoNoError was returning on DoParse method when file was empty (#4208)
Louis-Paul CORDIER [Fri, 10 Mar 2017 16:50:44 +0000 (17:50 +0100)]
NoError was returning on DoParse method when file was empty (#4208)

* NoError was returning on DoParse method when file was empty.

* change NoError message in DoParse.

7 years agoVS2015 warning "conditional expression is constant" (#4210)
chronoxor [Wed, 8 Mar 2017 21:34:38 +0000 (00:34 +0300)]
VS2015 warning "conditional expression is constant" (#4210)

* VS2015 warning "conditional expression is constant"

* VS2015 warning "conditional expression is constant"