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:
Olly Betts 2008-01-18 19:51:46 +00:00
commit ddb7c73411
3 changed files with 8 additions and 4 deletions

View file

@ -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;

View file

@ -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;