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
1b9d1b01
Commit
1b9d1b01
authored
Feb 25, 2019
by
Marcus Comstedt
Committed by
Wouter van Oortmerssen
Feb 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IterateValue: Use ReadScalar instead of unportable reinterpret_casts (#5209)
This fixes the testcase MiniReflectFlatBuffersTest.
parent
6e2d530d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
minireflect.h
include/flatbuffers/minireflect.h
+12
-12
No files found.
include/flatbuffers/minireflect.h
View file @
1b9d1b01
...
...
@@ -122,58 +122,58 @@ inline void IterateValue(ElementaryType type, const uint8_t *val,
soffset_t
vector_index
,
IterationVisitor
*
visitor
)
{
switch
(
type
)
{
case
ET_UTYPE
:
{
auto
tval
=
*
reinterpret_cast
<
const
uint8_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
uint8_t
>
(
val
);
visitor
->
UType
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_BOOL
:
{
visitor
->
Bool
(
*
reinterpret_cast
<
const
uint8_t
*
>
(
val
)
!=
0
);
visitor
->
Bool
(
ReadScalar
<
uint8_t
>
(
val
)
!=
0
);
break
;
}
case
ET_CHAR
:
{
auto
tval
=
*
reinterpret_cast
<
const
int8_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
int8_t
>
(
val
);
visitor
->
Char
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_UCHAR
:
{
auto
tval
=
*
reinterpret_cast
<
const
uint8_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
uint8_t
>
(
val
);
visitor
->
UChar
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_SHORT
:
{
auto
tval
=
*
reinterpret_cast
<
const
int16_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
int16_t
>
(
val
);
visitor
->
Short
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_USHORT
:
{
auto
tval
=
*
reinterpret_cast
<
const
uint16_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
uint16_t
>
(
val
);
visitor
->
UShort
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_INT
:
{
auto
tval
=
*
reinterpret_cast
<
const
int32_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
int32_t
>
(
val
);
visitor
->
Int
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_UINT
:
{
auto
tval
=
*
reinterpret_cast
<
const
uint32_t
*
>
(
val
);
auto
tval
=
ReadScalar
<
uint32_t
>
(
val
);
visitor
->
UInt
(
tval
,
EnumName
(
tval
,
type_table
));
break
;
}
case
ET_LONG
:
{
visitor
->
Long
(
*
reinterpret_cast
<
const
int64_t
*
>
(
val
));
visitor
->
Long
(
ReadScalar
<
int64_t
>
(
val
));
break
;
}
case
ET_ULONG
:
{
visitor
->
ULong
(
*
reinterpret_cast
<
const
uint64_t
*
>
(
val
));
visitor
->
ULong
(
ReadScalar
<
uint64_t
>
(
val
));
break
;
}
case
ET_FLOAT
:
{
visitor
->
Float
(
*
reinterpret_cast
<
const
float
*
>
(
val
));
visitor
->
Float
(
ReadScalar
<
float
>
(
val
));
break
;
}
case
ET_DOUBLE
:
{
visitor
->
Double
(
*
reinterpret_cast
<
const
double
*
>
(
val
));
visitor
->
Double
(
ReadScalar
<
double
>
(
val
));
break
;
}
case
ET_STRING
:
{
...
...
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