Hide zlib and expat libs from the user of Poco libraries (replaces #4579) (#4724)

* foundation: Remove unused ucp.h

Nothing use this and it is not even included in Visual Studio project
files. Remove it so it will not confuse any more.

* foundation: Hide zlib from user

Hide zlib completly from user. This way we do not need to publish zlib.h
or zconfig.h.

As we now have two different pointer initalizing in constructor I choose
to use unique pointers so it is more obvious those are safe. I also
choose to use make_unique which default initalize z_stream_t. This makes
code more readable as we do not need to specifie every field of
z_stream_t. It really should not matter much if we initialize couple
field for nothing. If does we should add comment about that. Still
keeping _buffer without inializing as it is quite big.

* xml: Hide expat and ParserEngine from user

Hide expat completly from user. This way we do not need to publish
expat.h or expat_external.h.

I move also headers to orignal locations so diff is smaller compared to
original.

* chore(Foundation): Compression level constants

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Matej Kenda 2024-10-04 09:50:39 +02:00 committed by GitHub
parent af3b3b1902
commit aab4058bae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 248 additions and 512 deletions

View File

@ -70,12 +70,6 @@ else()
src/pcre2_xclass.c
)
# zlib
POCO_HEADERS(SRCS zlib
include/Poco/zconf.h
include/Poco/zlib.h
)
POCO_SOURCES(SRCS zlib
src/adler32.c
src/compress.c

View File

@ -22,11 +22,8 @@
#include "Poco/BufferedStreamBuf.h"
#include <istream>
#include <ostream>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#endif
struct z_stream_s;
namespace Poco {
@ -47,6 +44,17 @@ public:
STREAM_GZIP /// Create a gzip header, use CRC-32 checksum.
};
enum CompressionLevel
/// Constants for compression levels.
/// Note to maintainers: These must be kept in sync with the constants
/// defined by zlib.
{
DEFAULT_COMPRESSION = -1,
NO_COMPRESSION = 0,
BEST_SPEED = 1,
BEST_COMPRESSION = 9
};
DeflatingStreamBuf(std::istream& istr, StreamType type, int level);
/// Creates a DeflatingStreamBuf for compressing data read
/// from the given input stream.
@ -89,11 +97,11 @@ private:
DEFLATE_BUFFER_SIZE = 32768
};
std::istream* _pIstr;
std::ostream* _pOstr;
char* _buffer;
z_stream _zstr;
bool _eof;
std::istream* _pIstr;
std::ostream* _pOstr;
char* _buffer;
z_stream_s* _pZstr;
bool _eof;
};
@ -104,7 +112,7 @@ class Foundation_API DeflatingIOS: public virtual std::ios
/// order of the stream buffer and base classes.
{
public:
DeflatingIOS(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
DeflatingIOS(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = DeflatingStreamBuf::DEFAULT_COMPRESSION);
/// Creates a DeflatingIOS for compressing data passed
/// through and forwarding it to the given output stream.
@ -115,7 +123,7 @@ public:
/// Please refer to the zlib documentation of deflateInit2() for a description
/// of the windowBits parameter.
DeflatingIOS(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
DeflatingIOS(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = DeflatingStreamBuf::DEFAULT_COMPRESSION);
/// Creates a DeflatingIOS for compressing data read
/// from the given input stream.
@ -150,7 +158,7 @@ class Foundation_API DeflatingOutputStream: public std::ostream, public Deflatin
/// ostr.close();
{
public:
DeflatingOutputStream(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
DeflatingOutputStream(std::ostream& ostr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = DeflatingStreamBuf::DEFAULT_COMPRESSION);
/// Creates a DeflatingOutputStream for compressing data passed
/// through and forwarding it to the given output stream.
@ -179,7 +187,7 @@ class Foundation_API DeflatingInputStream: public std::istream, public Deflating
/// using zlib's deflate algorithm.
{
public:
DeflatingInputStream(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = Z_DEFAULT_COMPRESSION);
DeflatingInputStream(std::istream& istr, DeflatingStreamBuf::StreamType type = DeflatingStreamBuf::STREAM_ZLIB, int level = DeflatingStreamBuf::DEFAULT_COMPRESSION);
/// Creates a DeflatingIOS for compressing data read
/// from the given input stream.

View File

@ -22,11 +22,8 @@
#include "Poco/BufferedStreamBuf.h"
#include <istream>
#include <ostream>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#endif
struct z_stream_s;
namespace Poco {
@ -92,12 +89,12 @@ private:
INFLATE_BUFFER_SIZE = 32768
};
std::istream* _pIstr;
std::ostream* _pOstr;
char* _buffer;
z_stream _zstr;
bool _eof;
bool _check;
std::istream* _pIstr;
std::ostream* _pOstr;
char* _buffer;
z_stream_s* _pZstr;
bool _eof;
bool _check;
};

View File

@ -16,7 +16,7 @@
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
#include "zlib.h"
#endif

View File

@ -14,6 +14,12 @@
#include "Poco/DeflatingStream.h"
#include "Poco/Exception.h"
#include <memory>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "zlib.h"
#endif
namespace Poco {
@ -25,29 +31,17 @@ DeflatingStreamBuf::DeflatingStreamBuf(std::istream& istr, StreamType type, int
_pOstr(0),
_eof(false)
{
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.total_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
_zstr.total_out = 0;
_zstr.msg = 0;
_zstr.state = 0;
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.data_type = 0;
_zstr.adler = 0;
_zstr.reserved = 0;
std::unique_ptr<char[]> buffer(new char[DEFLATE_BUFFER_SIZE]);
_buffer = new char[DEFLATE_BUFFER_SIZE];
int rc = deflateInit2(&_zstr, level, Z_DEFLATED, 15 + (type == STREAM_GZIP ? 16 : 0), 8, Z_DEFAULT_STRATEGY);
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = deflateInit2(pZstr.get(), level, Z_DEFLATED, 15 + (type == STREAM_GZIP ? 16 : 0), 8, Z_DEFAULT_STRATEGY);
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -57,22 +51,17 @@ DeflatingStreamBuf::DeflatingStreamBuf(std::istream& istr, int windowBits, int l
_pOstr(0),
_eof(false)
{
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
std::unique_ptr<char[]> buffer(new char[DEFLATE_BUFFER_SIZE]);
_buffer = new char[DEFLATE_BUFFER_SIZE];
int rc = deflateInit2(&_zstr, level, Z_DEFLATED, windowBits, 8, Z_DEFAULT_STRATEGY);
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = deflateInit2(pZstr.get(), level, Z_DEFLATED, windowBits, 8, Z_DEFAULT_STRATEGY);
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -82,22 +71,17 @@ DeflatingStreamBuf::DeflatingStreamBuf(std::ostream& ostr, StreamType type, int
_pOstr(&ostr),
_eof(false)
{
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
std::unique_ptr<char[]> buffer(new char[DEFLATE_BUFFER_SIZE]);
_buffer = new char[DEFLATE_BUFFER_SIZE];
int rc = deflateInit2(&_zstr, level, Z_DEFLATED, 15 + (type == STREAM_GZIP ? 16 : 0), 8, Z_DEFAULT_STRATEGY);
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = deflateInit2(pZstr.get(), level, Z_DEFLATED, 15 + (type == STREAM_GZIP ? 16 : 0), 8, Z_DEFAULT_STRATEGY);
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -107,22 +91,17 @@ DeflatingStreamBuf::DeflatingStreamBuf(std::ostream& ostr, int windowBits, int l
_pOstr(&ostr),
_eof(false)
{
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
std::unique_ptr<char[]> buffer(new char[DEFLATE_BUFFER_SIZE]);
_buffer = new char[DEFLATE_BUFFER_SIZE];
int rc = deflateInit2(&_zstr, level, Z_DEFLATED, windowBits, 8, Z_DEFAULT_STRATEGY);
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = deflateInit2(pZstr.get(), level, Z_DEFLATED, windowBits, 8, Z_DEFAULT_STRATEGY);
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -136,7 +115,8 @@ DeflatingStreamBuf::~DeflatingStreamBuf()
{
}
delete [] _buffer;
deflateEnd(&_zstr);
deflateEnd(_pZstr);
delete _pZstr;
}
@ -146,22 +126,22 @@ int DeflatingStreamBuf::close()
_pIstr = 0;
if (_pOstr)
{
if (_zstr.next_out)
if (_pZstr->next_out)
{
int rc = deflate(&_zstr, Z_FINISH);
int rc = deflate(_pZstr, Z_FINISH);
if (rc != Z_OK && rc != Z_STREAM_END) throw IOException(zError(rc));
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
while (rc != Z_STREAM_END)
{
rc = deflate(&_zstr, Z_FINISH);
rc = deflate(_pZstr, Z_FINISH);
if (rc != Z_OK && rc != Z_STREAM_END) throw IOException(zError(rc));
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
}
}
_pOstr->flush();
@ -178,23 +158,23 @@ int DeflatingStreamBuf::sync()
if (_pOstr)
{
if (_zstr.next_out)
if (_pZstr->next_out)
{
int rc = deflate(&_zstr, Z_SYNC_FLUSH);
int rc = deflate(_pZstr, Z_SYNC_FLUSH);
if (rc != Z_OK) throw IOException(zError(rc));
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
while (_zstr.avail_out == 0)
while (_pZstr->avail_out == 0)
{
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
rc = deflate(&_zstr, Z_SYNC_FLUSH);
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
rc = deflate(_pZstr, Z_SYNC_FLUSH);
if (rc != Z_OK) throw IOException(zError(rc));
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
};
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
}
// NOTE: This breaks the Zip library and causes corruption in some files.
// See GH #1828
@ -207,7 +187,7 @@ int DeflatingStreamBuf::sync()
int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
if (!_pIstr) return 0;
if (_zstr.avail_in == 0 && !_eof)
if (_pZstr->avail_in == 0 && !_eof)
{
int n = 0;
if (_pIstr->good())
@ -217,32 +197,32 @@ int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
}
if (n > 0)
{
_zstr.next_in = (unsigned char*) _buffer;
_zstr.avail_in = n;
_pZstr->next_in = (unsigned char*) _buffer;
_pZstr->avail_in = n;
}
else
{
_zstr.next_in = 0;
_zstr.avail_in = 0;
_pZstr->next_in = 0;
_pZstr->avail_in = 0;
_eof = true;
}
}
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = static_cast<unsigned>(length);
_pZstr->next_out = (unsigned char*) buffer;
_pZstr->avail_out = static_cast<unsigned>(length);
for (;;)
{
int rc = deflate(&_zstr, _eof ? Z_FINISH : Z_NO_FLUSH);
int rc = deflate(_pZstr, _eof ? Z_FINISH : Z_NO_FLUSH);
if (_eof && rc == Z_STREAM_END)
{
_pIstr = 0;
return static_cast<int>(length) - _zstr.avail_out;
return static_cast<int>(length) - _pZstr->avail_out;
}
if (rc != Z_OK) throw IOException(zError(rc));
if (_zstr.avail_out == 0)
if (_pZstr->avail_out == 0)
{
return static_cast<int>(length);
}
if (_zstr.avail_in == 0)
if (_pZstr->avail_in == 0)
{
int n = 0;
if (_pIstr->good())
@ -252,13 +232,13 @@ int DeflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
}
if (n > 0)
{
_zstr.next_in = (unsigned char*) _buffer;
_zstr.avail_in = n;
_pZstr->next_in = (unsigned char*) _buffer;
_pZstr->avail_in = n;
}
else
{
_zstr.next_in = 0;
_zstr.avail_in = 0;
_pZstr->next_in = 0;
_pZstr->avail_in = 0;
_eof = true;
}
}
@ -270,27 +250,27 @@ int DeflatingStreamBuf::writeToDevice(const char* buffer, std::streamsize length
{
if (length == 0 || !_pOstr) return 0;
_zstr.next_in = (unsigned char*) buffer;
_zstr.avail_in = static_cast<unsigned>(length);
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
_pZstr->next_in = (unsigned char*) buffer;
_pZstr->avail_in = static_cast<unsigned>(length);
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
for (;;)
{
int rc = deflate(&_zstr, Z_NO_FLUSH);
int rc = deflate(_pZstr, Z_NO_FLUSH);
if (rc != Z_OK) throw IOException(zError(rc));
if (_zstr.avail_out == 0)
if (_pZstr->avail_out == 0)
{
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE);
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
}
if (_zstr.avail_in == 0)
if (_pZstr->avail_in == 0)
{
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, DEFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing deflated data to output stream");
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = DEFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = DEFLATE_BUFFER_SIZE;
break;
}
}

View File

@ -15,6 +15,12 @@
#include "Poco/InflatingStream.h"
#include "Poco/Exception.h"
#include <cstring>
#include <memory>
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "zlib.h"
#endif
namespace Poco {
@ -27,29 +33,17 @@ InflatingStreamBuf::InflatingStreamBuf(std::istream& istr, StreamType type):
_eof(false),
_check(type != STREAM_ZIP)
{
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.total_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
_zstr.total_out = 0;
_zstr.msg = 0;
_zstr.state = 0;
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.data_type = 0;
_zstr.adler = 0;
_zstr.reserved = 0;
std::unique_ptr<char[]> buffer(new char[INFLATE_BUFFER_SIZE]);
_buffer = new char[INFLATE_BUFFER_SIZE];
int rc = inflateInit2(&_zstr, 15 + (type == STREAM_GZIP ? 16 : 0));
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = inflateInit2(pZstr.get(), 15 + (type == STREAM_GZIP ? 16 : 0));
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -60,22 +54,17 @@ InflatingStreamBuf::InflatingStreamBuf(std::istream& istr, int windowBits):
_eof(false),
_check(false)
{
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
std::unique_ptr<char[]> buffer(new char[INFLATE_BUFFER_SIZE]);
_buffer = new char[INFLATE_BUFFER_SIZE];
int rc = inflateInit2(&_zstr, windowBits);
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = inflateInit2(pZstr.get(), windowBits);
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -86,22 +75,17 @@ InflatingStreamBuf::InflatingStreamBuf(std::ostream& ostr, StreamType type):
_eof(false),
_check(type != STREAM_ZIP)
{
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
std::unique_ptr<char[]> buffer(new char[INFLATE_BUFFER_SIZE]);
_buffer = new char[INFLATE_BUFFER_SIZE];
int rc = inflateInit2(&_zstr, 15 + (type == STREAM_GZIP ? 16 : 0));
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = inflateInit2(pZstr.get(), 15 + (type == STREAM_GZIP ? 16 : 0));
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -112,22 +96,17 @@ InflatingStreamBuf::InflatingStreamBuf(std::ostream& ostr, int windowBits):
_eof(false),
_check(false)
{
_zstr.zalloc = Z_NULL;
_zstr.zfree = Z_NULL;
_zstr.opaque = Z_NULL;
_zstr.next_in = 0;
_zstr.avail_in = 0;
_zstr.next_out = 0;
_zstr.avail_out = 0;
std::unique_ptr<char[]> buffer(new char[INFLATE_BUFFER_SIZE]);
_buffer = new char[INFLATE_BUFFER_SIZE];
int rc = inflateInit2(&_zstr, windowBits);
std::unique_ptr<z_stream> pZstr = std::make_unique<z_stream>(z_stream{});
int rc = inflateInit2(pZstr.get(), windowBits);
if (rc != Z_OK)
{
delete [] _buffer;
throw IOException(zError(rc));
}
_pZstr = pZstr.release();
_buffer = buffer.release();
}
@ -141,7 +120,8 @@ InflatingStreamBuf::~InflatingStreamBuf()
{
}
delete [] _buffer;
inflateEnd(&_zstr);
inflateEnd(_pZstr);
delete _pZstr;
}
@ -156,7 +136,7 @@ int InflatingStreamBuf::close()
void InflatingStreamBuf::reset()
{
int rc = inflateReset(&_zstr);
int rc = inflateReset(_pZstr);
if (rc == Z_OK)
_eof = false;
else
@ -168,7 +148,7 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
if (_eof || !_pIstr) return 0;
if (_zstr.avail_in == 0)
if (_pZstr->avail_in == 0)
{
int n = 0;
if (_pIstr->good())
@ -176,17 +156,17 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
_pIstr->read(_buffer, INFLATE_BUFFER_SIZE);
n = static_cast<int>(_pIstr->gcount());
}
_zstr.next_in = (unsigned char*) _buffer;
_zstr.avail_in = n;
_pZstr->next_in = (unsigned char*) _buffer;
_pZstr->avail_in = n;
}
_zstr.next_out = (unsigned char*) buffer;
_zstr.avail_out = static_cast<unsigned>(length);
_pZstr->next_out = (unsigned char*) buffer;
_pZstr->avail_out = static_cast<unsigned>(length);
for (;;)
{
int rc = inflate(&_zstr, Z_NO_FLUSH);
int rc = inflate(_pZstr, Z_NO_FLUSH);
if (rc == Z_DATA_ERROR && !_check)
{
if (_zstr.avail_in == 0)
if (_pZstr->avail_in == 0)
{
if (_pIstr->good())
rc = Z_OK;
@ -197,12 +177,12 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
if (rc == Z_STREAM_END)
{
_eof = true;
return static_cast<int>(length) - _zstr.avail_out;
return static_cast<int>(length) - _pZstr->avail_out;
}
if (rc != Z_OK) throw IOException(zError(rc));
if (_zstr.avail_out == 0)
if (_pZstr->avail_out == 0)
return static_cast<int>(length);
if (_zstr.avail_in == 0)
if (_pZstr->avail_in == 0)
{
int n = 0;
if (_pIstr->good())
@ -212,10 +192,10 @@ int InflatingStreamBuf::readFromDevice(char* buffer, std::streamsize length)
}
if (n > 0)
{
_zstr.next_in = (unsigned char*) _buffer;
_zstr.avail_in = n;
_pZstr->next_in = (unsigned char*) _buffer;
_pZstr->avail_in = n;
}
else return static_cast<int>(length) - _zstr.avail_out;
else return static_cast<int>(length) - _pZstr->avail_out;
}
}
}
@ -225,33 +205,33 @@ int InflatingStreamBuf::writeToDevice(const char* buffer, std::streamsize length
{
if (length == 0 || !_pOstr) return 0;
_zstr.next_in = (unsigned char*) buffer;
_zstr.avail_in = static_cast<unsigned>(length);
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = INFLATE_BUFFER_SIZE;
_pZstr->next_in = (unsigned char*) buffer;
_pZstr->avail_in = static_cast<unsigned>(length);
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = INFLATE_BUFFER_SIZE;
for (;;)
{
int rc = inflate(&_zstr, Z_NO_FLUSH);
int rc = inflate(_pZstr, Z_NO_FLUSH);
if (rc == Z_STREAM_END)
{
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing inflated data to output stream");
break;
}
if (rc != Z_OK) throw IOException(zError(rc));
if (_zstr.avail_out == 0)
if (_pZstr->avail_out == 0)
{
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE);
if (!_pOstr->good()) throw IOException("Failed writing inflated data to output stream");
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = INFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = INFLATE_BUFFER_SIZE;
}
if (_zstr.avail_in == 0)
if (_pZstr->avail_in == 0)
{
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _zstr.avail_out);
_pOstr->write(_buffer, INFLATE_BUFFER_SIZE - _pZstr->avail_out);
if (!_pOstr->good()) throw IOException("Failed writing inflated data to output stream");
_zstr.next_out = (unsigned char*) _buffer;
_zstr.avail_out = INFLATE_BUFFER_SIZE;
_pZstr->next_out = (unsigned char*) _buffer;
_pZstr->avail_out = INFLATE_BUFFER_SIZE;
break;
}
}

View File

@ -1,224 +0,0 @@
/*************************************************
* Unicode Property Table handler *
*************************************************/
#ifndef _UCP_H
#define _UCP_H
/* This file contains definitions of the property values that are returned by
the UCD access macros. New values that are added for new releases of Unicode
should always be at the end of each enum, for backwards compatibility.
IMPORTANT: Note also that the specific numeric values of the enums have to be
the same as the values that are generated by the maint/MultiStage2.py script,
where the equivalent property descriptive names are listed in vectors.
ALSO: The specific values of the first two enums are assumed for the table
called catposstab in pcre_compile.c. */
/* These are the general character categories. */
enum {
ucp_C, /* Other */
ucp_L, /* Letter */
ucp_M, /* Mark */
ucp_N, /* Number */
ucp_P, /* Punctuation */
ucp_S, /* Symbol */
ucp_Z /* Separator */
};
/* These are the particular character categories. */
enum {
ucp_Cc, /* Control */
ucp_Cf, /* Format */
ucp_Cn, /* Unassigned */
ucp_Co, /* Private use */
ucp_Cs, /* Surrogate */
ucp_Ll, /* Lower case letter */
ucp_Lm, /* Modifier letter */
ucp_Lo, /* Other letter */
ucp_Lt, /* Title case letter */
ucp_Lu, /* Upper case letter */
ucp_Mc, /* Spacing mark */
ucp_Me, /* Enclosing mark */
ucp_Mn, /* Non-spacing mark */
ucp_Nd, /* Decimal number */
ucp_Nl, /* Letter number */
ucp_No, /* Other number */
ucp_Pc, /* Connector punctuation */
ucp_Pd, /* Dash punctuation */
ucp_Pe, /* Close punctuation */
ucp_Pf, /* Final punctuation */
ucp_Pi, /* Initial punctuation */
ucp_Po, /* Other punctuation */
ucp_Ps, /* Open punctuation */
ucp_Sc, /* Currency symbol */
ucp_Sk, /* Modifier symbol */
ucp_Sm, /* Mathematical symbol */
ucp_So, /* Other symbol */
ucp_Zl, /* Line separator */
ucp_Zp, /* Paragraph separator */
ucp_Zs /* Space separator */
};
/* These are grapheme break properties. Note that the code for processing them
assumes that the values are less than 16. If more values are added that take
the number to 16 or more, the code will have to be rewritten. */
enum {
ucp_gbCR, /* 0 */
ucp_gbLF, /* 1 */
ucp_gbControl, /* 2 */
ucp_gbExtend, /* 3 */
ucp_gbPrepend, /* 4 */
ucp_gbSpacingMark, /* 5 */
ucp_gbL, /* 6 Hangul syllable type L */
ucp_gbV, /* 7 Hangul syllable type V */
ucp_gbT, /* 8 Hangul syllable type T */
ucp_gbLV, /* 9 Hangul syllable type LV */
ucp_gbLVT, /* 10 Hangul syllable type LVT */
ucp_gbRegionalIndicator, /* 11 */
ucp_gbOther /* 12 */
};
/* These are the script identifications. */
enum {
ucp_Arabic,
ucp_Armenian,
ucp_Bengali,
ucp_Bopomofo,
ucp_Braille,
ucp_Buginese,
ucp_Buhid,
ucp_Canadian_Aboriginal,
ucp_Cherokee,
ucp_Common,
ucp_Coptic,
ucp_Cypriot,
ucp_Cyrillic,
ucp_Deseret,
ucp_Devanagari,
ucp_Ethiopic,
ucp_Georgian,
ucp_Glagolitic,
ucp_Gothic,
ucp_Greek,
ucp_Gujarati,
ucp_Gurmukhi,
ucp_Han,
ucp_Hangul,
ucp_Hanunoo,
ucp_Hebrew,
ucp_Hiragana,
ucp_Inherited,
ucp_Kannada,
ucp_Katakana,
ucp_Kharoshthi,
ucp_Khmer,
ucp_Lao,
ucp_Latin,
ucp_Limbu,
ucp_Linear_B,
ucp_Malayalam,
ucp_Mongolian,
ucp_Myanmar,
ucp_New_Tai_Lue,
ucp_Ogham,
ucp_Old_Italic,
ucp_Old_Persian,
ucp_Oriya,
ucp_Osmanya,
ucp_Runic,
ucp_Shavian,
ucp_Sinhala,
ucp_Syloti_Nagri,
ucp_Syriac,
ucp_Tagalog,
ucp_Tagbanwa,
ucp_Tai_Le,
ucp_Tamil,
ucp_Telugu,
ucp_Thaana,
ucp_Thai,
ucp_Tibetan,
ucp_Tifinagh,
ucp_Ugaritic,
ucp_Yi,
/* New for Unicode 5.0: */
ucp_Balinese,
ucp_Cuneiform,
ucp_Nko,
ucp_Phags_Pa,
ucp_Phoenician,
/* New for Unicode 5.1: */
ucp_Carian,
ucp_Cham,
ucp_Kayah_Li,
ucp_Lepcha,
ucp_Lycian,
ucp_Lydian,
ucp_Ol_Chiki,
ucp_Rejang,
ucp_Saurashtra,
ucp_Sundanese,
ucp_Vai,
/* New for Unicode 5.2: */
ucp_Avestan,
ucp_Bamum,
ucp_Egyptian_Hieroglyphs,
ucp_Imperial_Aramaic,
ucp_Inscriptional_Pahlavi,
ucp_Inscriptional_Parthian,
ucp_Javanese,
ucp_Kaithi,
ucp_Lisu,
ucp_Meetei_Mayek,
ucp_Old_South_Arabian,
ucp_Old_Turkic,
ucp_Samaritan,
ucp_Tai_Tham,
ucp_Tai_Viet,
/* New for Unicode 6.0.0: */
ucp_Batak,
ucp_Brahmi,
ucp_Mandaic,
/* New for Unicode 6.1.0: */
ucp_Chakma,
ucp_Meroitic_Cursive,
ucp_Meroitic_Hieroglyphs,
ucp_Miao,
ucp_Sharada,
ucp_Sora_Sompeng,
ucp_Takri,
/* New for Unicode 7.0.0: */
ucp_Bassa_Vah,
ucp_Caucasian_Albanian,
ucp_Duployan,
ucp_Elbasan,
ucp_Grantha,
ucp_Khojki,
ucp_Khudawadi,
ucp_Linear_A,
ucp_Mahajani,
ucp_Manichaean,
ucp_Mende_Kikakui,
ucp_Modi,
ucp_Mro,
ucp_Nabataean,
ucp_Old_North_Arabian,
ucp_Old_Permic,
ucp_Pahawh_Hmong,
ucp_Palmyrene,
ucp_Psalter_Pahlavi,
ucp_Pau_Cin_Hau,
ucp_Siddham,
ucp_Tirhuta,
ucp_Warang_Citi
};
#endif
/* End of ucp.h */

View File

@ -18,7 +18,6 @@
#include "Poco/Buffer.h"
#include <sstream>
using Poco::InflatingInputStream;
using Poco::InflatingOutputStream;
using Poco::DeflatingOutputStream;
@ -97,7 +96,7 @@ void ZLibTest::testDeflate4()
{
Poco::Buffer<char> buffer(1024);
Poco::MemoryOutputStream ostr(buffer.begin(), static_cast<std::streamsize>(buffer.size()));
DeflatingOutputStream deflater(ostr, -10, Z_BEST_SPEED);
DeflatingOutputStream deflater(ostr, -10, DeflatingStreamBuf::BEST_SPEED);
std::string data(36828, 'x');
deflater << data;
deflater.close();

View File

@ -10,9 +10,6 @@
</include>
<exclude>
*_*.h,
expat*.h,
zconf.h,
zlib.h,
</exclude>
</files>
<pages>

View File

@ -10,9 +10,6 @@
</include>
<exclude>
*_*.h,
expat*.h,
zconf.h,
zlib.h,
${PocoBuild}/Util/include/Poco/Util/Units.h
</exclude>
</files>

View File

@ -1167,18 +1167,6 @@
<Filter
Name="Expat"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\Xml\expat.h"
>
</File>
<File
RelativePath=".\include\Poco\Xml\expat_external.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
@ -1190,10 +1178,18 @@
RelativePath=".\src\asciitab.h"
>
</File>
<File
RelativePath=".\src\expat.h"
>
</File>
<File
RelativePath=".\src\expat_config.h"
>
</File>
<File
RelativePath=".\src\expat_external.h"
>
</File>
<File
RelativePath=".\src\iasciitab.h"
>

View File

@ -20,13 +20,16 @@
#include "Poco/XML/XML.h"
#include "Poco/SAX/XMLReader.h"
#include "Poco/XML/ParserEngine.h"
#include "Poco/TextEncoding.h"
namespace Poco {
namespace XML {
class ParserEngine;
class XML_API SAXParser: public XMLReader
/// This class provides a SAX2 (Simple API for XML) interface to expat,
/// the XML parser toolkit.
@ -101,7 +104,7 @@ protected:
void setupParse();
private:
ParserEngine _engine;
ParserEngine* _engine;
bool _namespaces;
bool _namespacePrefixes;
};

View File

@ -30,11 +30,7 @@
#include "Poco/XML/QName.h"
#include "Poco/XML/ValueTraits.h"
#include "Poco/XML/Content.h"
#if defined(POCO_UNBUNDLED)
#include <expat.h>
#else
#include "Poco/XML/expat.h"
#endif
#include "Poco/XML/XMLString.h"
#include <map>
#include <vector>
#include <string>
@ -42,6 +38,9 @@
#include <cstddef>
struct XML_ParserStruct;
namespace Poco {
namespace XML {
@ -269,11 +268,11 @@ private:
XMLStreamParser(const XMLStreamParser&);
XMLStreamParser& operator = (const XMLStreamParser&);
static void XMLCALL handleStartElement(void*, const XML_Char*, const XML_Char**);
static void XMLCALL handleEndElement(void*, const XML_Char*);
static void XMLCALL handleCharacters(void*, const XML_Char*, int);
static void XMLCALL handleStartNamespaceDecl(void*, const XML_Char*, const XML_Char*);
static void XMLCALL handleEndNamespaceDecl(void*, const XML_Char*);
static void handleStartElement(void*, const XMLChar*, const XMLChar**);
static void handleEndElement(void*, const XMLChar*);
static void handleCharacters(void*, const XMLChar*, int);
static void handleStartNamespaceDecl(void*, const XMLChar*, const XMLChar*);
static void handleEndNamespaceDecl(void*, const XMLChar*);
void init();
EventType nextImpl(bool peek);
@ -299,7 +298,7 @@ private:
std::size_t _size;
const std::string _inputName;
FeatureType _feature;
XML_Parser _parser;
XML_ParserStruct* _parser;
std::size_t _depth;
bool _accumulateContent; // Whether we are accumulating character content.
ParserState _parserState;

View File

@ -12,7 +12,7 @@
//
#include "Poco/XML/ParserEngine.h"
#include "ParserEngine.h"
#include "Poco/XML/NamespaceStrategy.h"
#include "Poco/XML/XMLException.h"
#include "Poco/SAX/EntityResolver.h"

View File

@ -21,7 +21,7 @@
#if defined(POCO_UNBUNDLED)
#include <expat.h>
#else
#include "Poco/XML/expat.h"
#include "expat.h"
#endif
#include "Poco/XML/XMLString.h"
#include "Poco/XML/XMLStream.h"

View File

@ -18,6 +18,7 @@
#include "Poco/SAX/InputSource.h"
#include "Poco/XML/NamespaceStrategy.h"
#include "Poco/NumberParser.h"
#include "ParserEngine.h"
#include <sstream>
@ -34,85 +35,87 @@ SAXParser::SAXParser():
_namespaces(true),
_namespacePrefixes(false)
{
_engine = new ParserEngine;
}
SAXParser::SAXParser(const XMLString& encoding):
_engine(encoding),
_namespaces(true),
_namespacePrefixes(false)
{
_engine = new ParserEngine(encoding);
}
SAXParser::~SAXParser()
{
delete _engine;
}
void SAXParser::setEncoding(const XMLString& encoding)
{
_engine.setEncoding(encoding);
_engine->setEncoding(encoding);
}
const XMLString& SAXParser::getEncoding() const
{
return _engine.getEncoding();
return _engine->getEncoding();
}
void SAXParser::addEncoding(const XMLString& name, Poco::TextEncoding* pEncoding)
{
_engine.addEncoding(name, pEncoding);
_engine->addEncoding(name, pEncoding);
}
void SAXParser::setEntityResolver(EntityResolver* pResolver)
{
_engine.setEntityResolver(pResolver);
_engine->setEntityResolver(pResolver);
}
EntityResolver* SAXParser::getEntityResolver() const
{
return _engine.getEntityResolver();
return _engine->getEntityResolver();
}
void SAXParser::setDTDHandler(DTDHandler* pDTDHandler)
{
_engine.setDTDHandler(pDTDHandler);
_engine->setDTDHandler(pDTDHandler);
}
DTDHandler* SAXParser::getDTDHandler() const
{
return _engine.getDTDHandler();
return _engine->getDTDHandler();
}
void SAXParser::setContentHandler(ContentHandler* pContentHandler)
{
_engine.setContentHandler(pContentHandler);
_engine->setContentHandler(pContentHandler);
}
ContentHandler* SAXParser::getContentHandler() const
{
return _engine.getContentHandler();
return _engine->getContentHandler();
}
void SAXParser::setErrorHandler(ErrorHandler* pErrorHandler)
{
_engine.setErrorHandler(pErrorHandler);
_engine->setErrorHandler(pErrorHandler);
}
ErrorHandler* SAXParser::getErrorHandler() const
{
return _engine.getErrorHandler();
return _engine->getErrorHandler();
}
@ -121,15 +124,15 @@ void SAXParser::setFeature(const XMLString& featureId, bool state)
if (featureId == XMLReader::FEATURE_VALIDATION || featureId == XMLReader::FEATURE_STRING_INTERNING)
throw SAXNotSupportedException(fromXMLString(XMLReader::FEATURE_VALIDATION));
else if (featureId == XMLReader::FEATURE_EXTERNAL_GENERAL_ENTITIES)
_engine.setExternalGeneralEntities(state);
_engine->setExternalGeneralEntities(state);
else if (featureId == XMLReader::FEATURE_EXTERNAL_PARAMETER_ENTITIES)
_engine.setExternalParameterEntities(state);
_engine->setExternalParameterEntities(state);
else if (featureId == XMLReader::FEATURE_NAMESPACES)
_namespaces = state;
else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES)
_namespacePrefixes = state;
else if (featureId == FEATURE_PARTIAL_READS)
_engine.setEnablePartialReads(state);
_engine->setEnablePartialReads(state);
else throw SAXNotRecognizedException(fromXMLString(featureId));
}
@ -139,15 +142,15 @@ bool SAXParser::getFeature(const XMLString& featureId) const
if (featureId == XMLReader::FEATURE_VALIDATION || featureId == XMLReader::FEATURE_STRING_INTERNING)
throw SAXNotSupportedException(fromXMLString(XMLReader::FEATURE_VALIDATION));
else if (featureId == XMLReader::FEATURE_EXTERNAL_GENERAL_ENTITIES)
return _engine.getExternalGeneralEntities();
return _engine->getExternalGeneralEntities();
else if (featureId == XMLReader::FEATURE_EXTERNAL_PARAMETER_ENTITIES)
return _engine.getExternalParameterEntities();
return _engine->getExternalParameterEntities();
else if (featureId == XMLReader::FEATURE_NAMESPACES)
return _namespaces;
else if (featureId == XMLReader::FEATURE_NAMESPACE_PREFIXES)
return _namespacePrefixes;
else if (featureId == FEATURE_PARTIAL_READS)
return _engine.getEnablePartialReads();
return _engine->getEnablePartialReads();
else throw SAXNotRecognizedException(fromXMLString(featureId));
}
@ -157,9 +160,9 @@ void SAXParser::setProperty(const XMLString& propertyId, const XMLString& value)
if (propertyId == XMLReader::PROPERTY_DECLARATION_HANDLER || propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER)
throw SAXNotSupportedException(std::string("property does not take a string value: ") + fromXMLString(propertyId));
else if (propertyId == PROPERTY_BLA_MAXIMUM_AMPLIFICATION)
_engine.setBillionLaughsAttackProtectionMaximumAmplification(static_cast<float>(Poco::NumberParser::parseFloat(value)));
_engine->setBillionLaughsAttackProtectionMaximumAmplification(static_cast<float>(Poco::NumberParser::parseFloat(value)));
else if (propertyId == PROPERTY_BLA_ACTIVATION_THRESHOLD)
_engine.setBillionLaughsAttackProtectionActivationThreshold(Poco::NumberParser::parseUnsigned64(value));
_engine->setBillionLaughsAttackProtectionActivationThreshold(Poco::NumberParser::parseUnsigned64(value));
else
throw SAXNotRecognizedException(fromXMLString(propertyId));
}
@ -168,9 +171,9 @@ void SAXParser::setProperty(const XMLString& propertyId, const XMLString& value)
void SAXParser::setProperty(const XMLString& propertyId, void* value)
{
if (propertyId == XMLReader::PROPERTY_DECLARATION_HANDLER)
_engine.setDeclHandler(reinterpret_cast<DeclHandler*>(value));
_engine->setDeclHandler(reinterpret_cast<DeclHandler*>(value));
else if (propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER)
_engine.setLexicalHandler(reinterpret_cast<LexicalHandler*>(value));
_engine->setLexicalHandler(reinterpret_cast<LexicalHandler*>(value));
else throw SAXNotRecognizedException(fromXMLString(propertyId));
}
@ -178,9 +181,9 @@ void SAXParser::setProperty(const XMLString& propertyId, void* value)
void* SAXParser::getProperty(const XMLString& propertyId) const
{
if (propertyId == XMLReader::PROPERTY_DECLARATION_HANDLER)
return _engine.getDeclHandler();
return _engine->getDeclHandler();
else if (propertyId == XMLReader::PROPERTY_LEXICAL_HANDLER)
return _engine.getLexicalHandler();
return _engine->getLexicalHandler();
else throw SAXNotSupportedException(fromXMLString(propertyId));
}
@ -190,7 +193,7 @@ void SAXParser::parse(InputSource* pInputSource)
if (pInputSource->getByteStream() || pInputSource->getCharacterStream())
{
setupParse();
_engine.parse(pInputSource);
_engine->parse(pInputSource);
}
else parse(pInputSource->getSystemId());
}
@ -205,7 +208,7 @@ void SAXParser::parse(const XMLString& systemId)
{
try
{
_engine.parse(pInputSource);
_engine->parse(pInputSource);
}
catch (...)
{
@ -227,18 +230,18 @@ void SAXParser::parseString(const std::string& xml)
void SAXParser::parseMemoryNP(const char* xml, std::size_t size)
{
setupParse();
_engine.parse(xml, size);
_engine->parse(xml, size);
}
void SAXParser::setupParse()
{
if (_namespaces && !_namespacePrefixes)
_engine.setNamespaceStrategy(new NoNamespacePrefixesStrategy);
_engine->setNamespaceStrategy(new NoNamespacePrefixesStrategy);
else if (_namespaces && _namespacePrefixes)
_engine.setNamespaceStrategy(new NamespacePrefixesStrategy);
_engine->setNamespaceStrategy(new NamespacePrefixesStrategy);
else
_engine.setNamespaceStrategy(new NoNamespacesStrategy);
_engine->setNamespaceStrategy(new NoNamespacesStrategy);
}

View File

@ -16,6 +16,12 @@
#include "Poco/XML/XMLStreamParser.h"
#include "Poco/XML/XMLString.h"
#if defined(POCO_UNBUNDLED)
#include <expat.h>
#else
#include "expat.h"
#endif
#include <new>
#include <cstring>
#include <istream>
@ -705,7 +711,7 @@ static void splitName(const XML_Char* s, QName& qn)
}
void XMLCALL XMLStreamParser::handleStartElement(void* v, const XML_Char* name, const XML_Char** atts)
void XMLStreamParser::handleStartElement(void* v, const XMLChar* name, const XMLChar** atts)
{
XMLStreamParser& p(*static_cast<XMLStreamParser*>(v));
@ -789,7 +795,7 @@ void XMLCALL XMLStreamParser::handleStartElement(void* v, const XML_Char* name,
}
void XMLCALL XMLStreamParser::handleEndElement(void* v, const XML_Char* name)
void XMLStreamParser::handleEndElement(void* v, const XMLChar* name)
{
XMLStreamParser& p(*static_cast<XMLStreamParser*>(v));
@ -828,7 +834,7 @@ void XMLCALL XMLStreamParser::handleEndElement(void* v, const XML_Char* name)
}
void XMLCALL XMLStreamParser::handleCharacters(void* v, const XML_Char* s, int n)
void XMLStreamParser::handleCharacters(void* v, const XMLChar* s, int n)
{
XMLStreamParser& p(*static_cast<XMLStreamParser*>(v));
@ -899,7 +905,7 @@ void XMLCALL XMLStreamParser::handleCharacters(void* v, const XML_Char* s, int n
}
void XMLCALL XMLStreamParser::handleStartNamespaceDecl(void* v, const XML_Char* prefix, const XML_Char* ns)
void XMLStreamParser::handleStartNamespaceDecl(void* v, const XMLChar* prefix, const XMLChar* ns)
{
XMLStreamParser& p(*static_cast<XMLStreamParser*>(v));
@ -918,7 +924,7 @@ void XMLCALL XMLStreamParser::handleStartNamespaceDecl(void* v, const XML_Char*
}
void XMLCALL XMLStreamParser::handleEndNamespaceDecl(void* v, const XML_Char* prefix)
void XMLStreamParser::handleEndNamespaceDecl(void* v, const XMLChar* prefix)
{
XMLStreamParser& p(*static_cast<XMLStreamParser*>(v));

View File

@ -147,7 +147,7 @@
8388608 // 8 MiB, 2^23
/* NOTE END */
#include "Poco/XML/expat.h" // so we can use type XML_Parser below
#include "expat.h" // so we can use type XML_Parser below
#ifdef __cplusplus
extern "C" {

View File

@ -124,7 +124,7 @@
#include "expat_config.h"
#include "ascii.h"
#include "Poco/XML/expat.h"
#include "expat.h"
#include "siphash.h"
#if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)

View File

@ -38,15 +38,15 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "expat_config.h"
#include <stddef.h>
#ifdef EXPAT_WIN32
#include "winconfig.h"
#endif
#include "expat_config.h"
#include "Poco/XML/expat_external.h"
#include "expat_external.h"
#include "internal.h"
#include "xmlrole.h"
#include "ascii.h"

View File

@ -46,6 +46,8 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "expat_config.h"
#include <stddef.h>
#include <string.h> /* memcpy */
#include <stdbool.h>
@ -54,9 +56,7 @@
# include "winconfig.h"
#endif
#include "expat_config.h"
#include "Poco/XML/expat_external.h"
#include "expat_external.h"
#include "internal.h"
#include "xmltok.h"
#include "nametab.h"

View File

@ -25,7 +25,8 @@
#if defined(POCO_UNBUNDLED)
#include <zlib.h>
#else
#include "Poco/zlib.h"
// Quirk before we move zlib to external libs.
#include "../../Foundation/src/zlib.h"
#endif