Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21136] Bugfix: Revert XML Flow controller names to const char* #4911

Merged
merged 4 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/fastrtps/xmlparser/XMLParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ class XMLParser
private:

static std::mutex collections_mtx_;
static std::vector<std::string> flow_controller_descriptor_names_;
static std::set<std::string> flow_controller_descriptor_names_;
};

} // namespace xmlparser
Expand Down
20 changes: 11 additions & 9 deletions src/cpp/rtps/xmlparser/XMLElementParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace fastrtps {
namespace xmlparser {

std::mutex XMLParser::collections_mtx_;
std::vector<std::string> XMLParser::flow_controller_descriptor_names_;
std::set<std::string> XMLParser::flow_controller_descriptor_names_;

using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::xml::detail;
Expand Down Expand Up @@ -1058,13 +1058,14 @@ XMLP_ret XMLParser::getXMLFlowControllerDescriptorList(
{
std::lock_guard<std::mutex> lock(collections_mtx_);
// name - stringType
flow_controller_descriptor_names_.emplace_back(get_element_text(p_aux1));
flow_controller_descriptor->name = flow_controller_descriptor_names_.back().c_str();
if (flow_controller_descriptor_names_.back().empty())
auto element_inserted = flow_controller_descriptor_names_.insert(get_element_text(p_aux1));
EduPonz marked this conversation as resolved.
Show resolved Hide resolved
if (element_inserted.first == flow_controller_descriptor_names_.end() ||
element_inserted.first->empty())
{
EPROSIMA_LOG_ERROR(XMLPARSER, "<" << p_aux1->Value() << "> getXMLString XML_ERROR!");
EPROSIMA_LOG_ERROR(XMLPARSER, "Node flow controller node '" << NAME << "' invalid");
return XMLP_ret::XML_ERROR;
}
flow_controller_descriptor->name = element_inserted.first->c_str();
name_defined = true;
}
else if (strcmp(name, SCHEDULER) == 0)
Expand Down Expand Up @@ -2845,13 +2846,14 @@ XMLP_ret XMLParser::getXMLPublishModeQos(
else if (strcmp(name, FLOW_CONTROLLER_NAME) == 0)
{
std::lock_guard<std::mutex> lock(collections_mtx_);
flow_controller_descriptor_names_.emplace_back(get_element_text(p_aux0));
publishMode.flow_controller_name = flow_controller_descriptor_names_.back().c_str();
if (flow_controller_descriptor_names_.back().empty())
auto element_inserted = flow_controller_descriptor_names_.insert(get_element_text(p_aux0));
if (element_inserted.first == flow_controller_descriptor_names_.end() ||
element_inserted.first->empty())
{
EPROSIMA_LOG_ERROR(XMLPARSER, "Node '" << FLOW_CONTROLLER_NAME << "' without content");
EPROSIMA_LOG_ERROR(XMLPARSER, "Node '" << FLOW_CONTROLLER_NAME << "' invalid");
return XMLP_ret::XML_ERROR;
}
publishMode.flow_controller_name = element_inserted.first->c_str();
}
else
{
Expand Down
Loading