diff -r 106adb6883dc -r 9726f9ebd4cb libgnomevfs2-mythtv/modules/mythtv-method.c --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Thu Nov 30 21:31:34 2006 +0000 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Fri Dec 01 15:48:55 2006 +0000 @@ -69,8 +69,6 @@ _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL); _GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL); - //g_debug ("[%s] Calling do_open function", __FUNCTION__); - myth_handle = g_new0 (MythtvHandle, 1); if (mode & GNOME_VFS_OPEN_WRITE) { @@ -89,9 +87,9 @@ /* Creates and fills out the backend info structure */ backend_info = gmyth_backend_info_new_full ( - gnome_vfs_uri_get_host_name (uri), - NULL, NULL, NULL, - gnome_vfs_uri_get_host_port (uri)); + gnome_vfs_uri_get_host_name (uri), + NULL, NULL, NULL, + gnome_vfs_uri_get_host_port (uri)); /* Connect to the backend */ myth_handle->file_transfer = gmyth_file_transfer_new (backend_info); @@ -101,7 +99,7 @@ /* sets the Playback monitor connection */ ret = gmyth_file_transfer_open (myth_handle->file_transfer, gnome_vfs_uri_get_path (uri)); if (ret == FALSE) { - g_printerr ("Mythtv FileTransfer open error\n"); + g_warning ("Mythtv FileTransfer open error\n"); return GNOME_VFS_ERROR_NOT_OPEN; } @@ -128,13 +126,8 @@ MythtvHandle *myth_handle = (MythtvHandle *) method_handle; GnomeVFSFileSize bytes_to_read; - //g_debug ("do_read(): file size: %llu, already read: %llu, requested: %llu, buffer_remain: %du", - // myth_handle->content_size, myth_handle->bytes_read, num_bytes, - // myth_handle->buffer_remain); - *bytes_read = 0; - printf ("XXXXXXXXXXXXXXXXXXXX bytes_read: %d, content_size: %d\n", (int)myth_handle->bytes_read, (int)myth_handle->content_size); if (myth_handle->bytes_read >= myth_handle->content_size) return GNOME_VFS_ERROR_EOF; @@ -155,6 +148,7 @@ if (len < 0) { g_byte_array_free (tmp_buffer, TRUE); + g_warning ("Fail to read bytes"); return GNOME_VFS_ERROR_IO; } @@ -163,16 +157,11 @@ myth_handle->buffer_remain += len; - //g_debug ( "Reading %d data from backend", MYTHTV_BUFFER_SIZE - myth_handle->buffer_remain ); - - g_byte_array_free (tmp_buffer, TRUE); tmp_buffer = NULL; } bytes_to_read = (bytes_to_read > myth_handle->buffer_remain) ? myth_handle->buffer_remain : bytes_to_read; - - //g_debug ("Returning %du bytes to gnomevfs", (gint) bytes_to_read); - /* gets the first buffer_size bytes from the byte array buffer variable */ + /* gets the first buffer_size bytes from the byte array buffer variable */ g_memmove (buffer, myth_handle->buffer->data, bytes_to_read); @@ -195,14 +184,14 @@ MythtvHandle *myth_handle = (MythtvHandle *) method_handle; if (myth_handle->file_transfer) { - gmyth_file_transfer_close (myth_handle->file_transfer); + gmyth_file_transfer_close (myth_handle->file_transfer); g_object_unref (myth_handle->file_transfer); - myth_handle->file_transfer = NULL; + myth_handle->file_transfer = NULL; } if (myth_handle->buffer) { - g_byte_array_free (myth_handle->buffer, TRUE); - myth_handle->buffer = NULL; + g_byte_array_free (myth_handle->buffer, TRUE); + myth_handle->buffer = NULL; } g_free (myth_handle);