Fix OS X build

Change-Id: If0465b73843ad1a489fa66318a689801def3f0f0
This commit is contained in:
Stefan Eilemann 2014-07-26 13:12:56 +02:00 committed by Wouter van Oortmerssen
parent 7a99b3c7cb
commit 52f4f4573e
2 changed files with 10 additions and 12 deletions

View File

@ -51,16 +51,14 @@ set(CMAKE_BUILD_TYPE Debug)
# source_group(Compiler FILES ${FlatBuffers_Compiler_SRCS})
# source_group(Tests FILES ${FlatBuffers_Tests_SRCS})
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions("-std=c++0x")
add_definitions("-Wall")
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
add_definitions("-std=c++0x")
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -Wall")
elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall")
endif()
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")
endif()

View File

@ -299,8 +299,8 @@ class vector_downward {
void clear() { cur_ = buf_ + reserved_; }
size_t growth_policy(size_t size) {
return (size / 2) & ~(sizeof(largest_scalar_t) - 1);
size_t growth_policy(size_t bytes) {
return (bytes / 2) & ~(sizeof(largest_scalar_t) - 1);
}
uint8_t *make_space(size_t len) {
@ -331,9 +331,9 @@ class vector_downward {
// push() & fill() are most frequently called with small byte counts (<= 4),
// which is why we're using loops rather than calling memcpy/memset.
void push(const uint8_t *bytes, size_t size) {
auto dest = make_space(size);
for (size_t i = 0; i < size; i++) dest[i] = bytes[i];
void push(const uint8_t *bytes, size_t num) {
auto dest = make_space(num);
for (size_t i = 0; i < num; i++) dest[i] = bytes[i];
}
void fill(size_t zero_pad_bytes) {