Mesa (mesa_7_7_branch): glu/sgi: Silence warn_unused_result warnings.

Vinson Lee vlee at kemper.freedesktop.org
Tue Dec 29 21:04:09 PST 2009


Module: Mesa
Branch: mesa_7_7_branch
Commit: 70bbe2236668bdee9131dc2e6f71e53f9bc78863
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=70bbe2236668bdee9131dc2e6f71e53f9bc78863

Author: Vinson Lee <vlee at vmware.com>
Date:   Tue Dec 29 21:03:23 2009 -0800

glu/sgi: Silence warn_unused_result warnings.

---

 src/glu/sgi/libnurbs/nurbtess/directedLine.cc |   28 +++++++++++++++++--------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
index 1ceda02..d942db7 100644
--- a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
+++ b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc
@@ -793,22 +793,30 @@ directedLine* readAllPolygons(char* filename)
 {
   Int i,j;
   FILE* fp = fopen(filename, "r");
-  assert(fp);
   Int nPolygons;
-  fscanf(fp, "%i", &nPolygons);
+  int result;
+
+  assert(fp);
+  result = fscanf(fp, "%i", &nPolygons);
+  assert(result != EOF);
   directedLine *ret = NULL;
 
   for(i=0; i<nPolygons; i++)
     {
       Int nEdges;
-      fscanf(fp, "%i", &nEdges);
+      result = fscanf(fp, "%i", &nEdges);
+      assert(result != EOF);
       Real vert[2][2] = { { 0 } };
       Real VV[2][2];
       /*the first two vertices*/
-      fscanf(fp, "%f", &(vert[0][0]));
-      fscanf(fp, "%f", &(vert[0][1]));
-      fscanf(fp, "%f", &(vert[1][0]));
-      fscanf(fp, "%f", &(vert[1][1]));
+      result = fscanf(fp, "%f", &(vert[0][0]));
+      assert(result != EOF);
+      result = fscanf(fp, "%f", &(vert[0][1]));
+      assert(result != EOF);
+      result = fscanf(fp, "%f", &(vert[1][0]));
+      assert(result != EOF);
+      result = fscanf(fp, "%f", &(vert[1][1]));
+      assert(result != EOF);
       VV[1][0] = vert[0][0];
       VV[1][1] = vert[0][1];
       sampledLine *sLine = new sampledLine(2, vert);
@@ -820,8 +828,10 @@ thisPoly->rootLinkSet(NULL);
 	{
 	  vert[0][0]=vert[1][0];
 	  vert[0][1]=vert[1][1];
-	  fscanf(fp, "%f", &(vert[1][0]));
-	  fscanf(fp, "%f", &(vert[1][1]));
+	  result = fscanf(fp, "%f", &(vert[1][0]));
+	  assert(result != EOF);
+	  result = fscanf(fp, "%f", &(vert[1][1]));
+	  assert(result != EOF);
 	  sLine = new sampledLine(2,vert);
 	  dLine = new directedLine(INCREASING, sLine);
 dLine->rootLinkSet(thisPoly);



More information about the mesa-commit mailing list