From 9d9c1397d0c213766b281bea52bc40d3d2db6f96 Mon Sep 17 00:00:00 2001 From: Hannes Kamecke Date: Tue, 29 May 2018 14:44:15 +0200 Subject: [PATCH] Fix windows com port prefix The check in `_prefix_port_if_needed` does not work, as it's currently comparing the whole input string to the prefix. As a consequence, port strings will be prefixed, even if they're already prefixed. This commit changes the call to `wstring::compare` to use an overload that compares a substring of the input string only. --- src/impl/win.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/impl/win.cc b/src/impl/win.cc index 786f4f6..889e06f 100644 --- a/src/impl/win.cc +++ b/src/impl/win.cc @@ -24,7 +24,7 @@ inline wstring _prefix_port_if_needed(const wstring &input) { static wstring windows_com_port_prefix = L"\\\\.\\"; - if (input.compare(windows_com_port_prefix) != 0) + if (input.compare(0, windows_com_port_prefix.size(), windows_com_port_prefix) != 0) { return windows_com_port_prefix + input; }