mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-26 21:03:57 +00:00
Helper function for appending more memory to a memory_c
This commit is contained in:
parent
87ee67fc50
commit
36e77f8468
@ -34,6 +34,17 @@ memory_c::resize(size_t new_size) throw() {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
memory_c::add(unsigned char *new_buffer,
|
||||
size_t new_size) {
|
||||
if ((0 == new_size) || (NULL == new_buffer))
|
||||
return;
|
||||
|
||||
size_t previous_size = get_size();
|
||||
resize(previous_size + new_size);
|
||||
memcpy(get_buffer() + previous_size, new_buffer, new_size);
|
||||
}
|
||||
|
||||
memory_cptr
|
||||
lace_memory_xiph(const std::vector<memory_cptr> &blocks) {
|
||||
size_t i, size = 1;
|
||||
|
@ -138,6 +138,10 @@ public:
|
||||
}
|
||||
|
||||
void resize(size_t new_size) throw();
|
||||
void add(unsigned char *new_buffer, size_t new_size);
|
||||
void add(memory_cptr &new_buffer) {
|
||||
add(new_buffer->get_buffer(), new_buffer->get_size());
|
||||
}
|
||||
|
||||
operator const unsigned char *() const {
|
||||
return its_counter ? its_counter->ptr : NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user