summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xreadme.md2
-rw-r--r--src/idl_gen_js.cpp2
-rw-r--r--tests/monster_test.bfbsbin3320 -> 3320 bytes
-rw-r--r--tests/monster_test_generated.js6
4 files changed, 6 insertions, 4 deletions
diff --git a/readme.md b/readme.md
index 38bf355d..8d05c314 100755
--- a/readme.md
+++ b/readme.md
@@ -1,5 +1,7 @@
![logo](http://google.github.io/flatbuffers/fpl_logo_small.png) FlatBuffers
===========
+
+[![Join the chat at https://gitter.im/google/flatbuffers](https://badges.gitter.im/google/flatbuffers.svg)](https://gitter.im/google/flatbuffers?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/google/flatbuffers.svg?branch=master)](https://travis-ci.org/google/flatbuffers) [![Build status](https://ci.appveyor.com/api/projects/status/yg5idd2fnusv1n10?svg=true)](https://ci.appveyor.com/project/gwvo/flatbuffers)
**FlatBuffers** is an efficient cross platform serialization library for games and
diff --git a/src/idl_gen_js.cpp b/src/idl_gen_js.cpp
index fec57802..23fd52c5 100644
--- a/src/idl_gen_js.cpp
+++ b/src/idl_gen_js.cpp
@@ -581,7 +581,7 @@ void GenStruct(const Parser &parser, StructDef &struct_def, std::string *code_pt
code += object_name + ".prototype." + MakeCamel(field.name, false);
code += "Array = function() {\n" + offset_prefix;
code += "new " + GenType(vectorType) + "Array(this.bb.bytes().buffer, "
- "this.bb.__vector(this.bb_pos + offset), "
+ "this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), "
"this.bb.__vector_len(this.bb_pos + offset)) : null;\n};\n\n";
}
}
diff --git a/tests/monster_test.bfbs b/tests/monster_test.bfbs
index 41d9edb1..66d3ee8f 100644
--- a/tests/monster_test.bfbs
+++ b/tests/monster_test.bfbs
Binary files differ
diff --git a/tests/monster_test_generated.js b/tests/monster_test_generated.js
index 774882d7..6789ebb4 100644
--- a/tests/monster_test_generated.js
+++ b/tests/monster_test_generated.js
@@ -693,7 +693,7 @@ MyGame.Example.Monster.prototype.inventoryLength = function() {
*/
MyGame.Example.Monster.prototype.inventoryArray = function() {
var offset = this.bb.__offset(this.bb_pos, 14);
- return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
+ return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
};
/**
@@ -839,7 +839,7 @@ MyGame.Example.Monster.prototype.testnestedflatbufferLength = function() {
*/
MyGame.Example.Monster.prototype.testnestedflatbufferArray = function() {
var offset = this.bb.__offset(this.bb_pos, 30);
- return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
+ return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
};
/**
@@ -1080,7 +1080,7 @@ MyGame.Example.Monster.prototype.testarrayofboolsLength = function() {
*/
MyGame.Example.Monster.prototype.testarrayofboolsArray = function() {
var offset = this.bb.__offset(this.bb_pos, 52);
- return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
+ return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
};
/**