diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2014-07-10 11:40:18 +0400 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2014-07-10 10:41:19 +0200 |
commit | 55b29ef40df2b1f91ecab06c492ca70ba5e0297f (patch) | |
tree | 4b96b9f68a2482e4b85c0b49074743f459005400 /src | |
parent | c3460993440172f0f29fe2bc290c0b2f10d3de5a (diff) | |
download | qtserialport-55b29ef40df2b1f91ecab06c492ca70ba5e0297f.tar.gz |
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 <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/serialport/qserialportinfo_win.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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; |