Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-flatbuffers
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fuchsia-mirror
fuchsia.googlesource.com-third_party-flatbuffers
Commits
fadb71f2
Commit
fadb71f2
authored
10 years ago
by
Wouter van Oortmerssen
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fixed various compiler warnings (most related to a 64bit size_t)." into ub-games-master
parents
ad84a663
aab06c6b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/flatbuffers/flatbuffers.h
+9
-9
9 additions, 9 deletions
include/flatbuffers/flatbuffers.h
tests/test.cpp
+2
-2
2 additions, 2 deletions
tests/test.cpp
with
11 additions
and
11 deletions
include/flatbuffers/flatbuffers.h
+
9
−
9
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
...
...
This diff is collapsed.
Click to expand it.
tests/test.cpp
+
2
−
2
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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment