[Mapserver-users] Problem with Mapserver 4 / regex in loadMapFile (FIXED)
Franck Martin
franck at sopac.org
Sun Jul 6 20:00:54 PDT 2003
--=-D0pl64wiKB+o8FV5sV/Q
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
I modified msEvalRegex in mapfile.c as follows and now it works... I use
a regex_t *re instead of a regex_t re.
int msEvalRegex(char *e, char *s) {
regex_t *re;
if(!e || !s) return(MS_FALSE);
re=malloc(sizeof(regex_t));
if(regcomp(re, e, REG_EXTENDED||REG_NOSUB) != 0) {
regfree(re);
msSetError(MS_REGEXERR, "Failed to compile expression (%s).",
"msEvalRegex()", e);
return(MS_FALSE);
}
if(regexec(re, s, 0, NULL, 0) != 0) { // no match
regfree(re);
msSetError(MS_REGEXERR, "String (%s) failed expression test.",
"msEvalRegex()", s);
return(MS_FALSE);
}
regfree(re);
return(MS_TRUE);
}
--
Franck Martin <franck at sopac.org>
SOPAC
--=-D0pl64wiKB+o8FV5sV/Q
Content-Type: text/html; charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/1.1.8">
</HEAD>
<BODY>
I modified msEvalRegex in mapfile.c as follows and now it works... I use a regex_t *re instead of a regex_t re.<BR>
<BR>
int msEvalRegex(char *e, char *s) {<BR>
regex_t *re;<BR>
<BR>
if(!e || !s) return(MS_FALSE);<BR>
re=malloc(sizeof(regex_t));<BR>
if(regcomp(re, e, REG_EXTENDED||REG_NOSUB) != 0) {<BR>
regfree(re);<BR>
msSetError(MS_REGEXERR, "Failed to compile expression (%s).", "msEvalRegex()", e); <BR>
return(MS_FALSE);<BR>
}<BR>
if(regexec(re, s, 0, NULL, 0) != 0) { // no match<BR>
regfree(re);<BR>
msSetError(MS_REGEXERR, "String (%s) failed expression test.", "msEvalRegex()", s);<BR>
return(MS_FALSE);<BR>
}<BR>
regfree(re);<BR>
<BR>
return(MS_TRUE);<BR>
}<BR>
<BR>
<BR>
<PRE><TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Franck Martin <<A HREF="mailto:franck at sopac.org">franck at sopac.org</A>><BR>
SOPAC
</TD>
</TR>
</TABLE>
</PRE>
</BODY>
</HTML>
--=-D0pl64wiKB+o8FV5sV/Q--
More information about the MapServer-users
mailing list