platform/upstream/flatbuffers.git
8 years agoMerge pull request #778 from armen/master
Wouter van Oortmerssen [Mon, 7 Dec 2015 18:27:27 +0000 (10:27 -0800)]
Merge pull request #778 from armen/master

Correct the max/min signed/unsigned 32-bit int

8 years agoFixed language for generators not being set correctly.
Wouter van Oortmerssen [Mon, 7 Dec 2015 17:53:04 +0000 (09:53 -0800)]
Fixed language for generators not being set correctly.

Change-Id: I36c1f05efa836b32635e3274ac0ba976a8961bdd
Tested: on Linux.

8 years agoOptimize get* operation
Armen Baghumian [Fri, 4 Dec 2015 06:10:11 +0000 (06:10 +0000)]
Optimize get* operation

It's slightly faster to convert the value to signed value in PHP as
opposed to use pack and unpack.

For 1M get operation the difference is:

    getShort in 3.3272678852081 seconds
    getInt in 3.8338589668274 seconds
    getLong in 5.6381590366364 seconds
    getLong (neg) in 5.6149101257324 seconds

vs

    getShort in 2.7564418315887 seconds
    getInt in 3.1612701416016 seconds
    getLong in 3.1369340419769 seconds
    getLong (neg) in 3.1478710174561 seconds

And since pack("P") and unpack("q") has been removed now ByteBuffer
works for PHP >= 5.4

8 years agoCorrect the max/min signed/unsigned 32-bit int
Armen Baghumian [Fri, 4 Dec 2015 03:05:42 +0000 (03:05 +0000)]
Correct the max/min signed/unsigned 32-bit int

The test was trying to pack an unsigned int which couldn't fit as a
signed int and putInt() wasn't doing the validation in the correct range

8 years agoDo not create empty enums.
Jason Sanmiya [Fri, 4 Dec 2015 15:09:16 +0000 (07:09 -0800)]
Do not create empty enums.

Mac build issued a warning for enum{}.

Change-Id: I9cab958538ac3cec61aeae289d1da0118ecac15f
Tested: Mac build no longer issues warnings.

8 years agoAdded --gen-all to generate code for a schema and all its includes.
Wouter van Oortmerssen [Tue, 1 Dec 2015 01:42:19 +0000 (17:42 -0800)]
Added --gen-all to generate code for a schema and all its includes.

Also refactored the way options are stored.

Change-Id: I709ac908cd2aba396c9c282725cf1d42ccce0882
Tested: on Linux.

8 years agoFixed implicit dereference in flatc.
Wouter van Oortmerssen [Tue, 1 Dec 2015 01:49:51 +0000 (17:49 -0800)]
Fixed implicit dereference in flatc.

Change-Id: If2e62a325b47399561b4c20d2def55ede4831d19
Tested: on Linux.

8 years agoLink clang builds against libc++abi on Linux
Perry Hung [Tue, 1 Dec 2015 00:41:54 +0000 (19:41 -0500)]
Link clang builds against libc++abi on Linux

Simply running clang with -stdlib=libc++ requires a manual link against
libc++abi on Linux. This is documented in the libc++ documentation:
    http://libcxx.llvm.org/

Tested on Arch Linux, using clang 3.7.0 RELEASE.

Signed-off-by: Perry Hung <iperry@gmail.com>
8 years agoMultiple schemas parsed by flatc are now parsed independently.
Wouter van Oortmerssen [Tue, 1 Dec 2015 00:42:48 +0000 (16:42 -0800)]
Multiple schemas parsed by flatc are now parsed independently.

It used to be such that later schemas could depend on earlier
schemas. This was a convenience from days before include files
were implemented. Nowadays they cause subtle bugs rather than being
useful, so this functionality has been removed.

You now need to explicitly include files you depend upon.

Change-Id: Id8292c3c621fc38fbd796da2d2cbdd63efc230d1
Tested: on Linux.

8 years agoC++ generated code now has constants for vtable offsets.
Wouter van Oortmerssen [Mon, 30 Nov 2015 22:27:47 +0000 (14:27 -0800)]
C++ generated code now has constants for vtable offsets.

Besides making the generated code looking a lot more readable,
it also allows you to use these offsets in calls to
Table::CheckField, to see if a field is present in a table.

Change-Id: I1b4cc350c4f27c4e474c31add40c701ef4ae63b2
Tested: On Linux.

8 years agoMade C++ generated code use "bool" instead of uint8_t wire type.
Wouter van Oortmerssen [Mon, 30 Nov 2015 21:54:24 +0000 (13:54 -0800)]
Made C++ generated code use "bool" instead of uint8_t wire type.

