[Dplr-commits] r661 - in pkg/dplR: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Mar 19 08:40:56 CET 2013
Author: mvkorpel
Date: 2013-03-19 08:40:56 +0100 (Tue, 19 Mar 2013)
New Revision: 661
Modified:
pkg/dplR/ChangeLog
pkg/dplR/DESCRIPTION
pkg/dplR/R/exactmean.R
pkg/dplR/R/gini.coef.R
pkg/dplR/R/sens1.R
pkg/dplR/R/sens2.R
pkg/dplR/R/tbrm.R
Log:
Check that length of vector does not overflow integer datatype before use of .C()
Modified: pkg/dplR/ChangeLog
===================================================================
--- pkg/dplR/ChangeLog 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/ChangeLog 2013-03-19 07:40:56 UTC (rev 661)
@@ -1,5 +1,11 @@
* CHANGES IN dplR VERSION 1.5.7
+Various .R files
+----------------
+
+- Check that length of vector does not overflow integer datatype
+ before use of .C()
+
File: corr.rwl.seg.R
--------------------
Modified: pkg/dplR/DESCRIPTION
===================================================================
--- pkg/dplR/DESCRIPTION 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/DESCRIPTION 2013-03-19 07:40:56 UTC (rev 661)
@@ -3,7 +3,7 @@
Type: Package
Title: Dendrochronology Program Library in R
Version: 1.5.7
-Date: 2013-01-10
+Date: 2013-03-19
Authors at R: c(person(c("Andrew", "G."), "Bunn", role = c("aut", "cph",
"cre", "trl"), email = "andrew.bunn at wwu.edu"), person("Mikko",
"Korpela", role = c("aut", "cph")), person("Franco", "Biondi",
Modified: pkg/dplR/R/exactmean.R
===================================================================
--- pkg/dplR/R/exactmean.R 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/R/exactmean.R 2013-03-19 07:40:56 UTC (rev 661)
@@ -2,6 +2,8 @@
{
## Drops NA and NaN values!
y <- as.double(x[!is.na(x)])
+ n <- as.integer(length(y))
+ stopifnot(!is.na(n))
.C(dplR.mean,
- y, as.integer(length(y)), result=NaN, NAOK=TRUE, DUP=FALSE)$result
+ y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
}
Modified: pkg/dplR/R/gini.coef.R
===================================================================
--- pkg/dplR/R/gini.coef.R 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/R/gini.coef.R 2013-03-19 07:40:56 UTC (rev 661)
@@ -1,6 +1,8 @@
`gini.coef` <- function(x)
{
y <- as.double(x[!is.na(x)])
+ n <- as.integer(length(y))
+ stopifnot(!is.na(n))
.C(dplR.gini,
- y, as.integer(length(y)), result=NaN, NAOK=TRUE, DUP=FALSE)$result
+ y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
}
Modified: pkg/dplR/R/sens1.R
===================================================================
--- pkg/dplR/R/sens1.R 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/R/sens1.R 2013-03-19 07:40:56 UTC (rev 661)
@@ -1,6 +1,8 @@
`sens1` <- function(x)
{
y <- as.double(x[!is.na(x)])
+ n <- as.integer(length(y))
+ stopifnot(!is.na(n))
.C(dplR.sens1,
- y, as.integer(length(y)), result=NaN, NAOK=TRUE, DUP=FALSE)$result
+ y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
}
Modified: pkg/dplR/R/sens2.R
===================================================================
--- pkg/dplR/R/sens2.R 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/R/sens2.R 2013-03-19 07:40:56 UTC (rev 661)
@@ -1,6 +1,8 @@
`sens2` <- function(x)
{
y <- as.double(x[!is.na(x)])
+ n <- as.integer(length(y))
+ stopifnot(!is.na(n))
.C(dplR.sens2,
- y, as.integer(length(y)), result=NaN, NAOK=TRUE, DUP=FALSE)$result
+ y, n, result=NaN, NAOK=TRUE, DUP=FALSE)$result
}
Modified: pkg/dplR/R/tbrm.R
===================================================================
--- pkg/dplR/R/tbrm.R 2013-01-10 09:42:12 UTC (rev 660)
+++ pkg/dplR/R/tbrm.R 2013-03-19 07:40:56 UTC (rev 661)
@@ -1,7 +1,8 @@
`tbrm` <- function(x, C=9)
{
y <- as.double(x[!is.na(x)])
+ n <- as.integer(length(y))
+ stopifnot(!is.na(n))
.C(dplR.tbrm,
- y, as.integer(length(y)), as.double(C),
- result=NaN, NAOK=TRUE, DUP=FALSE)$result
+ y, n, as.double(C), result=NaN, NAOK=TRUE, DUP=FALSE)$result
}
More information about the Dplr-commits
mailing list