bonobo-stream-vfs.c



So, I've been going through the bonobo-stream-vfs.c files in both bonobo
and nautilus, trying to discern differences. They are almost exactly the
same, with these few exceptions:

The bonobo one has an object called BonoboStreamVfs which looks like:

struct _BonoboStreamVfs {
        BonoboStream    stream;
        GnomeVFSHandle *handle;

        BonoboStreamVfsPrivate *priv;
};

As far as I can tell, there isn't a BonoboStreamVfsPrivate.

In the nautilus one, there is one called BonobStreamVFS, which looks like
this:

struct BonoboStreamVFS {
        BonoboStream stream;

        BonoboStreamVFSDetails *details;
};

And BonoboStreamVFSDetails (which is private) looks like this:

struct BonoboStreamVFSDetails {
        GnomeVFSHandle *handle;
};

... so the accessing of the handles is slightly different through the
implementations.

Anyway, onward:

vfs_{get|set}_info: The Nautilus one raises an ex_Bonobo_Stream_IOError
exception as opposed to a ex_Bonobo_Stream_NoPermission one in the bonobo
one.

vfs_{write|read}: In the bonobo one, there is a do-while loop that depends
on (bytes_written < 1 && result == GNOME_VFS_ERROR_INTERRUPTED)
(s/written/read/ in vfs_read). This isn't in the Nautilus one.

vfs_seek: In the bonobo seek, if result != GNOME_VFS_OK, it raises an
IOError exception and returns -1. The Nautilus one doesn't do this and
simply returns -1.

vfs_truncate: In the bonobo one, if result != GNOME_VFS_OK, it raises a 
NoPermission in truncate. The Nautilus one doesn't.

vfs_copy_to: The bonobo one sets a NoPermission exception if 
res != GNOME_VFS_OK in creating a handle. The nautilus one has a FIXME for
it.

vfs_copy_to: The bonobo one sets an IOError exception if !GNOME_VFS_OK at
any point in the actual copy do-while loop. The nautilus one doesn't at
all (but there are FIXMEs).

So, there are basically zero functional differences between the versions,
except that the bonobo one seems to be a little better at throwing
exceptions, but even then it doesn't do a very good job of checking what
the actual error is (just that there is one) and just throws an exception
that it thinks is right. Maybe right now we don't give different error
messages for an IO Error as opposed to a permission denied, but they are
rather significantly different errors and should be distinguished at some
point, so it's important that the right one be thrown. However, there are
a lot more FIXMEs in various places in the Nautilus one and they have
bugzilla.eazel.com bug numbers in them, which is handy and it seems to
have a little better in-code comments. Certain parts are functionally
equivalent but easier to read in the Nautilus one, too.

I'm a little confused about the do-while in vfs_read and vfs_write, but
that may be due to my ignorance about gnome-vfs. If result ==
GNOME_VFS_ERROR_INTERRUPTED, does that mean that none of the data was read
from/written to the handle? And, should we keep retrying the read/write
until it gets something other than an interrupted result?

Anyway, I think it'd be a good idea to merge the differences, close a few
of the Eazel bugzilla bugs that are applicable, improve error handling and
exception throwing and remove the files from Nautilus. I'll volunteer to
do this if others think it's a good idea.

Joe





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