Skip to content
Snippets Groups Projects
Commit fadb71f2 authored by Wouter van Oortmerssen's avatar Wouter van Oortmerssen Committed by Android (Google) Code Review
Browse files

Merge "Fixed various compiler warnings (most related to a 64bit size_t)." into ub-games-master

parents ad84a663 aab06c6b
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment