Skip to content

Commit

Permalink
Last Even comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelPau committed Apr 9, 2024
1 parent 469ea47 commit c4c5b0a
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions ogr/ogrsf_frmts/miramon/ogrmiramonlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,9 +1434,9 @@ OGRErr OGRMiraMonLayer::MMProcessMultiGeometry(OGRGeometryH hGeom,
int nGeom = OGR_G_GetGeometryCount(OGRGeometry::ToHandle(poGeom));
for (int iGeom = 0; iGeom < nGeom; iGeom++)
{
OGRGeometryH poNewGeometry =
OGRGeometryH poSubGeometry =
OGR_G_GetGeometryRef(OGRGeometry::ToHandle(poGeom), iGeom);
eErr = MMProcessMultiGeometry(poNewGeometry, poFeature);
eErr = MMProcessMultiGeometry(poSubGeometry, poFeature);
if (eErr != OGRERR_NONE)
return eErr;
}
Expand All @@ -1449,9 +1449,9 @@ OGRErr OGRMiraMonLayer::MMProcessMultiGeometry(OGRGeometryH hGeom,
int nGeom = OGR_G_GetGeometryCount(OGRGeometry::ToHandle(poGeom));
for (int iGeom = 0; iGeom < nGeom; iGeom++)
{
OGRGeometryH poNewGeometry =
OGRGeometryH poSubGeometry =
OGR_G_GetGeometryRef(OGRGeometry::ToHandle(poGeom), iGeom);
eErr = MMProcessGeometry(poNewGeometry, poFeature, (iGeom == 0));
eErr = MMProcessGeometry(poSubGeometry, poFeature, (iGeom == 0));
if (eErr != OGRERR_NONE)
return eErr;
}
Expand Down Expand Up @@ -1587,10 +1587,16 @@ OGRErr OGRMiraMonLayer::ICreateFeature(OGRFeature *poFeature)
if (!m_bUpdate)
{
CPLError(CE_Failure, CPLE_NoWriteAccess,
"\nCannot create features on a read-only dataset.");
"Cannot create features on a read-only dataset.");
return OGRERR_FAILURE;
}

// DEBUG ABEL
if (phMiraMonLayer && phMiraMonLayer->TopHeader.nElemCount >= 694954)
{
int a = 0;
}

/* -------------------------------------------------------------------- */
/* Write out the feature */
/* -------------------------------------------------------------------- */
Expand All @@ -1612,9 +1618,9 @@ OGRErr OGRMiraMonLayer::ICreateFeature(OGRFeature *poFeature)
LOG_ACTION(OGR_G_GetGeometryCount(OGRGeometry::ToHandle(poGeom)));
for (int iGeom = 0; iGeom < nGeom; iGeom++)
{
OGRGeometryH poNewGeometry = LOG_ACTION(
OGRGeometryH poSubGeometry = LOG_ACTION(
OGR_G_GetGeometryRef(OGRGeometry::ToHandle(poGeom), iGeom));
eErr = LOG_ACTION(MMProcessMultiGeometry(poNewGeometry, poFeature));
eErr = LOG_ACTION(MMProcessMultiGeometry(poSubGeometry, poFeature));
if (eErr != OGRERR_NONE)
return eErr;
}
Expand Down Expand Up @@ -1742,10 +1748,10 @@ OGRErr OGRMiraMonLayer::MMLoadGeometry(OGRGeometryH hGeom)
{
for (int iGeom = 0; iGeom < nGeom; iGeom++)
{
OGRGeometryH poNewGeometry = OGR_G_GetGeometryRef(hGeom, iGeom);
OGRGeometryH poSubGeometry = OGR_G_GetGeometryRef(hGeom, iGeom);

// Reads all coordinates
eErr = MMLoadGeometry(poNewGeometry);
eErr = MMLoadGeometry(poSubGeometry);
if (eErr != OGRERR_NONE)
return eErr;
}
Expand All @@ -1754,14 +1760,14 @@ OGRErr OGRMiraMonLayer::MMLoadGeometry(OGRGeometryH hGeom)
{
for (int iGeom = 0; iGeom < nGeom && eErr == OGRERR_NONE; iGeom++)
{
OGRGeometryH poNewGeometry = OGR_G_GetGeometryRef(hGeom, iGeom);
OGRGeometryH poSubGeometry = OGR_G_GetGeometryRef(hGeom, iGeom);

if (iGeom == 0)
bExternalRing = true;
else
bExternalRing = false;

eErr = MMDumpVertices(poNewGeometry, bExternalRing, TRUE);
eErr = MMDumpVertices(poSubGeometry, bExternalRing, TRUE);
if (eErr != OGRERR_NONE)
return eErr;
}
Expand Down Expand Up @@ -1835,13 +1841,13 @@ OGRErr OGRMiraMonLayer::TranslateFieldsToMM()
return OGRERR_NONE;

phMiraMonLayer->pLayerDB = static_cast<struct MiraMonDataBase *>(
CPLCalloc(sizeof(*phMiraMonLayer->pLayerDB), 1));
VSICalloc(sizeof(*phMiraMonLayer->pLayerDB), 1));
if (!phMiraMonLayer->pLayerDB)
return OGRERR_NOT_ENOUGH_MEMORY;

phMiraMonLayer->pLayerDB->pFields =
static_cast<struct MiraMonDataBaseField *>(
CPLCalloc(m_poFeatureDefn->GetFieldCount(),
VSICalloc(m_poFeatureDefn->GetFieldCount(),
sizeof(*(phMiraMonLayer->pLayerDB->pFields))));
if (!phMiraMonLayer->pLayerDB->pFields)
return OGRERR_NOT_ENOUGH_MEMORY;
Expand Down

0 comments on commit c4c5b0a

Please sign in to comment.