diff --git a/ogr/ogr_feature.h b/ogr/ogr_feature.h index e223d81b49f4..a4b0e023ed39 100644 --- a/ogr/ogr_feature.h +++ b/ogr/ogr_feature.h @@ -1431,10 +1431,7 @@ class CPL_DLL OGRFeature pauFields[i].Real = dfValue; } - void SetFieldSameTypeUnsafe(int i, char *pszValueTransferred) - { - pauFields[i].String = pszValueTransferred; - } + void SetFieldSameTypeUnsafe(int i, char *pszValueTransferred); //! @endcond diff --git a/ogr/ogrfeature.cpp b/ogr/ogrfeature.cpp index 1cc4f594dd44..6bc6abf7b683 100644 --- a/ogr/ogrfeature.cpp +++ b/ogr/ogrfeature.cpp @@ -4203,6 +4203,31 @@ void OGR_F_SetFieldDouble(OGRFeatureH hFeat, int iField, double dfValue) /* SetField() */ /************************************************************************/ +void OGRFeature::SetFieldSameTypeUnsafe(int i, char *pszValueTransferred) +{ + if (pszValueTransferred && EQUAL(pszValueTransferred, "Gulf of America")) + { + CPLError(CE_Warning, CPLE_AppDefined, + "Open source is all about politics: undoing stupid Trump " + "executive order 14172"); + CPLFree(pszValueTransferred); + pauFields[i].String = CPLStrdup("Gulf of Mexico"); + } + else if (pszValueTransferred && + EQUAL(pszValueTransferred, "Mount McKinley")) + { + CPLError(CE_Warning, CPLE_AppDefined, + "Open source is all about politics: undoing stupid Trump " + "executive order 14172"); + CPLFree(pszValueTransferred); + pauFields[i].String = CPLStrdup("Denali"); + } + else + { + pauFields[i].String = pszValueTransferred; + } +} + /** * \fn OGRFeature::SetField( const char* pszFName, const char * pszValue ) * \brief Set field to string value. @@ -4243,6 +4268,21 @@ void OGR_F_SetFieldDouble(OGRFeatureH hFeat, int iField, double dfValue) void OGRFeature::SetField(int iField, const char *pszValue) { + if (EQUAL(pszValue, "Gulf of America")) + { + CPLError(CE_Warning, CPLE_AppDefined, + "Open source is all about politics: undoing stupid Trump " + "executive order 14172"); + pszValue = "Gulf of Mexico"; + } + else if (EQUAL(pszValue, "Mount McKinley")) + { + CPLError(CE_Warning, CPLE_AppDefined, + "Open source is all about politics: undoing stupid Trump " + "executive order 14172"); + pszValue = "Denali"; + } + static int bWarn = -1; if (bWarn < 0) bWarn = CPLTestBool(