Change-Id: I5756d15a758429ca67456264842017063d1f755e
Tested: on Linux.

8 years agoAllow vectors to be aligned beyond their natural type.
Wouter van Oortmerssen [Mon, 30 Nov 2015 19:50:09 +0000 (11:50 -0800)]
Allow vectors to be aligned beyond their natural type.

Change-Id: I09ade6b688a6b97d65fd832558917225d86c9118

8 years agoJava builder now checks if buffer was finished upon access.
Wouter van Oortmerssen [Mon, 30 Nov 2015 19:25:21 +0000 (11:25 -0800)]
Java builder now checks if buffer was finished upon access.

Also checks for nesting of objects in vector construction.

This avoids common errors in FlatBuffer construction.

Change-Id: I5507c5d767684e20e94883a92448f05acefba4d6
Tested: on Linux.

8 years agoFix use of std::max when Windows.h is imported.
Chris [Fri, 27 Nov 2015 20:06:41 +0000 (20:06 +0000)]
Fix use of std::max when Windows.h is imported.

8 years agoReturn the full string when requested from a flatbuffers::String, even if it contains...
Chris [Fri, 27 Nov 2015 20:05:48 +0000 (20:05 +0000)]
Return the full string when requested from a flatbuffers::String, even if it contains a NULL byte.

8 years agoAdded long form options for all generators (--cpp etc.)
Wouter van Oortmerssen [Thu, 26 Nov 2015 01:26:34 +0000 (17:26 -0800)]
Added long form options for all generators (--cpp etc.)

Short-form versions are still supported, but are deprecated.

Change-Id: I15f70ca8d69ba5790368205caa9603b65e1b7fff
Tested: on Linux.

8 years agoMade generated C++ code respect gcc -Werror=shadow.
Wouter van Oortmerssen [Thu, 26 Nov 2015 00:48:28 +0000 (16:48 -0800)]
Made generated C++ code respect gcc -Werror=shadow.

Change-Id: I17de0bcc462770124227a9967e2aab620467f6eb
Tested: on Linux.

8 years agoFixed crash related to flatc parsing duplicate input files.
Wouter van Oortmerssen [Wed, 25 Nov 2015 23:50:30 +0000 (15:50 -0800)]
Fixed crash related to flatc parsing duplicate input files.

Thanks @Chaosvex for reporting.

Change-Id: I73f60ab0bf875a3e0849eaec5f42f6d036881094
Tested: on Linux.

8 years agoMerge pull request #353 from takaken1994/master
Wouter van Oortmerssen [Wed, 25 Nov 2015 21:40:00 +0000 (13:40 -0800)]
Merge pull request #353 from takaken1994/master

C++: Fixed generated header file cannot be compiled when the type of key is enum class

8 years agoMerge pull request #349 from belldon/enum-fix
Wouter van Oortmerssen [Wed, 25 Nov 2015 21:14:28 +0000 (13:14 -0800)]
Merge pull request #349 from belldon/enum-fix

Fixes issue #348: C# vector of enums doesn't compile

8 years agoFix C# vector of enum code generation
Donnell [Sat, 14 Nov 2015 04:39:46 +0000 (23:39 -0500)]
Fix C# vector of enum code generation

Fixes a bug where the logic to determine when to use a C# enum flags
both enums and vectors of enums.  This causes the C# generator to
generate code that doesn't compile for tables that contain vectors of
enums.

The fix also consolidates type generation functions a bit and adds
some additional casting functions for clarity.

8 years agoMerge pull request #362 from chobie/fix-projectfile
Wouter van Oortmerssen [Fri, 20 Nov 2015 21:43:57 +0000 (13:43 -0800)]
Merge pull request #362 from chobie/fix-projectfile

Fix projectfile (VisualStudio, XCode) for development

8 years agoalso, fix xcode project
Shuhei Tanuma [Fri, 20 Nov 2015 20:38:57 +0000 (05:38 +0900)]
also, fix xcode project

8 years agoAdd missing idl_gen_php.cpp to VisualStudio project
Shuhei Tanuma [Fri, 20 Nov 2015 20:33:30 +0000 (05:33 +0900)]
Add missing idl_gen_php.cpp to VisualStudio project

8 years agoMerge remote-tracking branch internal into fb_upstream
Stewart Miles [Thu, 19 Nov 2015 11:07:49 +0000 (03:07 -0800)]
Merge remote-tracking branch internal into fb_upstream

