From 55b29ef40df2b1f91ecab06c492ca70ba5e0297f Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Thu, 10 Jul 2014 11:40:18 +0400 Subject: Return from the loop if a port name is found The function devicePortName() search in the Registry the names of ports by names of registry keys. At first looks for value of a key of "PortName", and then of "PortNumber" key. Thus, the first found value shall stop search and do not try to continue. Tested on Windows 7/8 using Qt4 and then Qt5. Change-Id: I98b00ff043a3b08476fec0a57b0d36ce65fc8d63 Reviewed-by: Sergey Belyashov --- src/serialport/qserialportinfo_win.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/serialport/qserialportinfo_win.cpp b/src/serialport/qserialportinfo_win.cpp index dbef314..0e01ac7 100644 --- a/src/serialport/qserialportinfo_win.cpp +++ b/src/serialport/qserialportinfo_win.cpp @@ -182,6 +182,9 @@ static QString devicePortName(HDEVINFO deviceInfoSet, PSP_DEVINFO_DATA deviceInf } break; } + + if (!portName.isEmpty()) + break; } ::RegCloseKey(key); return portName; -- cgit v1.2.1