From 7ef62aac45140e5326fc4272e5488843ed8441ac Mon Sep 17 00:00:00 2001 From: Peter Kjellerstedt Date: Sat, 12 May 2007 16:37:50 +0000 Subject: [PATCH] gst/rtsp/: Make channel guint8 where possible. Original commit message from CVS: Patch by: Peter Kjellerstedt * gst/rtsp/gstrtspsrc.h: * gst/rtsp/rtspconnection.c: (rtsp_connection_receive): * gst/rtsp/rtspmessage.c: (rtsp_message_init_data), (rtsp_message_get_header): * gst/rtsp/rtspmessage.h: Make channel guint8 where possible. Make rtsp_message_init_data() take the channel as a guint8. * gst/rtsp/rtspdefs.c: Fixed a typo: Timout -> Timeout * gst/rtsp/rtspdefs.h: Make RTSP_CHECK() behave as a statement. * gst/rtsp/sdpmessage.c: Avoid a compiler warning in INIT_ARRAY(). Fixes #437692. --- ChangeLog | 22 ++++++++++++++++++++++ gst/rtsp/gstrtspsrc.h | 2 +- gst/rtsp/rtspconnection.c | 2 +- gst/rtsp/rtspdefs.c | 2 +- gst/rtsp/rtspdefs.h | 5 ++++- gst/rtsp/rtspmessage.c | 4 ++-- gst/rtsp/rtspmessage.h | 4 ++-- gst/rtsp/sdpmessage.c | 2 +- 8 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ffe9359c5..31027bc61f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2007-05-12 Wim Taymans + + Patch by: Peter Kjellerstedt + + * gst/rtsp/gstrtspsrc.h: + * gst/rtsp/rtspconnection.c: (rtsp_connection_receive): + * gst/rtsp/rtspmessage.c: (rtsp_message_init_data), + (rtsp_message_get_header): + * gst/rtsp/rtspmessage.h: + Make channel guint8 where possible. + Make rtsp_message_init_data() take the channel as a guint8. + + * gst/rtsp/rtspdefs.c: + Fixed a typo: Timout -> Timeout + + * gst/rtsp/rtspdefs.h: + Make RTSP_CHECK() behave as a statement. + + * gst/rtsp/sdpmessage.c: + Avoid a compiler warning in INIT_ARRAY(). + Fixes #437692. + 2007-05-12 Wim Taymans Patch by: Peter Kjellerstedt diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index 1e6b623c56..3bada0663b 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -90,7 +90,7 @@ struct _GstRTSPStream { gboolean added; /* for interleaved mode */ - gint channel[2]; + guint8 channel[2]; GstCaps *caps; GstPad *channelpad[2]; diff --git a/gst/rtsp/rtspconnection.c b/gst/rtsp/rtspconnection.c index 038a4acaf3..d806b50ae7 100644 --- a/gst/rtsp/rtspconnection.c +++ b/gst/rtsp/rtspconnection.c @@ -767,7 +767,7 @@ rtsp_connection_receive (RTSPConnection * conn, RTSPMessage * msg, RTSP_CHECK (rtsp_connection_read (conn, &c, 1, timeout), read_error); /* now we create a data message */ - rtsp_message_init_data (msg, (gint) c); + rtsp_message_init_data (msg, c); /* next two bytes are the length of the data */ RTSP_CHECK (rtsp_connection_read (conn, (guint8 *) & size, 2, timeout), diff --git a/gst/rtsp/rtspdefs.c b/gst/rtsp/rtspdefs.c index 70cef7e702..2c3f7b73bf 100644 --- a/gst/rtsp/rtspdefs.c +++ b/gst/rtsp/rtspdefs.c @@ -66,7 +66,7 @@ static const gchar *rtsp_results[] = { "Received end-of-file", "Network error: %s", "Host is not a valid IP address", - "Timout while waiting for server response", + "Timeout while waiting for server response", "Unknown error (%d)", NULL }; diff --git a/gst/rtsp/rtspdefs.h b/gst/rtsp/rtspdefs.h index 13d2401c5e..8a2182db90 100644 --- a/gst/rtsp/rtspdefs.h +++ b/gst/rtsp/rtspdefs.h @@ -48,7 +48,10 @@ G_BEGIN_DECLS #define RTSP_CHECK(stmt, label) \ -if (G_UNLIKELY ((res = (stmt)) != RTSP_OK)) goto label +G_STMT_START { \ + if (G_UNLIKELY ((res = (stmt)) != RTSP_OK)) \ + goto label; \ +} G_STMT_END typedef enum { RTSP_OK = 0, diff --git a/gst/rtsp/rtspmessage.c b/gst/rtsp/rtspmessage.c index abd6d4db83..ed622c3375 100644 --- a/gst/rtsp/rtspmessage.c +++ b/gst/rtsp/rtspmessage.c @@ -167,7 +167,7 @@ rtsp_message_init_response (RTSPMessage * msg, RTSPStatusCode code, } RTSPResult -rtsp_message_init_data (RTSPMessage * msg, gint channel) +rtsp_message_init_data (RTSPMessage * msg, guint8 channel) { g_return_val_if_fail (msg != NULL, RTSP_EINVAL); @@ -255,7 +255,7 @@ rtsp_message_get_header (const RTSPMessage * msg, RTSPHeaderField field, g_return_val_if_fail (msg != NULL, RTSP_EINVAL); - if (msg->type != RTSP_MESSAGE_RESPONSE && msg->type != RTSP_MESSAGE_REQUEST) + if (msg->type == RTSP_MESSAGE_INVALID || msg->type == RTSP_MESSAGE_DATA) return RTSP_ENOTIMPL; val = g_hash_table_lookup (msg->hdr_fields, GINT_TO_POINTER (field)); diff --git a/gst/rtsp/rtspmessage.h b/gst/rtsp/rtspmessage.h index 2b91432da1..089676c13e 100644 --- a/gst/rtsp/rtspmessage.h +++ b/gst/rtsp/rtspmessage.h @@ -71,7 +71,7 @@ typedef struct _RTSPMessage gchar *reason; } response; struct { - gint channel; + guint8 channel; } data; } type_data; @@ -102,7 +102,7 @@ RTSPResult rtsp_message_init_response (RTSPMessage *msg, const RTSPMessage *request); RTSPResult rtsp_message_init_data (RTSPMessage *msg, - gint channel); + guint8 channel); RTSPResult rtsp_message_unset (RTSPMessage *msg); RTSPResult rtsp_message_free (RTSPMessage *msg); diff --git a/gst/rtsp/sdpmessage.c b/gst/rtsp/sdpmessage.c index 256a8ce2e9..2af52580a6 100644 --- a/gst/rtsp/sdpmessage.c +++ b/gst/rtsp/sdpmessage.c @@ -60,7 +60,7 @@ G_STMT_START { \ #define INIT_ARRAY(field,type,init_func) \ G_STMT_START { \ if (field) { \ - gint i; \ + guint i; \ for(i=0; ilen; i++) \ init_func (&g_array_index(field, type, i)); \ g_array_set_size (field,0); \