mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* w32reg.c (read_w32_registry_string): Handle REG_EXPAND_SZ.
Suggested by Ryan Malayter. * strgutil.c (ascii_strcasecmp): Replaced by code from gnulib. (ascii_strncasecmp): New.
This commit is contained in:
parent
e892058dba
commit
075f862277
4 changed files with 110 additions and 12 deletions
|
@ -687,18 +687,58 @@ ascii_tolower (int c)
|
|||
|
||||
|
||||
int
|
||||
ascii_strcasecmp( const char *a, const char *b )
|
||||
ascii_strcasecmp (const char *a, const char *b)
|
||||
{
|
||||
if (a == b)
|
||||
return 0;
|
||||
const unsigned char *p1 = (const unsigned char *)a;
|
||||
const unsigned char *p2 = (const unsigned char *)b;
|
||||
unsigned char c1, c2;
|
||||
|
||||
for (; *a && *b; a++, b++) {
|
||||
if (*a != *b && ascii_toupper(*a) != ascii_toupper(*b))
|
||||
break;
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = ascii_tolower (*p1);
|
||||
c2 = ascii_tolower (*p2);
|
||||
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
return *a == *b? 0 : (ascii_toupper (*a) - ascii_toupper (*b));
|
||||
while (c1 == c2);
|
||||
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
int
|
||||
ascii_strncasecmp (const char *a, const char *b, size_t n)
|
||||
{
|
||||
const unsigned char *p1 = (const unsigned char *)a;
|
||||
const unsigned char *p2 = (const unsigned char *)b;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2 || !n )
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = ascii_tolower (*p1);
|
||||
c2 = ascii_tolower (*p2);
|
||||
|
||||
if ( !--n || c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
return c1 - c2;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ascii_memcasecmp( const char *a, const char *b, size_t n )
|
||||
{
|
||||
|
@ -712,6 +752,7 @@ ascii_memcasecmp( const char *a, const char *b, size_t n )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************
|
||||
********** missing string functions *********
|
||||
*********************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue