| 592 | } |
| 593 | |
| 594 | static 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 | |
| 615 | int delete_streamer ( |
| 616 | const char *streamer, int preset, int board_id, const char *json_brainflow_input_params) |