X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71b5725f30bd6006f77f56ffdeb697b72241888d..83842a0ba326b22c6b930998a7f817e83ff7f7be:/src/common/regex.cpp diff --git a/src/common/regex.cpp b/src/common/regex.cpp index e96257c8b6..8983f98d02 100644 --- a/src/common/regex.cpp +++ b/src/common/regex.cpp @@ -18,7 +18,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "regex.h" #endif @@ -43,10 +43,17 @@ #include #endif +#ifndef __WXWINCE__ #include +#endif #include "wx/regex.h" +#if wxUSE_UNICODE + #define regerror wx_regerror + #define regfree wx_regfree +#endif + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -178,9 +185,15 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags) if ( flags & wxRE_NEWLINE ) flagsRE |= REG_NEWLINE; + // compile it +#if wxUSE_UNICODE + int errorcode = wx_regcomp(&m_RegEx, expr, expr.Length(), flagsRE); +#else int errorcode = regcomp(&m_RegEx, expr.mb_str(), flagsRE); - if ( errorcode ) +#endif + + if ( errorcode ) { wxLogError(_("Invalid regular expression '%s': %s"), expr.c_str(), GetErrorMsg(errorcode).c_str()); @@ -253,7 +266,12 @@ bool wxRegExImpl::Matches(const wxChar *str, int flags) const } // do match it +#if wxUSE_UNICODE + 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); +#endif switch ( rc ) {