mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
g_strncasecmp() function is deprecated.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8b4124dfa5
commit
0cb04aec3b
@ -161,6 +161,7 @@ AC_CHECK_FUNCS([\
|
|||||||
setreuid statfs sysconf \
|
setreuid statfs sysconf \
|
||||||
tcgetattr tcsetattr truncate \
|
tcgetattr tcsetattr truncate \
|
||||||
strverscmp \
|
strverscmp \
|
||||||
|
strncasecmp \
|
||||||
realpath
|
realpath
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -692,9 +692,41 @@ str_8bit_casecmp (const char *s1, const char *s2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
str_8bit_ncasecmp (const char *t1, const char *t2)
|
str_8bit_ncasecmp (const char *s1, const char *s2)
|
||||||
{
|
{
|
||||||
return g_strncasecmp (t1, t2, min (strlen (t1), strlen (t2)));
|
size_t n;
|
||||||
|
|
||||||
|
g_return_val_if_fail (s1 != NULL, 0);
|
||||||
|
g_return_val_if_fail (s2 != NULL, 0);
|
||||||
|
|
||||||
|
n = min (strlen (s1), strlen (s2));
|
||||||
|
|
||||||
|
/* code from GLib */
|
||||||
|
|
||||||
|
#ifdef HAVE_STRNCASECMP
|
||||||
|
return strncasecmp (s1, s2, n);
|
||||||
|
#else
|
||||||
|
gint c1, c2;
|
||||||
|
|
||||||
|
while (n != 0 && *s1 != '\0' && *s2 != '\0')
|
||||||
|
{
|
||||||
|
n -= 1;
|
||||||
|
/* According to A. Cox, some platforms have islower's that
|
||||||
|
* don't work right on non-uppercase
|
||||||
|
*/
|
||||||
|
c1 = isupper ((guchar) *s1) ? tolower ((guchar) *s1) : *s1;
|
||||||
|
c2 = isupper ((guchar) *s2) ? tolower ((guchar) *s2) : *s2;
|
||||||
|
if (c1 != c2)
|
||||||
|
return (c1 - c2);
|
||||||
|
s1++;
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n != 0)
|
||||||
|
return (((gint) (guchar) *s1) - ((gint) (guchar) *s2));
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2169,7 +2169,7 @@ ftpfs_find_machine (const char *host, const char *domain)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Compare local part */
|
/* Compare local part */
|
||||||
if (g_strncasecmp (host, buffer, host_domain - host))
|
if (g_ascii_strncasecmp (host, buffer, host_domain - host) != 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user