MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLSetConfigOptionDetectUnknownConfigOption

Function CPLSetConfigOptionDetectUnknownConfigOption

port/cpl_conv.cpp:2033–2066  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2031/************************************************************************/
2032
2033static void CPLSetConfigOptionDetectUnknownConfigOption(const char *pszKey,
2034 const char *pszValue)
2035{
2036 if (EQUAL(pszKey, "CPL_DEBUG"))
2037 {
2038 gnDebug = pszValue ? CPLTestBool(pszValue) : false;
2039 }
2040 else if (CPLIsDebugEnabled())
2041 {
2042 if (!std::binary_search(std::begin(apszKnownConfigOptions),
2043 std::end(apszKnownConfigOptions), pszKey,
2044 [](const char *a, const char *b)
2045 { return STRCASECMP(a, b) < 0; }))
2046 {
2047 bool bFound;
2048 {
2049 std::lock_guard oLock(goMutexDeclaredKnownConfigOptions);
2050 bFound = cpl::contains(goSetKnownConfigOptions,
2051 CPLString(pszKey).toupper());
2052 }
2053 if (!bFound)
2054 {
2055 const char *pszOldValue = CPLGetConfigOption(pszKey, nullptr);
2056 if (!((!pszValue && !pszOldValue) ||
2057 (pszValue && pszOldValue &&
2058 EQUAL(pszValue, pszOldValue))))
2059 {
2060 CPLError(CE_Warning, CPLE_AppDefined,
2061 "Unknown configuration option '%s'.", pszKey);
2062 }
2063 }
2064 }
2065 }
2066}
2067
2068/************************************************************************/
2069/* CPLSetConfigOption() */

Calls 8

CPLTestBoolFunction · 0.85
CPLIsDebugEnabledFunction · 0.85
containsFunction · 0.85
CPLStringFunction · 0.85
CPLErrorFunction · 0.85
beginFunction · 0.70
endFunction · 0.70
EQUALFunction · 0.50

Tested by

no test coverage detected