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

Function msOWSParseVersionString

mapows.c:507–538  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

505** could not be parsed.
506*/
507int msOWSParseVersionString(const char *pszVersion)
508{
509 char **digits = NULL;
510 int numDigits = 0;
511
512 if (pszVersion)
513 {
514 int nVersion = 0;
515 digits = msStringSplit(pszVersion, '.', &numDigits);
516 if (digits == NULL || numDigits < 2 || numDigits > 3)
517 {
518 msSetError(MS_OWSERR,
519 "Invalid version (%s). Version must be in the "
520 "format 'x.y' or 'x.y.z'",
521 "msOWSParseVersionString()", pszVersion);
522 if (digits)
523 msFreeCharArray(digits, numDigits);
524 return OWS_VERSION_BADFORMAT;
525 }
526
527 nVersion = atoi(digits[0])*0x010000;
528 nVersion += atoi(digits[1])*0x0100;
529 if (numDigits > 2)
530 nVersion += atoi(digits[2]);
531
532 msFreeCharArray(digits, numDigits);
533
534 return nVersion;
535 }
536
537 return OWS_VERSION_NOTSET;
538}
539
540/* msOWSGetVersionString()
541**

Callers 14

msSLDGenerateSLDFunction · 0.85
msBuildWMSLayerURLFunction · 0.85
msWCSExceptionFunction · 0.85
msWCSGetCapabilitiesFunction · 0.85
msWCSDispatch20Function · 0.85
msWMSDispatchFunction · 0.85
msLoadMapContextFunction · 0.85
msWriteMapContextFunction · 0.85
msMapLoadOWSParametersFunction · 0.85
msWFSExceptionFunction · 0.85
msWFSGetCapabilitiesFunction · 0.85
msWFSGetFeatureFunction · 0.85

Calls 3

msStringSplitFunction · 0.85
msSetErrorFunction · 0.85
msFreeCharArrayFunction · 0.85

Tested by

no test coverage detected