tracers: fix thread-id casts to 64-bit ints on 32-bit systems
authorTim-Philipp Müller <tim@centricular.com>
Sun, 17 Jan 2016 23:49:27 +0000 (23:49 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 18 Jan 2016 11:28:28 +0000 (11:28 +0000)
https://bugzilla.gnome.org/show_bug.cgi?id=760762

plugins/tracers/gstrusage.c
plugins/tracers/gststats.c
tools/gst-stats.c

index 58f1b51..67c18fe 100644 (file)
@@ -238,7 +238,7 @@ do_stats (GstTracer * obj, guint64 ts)
   update_trace_value (stats->tvs_thread, ts, stats->tthread, &dts, &dtproc);
   cur_cpuload = (guint) gst_util_uint64_scale (dtproc,
       G_GINT64_CONSTANT (1000), dts);
-  gst_tracer_record_log (tr_thread, (guint64)thread_id, ts,
+  gst_tracer_record_log (tr_thread, (guint64) (guintptr) thread_id, ts,
       MIN (avg_cpuload, 1000), MIN (cur_cpuload, 1000), stats->tthread);
 
   avg_cpuload = (guint) gst_util_uint64_scale (tproc / num_cpus,
index e6eee06..52ee091 100644 (file)
@@ -95,7 +95,7 @@ static void
 log_new_element_stats (GstElementStats * stats, GstElement * element,
     GstClockTime elapsed)
 {
-  gst_tracer_record_log (tr_new_element, (guint64) g_thread_self (),
+  gst_tracer_record_log (tr_new_element, (guint64) (guintptr) g_thread_self (),
       elapsed, stats->index, stats->parent_ix, GST_OBJECT_NAME (element),
       G_OBJECT_TYPE_NAME (element), GST_IS_BIN (element));
 }
@@ -197,7 +197,7 @@ fill_pad_stats (GstStatsTracer * self, GstPad * pad)
 static void
 log_new_pad_stats (GstPadStats * stats, GstPad * pad)
 {
-  gst_tracer_record_log (tr_new_pad, (guint64) g_thread_self (),
+  gst_tracer_record_log (tr_new_pad, (guint64) (guintptr) g_thread_self (),
       stats->index, stats->parent_ix, GST_OBJECT_NAME (pad),
       G_OBJECT_TYPE_NAME (pad), GST_IS_GHOST_PAD (pad),
       GST_PAD_DIRECTION (pad));
@@ -252,10 +252,11 @@ do_buffer_stats (GstStatsTracer * self, GstPad * this_pad,
   GstElement *that_elem = get_real_pad_parent (that_pad);
   GstElementStats *that_elem_stats = get_element_stats (self, that_elem);
 
-  gst_tracer_record_log (tr_buffer, (guint64) g_thread_self (), elapsed,
-      this_pad_stats->index, this_elem_stats->index, that_pad_stats->index,
-      that_elem_stats->index, gst_buffer_get_size (buf), GST_BUFFER_PTS (buf),
-      GST_BUFFER_DTS (buf), GST_BUFFER_DURATION (buf), GST_BUFFER_FLAGS (buf));
+  gst_tracer_record_log (tr_buffer, (guint64) (guintptr) g_thread_self (),
+      elapsed, this_pad_stats->index, this_elem_stats->index,
+      that_pad_stats->index, that_elem_stats->index, gst_buffer_get_size (buf),
+      GST_BUFFER_PTS (buf), GST_BUFFER_DTS (buf), GST_BUFFER_DURATION (buf),
+      GST_BUFFER_FLAGS (buf));
 }
 
 static void
@@ -269,9 +270,9 @@ do_query_stats (GstStatsTracer * self, GstPad * this_pad,
   GstElement *that_elem = get_real_pad_parent (that_pad);
   GstElementStats *that_elem_stats = get_element_stats (self, that_elem);
 
-  gst_tracer_record_log (tr_query, (guint64) g_thread_self (), elapsed,
-      this_pad_stats->index, this_elem_stats->index, that_pad_stats->index,
-      that_elem_stats->index, GST_QUERY_TYPE_NAME (qry),
+  gst_tracer_record_log (tr_query, (guint64) (guintptr) g_thread_self (),
+      elapsed, this_pad_stats->index, this_elem_stats->index,
+      that_pad_stats->index, that_elem_stats->index, GST_QUERY_TYPE_NAME (qry),
       gst_query_get_structure (qry), have_res, res);
 }
 
@@ -448,7 +449,7 @@ do_push_event_pre (GstStatsTracer * self, guint64 ts, GstPad * pad,
   GstPadStats *pad_stats = get_pad_stats (self, pad);
 
   elem_stats->last_ts = ts;
-  gst_tracer_record_log (tr_event, (guint64) g_thread_self (), ts,
+  gst_tracer_record_log (tr_event, (guint64) (guintptr) g_thread_self (), ts,
       pad_stats->index, elem_stats->index, GST_EVENT_TYPE_NAME (ev));
 }
 
@@ -460,7 +461,7 @@ do_post_message_pre (GstStatsTracer * self, guint64 ts, GstElement * elem,
   const GstStructure *msg_s = gst_message_get_structure (msg);
 
   stats->last_ts = ts;
-  gst_tracer_record_log (tr_message, (guint64) g_thread_self (), ts,
+  gst_tracer_record_log (tr_message, (guint64) (guintptr) g_thread_self (), ts,
       stats->index, GST_MESSAGE_TYPE_NAME (msg),
       (msg_s ? msg_s : gst_structure_new_empty ("dummy")));
 }
@@ -481,8 +482,9 @@ do_element_query_pre (GstStatsTracer * self, guint64 ts, GstElement * elem,
   GstElementStats *stats = get_element_stats (self, elem);
 
   stats->last_ts = ts;
-  gst_tracer_record_log (tr_element_query, (guint64) g_thread_self (), ts,
-      stats->index, GST_QUERY_TYPE_NAME (qry));
+  gst_tracer_record_log (tr_element_query,
+      (guint64) (guintptr) g_thread_self (), ts, stats->index,
+      GST_QUERY_TYPE_NAME (qry));
 }
 
 static void
index d1ae659..f663a65 100644 (file)
@@ -159,7 +159,7 @@ new_pad_stats (GstStructure * s)
   stats->dir = dir;
   stats->min_size = G_MAXUINT;
   stats->first_ts = stats->last_ts = stats->next_ts = GST_CLOCK_TIME_NONE;
-  stats->thread_id = (gpointer) thread_id;
+  stats->thread_id = (gpointer) (guintptr) thread_id;
   stats->parent_ix = parent_ix;
 
   if (pads->len <= ix)
@@ -392,7 +392,7 @@ do_thread_rusage_stats (GstStructure * s)
       "thread-id", G_TYPE_UINT64, &thread_id,
       "average-cpuload", G_TYPE_UINT, &cpuload, "time", G_TYPE_UINT64, &tthread,
       NULL);
-  thread_stats = get_thread_stats ((gpointer) thread_id);
+  thread_stats = get_thread_stats ((gpointer) (guintptr) thread_id);
   thread_stats->cpuload = cpuload;
   thread_stats->tthread = tthread;
   last_ts = MAX (last_ts, ts);