2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-23 11:28:56 +00:00
qpdf/libqpdf/qpdf/Pl_RC4.hh
Jay Berkenbilt 6c39aa8763 In shippable code, favor smart pointers (fixes #235)
Use PointerHolder in several places where manually memory allocation
and deallocation were being used. This helps to protect against memory
leaks when exceptions are thrown in surprising places.
2019-06-22 16:57:52 -04:00

33 lines
665 B
C++

#ifndef PL_RC4_HH
#define PL_RC4_HH
#include <qpdf/Pipeline.hh>
#include <qpdf/RC4.hh>
class Pl_RC4: public Pipeline
{
public:
static size_t const def_bufsize = 65536;
// key_len of -1 means treat key_data as a null-terminated string
QPDF_DLL
Pl_RC4(char const* identifier, Pipeline* next,
unsigned char const* key_data, int key_len = -1,
size_t out_bufsize = def_bufsize);
QPDF_DLL
virtual ~Pl_RC4();
QPDF_DLL
virtual void write(unsigned char* data, size_t len);
QPDF_DLL
virtual void finish();
private:
PointerHolder<unsigned char> outbuf;
size_t out_bufsize;
RC4 rc4;
};
#endif // PL_RC4_HH