Skip to content

Commit 639c5fd

Browse files
committed
refinement for String tests
plus NEWS entry rolled Version and Date
1 parent b5cbcf8 commit 639c5fd

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rcpp
22
Title: Seamless R and C++ Integration
3-
Version: 0.12.1
4-
Date: 2015-09-10
3+
Version: 0.12.1.1
4+
Date: 2015-09-21
55
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey,
66
Qiang Kou, Douglas Bates and John Chambers
77
Maintainer: Dirk Eddelbuettel <[email protected]>

inst/NEWS.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
\title{News for Package 'Rcpp'}
33
\newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
44

5+
\section{Changes in Rcpp version 0.12.2 (expected 2015-11-01 or later)}{
6+
\itemize{
7+
\item Changes in Rcpp API:
8+
\itemize{
9+
\item Before creating a single String object from a \code{SEXP}, ensure
10+
that it is from a vector of length one (issue #375)
11+
}
12+
}
13+
}
14+
515
\section{Changes in Rcpp version 0.12.1 (2015-09-10)}{
616
\itemize{
717
\item Changes in Rcpp API:

inst/include/Rcpp/String.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,14 @@ namespace Rcpp {
7272

7373
/** construct a string from a single CHARSXP SEXP */
7474
String(SEXP charsxp) : data(charsxp), valid(true), buffer_ready(false), enc(Rf_getCharCE(charsxp)) {
75-
if (! ::Rf_isString(data))
76-
throw ::Rcpp::not_compatible("expecting a string");
77-
if (::Rf_length(data) != 1)
75+
if (::Rf_isString(data) && ::Rf_length(data) != 1)
7876
throw ::Rcpp::not_compatible("expecting a single value");
7977
Rcpp_PreserveObject(data);
8078
RCPP_STRING_DEBUG( "String(SEXP)" ) ;
8179
}
8280

8381
String(SEXP charsxp, const std::string& enc) : data(charsxp), valid(true), buffer_ready(false) {
84-
if (! ::Rf_isString(data))
85-
throw ::Rcpp::not_compatible("expecting a string");
86-
if (::Rf_length(data) != 1)
82+
if (::Rf_isString(data) && ::Rf_length(data) != 1)
8783
throw ::Rcpp::not_compatible("expecting a single value");
8884
Rcpp_PreserveObject( data );
8985
set_encoding(enc);

0 commit comments

Comments
 (0)