Re: [sandbox PATCH 01/10] Add an utility function for guessing filetype from file extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 26, 2015 at 03:27:36PM +0200, Eren Yagdiran wrote:
> Consider the file name extension as the image type, except for .img that are usually RAW images

NB, try to line wrap commit messages at less than 80 chracters

> diff --git a/libvirt-sandbox/libvirt-sandbox-util.c b/libvirt-sandbox/libvirt-sandbox-util.c
> new file mode 100644
> index 0000000..079ecd6
> --- /dev/null
> +++ b/libvirt-sandbox/libvirt-sandbox-util.c

> +gint gvir_sandbox_util_guess_image_format(const gchar *path,
> +                                          GError **error)
> +{
> +    gchar *tmp;
> +
> +    if ((tmp = strchr(path, '.')) == NULL) {
> +        return -1;

Missing a g_set_error() call here.

> +    }
> +    tmp = tmp + 1;
> +
> +    if (g_str_equal(tmp,"img")==TRUE){

Comparing == TRUE is not really needed, nor at the {} braces

> +       return GVIR_CONFIG_DOMAIN_DISK_FORMAT_RAW;
> +    }
> +
> +    return gvir_sandbox_util_disk_format_from_str(tmp, error);
> +}

ACK, I'll fix these mistakes myself before pushing

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]