decompals / ido-static-recomp

IDO static recomp
43 stars 10 forks source link

Add special case to wrapper_fread for reading 0 bytes #59

Closed EllipticEllipsis closed 1 year ago

EllipticEllipsis commented 1 year ago

wrapper_fread currently misbehaves when it reads 0 bytes from a file, disrupting the stream so the next access gives garbage, at least in the cfe case highlighted in #58 . This can be fixed by adding a special 0 bytes are read, as is done by glibc's fread, and Irix's, although Irix's only looks at count, this also complies with the behaviour the C standard specifies.

Fixes #58 , certainly for the two cases mentioned in that issue. I have not attempted to build a whole decomp repository with this (yet, anyway), so that's worth testing.

EDIT: also added missing 'o' case to _mprintf.