http://bugs.winehq.org/show_bug.cgi?id=6525
Summary: Microchip C18 compiler, fread bug? Product: Wine Version: 0.9.23. Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-msvcrt AssignedTo: wine-bugs@winehq.org ReportedBy: user_2_2_3@yahoo.com
Microchip's C18 compiler (v2.40) no longer works under wine. More specifically, when I try to compile with it, it fails claiming the code has an error on line 0 (btw, line numbering starts at 1).
I used git and found that a change to 'fread' in dlls/msvcrt/file.c back in july was the culprit. In that patch, 'fread' was changed to use a 'while' loop containing a '_read(file->_file,ptr, rcnt);'. Basically, 'ptr' (the destination for the data) isn't getting updated in between successive '_read's.
In the latest source (that I've seen) this bug has mulitplied with the addition of a 'memcpy(ptr, file->_ptr, i);' in the same loop.
A couple well-placed 'if( i > 0 ) ptr = (char*)ptr + i;' should fix this.