Skip to content

Commit

Permalink
OGRFeature setters: remove useless const_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Oct 5, 2024
1 parent d09bdd0 commit 3194bf8
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions ogr/ogrfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4440,8 +4440,8 @@ void OGRFeature::SetField(int iField, const char *pszValue)
}
else
{
const char *papszValues[2] = {pszValue, nullptr};
SetField(iField, const_cast<char **>(papszValues));
const char *const papszValues[2] = {pszValue, nullptr};
SetField(iField, papszValues);
}
}
}
Expand Down Expand Up @@ -5062,8 +5062,7 @@ void OGR_F_SetFieldStringList(OGRFeatureH hFeat, int iField,
{
VALIDATE_POINTER0(hFeat, "OGR_F_SetFieldStringList");

OGRFeature::FromHandle(hFeat)->SetField(
iField, const_cast<const char *const *>(papszValues));
OGRFeature::FromHandle(hFeat)->SetField(iField, papszValues);
}

/************************************************************************/
Expand Down Expand Up @@ -6576,9 +6575,7 @@ OGRErr OGRFeature::SetFieldsFrom(const OGRFeature *poSrcFeature,
if (eDstType == OFTDate || eDstType == OFTTime ||
eDstType == OFTDateTime)
{
SetField(iDstField,
const_cast<OGRField *>(
poSrcFeature->GetRawFieldRef(iField)));
SetField(iDstField, poSrcFeature->GetRawFieldRef(iField));
}
else if (eDstType == OFTString || eDstType == OFTStringList)
{
Expand All @@ -6598,9 +6595,7 @@ OGRErr OGRFeature::SetFieldsFrom(const OGRFeature *poSrcFeature,
{
if (eSrcType == eDstType)
{
SetField(iDstField,
const_cast<OGRField *>(
poSrcFeature->GetRawFieldRef(iField)));
SetField(iDstField, poSrcFeature->GetRawFieldRef(iField));
}
else if (eDstType == OFTString || eDstType == OFTStringList)
{
Expand Down

0 comments on commit 3194bf8

Please sign in to comment.