int bcy = box->y + box->height / 2;
d->distance =
- (c->cx - bcx) * (c->cx - bcx) + (c->cy - bcy) * (c->cy - bcy);
+ (guint64) ((c->cx - bcx) * (c->cx - bcx)
+ + (c->cy - bcy) * (c->cy - bcy));
}
}
}
centroid *c = &g_array_index (centroids, centroid, d->centroid_idx);
detectedObject *box = &g_array_index (boxes, detectedObject, d->box_idx);
- cIdx = d->centroid_idx;
bIdx = d->box_idx;
/* the centroid is invalid */
if (ret && gst_caps_is_fixed (self->in_caps)) {
gchar *caps_str = gst_caps_to_string (caps);
+ gsize len;
- g_strlcpy (self->mqtt_msg_hdr.gst_caps_str, caps_str,
+ if (caps_str == NULL) {
+ g_critical ("Fail to convert caps to string representation");
+ return FALSE;
+ }
+
+ len = g_strlcpy (self->mqtt_msg_hdr.gst_caps_str, caps_str,
GST_MQTT_MAX_LEN_GST_CAPS_STR);
+
+ if (len >= GST_MQTT_MAX_LEN_GST_CAPS_STR) {
+ g_critical ("Fail to copy caps_str.");
+ ret = FALSE;
+ }
+
g_free (caps_str);
}