fixed GH #1581: Cannot find 'pcre.h' when using POCO_UNBUNDLED, a non-system PCRE, and CMake

This commit is contained in:
Guenter Obiltschnig
2017-02-11 12:03:37 +01:00
parent 43a0490a70
commit f8a0bbff1b
2 changed files with 10 additions and 22 deletions

View File

@@ -43,14 +43,14 @@ RegularExpression::RegularExpression(const std::string& pattern, int options, bo
throw RegularExpressionException(msg.str());
}
if (study)
_extra = pcre_study(_pcre, 0, &error);
_extra = pcre_study(reinterpret_cast<pcre*>(_pcre), 0, &error);
}
RegularExpression::~RegularExpression()
{
if (_pcre) pcre_free(_pcre);
if (_extra) pcre_free(_extra);
if (_pcre) pcre_free(reinterpret_cast<pcre*>(_pcre));
if (_extra) pcre_free(reinterpret_cast<struct pcre_extra*>(_extra));
}
@@ -59,7 +59,7 @@ int RegularExpression::match(const std::string& subject, std::string::size_type
poco_assert (offset <= subject.length());
int ovec[OVEC_SIZE];
int rc = pcre_exec(_pcre, _extra, subject.c_str(), int(subject.size()), int(offset), options & 0xFFFF, ovec, OVEC_SIZE);
int rc = pcre_exec(reinterpret_cast<pcre*>(_pcre), reinterpret_cast<struct pcre_extra*>(_extra), subject.c_str(), int(subject.size()), int(offset), options & 0xFFFF, ovec, OVEC_SIZE);
if (rc == PCRE_ERROR_NOMATCH)
{
mtch.offset = std::string::npos;
@@ -93,7 +93,7 @@ int RegularExpression::match(const std::string& subject, std::string::size_type
matches.clear();
int ovec[OVEC_SIZE];
int rc = pcre_exec(_pcre, _extra, subject.c_str(), int(subject.size()), int(offset), options & 0xFFFF, ovec, OVEC_SIZE);
int rc = pcre_exec(reinterpret_cast<pcre*>(_pcre), reinterpret_cast<struct pcre_extra*>(_extra), subject.c_str(), int(subject.size()), int(offset), options & 0xFFFF, ovec, OVEC_SIZE);
if (rc == PCRE_ERROR_NOMATCH)
{
return 0;
@@ -206,7 +206,7 @@ std::string::size_type RegularExpression::substOne(std::string& subject, std::st
if (offset >= subject.length()) return std::string::npos;
int ovec[OVEC_SIZE];
int rc = pcre_exec(_pcre, _extra, subject.c_str(), int(subject.size()), int(offset), options & 0xFFFF, ovec, OVEC_SIZE);
int rc = pcre_exec(reinterpret_cast<pcre*>(_pcre), reinterpret_cast<struct pcre_extra*>(_extra), subject.c_str(), int(subject.size()), int(offset), options & 0xFFFF, ovec, OVEC_SIZE);
if (rc == PCRE_ERROR_NOMATCH)
{
return std::string::npos;