]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/regex.cpp
Use lib64 for 64-bit builds on some kinds of linux and lib/64 on solaris
[wxWidgets.git] / src / common / regex.cpp
index 8ae727359c27b2ba20682a2e0ba284cf2b693247..ac85aac9720510d86a72b0e23a529eca9edcef32 100644 (file)
@@ -199,7 +199,7 @@ bool wxRegExImpl::Compile(const wxString& expr, int flags)
     // compile it
 #ifdef __REG_NOFRONT
     bool conv = true;
-    int errorcode = re_comp(&m_RegEx, expr, expr.length(), flagsRE);
+    int errorcode = wx_re_comp(&m_RegEx, expr, expr.length(), flagsRE);
 #else
     const wxWX2MBbuf conv = expr.mbc_str();
     int errorcode = conv ? regcomp(&m_RegEx, conv, flagsRE) : REG_BADPAT;
@@ -283,7 +283,7 @@ bool wxRegExImpl::Matches(const wxChar *str, int flags) const
     // do match it
 #ifdef __REG_NOFRONT
     bool conv = true;
-    int rc = re_exec(&self->m_RegEx, str, wxStrlen(str), NULL, m_nMatches, m_Matches, flagsRE);
+    int rc = wx_re_exec(&self->m_RegEx, str, wxStrlen(str), NULL, m_nMatches, m_Matches, flagsRE);
 #else
     const wxWX2MBbuf conv = wxConvertWX2MB(str);
     int rc = conv ? regexec(&self->m_RegEx, conv, m_nMatches, m_Matches, flagsRE) : REG_BADPAT;
@@ -296,7 +296,7 @@ bool wxRegExImpl::Matches(const wxChar *str, int flags) const
             return true;
 
         default:
-            // an error occured
+            // an error occurred
             wxLogError(_("Failed to match '%s' in regular expression: %s"),
                        str, GetErrorMsg(rc, !conv).c_str());
             // fall through
@@ -316,10 +316,11 @@ bool wxRegExImpl::GetMatch(size_t *start, size_t *len, size_t index) const
 
     const regmatch_t& match = m_Matches[index];
 
+    // we need the casts because rm_so can be a 64 bit quantity
     if ( start )
-        *start = match.rm_so;
+        *start = wx_truncate_cast(size_t, match.rm_so);
     if ( len )
-        *len = match.rm_eo - match.rm_so;
+        *len = wx_truncate_cast(size_t, match.rm_eo - match.rm_so);
 
     return true;
 }