[mapserver-commits] r10606 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Thu Oct 14 14:31:30 EDT 2010
Author: warmerdam
Date: 2010-10-14 11:31:30 -0700 (Thu, 14 Oct 2010)
New Revision: 10606
Modified:
trunk/mapserver/mapows.c
trunk/mapserver/mapows.h
Log:
provide some ows defines and functions regardless of services enabled - fixes builds with no ows services
Modified: trunk/mapserver/mapows.c
===================================================================
--- trunk/mapserver/mapows.c 2010-10-14 18:25:41 UTC (rev 10605)
+++ trunk/mapserver/mapows.c 2010-10-14 18:31:30 UTC (rev 10606)
@@ -249,6 +249,66 @@
}
+/* msOWSParseVersionString()
+**
+** Parse a version string in the format "a.b.c" or "a.b" and return an
+** integer in the format 0x0a0b0c suitable for regular integer comparisons.
+**
+** Returns one of OWS_VERSION_NOTSET or OWS_VERSION_BADFORMAT if version
+** could not be parsed.
+*/
+int msOWSParseVersionString(const char *pszVersion)
+{
+ char **digits = NULL;
+ int numDigits = 0;
+
+ if (pszVersion)
+ {
+ int nVersion = 0;
+ digits = msStringSplit(pszVersion, '.', &numDigits);
+ if (digits == NULL || numDigits < 2 || numDigits > 3)
+ {
+ msSetError(MS_OWSERR,
+ "Invalid version (%s). Version must be in the "
+ "format 'x.y' or 'x.y.z'",
+ "msOWSParseVersionString()", pszVersion);
+ if (digits)
+ msFreeCharArray(digits, numDigits);
+ return OWS_VERSION_BADFORMAT;
+ }
+
+ nVersion = atoi(digits[0])*0x010000;
+ nVersion += atoi(digits[1])*0x0100;
+ if (numDigits > 2)
+ nVersion += atoi(digits[2]);
+
+ msFreeCharArray(digits, numDigits);
+
+ return nVersion;
+ }
+
+ return OWS_VERSION_NOTSET;
+}
+
+/* msOWSGetVersionString()
+**
+** Returns a OWS version string in the format a.b.c from the integer
+** version value passed as argument (0x0a0b0c)
+**
+** Fills in the pszBuffer and returns a reference to it. Recommended buffer
+** size is OWS_VERSION_MAXLEN chars.
+*/
+const char *msOWSGetVersionString(int nVersion, char *pszBuffer)
+{
+
+ if (pszBuffer)
+ snprintf(pszBuffer, OWS_VERSION_MAXLEN-1, "%d.%d.%d",
+ (nVersion/0x10000)%0x100, (nVersion/0x100)%0x100, nVersion%0x100);
+
+ return pszBuffer;
+}
+
+
#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) || defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
#if !defined(USE_PROJ)
@@ -521,66 +581,6 @@
return language;
}
-/* msOWSParseVersionString()
-**
-** Parse a version string in the format "a.b.c" or "a.b" and return an
-** integer in the format 0x0a0b0c suitable for regular integer comparisons.
-**
-** Returns one of OWS_VERSION_NOTSET or OWS_VERSION_BADFORMAT if version
-** could not be parsed.
-*/
-int msOWSParseVersionString(const char *pszVersion)
-{
- char **digits = NULL;
- int numDigits = 0;
-
- if (pszVersion)
- {
- int nVersion = 0;
- digits = msStringSplit(pszVersion, '.', &numDigits);
- if (digits == NULL || numDigits < 2 || numDigits > 3)
- {
- msSetError(MS_OWSERR,
- "Invalid version (%s). Version must be in the "
- "format 'x.y' or 'x.y.z'",
- "msOWSParseVersionString()", pszVersion);
- if (digits)
- msFreeCharArray(digits, numDigits);
- return OWS_VERSION_BADFORMAT;
- }
-
- nVersion = atoi(digits[0])*0x010000;
- nVersion += atoi(digits[1])*0x0100;
- if (numDigits > 2)
- nVersion += atoi(digits[2]);
-
- msFreeCharArray(digits, numDigits);
-
- return nVersion;
- }
-
- return OWS_VERSION_NOTSET;
-}
-
-/* msOWSGetVersionString()
-**
-** Returns a OWS version string in the format a.b.c from the integer
-** version value passed as argument (0x0a0b0c)
-**
-** Fills in the pszBuffer and returns a reference to it. Recommended buffer
-** size is OWS_VERSION_MAXLEN chars.
-*/
-const char *msOWSGetVersionString(int nVersion, char *pszBuffer)
-{
-
- if (pszBuffer)
- snprintf(pszBuffer, OWS_VERSION_MAXLEN-1, "%d.%d.%d",
- (nVersion/0x10000)%0x100, (nVersion/0x100)%0x100, nVersion%0x100);
-
- return pszBuffer;
-}
-
-
/*
** msOWSPrintMetadata()
**
Modified: trunk/mapserver/mapows.h
===================================================================
--- trunk/mapserver/mapows.h 2010-10-14 18:25:41 UTC (rev 10605)
+++ trunk/mapserver/mapows.h 2010-10-14 18:31:30 UTC (rev 10606)
@@ -184,15 +184,6 @@
const char *namespaces,
const char *name);
-#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) || defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
-
-MS_DLL_EXPORT int msOWSMakeAllLayersUnique(mapObj *map);
-MS_DLL_EXPORT int msOWSNegotiateVersion(int requested_version, int supported_versions[], int num_supported_versions);
-MS_DLL_EXPORT char *msOWSTerminateOnlineResource(const char *src_url);
-MS_DLL_EXPORT char *msOWSGetOnlineResource(mapObj *map, const char *namespaces, const char *metadata_name, cgiRequestObj *req);
-MS_DLL_EXPORT const char *msOWSGetSchemasLocation(mapObj *map);
-MS_DLL_EXPORT const char *msOWSGetLanguage(mapObj *map, const char *context);
-
/* Constants for OWS Service version numbers */
#define OWS_0_1_2 0x000102
#define OWS_0_1_4 0x000104
@@ -213,7 +204,16 @@
MS_DLL_EXPORT int msOWSParseVersionString(const char *pszVersion);
MS_DLL_EXPORT const char *msOWSGetVersionString(int nVersion, char *pszBuffer);
+#if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) || defined(USE_WMS_LYR) || defined(USE_WFS_LYR)
+MS_DLL_EXPORT int msOWSMakeAllLayersUnique(mapObj *map);
+MS_DLL_EXPORT int msOWSNegotiateVersion(int requested_version, int supported_versions[], int num_supported_versions);
+MS_DLL_EXPORT char *msOWSTerminateOnlineResource(const char *src_url);
+MS_DLL_EXPORT char *msOWSGetOnlineResource(mapObj *map, const char *namespaces, const char *metadata_name, cgiRequestObj *req);
+MS_DLL_EXPORT const char *msOWSGetSchemasLocation(mapObj *map);
+MS_DLL_EXPORT const char *msOWSGetLanguage(mapObj *map, const char *context);
+
+
/* OWS_NOERR and OWS_WARN passed as action_if_not_found to printMetadata() */
#define OWS_NOERR 0
#define OWS_WARN 1
More information about the mapserver-commits
mailing list