diff --git a/ChangeLog b/ChangeLog index 3d38b5be70..e8227f2c34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-06-02 Thomas Vander Stichele + + * ext/alsa/gstalsasrc.c: (gst_alsa_src_get_time): + avoid a segfault + * gst/tcp/gsttcp.c: (gst_tcp_socket_write), (gst_tcp_socket_read), + (gst_tcp_gdp_read_header), (gst_tcp_gdp_read_caps): + * gst/tcp/gsttcpserversrc.c: (gst_tcpserversrc_gdp_read_caps), + (gst_tcpserversrc_gdp_read_header): + use ssize_t over size_t since the former is signed and thus the + check for error codes can work + 2004-06-02 Wim Taymans reviewed by: Johan diff --git a/ext/alsa/gstalsasrc.c b/ext/alsa/gstalsasrc.c index 2b9966690e..ea9d4856f2 100644 --- a/ext/alsa/gstalsasrc.c +++ b/ext/alsa/gstalsasrc.c @@ -419,7 +419,7 @@ gst_alsa_src_get_time (GstAlsa * this) { snd_pcm_sframes_t delay; - if (snd_pcm_delay (this->handle, &delay) == 0) { + if (snd_pcm_delay (this->handle, &delay) == 0 && this->format) { return GST_SECOND * (this->transmitted + delay) / this->format->rate; } else { return 0; diff --git a/gst/tcp/gsttcp.c b/gst/tcp/gsttcp.c index d149e5e682..307ba9d85f 100644 --- a/gst/tcp/gsttcp.c +++ b/gst/tcp/gsttcp.c @@ -84,7 +84,7 @@ gst_tcp_socket_write (int socket, const void *buf, size_t count) size_t bytes_written = 0; while (bytes_written < count) { - size_t wrote = write (socket, buf + bytes_written, + ssize_t wrote = write (socket, buf + bytes_written, count - bytes_written); if (wrote <= 0) { @@ -109,7 +109,7 @@ gst_tcp_socket_read (int socket, void *buf, size_t count) size_t bytes_read = 0; while (bytes_read < count) { - size_t ret = read (socket, buf + bytes_read, + ssize_t ret = read (socket, buf + bytes_read, count - bytes_read); if (ret <= 0) { @@ -135,7 +135,7 @@ gst_tcp_gdp_read_header (GstElement * this, int socket) size_t header_length = GST_DP_HEADER_LENGTH; size_t readsize; guint8 *header = NULL; - size_t ret; + ssize_t ret; GstBuffer *buffer; header = g_malloc (header_length); @@ -183,7 +183,7 @@ gst_tcp_gdp_read_caps (GstElement * this, int socket) size_t readsize; guint8 *header = NULL; guint8 *payload = NULL; - size_t ret; + ssize_t ret; GstCaps *caps; gchar *string; diff --git a/gst/tcp/gsttcpserversrc.c b/gst/tcp/gsttcpserversrc.c index fcc062059f..35b44ac254 100644 --- a/gst/tcp/gsttcpserversrc.c +++ b/gst/tcp/gsttcpserversrc.c @@ -183,7 +183,7 @@ gst_tcpserversrc_gdp_read_caps (GstTCPServerSrc * this) size_t readsize; guint8 *header = NULL; guint8 *payload = NULL; - size_t ret; + ssize_t ret; GstCaps *caps; gchar *string; @@ -244,7 +244,7 @@ gst_tcpserversrc_gdp_read_header (GstTCPServerSrc * this) size_t header_length = GST_DP_HEADER_LENGTH; size_t readsize; guint8 *header = NULL; - size_t ret; + ssize_t ret; GstBuffer *buffer; header = g_malloc (header_length);