X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/031fcd433e233cf31c4ee732883940d9b8c8165a..9165bd32b76293816e266e9181cc9b9cbc103fba:/src/clave_variable.cpp diff --git a/src/clave_variable.cpp b/src/clave_variable.cpp index c97b9d9..4479a15 100644 --- a/src/clave_variable.cpp +++ b/src/clave_variable.cpp @@ -124,12 +124,24 @@ std::string ClaveVariable::abreviar(std::string &p, std::string &a, int &iguales uchar *ClaveVariable::ToRaw (uint &size) const { - uchar *out; - size = raw_data.size ()*sizeof (uchar)+sizeof (uint); - uint len = raw_data.size (); - out = new uchar[size]; - memcpy (out, &len, sizeof (uint)); - memcpy (out+sizeof(uint), raw_data.c_str (), raw_data.size ()*sizeof (uchar)); + std::stringstream ss; + + ss << "["; + ss << data.size (); + ss << "]"; + ss << "["; + ss << raw_data; + ss << "]"; + ss << "["; + ss << block_data; + ss << "]"; + + std::string s = ss.str (); + + uchar *out = new uchar[s.size ()]; + memcpy (out, s.c_str (), s.size ()); + + size = s.size (); return out; }