diff -r f310d1d086b5 -r 12308ae2d907 libgnomevfs2-mythtv/modules/mythtv-method.c --- a/libgnomevfs2-mythtv/modules/mythtv-method.c Fri Mar 23 14:34:50 2007 +0000 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c Mon Mar 26 20:19:42 2007 +0100 @@ -90,6 +90,8 @@ GMythBackendInfo *backend_info = NULL; GMythURI *gmyth_uri = NULL; gboolean ret = TRUE; + gchar *tmp_str1; + gchar *tmp_str2; _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL); _GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL); @@ -104,33 +106,35 @@ // FIXME: myth_handle is always NULL here if ((NULL == myth_handle) || !myth_handle->configured) { - myth_handle = g_new0 (MythtvHandle, 1); - - myth_handle->configured = FALSE; - - myth_handle->is_livetv = FALSE; + myth_handle = g_new0 (MythtvHandle, 1); + + myth_handle->configured = FALSE; + myth_handle->is_livetv = FALSE; /* Initialize mythtv handler */ - myth_handle->file_transfer = NULL; - myth_handle->livetv = NULL; - myth_handle->mythtv_version = MYTHTV_VERSION_DEFAULT; - myth_handle->bytes_read = 0; - myth_handle->content_size = (GnomeVFSFileSize) - 1; + myth_handle->file_transfer = NULL; + myth_handle->livetv = NULL; + myth_handle->mythtv_version = MYTHTV_VERSION_DEFAULT; + myth_handle->bytes_read = 0; + myth_handle->content_size = (GnomeVFSFileSize) - 1; + + /* Creates and fills out the backend info structure */ + tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); + tmp_str2 = gnome_vfs_unescape_string (tmp_str1, ""); - /* Creates and fills out the backend info structure */ - backend_info = - gmyth_backend_info_new_with_uri - (gnome_vfs_unescape_string - (gnome_vfs_uri_to_string - (uri, GNOME_VFS_URI_HIDE_NONE), "")); + backend_info = gmyth_backend_info_new_with_uri (tmp_str2); + g_free (tmp_str1); + g_free (tmp_str2); + /* creates an instance of */ - gmyth_uri = - gmyth_uri_new_with_value (gnome_vfs_unescape_string - (gnome_vfs_uri_to_string - (uri, - GNOME_VFS_URI_HIDE_NONE), - "")); + tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); + tmp_str2 = gnome_vfs_unescape_string (tmp_str1, ""); + + gmyth_uri = gmyth_uri_new_with_value (tmp_str2); + + g_free (tmp_str1); + g_free (tmp_str2); myth_handle->is_livetv = gmyth_uri_is_livetv (gmyth_uri); @@ -167,24 +171,16 @@ if (NULL == myth_handle->file_transfer) { ret = FALSE; - g_debug - ("MythTV FileTransfer is NULL!\n"); + g_debug ("MythTV FileTransfer is NULL!\n"); return GNOME_VFS_ERROR_NOT_OPEN; } - if (!gmyth_file_transfer_open - (myth_handle->file_transfer, - myth_handle->livetv->uri != - NULL ? - gmyth_uri_get_path (myth_handle-> - livetv-> - uri) : - myth_handle->livetv->proginfo-> - pathname->str)) { - g_debug - ("Couldn't open MythTV FileTransfer is NULL!\n"); - g_object_unref (myth_handle-> - file_transfer); + if (!gmyth_file_transfer_open (myth_handle->file_transfer, + myth_handle->livetv->uri != NULL ? + gmyth_uri_get_path (myth_handle->livetv->uri) : + myth_handle->livetv->proginfo->pathname->str)) { + g_debug ("Couldn't open MythTV FileTransfer is NULL!\n"); + g_object_unref (myth_handle->file_transfer); myth_handle->file_transfer = NULL; ret = FALSE; } @@ -196,20 +192,15 @@ gmyth_file_transfer_new (backend_info); /* Verifies if the file exists */ - if (!gmyth_util_file_exists - (backend_info, - gmyth_uri_get_path (gmyth_uri))) { + if (!gmyth_util_file_exists (backend_info, + gmyth_uri_get_path (gmyth_uri))) { g_object_unref (backend_info); ret = FALSE; } /* sets the Playback monitor connection */ - ret = - gmyth_file_transfer_open (myth_handle-> - file_transfer, - gmyth_uri_get_path - (gmyth_uri)); - + ret = gmyth_file_transfer_open (myth_handle->file_transfer, + gmyth_uri_get_path (gmyth_uri)); } } /* if - LiveTV or not? */ @@ -283,12 +274,9 @@ while (MYTHTV_BUFFER_SIZE != myth_handle->buffer_remain) { /* resize buffer length request to no more than MYTHTV_MAX_REQUEST_SIZE */ - if ((MYTHTV_BUFFER_SIZE - - myth_handle->buffer_remain) <= - MYTHTV_MAX_REQUEST_SIZE) - buffer_size = - MYTHTV_BUFFER_SIZE - - myth_handle->buffer_remain; + if ((MYTHTV_BUFFER_SIZE - myth_handle->buffer_remain) <= + MYTHTV_MAX_REQUEST_SIZE) + buffer_size = MYTHTV_BUFFER_SIZE - myth_handle->buffer_remain; else buffer_size = MYTHTV_MAX_REQUEST_SIZE; @@ -297,11 +285,9 @@ g_debug ("Asking %d bytes (there is %d bytes in the buffer)\n", buffer_size, myth_handle->buffer_remain); - gint len = - gmyth_file_transfer_read (myth_handle-> - file_transfer, - tmp_buffer, - buffer_size, TRUE); + gint len = gmyth_file_transfer_read (myth_handle->file_transfer, + tmp_buffer, + buffer_size, TRUE); if ( !myth_handle->is_livetv ) { if ( len < 0 ) { @@ -330,10 +316,8 @@ } /* if - got from the network, or not */ - bytes_to_read = - (bytes_to_read > - myth_handle->buffer_remain) ? myth_handle-> - buffer_remain : bytes_to_read; + bytes_to_read = (bytes_to_read > myth_handle->buffer_remain) ? + myth_handle->buffer_remain : bytes_to_read; /* gets the first buffer_size bytes from the byte array buffer variable */ g_memmove (buffer, myth_handle->buffer->data, bytes_to_read); @@ -406,23 +390,27 @@ GMythURI *gmyth_uri = NULL; GMythSocket *socket = NULL; gboolean is_livetv = FALSE; + gchar *tmp_str1; + gchar *tmp_str2; + gboolean ret = TRUE; gboolean res = TRUE; - /* Creates and fills out the backend info structure */ - backend_info = - gmyth_backend_info_new_with_uri (gnome_vfs_unescape_string - (gnome_vfs_uri_to_string - (uri, - GNOME_VFS_URI_HIDE_NONE), - "")); + /* Creates and fills out the backend info structure */ + tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); + tmp_str2 = gnome_vfs_unescape_string (tmp_str1, ""); + + backend_info = gmyth_backend_info_new_with_uri (tmp_str2); + g_free (tmp_str1); + g_free (tmp_str2); /* creates an instance of */ - gmyth_uri = - gmyth_uri_new_with_value (gnome_vfs_unescape_string - (gnome_vfs_uri_to_string - (uri, GNOME_VFS_URI_HIDE_NONE), - "")); + tmp_str1 = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); + tmp_str2 = gnome_vfs_unescape_string (tmp_str1, ""); + + gmyth_uri = gmyth_uri_new_with_value (tmp_str2); + g_free (tmp_str1); + g_free (tmp_str2); is_livetv = gmyth_uri_is_livetv (gmyth_uri);