X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/92e789b98886747a330ba0791a39217316c18b33..ebd71fa45bb0538e65e3106de57a04ae6c70abae:/sbr/m_getfld.c diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 40ae2289..c6716284 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -443,6 +443,9 @@ read_more (m_getfld_state_t s) { return num_read; } +/* The return values of the following functions are a bit + subtle. They can return 0x00 - 0xff as a valid character, + but EOF is typically 0xffffffff. */ static int Getc (m_getfld_state_t s) { if (s->end - s->readpos < 1) { @@ -454,7 +457,7 @@ Getc (m_getfld_state_t s) { } ++s->bytes_read; - return s->readpos < s->end ? *s->readpos++ : EOF; + return s->readpos < s->end ? (unsigned char) *s->readpos++ : EOF; } static int @@ -467,7 +470,7 @@ Peek (m_getfld_state_t s) { } } - return s->readpos < s->end ? *s->readpos : EOF; + return s->readpos < s->end ? (unsigned char) *s->readpos : EOF; } static int @@ -476,7 +479,7 @@ Ungetc (int c, m_getfld_state_t s) { return EOF; } else { --s->bytes_read; - return *--s->readpos = c; + return *--s->readpos = (unsigned char) c; } }