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
6d1ff8a5
Commit
6d1ff8a5
authored
Nov 30, 2015
by
Wouter van Oortmerssen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/google/flatbuffers
parents
59dc29a1
6db667b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
flatbuffers.h
include/flatbuffers/flatbuffers.h
+2
-2
No files found.
include/flatbuffers/flatbuffers.h
View file @
6d1ff8a5
...
@@ -379,7 +379,7 @@ template<typename T> static inline size_t VectorLength(const Vector<T> *v) {
...
@@ -379,7 +379,7 @@ template<typename T> static inline size_t VectorLength(const Vector<T> *v) {
struct
String
:
public
Vector
<
char
>
{
struct
String
:
public
Vector
<
char
>
{
const
char
*
c_str
()
const
{
return
reinterpret_cast
<
const
char
*>
(
Data
());
}
const
char
*
c_str
()
const
{
return
reinterpret_cast
<
const
char
*>
(
Data
());
}
std
::
string
str
()
const
{
return
c_str
(
);
}
std
::
string
str
()
const
{
return
std
::
string
(
c_str
(),
Length
()
);
}
bool
operator
<
(
const
String
&
o
)
const
{
bool
operator
<
(
const
String
&
o
)
const
{
return
strcmp
(
c_str
(),
o
.
c_str
())
<
0
;
return
strcmp
(
c_str
(),
o
.
c_str
())
<
0
;
...
@@ -445,7 +445,7 @@ class vector_downward {
...
@@ -445,7 +445,7 @@ class vector_downward {
if
(
len
>
static_cast
<
size_t
>
(
cur_
-
buf_
))
{
if
(
len
>
static_cast
<
size_t
>
(
cur_
-
buf_
))
{
auto
old_size
=
size
();
auto
old_size
=
size
();
auto
largest_align
=
AlignOf
<
largest_scalar_t
>
();
auto
largest_align
=
AlignOf
<
largest_scalar_t
>
();
reserved_
+=
std
::
max
(
len
,
growth_policy
(
reserved_
));
reserved_
+=
(
std
::
max
)
(
len
,
growth_policy
(
reserved_
));
// Round up to avoid undefined behavior from unaligned loads and stores.
// Round up to avoid undefined behavior from unaligned loads and stores.
reserved_
=
(
reserved_
+
(
largest_align
-
1
))
&
~
(
largest_align
-
1
);
reserved_
=
(
reserved_
+
(
largest_align
-
1
))
&
~
(
largest_align
-
1
);
auto
new_buf
=
allocator_
.
allocate
(
reserved_
);
auto
new_buf
=
allocator_
.
allocate
(
reserved_
);
...
...
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