Skip to content

Commit

Permalink
Merge pull request #24 from masatake/use-unsigned-char-when-comparing…
Browse files Browse the repository at this point in the history
…-string

Use "unsigned char" instead of "char" when comparing byte sequences
  • Loading branch information
masatake authored Nov 21, 2020
2 parents 6c289b7 + 6bb28f4 commit fbc0e8d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions readtags.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static int xdigitValue (char digit)
*/
static int readTagCharacter (const char **s)
{
int c = **s;
int c = **(const unsigned char **)s;

(*s)++;

Expand Down Expand Up @@ -160,7 +160,7 @@ static int taguppercmp (const char *s1, const char *s2)
int c1, c2;
do
{
c1 = *s1++;
c1 = (unsigned char)*s1++;
c2 = readTagCharacter (&s2);

result = toupper (c1) - toupper (c2);
Expand All @@ -174,7 +174,7 @@ static int tagnuppercmp (const char *s1, const char *s2, size_t n)
int c1, c2;
do
{
c1 = *s1++;
c1 = (unsigned char)*s1++;
c2 = readTagCharacter (&s2);

result = toupper (c1) - toupper (c2);
Expand All @@ -188,7 +188,7 @@ static int tagcmp (const char *s1, const char *s2)
int c1, c2;
do
{
c1 = *s1++;
c1 = (unsigned char)*s1++;
c2 = readTagCharacter (&s2);

result = c1 - c2;
Expand Down

0 comments on commit fbc0e8d

Please sign in to comment.