libgnomevfs2-mythtv/tests/main.c
branchtrunk
changeset 753 8ee634511c1e
parent 645 17877d6e44e2
child 754 cb885ee44618
     1.1 --- a/libgnomevfs2-mythtv/tests/main.c	Fri May 11 15:03:21 2007 +0100
     1.2 +++ b/libgnomevfs2-mythtv/tests/main.c	Thu Jun 14 18:22:32 2007 +0100
     1.3 @@ -3,48 +3,49 @@
     1.4  #include <libgnomevfs/gnome-vfs.h>
     1.5  #include <glib.h>
     1.6  
     1.7 -static void 
     1.8 -assert_message (gboolean valid, const gchar* message)
     1.9 +static void
    1.10 +assert_message(gboolean valid, const gchar * message)
    1.11  {
    1.12 -    if (!valid) {
    1.13 -        g_warning (message);            
    1.14 -        exit (1);
    1.15 -    }
    1.16 +  if (!valid)
    1.17 +	{
    1.18 +	  g_warning(message);
    1.19 +	  exit(1);
    1.20 +	}
    1.21  }
    1.22 -        
    1.23 -int main (int argc, char** argv)
    1.24 +
    1.25 +int
    1.26 +main(int argc, char **argv)
    1.27  {
    1.28 -        GnomeVFSResult result;
    1.29 -        GnomeVFSFileSize read;
    1.30 -        gchar buff[512];
    1.31 -        GnomeVFSHandle *handle = NULL;
    1.32 -        
    1.33 -       
    1.34 -        g_assert (argc == 2);
    1.35 -        
    1.36 -        gnome_vfs_init ();
    1.37 +  GnomeVFSResult result;
    1.38 +  GnomeVFSFileSize read;
    1.39 +  gchar buff[512];
    1.40 +  GnomeVFSHandle *handle = NULL;
    1.41  
    1.42 -        g_debug ("Oppening: %s", argv[1]);
    1.43  
    1.44 -        result = gnome_vfs_open (&handle, argv[1], GNOME_VFS_OPEN_READ);
    1.45 -        assert_message (result == GNOME_VFS_OK, 
    1.46 -                        gnome_vfs_result_to_string (result));
    1.47 +  g_assert(argc == 2);
    1.48  
    1.49 -		g_debug ("handle %p", handle);
    1.50 +  gnome_vfs_init();
    1.51  
    1.52 -        while (result == GNOME_VFS_OK) {
    1.53 -            memset (buff, '\0', sizeof (buff));
    1.54 -            result = gnome_vfs_read (handle, buff, sizeof (buff), &read);
    1.55 -			g_debug ("read %"G_GINT64_FORMAT, read);
    1.56 -        }
    1.57 +  g_debug("Oppening: %s", argv[1]);
    1.58  
    1.59 -        assert_message (result == GNOME_VFS_ERROR_EOF, 
    1.60 -                        gnome_vfs_result_to_string (result));
    1.61 +  result = gnome_vfs_open(&handle, argv[1], GNOME_VFS_OPEN_READ);
    1.62 +  assert_message(result == GNOME_VFS_OK, gnome_vfs_result_to_string(result));
    1.63  
    1.64 -        result = gnome_vfs_close (handle);
    1.65 -        assert_message (result == GNOME_VFS_OK, 
    1.66 -                        gnome_vfs_result_to_string (result));
    1.67 +  g_debug("handle %p", handle);
    1.68  
    1.69 -        g_debug ("OK");
    1.70 -        return 0;
    1.71 +  while (result == GNOME_VFS_OK)
    1.72 +	{
    1.73 +	  memset(buff, '\0', sizeof(buff));
    1.74 +	  result = gnome_vfs_read(handle, buff, sizeof(buff), &read);
    1.75 +	  g_debug("read %" G_GINT64_FORMAT, read);
    1.76 +	}
    1.77 +
    1.78 +  assert_message(result == GNOME_VFS_ERROR_EOF,
    1.79 +				 gnome_vfs_result_to_string(result));
    1.80 +
    1.81 +  result = gnome_vfs_close(handle);
    1.82 +  assert_message(result == GNOME_VFS_OK, gnome_vfs_result_to_string(result));
    1.83 +
    1.84 +  g_debug("OK");
    1.85 +  return 0;
    1.86  }