nsiproxy: Use an ascii version of str(n)casecmp() instead of _strnicmp().
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7199f32c0b
commit
280999aee2
|
@ -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 (ascii_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 (!ascii_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 (!ascii_strcasecmp( buf, "Icmp6InMsgs" ))
|
||||
{
|
||||
if (sscanf( value, "%d", &res )) dyn.in_msgs = res;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_strnicmp( buf, "Icmp6InErrors", -1 ))
|
||||
if (!ascii_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 (!ascii_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 (!ascii_strcasecmp( buf, "Icmp6OutMsgs" ))
|
||||
{
|
||||
if (sscanf( value, "%d", &res )) dyn.out_msgs = res;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_strnicmp( buf, "Icmp6OutErrors", -1 ))
|
||||
if (!ascii_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 (!ascii_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 (ascii_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 (!ascii_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 (!ascii_strcasecmp( buf, ipstatlist[i].name ))
|
||||
{
|
||||
if (ipstatlist[i].size == sizeof(long))
|
||||
*(long *)ipstatlist[i].elem = strtoul( value, NULL, 10 );
|
||||
|
|
|
@ -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 (!ascii_strncasecmp( ptr, entry->if_unix_name, name_len ) && ptr[name_len] == ':')
|
||||
{
|
||||
unsigned long long values[9];
|
||||
ptr += name_len + 1;
|
||||
|
|
|
@ -135,3 +135,24 @@ extern const struct module ipv4_module DECLSPEC_HIDDEN;
|
|||
extern const struct module ipv6_module DECLSPEC_HIDDEN;
|
||||
extern const struct module tcp_module DECLSPEC_HIDDEN;
|
||||
extern const struct module udp_module DECLSPEC_HIDDEN;
|
||||
|
||||
static inline int ascii_strncasecmp( const char *s1, const char *s2, size_t n )
|
||||
{
|
||||
int l1, l2;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
l1 = (unsigned char)((*s1 >= 'A' && *s1 <= 'Z') ? *s1 + ('a' - 'A') : *s1);
|
||||
l2 = (unsigned char)((*s2 >= 'A' && *s2 <= 'Z') ? *s2 + ('a' - 'A') : *s2);
|
||||
if (l1 != l2) return l1 - l2;
|
||||
if (!l1) return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ascii_strcasecmp( const char *s1, const char *s2 )
|
||||
{
|
||||
return ascii_strncasecmp( s1, s2, -1 );
|
||||
}
|
||||
|
|
|
@ -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 (ascii_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 (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
|
||||
{
|
||||
DWORD in_segs, out_segs;
|
||||
ptr += sizeof(hdr);
|
||||
|
|
|
@ -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 (ascii_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 (!ascii_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 (!ascii_strcasecmp( buf, udp_stat_list[i].name ) && sscanf( value, "%d", &res ))
|
||||
*udp_stat_list[i].elem = res;
|
||||
}
|
||||
dyn.in_dgrams = in_dgrams;
|
||||
|
|
Loading…
Reference in New Issue