X-Git-Url: https://git.llucax.com/z.facultad/75.52/treemulator.git/blobdiff_plain/59b7476481f01388fcfd13492adbba7ef841755c..f4eaa9c2418b7084cb973100495fb8290e1c4075:/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; }