Skip to content

Commit 5d4974b

Browse files
committed
better default sizes
1 parent 7803a3a commit 5d4974b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ static SEXP nano_inHook(SEXP x, SEXP fun) {
153153
PROTECT(list = Rf_xlengthgets(nano_refList, xlen + 1));
154154
SET_VECTOR_ELT(list, xlen, x);
155155
}
156-
char idx[NANONEXT_INT_STRLEN];
157-
snprintf(idx, NANONEXT_INT_STRLEN, "%d", (int) xlen + 1);
156+
char idx[NANONEXT_LD_STRLEN];
157+
snprintf(idx, NANONEXT_LD_STRLEN, "%ld", (long int) xlen + 1);
158158
PROTECT(out = Rf_mkChar(idx));
159159
if (xlen == 0) {
160160
PROTECT(names = Rf_ScalarString(out));
@@ -173,7 +173,7 @@ static SEXP nano_inHook(SEXP x, SEXP fun) {
173173

174174
static SEXP nano_outHook(SEXP x, SEXP fun) {
175175

176-
const int i = atoi(CHAR(STRING_ELT(x, 0))) - 1;
176+
const long int i = atol(CHAR(STRING_ELT(x, 0))) - 1;
177177

178178
return VECTOR_ELT(fun, i);
179179

src/nanonext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ typedef struct nano_cv_s {
127127

128128
#define ERROR_OUT(xc) Rf_error("%d | %s", xc, nng_strerror(xc))
129129
#define ERROR_RET(xc) { Rf_warning("%d | %s", xc, nng_strerror(xc)); return mk_error(xc); }
130-
#define NANONEXT_INIT_BUFSIZE 16384
130+
#define NANONEXT_INIT_BUFSIZE 8192
131131
#define NANONEXT_SERIAL_VER 3
132-
#define NANONEXT_INT_STRLEN 12
132+
#define NANONEXT_LD_STRLEN 21
133133
#define NANO_ALLOC(x, sz) \
134134
(x)->buf = R_Calloc(sz, unsigned char); \
135135
(x)->len = sz; \

0 commit comments

Comments
 (0)