Fix ArgBuffer String Serialization (#999)
This commit is contained in:
parent
e1648ba8f9
commit
9cd2a74271
@ -37,7 +37,7 @@
|
|||||||
template <typename T, typename...Rest>
|
template <typename T, typename...Rest>
|
||||||
class ArgBuffer {
|
class ArgBuffer {
|
||||||
public:
|
public:
|
||||||
ArgBuffer(T t, Rest... rest) {
|
ArgBuffer(const T& t, const Rest&... rest) {
|
||||||
unsigned char *ptr = buff;
|
unsigned char *ptr = buff;
|
||||||
buildbuffer(&ptr, t, rest...);
|
buildbuffer(&ptr, t, rest...);
|
||||||
}
|
}
|
||||||
@ -60,13 +60,13 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename K>
|
template <typename K>
|
||||||
void buildbuffer(unsigned char **ptr, K k) {
|
void buildbuffer(unsigned char **ptr, K& k) {
|
||||||
memcpy(*ptr, &k, sizeof(k));
|
memcpy(*ptr, &k, sizeof(k));
|
||||||
*ptr += sizeof(K);
|
*ptr += sizeof(K);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename K, typename... Kn>
|
template <typename K, typename... Kn>
|
||||||
void buildbuffer(unsigned char **ptr, K k, Kn... kn) {
|
void buildbuffer(unsigned char **ptr, K& k, Kn&... kn) {
|
||||||
buildbuffer(ptr, k);
|
buildbuffer(ptr, k);
|
||||||
if (sizeof...(kn)!=0)
|
if (sizeof...(kn)!=0)
|
||||||
buildbuffer(ptr, kn...);
|
buildbuffer(ptr, kn...);
|
||||||
|
Loading…
Reference in New Issue
Block a user