From 0b56b1685a3a815296b1a55fced4dbdcb05cdfb9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 23 Dec 2020 14:08:20 -0600 Subject: [PATCH] Use LiStringifyPortFlags() instead of coding it ourselves --- app/gui/computermodel.cpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/app/gui/computermodel.cpp b/app/gui/computermodel.cpp index 87dbdac9..f6156ddd 100644 --- a/app/gui/computermodel.cpp +++ b/app/gui/computermodel.cpp @@ -158,26 +158,9 @@ public: emit connectionTestCompleted(-1, QString()); } else { - QString blockedPorts; - - for (int i = 0; i < 32; i++) { - if (portTestResult & (1 << i)) { - if (!blockedPorts.isEmpty()) { - blockedPorts += "\n"; - } - - if (LiGetProtocolFromPortFlagIndex(i) == 17 /* IPPROTO_UDP */) { - blockedPorts += "UDP "; - } - else { - blockedPorts += "TCP "; - } - - blockedPorts += QString::number(LiGetPortFromPortFlagIndex(i)); - } - } - - emit connectionTestCompleted(portTestResult, blockedPorts); + char blockedPorts[512]; + LiStringifyPortFlags(portTestResult, "\n", blockedPorts, sizeof(blockedPorts)); + emit connectionTestCompleted(portTestResult, QString(blockedPorts)); } }