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
fadb71f2
Commit
fadb71f2
authored
Jun 19, 2014
by
Wouter van Oortmerssen
Committed by
Android (Google) Code Review
Jun 19, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Fixed various compiler warnings (most related to a 64bit size_t)." into ub-games-master
parents
ad84a663
aab06c6b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
flatbuffers.h
include/flatbuffers/flatbuffers.h
+9
-9
test.cpp
tests/test.cpp
+2
-2
No files found.
include/flatbuffers/flatbuffers.h
View file @
fadb71f2
...
...
@@ -193,7 +193,7 @@ struct String : public Vector<char> {
// in the lowest address in the vector.
class
vector_downward
{
public
:
explicit
vector_downward
(
uoffset
_t
initial_size
)
explicit
vector_downward
(
size
_t
initial_size
)
:
reserved_
(
initial_size
),
buf_
(
new
uint8_t
[
reserved_
]),
cur_
(
buf_
+
reserved_
)
{
...
...
@@ -204,11 +204,11 @@ class vector_downward {
void
clear
()
{
cur_
=
buf_
+
reserved_
;
}
uoffset_t
growth_policy
(
uoffset
_t
size
)
{
size_t
growth_policy
(
size
_t
size
)
{
return
(
size
/
2
)
&
~
(
sizeof
(
largest_scalar_t
)
-
1
);
}
uint8_t
*
make_space
(
uoffset
_t
len
)
{
uint8_t
*
make_space
(
size
_t
len
)
{
if
(
buf_
>
cur_
-
len
)
{
auto
old_size
=
size
();
reserved_
+=
std
::
max
(
len
,
growth_policy
(
reserved_
));
...
...
@@ -232,7 +232,7 @@ class vector_downward {
uint8_t
*
data
()
const
{
return
cur_
;
}
uint8_t
*
data_at
(
uoffset
_t
offset
)
{
return
buf_
+
reserved_
-
offset
;
}
uint8_t
*
data_at
(
size
_t
offset
)
{
return
buf_
+
reserved_
-
offset
;
}
// push() & fill() are most frequently called with small byte counts (<= 4),
// which is why we're using loops rather than calling memcpy/memset.
...
...
@@ -249,7 +249,7 @@ class vector_downward {
void
pop
(
size_t
bytes_to_remove
)
{
cur_
+=
bytes_to_remove
;
}
private
:
uoffset
_t
reserved_
;
size
_t
reserved_
;
uint8_t
*
buf_
;
uint8_t
*
cur_
;
// Points at location between empty (below) and used (above).
};
...
...
@@ -282,10 +282,10 @@ class FlatBufferBuilder {
vtables_
.
reserve
(
16
);
EndianCheck
();
flatbuffer_version_string
=
"FlatBuffers "
FLATBUFFERS_STRING
(
FLATBUFFERS_VERSION_MAJOR
)
"."
FLATBUFFERS_STRING
(
FLATBUFFERS_VERSION_MINOR
)
"."
FLATBUFFERS_STRING
(
FLATBUFFERS_VERSION_REVISION
);
"FlatBuffers "
FLATBUFFERS_STRING
(
FLATBUFFERS_VERSION_MAJOR
)
"."
FLATBUFFERS_STRING
(
FLATBUFFERS_VERSION_MINOR
)
"."
FLATBUFFERS_STRING
(
FLATBUFFERS_VERSION_REVISION
);
}
// Reset all the state in this FlatBufferBuilder so it can be reused
...
...
tests/test.cpp
View file @
fadb71f2
...
...
@@ -47,8 +47,8 @@ void TestEq(T expval, U val, const char *exp, const char *file, int line) {
}
}
#define TEST_EQ(exp, val) TestEq(
exp,
val, #exp, __FILE__, __LINE__)
#define TEST_NOTNULL(exp) TestEq(
!exp
, false, #exp, __FILE__, __LINE__)
#define TEST_EQ(exp, val) TestEq(
exp,
val, #exp, __FILE__, __LINE__)
#define TEST_NOTNULL(exp) TestEq(
exp == NULL
, false, #exp, __FILE__, __LINE__)
// Include simple random number generator to ensure results will be the
// same cross platform.
...
...
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