-
-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use 'Rf_mkCharLenCE() as appropriate #917
Conversation
0c815c6
to
8c26ace
Compare
inst/include/Rcpp/String.h
Outdated
@@ -395,9 +395,12 @@ namespace Rcpp { | |||
enc = encoding; | |||
|
|||
if (valid) { | |||
data = Rcpp_ReplaceObject(data, Rf_mkCharCE(Rf_translateCharUTF8(data), encoding)); | |||
const void* vmax = vmaxget(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that translateCharUTF8() has, in the R sources:
so it's recommended that we manage the stack after usage. Not sure if we should do this in this PR or just leave it out for now though.
It just occurred to me that we don't want the R error (ie the |
That sounds like a worthwhile change. |
@kevinushey Do you want to add an error check before |
Yes, sorry -- I'll try to get to it soon. |
No worries -- that was the right call. No rush. |
8c26ace
to
ddd2c8b
Compare
ddd2c8b
to
10a02e2
Compare
I'm confused. Did you amend the initial commit in this PR? I am only seeing one commit when there should have been two. |
Yes, I amended the original commit -- I tend to do this on feature branches just to keep the commit history clean. (Although perhaps it's better to just squash and merge rather than retroactively change history on the branch) |
Yes, we could settle on just squashing. I also don't single / non-parallel branches merging back. In any event here the downside was that your repo co-user, ie me, got lost :). |
Sorry for the confusion :-) Ultimately, this should be ready to go now. |
It looks like the |
Interesting. Have we ever done that? Explicitly accomodate other packages? (And yes, hdf5 package seem to be a in constant state of flux. Too bad CRAN doesn't just patch...) Edit: I also know the h5 maintainer so I can always ask... |
Not that I can recall, but given that it's one package with a simple workaround, I don't mind having this live in Rcpp if it means existing code depending on |
It is on the hack-ish side of things but if we mean it to be temporary I can live with it. Let me email Mario and see what he says. |
Oh, and I just now see the rather nice ticket you opened there already. Well done. |
Closes #916, taking option (1) -- signal an error if an embedded NUL byte is encountered, as R does.