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
2e865f4d
Commit
2e865f4d
authored
Mar 04, 2019
by
Laurent Stacul
Committed by
Wouter van Oortmerssen
Mar 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Fix #5112] flatc generates constructors with memset for non-trivial types (#5222)
parent
13c9c674
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
monster_generated.h
samples/monster_generated.h
+1
-1
idl_gen_cpp.cpp
src/idl_gen_cpp.cpp
+1
-1
monster_test_generated.h
tests/monster_test_generated.h
+3
-3
namespace_test1_generated.h
tests/namespace_test/namespace_test1_generated.h
+1
-1
union_vector_generated.h
tests/union_vector/union_vector_generated.h
+2
-2
No files found.
samples/monster_generated.h
View file @
2e865f4d
...
...
@@ -166,7 +166,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Vec3 FLATBUFFERS_FINAL_CLASS {
public
:
Vec3
()
{
memset
(
this
,
0
,
sizeof
(
Vec3
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
Vec3
));
}
Vec3
(
float
_x
,
float
_y
,
float
_z
)
:
x_
(
flatbuffers
::
EndianScalar
(
_x
)),
...
...
src/idl_gen_cpp.cpp
View file @
2e865f4d
...
...
@@ -2617,7 +2617,7 @@ class CppGenerator : public BaseGenerator {
// Generate a default constructor.
code_
+=
" {{STRUCT_NAME}}() {"
;
code_
+=
" memset(
this
, 0, sizeof({{STRUCT_NAME}}));"
;
code_
+=
" memset(
static_cast<void *>(this)
, 0, sizeof({{STRUCT_NAME}}));"
;
code_
+=
" }"
;
// Generate a constructor that takes all fields as arguments.
...
...
tests/monster_test_generated.h
View file @
2e865f4d
...
...
@@ -516,7 +516,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(2) Test FLATBUFFERS_FINAL_CLASS {
public
:
Test
()
{
memset
(
this
,
0
,
sizeof
(
Test
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
Test
));
}
Test
(
int16_t
_a
,
int8_t
_b
)
:
a_
(
flatbuffers
::
EndianScalar
(
_a
)),
...
...
@@ -559,7 +559,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
public
:
Vec3
()
{
memset
(
this
,
0
,
sizeof
(
Vec3
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
Vec3
));
}
Vec3
(
float
_x
,
float
_y
,
float
_z
,
double
_test1
,
Color
_test2
,
const
Test
&
_test3
)
:
x_
(
flatbuffers
::
EndianScalar
(
_x
)),
...
...
@@ -631,7 +631,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
public
:
Ability
()
{
memset
(
this
,
0
,
sizeof
(
Ability
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
Ability
));
}
Ability
(
uint32_t
_id
,
uint32_t
_distance
)
:
id_
(
flatbuffers
::
EndianScalar
(
_id
)),
...
...
tests/namespace_test/namespace_test1_generated.h
View file @
2e865f4d
...
...
@@ -57,7 +57,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS
public
:
StructInNestedNS
()
{
memset
(
this
,
0
,
sizeof
(
StructInNestedNS
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
StructInNestedNS
));
}
StructInNestedNS
(
int32_t
_a
,
int32_t
_b
)
:
a_
(
flatbuffers
::
EndianScalar
(
_a
)),
...
...
tests/union_vector/union_vector_generated.h
View file @
2e865f4d
...
...
@@ -189,7 +189,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
public
:
Rapunzel
()
{
memset
(
this
,
0
,
sizeof
(
Rapunzel
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
Rapunzel
));
}
Rapunzel
(
int32_t
_hair_length
)
:
hair_length_
(
flatbuffers
::
EndianScalar
(
_hair_length
))
{
...
...
@@ -214,7 +214,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS {
public
:
BookReader
()
{
memset
(
this
,
0
,
sizeof
(
BookReader
));
memset
(
static_cast
<
void
*>
(
this
)
,
0
,
sizeof
(
BookReader
));
}
BookReader
(
int32_t
_books_read
)
:
books_read_
(
flatbuffers
::
EndianScalar
(
_books_read
))
{
...
...
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