Skip to content

Commit 70ad472

Browse files
author
Qiang Kou
committed
replace R_len_t with R_xlen_t
1 parent cb87ebd commit 70ad472

File tree

8 files changed

+30
-30
lines changed

8 files changed

+30
-30
lines changed

inst/include/Rcpp/DottedPairImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ namespace Rcpp{
6363
template <typename T>
6464
void replace( const int& index, const T& object ) ;
6565

66-
inline R_len_t length() const {
66+
inline R_xlen_t length() const {
6767
return ::Rf_length(static_cast<const CLASS&>(*this).get__()) ;
6868
}
6969

70-
inline R_len_t size() const {
70+
inline R_xlen_t size() const {
7171
return ::Rf_length(static_cast<const CLASS&>(*this).get__()) ;
7272
}
7373

inst/include/Rcpp/api/meat/DottedPairImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace Rcpp{
5353
} else {
5454
if( ref.isNULL( ) ) throw index_out_of_bounds() ;
5555

56-
if( static_cast<R_len_t>(index) > ::Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
56+
if( static_cast<R_xlen_t>(index) > ::Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
5757

5858
size_t i=1;
5959
SEXP x = ref.get__() ;
@@ -70,7 +70,7 @@ namespace Rcpp{
7070
template <typename T>
7171
void DottedPairImpl<CLASS>::replace( const int& index, const T& object ) {
7272
CLASS& ref = static_cast<CLASS&>(*this) ;
73-
if( static_cast<R_len_t>(index) >= ::Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
73+
if( static_cast<R_xlen_t>(index) >= ::Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
7474

7575
Shield<SEXP> x( pairlist( object ) );
7676
SEXP y = ref.get__() ;
@@ -84,7 +84,7 @@ namespace Rcpp{
8484
template <typename CLASS>
8585
void DottedPairImpl<CLASS>::remove( const size_t& index ) {
8686
CLASS& ref = static_cast<CLASS&>(*this) ;
87-
if( static_cast<R_len_t>(index) >= Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
87+
if( static_cast<R_xlen_t>(index) >= Rf_length(ref.get__()) ) throw index_out_of_bounds() ;
8888
if( index == 0 ){
8989
ref.set__( CDR( ref.get__() ) ) ;
9090
} else{

inst/include/Rcpp/api/meat/export.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ namespace internal{
2727

2828
template <typename InputIterator, typename value_type>
2929
void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_generic_tag ) {
30-
R_len_t n = ::Rf_length(x) ;
31-
for( R_len_t i=0; i<n; i++, ++first ){
30+
R_xlen_t n = ::Rf_length(x) ;
31+
for( R_xlen_t i=0; i<n; i++, ++first ){
3232
*first = ::Rcpp::as<value_type>( VECTOR_ELT(x, i) ) ;
3333
}
3434
}

inst/include/Rcpp/internal/export.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ namespace Rcpp{
2828

2929

3030
template <typename T>
31-
std::wstring as_string_elt__impl( SEXP x, R_len_t i, Rcpp::traits::true_type ){
31+
std::wstring as_string_elt__impl( SEXP x, R_xlen_t i, Rcpp::traits::true_type ){
3232
const char* y = char_get_string_elt( x, i ) ;
3333
return std::wstring(y, y+strlen(y) ) ;
3434
}
3535

3636
template <typename T>
37-
std::string as_string_elt__impl( SEXP x, R_len_t i, Rcpp::traits::false_type ){
37+
std::string as_string_elt__impl( SEXP x, R_xlen_t i, Rcpp::traits::false_type ){
3838
return char_get_string_elt( x, i ) ;
3939
}
4040

4141
template <typename T>
4242
const std::basic_string< typename Rcpp::traits::char_type<T>::type >
43-
as_string_elt( SEXP x, R_len_t i ){
43+
as_string_elt( SEXP x, R_xlen_t i ){
4444
return as_string_elt__impl<T>( x, i, typename Rcpp::traits::is_wide_string<T>::type() ) ;
4545
}
4646

@@ -80,8 +80,8 @@ namespace Rcpp{
8080
template <typename InputIterator, typename value_type>
8181
void export_range__dispatch( SEXP x, InputIterator first, ::Rcpp::traits::r_type_string_tag ) {
8282
if( ! ::Rf_isString( x) ) throw ::Rcpp::not_compatible( "expecting a string vector" ) ;
83-
R_len_t n = ::Rf_length(x) ;
84-
for( R_len_t i=0; i<n; i++, ++first ){
83+
R_xlen_t n = ::Rf_length(x) ;
84+
for( R_xlen_t i=0; i<n; i++, ++first ){
8585
*first = as_string_elt<typename std::iterator_traits<InputIterator>::value_type> ( x, i ) ;
8686
}
8787
}
@@ -104,8 +104,8 @@ namespace Rcpp{
104104
typedef typename ::Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
105105
Shield<SEXP> y( ::Rcpp::r_cast<RTYPE>(x) ) ;
106106
STORAGE* start = ::Rcpp::internal::r_vector_start<RTYPE>(y) ;
107-
R_len_t size = ::Rf_length(y) ;
108-
for( R_len_t i=0; i<size; i++){
107+
R_xlen_t size = ::Rf_length(y) ;
108+
for( R_xlen_t i=0; i<size; i++){
109109
res[i] = start[i] ;
110110
}
111111
}
@@ -116,8 +116,8 @@ namespace Rcpp{
116116
typedef typename ::Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
117117
Shield<SEXP> y( ::Rcpp::r_cast<RTYPE>(x) );
118118
STORAGE* start = ::Rcpp::internal::r_vector_start<RTYPE>(y) ;
119-
R_len_t size = ::Rf_length(y) ;
120-
for( R_len_t i=0; i<size; i++){
119+
R_xlen_t size = ::Rf_length(y) ;
120+
for( R_xlen_t i=0; i<size; i++){
121121
res[i] = caster<STORAGE,value_type>(start[i]) ;
122122
}
123123
}
@@ -134,8 +134,8 @@ namespace Rcpp{
134134
template <typename T, typename value_type>
135135
void export_indexing__dispatch( SEXP x, T& res, ::Rcpp::traits::r_type_string_tag ) {
136136
if( ! ::Rf_isString( x) ) throw Rcpp::not_compatible( "expecting a string vector" ) ;
137-
R_len_t n = ::Rf_length(x) ;
138-
for( R_len_t i=0; i<n; i++ ){
137+
R_xlen_t n = ::Rf_length(x) ;
138+
for( R_xlen_t i=0; i<n; i++ ){
139139
res[i] = as_string_elt< value_type >( x, i) ;
140140
}
141141
}

inst/include/Rcpp/vector/ListOf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class ListOf
9595
return list.end();
9696
}
9797

98-
inline R_len_t size() const {
98+
inline R_xlen_t size() const {
9999
return list.size() ;
100100
}
101101

inst/include/Rcpp/vector/MatrixBase.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ namespace Rcpp{
4343
return static_cast<const MATRIX*>(this)->operator()(i, j) ;
4444
}
4545

46-
inline R_len_t size() const { return static_cast<const MATRIX&>(*this).size() ; }
47-
inline R_len_t nrow() const { return static_cast<const MATRIX&>(*this).nrow() ; }
48-
inline R_len_t ncol() const { return static_cast<const MATRIX&>(*this).ncol() ; }
46+
inline R_xlen_t size() const { return static_cast<const MATRIX&>(*this).size() ; }
47+
inline R_xlen_t nrow() const { return static_cast<const MATRIX&>(*this).nrow() ; }
48+
inline R_xlen_t ncol() const { return static_cast<const MATRIX&>(*this).ncol() ; }
4949

5050
class iterator {
5151
public:

inst/include/Rcpp/vector/MatrixColumn.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ class MatrixColumn : public VectorBase<RTYPE,true,MatrixColumn<RTYPE> > {
9292
return const_start + n ;
9393
}
9494

95-
inline R_len_t size() const {
95+
inline R_xlen_t size() const {
9696
return n ;
9797
}
9898

9999
private:
100-
const R_len_t n ;
100+
const R_xlen_t n ;
101101
iterator start ;
102102
const_iterator const_start ;
103103

inst/include/Rcpp/vector/Vector.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ class Vector :
237237
/**
238238
* the length of the vector, uses Rf_length
239239
*/
240-
inline R_len_t length() const {
240+
inline R_xlen_t length() const {
241241
return ::Rf_length( Storage::get__() ) ;
242242
}
243243

244244
/**
245245
* alias of length
246246
*/
247-
inline R_len_t size() const {
247+
inline R_xlen_t size() const {
248248
return ::Rf_length( Storage::get__() ) ;
249249
}
250250

@@ -267,15 +267,15 @@ class Vector :
267267
* it is valid
268268
*/
269269
size_t offset(const size_t& i) const {
270-
if( static_cast<R_len_t>(i) >= ::Rf_length(Storage::get__()) ) throw index_out_of_bounds() ;
270+
if( static_cast<R_xlen_t>(i) >= ::Rf_length(Storage::get__()) ) throw index_out_of_bounds() ;
271271
return i ;
272272
}
273273

274-
R_len_t offset(const std::string& name) const {
274+
R_xlen_t offset(const std::string& name) const {
275275
SEXP names = RCPP_GET_NAMES( Storage::get__() ) ;
276276
if( Rf_isNull(names) ) throw index_out_of_bounds();
277-
R_len_t n=size() ;
278-
for( R_len_t i=0; i<n; ++i){
277+
R_xlen_t n=size() ;
278+
for( R_xlen_t i=0; i<n; ++i){
279279
if( ! name.compare( CHAR(STRING_ELT(names, i)) ) ){
280280
return i ;
281281
}

0 commit comments

Comments
 (0)