[Bug 1759] New: getc returns 0x000000FF instead of 0xFFFFFFFF (-1) for EOF
Wine Bugs
wine-bugs at winehq.com
Mon Oct 6 21:54:55 CDT 2003
http://bugs.winehq.com/show_bug.cgi?id=1759
Summary: getc returns 0x000000FF instead of 0xFFFFFFFF (-1) for
EOF
Product: Wine
Version: 20030911
Platform: PC
OS/Version: Linux
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: wine-files
AssignedTo: wine-bugs at winehq.com
ReportedBy: jbon at cfl.rr.com
A program I'm working on calls getc (which I assume maps to MSVCRT_getc). It
has been having problems detecting the EOF condition. It seems that the first
EOF indication comes as a 0x000000ff (255) instead of 0xffffffff (-1). This
causes the character 0xff to be processed as a real character. Strangely
enough, another call to getc_unlocked causes the proper value of 0xffffffff to
be returned, and the EOF is handled. Unfortunately this extra bogus character
breaks this program which is simply checking against EOF (-1).
while (1) {
int c;
c = getc_unlocked(myfile);
if (c == EOF)
break;
else
// process character
}
This behavior goes away when using the native Win98 msvcrt.dll. I've looked in
dlls/msvcrt/file.c for anything that could cause this, but everything in there
looked good. My hunch is that somewhere a character value of 0xff is getting
promoted to int without sign-extension, but I haven't seen this where I have looked.
--
Configure bugmail: http://bugs.winehq.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the wine-bugs
mailing list