From 3194bf8e8da1a7771197418f37174401732995f1 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 5 Oct 2024 15:42:13 +0200 Subject: [PATCH] OGRFeature setters: remove useless const_cast --- ogr/ogrfeature.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ogr/ogrfeature.cpp b/ogr/ogrfeature.cpp index 684f22f53fac..6b16502619ba 100644 --- a/ogr/ogrfeature.cpp +++ b/ogr/ogrfeature.cpp @@ -4440,8 +4440,8 @@ void OGRFeature::SetField(int iField, const char *pszValue) } else { - const char *papszValues[2] = {pszValue, nullptr}; - SetField(iField, const_cast(papszValues)); + const char *const papszValues[2] = {pszValue, nullptr}; + SetField(iField, papszValues); } } } @@ -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(papszValues)); + OGRFeature::FromHandle(hFeat)->SetField(iField, papszValues); } /************************************************************************/ @@ -6576,9 +6575,7 @@ OGRErr OGRFeature::SetFieldsFrom(const OGRFeature *poSrcFeature, if (eDstType == OFTDate || eDstType == OFTTime || eDstType == OFTDateTime) { - SetField(iDstField, - const_cast( - poSrcFeature->GetRawFieldRef(iField))); + SetField(iDstField, poSrcFeature->GetRawFieldRef(iField)); } else if (eDstType == OFTString || eDstType == OFTStringList) { @@ -6598,9 +6595,7 @@ OGRErr OGRFeature::SetFieldsFrom(const OGRFeature *poSrcFeature, { if (eSrcType == eDstType) { - SetField(iDstField, - const_cast( - poSrcFeature->GetRawFieldRef(iField))); + SetField(iDstField, poSrcFeature->GetRawFieldRef(iField)); } else if (eDstType == OFTString || eDstType == OFTStringList) {