diff --git a/src/column.cpp b/src/column.cpp index 3f43a9e..7492a34 100644 --- a/src/column.cpp +++ b/src/column.cpp @@ -5,6 +5,7 @@ #include "string_utils.h" #include "iconv.h" + #include using namespace Rcpp; @@ -101,47 +102,28 @@ void ColumnInteger::setValue(int i, const char* x_start, const char* x_end) { } void ColumnCharacter::resize(int n) { - if (n == n_) - return; - - if (n > 0 && n < n_) { - SETLENGTH(values_, n); - SET_TRUELENGTH(values_, n); - } else { - values_ = Rf_lengthgets(values_, n); - } + if (n == n_) return; + values_ = Rf_lengthgets(values_, n); n_ = n; - } -void ColumnDouble::resize(int n) { - if (n == n_) - return; - if (n > 0 && n < n_) { - SETLENGTH(values_, n); - SET_TRUELENGTH(values_, n); - } else { - values_ = Rf_lengthgets(values_, n); - } +void ColumnDouble::resize(int n) { + if (n == n_) return; + values_ = Rf_lengthgets(values_, n); n_ = n; valuepointer = REAL(values_); } -void ColumnInteger::resize(int n) { - if (n == n_) - return; - if (n > 0 && n < n_) { - SETLENGTH(values_, n); - SET_TRUELENGTH(values_, n); - } else { - values_ = Rf_lengthgets(values_, n); - } +void ColumnInteger::resize(int n) { + if (n == n_) return; + values_ = Rf_lengthgets(values_, n); n_ = n; valuepointer = INTEGER(values_); } + std::vector createAllColumns(CharacterVector types, Rcpp::List var_opts, Iconv* pEncoder_) { int num_cols = static_cast(types.size()); std::vector out;