[H5r-commits] r76 - src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Mar 9 17:15:44 CET 2012


Author: extemporaneousb
Date: 2012-03-09 17:15:44 +0100 (Fri, 09 Mar 2012)
New Revision: 76

Modified:
   src/h5_wrap.c
Log:
Little code cleanup.



Modified: src/h5_wrap.c
===================================================================
--- src/h5_wrap.c	2011-12-28 17:01:09 UTC (rev 75)
+++ src/h5_wrap.c	2012-03-09 16:15:44 UTC (rev 76)
@@ -36,10 +36,6 @@
 	    H5Gclose(HID(h5_obj));
 	    break;
 	default:
-	    // error("Tried finalize type: %d.\n",  H5Iget_type(HID(h5_obj)));
-	    // Now that I'm writing, when I garbage collect I could
-	    // pick up an already closed thing, which seems to give this branch
-	    // problems.
 	    break;
 	}
     }
@@ -203,6 +199,8 @@
 }
 
 SEXP _h5R_read_compound_dataset(SEXP h5_obj) {
+    error("This functionality doesn't yet exist.\n");
+
     int nelts = _h5R_get_nelts(h5_obj);
     int size  = _h5R_get_size(h5_obj);
     int nmembers = H5Tget_nmembers(H5Dget_type(HID(h5_obj)));
@@ -479,40 +477,35 @@
 	__ERROR__ = 1;
     }
     
-
     if (__ERROR__ == 0) {
 	H5Dread(HID(h5_dataset), memtype, memspace, space, H5P_DEFAULT, buf);
-
 	/** There requires a little more with strings. **/
 	if (H5T_STRING == INTEGER(h5R_get_type(h5_dataset))[0]) {
 	    PROTECT(dta = allocVector(STRSXP, v));
-	    for (i = 0; i < v; i++)
+	    for (i = 0; i < v; i++) {
 		if (((char **) buf)[i]) {
 		    SET_STRING_ELT(dta, i, mkChar(  ((char **) buf)[i] )); 
 		}
-	    
+	    }
 	    H5Dvlen_reclaim (memtype, memspace, H5P_DEFAULT, buf);
-	    
 	    H5Tclose(memtype);
 	    Free(buf);
 	}
     }
-
     /** clean up. **/
     Free(_h_offsets);
     Free(_h_counts);
     H5Sclose(memspace);
     H5Sclose(space);
-
     UNPROTECT(1);
     
     if (__ERROR__ == 1) {
 	error("Unsupported class in %s\n", __func__);
     }
-
     return dta;
 }
 
+/** This is an optimization to a very common use case of 1-d slabs. **/
 SEXP h5R_read_1d_slabs(SEXP h5_dataset, SEXP _offsets, SEXP _counts) {
     int rlen = length(_counts);
     SEXP r_lst, _SEXP_offsets, _SEXP_counts;
@@ -531,7 +524,6 @@
 					       _SEXP_counts));
     }
     UNPROTECT(3);
-
     return(r_lst);
 }
 
@@ -737,7 +729,6 @@
     }
 }
 
-
 /** Iteration **/
 typedef struct __index_and_SEXP__ {
     int  i;



More information about the H5r-commits mailing list