X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fext2.c;h=34162780131849adc93b4508516e0a4450bc07ed;hb=21a172dd36cae7a08492fd3a7500d7bf0daee13e;hp=e587d64b2b52e32af33afefc4afc0624a1ba76fb;hpb=e15171b8d8e80e8b5bcf4e95b1709697858f545a;p=musl diff --git a/src/stdio/ext2.c b/src/stdio/ext2.c index e587d64b..34162780 100644 --- a/src/stdio/ext2.c +++ b/src/stdio/ext2.c @@ -1,16 +1,16 @@ #include "stdio_impl.h" +#include size_t __freadahead(FILE *f) { - return f->rend - f->rpos; + return f->rend ? f->rend - f->rpos : 0; } const char *__freadptr(FILE *f, size_t *sizep) { - size_t size = f->rend - f->rpos; - if (!size) return 0; - *sizep = size; - return f->rpos; + if (f->rpos == f->rend) return 0; + *sizep = f->rend - f->rpos; + return (const char *)f->rpos; } void __freadptrinc(FILE *f, size_t inc)