X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Ffflush.c;h=1e8e2dc920bcc2e49e2f41a6246c2567a2fee242;hb=3d25ec76d62050ec9a2f0cf861b66122132f1539;hp=0af17034e42c69ad4d51417b06bcd1b2a9b693b2;hpb=7becd9d708425924f3a402fdd3c6e18ba2a7e4e3;p=gnulib.git diff --git a/lib/fflush.c b/lib/fflush.c index 0af17034e..1e8e2dc92 100644 --- a/lib/fflush.c +++ b/lib/fflush.c @@ -1,5 +1,5 @@ /* fflush.c -- allow flushing input streams - Copyright (C) 2007-2009 Free Software Foundation, Inc. + Copyright (C) 2007-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,8 @@ #include "stdio-impl.h" +#include "unused-parameter.h" + #undef fflush @@ -60,7 +62,7 @@ clear_ungetc_buffer (FILE *fp) fp->_ungetc_count = 0; fp->_rcount = - fp->_rcount; } -# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# elif defined _IOERR /* Minix, AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw, NonStop Kernel */ /* Nothing to do. */ # else /* other implementations */ fseeko (fp, 0, SEEK_CUR); @@ -91,7 +93,22 @@ static inline void update_fpos_cache (FILE *fp, off_t pos) { #if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */ +# if defined __CYGWIN__ + /* fp_->_offset is typed as an integer. */ fp_->_offset = pos; +# else + /* fp_->_offset is an fpos_t. */ + /* Use a union, since on NetBSD, the compilation flags determine + whether fpos_t is typedef'd to off_t or a struct containing a + single off_t member. */ + union + { + fpos_t f; + off_t o; + } u; + u.o = pos; + fp_->_offset = u.f; +# endif fp_->_flags |= __SOFF; #endif }