# HG changeset patch # User renatofilho # Date 1164984725 0 # Node ID 81e9da9ad7db8a0bd219fcbaca6f1511ee059fa0 # Parent ef3b08cbf4b2d215f5750183015c673b24472314 [svn r165] code cleanup diff -r ef3b08cbf4b2 -r 81e9da9ad7db libgnomevfs2-mythtv/modules/mythtv-method.c --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Fri Dec 01 14:30:28 2006 +0000 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Fri Dec 01 14:52:05 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);