Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
2d67de31
Commit
2d67de31
authored
Apr 05, 2019
by
Kamil Rojewski
Committed by
Wouter van Oortmerssen
Apr 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for build break in c# vector of unions (#5271)
parent
5cdbd024
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
3 deletions
+8
-3
idl_gen_general.cpp
src/idl_gen_general.cpp
+1
-1
generate_code.sh
tests/generate_code.sh
+1
-1
Attacker.cs
tests/union_vector/Attacker.cs
+1
-0
BookReader.cs
tests/union_vector/BookReader.cs
+1
-0
Movie.cs
tests/union_vector/Movie.cs
+3
-1
Rapunzel.cs
tests/union_vector/Rapunzel.cs
+1
-0
No files found.
src/idl_gen_general.cpp
View file @
2d67de31
...
@@ -1044,7 +1044,7 @@ class GeneralGenerator : public BaseGenerator {
...
@@ -1044,7 +1044,7 @@ class GeneralGenerator : public BaseGenerator {
:
lang_
.
accessor_prefix
+
"__indirect("
+
index
+
")"
;
:
lang_
.
accessor_prefix
+
"__indirect("
+
index
+
")"
;
code
+=
", "
+
lang_
.
accessor_prefix
+
"bb"
;
code
+=
", "
+
lang_
.
accessor_prefix
+
"bb"
;
}
else
if
(
vectortype
.
base_type
==
BASE_TYPE_UNION
)
{
}
else
if
(
vectortype
.
base_type
==
BASE_TYPE_UNION
)
{
code
+=
index
+
" - bb_pos"
;
code
+=
index
+
" -
"
+
lang_
.
accessor_prefix
+
"
bb_pos"
;
}
else
{
}
else
{
code
+=
index
;
code
+=
index
;
}
}
...
...
tests/generate_code.sh
View file @
2d67de31
...
@@ -17,7 +17,7 @@ set -e
...
@@ -17,7 +17,7 @@ set -e
../flatc
--cpp
--java
--csharp
--dart
--go
--binary
--lobster
--lua
--python
--js
--ts
--php
--rust
--grpc
--gen-mutable
--reflect-names
--gen-object-api
--gen-compare
--no-includes
--cpp-ptr-type
flatbuffers::unique_ptr
--no-fb-import
-I
include_test monster_test.fbs monsterdata_test.json
../flatc
--cpp
--java
--csharp
--dart
--go
--binary
--lobster
--lua
--python
--js
--ts
--php
--rust
--grpc
--gen-mutable
--reflect-names
--gen-object-api
--gen-compare
--no-includes
--cpp-ptr-type
flatbuffers::unique_ptr
--no-fb-import
-I
include_test monster_test.fbs monsterdata_test.json
../flatc
--cpp
--java
--csharp
--dart
--go
--binary
--lobster
--lua
--python
--js
--ts
--php
--rust
--gen-mutable
--reflect-names
--no-fb-import
--cpp-ptr-type
flatbuffers::unique_ptr
-o
namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
../flatc
--cpp
--java
--csharp
--dart
--go
--binary
--lobster
--lua
--python
--js
--ts
--php
--rust
--gen-mutable
--reflect-names
--no-fb-import
--cpp-ptr-type
flatbuffers::unique_ptr
-o
namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
../flatc
--cpp
--java
--js
--ts
--php
--gen-mutable
--reflect-names
--gen-object-api
--gen-compare
--cpp-ptr-type
flatbuffers::unique_ptr
-o
union_vector ./union_vector/union_vector.fbs
../flatc
--cpp
--java
--
csharp
--
js
--ts
--php
--gen-mutable
--reflect-names
--gen-object-api
--gen-compare
--cpp-ptr-type
flatbuffers::unique_ptr
-o
union_vector ./union_vector/union_vector.fbs
../flatc
-b
--schema
--bfbs-comments
--bfbs-builtins
-I
include_test monster_test.fbs
../flatc
-b
--schema
--bfbs-comments
--bfbs-builtins
-I
include_test monster_test.fbs
../flatc
--jsonschema
--schema
-I
include_test monster_test.fbs
../flatc
--jsonschema
--schema
-I
include_test monster_test.fbs
../flatc
--cpp
--java
--csharp
--python
--gen-mutable
--reflect-names
--gen-object-api
--gen-compare
--no-includes
monster_extra.fbs
||
goto FAIL
../flatc
--cpp
--java
--csharp
--python
--gen-mutable
--reflect-names
--gen-object-api
--gen-compare
--no-includes
monster_extra.fbs
||
goto FAIL
...
...
tests/union_vector/Attacker.cs
View file @
2d67de31
...
@@ -15,6 +15,7 @@ public struct Attacker : IFlatbufferObject
...
@@ -15,6 +15,7 @@ public struct Attacker : IFlatbufferObject
public
Attacker
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
Attacker
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
int
SwordAttackDamage
{
get
{
int
o
=
__p
.
__offset
(
4
);
return
o
!=
0
?
__p
.
bb
.
GetInt
(
o
+
__p
.
bb_pos
)
:
(
int
)
0
;
}
}
public
int
SwordAttackDamage
{
get
{
int
o
=
__p
.
__offset
(
4
);
return
o
!=
0
?
__p
.
bb
.
GetInt
(
o
+
__p
.
bb_pos
)
:
(
int
)
0
;
}
}
public
bool
MutateSwordAttackDamage
(
int
sword_attack_damage
)
{
int
o
=
__p
.
__offset
(
4
);
if
(
o
!=
0
)
{
__p
.
bb
.
PutInt
(
o
+
__p
.
bb_pos
,
sword_attack_damage
);
return
true
;
}
else
{
return
false
;
}
}
public
static
Offset
<
Attacker
>
CreateAttacker
(
FlatBufferBuilder
builder
,
public
static
Offset
<
Attacker
>
CreateAttacker
(
FlatBufferBuilder
builder
,
int
sword_attack_damage
=
0
)
{
int
sword_attack_damage
=
0
)
{
...
...
tests/union_vector/BookReader.cs
View file @
2d67de31
...
@@ -13,6 +13,7 @@ public struct BookReader : IFlatbufferObject
...
@@ -13,6 +13,7 @@ public struct BookReader : IFlatbufferObject
public
BookReader
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
BookReader
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
int
BooksRead
{
get
{
return
__p
.
bb
.
GetInt
(
__p
.
bb_pos
+
0
);
}
}
public
int
BooksRead
{
get
{
return
__p
.
bb
.
GetInt
(
__p
.
bb_pos
+
0
);
}
}
public
void
MutateBooksRead
(
int
books_read
)
{
__p
.
bb
.
PutInt
(
__p
.
bb_pos
+
0
,
books_read
);
}
public
static
Offset
<
BookReader
>
CreateBookReader
(
FlatBufferBuilder
builder
,
int
BooksRead
)
{
public
static
Offset
<
BookReader
>
CreateBookReader
(
FlatBufferBuilder
builder
,
int
BooksRead
)
{
builder
.
Prep
(
4
,
4
);
builder
.
Prep
(
4
,
4
);
...
...
tests/union_vector/Movie.cs
View file @
2d67de31
...
@@ -16,6 +16,7 @@ public struct Movie : IFlatbufferObject
...
@@ -16,6 +16,7 @@ public struct Movie : IFlatbufferObject
public
Movie
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
Movie
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
Character
MainCharacterType
{
get
{
int
o
=
__p
.
__offset
(
4
);
return
o
!=
0
?
(
Character
)
__p
.
bb
.
Get
(
o
+
__p
.
bb_pos
)
:
Character
.
NONE
;
}
}
public
Character
MainCharacterType
{
get
{
int
o
=
__p
.
__offset
(
4
);
return
o
!=
0
?
(
Character
)
__p
.
bb
.
Get
(
o
+
__p
.
bb_pos
)
:
Character
.
NONE
;
}
}
public
bool
MutateMainCharacterType
(
Character
main_character_type
)
{
int
o
=
__p
.
__offset
(
4
);
if
(
o
!=
0
)
{
__p
.
bb
.
Put
(
o
+
__p
.
bb_pos
,
(
byte
)
main_character_type
);
return
true
;
}
else
{
return
false
;
}
}
public
TTable
?
MainCharacter
<
TTable
>()
where
TTable
:
struct
,
IFlatbufferObject
{
int
o
=
__p
.
__offset
(
6
);
return
o
!=
0
?
(
TTable
?)
__p
.
__union
<
TTable
>(
o
)
:
null
;
}
public
TTable
?
MainCharacter
<
TTable
>()
where
TTable
:
struct
,
IFlatbufferObject
{
int
o
=
__p
.
__offset
(
6
);
return
o
!=
0
?
(
TTable
?)
__p
.
__union
<
TTable
>(
o
)
:
null
;
}
public
Character
CharactersType
(
int
j
)
{
int
o
=
__p
.
__offset
(
8
);
return
o
!=
0
?
(
Character
)
__p
.
bb
.
Get
(
__p
.
__vector
(
o
)
+
j
*
1
)
:
(
Character
)
0
;
}
public
Character
CharactersType
(
int
j
)
{
int
o
=
__p
.
__offset
(
8
);
return
o
!=
0
?
(
Character
)
__p
.
bb
.
Get
(
__p
.
__vector
(
o
)
+
j
*
1
)
:
(
Character
)
0
;
}
public
int
CharactersTypeLength
{
get
{
int
o
=
__p
.
__offset
(
8
);
return
o
!=
0
?
__p
.
__vector_len
(
o
)
:
0
;
}
}
public
int
CharactersTypeLength
{
get
{
int
o
=
__p
.
__offset
(
8
);
return
o
!=
0
?
__p
.
__vector_len
(
o
)
:
0
;
}
}
...
@@ -25,7 +26,8 @@ public struct Movie : IFlatbufferObject
...
@@ -25,7 +26,8 @@ public struct Movie : IFlatbufferObject
public
ArraySegment
<
byte
>?
GetCharactersTypeBytes
()
{
return
__p
.
__vector_as_arraysegment
(
8
);
}
public
ArraySegment
<
byte
>?
GetCharactersTypeBytes
()
{
return
__p
.
__vector_as_arraysegment
(
8
);
}
#endif
#endif
public
Character
[]
GetCharactersTypeArray
()
{
return
__p
.
__vector_as_array
<
Character
>(
8
);
}
public
Character
[]
GetCharactersTypeArray
()
{
return
__p
.
__vector_as_array
<
Character
>(
8
);
}
public
TTable
?
Characters
<
TTable
>(
int
j
)
where
TTable
:
struct
,
IFlatbufferObject
{
int
o
=
__p
.
__offset
(
10
);
return
o
!=
0
?
(
TTable
?)
__p
.
__union
<
TTable
>(
__p
.
__vector
(
o
)
+
j
*
4
)
:
null
;
}
public
bool
MutateCharactersType
(
int
j
,
Character
characters_type
)
{
int
o
=
__p
.
__offset
(
8
);
if
(
o
!=
0
)
{
__p
.
bb
.
Put
(
__p
.
__vector
(
o
)
+
j
*
1
,
(
byte
)
characters_type
);
return
true
;
}
else
{
return
false
;
}
}
public
TTable
?
Characters
<
TTable
>(
int
j
)
where
TTable
:
struct
,
IFlatbufferObject
{
int
o
=
__p
.
__offset
(
10
);
return
o
!=
0
?
(
TTable
?)
__p
.
__union
<
TTable
>(
__p
.
__vector
(
o
)
+
j
*
4
-
__p
.
bb_pos
)
:
null
;
}
public
int
CharactersLength
{
get
{
int
o
=
__p
.
__offset
(
10
);
return
o
!=
0
?
__p
.
__vector_len
(
o
)
:
0
;
}
}
public
int
CharactersLength
{
get
{
int
o
=
__p
.
__offset
(
10
);
return
o
!=
0
?
__p
.
__vector_len
(
o
)
:
0
;
}
}
public
static
Offset
<
Movie
>
CreateMovie
(
FlatBufferBuilder
builder
,
public
static
Offset
<
Movie
>
CreateMovie
(
FlatBufferBuilder
builder
,
...
...
tests/union_vector/Rapunzel.cs
View file @
2d67de31
...
@@ -13,6 +13,7 @@ public struct Rapunzel : IFlatbufferObject
...
@@ -13,6 +13,7 @@ public struct Rapunzel : IFlatbufferObject
public
Rapunzel
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
Rapunzel
__assign
(
int
_i
,
ByteBuffer
_bb
)
{
__init
(
_i
,
_bb
);
return
this
;
}
public
int
HairLength
{
get
{
return
__p
.
bb
.
GetInt
(
__p
.
bb_pos
+
0
);
}
}
public
int
HairLength
{
get
{
return
__p
.
bb
.
GetInt
(
__p
.
bb_pos
+
0
);
}
}
public
void
MutateHairLength
(
int
hair_length
)
{
__p
.
bb
.
PutInt
(
__p
.
bb_pos
+
0
,
hair_length
);
}
public
static
Offset
<
Rapunzel
>
CreateRapunzel
(
FlatBufferBuilder
builder
,
int
HairLength
)
{
public
static
Offset
<
Rapunzel
>
CreateRapunzel
(
FlatBufferBuilder
builder
,
int
HairLength
)
{
builder
.
Prep
(
4
,
4
);
builder
.
Prep
(
4
,
4
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment