[svn r165] code cleanup trunk
authorrenatofilho
Fri Dec 01 14:52:05 2006 +0000 (2006-12-01)
branchtrunk
changeset 16481e9da9ad7db
parent 163 ef3b08cbf4b2
child 165 9726f9ebd4cb
[svn r165] code cleanup
libgnomevfs2-mythtv/modules/mythtv-method.c
     1.1 --- a/libgnomevfs2-mythtv/modules/mythtv-method.c	Fri Dec 01 14:30:28 2006 +0000
     1.2 +++ b/libgnomevfs2-mythtv/modules/mythtv-method.c	Fri Dec 01 14:52:05 2006 +0000
     1.3 @@ -69,8 +69,6 @@
     1.4      _GNOME_VFS_METHOD_PARAM_CHECK (method_handle != NULL);
     1.5      _GNOME_VFS_METHOD_PARAM_CHECK (uri != NULL);
     1.6  
     1.7 -    //g_debug ("[%s] Calling do_open function", __FUNCTION__);
     1.8 -	    
     1.9      myth_handle = g_new0 (MythtvHandle, 1);
    1.10  
    1.11      if (mode & GNOME_VFS_OPEN_WRITE) {
    1.12 @@ -89,9 +87,9 @@
    1.13  
    1.14      /* Creates and fills out the backend info structure */
    1.15      backend_info = gmyth_backend_info_new_full (
    1.16 -	gnome_vfs_uri_get_host_name (uri),
    1.17 -	NULL, NULL, NULL,
    1.18 -	gnome_vfs_uri_get_host_port (uri));
    1.19 +        gnome_vfs_uri_get_host_name (uri),
    1.20 +	    NULL, NULL, NULL,
    1.21 +	    gnome_vfs_uri_get_host_port (uri));
    1.22  
    1.23      /* Connect to the backend */
    1.24      myth_handle->file_transfer = gmyth_file_transfer_new (backend_info);
    1.25 @@ -101,7 +99,7 @@
    1.26      /* sets the Playback monitor connection */
    1.27      ret = gmyth_file_transfer_open (myth_handle->file_transfer, gnome_vfs_uri_get_path (uri));
    1.28      if (ret == FALSE) {
    1.29 -        g_printerr ("Mythtv FileTransfer open error\n");
    1.30 +        g_warning ("Mythtv FileTransfer open error\n");
    1.31          return GNOME_VFS_ERROR_NOT_OPEN;
    1.32      }
    1.33  
    1.34 @@ -128,13 +126,8 @@
    1.35      MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
    1.36      GnomeVFSFileSize bytes_to_read;
    1.37  
    1.38 -    //g_debug ("do_read(): file size: %llu, already read: %llu, requested: %llu, buffer_remain: %du", 
    1.39 -	//	    myth_handle->content_size, myth_handle->bytes_read, num_bytes, 
    1.40 -	//			myth_handle->buffer_remain);
    1.41 -
    1.42      *bytes_read = 0;
    1.43  
    1.44 -    printf ("XXXXXXXXXXXXXXXXXXXX bytes_read: %d, content_size: %d\n", (int)myth_handle->bytes_read, (int)myth_handle->content_size);
    1.45      if (myth_handle->bytes_read >= myth_handle->content_size)
    1.46          return GNOME_VFS_ERROR_EOF;
    1.47  
    1.48 @@ -155,6 +148,7 @@
    1.49  
    1.50  		if (len < 0) {
    1.51              g_byte_array_free (tmp_buffer, TRUE);
    1.52 +            g_warning ("Fail to read bytes");
    1.53  		    return GNOME_VFS_ERROR_IO;
    1.54          }
    1.55  
    1.56 @@ -163,16 +157,11 @@
    1.57  
    1.58  		myth_handle->buffer_remain += len;
    1.59  
    1.60 -		//g_debug ( "Reading %d data from backend", MYTHTV_BUFFER_SIZE - myth_handle->buffer_remain );
    1.61 -	
    1.62 -        g_byte_array_free (tmp_buffer, TRUE);
    1.63      	tmp_buffer = NULL;    	
    1.64      }
    1.65      
    1.66      bytes_to_read = (bytes_to_read > myth_handle->buffer_remain) ? myth_handle->buffer_remain : bytes_to_read;
    1.67 -
    1.68 -    //g_debug ("Returning %du bytes to gnomevfs", (gint) bytes_to_read);
    1.69 -	  /* gets the first buffer_size bytes from the byte array buffer variable */ 
    1.70 +    /* gets the first buffer_size bytes from the byte array buffer variable */ 
    1.71  
    1.72      g_memmove (buffer, myth_handle->buffer->data, bytes_to_read);
    1.73  
    1.74 @@ -195,14 +184,14 @@
    1.75      MythtvHandle *myth_handle = (MythtvHandle *) method_handle;
    1.76  
    1.77      if (myth_handle->file_transfer) {
    1.78 -	gmyth_file_transfer_close (myth_handle->file_transfer);
    1.79 +	    gmyth_file_transfer_close (myth_handle->file_transfer);
    1.80          g_object_unref (myth_handle->file_transfer);
    1.81 -	myth_handle->file_transfer = NULL;
    1.82 +    	myth_handle->file_transfer = NULL;
    1.83      }
    1.84      
    1.85      if (myth_handle->buffer) {
    1.86 -			g_byte_array_free (myth_handle->buffer, TRUE);
    1.87 -			myth_handle->buffer = NULL;
    1.88 +		g_byte_array_free (myth_handle->buffer, TRUE);
    1.89 +		myth_handle->buffer = NULL;
    1.90      }
    1.91  
    1.92      g_free (myth_handle);