From a68e0b832408660fdbaff4f188c0bf93e35f38d4 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 26 Apr 2003 01:54:01 +0000 Subject: [PATCH] fix and better comment gst_event_new_discontinuous. Nice memory leak there Original commit message from CVS: fix and better comment gst_event_new_discontinuous. Nice memory leak there --- gst/gstevent.c | 10 ++++++---- gst/gstformat.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gst/gstevent.c b/gst/gstevent.c index acee48a74c..ecf145c91e 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -183,7 +183,10 @@ gst_event_new_seek (GstSeekType type, gint64 offset) * @format1: The format of the discont value * @...: more discont values and formats * - * Allocate a new discontinuous event with the geven format/value pairs. + * Allocate a new discontinuous event with the given format/value pairs. Note + * that the values are of type gint64 - you may not use simple integers such + * as "0" when calling this function, always cast them like "(gint64) 0". + * Terminate the list with #GST_FORMAT_UNDEFINED. * * Returns: A new discontinuous event. */ @@ -199,12 +202,12 @@ gst_event_new_discontinuous (gboolean new_media, GstFormat format1, ...) va_start (var_args, format1); - while (format1) { + while (format1 >= GST_FORMAT_UNDEFINED && count < 8) { GST_EVENT_DISCONT_OFFSET (event, count).format = format1 & GST_SEEK_FORMAT_MASK; GST_EVENT_DISCONT_OFFSET (event, count).value = va_arg (var_args, gint64); - format1 = va_arg (var_args, GstSeekType); + format1 = va_arg (var_args, GstFormat); count++; } @@ -313,4 +316,3 @@ gst_event_new_segment_seek (GstSeekType type, gint64 start, gint64 stop) return event; } - diff --git a/gst/gstformat.h b/gst/gstformat.h index 74347ec598..9af0a45231 100644 --- a/gst/gstformat.h +++ b/gst/gstformat.h @@ -30,7 +30,7 @@ G_BEGIN_DECLS typedef enum { - GST_FORMAT_UNDEFINED = 0, + GST_FORMAT_UNDEFINED = 0, /* must be first in list */ GST_FORMAT_DEFAULT = 1, GST_FORMAT_BYTES = 2, GST_FORMAT_TIME = 3,