Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void compressLZ4(const std::string &source, std::string &dest)
- {
- int str_s = source.size();
- char* buffer = new char[LZ4_compressBound(str_s)];
- int s = LZ4_compress(source.c_str(), buffer, str_s);
- dest = std::string(buffer,s);
- delete [] buffer;
- }
- void decompressLZ4(const std::string &source, std::string &dest)
- {
- int maxLZ4bufferSize = source.size() * 255;
- char* buffer = new char[maxLZ4bufferSize];
- int s = LZ4_decompress_safe(source.c_str(), buffer,
- source.size(), maxLZ4bufferSize);
- dest = std::string(buffer, s);
- delete [] buffer;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement