MCPcopy Index your code
hub / github.com/MapServer/MapServer / msOWSNegotiateUpdateSequence

Function msOWSNegotiateUpdateSequence

mapows.c:2121–2181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2119 */
2120
2121int msOWSNegotiateUpdateSequence(const char *requested_updatesequence, const char *updatesequence) {
2122 int i;
2123 int valtype1 = 1; /* default datatype for updatesequence passed by client */
2124 int valtype2 = 1; /* default datatype for updatesequence set by server */
2125 struct tm tm_requested_updatesequence, tm_updatesequence;
2126
2127 /* if not specified by client, or set by server,
2128 server responds with latest Capabilities XML */
2129 if (! requested_updatesequence || ! updatesequence)
2130 return -1;
2131
2132 /* test to see if server value is an integer (1), string (2) or timestamp (3) */
2133 if (msStringIsInteger(updatesequence) == MS_FAILURE)
2134 valtype1 = 2;
2135
2136 if (valtype1 == 2) { /* test if timestamp */
2137 msTimeInit(&tm_updatesequence);
2138 if (msParseTime(updatesequence, &tm_updatesequence) == MS_TRUE)
2139 valtype1 = 3;
2140 msResetErrorList();
2141 }
2142
2143 /* test to see if client value is an integer (1), string (2) or timestamp (3) */
2144 if (msStringIsInteger(requested_updatesequence) == MS_FAILURE)
2145 valtype2 = 2;
2146
2147 if (valtype2 == 2) { /* test if timestamp */
2148 msTimeInit(&tm_requested_updatesequence);
2149 if (msParseTime(requested_updatesequence, &tm_requested_updatesequence) == MS_TRUE)
2150 valtype2 = 3;
2151 msResetErrorList();
2152 }
2153
2154 /* if the datatypes do not match, do not compare, */
2155 if (valtype1 != valtype2)
2156 return -1;
2157
2158 if (valtype1 == 1) { /* integer */
2159 if (atoi(requested_updatesequence) < atoi(updatesequence))
2160 return -1;
2161
2162 if (atoi(requested_updatesequence) > atoi(updatesequence))
2163 return 1;
2164
2165 if (atoi(requested_updatesequence) == atoi(updatesequence))
2166 return 0;
2167 }
2168
2169 if (valtype1 == 2) /* string */
2170 return strcasecmp(requested_updatesequence, updatesequence);
2171
2172 if (valtype1 == 3) { /* timestamp */
2173 /* compare timestamps */
2174 i = msDateCompare(&tm_requested_updatesequence, &tm_updatesequence) +
2175 msTimeCompare(&tm_requested_updatesequence, &tm_updatesequence);
2176 return i;
2177 }
2178

Callers 7

msWCSGetCapabilitiesFunction · 0.85
msWCSGetCapabilities20Function · 0.85
msWFSGetCapabilities11Function · 0.85
msWMSGetCapabilitiesFunction · 0.85
msWFSGetCapabilitiesFunction · 0.85
msWCSGetCapabilities11Function · 0.85
msSOSGetCapabilitiesFunction · 0.85

Calls 7

msStringIsIntegerFunction · 0.85
msTimeInitFunction · 0.85
msParseTimeFunction · 0.85
msResetErrorListFunction · 0.85
strcasecmpFunction · 0.85
msDateCompareFunction · 0.85
msTimeCompareFunction · 0.85

Tested by

no test coverage detected