MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / copy_string_value

Function copy_string_value

src/board_controller/board_info_getter.cpp:352–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

350}
351
352static int copy_string_value (
353 const std::string &value, char *destination, int *len, int max_len, bool use_logger)
354{
355 if ((destination == NULL) || (len == NULL) || (max_len < 1))
356 {
357 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
358 }
359
360 *len = (int)value.size ();
361 if (((int)value.size () + 1) > max_len)
362 {
363 destination[0] = '\0';
364 if (use_logger)
365 {
366 Board::board_logger->error ("provided output buffer is too small, required {}, got {}",
367 value.size () + 1, max_len);
368 }
369 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
370 }
371
372 memcpy (destination, value.c_str (), value.size () + 1);
373 return (int)BrainFlowExitCodes::STATUS_OK;
374}

Callers 2

get_board_descrFunction · 0.85
get_string_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected