[Highfrequency-commits] r22 - pkg/highfrequency/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 17 22:17:33 CEST 2012


Author: jonathan
Date: 2012-07-17 22:17:33 +0200 (Tue, 17 Jul 2012)
New Revision: 22

Modified:
   pkg/highfrequency/src/highfrequency.c
Log:
C-code fixed, this should (hopefully) work on linux too now, thx to Andreas Alfons

Modified: pkg/highfrequency/src/highfrequency.c
===================================================================
--- pkg/highfrequency/src/highfrequency.c	2012-07-16 22:52:47 UTC (rev 21)
+++ pkg/highfrequency/src/highfrequency.c	2012-07-17 20:17:33 UTC (rev 22)
@@ -405,7 +405,13 @@
 
 void tocts(double *a, int *na, int *millis, int *millisstart, int *millisend, double *cts)
 {
-    int n = (*millisend - *millisstart)/1000 +1,i, j=0;
+//	array cts is passed from R having length (millisend-millisstart)/1000
+//	loop tries to write (*millisend - *millisstart)/1000 +1 values into the
+//	array -> C runs out of memory and throws segfault error
+//    int n = (*millisend - *millisstart)/1000 +1,i, j=0;
+//	Still need to carefully check if the correction below works correctly, maybe
+//  you rather need to increase the size of the array on the R side
+    int n = (*millisend - *millisstart)/1000,i, j=0;
    for(i = 0; i < n; i ++)
     {
     	if((j < *na) && (millis[j] == ((i*1000) + *millisstart)))



More information about the Highfrequency-commits mailing list