[Rcpp-commits] r3674 - pkg/RcppCNPy/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Jul 7 01:42:46 CEST 2012


Author: edd
Date: 2012-07-07 01:42:46 +0200 (Sat, 07 Jul 2012)
New Revision: 3674

Modified:
   pkg/RcppCNPy/src/Makevars
   pkg/RcppCNPy/src/Makevars.win
   pkg/RcppCNPy/src/cnpy.cpp
Log:
 o add -lz linker flags to Makevars{.win} (tested on win-builder)
 o ignore size returned from gzread() as it can fall victim to an int overflow


Modified: pkg/RcppCNPy/src/Makevars
===================================================================
--- pkg/RcppCNPy/src/Makevars	2012-07-06 13:13:32 UTC (rev 3673)
+++ pkg/RcppCNPy/src/Makevars	2012-07-06 23:42:46 UTC (rev 3674)
@@ -1,27 +1,5 @@
 ## Use the R_HOME indirection to support installations of multiple R version
-PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"`
+PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` -lz
 
-## As an alternative, one can also add this code in a file 'configure'
-##
-##    PKG_LIBS=`${R_HOME}/bin/Rscript -e "Rcpp:::LdFlags()"`
-## 
-##    sed -e "s|@PKG_LIBS@|${PKG_LIBS}|" \
-##        src/Makevars.in > src/Makevars
-## 
-## which together with the following file 'src/Makevars.in'
-##
-##    PKG_LIBS = @PKG_LIBS@
-##
-## can be used to create src/Makevars dynamically. This scheme is more
-## powerful and can be expanded to also check for and link with other
-## libraries.  It should be complemented by a file 'cleanup'
-##
-##    rm src/Makevars
-##
-## which removes the autogenerated file src/Makevars. 
-##
-## Of course, autoconf can also be used to write configure files. This is
-## done by a number of packages, but recommended only for more advanced users
-## comfortable with autoconf and its related tools.
 
 

Modified: pkg/RcppCNPy/src/Makevars.win
===================================================================
--- pkg/RcppCNPy/src/Makevars.win	2012-07-06 13:13:32 UTC (rev 3673)
+++ pkg/RcppCNPy/src/Makevars.win	2012-07-06 23:42:46 UTC (rev 3674)
@@ -1,3 +1,3 @@
 
 ## Use the R_HOME indirection to support installations of multiple R version
-PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")
+PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") -lz

Modified: pkg/RcppCNPy/src/cnpy.cpp
===================================================================
--- pkg/RcppCNPy/src/cnpy.cpp	2012-07-06 13:13:32 UTC (rev 3673)
+++ pkg/RcppCNPy/src/cnpy.cpp	2012-07-06 23:42:46 UTC (rev 3674)
@@ -146,7 +146,8 @@
     arr.shape = std::vector<unsigned int>(shape,shape+ndims);
     arr.data = new char[size*word_size];    
     //int nread = fread(arr.data,word_size,size,fp);
-    if (gzread(fp,arr.data,word_size*size) < 0) REprintf("cnpy::gzload_the_npy_file error");
+    //if (gzread(fp,arr.data,word_size*size) < 0) REprintf("cnpy::gzload_the_npy_file error");
+    gzread(fp,arr.data,word_size*size);
     return arr;
 }
 



More information about the Rcpp-commits mailing list