Skip to content

Commit

Permalink
better default sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 3, 2023
1 parent 7803a3a commit 5d4974b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ static SEXP nano_inHook(SEXP x, SEXP fun) {
PROTECT(list = Rf_xlengthgets(nano_refList, xlen + 1));
SET_VECTOR_ELT(list, xlen, x);
}
char idx[NANONEXT_INT_STRLEN];
snprintf(idx, NANONEXT_INT_STRLEN, "%d", (int) xlen + 1);
char idx[NANONEXT_LD_STRLEN];
snprintf(idx, NANONEXT_LD_STRLEN, "%ld", (long int) xlen + 1);
PROTECT(out = Rf_mkChar(idx));
if (xlen == 0) {
PROTECT(names = Rf_ScalarString(out));
Expand All @@ -173,7 +173,7 @@ static SEXP nano_inHook(SEXP x, SEXP fun) {

static SEXP nano_outHook(SEXP x, SEXP fun) {

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

return VECTOR_ELT(fun, i);

Expand Down
4 changes: 2 additions & 2 deletions src/nanonext.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ typedef struct nano_cv_s {

#define ERROR_OUT(xc) Rf_error("%d | %s", xc, nng_strerror(xc))
#define ERROR_RET(xc) { Rf_warning("%d | %s", xc, nng_strerror(xc)); return mk_error(xc); }
#define NANONEXT_INIT_BUFSIZE 16384
#define NANONEXT_INIT_BUFSIZE 8192
#define NANONEXT_SERIAL_VER 3
#define NANONEXT_INT_STRLEN 12
#define NANONEXT_LD_STRLEN 21
#define NANO_ALLOC(x, sz) \
(x)->buf = R_Calloc(sz, unsigned char); \
(x)->len = sz; \
Expand Down

0 comments on commit 5d4974b

Please sign in to comment.