Commit d3429187 authored by Wouter van Oortmerssen's avatar Wouter van Oortmerssen

Merge branch 'master' of https://github.com/google/flatbuffers

Change-Id: I02b00b22cdd2d1bd32de3273ff69185c9b0f4e5b
parents c4377390 dbecdf20
......@@ -65,3 +65,4 @@ build/VS2010/FlatBuffers.sdf
build/VS2010/FlatBuffers.opensdf
build/VS2010/ipch/**/*.ipch
*.so
Testing/Temporary
......@@ -593,6 +593,10 @@ class FlatbufferBuilder
protected function is_utf8($bytes)
{
if (function_exists('mb_detect_encoding')) {
return (bool) mb_detect_encoding($bytes, 'UTF-8', true);
}
$len = strlen($bytes);
if ($len < 1) {
/* NOTE: always return 1 when passed string is null */
......
......@@ -557,13 +557,13 @@ void GenStruct(const Parser &parser, StructDef &struct_def, std::string *code_pt
"@returns {boolean}");
code += object_name + ".prototype.mutate_" + field.name + " = function(value) {\n";
code += " var offset = this.bb.__offset(this.bb_pos, " + NumToString(field.value.offset) + ")\n\n";
code += " var offset = this.bb.__offset(this.bb_pos, " + NumToString(field.value.offset) + ");\n\n";
code += " if (offset === 0) {\n";
code += " return false;\n";
code += " }\n\n";
code += " this.bb.write" + MakeCamel(GenType(field.value.type)) + "(this.bb_pos + offset, value);\n";
code += " return true;\n";
code += "}\n\n";
code += "};\n\n";
}
// Emit vector helpers
......
......@@ -1758,6 +1758,9 @@ CheckedError Parser::SkipAnyJsonValue() {
case kTokenFloatConstant:
EXPECT(kTokenFloatConstant);
break;
case kTokenNull:
EXPECT(kTokenNull);
break;
default:
return Error(std::string("Unexpected token:") + std::string(1, static_cast<char>(token_)));
}
......
This diff is collapsed.
......@@ -69,7 +69,7 @@ NamespaceA.NamespaceB.TableInNestedNS.prototype.foo = function() {
* @returns {boolean}
*/
NamespaceA.NamespaceB.TableInNestedNS.prototype.mutate_foo = function(value) {
var offset = this.bb.__offset(this.bb_pos, 4)
var offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
......@@ -77,7 +77,7 @@ NamespaceA.NamespaceB.TableInNestedNS.prototype.mutate_foo = function(value) {
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
};
/**
* @param {flatbuffers.Builder} builder
......@@ -141,7 +141,7 @@ NamespaceA.NamespaceB.StructInNestedNS.prototype.a = function() {
* @returns {boolean}
*/
NamespaceA.NamespaceB.StructInNestedNS.prototype.mutate_a = function(value) {
var offset = this.bb.__offset(this.bb_pos, 0)
var offset = this.bb.__offset(this.bb_pos, 0);
if (offset === 0) {
return false;
......@@ -149,7 +149,7 @@ NamespaceA.NamespaceB.StructInNestedNS.prototype.mutate_a = function(value) {
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
};
/**
* @returns {number}
......@@ -163,7 +163,7 @@ NamespaceA.NamespaceB.StructInNestedNS.prototype.b = function() {
* @returns {boolean}
*/
NamespaceA.NamespaceB.StructInNestedNS.prototype.mutate_b = function(value) {
var offset = this.bb.__offset(this.bb_pos, 4)
var offset = this.bb.__offset(this.bb_pos, 4);
if (offset === 0) {
return false;
......@@ -171,7 +171,7 @@ NamespaceA.NamespaceB.StructInNestedNS.prototype.mutate_b = function(value) {
this.bb.writeInt32(this.bb_pos + offset, value);
return true;
}
};
/**
* @param {flatbuffers.Builder} builder
......
......@@ -75,7 +75,7 @@ NamespaceA.TableInFirstNS.prototype.fooEnum = function() {
* @returns {boolean}
*/
NamespaceA.TableInFirstNS.prototype.mutate_foo_enum = function(value) {
var offset = this.bb.__offset(this.bb_pos, 6)
var offset = this.bb.__offset(this.bb_pos, 6);
if (offset === 0) {
return false;
......@@ -83,7 +83,7 @@ NamespaceA.TableInFirstNS.prototype.mutate_foo_enum = function(value) {
this.bb.writeInt8(this.bb_pos + offset, value);
return true;
}
};
/**
* @param {NamespaceA.NamespaceB.StructInNestedNS=} obj
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment