* lib-stream.c: try to make the __filbuf() implementation portable across
HP-UX and OpenSolaris.
This commit is contained in:
parent
36726dcced
commit
f9f17a64a3
16
configure.ac
16
configure.ac
@ -67,6 +67,22 @@ AC_TRY_COMPILE([#define _XOPEN_SOURCE_EXTENDED
|
||||
AC_MSG_RESULT($ac_v_recv_t)
|
||||
AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
|
||||
|
||||
AC_MSG_CHECKING(for FILE* internal members)
|
||||
ac_v_fp_cnt="unknown"
|
||||
ac_v_fp_ptr="unknown"
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[FILE *fp; fp->__cnt++; fp->__ptr++],
|
||||
[ac_v_fp_cnt=__cnt; ac_v_fp_ptr=__ptr])
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[FILE *fp; fp->_cnt++; fp->_ptr++],
|
||||
[ac_v_fp_cnt=_cnt; ac_v_fp_ptr=_ptr])
|
||||
AC_TRY_COMPILE([#include <stdio.h>],
|
||||
[FILE *fp; fp->_c++; fp->_p++],
|
||||
[ac_v_fp_cnt=_c; ac_v_fp_ptr=_p])
|
||||
AC_MSG_RESULT($ac_v_fp_cnt/$ac_v_fp_ptr)
|
||||
AC_DEFINE_UNQUOTED(FILE_CNT, $ac_v_fp_cnt, [Define to the FILE::cnt member name])
|
||||
AC_DEFINE_UNQUOTED(FILE_PTR, $ac_v_fp_ptr, [Define to the FILE::ptr member name])
|
||||
|
||||
AC_MSG_CHECKING(for pragma INIT/FINI)
|
||||
AC_TRY_COMPILE([],
|
||||
[#pragma INIT "my_init"
|
||||
|
||||
@ -144,7 +144,7 @@ int (*ORIG(__filbuf)) (FILE *fp);
|
||||
/* Our function wrappers */
|
||||
#if defined HAVE_REFILL_STDIO /* Fuzz fp if we have __srefill() */
|
||||
# define FOPEN_FUZZ() \
|
||||
_zz_fuzz(fd, ret->__ptr, ret->__cnt)
|
||||
_zz_fuzz(fd, ret->FP_PTR, ret->FP_CNT)
|
||||
#else
|
||||
# define FOPEN_FUZZ()
|
||||
#endif
|
||||
@ -794,10 +794,10 @@ int NEW(__filbuf)(FILE *fp)
|
||||
if(ret != EOF)
|
||||
{
|
||||
if(newpos != -1)
|
||||
_zz_setpos(fd, newpos - fp->__cnt - 1);
|
||||
_zz_fuzz(fd, fp->__ptr - 1, fp->__cnt + 1);
|
||||
ret = (uint8_t)fp->__ptr[-1];
|
||||
_zz_addpos(fd, fp->__cnt + 1);
|
||||
_zz_setpos(fd, newpos - fp->FP_CNT - 1);
|
||||
_zz_fuzz(fd, fp->FP_PTR - 1, fp->FP_CNT + 1);
|
||||
ret = (uint8_t)fp->FP_PTR[-1];
|
||||
_zz_addpos(fd, fp->FP_CNT + 1);
|
||||
}
|
||||
|
||||
if(!_zz_islocked(fd))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user