rtp: Fix compilation with non-C99 compilers

By moving variable declarations out of loop headers.
diff --git a/gst/rtp/gstrtpreddec.c b/gst/rtp/gstrtpreddec.c
index 5f769ba..bc9c0ea 100644
--- a/gst/rtp/gstrtpreddec.c
+++ b/gst/rtp/gstrtpreddec.c
@@ -218,7 +218,7 @@
   RTPHistItem *older;
   RTPHistItem *newer;
   guint32 timestamp_diff;
-  gint seq_diff;
+  gint seq_diff, lost_packet_idx;
 
   if (NULL == older_sibling) {
     if (self->rtp_history->length == RTP_HISTORY_MAX_SIZE)
@@ -260,7 +260,7 @@
   }
 
   timestamp_diff = newer->timestamp - older->timestamp;
-  for (gint lost_packet_idx = 1; lost_packet_idx < seq_diff; ++lost_packet_idx) {
+  for (lost_packet_idx = 1; lost_packet_idx < seq_diff; ++lost_packet_idx) {
     guint32 lost_timestamp = older->timestamp +
         lost_packet_idx * timestamp_diff / seq_diff;
     if (lost_timestamp == timestamp) {
@@ -283,6 +283,7 @@
   guint csrc_count = gst_rtp_buffer_get_csrc_count (red_rtp);
   GstBuffer *ret = gst_rtp_buffer_new_allocate (0, 0, csrc_count);
   GstRTPBuffer ret_rtp = GST_RTP_BUFFER_INIT;
+  guint i;
   if (!gst_rtp_buffer_map (ret, GST_MAP_WRITE, &ret_rtp))
     g_assert_not_reached ();
 
@@ -291,7 +292,7 @@
   gst_rtp_buffer_set_seq (&ret_rtp, seq_num);
   gst_rtp_buffer_set_timestamp (&ret_rtp, timestamp);
   gst_rtp_buffer_set_ssrc (&ret_rtp, gst_rtp_buffer_get_ssrc (red_rtp));
-  for (guint i = 0; i < csrc_count; ++i)
+  for (i = 0; i < csrc_count; ++i)
     gst_rtp_buffer_set_csrc (&ret_rtp, i, gst_rtp_buffer_get_csrc (red_rtp, i));
   gst_rtp_buffer_unmap (&ret_rtp);
 
diff --git a/gst/rtp/gstrtpredenc.c b/gst/rtp/gstrtpredenc.c
index f1bf72c..1bbc9a9 100644
--- a/gst/rtp/gstrtpredenc.c
+++ b/gst/rtp/gstrtpredenc.c
@@ -143,6 +143,7 @@
   GstBuffer *red = gst_rtp_buffer_new_allocate (red_header_size, 0, csrc_count);
   guint8 *red_block_header;
   GstRTPBuffer red_rtp = GST_RTP_BUFFER_INIT;
+  guint i;
 
   if (!gst_rtp_buffer_map (red, GST_MAP_WRITE, &red_rtp))
     g_assert_not_reached ();
@@ -156,7 +157,7 @@
   gst_rtp_buffer_set_seq (&red_rtp, gst_rtp_buffer_get_seq (inp_rtp));
   gst_rtp_buffer_set_timestamp (&red_rtp, timestmap);
   gst_rtp_buffer_set_ssrc (&red_rtp, gst_rtp_buffer_get_ssrc (inp_rtp));
-  for (guint i = 0; i != csrc_count; ++i)
+  for (i = 0; i != csrc_count; ++i)
     gst_rtp_buffer_set_csrc (&red_rtp, i,
         gst_rtp_buffer_get_csrc ((inp_rtp), i));
 
diff --git a/gst/rtp/gstrtpulpfecdec.c b/gst/rtp/gstrtpulpfecdec.c
index a24dd51..9cb4997 100644
--- a/gst/rtp/gstrtpulpfecdec.c
+++ b/gst/rtp/gstrtpulpfecdec.c
@@ -105,6 +105,7 @@
     guint8 fec_pt, guint16 lost_seq)
 {
   guint fec_packets = 0;
+  gsize i;
 
   g_assert (NULL == self->info_media);
   g_assert (0 == self->info_fec->len);
@@ -112,7 +113,7 @@
 
   g_array_set_size (self->info_arr, gst_buffer_list_length (buflist));
 
-  for (gsize i = 0;
+  for (i = 0;
       i < gst_buffer_list_length (buflist) && !self->lost_packet_from_storage;
       ++i) {
     GstBuffer *buffer = gst_buffer_list_get (buflist, i);
@@ -165,7 +166,9 @@
     guint16 fec_seq_base)
 {
   guint64 mask = 0;
-  for (GList * it = self->info_media; it; it = it->next) {
+  GList *it;
+
+  for (it = self->info_media; it; it = it->next) {
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
     mask |=
         rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
@@ -178,10 +181,11 @@
 gst_rtp_ulpfec_dec_is_recovered_pt_valid (GstRtpUlpFecDec * self, gint media_pt,
     guint8 recovered_pt)
 {
+  GList *it;
   if (media_pt == recovered_pt)
     return TRUE;
 
-  for (GList * it = self->info_media; it; it = it->next) {
+  for (it = self->info_media; it; it = it->next) {
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
     if (gst_rtp_buffer_get_payload_type (&info->rtp) == recovered_pt)
       return TRUE;
@@ -198,12 +202,13 @@
   gboolean fec_mask_long = rtp_ulpfec_buffer_get_fechdr (&info_fec->rtp)->L;
   guint16 fec_seq_base = rtp_ulpfec_buffer_get_seq_base (&info_fec->rtp);
   GstBuffer *ret;
+  GList *it;
 
   g_array_set_size (self->scratch_buf, 0);
   rtp_buffer_to_ulpfec_bitstring (&info_fec->rtp, self->scratch_buf, TRUE,
       fec_mask_long);
 
-  for (GList * it = self->info_media; it; it = it->next) {
+  for (it = self->info_media; it; it = it->next) {
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self, it->data);
     guint64 packet_mask =
         rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
@@ -305,12 +310,13 @@
 {
   guint64 media_mask = 0;
   gint media_mask_seq_base = -1;
+  gsize i;
 
   if (self->lost_packet_from_storage)
     return gst_rtp_ulpfec_dec_recover_from_storage (self, dst_pt, dst_seq);
 
   /* Looking for a FEC packet which can be used for recovery */
-  for (gsize i = 0; i < self->info_fec->len; ++i) {
+  for (i = 0; i < self->info_fec->len; ++i) {
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (self,
         g_ptr_array_index (self->info_fec, i));
     guint16 seq_base = rtp_ulpfec_buffer_get_seq_base (&info->rtp);
diff --git a/gst/rtp/gstrtpulpfecenc.c b/gst/rtp/gstrtpulpfecenc.c
index c06b423..f29acd5 100644
--- a/gst/rtp/gstrtpulpfecenc.c
+++ b/gst/rtp/gstrtpulpfecenc.c
@@ -120,10 +120,11 @@
     GQueue * packets, guint fec_packets)
 {
   GList *it = packets->tail;
+  guint i;
 
   g_array_set_size (ctx->info_arr, packets->length);
 
-  for (guint i = 0; i < packets->length; ++i) {
+  for (i = 0; i < packets->length; ++i) {
     GstBuffer *buffer = it->data;
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (ctx, i);
 
@@ -162,11 +163,12 @@
   guint len = end - start + 1;
   guint64 mask = 0;
   guint16 seq_base = 0;
+  guint i;
 
   len = MIN (len, RTP_ULPFEC_PROTECTED_PACKETS_MAX (TRUE));
   end = start + len - 1;
 
-  for (guint i = start; i <= end; ++i) {
+  for (i = start; i <= end; ++i) {
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (ctx, i);
     guint16 seq = gst_rtp_buffer_get_seq (&info->rtp);
 
@@ -200,6 +202,7 @@
   GstBuffer *ret;
   guint64 tmp_mask;
   gboolean fec_mask_long;
+  guint i;
 
   if (ctx->fec_packet_idx >= ctx->fec_packets)
     return NULL;
@@ -210,7 +213,7 @@
 
   tmp_mask = fec_mask;
   fec_mask_long = rtp_ulpfec_mask_is_long (fec_mask);
-  for (guint i = start; i <= end; ++i) {
+  for (i = start; i <= end; ++i) {
     RtpUlpFecMapInfo *info = RTP_FEC_MAP_INFO_NTH (ctx, i);
     guint64 packet_mask =
         rtp_ulpfec_packet_mask_from_seqnum (gst_rtp_buffer_get_seq (&info->rtp),
diff --git a/gst/rtp/rtpstoragestream.c b/gst/rtp/rtpstoragestream.c
index 9b5d724..d556e6e 100644
--- a/gst/rtp/rtpstoragestream.c
+++ b/gst/rtp/rtpstoragestream.c
@@ -72,7 +72,7 @@
     }
   }
 
-  for (guint i = 0; i < too_old_buffers_num; ++i) {
+  for (i = 0; i < too_old_buffers_num; ++i) {
     RtpStorageItem *item = g_queue_pop_tail (&stream->queue);
     rtp_storage_item_free (item);
   }
@@ -137,6 +137,7 @@
   GList *end = NULL;
   GList *start = NULL;
   gboolean saw_fec = TRUE;      /* To initialize the start pointer in the loop below */
+  GList *it;
 
   /* Looking for media stream chunk with FEC packets at the end, which could
    * can have the lost packet. For example:
@@ -151,7 +152,7 @@
    * - it could have arrived right after it was considered lost (more of a corner case)
    * - it was recovered together with the other lost packet (most likely)
    */
-  for (GList * it = stream->queue.tail; it; it = it->prev) {
+  for (it = stream->queue.tail; it; it = it->prev) {
     RtpStorageItem *item = it->data;
     gboolean found_end = FALSE;
 
@@ -193,8 +194,9 @@
 
   if (start && end) {
     GstBufferList *ret = gst_buffer_list_new_sized (ret_length);
+    GList *it;
 
-    for (GList * it = start; it != end->prev; it = it->prev)
+    for (it = start; it != end->prev; it = it->prev)
       gst_buffer_list_add (ret,
           gst_buffer_ref (((RtpStorageItem *) it->data)->buffer));
     return ret;
@@ -207,7 +209,8 @@
 rtp_storage_stream_get_redundant_packet (RtpStorageStream * stream,
     guint16 lost_seq)
 {
-  for (GList * it = stream->queue.head; it; it = it->next) {
+  GList *it;
+  for (it = stream->queue.head; it; it = it->next) {
     RtpStorageItem *item = it->data;
     if (item->seq == lost_seq)
       return gst_buffer_ref (item->buffer);
diff --git a/tests/check/elements/rtpred.c b/tests/check/elements/rtpred.c
index 6db4c38..ff48389 100644
--- a/tests/check/elements/rtpred.c
+++ b/tests/check/elements/rtpred.c
@@ -49,10 +49,10 @@
 #define _check_caps(_h_, _nth_, _expected_payload_)               \
   G_STMT_START {                                                  \
     GstEvent *_ev_;                                               \
-    gint _pt_ = -1;                                               \
+    gint _pt_ = -1, _i_;                                          \
     GstCaps *_caps_ = NULL;                                       \
                                                                   \
-    for (gint _i_ = 0; _i_ < _nth_; ++_i_)                        \
+    for (_i_ = 0; _i_ < _nth_; ++_i_)                             \
       gst_event_unref (gst_harness_pull_event (_h_));             \
                                                                   \
     _ev_ = gst_harness_pull_event (_h_);                          \
diff --git a/tests/check/elements/rtpulpfec.c b/tests/check/elements/rtpulpfec.c
index a1d637b..f172233 100644
--- a/tests/check/elements/rtpulpfec.c
+++ b/tests/check/elements/rtpulpfec.c
@@ -144,10 +144,11 @@
 {
   gboolean found = FALSE;
   GstRTPBuffer rtp = { NULL };
+  GList *it;
 
   fail_unless (gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp));
 
-  for (GList * it = infos; it; it = it->next) {
+  for (it = infos; it; it = it->next) {
     RecoveredPacketInfo *info = it->data;
     if (gst_rtp_buffer_get_seq (&rtp) == info->seq) {
       fail_unless_equals_int (gst_rtp_buffer_get_payload_type (&rtp), info->pt);
@@ -285,8 +286,9 @@
   gsize lost_packet_size = packets_size[__i__];
   RecoveredPacketInfo info = {.pt = 126,.ssrc = 578322839,.seq = lost_seq };
   GList *expected = expect_recovered_packets (h, &info, 1);
+  gsize i;
 
-  for (gsize i = 0; i < G_N_ELEMENTS (packets); ++i) {
+  for (i = 0; i < G_N_ELEMENTS (packets); ++i) {
     if (i != (gsize) __i__)
       push_data (h, packets[i], packets_size[i]);
   }