Fix memory buffer issues on gcc
This commit is contained in:
parent
872bef51bb
commit
8b3aed1f29
1 changed files with 12 additions and 8 deletions
|
@ -3,6 +3,8 @@
|
|||
#include <string_view>
|
||||
#include <streambuf>
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
#include <cstring>
|
||||
|
||||
enum class Seek {
|
||||
Current,
|
||||
|
@ -39,15 +41,7 @@ struct MemoryBuffer {
|
|||
position = end;
|
||||
}
|
||||
|
||||
template <>
|
||||
void write<std::vector<uint8_t>>(const std::vector<uint8_t>& t) {
|
||||
size_t end = position + (sizeof(uint8_t) * t.size());
|
||||
if(end > data.size())
|
||||
data.resize(end);
|
||||
|
||||
data.insert(data.begin() + position, t.begin(), t.end());
|
||||
position = end;
|
||||
}
|
||||
|
||||
size_t size() const {
|
||||
return data.size();
|
||||
|
@ -63,6 +57,16 @@ private:
|
|||
size_t position = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
void MemoryBuffer::write<std::vector<uint8_t>>(const std::vector<uint8_t>& t) {
|
||||
size_t end = position + (sizeof(uint8_t) * t.size());
|
||||
if(end > data.size())
|
||||
data.resize(end);
|
||||
|
||||
data.insert(data.begin() + position, t.begin(), t.end());
|
||||
position = end;
|
||||
}
|
||||
|
||||
struct MemorySpan {
|
||||
MemorySpan(const MemoryBuffer& new_buffer) : buffer(new_buffer) {}
|
||||
|
||||
|
|
Reference in a new issue