Fixed build warnings on MSVC14 x64 in the IFC format sources.
authorJared Mulconry <j.mulconry@atomizergames.com>
Sat, 19 Nov 2016 14:13:55 +0000 (01:13 +1100)
committerJared Mulconry <j.mulconry@atomizergames.com>
Sat, 19 Nov 2016 14:13:55 +0000 (01:13 +1100)
code/IFCBoolean.cpp
code/IFCGeometry.cpp
code/IFCLoader.cpp
code/IFCMaterial.cpp
code/IFCOpenings.cpp
code/IFCProfile.cpp
code/IFCUtil.cpp

index 0425153..d3b77d8 100644 (file)
@@ -109,7 +109,7 @@ void FilterPolygon(std::vector<IfcVector3>& resultpoly)
     }
 
     IfcVector3 vmin, vmax;
-    ArrayBounds(resultpoly.data(), resultpoly.size(), vmin, vmax);
+    ArrayBounds(resultpoly.data(), static_cast<unsigned int>(resultpoly.size()), vmin, vmax);
 
     // filter our IfcFloat points - those may happen if a point lies
     // directly on the intersection line or directly on the clipping plane
@@ -132,7 +132,7 @@ void WritePolygon(std::vector<IfcVector3>& resultpoly, TempMesh& result)
     if( resultpoly.size() > 2 )
     {
         result.verts.insert(result.verts.end(), resultpoly.begin(), resultpoly.end());
-        result.vertcnt.push_back(resultpoly.size());
+        result.vertcnt.push_back(static_cast<unsigned int>(resultpoly.size()));
     }
 }
 
@@ -589,7 +589,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
                 // to result mesh unchanged
                 if( !startedInside )
                 {
-                    outvertcnt.push_back(blackside.size());
+                    outvertcnt.push_back(static_cast<unsigned int>(blackside.size()));
                     outvert.insert(outvert.end(), blackside.begin(), blackside.end());
                     continue;
                 }
index 3d0cda3..f80fadf 100644 (file)
@@ -70,7 +70,7 @@ bool ProcessPolyloop(const IfcPolyLoop& loop, TempMesh& meshout, ConversionData&
         ++cnt;
     }
 
-    meshout.vertcnt.push_back(cnt);
+    meshout.vertcnt.push_back(static_cast<unsigned int>(cnt));
 
     // zero- or one- vertex polyloops simply ignored
     if (meshout.vertcnt.back() > 1) {
@@ -180,7 +180,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
     // fill a mesh with ONLY the main polygon
     TempMesh temp;
     temp.verts.reserve(outer_polygon_size);
-    temp.vertcnt.push_back(outer_polygon_size);
+    temp.vertcnt.push_back(static_cast<unsigned int>(outer_polygon_size));
     std::copy(outer_vit, outer_vit+outer_polygon_size,
         std::back_inserter(temp.verts));
 
@@ -305,8 +305,8 @@ void ProcessRevolvedAreaSolid(const IfcRevolvedAreaSolid& solid, TempMesh& resul
         for(size_t i = 0; i < size; ++i ) {
             out.push_back(out[i*4]);
         }
-        result.vertcnt.push_back(size);
-        result.vertcnt.push_back(size);
+        result.vertcnt.push_back(static_cast<unsigned int>(size));
+        result.vertcnt.push_back(static_cast<unsigned int>(size));
     }
 
     IfcMatrix4 trafo;
@@ -638,7 +638,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
                     out.push_back(in[i]);
             }
 
