diff --git a/src/main/c/Windows/SerialPort_Windows.c b/src/main/c/Windows/SerialPort_Windows.c index aff5d4d..2f9c32a 100644 --- a/src/main/c/Windows/SerialPort_Windows.c +++ b/src/main/c/Windows/SerialPort_Windows.c @@ -170,7 +170,7 @@ JNIEXPORT jobjectArray JNICALL Java_com_fazecast_jSerialComm_SerialPort_getCommP { if (wcsstr(locationString, L"Hub")) hubNumber = _wtoi(wcschr(wcsstr(locationString, L"Hub"), L'#') + 1); - if ((portNumber < 0) && wcsstr(locationString, L"Port")) + if ((portNumber == -1) && wcsstr(locationString, L"Port")) { wchar_t *portString = wcschr(wcsstr(locationString, L"Port"), L'#') + 1; if (portString) @@ -184,11 +184,11 @@ JNIEXPORT jobjectArray JNICALL Java_com_fazecast_jSerialComm_SerialPort_getCommP } free(locationString); } - if (busNumber < 0) + if (busNumber == -1) busNumber = 0; - if (hubNumber < 0) + if (hubNumber == -1) hubNumber = 0; - if (portNumber < 0) + if (portNumber == -1) portNumber = 0; locationString = (wchar_t*)malloc(32*sizeof(wchar_t)); _snwprintf(locationString, 32, L"%d-%d.%d", busNumber, hubNumber, portNumber); diff --git a/src/main/resources/Windows/aarch64/jSerialComm.dll b/src/main/resources/Windows/aarch64/jSerialComm.dll index 0277470..642a93c 100644 Binary files a/src/main/resources/Windows/aarch64/jSerialComm.dll and b/src/main/resources/Windows/aarch64/jSerialComm.dll differ diff --git a/src/main/resources/Windows/armv7/jSerialComm.dll b/src/main/resources/Windows/armv7/jSerialComm.dll index 8864e3c..fbf583b 100644 Binary files a/src/main/resources/Windows/armv7/jSerialComm.dll and b/src/main/resources/Windows/armv7/jSerialComm.dll differ diff --git a/src/main/resources/Windows/x86/jSerialComm.dll b/src/main/resources/Windows/x86/jSerialComm.dll index 7704894..cd3220f 100644 Binary files a/src/main/resources/Windows/x86/jSerialComm.dll and b/src/main/resources/Windows/x86/jSerialComm.dll differ diff --git a/src/main/resources/Windows/x86_64/jSerialComm.dll b/src/main/resources/Windows/x86_64/jSerialComm.dll index 6bb0ed1..e0522a6 100644 Binary files a/src/main/resources/Windows/x86_64/jSerialComm.dll and b/src/main/resources/Windows/x86_64/jSerialComm.dll differ diff --git a/src/test/c/testEnumerateWindows.c b/src/test/c/testEnumerateWindows.c index ad4f5ca..2e9a33c 100644 --- a/src/test/c/testEnumerateWindows.c +++ b/src/test/c/testEnumerateWindows.c @@ -113,7 +113,7 @@ void getPortsWindows(void) { if (wcsstr(locationString, L"Hub")) hubNumber = _wtoi(wcschr(wcsstr(locationString, L"Hub"), L'#') + 1); - if ((portNumber < 0) && wcsstr(locationString, L"Port")) + if ((portNumber == -1) && wcsstr(locationString, L"Port")) { wchar_t *portString = wcschr(wcsstr(locationString, L"Port"), L'#') + 1; if (portString) @@ -127,11 +127,11 @@ void getPortsWindows(void) } free(locationString); } - if (busNumber < 0) + if (busNumber == -1) busNumber = 0; - if (hubNumber < 0) + if (hubNumber == -1) hubNumber = 0; - if (portNumber < 0) + if (portNumber == -1) portNumber = 0; locationString = (wchar_t*)malloc(32*sizeof(wchar_t)); _snwprintf(locationString, 32, L"%d-%d.%d", busNumber, hubNumber, portNumber);