Fix: respect signed integers' length when printing in hex base

Make sure we don't print a full 64-bit sign-extended value
when printing a negative integer in hexadecimal base.

Fixes #848

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: make sure we can exit the get_new_metadata loop

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Remove duplicate include of unistd in test_ctf_writer

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Fix: iterate manually over each live trace to add to catch errors

Instead of using g_hash_table_foreach, we now control the iteration over
the hash table, so we can handle properly the errors.
For now, if there is an error for any trace, we consider this a fatal
issue and exit.

We could allow the process to continue and only skip the problematic
traces, but we will wait until this becomes a real use-case.

Fixes: #827

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: sanity check in iterator creation

This function is part of the public API; we need more
sanity checks before using the structures provided by the caller.

Refs: #827

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add comment indicating the type of ctf_traces' elements

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Ensure a packet context is a structure

bt_ctf_stream_class_set_packet_context_type was checking the current
stream packet context's type instead of the one being passed.

Added a test to validate that the check is done appropriately.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Missing description NULL check in bt_ctf_clock when serializing

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Incorrect variant tag validation

An erroneous tag validation causes bt_ctf_field_variant_get_field() to
fail when called a second time on a given variant field.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Implement bt_ctf_field deep copy

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add stream_event_context accessors

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Only allow setting a packet context on a non-frozen stream class

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Cleanup: Missing whitespace in comment

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Add unit tests for stream event context accessors
Cleanup: Remove unnecessary argument name

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add stream_event_context accessors

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Add unit tests for stream event context accessors

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Cleanup: Misplaced end label in bt_ctf_stream_get_packet_context

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Docs: Add a comment about event validation in bt_ctf_stream_append_event

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Check integer signedness in packet header when auto-populating

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>