X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/59078e629d5ad9fc0b11dfd6100d0feff5af95d3..88594d02eb59a55ac85d3210a49d02918124617b:/src/common/regex.cpp diff --git a/src/common/regex.cpp b/src/common/regex.cpp index 45efe1a5b2..7b480f24c8 100644 --- a/src/common/regex.cpp +++ b/src/common/regex.cpp @@ -38,8 +38,8 @@ #include "wx/intl.h" #endif //WX_PRECOMP -// FreeBSD requires this, it probably doesn't hurt for others -#ifdef __UNIX__ +// FreeBSD & Watcom require this, it probably doesn't hurt for others +#if defined(__UNIX__) || defined(__WATCOMC__) #include #endif @@ -127,9 +127,17 @@ wxString wxRegExImpl::GetErrorMsg(int errorcode) const { len++; +#if wxUSE_UNICODE + wxCharBuffer buf(len); + + (void)regerror(errorcode, &m_RegEx, (char *)buf.data(), len); + + msg = buf.data(); +#else // !Unicode (void)regerror(errorcode, &m_RegEx, msg.GetWriteBuf(len), len); msg.UngetWriteBuf(); +#endif // Unicode/!Unicode } else // regerror() returned 0 { @@ -159,7 +167,7 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags) flagsRE |= REG_NEWLINE; // compile it - int errorcode = regcomp(&m_RegEx, expr, flagsRE); + int errorcode = regcomp(&m_RegEx, expr.mb_str(), flagsRE); if ( errorcode ) { wxLogError(_("Invalid regular expression '%s': %s"), @@ -230,7 +238,7 @@ bool wxRegExImpl::Matches(const wxChar *str, int flags) const } // do match it - int rc = regexec(&self->m_RegEx, str, m_nMatches, m_Matches, flagsRE); + int rc = regexec(&self->m_RegEx, wxConvertWX2MB(str), m_nMatches, m_Matches, flagsRE); switch ( rc ) {