Revision: 57081
          http://sourceforge.net/p/brlcad/code/57081
Author:   mohitdaga
Date:     2013-08-22 21:01:05 +0000 (Thu, 22 Aug 2013)
Log Message:
-----------
Few changes in bw.c and pix.c related to style. Also read function returns 0 
when end of file is reached.

Modified Paths:
--------------
    brlcad/trunk/src/libicv/bw.c
    brlcad/trunk/src/libicv/pix.c

Modified: brlcad/trunk/src/libicv/bw.c
===================================================================
--- brlcad/trunk/src/libicv/bw.c        2013-08-22 20:47:50 UTC (rev 57080)
+++ brlcad/trunk/src/libicv/bw.c        2013-08-22 21:01:05 UTC (rev 57081)
@@ -83,7 +83,7 @@
     int fd;
     unsigned char *data = 0;
     icv_image_t *bif;
-    ssize_t size;
+    size_t size;
 
     if (width == 0 || height == 0) {
        height = 512;
@@ -95,12 +95,12 @@
     if(filename==NULL)
        fd = fileno(stdin);
     else if ((fd = open(filename, O_RDONLY, WRMODE)) < 0) {
-       bu_log("bw_read: Cannot open file for reading\n");
+       bu_log("bw_read: Cannot open %s for reading\n", filename);
        return NULL;
-       }
+    }   
 
     data = (unsigned char *)bu_malloc(size, "bw_read : unsigned char data");
-    if (read(fd, data, size) != size) {
+    if (read(fd, data, size) < 0) {
        bu_log("bw_read: Error Occurred while Reading\n");
        bu_free(data, "icv_image data");
        return NULL;

Modified: brlcad/trunk/src/libicv/pix.c
===================================================================
--- brlcad/trunk/src/libicv/pix.c       2013-08-22 20:47:50 UTC (rev 57080)
+++ brlcad/trunk/src/libicv/pix.c       2013-08-22 21:01:05 UTC (rev 57081)
@@ -81,7 +81,7 @@
     unsigned char *data = 0;
     icv_image_t *bif;
 
-    ssize_t size;
+    size_t size;
 
     if (width == 0 || height == 0) {
        height = 512;
@@ -95,10 +95,10 @@
     else if ((fd = open(filename, O_RDONLY, WRMODE))<0) {
        bu_log("bw_read: Cannot open file for reading\n");
        return NULL;
-       }
+    }
 
     data = (unsigned char *)bu_malloc(size, "pix_read : unsigned char data");
-    if (read(fd, data, size) != size) {
+    if (read(fd, data, size) < 0) {
        bu_log("pix_read: Error Occurred while Reading\n");
        bu_free(data, "icv_image data");
        return NULL;

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


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to