Skip to content

Commit

Permalink
Types fixes from QGIS (#494)
Browse files Browse the repository at this point in the history
* backport changes from QGIS

* types fixes from QGIS

* add static_cast

---------

Co-authored-by: Jan Caha <[email protected]>
  • Loading branch information
JanCaha and Jan Caha authored Nov 8, 2024
1 parent 4f5c52d commit de67dc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions mdal/frmts/mdal_xmdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,19 @@ std::unique_ptr< MDAL::Mesh > MDAL::DriverXmdf::load( const std::string &meshFil

std::vector<hsize_t> elementsDims = elements.dims();
hsize_t elementsRows = elementsDims[0];
int elementsRowsDims = elementsDims[1];
hsize_t elementsRowsDims = elementsDims[1];

std::vector<int> facesData = elements.readArrayInt();

Faces faces( elementsRows );
int maxVerticesPerFace = 0;
size_t maxVerticesPerFace = 0;

size_t currentFaceIndex = 0;
i = 0;
while ( i < facesData.size() )
{
std::vector<size_t> tempFace;
for ( int j = 0; j < elementsRowsDims; j++ )
for ( hsize_t j = 0; j < elementsRowsDims; j++ )
{
int vertexIndex = facesData[i];
if ( vertexIndex > 0 )
Expand All @@ -539,7 +539,7 @@ std::unique_ptr< MDAL::Mesh > MDAL::DriverXmdf::load( const std::string &meshFil
}

// only store faces with more than 2 vertices
if ( tempFace.size() > 2 )
if ( tempFace.size() > static_cast<size_t>( 2 ) )
{
Face &face = faces[currentFaceIndex];
std::copy( tempFace.begin(), tempFace.end(), std::back_inserter( face ) );
Expand All @@ -556,7 +556,7 @@ std::unique_ptr< MDAL::Mesh > MDAL::DriverXmdf::load( const std::string &meshFil
facesData.clear();

// copy only the faces that have been properly filled
faces = Faces( faces.begin(), faces.begin() + currentFaceIndex );
faces = Faces( faces.begin(), faces.begin() + static_cast<long>( currentFaceIndex ) );

// create the mesh and set the required data
std::unique_ptr< MemoryMesh > mesh(
Expand Down
2 changes: 1 addition & 1 deletion mdal/mdal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ void MDAL_M_RemoveDatasetGroup( MDAL_MeshH mesh, int index )
}
size_t i = static_cast<size_t>( index );

m->datasetGroups.erase( m->datasetGroups.begin() + i );
m->datasetGroups.erase( m->datasetGroups.begin() + static_cast<long>( i ) );
}

const char *MDAL_M_driverName( MDAL_MeshH mesh )
Expand Down

0 comments on commit de67dc5

Please sign in to comment.