Commit 52f4f457 authored by Stefan Eilemann's avatar Stefan Eilemann Committed by Wouter van Oortmerssen

Fix OS X build

Change-Id: If0465b73843ad1a489fa66318a689801def3f0f0
parent 7a99b3c7
...@@ -51,16 +51,14 @@ set(CMAKE_BUILD_TYPE Debug) ...@@ -51,16 +51,14 @@ set(CMAKE_BUILD_TYPE Debug)
# source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS}) # source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS})
# source_group(Tests FILES ${FlatBuffers_Tests_SRCS}) # source_group(Tests FILES ${FlatBuffers_Tests_SRCS})
if(CMAKE_COMPILER_IS_GNUCXX) if(APPLE)
add_definitions("-std=c++0x") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wall")
add_definitions("-Wall") elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_definitions("-std=c++0x")
endif() endif()
if(FLATBUFFERS_CODE_COVERAGE) if(FLATBUFFERS_CODE_COVERAGE)
add_definitions("-g -fprofile-arcs -ftest-coverage") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
endif() endif()
......
...@@ -299,8 +299,8 @@ class vector_downward { ...@@ -299,8 +299,8 @@ class vector_downward {
void clear() { cur_ = buf_ + reserved_; } void clear() { cur_ = buf_ + reserved_; }
size_t growth_policy(size_t size) { size_t growth_policy(size_t bytes) {
return (size / 2) & ~(sizeof(largest_scalar_t) - 1); return (bytes / 2) & ~(sizeof(largest_scalar_t) - 1);
} }
uint8_t *make_space(size_t len) { uint8_t *make_space(size_t len) {
...@@ -331,9 +331,9 @@ class vector_downward { ...@@ -331,9 +331,9 @@ class vector_downward {
// push() & fill() are most frequently called with small byte counts (<= 4), // push() & fill() are most frequently called with small byte counts (<= 4),
// which is why we're using loops rather than calling memcpy/memset. // which is why we're using loops rather than calling memcpy/memset.
void push(const uint8_t *bytes, size_t size) { void push(const uint8_t *bytes, size_t num) {
auto dest = make_space(size); auto dest = make_space(num);
for (size_t i = 0; i < size; i++) dest[i] = bytes[i]; for (size_t i = 0; i < num; i++) dest[i] = bytes[i];
} }
void fill(size_t zero_pad_bytes) { void fill(size_t zero_pad_bytes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment