read_string: Use char if you mean char.

This commit is contained in:
Justin M. Keyes 2016-09-12 02:05:42 +02:00
parent df072c3b2b
commit ca93b4a299

View File

@ -4498,16 +4498,16 @@ time_t get8ctime(FILE *fd)
/// @return pointer to the string or NULL when unable to read that many bytes. /// @return pointer to the string or NULL when unable to read that many bytes.
char *read_string(FILE *fd, size_t cnt) char *read_string(FILE *fd, size_t cnt)
{ {
uint8_t *str = xmallocz(cnt); char *str = xmallocz(cnt);
for (size_t i = 0; i < cnt; i++) { for (size_t i = 0; i < cnt; i++) {
int c = getc(fd); int c = getc(fd);
if (c == EOF) { if (c == EOF) {
xfree(str); xfree(str);
return NULL; return NULL;
} }
str[i] = (uint8_t)c; str[i] = (char)c;
} }
return (char *)str; return str;
} }
/// Writes a number to file "fd", most significant bit first, in "len" bytes. /// Writes a number to file "fd", most significant bit first, in "len" bytes.