There's a bug in MSVCRT_fgetc in 0.9.21 (likely introduced in 0.9.19) in that it sometimes sign extends the byte read from the file. The following program illustrates the problem: #include <stdio.h> int main() { FILE *f = fopen("tmp.bin", "w+"); fputc(0xe0, f); fputc(0xe0, f); rewind(f); printf("0x%08x\n", fgetc(f)); printf("0x%08x\n", fgetc(f)); fclose(f); return 0; } The output is: 0x000000e0 0xffffffe0 (should be 0x000000e0 too) The bug is likely this line: http://source.winehq.org/source/dlls/msvcrt/file.c#L2134 That line is now i = file->_ptr++; but should be i = *(unsigned char*)(file->_ptr++); I don't have a build environment for Wine, and it felt like overkill to set one up for this little bug, so I've not been able to verify my hypothesis. I hope that's acceptable. /Tobias
participants (2)
-
Chris Robinson -
Tobias Ringström