Fix handling of byte value 255 in input files on platforms where
char is signed (it was getting mapped to EOF). Fixes SF#1518219. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10211 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
b79e9a7d7e
commit
ddb7c73411
3 changed files with 8 additions and 4 deletions
|
|
@ -139,7 +139,7 @@ static int File_getc(DOH *fo) {
|
|||
return fgetc(f->filep);
|
||||
} else if (f->fd) {
|
||||
#ifdef DOH_INTFILE
|
||||
char c;
|
||||
unsigned char c;
|
||||
if (read(f->fd, &c, 1) < 0)
|
||||
return EOF;
|
||||
return c;
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ static int String_getc(DOH *so) {
|
|||
if (s->sp >= s->len)
|
||||
c = EOF;
|
||||
else
|
||||
c = (int) s->str[s->sp++];
|
||||
c = (int)(unsigned char) s->str[s->sp++];
|
||||
if (c == '\n')
|
||||
s->line++;
|
||||
return c;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue