Re: A GnomeVFS API for accessing standard streams

Il gio, 2002-11-28 alle 14:51, Alexander Larsson ha scritto:
> On 28 Nov 2002, Giovanni Corriga wrote:
> > Il gio, 2002-11-28 alle 09:09, Alexander Larsson ha scritto:
> > > On 27 Nov 2002, Giovanni Corriga wrote:
> > > 
> > > I'm not the maintainer, but that API is not very good. It exports three 
> > > functions that all do the same thing, in differently limited ways.
> > > 
> > > What you really want is:
> > > GnomeVFSHandle* gnome_vfs_fdopen (int fd);
> > > 
> > I know... in fact, the three functions are just wrappers around a
> > _get_stream (GnomeVFSHandle**, GnomeVFSConsoleStreamType) functions.
> > 
> > I have opened a bug in bugzilla; I'm attaching the code there. You may
> > find it at 
> > 
> >
> I'd much prefer if you dropped all references to consoles and made it 
> GnomeVFSResult gnome_vfs_open_fd (GnomeVFSHandle** handle, int fd)
Ok, I can do it. Should I add that function to the gnome-vfs-utils.h

> Also, you probably want to implement seek,tell and truncate too.

I don't think so. The seek, tell and truncate functions don't work with
the standard streams file descriptors.

> Plus you're not following standard gnome-vfs coding standards. (Usage of 
> '{' and '}' at least.)

Ok, I will fix it.

> One potential issue is that you might want to free the handle and still 
> not close the fd, which is not possible with this API. OTOH this api 
> mirrors what fdopen() does, and if you really want to do that you can 
> dup(fd) before calling gnome_vfs_open_fd().

Right now, _get_stream() duplicates the fd and stores the dup in the
handle. Should  gnome_vfs_open_fd() keep this behavior, or should it
assume the caller has already dup()'ed the fd?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]