← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3979: fix compile warnings

 

------------------------------------------------------------
revno: 3979
committer: bchareyre <bruno.chareyre@xxxxxxxxxxxxxxx>
timestamp: Fri 2016-11-25 18:06:34 +0100
message:
  fix compile warnings
modified:
  pkg/dem/STLImporter.hpp
  pkg/dem/deformablecohesive/DeformableCohesiveElement.hpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'pkg/dem/STLImporter.hpp'
--- pkg/dem/STLImporter.hpp	2015-05-28 18:32:30 +0000
+++ pkg/dem/STLImporter.hpp	2016-11-25 17:06:34 +0000
@@ -122,17 +122,18 @@
   set<pair<int,int> > egs;
 
   /* Read a single facet from an ASCII .STL file */
+  int r=0; //just to escape "warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)',"
   while(!feof(fp))
   {
     float n[3];
     Vrtx v[3];
-    fscanf(fp, "%*s %*s %f %f %f\n", &n[0], &n[1], &n[2]);
-    fscanf(fp, "%*s %*s");
-    fscanf(fp, "%*s %f %f %f\n", &v[0][0],  &v[0][1],  &v[0][2]);
-    fscanf(fp, "%*s %f %f %f\n", &v[1][0],  &v[1][1],  &v[1][2]);
-    fscanf(fp, "%*s %f %f %f\n", &v[2][0],  &v[2][1],  &v[2][2]);
-    fscanf(fp, "%*s"); // end loop
-    fscanf(fp, "%*s"); // end facet
+    r=fscanf(fp, "%*s %*s %f %f %f\n", &n[0], &n[1], &n[2]);
+    r+=fscanf(fp, "%*s %*s");
+    r+=fscanf(fp, "%*s %f %f %f\n", &v[0][0],  &v[0][1],  &v[0][2]);
+    r+=fscanf(fp, "%*s %f %f %f\n", &v[1][0],  &v[1][1],  &v[1][2]);
+    r+=fscanf(fp, "%*s %f %f %f\n", &v[2][0],  &v[2][1],  &v[2][2]);
+    r+=fscanf(fp, "%*s"); // end loop
+    r+=fscanf(fp, "%*s"); // end facet
     if(feof(fp)) break;
   
     int vid[3];
@@ -170,7 +171,7 @@
     (edges++) = it->first;
     (edges++) = it->second;
   }
-  return true;
+  return (r>0);
 }
 
 template<class OutV, class OutE, class OutF, class OutN>

=== modified file 'pkg/dem/deformablecohesive/DeformableCohesiveElement.hpp'
--- pkg/dem/deformablecohesive/DeformableCohesiveElement.hpp	2016-01-07 17:49:32 +0000
+++ pkg/dem/deformablecohesive/DeformableCohesiveElement.hpp	2016-11-25 17:06:34 +0000
@@ -46,6 +46,8 @@
 				    if (node1.get() > param.node1.get()) return false;
 				    if (node2.get() < param.node2.get()) return true;
 				    if (node2.get() > param.node2.get()) return false;
+				    LOG_ERROR("Incomplete 'if' sequence");
+				    return false;
 				}
 			};