[gupnp-dlna/wip/new-api: 22/46] Add some parameter checks in profile guesser.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-dlna/wip/new-api: 22/46] Add some parameter checks in profile guesser.
- Date: Mon, 14 Jan 2013 10:06:25 +0000 (UTC)
commit 0fa95cd7365dd9664c05f549094b8da9c1799ff4
Author: Krzesimir Nowak <krnowak openismus com>
Date: Wed Jan 2 13:00:30 2013 +0100
Add some parameter checks in profile guesser.
libgupnp-dlna/gupnp-dlna-profile-guesser.c | 51 +++++++++++++++++----------
1 files changed, 32 insertions(+), 19 deletions(-)
---
diff --git a/libgupnp-dlna/gupnp-dlna-profile-guesser.c b/libgupnp-dlna/gupnp-dlna-profile-guesser.c
index bb55b2b..495e9cc 100644
--- a/libgupnp-dlna/gupnp-dlna-profile-guesser.c
+++ b/libgupnp-dlna/gupnp-dlna-profile-guesser.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Nokia Corporation.
- * Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2012, 2013 Intel Corporation.
*
* Authors: Arun Raghavan <arun raghavan collabora co uk>
* Krzesimir Nowak <krnowak openismus com>
@@ -299,16 +299,21 @@ gupnp_dlna_profile_guesser_guess_profile_async
guint timeout_in_ms,
GError **error)
{
- GUPnPDLNAMetadataExtractor *extractor =
- gupnp_dlna_metadata_backend_get_extractor ();
+ GUPnPDLNAMetadataExtractor *extractor;
gboolean queued;
- GError *extractor_error = NULL;
- guint id =
- g_signal_connect_swapped (extractor,
- "done",
- G_CALLBACK (gupnp_dlna_discovered_cb),
- guesser);
+ GError *extractor_error;
+ guint id;
+ g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), FALSE);
+ g_return_val_if_fail (uri != NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ extractor = gupnp_dlna_metadata_backend_get_extractor ();
+ extractor_error = NULL;
+ id = g_signal_connect_swapped (extractor,
+ "done",
+ G_CALLBACK (gupnp_dlna_discovered_cb),
+ guesser);
queued = gupnp_dlna_metadata_extractor_extract_async (extractor,
uri,
timeout_in_ms,
@@ -342,15 +347,22 @@ gupnp_dlna_profile_guesser_guess_profile_sync
guint timeout_in_ms,
GError **error)
{
- GError *extraction_error = NULL;
- GUPnPDLNAMetadataExtractor *extractor =
- gupnp_dlna_metadata_backend_get_extractor ();
- GUPnPDLNAInformation *info =
- gupnp_dlna_metadata_extractor_extract_sync (extractor,
- uri,
- timeout_in_ms,
- &extraction_error);
- GUPnPDLNAProfile *profile = NULL;
+ GError *extraction_error;
+ GUPnPDLNAMetadataExtractor *extractor;
+ GUPnPDLNAInformation *info;
+ GUPnPDLNAProfile *profile;
+
+ g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), NULL);
+ g_return_val_if_fail (uri != NULL, NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ extraction_error = NULL;
+ extractor = gupnp_dlna_metadata_backend_get_extractor ();
+ info = gupnp_dlna_metadata_extractor_extract_sync (extractor,
+ uri,
+ timeout_in_ms,
+ &extraction_error);
+ profile = NULL;
if (extraction_error)
g_propagate_error (error,
@@ -385,6 +397,7 @@ gupnp_dlna_profile_guesser_get_profile (GUPnPDLNAProfileGuesser *guesser,
GUPnPDLNAProfileGuesserPrivate *priv;
g_return_val_if_fail (GUPNP_IS_DLNA_PROFILE_GUESSER (guesser), NULL);
+ g_return_val_if_fail (name != NULL, NULL);
priv = guesser->priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]