Skip to content

Commit f5ee99f

Browse files
author
thirdwing
committed
resolve warnings in RUnit
1 parent ad6f6bd commit f5ee99f

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

inst/include/Rcpp/vector/Vector.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ class Vector :
294294
inline const_iterator begin() const{ return cache.get_const() ; }
295295
inline const_iterator end() const{ return cache.get_const() + size() ; }
296296

297-
inline Proxy operator[]( int i ){ return cache.ref(i) ; }
298-
inline const_Proxy operator[]( int i ) const { return cache.ref(i) ; }
297+
inline Proxy operator[]( R_xlen_t i ){ return cache.ref(i) ; }
298+
inline const_Proxy operator[]( R_xlen_t i ) const { return cache.ref(i) ; }
299299

300300
inline Proxy operator()( const size_t& i) {
301301
return cache.ref( offset(i) ) ;
@@ -491,10 +491,10 @@ class Vector :
491491
Vector& operator+=( const VectorBase<RTYPE,true,EXPR_VEC>& rhs ) {
492492
const EXPR_VEC& ref = rhs.get_ref() ;
493493
iterator start = begin() ;
494-
int n = size() ;
494+
R_xlen_t n = size() ;
495495
// TODO: maybe unroll this
496496
stored_type tmp ;
497-
for( int i=0; i<n; i++){
497+
for( R_xlen_t i=0; i<n; i++){
498498
Proxy left = start[i] ;
499499
if( ! traits::is_na<RTYPE>( left ) ){
500500
tmp = ref[i] ;
@@ -508,9 +508,9 @@ class Vector :
508508
Vector& operator+=( const VectorBase<RTYPE,false,EXPR_VEC>& rhs ) {
509509
const EXPR_VEC& ref = rhs.get_ref() ;
510510
iterator start = begin() ;
511-
int n = size() ;
511+
R_xlen_t n = size() ;
512512
stored_type tmp ;
513-
for( int i=0; i<n; i++){
513+
for( R_xlen_t i=0; i<n; i++){
514514
if( ! traits::is_na<RTYPE>(start[i]) ){
515515
start[i] += ref[i] ;
516516
}

inst/include/Rcpp/vector/proxy.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace internal{
6565
VECTOR& parent ;
6666
std::string name;
6767
void set( CTYPE rhs ){
68-
int index = 0 ;
68+
R_xlen_t index = 0 ;
6969
try{
7070
index = parent.offset(name) ;
7171
parent[ index ] = rhs ;
@@ -110,14 +110,14 @@ namespace internal{
110110

111111
inline iterator begin() { return get() ; }
112112
inline iterator end(){ return begin() + size() ; }
113-
inline reference operator[]( int i ){ return *( get() + i ) ; }
114-
inline int size(){ return strlen( get() ) ; }
113+
inline reference operator[]( R_xlen_t i ){ return *( get() + i ) ; }
114+
inline R_xlen_t size(){ return strlen( get() ) ; }
115115

116116
private:
117117
VECTOR& parent ;
118118
std::string name;
119119
void set( const std::string& rhs ){
120-
int index = 0 ;
120+
R_xlen_t index = 0 ;
121121
try{
122122
index = parent.offset(name) ;
123123
parent[ index ] = rhs ;
@@ -176,7 +176,7 @@ namespace internal{
176176
VECTOR& parent ;
177177
std::string name;
178178
void set( SEXP rhs ){
179-
int index = 0 ;
179+
R_xlen_t index = 0 ;
180180
try{
181181
index = parent.offset(name) ;
182182
parent[ index ] = rhs ;

inst/unitTests/cpp/ListOf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ NVList test_binary_ops(NVList x) {
8484
}
8585

8686
// [[Rcpp::export]]
87-
int test_sub_calls(NVList x) {
88-
int sz = x[0].size() + x[1].size() + x[2].size();
87+
R_xlen_t test_sub_calls(NVList x) {
88+
R_xlen_t sz = x[0].size() + x[1].size() + x[2].size();
8989
return sz;
9090
}
9191

0 commit comments

Comments
 (0)