Skip to content

Commit f65e1a0

Browse files
committed
translateCharUTF8
1 parent ab104a0 commit f65e1a0

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

src/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ SEXP nano_encode(SEXP object) {
5050
break;
5151
case STRSXP:
5252
for (i = 0; i < xlen; i++)
53-
outlen += strlen(Rf_translateChar0(STRING_ELT(object, i))) + 1;
53+
outlen += strlen(Rf_translateCharUTF8(STRING_ELT(object, i))) + 1;
5454
PROTECT(out = Rf_allocVector(RAWSXP, outlen));
5555
buf = RAW(out);
5656
for (i = 0, np = 0; i < xlen; i++) {
57-
s = Rf_translateChar0(STRING_ELT(object, i));
57+
s = Rf_translateCharUTF8(STRING_ELT(object, i));
5858
memcpy(buf + np, s, strlen(s) + 1);
5959
np += strlen(s) + 1;
6060
}

src/init.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
#include "nanonext.h"
44

5+
SEXP nano_AioSymbol;
6+
SEXP nano_ContextSymbol;
7+
SEXP nano_DataSymbol;
8+
SEXP nano_DialerSymbol;
9+
SEXP nano_IdSymbol;
10+
SEXP nano_ListenerSymbol;
11+
SEXP nano_ProtocolSymbol;
12+
SEXP nano_ResultSymbol;
13+
SEXP nano_SocketSymbol;
14+
SEXP nano_StateSymbol;
15+
SEXP nano_StreamSymbol;
16+
SEXP nano_TextframesSymbol;
17+
SEXP nano_UnserSymbol;
18+
SEXP nano_UrlSymbol;
19+
520
static void RegisterSymbols(void) {
621
nano_AioSymbol = Rf_install("aio");
722
nano_ContextSymbol = Rf_install("context");

src/nanonext.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ extern void dialer_finalizer(SEXP);
4242
extern void listener_finalizer(SEXP);
4343
#endif
4444

45-
SEXP nano_AioSymbol;
46-
SEXP nano_ContextSymbol;
47-
SEXP nano_DataSymbol;
48-
SEXP nano_DialerSymbol;
49-
SEXP nano_IdSymbol;
50-
SEXP nano_ListenerSymbol;
51-
SEXP nano_ProtocolSymbol;
52-
SEXP nano_ResultSymbol;
53-
SEXP nano_SocketSymbol;
54-
SEXP nano_StateSymbol;
55-
SEXP nano_StreamSymbol;
56-
SEXP nano_TextframesSymbol;
57-
SEXP nano_UnserSymbol;
58-
SEXP nano_UrlSymbol;
45+
extern SEXP nano_AioSymbol;
46+
extern SEXP nano_ContextSymbol;
47+
extern SEXP nano_DataSymbol;
48+
extern SEXP nano_DialerSymbol;
49+
extern SEXP nano_IdSymbol;
50+
extern SEXP nano_ListenerSymbol;
51+
extern SEXP nano_ProtocolSymbol;
52+
extern SEXP nano_ResultSymbol;
53+
extern SEXP nano_SocketSymbol;
54+
extern SEXP nano_StateSymbol;
55+
extern SEXP nano_StreamSymbol;
56+
extern SEXP nano_TextframesSymbol;
57+
extern SEXP nano_UnserSymbol;
58+
extern SEXP nano_UrlSymbol;
5959

6060
extern SEXP rnng_aio_call(SEXP);
6161
extern SEXP rnng_aio_get_msg(SEXP, SEXP, SEXP);

0 commit comments

Comments
 (0)