Made compatible with new regex
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24824 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -148,7 +148,9 @@ wxString wxRegExImpl::GetErrorMsg(int errorcode) const
|
|||||||
|
|
||||||
msg = wxString(buf.data(), wxConvLibc);
|
msg = wxString(buf.data(), wxConvLibc);
|
||||||
#else // !Unicode
|
#else // !Unicode
|
||||||
(void)regerror(errorcode, &m_RegEx, wxStringBuffer(msg, len), len);
|
(void)regerror(errorcode, &m_RegEx, msg.GetWriteBuf(len), len);
|
||||||
|
|
||||||
|
msg.UngetWriteBuf();
|
||||||
#endif // Unicode/!Unicode
|
#endif // Unicode/!Unicode
|
||||||
}
|
}
|
||||||
else // regerror() returned 0
|
else // regerror() returned 0
|
||||||
@@ -178,8 +180,14 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags)
|
|||||||
if ( flags & wxRE_NEWLINE )
|
if ( flags & wxRE_NEWLINE )
|
||||||
flagsRE |= REG_NEWLINE;
|
flagsRE |= REG_NEWLINE;
|
||||||
|
|
||||||
|
|
||||||
// compile it
|
// compile it
|
||||||
|
#if wxUSE_NEW_REGEX
|
||||||
|
int errorcode = wx_regcomp(&m_RegEx, expr, expr.Length(), flagsRE);
|
||||||
|
#else
|
||||||
int errorcode = regcomp(&m_RegEx, expr.mb_str(), flagsRE);
|
int errorcode = regcomp(&m_RegEx, expr.mb_str(), flagsRE);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( errorcode )
|
if ( errorcode )
|
||||||
{
|
{
|
||||||
wxLogError(_("Invalid regular expression '%s': %s"),
|
wxLogError(_("Invalid regular expression '%s': %s"),
|
||||||
@@ -253,7 +261,12 @@ bool wxRegExImpl::Matches(const wxChar *str, int flags) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do match it
|
// do match it
|
||||||
|
#ifdef wxUSE_NEW_REGEX
|
||||||
|
rm_detail_t rd;
|
||||||
|
int rc = wx_regexec(&self->m_RegEx, str, wxStrlen(str), &rd, m_nMatches, m_Matches, flagsRE);
|
||||||
|
#else
|
||||||
int rc = regexec(&self->m_RegEx, wxConvertWX2MB(str), m_nMatches, m_Matches, flagsRE);
|
int rc = regexec(&self->m_RegEx, wxConvertWX2MB(str), m_nMatches, m_Matches, flagsRE);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch ( rc )
|
switch ( rc )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user