|
|||||||||||
|
library/3236: type of funopen()
From: Kamo Hiroyasu <wd(at)ics.nara-wu.ac.jp>
Date: Fri Apr 25 2003 - 05:30:48 EDT
System : OpenBSD 3.2 Architecture: OpenBSD.sparc Machine : sparc >Description: The definition, the declaration, and the document disagree on the type of funopen(). In /usr/src/lib/libc/stdio/funopen.c :
FILE *
funopen(cookie, readfn, writefn, seekfn, closefn)
const void *cookie;
int (*readfn)(), (*writefn)();
fpos_t (*seekfn)(void *cookie, fpos_t off, int whence);
int (*closefn)();
{
In /usr/include/stdio.h :
FILE *funopen(const void *,
int (*)(void *, char *, int),
int (*)(void *, const char *, int),
fpos_t (*)(void *, fpos_t, int),
int (*)(void *));
In the manpage funopen(3):
FILE *
funopen(void *cookie, int (*readfn)(void *, char *, int),
int (*writefn)(void *, const char *, int),
fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *));
>How-To-Repeat:
>Fix:
The current implementation discards `const'. So I choose the documentation.
FILE *
- const void *cookie;
- int (*readfn)(), (*writefn)();
+ void *cookie;
+ int (*readfn)(void *cookie, void *buf, size_t nbytes);
+ int (*writefn)(void *cookie, const void *buf, size_t nbytes);
fpos_t (*seekfn)(void *cookie, fpos_t off, int whence);
- int (*closefn)();
+ int (*closefn)(void *cookie);
{
register FILE *fp;
int flags;
@@ -68,7 +69,7 @@
return (NULL);
fp->_flags = flags;
fp->_file = -1;
- fp->_cookie = (void *)cookie;
+ fp->_cookie = cookie;
fp->_read = readfn;
fp->_write = writefn;
fp->_seek = seekfn;
>Release-Note:
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:55 EDT |
||||||||||
|
|||||||||||