* grub-core/kern/misc.c (grub_strcmp): Use unsigned comparison as
per common usage and preffered in several parts of code. (grub_memcmp): Likewise. (grub_strncmp): Likewise. * include/grub/misc.h (grub_strcasecmp): Likewise. (grub_strncasecmp): Likewise. * Makefile.util.def (cmp_test): New test. (grub_script_strcmp): Likewise. * tests/cmp_unit_test.c: New file. * tests/grub_script_strcmp.in: Likewise. * grub-core/fs/hfsplus.c (grub_hfsplus_cmp_catkey): Add a comment.
This commit is contained in:
parent
49717bf429
commit
ce41ab7aab
7 changed files with 293 additions and 7 deletions
|
@ -247,14 +247,16 @@ grub_strcasecmp (const char *s1, const char *s2)
|
|||
{
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
if (grub_tolower ((grub_uint8_t) *s1)
|
||||
!= grub_tolower ((grub_uint8_t) *s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
return (int) grub_tolower ((grub_uint8_t) *s1)
|
||||
- (int) grub_tolower ((grub_uint8_t) *s2);
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -272,7 +274,8 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
return (int) grub_tolower ((grub_uint8_t) *s1)
|
||||
- (int) grub_tolower ((grub_uint8_t) *s2);
|
||||
}
|
||||
|
||||
unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue