mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-16 09:12:22 +00:00
Author: Daniel Lin <danielin@umich.edi> (#4595)
Date: Mon Jan 15 11:38:20 2018 -0200 Compilation failure with grpc.h If cmake run with flag FLATBUFFERS_BUILD_GRPCTEST=ON compilation fails. Fix : -Fix argument list for overriden function in grpc. -Fix member function name called by FlatBufferBuilder from buf() to scratch_data()
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
5cee340ad3
commit
98f681deb0
@@ -370,11 +370,23 @@ class Allocator {
|
||||
size_t in_use_front) {
|
||||
assert(new_size > old_size); // vector_downward only grows
|
||||
uint8_t *new_p = allocate(new_size);
|
||||
memcpy_downward(old_p, old_size, new_p, new_size, in_use_back,
|
||||
in_use_front);
|
||||
deallocate(old_p, old_size);
|
||||
return new_p;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Called by `reallocate_downward` to copy memory from `old_p` of `old_size`
|
||||
// to `new_p` of `new_size`. Only memory of size `in_use_front` and
|
||||
// `in_use_back` will be copied from the front and back of the old memory
|
||||
// allocation.
|
||||
void memcpy_downward(uint8_t *old_p, size_t old_size,
|
||||
uint8_t *new_p, size_t new_size,
|
||||
size_t in_use_back, size_t in_use_front) {
|
||||
memcpy(new_p + new_size - in_use_back, old_p + old_size - in_use_back,
|
||||
in_use_back);
|
||||
memcpy(new_p, old_p, in_use_front);
|
||||
deallocate(old_p, old_size);
|
||||
return new_p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user