gst/gstcaps.c: fix signedness issues in a (hopefully) correct way
authorThomas Vander Stichele <thomas@apestaart.org>
Mon, 17 Oct 2005 14:37:06 +0000 (14:37 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Mon, 17 Oct 2005 14:37:06 +0000 (14:37 +0000)
Original commit message from CVS:

* gst/gstcaps.c: (gst_caps_intersect):
fix signedness issues in a (hopefully) correct way
* gst/gstelement.c: (gst_element_pads_activate):
some debugging
* gst/gstobject.c: (gst_object_set_parent):
some debugging

ChangeLog
gst/gstcaps.c
gst/gstelement.c
gst/gstobject.c

index 20cf5d5..a2d863e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-10-17  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst/gstcaps.c: (gst_caps_intersect):
+         fix signedness issues in a (hopefully) correct way
+       * gst/gstelement.c: (gst_element_pads_activate):
+         some debugging
+       * gst/gstobject.c: (gst_object_set_parent):
+         some debugging
+
 2005-10-17  Julien MOUTTE  <julien@moutte.net>
 
        * gst/gstvalue.h: Fix prototypes.
index 3c29256..f1765e4 100644 (file)
@@ -955,7 +955,8 @@ gst_caps_structure_union (const GstStructure * struct1,
 GstCaps *
 gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2)
 {
-  gint64 i, j, k;               /* indexes can be up to 2 * sizeof (guint) */
+  guint64 i;                    /* index can be up to 2 * G_MAX_UINT */
+  guint j, k;
 
   GstStructure *struct1;
   GstStructure *struct2;
@@ -1000,7 +1001,7 @@ gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2)
 
     /* now run the diagonal line, end condition is the left or bottom
      * border */
-    while (k < caps2->structs->len && j >= 0) {
+    while (k < caps2->structs->len) {
       struct1 = gst_caps_get_structure (caps1, j);
       struct2 = gst_caps_get_structure (caps2, k);
 
@@ -1009,6 +1010,8 @@ gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2)
       gst_caps_append_structure (dest, istruct);
       /* move down left */
       k++;
+      if (j == 0)
+        break;                  /* so we don't roll back to G_MAXUINT */
       j--;
     }
   }
index 16d5de1..2186a9b 100644 (file)
@@ -2157,6 +2157,7 @@ gst_element_pads_activate (GstElement * element, gboolean active)
   GstIterator *iter;
   gboolean fold_ok;
 
+  GST_DEBUG_OBJECT (element, "pads_activate with active %d", active);
   /* no need to unset this later, it's just a boolean */
   g_value_init (&ret, G_TYPE_BOOLEAN);
   g_value_set_boolean (&ret, TRUE);
@@ -2165,16 +2166,21 @@ gst_element_pads_activate (GstElement * element, gboolean active)
   fold_ok = iterator_fold_with_resync
       (iter, (GstIteratorFoldFunction) activate_pads, &ret, &active);
   gst_iterator_free (iter);
-  if (!fold_ok || !g_value_get_boolean (&ret))
+  if (!fold_ok || !g_value_get_boolean (&ret)) {
+    GST_DEBUG_OBJECT (element, "pads_activate failed");
     return FALSE;
+  }
 
   iter = gst_element_iterate_sink_pads (element);
   fold_ok = iterator_fold_with_resync
       (iter, (GstIteratorFoldFunction) activate_pads, &ret, &active);
   gst_iterator_free (iter);
-  if (!fold_ok || !g_value_get_boolean (&ret))
+  if (!fold_ok || !g_value_get_boolean (&ret)) {
+    GST_DEBUG_OBJECT (element, "pads_activate failed");
     return FALSE;
+  }
 
+  GST_DEBUG_OBJECT (element, "pads_activate successful");
   return TRUE;
 }
 
index 4f594e0..c771f6c 100644 (file)
@@ -871,6 +871,7 @@ gst_object_set_parent (GstObject * object, GstObject * parent)
    * in the floating case. */
   object->parent = parent;
   if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
+    GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unsetting floating flag");
     GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
     GST_UNLOCK (object);
   } else {