[Rcpp-commits] r4285 - in pkg/Rcpp: . inst/include/Rcpp/internal inst/include/Rcpp/traits

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 20 20:00:57 CET 2013


Author: romain
Date: 2013-03-20 20:00:56 +0100 (Wed, 20 Mar 2013)
New Revision: 4285

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/include/Rcpp/internal/wrap.h
   pkg/Rcpp/inst/include/Rcpp/traits/is_wide_string.h
Log:
make httpuv happy

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-03-20 02:30:56 UTC (rev 4284)
+++ pkg/Rcpp/ChangeLog	2013-03-20 19:00:56 UTC (rev 4285)
@@ -1,3 +1,9 @@
+2013-03-20 Romain Francois <romain at r-enthusiasts.com>
+
+        * include/Rcpp/traits/is_wide_string.h : fixes to re-enable wrap( vector<char> )
+        and wrap( vector<wchar_t> ), needed to support package httpuv
+        * include/Rcpp/internal/wrap.h : same
+        
 2013-03-19  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/Rcpp/config.h: Define RCPP_USE_NEW_PRESERVE_RELEASE

Modified: pkg/Rcpp/inst/include/Rcpp/internal/wrap.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/internal/wrap.h	2013-03-20 02:30:56 UTC (rev 4284)
+++ pkg/Rcpp/inst/include/Rcpp/internal/wrap.h	2013-03-20 19:00:56 UTC (rev 4285)
@@ -47,12 +47,23 @@
 		wcstombs( buffer, data, MAXELTSIZE ) ;
 		return Rf_mkChar(buffer) ;
 	}
+	inline SEXP make_charsexp__impl__wstring( wchar_t data ){
+		wchar_t x[2] ; x[0] = data ; x[1] = '\0' ;
+		char* buffer = get_string_buffer() ;
+		wcstombs( buffer, x, MAXELTSIZE ) ;
+		return Rf_mkChar(buffer) ;
+	}
 	inline SEXP make_charsexp__impl__wstring( const std::wstring& st ){
 		return make_charsexp__impl__wstring( st.data()) ;	
 	}
 	inline SEXP make_charsexp__impl__cstring( const char* data ){
 		return Rf_mkChar( data ) ;
 	}
+	inline SEXP make_charsexp__impl__cstring( char data ){
+		char x[2]; x[0] = data ; x[1] = '\0' ;
+		return Rf_mkChar( x ) ;
+	}
+	
 	inline SEXP make_charsexp__impl__cstring( const std::string& st ){
 		return make_charsexp__impl__cstring( st.c_str() ) ;
 	}

Modified: pkg/Rcpp/inst/include/Rcpp/traits/is_wide_string.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/traits/is_wide_string.h	2013-03-20 02:30:56 UTC (rev 4284)
+++ pkg/Rcpp/inst/include/Rcpp/traits/is_wide_string.h	2013-03-20 19:00:56 UTC (rev 4285)
@@ -33,6 +33,9 @@
     template <> struct is_wide_string< const wchar_t* > : public true_type{} ;
     template <> struct is_wide_string< const char* > : public false_type{} ;
     
+    template <> struct is_wide_string< wchar_t > : public true_type{} ;
+    template <> struct is_wide_string< char > : public false_type{} ;
+    
 } // traits
 } // Rcpp
 



More information about the Rcpp-commits mailing list