[Gridflow-cvs] [svn] commit: r5443 - /trunk/src/formats.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Thu Apr 15 17:00:32 EDT 2010


Author: matju
Date: Thu Apr 15 17:00:32 2010
New Revision: 5443

Log:
fix libc warning in [#out grid]

Modified:
    trunk/src/formats.cxx

Modified: trunk/src/formats.cxx
==============================================================================
--- trunk/src/formats.cxx (original)
+++ trunk/src/formats.cxx Thu Apr 15 17:00:32 2010
@@ -233,8 +233,10 @@
 		}
 		head.reserved = 0;
 		head.dimn = in->dim->n;
-		fwrite(&head,1,8,f);
-		fwrite(in->dim->v,in->dim->n,4,f);
+		size_t sz = 4*in->dim->n;
+#define FRAISE(funk,f) RAISE("can't "#funk": %s",ferror(f));
+		if (fwrite(&head,1,8,f      )< 8) FRAISE(fwrite,f);
+		if (fwrite(in->dim->v,1,sz,f)<sz) FRAISE(fwrite,f);
 	}
 } GRID_FLOW {
 #define FOO(T) {T data2[n]; for(int i=0; i<n; i++) data2[i]=(T)data[i]; \



More information about the Gridflow-cvs mailing list