Re: A GnomeVFS API for accessing standard streams

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)

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

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

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().

With this in we can drop the horrible console-method.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a suicidal one-eyed cowboy fleeing from a secret government programme. 
She's a provocative cat-loving soap star from a different time and place. They 
fight crime! 

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