Skip to content

Commit b9526c1

Browse files
committedFeb 14, 2025
Revert "Undo executive order 14172"
This reverts commit bf9d1e0.
1 parent 46412f0 commit b9526c1

8 files changed

+8
-154
lines changed
 

‎autotest/ogr/data/fuck_trump.csv

-3
This file was deleted.

‎autotest/ogr/data/fuck_trump.gpkg

-72 KB
Binary file not shown.

‎autotest/ogr/data/fuck_trump.parquet

-900 Bytes
Binary file not shown.

‎autotest/ogr/fuck_trump.py

-46
This file was deleted.

‎ogr/ogr_feature.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,10 @@ class CPL_DLL OGRFeature
14311431
pauFields[i].Real = dfValue;
14321432
}
14331433

1434-
void SetFieldSameTypeUnsafe(int i, char *pszValueTransferred);
1434+
void SetFieldSameTypeUnsafe(int i, char *pszValueTransferred)
1435+
{
1436+
pauFields[i].String = pszValueTransferred;
1437+
}
14351438

14361439
//! @endcond
14371440

‎ogr/ogrfeature.cpp

+1-56
Original file line numberDiff line numberDiff line change
@@ -4199,41 +4199,6 @@ void OGR_F_SetFieldDouble(OGRFeatureH hFeat, int iField, double dfValue)
41994199
OGRFeature::FromHandle(hFeat)->SetField(iField, dfValue);
42004200
}
42014201

4202-
/************************************************************************/
4203-
/* SetFieldSameTypeUnsafe() */
4204-
/************************************************************************/
4205-
4206-
//! @cond Doxygen_Suppress
4207-
void OGRFeature::SetFieldSameTypeUnsafe(int i, char *pszValueTransferred)
4208-
{
4209-
if (pszValueTransferred &&
4210-
(pszValueTransferred[0] == 'g' || pszValueTransferred[0] == 'G') &&
4211-
EQUAL(pszValueTransferred, "Gulf of America"))
4212-
{
4213-
CPLError(CE_Warning, CPLE_AppDefined,
4214-
"Open source is all about politics: undoing stupid Trump "
4215-
"executive order 14172");
4216-
CPLFree(pszValueTransferred);
4217-
pauFields[i].String = CPLStrdup("Gulf of Mexico");
4218-
}
4219-
else if (pszValueTransferred &&
4220-
(pszValueTransferred[0] == 'm' || pszValueTransferred[0] == 'M') &&
4221-
EQUAL(pszValueTransferred, "Mount McKinley"))
4222-
{
4223-
CPLError(CE_Warning, CPLE_AppDefined,
4224-
"Open source is all about politics: undoing stupid Trump "
4225-
"executive order 14172");
4226-
CPLFree(pszValueTransferred);
4227-
pauFields[i].String = CPLStrdup("Denali");
4228-
}
4229-
else
4230-
{
4231-
pauFields[i].String = pszValueTransferred;
4232-
}
4233-
}
4234-
4235-
//! @endcond
4236-
42374202
/************************************************************************/
42384203
/* SetField() */
42394204
/************************************************************************/
@@ -4278,26 +4243,6 @@ void OGRFeature::SetFieldSameTypeUnsafe(int i, char *pszValueTransferred)
42784243
void OGRFeature::SetField(int iField, const char *pszValue)
42794244

