Skip to content

Commit

Permalink
Cast size_t to unsigned int to avoid conversion warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
gostefan committed Sep 4, 2024
1 parent 798623f commit b8724f5
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion sources/src/citygml/citymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace citygml

unsigned int CityModel::getNumRootCityObjects() const
{
return m_roots.size();
return static_cast<unsigned int>(m_roots.size());
}

CityObject& CityModel::getRootCityObject(int i)
Expand Down
6 changes: 3 additions & 3 deletions sources/src/citygml/cityobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace citygml {

unsigned int CityObject::getGeometriesCount() const
{
return m_geometries.size();
return static_cast<unsigned int>(m_geometries.size());
}

const Geometry& CityObject::getGeometry(unsigned int i) const
Expand All @@ -50,7 +50,7 @@ namespace citygml {

unsigned int CityObject::getImplicitGeometryCount() const
{
return m_implicitGeometries.size();
return static_cast<unsigned int>(m_implicitGeometries.size());
}

const ImplicitGeometry& CityObject::getImplicitGeometry(unsigned int i) const
Expand All @@ -70,7 +70,7 @@ namespace citygml {

unsigned int CityObject::getChildCityObjectsCount() const
{
return m_children.size();
return static_cast<unsigned int>(m_children.size());
}

const CityObject& CityObject::getChildCityObject(unsigned int i) const
Expand Down
8 changes: 4 additions & 4 deletions sources/src/citygml/geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace citygml {

unsigned int Geometry::getPolygonsCount() const
{
return m_polygons.size();
return static_cast<unsigned int>(m_polygons.size());
}

std::shared_ptr<Polygon> Geometry::getPolygon(unsigned int i)
Expand All @@ -35,7 +35,7 @@ namespace citygml {

unsigned int Geometry::getLineStringCount() const
{
return m_lineStrings.size();
return static_cast<unsigned int>(m_lineStrings.size());
}

std::shared_ptr<LineString> Geometry::getLineString(unsigned int i)
Expand All @@ -50,7 +50,7 @@ namespace citygml {

unsigned int Geometry::getGeometriesCount() const
{
return m_childGeometries.size();
return static_cast<unsigned int>(m_childGeometries.size());
}

const Geometry& Geometry::getGeometry(unsigned int i) const
Expand Down Expand Up @@ -164,7 +164,7 @@ namespace citygml {
for ( unsigned int i = 0; i < s.getPolygonsCount(); i++ )
{
os << s.getPolygon(i);
count += s.getPolygon(i)->getVertices().size();
count += static_cast<unsigned int>(s.getPolygon(i)->getVertices().size());
}

os << " @ " << s.getPolygonsCount() << " polys [" << count << " vertices]" << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion sources/src/citygml/implictgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace citygml {

unsigned int ImplicitGeometry::getGeometriesCount() const
{
return m_geometries.size();
return static_cast<unsigned int>(m_geometries.size());
}

Geometry& ImplicitGeometry::getGeometry(unsigned int i) const
Expand Down
4 changes: 2 additions & 2 deletions sources/src/citygml/linearring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace citygml {

unsigned int LinearRing::size() const
{
return m_vertices.size();
return static_cast<unsigned int>(m_vertices.size());
}

void LinearRing::addVertex(const TVec3d& v)
Expand Down Expand Up @@ -91,7 +91,7 @@ namespace citygml {
}

// Remove duplicated vertex
unsigned int len = m_vertices.size();
unsigned int len = static_cast<unsigned int>(m_vertices.size());
if ( len < 2 ) return;

unsigned int i = 0;
Expand Down
8 changes: 4 additions & 4 deletions sources/src/citygml/tesselator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ void Tesselator::compute()

void Tesselator::addContour(const std::vector<TVec3d>& pts, std::vector<std::vector<TVec2f> > textureCoordinatesLists )
{
unsigned int pos = _vertices.size();
unsigned int pos = static_cast<unsigned int>(_vertices.size());
TesselatorBase::addContour(pts, textureCoordinatesLists);

unsigned int len = pts.size();
unsigned int len = static_cast<unsigned int>(pts.size());
// Add contour to queue, and process later.
ContourRef contour(pos, len);
_contourQueue.push_back(contour);
Expand Down Expand Up @@ -115,7 +115,7 @@ void CALLBACK Tesselator::vertexDataCallback( GLvoid *data, void* userData )
void CALLBACK Tesselator::combineCallback( GLdouble coords[3], void* vertex_data[4], GLfloat weight[4], void** outData, void* userData )
{
Tesselator *tess = static_cast<Tesselator*>(userData);
tess->_indices.push_back(tess->_indices.size());
tess->_indices.push_back(static_cast<unsigned int>(tess->_indices.size()));
tess->_vertices.push_back( TVec3d( coords[0], coords[1], coords[2] ) );

if (!tess->_texCoordsLists.empty()) {
Expand Down Expand Up @@ -149,7 +149,7 @@ void CALLBACK Tesselator::endCallback( void* userData )
{
Tesselator *tess = static_cast<Tesselator*>(userData);

unsigned int len = tess->_curIndices.size();
unsigned int len = static_cast<unsigned int>(tess->_curIndices.size());

switch ( tess->_curMode )
{
Expand Down
4 changes: 2 additions & 2 deletions sources/src/citygml/tesselatorbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool TesselatorBase::keepVertices() const

void TesselatorBase::addContour(const std::vector<TVec3d>& pts, std::vector<std::vector<TVec2f> > textureCoordinatesLists )
{
unsigned int len = pts.size();
unsigned int len = static_cast<unsigned int>(pts.size());
if ( len < 3 ) return;

for (size_t i = 0; i < textureCoordinatesLists.size(); i++) {
Expand Down Expand Up @@ -113,7 +113,7 @@ void TesselatorBase::addContour(const std::vector<TVec3d>& pts, std::vector<std:

}

unsigned int pos = _vertices.size();
unsigned int pos = static_cast<unsigned int>(_vertices.size());

for ( unsigned int i = 0; i < len; i++ )
{
Expand Down
2 changes: 1 addition & 1 deletion sources/src/citygml/texturetargetdefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace citygml {

unsigned int TextureTargetDefinition::getTextureCoordinatesCount() const
{
return m_coordinatesList.size();
return static_cast<unsigned int>(m_coordinatesList.size());
}

std::shared_ptr<TextureCoordinates> TextureTargetDefinition::getTextureCoordinates(unsigned int i)
Expand Down

0 comments on commit b8724f5

Please sign in to comment.