From bda732cce4475a70a456f194c547ac5e286311ae Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Tue, 15 Mar 2022 19:45:49 +0000 Subject: [PATCH] Update AW. Signed-off-by: Andrea Odetti --- source/frontends/sdl/imgui/sdlsettings.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/source/frontends/sdl/imgui/sdlsettings.cpp b/source/frontends/sdl/imgui/sdlsettings.cpp index c8fdb7c6..e8477715 100644 --- a/source/frontends/sdl/imgui/sdlsettings.cpp +++ b/source/frontends/sdl/imgui/sdlsettings.cpp @@ -363,23 +363,22 @@ namespace sa2 if (ImGui::BeginCombo("pcap", current_interface.c_str())) { - std::vector ifaces; + std::vector ifaces; if (PCapBackend::tfe_enumadapter_open()) { - char *pname; - char *pdescription; + std::string name; + std::string description; - while (PCapBackend::tfe_enumadapter(&pname, &pdescription)) + while (PCapBackend::tfe_enumadapter(name, description)) { - ifaces.push_back(pname); - lib_free(pdescription); + ifaces.push_back(name); } PCapBackend::tfe_enumadapter_close(); for (const auto & iface : ifaces) { - const bool isSelected = strcmp(iface, current_interface.c_str()) == 0; - if (ImGui::Selectable(iface, isSelected)) + const bool isSelected = iface == current_interface; + if (ImGui::Selectable(iface.c_str(), isSelected)) { // the following line interacts with tfe_enumadapter, so we must run it outside the above loop PCapBackend::tfe_interface = iface; @@ -389,7 +388,6 @@ namespace sa2 { ImGui::SetItemDefaultFocus(); } - lib_free(iface); } } ImGui::EndCombo();