Revision: 42155
          http://brlcad.svn.sourceforge.net/brlcad/?rev=42155&view=rev
Author:   erikgreenwald
Date:     2011-01-12 18:28:14 +0000 (Wed, 12 Jan 2011)

Log Message:
-----------
fix various warnings

Modified Paths:
--------------
    brlcad/trunk/src/libbn/bntester.c
    brlcad/trunk/src/libbn/poly.c
    brlcad/trunk/src/libbn/tabdata.c

Modified: brlcad/trunk/src/libbn/bntester.c
===================================================================
--- brlcad/trunk/src/libbn/bntester.c   2011-01-12 18:10:23 UTC (rev 42154)
+++ brlcad/trunk/src/libbn/bntester.c   2011-01-12 18:28:14 UTC (rev 42155)
@@ -309,18 +309,20 @@
             return EXIT_FAILURE;
         }
         line_num++;
-        (void)fgets(buf, BUFSIZ, fp_in);
-        if (feof(fp_in)) {
-            if (ferror(fp_in)) {
-                perror("ERROR: Problem reading file, system error message");
-                if (fclose(fp_in) != 0) {
-                    (void)fprintf(stream, "Unable to close input file.\n");
-                }
-                return EXIT_FAILURE;
-            } else {
-                found_eof = 1;
-            }
-        } else {
+               if (fgets(buf, BUFSIZ, fp_in) == NULL) {
+                       if (feof(fp_in)) {
+                               found_eof = 1;
+                       } else if (ferror(fp_in)) {
+                               perror("ERROR: Problem reading file, system 
error message");
+                               if (fclose(fp_in) != 0) {
+                                       (void)fprintf(stream, "Unable to close 
input file.\n");
+                               }
+                               return EXIT_FAILURE;
+                       } else {
+                               perror("Oddness reading input file");
+                               return EXIT_FAILURE;
+                       }
+               } else {
             /* Skip input data file lines which start with a '#' character
              * or a new line character.
              */

Modified: brlcad/trunk/src/libbn/poly.c
===================================================================
--- brlcad/trunk/src/libbn/poly.c       2011-01-12 18:10:23 UTC (rev 42154)
+++ brlcad/trunk/src/libbn/poly.c       2011-01-12 18:28:14 UTC (rev 42155)
@@ -542,7 +542,7 @@
     bu_vls_init(&str);
     bu_vls_extend(&str, 196);
     bu_vls_strcat(&str, title);
-    snprintf(buf, 48, " polynomial, degree = %lu\n", eqn->dgr);
+    snprintf(buf, 48, " polynomial, degree = %lu\n", (long unsigned 
int)eqn->dgr);
     bu_vls_strcat(&str, buf);
 
     exponent = eqn->dgr;

Modified: brlcad/trunk/src/libbn/tabdata.c
===================================================================
--- brlcad/trunk/src/libbn/tabdata.c    2011-01-12 18:10:23 UTC (rev 42154)
+++ brlcad/trunk/src/libbn/tabdata.c    2011-01-12 18:28:14 UTC (rev 42155)
@@ -878,7 +878,7 @@
     }
 
     bu_semaphore_acquire( BU_SEM_SYSCALL );
-    fprintf(fp, "  %lu sample starts, and one end.\n", tabp->nx );
+    fprintf(fp, "  %lu sample starts, and one end.\n", (long unsigned 
int)tabp->nx );
     for ( j=0; j <= tabp->nx; j++ )  {
        fprintf( fp, "%g\n", tabp->x[j] );
     }
@@ -919,7 +919,10 @@
     bu_vls_init(&line);
     bu_vls_gets( &line, fp );
     nw = 0;
-    sscanf( bu_vls_addr(&line), "%lu", &nw );
+    /* TODO: %lu to size_t isn't right. We may need a bu_sscanf() that can cope
+     * with native pointer width correctly, as %p is not ubiquitous and %z is a
+     * C99-ism */
+    sscanf( bu_vls_addr(&line), "%lu", (long unsigned int *)(&nw) );
     bu_vls_free(&line);
 
     if ( nw <= 0 ) bu_bomb("bn_table_read() bad nw value\n");


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to