Skip to content

Commit

Permalink
fix linter complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Sep 6, 2021
1 parent f2c75da commit 44e6c8a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R-package/src/lightgbm_R.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,30 @@ struct LGBM_R_ErrorClass { SEXP cont_token; };
// after an R allocation error, which would trigger a long jump.
SEXP wrapped_R_string(void *len)
{
return Rf_allocVector(STRSXP, *(R_xlen_t*)len);
return Rf_allocVector(STRSXP, *(reinterpret_cast<R_xlen_t*>(len)));
}

SEXP wrapped_Rf_mkChar(void *txt)
{
return Rf_mkChar((char*)txt);
return Rf_mkChar(reinterpret_cast<char*>(txt));
}

void throw_R_memerr(void *ptr_cont_token, Rboolean jump)
{
if (jump) {
LGBM_R_ErrorClass err{*(SEXP*)ptr_cont_token};
LGBM_R_ErrorClass err{*(reinterpret_cast<SEXP*>(ptr_cont_token))};
throw err;
}
}

SEXP safe_R_string(R_xlen_t len, SEXP &cont_token)
{
return R_UnwindProtect(wrapped_R_string, (void*)&len, throw_R_memerr, &cont_token, cont_token);
return R_UnwindProtect(wrapped_R_string, reinterpret_cast<void*>(&len), throw_R_memerr, &cont_token, cont_token);
}

SEXP safe_R_mkChar(char *txt, SEXP &cont_token)
{
return R_UnwindProtect(wrapped_Rf_mkChar, (void*)txt, throw_R_memerr, &cont_token, cont_token);
return R_UnwindProtect(wrapped_Rf_mkChar, reinterpret_cast<void*>(txt), throw_R_memerr, &cont_token, cont_token);
}

using LightGBM::Common::Split;
Expand Down

0 comments on commit 44e6c8a

Please sign in to comment.