Check for WXREGEX_CONVERT_TO_MB when calling regcomp() too
Make code more consistent by using the same approach as in the other places where conversion is necessary in some builds and define temporary variables for clarity. Also use wx_str() when the conversion is not necessary rather than c_str() as this is more efficient and allows to address an existing FIXME comment.
This commit is contained in:
parent
fb21f556a7
commit
4dd77dabe8
@ -549,12 +549,18 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags)
|
||||
if ( flags & wxRE_NEWLINE )
|
||||
flagsRE |= REG_NEWLINE;
|
||||
|
||||
#ifndef WXREGEX_CONVERT_TO_MB
|
||||
const wxChar *exprstr = expr.wx_str();
|
||||
#else
|
||||
const wxScopedCharBuffer exprbuf = expr.utf8_str();
|
||||
const char* const exprstr = exprbuf.data();
|
||||
#endif
|
||||
|
||||
// compile it
|
||||
#ifdef WXREGEX_USING_BUILTIN
|
||||
// FIXME-UTF8: use wc_str() after removing ANSI build
|
||||
int errorcode = wx_re_comp(&m_RegEx, expr.c_str(), expr.length(), flagsRE);
|
||||
int errorcode = wx_re_comp(&m_RegEx, exprstr, expr.length(), flagsRE);
|
||||
#else
|
||||
int errorcode = wx_regcomp(&m_RegEx, expr.utf8_str(), flagsRE);
|
||||
int errorcode = wx_regcomp(&m_RegEx, exprstr, flagsRE);
|
||||
#endif
|
||||
|
||||
if ( errorcode )
|
||||
|
Loading…
Reference in New Issue
Block a user