From ddb7c7341106567ba9358793cb3aca2978f28c40 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Fri, 18 Jan 2008 19:51:46 +0000 Subject: [PATCH] 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 --- CHANGES.current | 8 ++++++-- Source/DOH/file.c | 2 +- Source/DOH/string.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 1b4e375e2..0c043584d 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,14 +1,18 @@ Version 1.3.34 (in progress) ============================ -01/16/2007: wsfulton +01/18/2008: olly + Fix handling of byte value 255 in input files on platforms where + char is signed (it was getting mapped to EOF). Fixes SF#1518219. + +01/16/2008: wsfulton Fix template member variables wrapped by a smart pointer. Bug reported by Robert Lupton. 01/14/2008: mgossage Substantial changes to configure script for detecting lua. Code can now link to liblua.a, liblua50.a or liblua51.a - Its also a lot neater now. + It's also a lot neater now. 12/16/2007: wsfulton [Perl] Backed out #1798728 - numbers can be passed to functions taking char * diff --git a/Source/DOH/file.c b/Source/DOH/file.c index 35a3d8a85..8c53978ee 100644 --- a/Source/DOH/file.c +++ b/Source/DOH/file.c @@ -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; diff --git a/Source/DOH/string.c b/Source/DOH/string.c index e783858a6..1498d717a 100644 --- a/Source/DOH/string.c +++ b/Source/DOH/string.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;