8 years agoFixed typo in cmake build rule for Linux.
Stewart Miles [Thu, 19 Nov 2015 11:02:58 +0000 (03:02 -0800)]
Fixed typo in cmake build rule for Linux.

Tested:
Verified it's possible to build generated headers on Linux for Android.

Change-Id: I82249a252cb851b978a177f4a4b92b527cc2bfd9

8 years agoWorkaround broken gnumake realpath on Windows.
Stewart Miles [Thu, 19 Nov 2015 05:02:13 +0000 (21:02 -0800)]
Workaround broken gnumake realpath on Windows.

Also, added missing build scripts for flatc on Windows and fixed
numerous issues in the flatbuffers/android/jni/include.mk makefile.

Tested:
Verified dependent project (motive) can generate flatbuffers headers
with these changes on Android.

Bug: 25780616

Change-Id: I73f0dec8f7a6a7eb4e71951a8f1cd3e0d343a9ff

8 years agoMerge pull request #359 from proppy/move-build-fb
Wouter van Oortmerssen [Wed, 18 Nov 2015 18:10:07 +0000 (10:10 -0800)]
Merge pull request #359 from proppy/move-build-fb

flatbuffers/cmake: move build_flatbuffers to a standalone file

8 years agoMerge pull request #308 from chobie/php
Wouter van Oortmerssen [Wed, 18 Nov 2015 17:31:17 +0000 (09:31 -0800)]
Merge pull request #308 from chobie/php

Add support for PHP code.

8 years agoMerge pull request #312 from chobie/unity-fix
Wouter van Oortmerssen [Wed, 18 Nov 2015 17:28:00 +0000 (09:28 -0800)]
Merge pull request #312 from chobie/unity-fix

C# Unity (.NET 3.5) can't cast enum default value.

8 years agoflatbuffers/cmake: move build_flatbuffers to a standalone file
Johan Euphrosine [Tue, 17 Nov 2015 21:39:37 +0000 (13:39 -0800)]
flatbuffers/cmake: move build_flatbuffers to a standalone file

So that it could be included from both flatbuffers CMakeLists.txt and
FindFlatBuffers.cmake.

Change-Id: Ie16a879beef9367cd6fd9b2d2157044841a7cdbc

8 years ago(PHP) add experimental support for PHP language.
Shuhei Taunma [Thu, 5 Nov 2015 07:19:28 +0000 (16:19 +0900)]
(PHP) add experimental support for PHP language.

* codegen for all basic features: WIP (probably implemented all basic feature)
* JSON parsing: NO
* Simple mutation: NO
* Reflection: NO
* Buffer verifier: NO (will be add later)
* Testing: basic: Yes
* Testing: fuzz: Yes
* Performance: Not bad
* Platform: Supported Linux, OS X, Windows (has 32bit integer limitation)
* Engine Unity: No

flatc --php monster_test.fbs

  <?php
  //include neccessary files.
  $fbb = new Google\FlatBuffers\FlatBufferBuilder(1);
  $str = $fbb->createString("monster");
  \MyGame\Example\Monster::startMonster($fbb);
  \MyGame\Example\Monster::addHp($fbb, 80);
  \MyGame\Example\Monster::addName($fbb, $str);
  $mon = \MyGame\Example\Monster::endMonster($fbb);
  $fbb->finish($mon);
  echo $fbb->sizedByteArray();

PHP 5.4 higher

Currently, we do not register this library to packagist as still experimental and versioning problem.
If you intended to use flatbuffers with composer. add repostiories section to composer.json like below.

  "repositories": [{
    "type": "vcs",
    "url": "https://github.com/google/flatbuffers"
  }],

 and just put google/flatbuffers.

  "require": {
    "google/flatbuffers": "*"
  }

* PHP's integer is platform dependant. we strongly recommend use 64bit machine
  and don't use uint, ulong types as prevent overflow issue.
  ref: http://php.net/manual/en/language.types.integer.php

* php don't support float type. floating point numbers are always parsed as double precision internally.
  ref: http://php.net/manual/en/language.types.float.php

* ByteBuffer is little bit slow implemnentation due to many chr/ord function calls. Especially encoding objects.
  This is expected performance as PHP5 has parsing arguments overhead. probably we'll add C-extension.

Basically, PHP implementation respects Java and C# implementation.

Note: ByteBuffer and FlatBuffersBuilder class are not intended to use other purposes.
      we may change internal API foreseeable future.

PSR-2, PSR-4 standards.

Implemented simple assertion class (respect JavaScript testcase implementation) as we prefer small code base.
this also keeps CI iteration speed.

we'll choose phpunit or something when the test cases grown.

