MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / EncodeChar

Function EncodeChar

python-package/compile/src/lightgbm_R.cpp:38–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36using namespace LightGBM;
37
38LGBM_SE EncodeChar(LGBM_SE dest, const char* src, LGBM_SE buf_len, LGBM_SE actual_len, size_t str_len) {
39 if (str_len > INT32_MAX) {
40 Log::Fatal("Don't support large string in R-package");
41 }
42 R_INT_PTR(actual_len)[0] = static_cast<int>(str_len);
43 if (R_AS_INT(buf_len) < static_cast<int>(str_len)) { return dest; }
44 auto ptr = R_CHAR_PTR(dest);
45 std::memcpy(ptr, src, str_len);
46 return dest;
47}
48
49LGBM_SE LGBM_GetLastError_R(LGBM_SE buf_len, LGBM_SE actual_len, LGBM_SE err_msg) {
50 return EncodeChar(err_msg, LGBM_GetLastError(), buf_len, actual_len, std::strlen(LGBM_GetLastError()) + 1);

Callers 5

LGBM_GetLastError_RFunction · 0.70
LGBM_BoosterDumpModel_RFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected