File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
inst/include/Rcpp/iostream Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ namespace Rcpp {
3535 protected:
3636 virtual std::streamsize xsputn (const char *s, std::streamsize n );
3737
38- virtual int overflow (int c = EOF );
38+ virtual int overflow (int c = traits_type::eof() );
3939
4040 virtual int sync () ;
4141 };
@@ -67,12 +67,22 @@ namespace Rcpp {
6767 }
6868
6969 template <> inline int Rstreambuf<true >::overflow(int c ) {
70- if (c != EOF) Rprintf ( " %.1s" , &c ) ;
71- return c ;
70+ if (c == traits_type::eof ())
71+ return traits_type::eof ();
72+ else
73+ {
74+ char_type ch = traits_type::to_char_type (c);
75+ return xsputn (&ch, 1 ) == 1 ? c : traits_type::eof ();
76+ }
7277 }
7378 template <> inline int Rstreambuf<false >::overflow(int c ) {
74- if (c != EOF) REprintf ( " %.1s" , &c ) ;
75- return c ;
79+ if (c == traits_type::eof ())
80+ return traits_type::eof ();
81+ else
82+ {
83+ char_type ch = traits_type::to_char_type (c);
84+ return xsputn (&ch, 1 ) == 1 ? c : traits_type::eof ();
85+ }
7686 }
7787
7888 template <> inline int Rstreambuf<true >::sync(){
You can’t perform that action at this time.
0 commit comments