diff options
author | George Hazan <george.hazan@gmail.com> | 2014-04-01 14:58:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-04-01 14:58:49 +0000 |
commit | 024c7fb409dc9b0c921a41a89a411496a17b0f70 (patch) | |
tree | cc68c2501bbbbfb9975c743b2daf1a4674ece016 /plugins/CryptoPP/src/cpp_gzip.cpp | |
parent | 41b55005fb074c35e5a62f8e8155c4be6edc2f22 (diff) |
CryptoPP: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@8813 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/cpp_gzip.cpp')
-rw-r--r-- | plugins/CryptoPP/src/cpp_gzip.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/plugins/CryptoPP/src/cpp_gzip.cpp b/plugins/CryptoPP/src/cpp_gzip.cpp index 36a4ae7e20..41183d3eb5 100644 --- a/plugins/CryptoPP/src/cpp_gzip.cpp +++ b/plugins/CryptoPP/src/cpp_gzip.cpp @@ -1,41 +1,40 @@ #include "commonheaders.h"
// gzip data
-BYTE *cpp_gzip(BYTE *pData, size_t nLen, size_t& nCompressedLen) {
-
+BYTE *cpp_gzip(BYTE *pData, size_t nLen, size_t& nCompressedLen)
+{
string zipped;
- Gzip gzip(new StringSink(zipped),5); // 1 is fast, 9 is slow
+ Gzip gzip(new StringSink(zipped), 5); // 1 is fast, 9 is slow
gzip.Put(pData, nLen);
gzip.MessageEnd();
- nCompressedLen = (int) zipped.length();
- PBYTE pCompressed = (PBYTE) malloc(nCompressedLen+1);
- memcpy(pCompressed,zipped.data(),nCompressedLen);
+ nCompressedLen = (int)zipped.length();
+ PBYTE pCompressed = (PBYTE)malloc(nCompressedLen + 1);
+ memcpy(pCompressed, zipped.data(), nCompressedLen);
return pCompressed;
}
// gunzip data
-BYTE *cpp_gunzip(BYTE *pCompressedData, size_t nCompressedLen, size_t& nLen) {
-
+BYTE *cpp_gunzip(BYTE *pCompressedData, size_t nCompressedLen, size_t& nLen)
+{
string unzipped;
Gunzip gunzip(new StringSink(unzipped));
- gunzip.Put((PBYTE)pCompressedData,nCompressedLen);
+ gunzip.Put((PBYTE)pCompressedData, nCompressedLen);
gunzip.MessageEnd();
- nLen = (int) unzipped.length();
- PBYTE pData = (PBYTE) malloc(nLen+1);
- memcpy(pData,unzipped.data(),nLen);
+ nLen = (int)unzipped.length();
+ PBYTE pData = (PBYTE)malloc(nLen + 1);
+ memcpy(pData, unzipped.data(), nLen);
return pData;
}
// zlibc data
-string cpp_zlibc(string& pData) {
-
+string cpp_zlibc(string& pData)
+{
string zipped;
-
- ZlibCompressor zlib(new StringSink(zipped),5); // 1 is fast, 9 is slow
+ ZlibCompressor zlib(new StringSink(zipped), 5); // 1 is fast, 9 is slow
zlib.Put((PBYTE)pData.data(), pData.length());
zlib.MessageEnd();
@@ -43,15 +42,12 @@ string cpp_zlibc(string& pData) { }
// zlibd data
-string cpp_zlibd(string& pData) {
-
+string cpp_zlibd(string& pData)
+{
string unzipped;
-
ZlibDecompressor zlib(new StringSink(unzipped));
- zlib.Put((PBYTE)pData.data(),pData.length());
+ zlib.Put((PBYTE)pData.data(), pData.length());
zlib.MessageEnd();
return unzipped;
}
-
-// EOF
|