8 years agoC# Unity can't cast integer represented enum value.
Shuhei Tanuma [Thu, 5 Nov 2015 22:47:39 +0000 (07:47 +0900)]
C# Unity can't cast integer represented enum value.

```
namespace MyGame;

enum CommandType : byte {
None = 0,
}

table Command {
id:int;
type:CommandType;
}
```

then generate c# files. it'll output compile error like these.

```
Assets/MyGame/Command.cs(18,39): error CS1041: Identifier expected
Assets/MyGame/Command.cs(18,39): error CS1737: Optional parameter cannot precede required parameters

16:   public static Offset<Command> CreateCommand(FlatBufferBuilder builder,
17:   int id = 0,
18:   CommandType type = (CommandType)0) {
```

8 years agoMerge branch 'master' of https://github.com/google/flatbuffers
Wouter van Oortmerssen [Mon, 16 Nov 2015 22:10:16 +0000 (14:10 -0800)]
Merge branch 'master' of https://github.com/google/flatbuffers

8 years agoMerge pull request #343 from rw/go-builder-ergonomics
Robert [Mon, 16 Nov 2015 20:18:30 +0000 (12:18 -0800)]
Merge pull request #343 from rw/go-builder-ergonomics

Go: Improve Builder user interface.

8 years agoMerge pull request #344 from rw/py-builder-ergonomics
Wouter van Oortmerssen [Mon, 16 Nov 2015 17:07:31 +0000 (09:07 -0800)]
Merge pull request #344 from rw/py-builder-ergonomics

Python: Improve Builder user interface.

8 years agoC++: Fixed generated header file cannot be compiled when the type of key is enum...
takaken1994 [Sat, 14 Nov 2015 13:25:35 +0000 (22:25 +0900)]
C++: Fixed generated header file cannot be compiled when the type of key is enum class

8 years agoStore the dirs you pass into build_flatbuffers as properties.
Jon Simantov [Sat, 14 Nov 2015 02:04:41 +0000 (18:04 -0800)]
Store the dirs you pass into build_flatbuffers as properties.

This allows you to query the generated target for those properties
later, so dependent modules can refer to the directories to, for example,
add them to the include_directories.

Change-Id: I7a6bd34c5c1d08e2ea69b5ad845223297cad1159

8 years agoAdded build_flatbuffers function to CMake.
Jon Simantov [Thu, 12 Nov 2015 00:29:26 +0000 (16:29 -0800)]
Added build_flatbuffers function to CMake.

This function is designed to be called by projects that use FlatBuffers.
It takes a list of FlatBuffers schemas and a list of schema include
directories, and generates build rules to create generated headers
and/or binary schemas for those files, as well as optionally copying
all of the text schemas into a directory for your use (for example if
you need to parse text schemas within your app).

See function comments for more details.

Change-Id: I181684b916e91d965e14849d8f83ec2c83e9a4a4

8 years agoExpand local file path to allow users to fix ndk-build
Stewart Miles [Fri, 13 Nov 2015 05:12:18 +0000 (21:12 -0800)]
Expand local file path to allow users to fix ndk-build

local-source-file-path does not expand to correct file paths in
some circumstances so some users override it.  Therefore
flatbuffers_header_build_rules has been modified to generate rules
that expand LOCAL_SRC_FILES values with flatbuffers_header_build_rules.

Also, this overrides local-source-file-path to allow nest projects
to build when NDK_OUT is set.

Tested:
Verified a dependent project continues to build.

Bug: 25673744
Change-Id: Ic90186fe96d6e4533f9f3b7ca9ef78084de08a7e

8 years agoPass job server arguments (-jX) to make.
Stewart Miles [Fri, 13 Nov 2015 02:16:45 +0000 (18:16 -0800)]
Pass job server arguments (-jX) to make.

When $(MAKE) is expanded via a macro "make" doesn't know whether
$(MAKE) refers to an instance of the make app and therefore doesn't
pass job server arguments down.  This change adds the + prefix to the
command in the receipe in order to indicate $(MAKE) is another instance of
make.

Tested:
Verified flatc builds in parallel from Android builds.

Change-Id: I9f2f4f9680b818fdda7420a75a8bfa995b4644db

8 years agoPython: Improve Builder user interface.
rw [Thu, 12 Nov 2015 03:43:53 +0000 (19:43 -0800)]
Python: Improve Builder user interface.

+ Add state to the Builder object to track if we are inside a table,
  and if we are finished building the buffer.
+ Use this data to check that a buffer is being built correctly.
+ Raise an exception if a buffer is not being built correctly.
+ Test that the exceptions happen as expected.

