[mapserver-commits] r8004 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Nov 4 01:45:14 EST 2008


Author: pramsey
Date: 2008-11-04 01:45:14 -0500 (Tue, 04 Nov 2008)
New Revision: 8004

Modified:
   trunk/mapserver/configure.in
   trunk/mapserver/mapserver.h
   trunk/mapserver/mapstring.c
   trunk/mapserver/nmake.opt
Log:
Add in BSD strcasestr for VC8


Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in	2008-11-04 06:28:42 UTC (rev 8003)
+++ trunk/mapserver/configure.in	2008-11-04 06:45:14 UTC (rev 8004)
@@ -68,6 +68,7 @@
 AC_CHECK_FUNC(strncasecmp, , STRINGS="-DNEED_STRNCASECMP $STRINGS")
 AC_CHECK_FUNC(strdup, ,      STRINGS="-DNEED_STRDUP $STRINGS")
 AC_CHECK_FUNC(strrstr, ,      STRINGS="-DNEED_STRRSTR $STRINGS")
+AC_CHECK_FUNC(strcasestr, ,      STRINGS="-DNEED_STRCASESTR $STRINGS")
 AC_CHECK_FUNC(strlcat, ,      STRINGS="-DNEED_STRLCAT $STRINGS")
 AC_CHECK_FUNC(vsnprintf, STRINGS="-DHAVE_VSNPRINTF $STRINGS", )
 AC_SUBST(STRINGS, $STRINGS)

Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h	2008-11-04 06:28:42 UTC (rev 8003)
+++ trunk/mapserver/mapserver.h	2008-11-04 06:45:14 UTC (rev 8004)
@@ -1652,6 +1652,10 @@
 MS_DLL_EXPORT char *strrstr(char *string, char *find);
 #endif /* NEED_STRRSTR */
 
+#ifdef NEED_STRCASESTR
+MS_DLL_EXPORT char *strcasestr(const char *s, const char *find)
+#endif /* NEED_STRCASESTR */
+
 #ifdef NEED_STRNCASECMP
 MS_DLL_EXPORT int strncasecmp(const char *s1, const char *s2, int len);
 #endif /* NEED_STRNCASECMP */

Modified: trunk/mapserver/mapstring.c
===================================================================
--- trunk/mapserver/mapstring.c	2008-11-04 06:28:42 UTC (rev 8003)
+++ trunk/mapserver/mapstring.c	2008-11-04 06:45:14 UTC (rev 8004)
@@ -36,7 +36,12 @@
 MS_CVSID("$Id$")
 
 #include <ctype.h>
+#include <string.h>
 
+/*
+ * Find the first occurrence of find in s, ignore case.
+ */
+
 #ifdef USE_FRIBIDI
 #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(USE_FRIBIDI2)
 #include "fribidi.h"
@@ -160,6 +165,58 @@
 }
 #endif
 
+#ifdef NEED_STRCASESTR
+/*-
+ * Copyright (c) 1990, 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+char *strcasestr(const char *s, const char *find)
+{
+	char c, sc;
+	size_t len;
+
+	if ((c = *find++) != 0) {
+		c = tolower((unsigned char)c);
+		len = strlen(find);
+		do {
+			do {
+				if ((sc = *s++) == 0)
+					return (NULL);
+			} while ((char)tolower((unsigned char)sc) != c);
+		} while (strncasecmp(s, find, len) != 0);
+		s--;
+	}
+	return ((char *)s);
+}
+#endif
+
 #ifdef NEED_STRDUP
 char	*strdup(char *s)
 {

Modified: trunk/mapserver/nmake.opt
===================================================================
--- trunk/mapserver/nmake.opt	2008-11-04 06:28:42 UTC (rev 8003)
+++ trunk/mapserver/nmake.opt	2008-11-04 06:45:14 UTC (rev 8004)
@@ -136,7 +136,7 @@
 # following line to reflect the missing functions on your platform.
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 #STRINGS=-DNEED_STRCASECMP -DNEED_STRNCASECMP -DNEED_STRDUP
-STRINGS=-DNEED_STRCASECMP -DNEED_STRNCASECMP -DNEED_STRLCAT -DNEED_STRRSTR
+STRINGS=-DNEED_STRCASECMP -DNEED_STRNCASECMP -DNEED_STRLCAT -DNEED_STRRSTR -DNEED_STRCASESTR
 
 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # Threading



More information about the mapserver-commits mailing list