@@ -971,7 +971,7 @@ TclpOpenFileChannel(
971
971
switch (FileGetType (handle )) {
972
972
case FILE_TYPE_SERIAL :
973
973
/*
974
- * Natively named serial ports "com1-9", "\\\\.\\comXX" are
974
+ * Natively named serial ports "com1-9", "\\\\.\\comXX" are
975
975
* already done with the code above.
976
976
* Here we handle all other serial port names.
977
977
*
@@ -1525,12 +1525,11 @@ FileGetType(
1525
1525
* NativeIsComPort --
1526
1526
*
1527
1527
* Determines if a path refers to a Windows serial port.
1528
- * A simple and efficient solution is to use a "name hint" to detect
1529
- * COM ports by their filename instead of resorting to a syscall
1528
+ * A simple and efficient solution is to use a "name hint" to detect
1529
+ * COM ports by their filename instead of resorting to a syscall
1530
1530
* to detect serialness after the fact.
1531
1531
* The following patterns cover common serial port names:
1532
- * COM[1-9]:?
1533
- * //./COM[0-9]+
1532
+ * COM[1-9]
1534
1533
* \\.\COM[0-9]+
1535
1534
*
1536
1535
* Results:
@@ -1550,33 +1549,26 @@ NativeIsComPort(
1550
1549
* 1. Look for com[1-9]:?
1551
1550
*/
1552
1551
1553
- if ( (len >= 4 ) && (len <= 5 )
1554
- && (_wcsnicmp (p , L"com" , 3 ) == 0 ) ) {
1552
+ if ( (len == 4 ) && (_wcsnicmp (p , L"com" , 3 ) == 0 ) ) {
1555
1553
/*
1556
- * The 4th character must be a digit 1..9 optionally followed by a ":"
1554
+ * The 4th character must be a digit 1..9
1557
1555
*/
1558
-
1556
+
1559
1557
if ( (p [3 ] < L'1' ) || (p [3 ] > L'9' ) ) {
1560
1558
return 0 ;
1561
1559
}
1562
- if ( (len == 5 ) && (p [4 ] != L':' ) ) {
1563
- return 0 ;
1564
- }
1565
1560
return 1 ;
1566
1561
}
1567
-
1562
+
1568
1563
/*
1569
- * 2. Look for //./com[0-9]+ or \\.\com[0-9]+
1564
+ * 2. Look for \\.\com[0-9]+
1570
1565
*/
1571
-
1572
- if ( (len >= 8 ) && (
1573
- (_wcsnicmp (p , L"//./com" , 7 ) == 0 )
1574
- || (_wcsnicmp (p , L"\\\\.\\com" , 7 ) == 0 ) ) )
1575
- {
1566
+
1567
+ if ((len >= 8 ) && (_wcsnicmp (p , L"\\\\.\\com" , 7 ) == 0 )) {
1576
1568
/*
1577
1569
* Charaters 8..end must be a digits 0..9
1578
1570
*/
1579
-
1571
+
1580
1572
for ( i = 7 ; i < len ; i ++ ) {
1581
1573
if ( (p [i ] < '0' ) || (p [i ] > '9' ) ) {
1582
1574
return 0 ;
0 commit comments