avidemux: Fix pointer arithmetic

This fixes a seeking regression, bug #134522.
This commit is contained in:
Sebastian Dröge 2009-05-12 21:20:04 +02:00
parent 5f609ead28
commit e93f784ee1

View file

@ -351,7 +351,7 @@ gst_avi_demux_index_entry_for_time (GstAviDemux * avi,
gint stream_nr, guint64 time) gint stream_nr, guint64 time)
{ {
gst_avi_index_entry *entry = NULL; gst_avi_index_entry *entry = NULL;
guint n = 0; guint n;
GST_LOG_OBJECT (avi, "stream_nr:%d , time:%" GST_TIME_FORMAT, GST_LOG_OBJECT (avi, "stream_nr:%d , time:%" GST_TIME_FORMAT,
stream_nr, GST_TIME_ARGS (time)); stream_nr, GST_TIME_ARGS (time));
@ -362,6 +362,7 @@ gst_avi_demux_index_entry_for_time (GstAviDemux * avi,
(GCompareDataFunc) gst_avi_demux_index_entry_search, (GCompareDataFunc) gst_avi_demux_index_entry_search,
GST_SEARCH_MODE_BEFORE, &time, NULL); GST_SEARCH_MODE_BEFORE, &time, NULL);
n = entry - avi->index_entries;
if (entry == NULL) { if (entry == NULL) {
entry = &avi->index_entries[0]; entry = &avi->index_entries[0];
n = 0; n = 0;
@ -370,7 +371,6 @@ gst_avi_demux_index_entry_for_time (GstAviDemux * avi,
entry = &avi->index_entries[n]; entry = &avi->index_entries[n];
} }
} else if (entry->stream_nr != stream_nr) { } else if (entry->stream_nr != stream_nr) {
n = (entry - avi->index_entries) / sizeof (gst_avi_index_entry);
while (entry->stream_nr != stream_nr && n > 0) { while (entry->stream_nr != stream_nr && n > 0) {
n--; n--;
entry = &avi->index_entries[n]; entry = &avi->index_entries[n];