File tree Expand file tree Collapse file tree
lang/c++/include/avro/buffer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020#define avro_BufferReader_hh__
2121
2222#include " Buffer.hh"
23+ #include < cstring>
2324#include < type_traits>
2425
2526#ifdef min
@@ -233,7 +234,7 @@ private:
233234 }
234235
235236 if (sizeof (T) <= chunkRemaining ()) {
236- val = *( reinterpret_cast < const T *>( addr ()));
237+ memcpy (& val, addr (), sizeof (T ));
237238 incrementChunk (sizeof (T));
238239 } else {
239240 read (reinterpret_cast <data_type *>(&val), sizeof (T));
Original file line number Diff line number Diff line change 2020#define avro_BufferDetail_hh__
2121
2222#include < cassert>
23+ #include < cstring>
2324#include < deque>
2425#include < exception>
2526#include < functional>
@@ -320,7 +321,7 @@ public:
320321 if (freeSpace_ && (sizeof (T) <= writeChunks_.front ().freeSize ())) {
321322 // fast path, there's enough room in the writeable chunk to just
322323 // straight out copy it
323- *( reinterpret_cast <T *>( writeChunks_.front ().tellWritePos ())) = val;
324+ memcpy ( writeChunks_.front ().tellWritePos (), & val, sizeof (T)) ;
324325 postWrite (sizeof (T));
325326 } else {
326327 // need to fixup chunks first, so use the regular memcpy
You can’t perform that action at this time.
0 commit comments