Re: A GnomeVFS API for accessing standard streams

On 29 Nov 2002, Giovanni Corriga wrote:

> Ok, I have modified the code taking into account what Alex said.
> I've attached the new code to bug #99796:

+/* Convert a file descriptor to a handle */
+GnomeVFSResult	gnome_vfs_open_fd	(GnomeVFSHandle	**handle,
+					 gint filedes,
+					 GnomeVFSOpenMode open_mode);

Drop the open_mode part. It should be extracted from the fd using 
fcntl(fd, F_GETFL, &args).

#ifdef HAVE_LSEEK64
#define LSEEK lseek64
#define OFF_T off64_t
#define LSEEK lseek
#define OFF_T off_t

That should not be necesary, since gnome-vfs builds with 
_FILE_OFFSET_BITS=64. Just use lseek and off_t.

Things like:
		close_retval = close (file_handle->fd);
	while (close_retval != 0
	       && errno == EINTR
	       && ! gnome_vfs_context_check_cancellation (context));

Should use braces:
do {
} while (...);

In do_get_file_info_from_handle():

	file_info->mime_type = g_strdup ("x-special/device-char");
	file_info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE;

That's wrong in general for any random filedescriptor, and the 
indentation is wrong.


file_handle = file_handle_new(uri, filedes);
*handle = gnome_vfs_handle_new(uri, (GnomeVFSMethodHandle*)file_handle, open_mode);

Need space before the parenthesis.

Otherwise this looks good to me, and I'd really like it to go in so we can 
remove the console method.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a shy misogynist paranormal investigator who hangs with the wrong crowd. 
She's a provocative streetsmart stripper with a song in her heart and a spring 
in her step. They fight crime! 

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