From 126fbf1ab8888d35e67fd6a4da0da31d2d54cf01 Mon Sep 17 00:00:00 2001 From: Satoshi Ikari Date: Thu, 5 Oct 2023 14:27:30 +0200 Subject: [PATCH] Remove strcat warnings in sap --- .../real/power/solar_array_panel.cpp | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/real/power/solar_array_panel.cpp b/src/components/real/power/solar_array_panel.cpp index 152616bdc..b693e36e6 100644 --- a/src/components/real/power/solar_array_panel.cpp +++ b/src/components/real/power/solar_array_panel.cpp @@ -152,32 +152,28 @@ SolarArrayPanel InitSAP(ClockGenerator* clock_generator, int sap_id, const std:: const SolarRadiationPressureEnvironment* srp_environment, double component_step_time_s) { IniAccess sap_conf(file_name); - const std::string st_sap_id = std::to_string(sap_id); - const char* cs = st_sap_id.data(); - - char Section[30] = "SOLAR_ARRAY_PANEL_"; - strcat(Section, cs); + const std::string section_name = "SOLAR_ARRAY_PANEL_" + std::to_string(static_cast(sap_id)); - int prescaler = sap_conf.ReadInt(Section, "prescaler"); + int prescaler = sap_conf.ReadInt(section_name.c_str(), "prescaler"); if (prescaler <= 1) prescaler = 1; int number_of_series; - number_of_series = sap_conf.ReadInt(Section, "number_of_series"); + number_of_series = sap_conf.ReadInt(section_name.c_str(), "number_of_series"); int number_of_parallel; - number_of_parallel = sap_conf.ReadInt(Section, "number_of_parallel"); + number_of_parallel = sap_conf.ReadInt(section_name.c_str(), "number_of_parallel"); double cell_area_m2; - cell_area_m2 = sap_conf.ReadDouble(Section, "cell_area_m2"); + cell_area_m2 = sap_conf.ReadDouble(section_name.c_str(), "cell_area_m2"); libra::Vector<3> normal_vector; - sap_conf.ReadVector(Section, "normal_vector_b", normal_vector); + sap_conf.ReadVector(section_name.c_str(), "normal_vector_b", normal_vector); double cell_efficiency; - cell_efficiency = sap_conf.ReadDouble(Section, "cell_efficiency"); + cell_efficiency = sap_conf.ReadDouble(section_name.c_str(), "cell_efficiency"); double transmission_efficiency; - transmission_efficiency = sap_conf.ReadDouble(Section, "transmission_efficiency"); + transmission_efficiency = sap_conf.ReadDouble(section_name.c_str(), "transmission_efficiency"); SolarArrayPanel sap(prescaler, clock_generator, sap_id, number_of_series, number_of_parallel, cell_area_m2, normal_vector, cell_efficiency, transmission_efficiency, srp_environment, component_step_time_s);