mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
* Base.cpp : extract gzip classes to separate file
This commit is contained in:
parent
10f3690ede
commit
6350f5e6e8
9 changed files with 158 additions and 132 deletions
36
Base.h
36
Base.h
|
@ -4,7 +4,6 @@
|
|||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <zlib.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace i2p
|
||||
|
@ -93,41 +92,6 @@ namespace data
|
|||
uint64_t ll[sz/8];
|
||||
};
|
||||
};
|
||||
|
||||
const size_t GZIP_CHUNK_SIZE = 16384;
|
||||
class GzipInflator
|
||||
{
|
||||
public:
|
||||
|
||||
GzipInflator ();
|
||||
~GzipInflator ();
|
||||
|
||||
size_t Inflate (const uint8_t * in, size_t inLen, uint8_t * out, size_t outLen);
|
||||
bool Inflate (const uint8_t * in, size_t inLen, std::ostream& s);
|
||||
// return true when finshed or error, s failbit will be set in case of error
|
||||
void Inflate (std::istream& in, std::ostream& out);
|
||||
|
||||
private:
|
||||
|
||||
z_stream m_Inflator;
|
||||
bool m_IsDirty;
|
||||
};
|
||||
|
||||
class GzipDeflator
|
||||
{
|
||||
public:
|
||||
|
||||
GzipDeflator ();
|
||||
~GzipDeflator ();
|
||||
|
||||
void SetCompressionLevel (int level);
|
||||
size_t Deflate (const uint8_t * in, size_t inLen, uint8_t * out, size_t outLen);
|
||||
|
||||
private:
|
||||
|
||||
z_stream m_Deflator;
|
||||
bool m_IsDirty;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue