From e929c8d3d49fa6c5d57f0271026609b006fd1633 Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Sun, 7 Jun 2020 14:16:40 +0200 Subject: [PATCH] fix in encoder --- .../lib/session/StreamingMsgPackEncoder.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/firmware/lib/session/StreamingMsgPackEncoder.h b/firmware/lib/session/StreamingMsgPackEncoder.h index 2ea08b4..82f0343 100644 --- a/firmware/lib/session/StreamingMsgPackEncoder.h +++ b/firmware/lib/session/StreamingMsgPackEncoder.h @@ -52,7 +52,7 @@ public: else { size |= 0b10000000; - writer->write((const char*)(&size), 1); + writer->write((byte*)(&size), 1); } } @@ -71,9 +71,9 @@ public: } else { - writer->write("\xd9", 1); - writer->write((const char*)&castedLen, 1); - writer->write(s, len); + writer->write((uint8_t*)"\xd9", 1); + writer->write((uint8_t*)&castedLen, 1); + writer->write((uint8_t*)s, len); } } @@ -90,8 +90,8 @@ public: value = htonl(value); else if( sizeof(T) == 2) value = htons(value); - writer->write(&TypeToMsgPackCode::CODE, 1); - writer->write((const char*)&value, sizeof(T)); + writer->write((uint8_t*)(&TypeToMsgPackCode::CODE), 1); + writer->write((uint8_t*)&value, sizeof(T)); } } @@ -112,9 +112,9 @@ public: else { uint32_t nlength = htonl(length * sizeof(T)); - writer->write("\xc9", 1); // ext dtype since typed arrays are not supported by msgpack - writer->write((char*)(&nlength), sizeof(uint32_t) ); - writer->write(&TypeToMsgPackCode::CODE, 1); // put code for type here, this is not part of msgpack but custom + writer->write((uint8_t*)("\xc9"), 1); // ext dtype since typed arrays are not supported by msgpack + writer->write((uint8_t*)(&nlength), sizeof(uint32_t) ); + writer->write((uint8_t*)(&TypeToMsgPackCode::CODE), 1); // put code for type here, this is not part of msgpack but custom } } @@ -122,7 +122,7 @@ public: void sendArrayPartialContents(T * data, uint32_t length) { if( !sizeCountMode ) { - writer->write((char*)(data), length * sizeof(T)); + writer->write((uint8_t*)(data), length * sizeof(T)); } else { contentLength += sizeof(T) * length; }