Skip to content

Commit

Permalink
Merge pull request #9372 from rouault/sealing_fixes
Browse files Browse the repository at this point in the history
RFC 97 / Sealing fixes (master only)
  • Loading branch information
rouault authored Mar 3, 2024
2 parents c414fdf + 2025c72 commit 5a5c0d2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion autotest/ogr/ogr_rfc41.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def test_ogr_rfc41_6():
geomfield = ogr.GeomFieldDefn("geomfield", ogr.wkbPolygon)
geomfield.SetSpatialRef(sr)
lyr.CreateGeomField(geomfield)
lyr.GetLayerDefn().GetGeomFieldDefn(0).SetName("geomfield")
lyr.CreateField(ogr.FieldDefn("intfield", ogr.OFTInteger))
lyr.CreateField(ogr.FieldDefn("wkt", ogr.OFTString))
feat = ogr.Feature(lyr.GetLayerDefn())
Expand Down
12 changes: 9 additions & 3 deletions autotest/ogr/ogr_sql_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,15 @@ def test_ogr_sql_28():

ds = ogr.GetDriverByName("Memory").CreateDataSource("my_ds")
lyr = ds.CreateLayer("my_layer")
lyr.GetLayerDefn().GetGeomFieldDefn(0).SetName(
"geom"
) # a bit border line but OK for Memory driver...

new_geom_field_defn = ogr.GeomFieldDefn("geom", ogr.wkbUnknown)
assert (
lyr.AlterGeomFieldDefn(
0, new_geom_field_defn, ogr.ALTER_GEOM_FIELD_DEFN_NAME_FLAG
)
== ogr.OGRERR_NONE
)

field_defn = ogr.FieldDefn("strfield", ogr.OFTString)
lyr.CreateField(field_defn)
field_defn = ogr.FieldDefn("intfield", ogr.OFTInteger)
Expand Down
5 changes: 2 additions & 3 deletions ogr/ogrgeomfielddefn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ void OGRGeomFieldDefn::SetName(const char *pszNameIn)
{
if (m_bSealed)
{
CPLError(
CE_Failure, CPLE_AppDefined,
"OGRGeomFieldDefn::SetComment() not allowed on a sealed object");
CPLError(CE_Failure, CPLE_AppDefined,
"OGRGeomFieldDefn::SetName() not allowed on a sealed object");
return;
}
if (pszName != pszNameIn)
Expand Down
2 changes: 1 addition & 1 deletion ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3458,7 +3458,7 @@ OGRErr OGRShapeLayer::ResizeDBF()
}
else
{
poFieldDefn->SetWidth(panBestWidth[j]);
whileUnsealing(poFieldDefn)->SetWidth(panBestWidth[j]);
}
}
}
Expand Down

0 comments on commit 5a5c0d2

Please sign in to comment.