[Kst] extragear/graphics/kst/src/datasources/dirfile

Matthew D Truch matt at truch.net
Tue Apr 11 20:41:19 CEST 2006


SVN commit 528756 by truch:

Apply Don's getdata patch: When getdata returns a double or a float that is 
before the frameoffset, it not returns NaN instead of zero.  Other return
types still return 0.  


 M  +8 -4      getdata.c  


--- trunk/extragear/graphics/kst/src/datasources/dirfile/getdata.c #528755:528756
@@ -38,6 +38,8 @@
                             "Too many levels of recursion"
 };
 
+#define NaN (0. / 0.)
+
 /* Suberror codes -- these don't need to be public */
 #define GD_E_FORMAT_SE_BAD_TYPE   0
 #define GD_E_FORMAT_SE_BAD_SPF    1
@@ -976,12 +978,12 @@
 
 /***************************************************************************/
 /*                                                                         */
-/*      FillZero: fill data buffer with zero of the appropriate type       */
+/*      FillZero: fill data buffer with zero/NaN of the appropriate type   */
 /*        used if s0<0 - fill up to 0, or up to ns+s0, whichever is less   */
 /*                                                                         */
 /***************************************************************************/
 static int FillZero(char *databuffer, char type, int s0, int ns) {
-  int nz;
+  int i, nz;
 
   if (s0>=0) return 0;
 
@@ -1002,10 +1004,12 @@
       memset(databuffer, 0, nz*sizeof(int));
       break;
     case 'f':
-      memset(databuffer, 0, nz*sizeof(float));
+      for (i = 0; i < nz; ++i)
+        *((float*)databuffer + i) = (float)NaN;
       break;
     case 'd':
-      memset(databuffer, 0, nz*sizeof(double));
+      for (i = 0; i < nz; ++i)
+        *((double*)databuffer + i) = (double)NaN;
       break;
   }
 


More information about the Kst mailing list