Revision: 41232
          http://brlcad.svn.sourceforge.net/brlcad/?rev=41232&view=rev
Author:   brlcad
Date:     2010-11-02 18:03:59 +0000 (Tue, 02 Nov 2010)

Log Message:
-----------
track fwrite() results

Modified Paths:
--------------
    brlcad/trunk/src/canon/canonize.c

Modified: brlcad/trunk/src/canon/canonize.c
===================================================================
--- brlcad/trunk/src/canon/canonize.c   2010-11-02 17:40:24 UTC (rev 41231)
+++ brlcad/trunk/src/canon/canonize.c   2010-11-02 18:03:59 UTC (rev 41232)
@@ -48,7 +48,7 @@
     FILE *fp;
 {
     char img_buffer[8 * 1024];
-    int img_bytes, i, args, bytes_read;
+    int img_bytes, i, args, bytes_read, bytes_written;
     FILE *pfp;
 
     img_bytes = width * height * 3;
@@ -85,15 +85,12 @@
        fprintf(stderr, "args written\n");
 
     /* write the image down the pipe */
-    for (bytes_read = 0;
-        bytes_read < img_bytes &&
-            (i = fread(img_buffer, 1, sizeof(img_buffer), fp));
-        bytes_read += i) {
-       fwrite(img_buffer, 1, i, pfp);
+    for (bytes_read = 0, bytes_written=0; bytes_read < img_bytes && (i = 
fread(img_buffer, 1, sizeof(img_buffer), fp)); bytes_read += i) {
+       bytes_written += fwrite(img_buffer, 1, i, pfp);
     }
 
     if (ipu_debug)
-       fprintf(stderr, "image written\n");
+       fprintf(stderr, "image written (%d bytes)\n", bytes_written);
 
     pclose(pfp);
 


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

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to