Based on d236dea.

8 years agoImprove Builder user interface.
rw [Thu, 12 Nov 2015 01:08:16 +0000 (17:08 -0800)]
Improve Builder user interface.

+ Add state to the Builder object to track if we are inside a table,
  and if we are finished building the buffer.
+ Use this data to check that a buffer is being built correctly.
+ Panic if a buffer is not being built correctly.
+ Test that the panics happen as expected.

Based on d236dea13d2fdb9ad596679868eb4204c1562151.

8 years agoMerge pull request #339 from chobie/net-add-bytebuffer-property-to-table
Wouter van Oortmerssen [Wed, 11 Nov 2015 18:07:51 +0000 (10:07 -0800)]
Merge pull request #339 from chobie/net-add-bytebuffer-property-to-table

(C#) Add ByteBuffer property to Table

8 years ago(C#) Add ByteBuffer property to Table
Shuhei Taunma [Tue, 10 Nov 2015 05:20:16 +0000 (14:20 +0900)]
(C#) Add ByteBuffer property to Table

8 years agoUpdated supported languages in the docs.
Wouter van Oortmerssen [Tue, 10 Nov 2015 01:23:32 +0000 (17:23 -0800)]
Updated supported languages in the docs.

Change-Id: I607f5f33b609c47fe32342f5e9d066f61f5546cd

8 years agoMerge pull request #311 from chobie/dont-hide-function-parameter-vs2015
Wouter van Oortmerssen [Mon, 9 Nov 2015 17:22:30 +0000 (09:22 -0800)]
Merge pull request #311 from chobie/dont-hide-function-parameter-vs2015

Don't hide function parameter

8 years agoDon't hide function parameter
Shuhei Tanuma [Thu, 5 Nov 2015 22:14:21 +0000 (07:14 +0900)]
Don't hide function parameter

8 years agoAdded new documentation links.
Wouter van Oortmerssen [Fri, 6 Nov 2015 17:51:19 +0000 (09:51 -0800)]
Added new documentation links.

Change-Id: Ib5234a97a863be08c3bb0f9329204bc3a7effccb

8 years agoAllow structs to be parsed in JSON with out of order fields.
Wouter van Oortmerssen [Mon, 28 Sep 2015 22:02:41 +0000 (15:02 -0700)]
Allow structs to be parsed in JSON with out of order fields.

Also simplified the code and made it faster.

Change-Id: I1d83b1165a4a9a4380d1bfb5538769c012d2d367
Tested: on Linux.

8 years agoFixed assert in flatc converting to text.
Wouter van Oortmerssen [Thu, 29 Oct 2015 00:40:33 +0000 (17:40 -0700)]
Fixed assert in flatc converting to text.

Change-Id: Idac375b22aa9beaba162084cc3396f5536a4e721
Tested: on Linux.

8 years agoUpdated Xcode project for v7 v1.2.0
Wouter van Oortmerssen [Wed, 28 Oct 2015 19:07:28 +0000 (12:07 -0700)]
Updated Xcode project for v7

8 years agoImproved C++ asserts for nesting and not finishing buffers.
Wouter van Oortmerssen [Wed, 28 Oct 2015 18:54:55 +0000 (11:54 -0700)]
Improved C++ asserts for nesting and not finishing buffers.

Change-Id: I82a392bd262b13e978df748bc54b7ac43aec1e15
Tested: on Linux.

8 years agoImproved build rule generation for Android flatbuffer headers.
Stewart Miles [Thu, 22 Oct 2015 18:51:33 +0000 (11:51 -0700)]
Improved build rule generation for Android flatbuffer headers.

* Added the ability to create a build target for generated headers.
* Made it possible for generated header targets to depend upon each
  other or arbitrary build targets.

Tested:
Verified some pretty complex libraries with numerous flatbuffer schema
dependencies build using this macro on Linux with the NDK.
Bug: 25188384

Change-Id: I846855a50808e58c34cdf7086e93e7ea0df69e0d

8 years agoMerge pull request #204 from layzerar/fix_struct_comment
Robert [Tue, 20 Oct 2015 20:25:53 +0000 (13:25 -0700)]
Merge pull request #204 from layzerar/fix_struct_comment

fix comment generation of struct

8 years agoAdded assert for referring to 0 offsets.
Wouter van Oortmerssen [Tue, 20 Oct 2015 16:36:35 +0000 (09:36 -0700)]
Added assert for referring to 0 offsets.

Change-Id: I7c04d934bfacd4aeaa2ba476b934dd3a62d4fc0e
Tested: on Linux.

8 years agoAdded -M flatc flag to the documentation.
Wouter van Oortmerssen [Tue, 20 Oct 2015 00:03:14 +0000 (17:03 -0700)]
Added -M flatc flag to the documentation.

Change-Id: Ie19af91ec5bf0b65297cba58c124bceaa58fd73e

8 years agoFixes for JS generator in Xcode
Wouter van Oortmerssen [Mon, 19 Oct 2015 23:05:39 +0000 (16:05 -0700)]
Fixes for JS generator in Xcode

8 years agoFixes for JS generator in VS
Wouter van Oortmerssen [Mon, 19 Oct 2015 22:55:28 +0000 (15:55 -0700)]
Fixes for JS generator in VS

8 years agoVector of structs were not being verified correctly.
Wouter van Oortmerssen [Mon, 19 Oct 2015 21:06:46 +0000 (14:06 -0700)]
Vector of structs were not being verified correctly.

Because they are represented as `const T *` in the Vector template,
the sizeof(const T *) was accidentally used instead of sizeof(T).

Change-Id: Ib4dc73e1d21396ba2e30c84e5e229c4147204bb1
Tested: on Linux.

8 years agoMerge pull request #257 from evanw/javascript
Wouter van Oortmerssen [Mon, 19 Oct 2015 19:49:16 +0000 (12:49 -0700)]
Merge pull request #257 from evanw/javascript

Add support for JavaScript code generation with Google Closure Compiler type annotations

8 years agoMerge pull request #298 from evolutional/master
Wouter van Oortmerssen [Mon, 19 Oct 2015 18:11:05 +0000 (11:11 -0700)]
Merge pull request #298 from evolutional/master

Ported some of the python fuzz tests to C#

8 years agoMerge pull request #296 from prideout/master
Wouter van Oortmerssen [Mon, 19 Oct 2015 17:40:16 +0000 (10:40 -0700)]
Merge pull request #296 from prideout/master

Fix minor typos in the Python documentation.

8 years agoPorted some of the python fuzz tests to C#
evolutional [Sun, 18 Oct 2015 21:08:39 +0000 (17:08 -0400)]
Ported some of the python fuzz tests to C#

* Refactored the test runner to use attribute based test discovery
* Ported value and vtable/object fuzzing tests from python to C#

8 years agoFix minor typos in the Python documentation.
Philip Rideout [Sun, 18 Oct 2015 00:48:06 +0000 (17:48 -0700)]
Fix minor typos in the Python documentation.

8 years agoAdd UTF-8 support to the JavaScript API
Evan Wallace [Thu, 15 Oct 2015 06:07:40 +0000 (23:07 -0700)]
Add UTF-8 support to the JavaScript API

This adds an optional argument to generated getters for string fields to
specify the encoding type and overloads the createString() function. It's
now possible to use either JavaScript UTF-16 string objects or C-style
UTF-8 byte arrays (Uint8Array) for string data.

8 years agoUpdate monster_test_generated.js baseline after rebase
Evan Wallace [Thu, 15 Oct 2015 04:25:16 +0000 (21:25 -0700)]
Update monster_test_generated.js baseline after rebase

8 years agochange DataView to bit twiddling for JavaScript
Evan Wallace [Wed, 14 Oct 2015 07:29:01 +0000 (00:29 -0700)]
change DataView to bit twiddling for JavaScript

8 years agoremove unnecessary return
Evan Wallace [Wed, 14 Oct 2015 06:45:38 +0000 (23:45 -0700)]
remove unnecessary return

8 years agoAdd low-level fuzzer, fix 64-bit issue it found
Evan Wallace [Thu, 20 Aug 2015 16:21:31 +0000 (09:21 -0700)]
Add low-level fuzzer, fix 64-bit issue it found

8 years agoAdd a test for JavaScript UTF-8 <=> UTF-16 conversion
Evan Wallace [Thu, 20 Aug 2015 06:53:55 +0000 (23:53 -0700)]
Add a test for JavaScript UTF-8 <=> UTF-16 conversion

JavaScript uses UTF-16 but FlatBuffers uses UTF-8. This commit tests the code
that does the conversion between the two encodings. The last entry in the array
is tricky because each code point actually requires two UTF-16 code units,
unlike the other examples. The current JSON output of flatc actually handles
this case incorrectly (it generates invalid JSON with UTF-8 code units). The
generated JavaScript code passes these tests fine, however.

8 years agoAdd support for JavaScript code generation
Evan Wallace [Mon, 17 Aug 2015 07:56:54 +0000 (00:56 -0700)]
Add support for JavaScript code generation

This adds a JavaScript language target. The generated JavaScript uses Google
Closure Compiler type annotations and can be compiled using the advanced
compilation mode, which performs type checking and optimizations such as
inlining and dead code elimination. The generated JavaScript also exports all
generated symbols for use with Node.js and RequireJS. This export behavior
can be turned off with the --no-js-exports flag for use with Google Closure
Compiler.

8 years agoAdded support for imports and many other .proto features.
Wouter van Oortmerssen [Tue, 6 Oct 2015 00:39:08 +0000 (17:39 -0700)]
Added support for imports and many other .proto features.

Change-Id: I6600021b7ec8c486794349511232c3e604421c5b
Tested: on Linux.

8 years agoMerge pull request #286 from tguo-aa/fix-278
Robert [Thu, 8 Oct 2015 07:23:26 +0000 (00:23 -0700)]
Merge pull request #286 from tguo-aa/fix-278

Add self.assertNotNested() in CreateString

8 years agoAdd self.assertNotNested() in CreateString
tguo-aa [Tue, 29 Sep 2015 00:30:37 +0000 (08:30 +0800)]
Add self.assertNotNested() in CreateString

And also add a test case.
If you try to nest CreateString you will get a clear exception.

8 years agoFixed LoadFile on Windows
Wouter van Oortmerssen [Mon, 28 Sep 2015 22:31:03 +0000 (15:31 -0700)]
Fixed LoadFile on Windows

8 years agoImproved documentation with links to videos, articles and who uses it.
Wouter van Oortmerssen [Mon, 28 Sep 2015 17:49:01 +0000 (10:49 -0700)]
Improved documentation with links to videos, articles and who uses it.

Change-Id: I62de6b7008e397a5043d47f014a7acd83ee64740

8 years agoMade .proto parsing understand nested declarations.
Wouter van Oortmerssen [Mon, 28 Sep 2015 16:42:45 +0000 (09:42 -0700)]
Made .proto parsing understand nested declarations.

Bug: 24401812
Change-Id: I196a03b8c5ef0bcd3c26178239c764e40ca1950d
Tested: on Linux.

8 years agoMerge pull request #282 from google/fix-277
Wouter van Oortmerssen [Fri, 25 Sep 2015 21:54:50 +0000 (14:54 -0700)]
Merge pull request #282 from google/fix-277

Fix 32bit-system integer overflow (test only)

8 years agoFix 32bit-system integer overflow (test only)
Robert [Fri, 25 Sep 2015 20:57:17 +0000 (13:57 -0700)]
Fix 32bit-system integer overflow (test only)

For #277

8 years agoMerge pull request #280 from alexames/master
Wouter van Oortmerssen [Fri, 25 Sep 2015 17:38:50 +0000 (10:38 -0700)]
Merge pull request #280 from alexames/master

Removed call to pop_back on std::string.

8 years agoFixed .proto translation making scalars into required fields.
Wouter van Oortmerssen [Fri, 25 Sep 2015 16:21:31 +0000 (09:21 -0700)]
Fixed .proto translation making scalars into required fields.

Change-Id: If414d156b4e9bc7fead5f131823b2c419cdc4e2c
Tested: on Linux.

8 years agoRemoved call to pop_back on std::string.
Alex Ames [Thu, 24 Sep 2015 21:19:32 +0000 (14:19 -0700)]
Removed call to pop_back on std::string.

The pop_back function was added to strings in C++11 and it appears not
all compilers we target support it. The call to pop_back has been
replaced with a call to erase.

Tested on Linux. All unit tests pass.

8 years agoMerge pull request #274 from cogumbreiro/master
Wouter van Oortmerssen [Wed, 23 Sep 2015 19:37:45 +0000 (12:37 -0700)]
Merge pull request #274 from cogumbreiro/master

Fix an out-of bounds read when the element is bigger than the buffer.

8 years agoMerge pull request #275 from brunoqc/patch-1
Robert [Mon, 21 Sep 2015 22:13:24 +0000 (15:13 -0700)]
Merge pull request #275 from brunoqc/patch-1

Remove duplicate Go test

8 years agoRemove duplicate Go test
Bruno Bigras [Mon, 21 Sep 2015 21:51:16 +0000 (17:51 -0400)]
Remove duplicate Go test

8 years agoFix an out-of bounds read when the element is bigger than the buffer.
Tiago Cogumbreiro [Sat, 19 Sep 2015 01:38:47 +0000 (20:38 -0500)]
Fix an out-of bounds read when the element is bigger than the buffer.

Ensure the size of the buffer being checked is bigger than the element
of the buffer being checked. The buffer can be triggered when, for
example, the buffer is of length zero and we are checking for:

    Verify<uoffset_t>(buf_)

The condition above should fail.

8 years agoserialize boolean in JSON to "true/false" instead of "0/1"
Björn Reimer [Tue, 8 Sep 2015 09:00:35 +0000 (11:00 +0200)]
serialize boolean in JSON to "true/false" instead of "0/1"

Change-Id: I90cf519c00eaf9ccd9fcab8035a91b9205587c3b

8 years agoMerge pull request #271 from vijairaj/scoped-enums
Wouter van Oortmerssen [Wed, 16 Sep 2015 17:14:49 +0000 (10:14 -0700)]
Merge pull request #271 from vijairaj/scoped-enums

Implemented option --scoped-enum for C++ generator

8 years agoImplemented option --scoped-enum for C++ generator
vijairaj [Tue, 15 Sep 2015 08:11:29 +0000 (13:41 +0530)]
Implemented option --scoped-enum for C++ generator

This generates C++11 style scoped and strongly typed enums.
Enabling this option also implies --no-prefix.

8 years agoMerge pull request #266 from kadirahq/fix-travis-osx
Wouter van Oortmerssen [Tue, 15 Sep 2015 00:50:29 +0000 (17:50 -0700)]
Merge pull request #266 from kadirahq/fix-travis-osx

Fix before_install step on .travis.yml file for osx

8 years agoClarified use of unions in C++.
Wouter van Oortmerssen [Mon, 14 Sep 2015 18:00:12 +0000 (11:00 -0700)]
Clarified use of unions in C++.

Change-Id: I9654e0c6a45457c8e150f07dd5f7b39539266f9e

8 years agoFix Visual Studio 2012 build warning.
Jason Sanmiya [Fri, 11 Sep 2015 20:40:59 +0000 (13:40 -0700)]
Fix Visual Studio 2012 build warning.

Also, remove execute permissions on several source files.

Tested: Builds on Visual Studio 2012, and Linux.

Change-Id: Idaacb2ae8eba98ce2974218c2ab840e97a1d67e9

8 years agoMerge pull request #269 from teemuandersen/master
Wouter van Oortmerssen [Fri, 11 Sep 2015 21:23:53 +0000 (14:23 -0700)]
Merge pull request #269 from teemuandersen/master

Add @SuppressWarnings("all") to generated Java classes

8 years agoAdd @SuppressWarnings("unused") to generated Java classes
Teemu Andersén [Thu, 10 Sep 2015 16:56:50 +0000 (19:56 +0300)]
Add @SuppressWarnings("unused") to generated Java classes

Usually generators add @SuppressWarnings("all") to generated Java
classes to prevent IDEs from complaining about unused imports, etc.
Solving used imports seems pretty hard with current generator logic so
IMO this is the next best thing.

Yes, it’s appended to import block but that is the block that gives
these warnings in the first place.

8 years agoFix OSX related errors on travis
Muhammed Thanish [Thu, 10 Sep 2015 04:21:35 +0000 (09:51 +0530)]
Fix OSX related errors on travis

 - Install g++ and cmake only on Linux.
 - Use biicode only on Linux machines.

8 years agoImproved the speed of LoadFile() in debug mode.
Wouter van Oortmerssen [Wed, 9 Sep 2015 19:56:23 +0000 (12:56 -0700)]
Improved the speed of LoadFile() in debug mode.

Apparently, istreambuf_iterator has a lot of overhead.

Change-Id: I804f4e8f2b380b05e939edefe0e1e88cd10e920c
Tested: on Linux.

8 years agoFixed Android builds on Windows (generated schema rules).
Wouter van Oortmerssen [Fri, 28 Aug 2015 19:06:41 +0000 (12:06 -0700)]
Fixed Android builds on Windows (generated schema rules).

include.mk causes absolute paths to be generated, which doesn't
work on Windows (make doesn't like : in paths).

Change-Id: Ib06c9581620bde1e8452e0dd887d3986d517c4f5
Tested: on Windows, Linux.

8 years agoPython: Fix potential code generation issue of documentation comment.
Melvi Ts [Fri, 28 Aug 2015 15:48:28 +0000 (23:48 +0800)]
Python: Fix potential code generation issue of documentation comment.

8 years agoFixed a clang warning about signed shifts.
Wouter van Oortmerssen [Wed, 26 Aug 2015 23:47:59 +0000 (16:47 -0700)]
Fixed a clang warning about signed shifts.

Change-Id: I7c2bf87972ee0ba6811d6ed42e13300bff90e36f