2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-29 16:30:53 +00:00

more dll exports

git-svn-id: svn+q:///qpdf/trunk@697 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-09-26 15:15:33 +00:00
parent b6af616dea
commit 492db82f6f
20 changed files with 130 additions and 6 deletions

View File

@ -27,14 +27,19 @@
class Pl_Buffer: public Pipeline
{
public:
DLL_EXPORT
Pl_Buffer(char const* identifier, Pipeline* next = 0);
DLL_EXPORT
virtual ~Pl_Buffer();
DLL_EXPORT
virtual void write(unsigned char*, int);
DLL_EXPORT
virtual void finish();
// Each call to getBuffer() resets this object -- see notes above.
// The caller is responsible for deleting the returned Buffer
// object.
DLL_EXPORT
Buffer* getBuffer();
private:

View File

@ -6,6 +6,7 @@
#define BITS_READ 1
#include "bits.icc"
DLL_EXPORT
BitStream::BitStream(unsigned char const* p, int nbytes) :
start(p),
nbytes(nbytes)
@ -13,6 +14,7 @@ BitStream::BitStream(unsigned char const* p, int nbytes) :
reset();
}
DLL_EXPORT
void
BitStream::reset()
{
@ -21,6 +23,7 @@ BitStream::reset()
bits_available = 8 * nbytes;
}
DLL_EXPORT
unsigned long
BitStream::getBits(int nbits)
{
@ -28,6 +31,7 @@ BitStream::getBits(int nbits)
this->bits_available, nbits);
}
DLL_EXPORT
void
BitStream::skipToNextByte()
{

View File

@ -6,6 +6,7 @@
#define BITS_WRITE 1
#include "bits.icc"
DLL_EXPORT
BitWriter::BitWriter(Pipeline* pl) :
pl(pl),
ch(0),
@ -13,12 +14,14 @@ BitWriter::BitWriter(Pipeline* pl) :
{
}
DLL_EXPORT
void
BitWriter::writeBits(unsigned long val, int bits)
{
write_bits(this->ch, this->bit_offset, val, bits, this->pl);
}
DLL_EXPORT
void
BitWriter::flush()
{

View File

@ -295,16 +295,19 @@ void MD5::decode(UINT4 *output, unsigned char *input, unsigned int len)
// Public functions
DLL_EXPORT
MD5::MD5()
{
init();
}
DLL_EXPORT
void MD5::reset()
{
init();
}
DLL_EXPORT
void MD5::encodeString(char const* str)
{
unsigned int len = strlen(str);
@ -313,16 +316,19 @@ void MD5::encodeString(char const* str)
final();
}
DLL_EXPORT
void MD5::appendString(char const* input_string)
{
update((unsigned char *)input_string, strlen(input_string));
}
DLL_EXPORT
void MD5::encodeDataIncrementally(char const* data, int len)
{
update((unsigned char *)data, len);
}
DLL_EXPORT
void MD5::encodeFile(char const *filename, int up_to_size)
throw (QEXC::System)
{
@ -366,12 +372,14 @@ void MD5::encodeFile(char const *filename, int up_to_size)
final();
}
DLL_EXPORT
void MD5::digest(Digest result)
{
final();
memcpy(result, digest_val, sizeof(digest_val));
}
DLL_EXPORT
void MD5::print()
{
final();
@ -384,6 +392,7 @@ void MD5::print()
printf("\n");
}
DLL_EXPORT
std::string MD5::unparse()
{
final();
@ -399,6 +408,7 @@ std::string MD5::unparse()
return result;
}
DLL_EXPORT
std::string
MD5::getDataChecksum(char const* buf, int len)
{
@ -407,6 +417,7 @@ MD5::getDataChecksum(char const* buf, int len)
return m.unparse();
}
DLL_EXPORT
std::string
MD5::getFileChecksum(char const* filename, int up_to_size)
{
@ -415,6 +426,7 @@ MD5::getFileChecksum(char const* filename, int up_to_size)
return m.unparse();
}
DLL_EXPORT
bool
MD5::checkDataChecksum(char const* const checksum,
char const* buf, int len)
@ -423,6 +435,7 @@ MD5::checkDataChecksum(char const* const checksum,
return (checksum == actual_checksum);
}
DLL_EXPORT
bool
MD5::checkFileChecksum(char const* const checksum,
char const* filename, int up_to_size)

View File

@ -5,31 +5,37 @@
#include <iostream>
#include <string.h>
DLL_EXPORT
PCRE::Exception::Exception(std::string const& message)
{
this->setMessage("PCRE error: " + message);
}
DLL_EXPORT
PCRE::NoBackref::NoBackref() :
Exception("no match")
{
}
DLL_EXPORT
PCRE::Match::Match(int nbackrefs, char const* subject)
{
this->init(-1, nbackrefs, subject);
}
DLL_EXPORT
PCRE::Match::~Match()
{
this->destroy();
}
DLL_EXPORT
PCRE::Match::Match(Match const& rhs)
{
this->copy(rhs);
}
DLL_EXPORT
PCRE::Match&
PCRE::Match::operator=(Match const& rhs)
{
@ -72,12 +78,13 @@ PCRE::Match::destroy()
delete [] this->ovector;
}
DLL_EXPORT
PCRE::Match::operator bool()
{
return (this->nmatches >= 0);
}
DLL_EXPORT
std::string
PCRE::Match::getMatch(int n, int flags)
throw(QEXC::General, Exception)
@ -107,6 +114,7 @@ PCRE::Match::getMatch(int n, int flags)
return std::string(this->subject).substr(offset, length);
}
DLL_EXPORT
void
PCRE::Match::getOffsetLength(int n, int& offset, int& length) throw(Exception)
{
@ -120,7 +128,7 @@ PCRE::Match::getOffsetLength(int n, int& offset, int& length) throw(Exception)
length = this->ovector[n * 2 + 1] - offset;
}
DLL_EXPORT
int
PCRE::Match::getOffset(int n) throw(Exception)
{
@ -130,7 +138,7 @@ PCRE::Match::getOffset(int n) throw(Exception)
return offset;
}
DLL_EXPORT
int
PCRE::Match::getLength(int n) throw(Exception)
{
@ -140,13 +148,14 @@ PCRE::Match::getLength(int n) throw(Exception)
return length;
}
DLL_EXPORT
int
PCRE::Match::nMatches() const
{
return this->nmatches;
}
DLL_EXPORT
PCRE::PCRE(char const* pattern, int options) throw (PCRE::Exception)
{
char const *errptr;
@ -166,11 +175,13 @@ PCRE::PCRE(char const* pattern, int options) throw (PCRE::Exception)
}
}
DLL_EXPORT
PCRE::~PCRE()
{
pcre_free(this->code);
}
DLL_EXPORT
PCRE::Match
PCRE::match(char const* subject, int options, int startoffset, int size)
throw (QEXC::General, Exception)
@ -219,6 +230,7 @@ PCRE::match(char const* subject, int options, int startoffset, int size)
return result;
}
DLL_EXPORT
void
PCRE::test(int n)
{

View File

@ -4,6 +4,7 @@
#include <string.h>
#include <ctype.h>
DLL_EXPORT
Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
pos(0),
@ -12,10 +13,12 @@ Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) :
strcpy(this->inbuf, "00");
}
DLL_EXPORT
Pl_ASCIIHexDecoder::~Pl_ASCIIHexDecoder()
{
}
DLL_EXPORT
void
Pl_ASCIIHexDecoder::write(unsigned char* buf, int len)
{
@ -100,6 +103,7 @@ Pl_ASCIIHexDecoder::flush()
strcpy(this->inbuf, "00");
}
DLL_EXPORT
void
Pl_ASCIIHexDecoder::finish()
{

View File

@ -4,6 +4,7 @@
#include <assert.h>
#include <string.h>
DLL_EXPORT
Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
ready(false),
@ -11,10 +12,12 @@ Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
{
}
DLL_EXPORT
Pl_Buffer::~Pl_Buffer()
{
}
DLL_EXPORT
void
Pl_Buffer::write(unsigned char* buf, int len)
{
@ -30,6 +33,7 @@ Pl_Buffer::write(unsigned char* buf, int len)
}
}
DLL_EXPORT
void
Pl_Buffer::finish()
{
@ -40,6 +44,7 @@ Pl_Buffer::finish()
}
}
DLL_EXPORT
Buffer*
Pl_Buffer::getBuffer()
{

View File

@ -5,6 +5,7 @@
#include <string.h>
#include <assert.h>
DLL_EXPORT
Pl_LZWDecoder::Pl_LZWDecoder(char const* identifier, Pipeline* next,
bool early_code_change) :
Pipeline(identifier, next),
@ -20,11 +21,12 @@ Pl_LZWDecoder::Pl_LZWDecoder(char const* identifier, Pipeline* next,
memset(buf, 0, 3);
}
DLL_EXPORT
Pl_LZWDecoder::~Pl_LZWDecoder()
{
}
DLL_EXPORT
void
Pl_LZWDecoder::write(unsigned char* bytes, int len)
{
@ -43,6 +45,7 @@ Pl_LZWDecoder::write(unsigned char* bytes, int len)
}
}
DLL_EXPORT
void
Pl_LZWDecoder::finish()
{

View File

@ -3,16 +3,19 @@
#include <qpdf/QEXC.hh>
DLL_EXPORT
Pl_MD5::Pl_MD5(char const* identifier, Pipeline* next) :
Pipeline(identifier, next),
in_progress(false)
{
}
DLL_EXPORT
Pl_MD5::~Pl_MD5()
{
}
DLL_EXPORT
void
Pl_MD5::write(unsigned char* buf, int len)
{
@ -25,6 +28,7 @@ Pl_MD5::write(unsigned char* buf, int len)
this->getNext()->write(buf, len);
}
DLL_EXPORT
void
Pl_MD5::finish()
{
@ -32,6 +36,7 @@ Pl_MD5::finish()
this->in_progress = false;
}
DLL_EXPORT
std::string
Pl_MD5::getHexDigest()
{

View File

@ -2,6 +2,7 @@
#include <qpdf/Pl_PNGFilter.hh>
#include <string.h>
DLL_EXPORT
Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next,
action_e action, unsigned int columns,
unsigned int bytes_per_pixel) :
@ -22,12 +23,14 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next,
this->incoming = (action == a_encode ? columns : columns + 1);
}
DLL_EXPORT
Pl_PNGFilter::~Pl_PNGFilter()
{
delete [] buf1;
delete [] buf2;
}
DLL_EXPORT
void
Pl_PNGFilter::write(unsigned char* data, int len)
{
@ -129,6 +132,7 @@ Pl_PNGFilter::encodeRow()
}
}
DLL_EXPORT
void
Pl_PNGFilter::finish()
{

View File

@ -3,6 +3,7 @@
#include <qpdf/QUtil.hh>
DLL_EXPORT
Pl_RC4::Pl_RC4(char const* identifier, Pipeline* next,
unsigned char const* key_data, int key_len,
int out_bufsize) :
@ -13,6 +14,7 @@ Pl_RC4::Pl_RC4(char const* identifier, Pipeline* next,
this->outbuf = new unsigned char[out_bufsize];
}
DLL_EXPORT
Pl_RC4::~Pl_RC4()
{
if (this->outbuf)
@ -22,6 +24,7 @@ Pl_RC4::~Pl_RC4()
}
}
DLL_EXPORT
void
Pl_RC4::write(unsigned char* data, int len)
{
@ -45,6 +48,7 @@ Pl_RC4::write(unsigned char* data, int len)
}
}
DLL_EXPORT
void
Pl_RC4::finish()
{

View File

@ -6,9 +6,13 @@
class BitStream
{
public:
DLL_EXPORT
BitStream(unsigned char const* p, int nbytes);
DLL_EXPORT
void reset();
DLL_EXPORT
unsigned long getBits(int nbits);
DLL_EXPORT
void skipToNextByte();
private:

View File

@ -10,9 +10,12 @@ class BitWriter
public:
// Write bits to the pipeline. It is the caller's responsibility
// to eventually call finish on the pipeline.
DLL_EXPORT
BitWriter(Pipeline* pl);
DLL_EXPORT
void writeBits(unsigned long val, int bits);
// Force any partial byte to be written to the pipeline.
DLL_EXPORT
void flush();
private:

View File

@ -14,37 +14,50 @@ class MD5
public:
typedef unsigned char Digest[16];
DLL_EXPORT
MD5();
DLL_EXPORT
void reset();
// encodes string and finalizes
DLL_EXPORT
void encodeString(char const* input_string);
// encodes file and finalizes
DLL_EXPORT
void encodeFile(char const* filename, int up_to_size = -1)
throw(QEXC::System);
// appends string to current md5 object
DLL_EXPORT
void appendString(char const* input_string);
// appends arbitrary data to current md5 object
DLL_EXPORT
void encodeDataIncrementally(char const* input_data, int len);
// computes a raw digest
DLL_EXPORT
void digest(Digest);
// prints the digest to stdout terminated with \r\n (primarily for
// testing)
DLL_EXPORT
void print();
// returns the digest as a hexadecimal string
DLL_EXPORT
std::string unparse();
// Convenience functions
DLL_EXPORT
static std::string getDataChecksum(char const* buf, int len);
DLL_EXPORT
static std::string getFileChecksum(char const* filename, int up_to_size = -1);
DLL_EXPORT
static bool checkDataChecksum(char const* const checksum,
char const* buf, int len);
DLL_EXPORT
static bool checkFileChecksum(char const* const checksum,
char const* filename, int up_to_size = -1);

View File

@ -22,7 +22,9 @@ class PCRE
class Exception: public QEXC::General
{
public:
DLL_EXPORT
Exception(std::string const& message);
DLL_EXPORT
virtual ~Exception() throw() {}
};
@ -31,7 +33,9 @@ class PCRE
class NoBackref: public Exception
{
public:
DLL_EXPORT
NoBackref();
DLL_EXPORT
virtual ~NoBackref() throw() {}
};
@ -39,10 +43,15 @@ class PCRE
{
friend class PCRE;
public:
DLL_EXPORT
Match(int nbackrefs, char const* subject);
DLL_EXPORT
Match(Match const&);
DLL_EXPORT
Match& operator=(Match const&);
DLL_EXPORT
~Match();
DLL_EXPORT
operator bool();
// All the back reference accessing routines may throw the
@ -54,10 +63,14 @@ class PCRE
// and not matching at all.
// see getMatch flags below
DLL_EXPORT
std::string getMatch(int n, int flags = 0)
throw(QEXC::General, Exception);
DLL_EXPORT
void getOffsetLength(int n, int& offset, int& length) throw(Exception);
DLL_EXPORT
int getOffset(int n) throw(Exception);
DLL_EXPORT
int getLength(int n) throw(Exception);
// nMatches returns the number of available matches including
@ -67,6 +80,7 @@ class PCRE
// will return the whole string, getMatch(1) will return the
// text that matched the backreference, and getMatch(2) will
// throw an exception because it is out of range.
DLL_EXPORT
int nMatches() const;
// Flags for getMatch
@ -89,13 +103,17 @@ class PCRE
// The value passed in as options is passed to pcre_exec. See man
// pcreapi for details.
DLL_EXPORT
PCRE(char const* pattern, int options = 0) throw(Exception);
DLL_EXPORT
~PCRE();
DLL_EXPORT
Match match(char const* subject, int options = 0, int startoffset = 0,
int size = -1)
throw(QEXC::General, Exception);
DLL_EXPORT
static void test(int n = 0);
private:

View File

@ -7,9 +7,13 @@
class Pl_ASCIIHexDecoder: public Pipeline
{
public:
DLL_EXPORT
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
DLL_EXPORT
virtual ~Pl_ASCIIHexDecoder();
DLL_EXPORT
virtual void write(unsigned char* buf, int len);
DLL_EXPORT
virtual void finish();
private:

View File

@ -10,10 +10,14 @@
class Pl_LZWDecoder: public Pipeline
{
public:
DLL_EXPORT
Pl_LZWDecoder(char const* identifier, Pipeline* next,
bool early_code_change);
DLL_EXPORT
virtual ~Pl_LZWDecoder();
DLL_EXPORT
virtual void write(unsigned char* buf, int len);
DLL_EXPORT
virtual void finish();
private:

View File

@ -16,10 +16,15 @@
class Pl_MD5: public Pipeline
{
public:
DLL_EXPORT
Pl_MD5(char const* identifier, Pipeline* next);
DLL_EXPORT
virtual ~Pl_MD5();
DLL_EXPORT
virtual void write(unsigned char*, int);
DLL_EXPORT
virtual void finish();
DLL_EXPORT
std::string getHexDigest();
private:

View File

@ -1,4 +1,3 @@
#ifndef __PL_PNGFILTER_HH__
#define __PL_PNGFILTER_HH__
@ -23,11 +22,13 @@ class Pl_PNGFilter: public Pipeline
class Exception: public Pipeline::Exception
{
public:
DLL_EXPORT
Exception(std::string const& message) :
Pipeline::Exception(message)
{
}
DLL_EXPORT
virtual ~Exception() throw ()
{
}
@ -36,12 +37,16 @@ class Pl_PNGFilter: public Pipeline
// Encoding is not presently supported
enum action_e { a_encode, a_decode };
DLL_EXPORT
Pl_PNGFilter(char const* identifier, Pipeline* next,
action_e action, unsigned int columns,
unsigned int bytes_per_pixel);
DLL_EXPORT
virtual ~Pl_PNGFilter();
DLL_EXPORT
virtual void write(unsigned char* data, int len);
DLL_EXPORT
virtual void finish();
private:

View File

@ -12,11 +12,13 @@ class Pl_RC4: public Pipeline
class Exception: public Pipeline::Exception
{
public:
DLL_EXPORT
Exception(std::string const& message) :
Pipeline::Exception(message)
{
}
DLL_EXPORT
virtual ~Exception() throw()
{
}
@ -25,12 +27,16 @@ class Pl_RC4: public Pipeline
static int const def_bufsize = 65536;
// key_len of -1 means treat key_data as a null-terminated string
DLL_EXPORT
Pl_RC4(char const* identifier, Pipeline* next,
unsigned char const* key_data, int key_len = -1,
int out_bufsize = def_bufsize);
DLL_EXPORT
virtual ~Pl_RC4();
DLL_EXPORT
virtual void write(unsigned char* data, int len);
DLL_EXPORT
virtual void finish();
private: