use ssize_t over size_t avoid segfault in alsa

Original commit message from CVS:

use ssize_t over size_t
avoid segfault in alsa
This commit is contained in:
Thomas Vander Stichele 2004-06-02 16:50:50 +00:00
parent 276f819c74
commit 571a5cd7a6
4 changed files with 18 additions and 7 deletions

View file

@ -1,3 +1,14 @@
2004-06-02 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <wim@fluendo.com>
reviewed by: Johan

View file

@ -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;

View file

@ -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;

View file

@ -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);