Simplify str_toupper() in "utils.c".
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
05900b62e9
commit
061f74108b
@ -873,7 +873,7 @@ char *new_tempfile (const char *, int);
|
|||||||
void erase_note (char **, enum eraseflg);
|
void erase_note (char **, enum eraseflg);
|
||||||
int parse_date (char *, enum datefmt, int *, int *, int *,
|
int parse_date (char *, enum datefmt, int *, int *, int *,
|
||||||
struct date *);
|
struct date *);
|
||||||
char *str_toupper (char *);
|
void str_toupper (char *);
|
||||||
void file_close (FILE *, const char *);
|
void file_close (FILE *, const char *);
|
||||||
void psleep (unsigned);
|
void psleep (unsigned);
|
||||||
|
|
||||||
|
13
src/io.c
13
src/io.c
@ -1916,13 +1916,13 @@ ical_chk_header (FILE *fd, unsigned *lineno)
|
|||||||
|
|
||||||
(void)fgets (buf, BUFSIZ, fd);
|
(void)fgets (buf, BUFSIZ, fd);
|
||||||
(*lineno)++;
|
(*lineno)++;
|
||||||
if (buf == NULL
|
|
||||||
|| strncmp (str_toupper (buf), icalheader.str, icalheader.len) != 0)
|
if (buf == NULL) return HEADER_MALFORMED;
|
||||||
{
|
|
||||||
|
str_toupper (buf);
|
||||||
|
if (strncmp (buf, icalheader.str, icalheader.len) != 0)
|
||||||
return HEADER_MALFORMED;
|
return HEADER_MALFORMED;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const int AWAITED = 1;
|
const int AWAITED = 1;
|
||||||
float version = HEADER_MALFORMED;
|
float version = HEADER_MALFORMED;
|
||||||
int read;
|
int read;
|
||||||
@ -1942,7 +1942,6 @@ ical_chk_header (FILE *fd, unsigned *lineno)
|
|||||||
while (read != AWAITED);
|
while (read != AWAITED);
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* iCalendar date-time format is based on the ISO 8601 complete
|
* iCalendar date-time format is based on the ISO 8601 complete
|
||||||
|
@ -957,14 +957,11 @@ parse_date (char *date_string, enum datefmt datefmt, int *year, int *month,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
void
|
||||||
str_toupper (char *s)
|
str_toupper (char *s)
|
||||||
{
|
{
|
||||||
int len;
|
if (!s) return;
|
||||||
|
for (; *s; s++) *s = toupper (*s);
|
||||||
for (len = 0; s && s[len]; len++)
|
|
||||||
s[len] = toupper (s[len]);
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user