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

Re: [virt-tools-list] [libosinfo] Don't entertain empty ID headers from ISOs



On Thu, Nov 24, 2011 at 06:00:55PM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak gnome org>
> 
> ---
>  osinfo/osinfo_media.c |   20 +++++++++++++++++---
>  1 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
> index cf065f0..8c51a0d 100644
> --- a/osinfo/osinfo_media.c
> +++ b/osinfo/osinfo_media.c
> @@ -517,6 +517,20 @@ OsinfoMedia *osinfo_media_create_from_location(const gchar *location,
>      return ret;
>  }
>  
> +static gboolean is_str_empty(const gchar *str) {
> +    guint8 i;
> +    gboolean ret = TRUE;
> +
> +    for (i = 0; i < strlen (str); i++)
> +        if (!g_ascii_isspace (str[i])) {
> +           ret = FALSE;
> +
> +           break;
> +        }
> +
> +    return ret;
> +}
> +
>  static void on_svd_read (GObject *source,
>                           GAsyncResult *res,
>                           gpointer user_data)
> @@ -564,15 +578,15 @@ static void on_svd_read (GObject *source,
>                              OSINFO_MEDIA_PROP_URL,
>                              uri);
>      g_free(uri);
> -    if (data->pvd.volume[0] != 0)
> +    if (data->pvd.volume[0] != 0 && !is_str_empty (data->pvd.volume))
>          osinfo_entity_set_param(OSINFO_ENTITY(ret),
>                                  OSINFO_MEDIA_PROP_VOLUME_ID,
>                                  data->pvd.volume);
> -    if (data->pvd.system[0] != 0)
> +    if (data->pvd.system[0] != 0 && !is_str_empty (data->pvd.system))
>          osinfo_entity_set_param(OSINFO_ENTITY(ret),
>                                  OSINFO_MEDIA_PROP_SYSTEM_ID,
>                                  data->pvd.system);
> -    if (data->pvd.publisher[0] != 0)
> +    if (data->pvd.publisher[0] != 0 && !is_str_empty (data->pvd.publisher))
>          osinfo_entity_set_param(OSINFO_ENTITY(ret),
>                                  OSINFO_MEDIA_PROP_PUBLISHER_ID,
>                                  data->pvd.publisher);

ACK


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 :|


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