From d787fd90a576e67dff99d863822b80c5a75dd81f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 1 Mar 2009 02:39:04 +0100 Subject: [PATCH] More support for FreeMiNT. --- ChangeLog | 11 ++++++++++- lib/freading.c | 13 +++++++++---- lib/fwriting.c | 13 +++++++++---- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35ae1f5c1..381888470 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,15 @@ 2009-02-28 Bruno Haible - * tests/test-freadseek.c (main): Disable test beyond end of file on FreeMiNT. + More support for FreeMiNT. + * lib/freading.c (freading) [__MINT__]: Use new macros that were added + to FreeMiNT today. + * lib/fwriting.c (fwriting): Likewise. + Based on patch by Alan Hourihane . + +2009-02-28 Bruno Haible + + * tests/test-freadseek.c (main): Disable test beyond end of file on + FreeMiNT. * tests/test-ftello.c (main): Likewise. Patch by Alan Hourihane . diff --git a/lib/freading.c b/lib/freading.c index f20affce3..4da0e31bb 100644 --- a/lib/freading.c +++ b/lib/freading.c @@ -47,10 +47,15 @@ freading (FILE *fp) return ((fp->_Mode & 0x2 /* _MOPENW */) == 0 || (fp->_Mode & 0x1000 /* _MREAD */) != 0); #elif defined __MINT__ /* Atari FreeMiNT */ - return (!fp->__mode.__write - || (fp->__mode.__read - && (fp->__buffer < fp->__get_limit - /*|| fp->__bufp == fp->__put_limit ??*/))); + if (!fp->__mode.__write) + return 1; + if (!fp->__mode.__read) + return 0; +# ifdef _IO_CURRENTLY_GETTING /* Flag added on 2009-02-28 */ + return (fp->__flags & _IO_CURRENTLY_GETTING) != 0; +# else + return (fp->__buffer < fp->__get_limit /*|| fp->__bufp == fp->__put_limit ??*/); +# endif #else #error "Please port gnulib freading.c to your platform!" #endif diff --git a/lib/fwriting.c b/lib/fwriting.c index b7fa45571..c6dc9ac8d 100644 --- a/lib/fwriting.c +++ b/lib/fwriting.c @@ -41,10 +41,15 @@ fwriting (FILE *fp) return ((fp->_Mode & 0x1 /* _MOPENR */) == 0 || (fp->_Mode & 0x2000 /* _MWRITE */) != 0); #elif defined __MINT__ /* Atari FreeMiNT */ - return (!fp->__mode.__read - || (fp->__mode.__write - && (fp->__buffer < fp->__put_limit - /*|| fp->__bufp == fp->__get_limit ??*/))); + if (!fp->__mode.__read) + return 1; + if (!fp->__mode.__write) + return 0; +# ifdef _IO_CURRENTLY_PUTTING /* Flag added on 2009-02-28 */ + return (fp->__flags & _IO_CURRENTLY_PUTTING) != 0; +# else + return (fp->__buffer < fp->__put_limit /*|| fp->__bufp == fp->__get_limit ??*/); +# endif #else #error "Please port gnulib fwriting.c to your platform!" #endif -- 2.11.0