[PATCH 2/4] nsiproxy: Use str(n)casecmp() instead of _strnicmp().

Huw Davies huw at codeweavers.com
Fri Oct 1 07:04:10 CDT 2021


Signed-off-by: Huw Davies <huw at codeweavers.com>
---
 dlls/nsiproxy.sys/ip.c   | 22 +++++++++++-----------
 dlls/nsiproxy.sys/ndis.c |  2 +-
 dlls/nsiproxy.sys/tcp.c  |  4 ++--
 dlls/nsiproxy.sys/udp.c  |  6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c
index 12fae3f2f12..aabf82d4d86 100644
--- a/dlls/nsiproxy.sys/ip.c
+++ b/dlls/nsiproxy.sys/ip.c
@@ -261,10 +261,10 @@ static NTSTATUS ipv4_icmpstats_get_all_parameters( const void *key, DWORD key_si
 
         while ((ptr = fgets( buf, sizeof(buf), fp )))
         {
-            if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue;
+            if (strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
             /* last line was a header, get another */
             if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
-            if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 ))
+            if (!strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
             {
                 ptr += sizeof(hdr);
                 sscanf( ptr, "%u %u %*u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u",
@@ -427,13 +427,13 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
             while (*value == ' ') value++;
             if ((ptr = strchr( value, '\n' ))) *ptr='\0';
 
-            if (!_strnicmp( buf, "Icmp6InMsgs", -1 ))
+            if (!strcasecmp( buf, "Icmp6InMsgs" ))
             {
                 if (sscanf( value, "%d", &res )) dyn.in_msgs = res;
                 continue;
             }
 
-            if (!_strnicmp( buf, "Icmp6InErrors", -1 ))
+            if (!strcasecmp( buf, "Icmp6InErrors" ))
             {
                 if (sscanf( value, "%d", &res )) dyn.in_errors = res;
                 continue;
@@ -441,7 +441,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
 
             for (i = 0; i < ARRAY_SIZE(in_list); i++)
             {
-                if (!_strnicmp( buf, in_list[i].name, -1 ))
+                if (!strcasecmp( buf, in_list[i].name ))
                 {
                     if (sscanf( value, "%d", &res ))
                         dyn.in_type_counts[in_list[i].pos] = res;
@@ -449,13 +449,13 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
                 }
             }
 
-            if (!_strnicmp( buf, "Icmp6OutMsgs", -1 ))
+            if (!strcasecmp( buf, "Icmp6OutMsgs" ))
             {
                 if (sscanf( value, "%d", &res )) dyn.out_msgs = res;
                 continue;
             }
 
-            if (!_strnicmp( buf, "Icmp6OutErrors", -1 ))
+            if (!strcasecmp( buf, "Icmp6OutErrors" ))
             {
                 if (sscanf( value, "%d", &res )) dyn.out_errors = res;
                 continue;
@@ -463,7 +463,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, DWORD key_si
 
             for (i = 0; i < ARRAY_SIZE(out_list); i++)
             {
-                if (!_strnicmp( buf, out_list[i].name, -1 ))
+                if (!strcasecmp( buf, out_list[i].name ))
                 {
                     if (sscanf( value, "%d", &res ))
                         dyn.out_type_counts[out_list[i].pos] = res;
@@ -504,10 +504,10 @@ static NTSTATUS ipv4_ipstats_get_all_parameters( const void *key, DWORD key_size
 
         while ((ptr = fgets( buf, sizeof(buf), fp )))
         {
-            if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue;
+            if (strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
             /* last line was a header, get another */
             if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
-            if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 ))
+            if (!strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
             {
                 DWORD in_recv, in_hdr_errs, fwd_dgrams, in_delivers, out_reqs;
                 ptr += sizeof(hdr);
@@ -643,7 +643,7 @@ static NTSTATUS ipv6_ipstats_get_all_parameters( const void *key, DWORD key_size
             if ((ptr = strchr( value, '\n' ))) *ptr = '\0';
 
             for (i = 0; i < ARRAY_SIZE(ipstatlist); i++)
-                if (!_strnicmp( buf, ipstatlist[i].name, -1 ))
+                if (!strcasecmp( buf, ipstatlist[i].name ))
                 {
                     if (ipstatlist[i].size == sizeof(long))
                         *(long *)ipstatlist[i].elem = strtoul( value, NULL, 10 );
diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c
index 1d0e69c593c..d75855dcf67 100644
--- a/dlls/nsiproxy.sys/ndis.c
+++ b/dlls/nsiproxy.sys/ndis.c
@@ -354,7 +354,7 @@ static void ifinfo_fill_dynamic( struct if_entry *entry, struct nsi_ndis_ifinfo_
             while ((ptr = fgets( buf, sizeof(buf), fp )))
             {
                 while (*ptr && isspace( *ptr )) ptr++;
-                if (!_strnicmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':')
+                if (!strncasecmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':')
                 {
                     unsigned long long values[9];
                     ptr += name_len + 1;
diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c
index f9ddf1a2b23..32939251dbe 100644
--- a/dlls/nsiproxy.sys/tcp.c
+++ b/dlls/nsiproxy.sys/tcp.c
@@ -147,10 +147,10 @@ static NTSTATUS tcp_stats_get_all_parameters( const void *key, DWORD key_size, v
 
         while ((ptr = fgets( buf, sizeof(buf), fp )))
         {
-            if (_strnicmp( buf, hdr, sizeof(hdr) - 1 )) continue;
+            if (strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
             /* last line was a header, get another */
             if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
-            if (!_strnicmp( buf, hdr, sizeof(hdr) - 1 ))
+            if (!strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
             {
                 DWORD in_segs, out_segs;
                 ptr += sizeof(hdr);
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c
index a0ace071753..efd18392a45 100644
--- a/dlls/nsiproxy.sys/udp.c
+++ b/dlls/nsiproxy.sys/udp.c
@@ -123,10 +123,10 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, DWORD key_size, v
 
         while ((ptr = fgets( buf, sizeof(buf), fp )))
         {
-            if (_strnicmp( buf, hdr, sizeof(hdr) - 1) ) continue;
+            if (strncasecmp( buf, hdr, sizeof(hdr) - 1 )) continue;
             /* last line was a header, get another */
             if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
-            if (!_strnicmp(buf, hdr, sizeof(hdr) - 1))
+            if (!strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
             {
                 unsigned int in_dgrams, out_dgrams;
                 ptr += sizeof(hdr);
@@ -176,7 +176,7 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, DWORD key_size, v
             if ((ptr = strchr( value, '\n' ))) *ptr='\0';
 
             for (i = 0; i < ARRAY_SIZE(udp_stat_list); i++)
-                if (!_strnicmp( buf, udp_stat_list[i].name, -1 ) && sscanf( value, "%d", &res ))
+                if (!strcasecmp( buf, udp_stat_list[i].name ) && sscanf( value, "%d", &res ))
                     *udp_stat_list[i].elem = res;
         }
         dyn.in_dgrams = in_dgrams;
-- 
2.25.1




More information about the wine-devel mailing list