File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change
1
+ 2017-02-14 Iñaki Ucar <
[email protected] >
2
+
3
+ * inst/include/Rcpp/iostream/Rstreambuf.h: Fixed single-character handling
4
+ (pull request #649, fixes issue #647)
5
+
1
6
2017-02-13 Dirk Eddelbuettel <
[email protected] >
2
7
3
8
* R/Attributes.R (.plugins[["cpp17"]]): New plugin
Original file line number Diff line number Diff line change 9
9
\itemize {
10
10
\item Added new size attribute aliases for number of rows and columns in
11
11
DataFrame (James Balamuta in \ghpr {638 } addressing \ghit {630 }).
12
+ \item Fixed single - character handling in \code {Rstreambuf } (I ñaki Ucar in
13
+ \ghpr {649 } addressing \ghit {647 }).
12
14
}
13
15
\item Changes in Rcpp Sugar :
14
16
\itemize {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ namespace Rcpp {
35
35
protected:
36
36
virtual std::streamsize xsputn (const char *s, std::streamsize n );
37
37
38
- virtual int overflow (int c = EOF );
38
+ virtual int overflow (int c = traits_type::eof() );
39
39
40
40
virtual int sync () ;
41
41
};
@@ -67,12 +67,18 @@ namespace Rcpp {
67
67
}
68
68
69
69
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
+ char_type ch = traits_type::to_char_type (c);
72
+ return xsputn (&ch, 1 ) == 1 ? c : traits_type::eof ();
73
+ }
74
+ return c;
72
75
}
73
76
template <> inline int Rstreambuf<false >::overflow(int c ) {
74
- if (c != EOF) REprintf ( " %.1s" , &c ) ;
75
- return c ;
77
+ if (c != traits_type::eof ()) {
78
+ char_type ch = traits_type::to_char_type (c);
79
+ return xsputn (&ch, 1 ) == 1 ? c : traits_type::eof ();
80
+ }
81
+ return c;
76
82
}
77
83
78
84
template <> inline int Rstreambuf<true >::sync(){
You can’t perform that action at this time.
0 commit comments