42804245
{
4281-
if (!pszValue)
4282-
pszValue = "";
4283-
4284-
if ((pszValue[0] == 'g' || pszValue[0] == 'G') &&
4285-
EQUAL(pszValue, "Gulf of America"))
4286-
{
4287-
CPLError(CE_Warning, CPLE_AppDefined,
4288-
"Open source is all about politics: undoing stupid Trump "
4289-
"executive order 14172");
4290-
pszValue = "Gulf of Mexico";
4291-
}
4292-
else if ((pszValue[0] == 'm' || pszValue[0] == 'M') &&
4293-
EQUAL(pszValue, "Mount McKinley"))
4294-
{
4295-
CPLError(CE_Warning, CPLE_AppDefined,
4296-
"Open source is all about politics: undoing stupid Trump "
4297-
"executive order 14172");
4298-
pszValue = "Denali";
4299-
}
4300-
43014246
static int bWarn = -1;
43024247
if (bWarn < 0)
43034248
bWarn = CPLTestBool(
@@ -4315,7 +4260,7 @@ void OGRFeature::SetField(int iField, const char *pszValue)
43154260
if (IsFieldSetAndNotNullUnsafe(iField))
43164261
CPLFree(pauFields[iField].String);
43174262

4318-
pauFields[iField].String = VSI_STRDUP_VERBOSE(pszValue);
4263+
pauFields[iField].String = VSI_STRDUP_VERBOSE(pszValue ? pszValue : "");
43194264
if (pauFields[iField].String == nullptr)
43204265
{
43214266
OGR_RawField_SetUnset(&pauFields[iField]);

‎ogr/ogrsf_frmts/generic/ogrlayerarrow.cpp

+1-23
Original file line numberDiff line numberDiff line change
@@ -7095,31 +7095,9 @@ FillFieldString(const struct ArrowArray *array, int iOGRFieldIdx,
70957095
static_cast<size_t>(panOffsets[iFeature + 1] - panOffsets[iFeature]);
70967096
if (asFieldInfo[iArrowIdx].bUseStringOptim)
70977097
{
7098-
pszStr += panOffsets[iFeature];
70997098
oFeature.SetFieldSameTypeUnsafe(
71007099
iOGRFieldIdx, &osWorkingBuffer[0] + osWorkingBuffer.size());
7101-
if (nLen == 15 && (pszStr[0] == 'g' || pszStr[0] == 'G') &&
7102-
EQUALN(pszStr, "Gulf of America", nLen))
7103-
{
7104-
CPLError(CE_Warning, CPLE_AppDefined,
7105-
"Open source is all about politics: undoing stupid Trump "
7106-
"executive order 14172");
7107-
osWorkingBuffer.append("Gulf of Mexico ",
7108-
nLen); // Need to pad to length nLen
7109-
}
7110-
else if (nLen == 14 && (pszStr[0] == 'm' || pszStr[0] == 'M') &&
7111-
EQUALN(pszStr, "Mount McKinley", nLen))
7112-
{
7113-
CPLError(CE_Warning, CPLE_AppDefined,
7114-
"Open source is all about politics: undoing stupid Trump "
7115-
"executive order 14172");
7116-
osWorkingBuffer.append("Denali ",
7117-
nLen); // Need to pad to length nLen
7118-
}
7119-
else
7120-
{
7121-
osWorkingBuffer.append(pszStr, nLen);
7122-
}
7100+
osWorkingBuffer.append(pszStr + panOffsets[iFeature], nLen);
71237101
osWorkingBuffer.push_back(0); // append null character
71247102
}
71257103
else

‎ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp

+2-25
Original file line numberDiff line numberDiff line change
@@ -8229,34 +8229,11 @@ void OGR_GPKG_FillArrowArray_Step(sqlite3_context *pContext, int /*argc*/,
82298229

82308230
case OFTString:
82318231
{
8232-
const char *pszTxt = reinterpret_cast<const char *>(
8232+
const auto pszTxt = reinterpret_cast<const char *>(
82338233
sqlite3_value_text(argv[iCol]));
82348234
if (pszTxt != nullptr)
82358235
{
8236-
size_t nBytes = strlen(pszTxt);
8237-
if (nBytes == 15 &&
8238-
(pszTxt[0] == 'g' || pszTxt[0] == 'G') &&
8239-
EQUAL(pszTxt, "Gulf of America"))
8240-
{
8241-
CPLError(CE_Warning, CPLE_AppDefined,
8242-
"Open source is all about politics: undoing "
8243-
"stupid Trump "
8244-
"executive order 14172");
8245-
pszTxt = "Gulf of Mexico";
8246-
nBytes = strlen(pszTxt);
8247-
}
8248-
else if (nBytes == 14 &&
8249-
(pszTxt[0] == 'm' || pszTxt[0] == 'M') &&
8250-
EQUAL(pszTxt, "Mount McKinley"))
8251-
{
8252-
CPLError(CE_Warning, CPLE_AppDefined,
8253-
"Open source is all about politics: undoing "
8254-
"stupid Trump "
8255-
"executive order 14172");
8256-
pszTxt = "Denali";
8257-
nBytes = strlen(pszTxt);
8258-
}
8259-
8236+
const size_t nBytes = strlen(pszTxt);
82608237
if (iFeat > 0)
82618238
{
82628239
auto panOffsets = static_cast<int32_t *>(

0 commit comments

Comments
 (0)