-            curmesh.vertcnt.push_back(in.size());
+            curmesh.vertcnt.push_back(static_cast<unsigned int>(in.size()));
             if( openings && in.size() > 2 ) {
                 if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) {
                     ++sides_with_v_openings;
@@ -665,7 +665,7 @@ void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curv
 
         std::shared_ptr<TempMesh> profile2D = std::shared_ptr<TempMesh>(new TempMesh());
         profile2D->verts.insert(profile2D->verts.end(), in.begin(), in.end());
-        profile2D->vertcnt.push_back(in.size());
+        profile2D->vertcnt.push_back(static_cast<unsigned int>(in.size()));
         conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
 
         ai_assert(result.IsEmpty());
@@ -810,7 +810,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
     aiMesh* const mesh = meshtmp->ToMesh();
     if(mesh) {
         mesh->mMaterialIndex = matid;
-        mesh_indices.push_back(conv.meshes.size());
+        mesh_indices.push_back(static_cast<unsigned int>(conv.meshes.size()));
         conv.meshes.push_back(mesh);
         return true;
     }
@@ -827,9 +827,8 @@ void AssignAddedMeshes(std::vector<unsigned int>& mesh_indices,aiNode* nd,
         std::sort(mesh_indices.begin(),mesh_indices.end());
         std::vector<unsigned int>::iterator it_end = std::unique(mesh_indices.begin(),mesh_indices.end());
 
-        const size_t size = std::distance(mesh_indices.begin(),it_end);
+        nd->mNumMeshes = static_cast<unsigned int>(std::distance(mesh_indices.begin(),it_end));
 
-        nd->mNumMeshes = size;
         nd->mMeshes = new unsigned int[nd->mNumMeshes];
         for(unsigned int i = 0; i < nd->mNumMeshes; ++i) {
             nd->mMeshes[i] = mesh_indices[i];
index 34977f5..f7fb6e0 100644 (file)
@@ -708,7 +708,7 @@ aiNode* ProcessSpatialStructure(aiNode* parent, const IfcProduct& el, Conversion
 
         if (!properties.empty()) {
             aiMetadata* data = new aiMetadata();
-            data->mNumProperties = properties.size();
+            data->mNumProperties = static_cast<unsigned int>(properties.size());
             data->mKeys = new aiString[data->mNumProperties]();
             data->mValues = new aiMetadataEntry[data->mNumProperties]();
 
index 7525db0..ae2fa36 100644 (file)
@@ -159,7 +159,7 @@ unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionDat
                         FillMaterial(mat.get(), surf, conv);
 
                         conv.materials.push_back(mat.release());
-                        unsigned int matindex = conv.materials.size() - 1;
+                        unsigned int matindex = static_cast<unsigned int>(conv.materials.size() - 1);
                         conv.cached_materials[surf] = matindex;
                         return matindex;
             }
index 3197426..c2a7439 100644 (file)
@@ -364,7 +364,7 @@ void InsertWindowContours(const ContourVector& contours,
                     }
 
                     if (const size_t d = curmesh.verts.size()-old) {
-                        curmesh.vertcnt.push_back(d);
+                        curmesh.vertcnt.push_back(static_cast<unsigned int>(d));
                         std::reverse(curmesh.verts.rbegin(),curmesh.verts.rbegin()+d);
                     }
                     if (n == very_first_hit) {
@@ -549,7 +549,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
                 clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero);
 
                 for(const ClipperLib::ExPolygon& ex : clipped) {
-                    iold.push_back(ex.outer.size());
+                    iold.push_back(static_cast<unsigned int>(ex.outer.size()));
                     for(const ClipperLib::IntPoint& point : ex.outer) {
                         vold.push_back(IfcVector3(
                             from_int64(point.X),
index 01b9008..a84f98f 100644 (file)
@@ -59,7 +59,7 @@ void ProcessPolyLine(const IfcPolyline& def, TempMesh& meshout, ConversionData&
         ConvertCartesianPoint(t,cp);
         meshout.verts.push_back(t);
     }
-    meshout.vertcnt.push_back(meshout.verts.size());
+    meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size()));
 }
 
 // ------------------------------------------------------------------------------------------------
@@ -80,7 +80,7 @@ bool ProcessCurve(const IfcCurve& curve,  TempMesh& meshout, ConversionData& con
             IFCImporter::LogError(cv.s+ " (error occurred while processing curve)");
             return false;
         }
-        meshout.vertcnt.push_back(meshout.verts.size());
+        meshout.vertcnt.push_back(static_cast<unsigned int>(meshout.verts.size()));
         return true;
     }
 
index 89a6c78..7caebbc 100644 (file)
@@ -180,7 +180,7 @@ IfcVector3 TempMesh::ComputePolygonNormal(const IfcVector3* vtcs, size_t cnt, bo
     }
 
     IfcVector3 nor;
-    NewellNormal<3, 3, 3>(nor, cnt, &temp[0], &temp[1], &temp[2]);
+    NewellNormal<3, 3, 3>(nor, static_cast<int>(cnt), &temp[0], &temp[1], &temp[2]);
     return normalize ? nor.Normalize() : nor;
 }
 
@@ -548,7 +548,7 @@ void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in)
 {
     out = IfcVector3();
     for(size_t i = 0; i < in.Coordinates.size(); ++i) {
-        out[i] = in.Coordinates[i];
+        out[static_cast<unsigned int>(i)] = in.Coordinates[i];
     }
 }
 
@@ -564,7 +564,7 @@ void ConvertDirection(IfcVector3& out, const IfcDirection& in)
 {
     out = IfcVector3();
     for(size_t i = 0; i < in.DirectionRatios.size(); ++i) {
-        out[i] = in.DirectionRatios[i];
+        out[static_cast<unsigned int>(i)] = in.DirectionRatios[i];
     }
     const IfcFloat len = out.Length();
     if (len<1e-6) {