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

Function copy_string_to_buffer

src/board_controller/board_controller.cpp:594–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594static int copy_string_to_buffer (
595 const std::string &source, char *destination, int *destination_len, int max_len)
596{
597 if ((destination == NULL) || (destination_len == NULL) || (max_len < 1))
598 {
599 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
600 }
601
602 *destination_len = (int)source.size ();
603 if (((int)source.size () + 1) > max_len)
604 {
605 destination[0] = '\0';
606 Board::board_logger->error ("provided output buffer is too small, required {}, got {}",
607 source.size () + 1, max_len);
608 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
609 }
610
611 memcpy (destination, source.c_str (), source.size () + 1);
612 return (int)BrainFlowExitCodes::STATUS_OK;
613}
614
615int delete_streamer (
616 const char *streamer, int preset, int board_id, const char *json_brainflow_input_params)

Callers 1

config_boardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected