fix in encoder

This commit is contained in:
Martin Bauer 2020-06-07 14:16:40 +02:00
parent 5558151c91
commit e929c8d3d4
1 changed files with 10 additions and 10 deletions

View File

@ -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<T>::CODE, 1);
writer->write((const char*)&value, sizeof(T));
writer->write((uint8_t*)(&TypeToMsgPackCode<T>::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<T>::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<T>::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;
}