[gupnp-igd] Move pre-conditions to the synchronous functions
- From: Olivier Crête <Tester src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-igd] Move pre-conditions to the synchronous functions
- Date: Wed, 1 Oct 2014 03:46:08 +0000 (UTC)
commit e47f5a979764c17d59432f2b7b35a89798b1d2ed
Author: Olivier Crête <olivier crete collabora com>
Date: Tue Sep 30 23:10:33 2014 -0400
Move pre-conditions to the synchronous functions
libgupnp-igd/gupnp-simple-igd.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libgupnp-igd/gupnp-simple-igd.c b/libgupnp-igd/gupnp-simple-igd.c
index efc231a..775c4d3 100644
--- a/libgupnp-igd/gupnp-simple-igd.c
+++ b/libgupnp-igd/gupnp-simple-igd.c
@@ -923,6 +923,9 @@ gupnp_simple_igd_add_port (GUPnPSimpleIgd *self,
GUPnPSimpleIgdClass *klass = GUPNP_SIMPLE_IGD_GET_CLASS (self);
g_return_if_fail (klass->add_port);
+ g_return_if_fail (protocol && local_ip);
+ g_return_if_fail (local_port > 0);
+ g_return_if_fail (!strcmp (protocol, "UDP") || !strcmp (protocol, "TCP"));
klass->add_port (self, protocol, external_port, local_ip, local_port,
lease_duration, description);
@@ -936,8 +939,6 @@ gupnp_simple_igd_remove_port_real (GUPnPSimpleIgd *self,
struct Mapping *mapping = NULL;
guint i;
- g_return_if_fail (protocol);
-
for (i = 0; i < self->priv->mappings->len; i++)
{
struct Mapping *tmpmapping = g_ptr_array_index (self->priv->mappings, i);
@@ -976,6 +977,9 @@ gupnp_simple_igd_remove_port (GUPnPSimpleIgd *self,
{
GUPnPSimpleIgdClass *klass = GUPNP_SIMPLE_IGD_GET_CLASS (self);
+ g_return_if_fail (protocol);
+ g_return_if_fail (external_port <= 65535);
+
g_return_if_fail (klass->remove_port);
klass->remove_port (self, protocol, external_port);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]