* classes for which the common boundary is not the boundary of
* a byte cannot have different byte orders.
*
- * This is set to -1 on reset and when the last basic field class
- * was a string class.
+ * This is set to CTF_BYTE_ORDER_UNKNOWN on reset and when the last
+ * basic field class was a string class.
*/
enum ctf_byte_order last_bo;
}
/* Always valid if last byte order is unknown */
- if (bfcr->last_bo == -1) {
+ if (bfcr->last_bo == CTF_BYTE_ORDER_UNKNOWN) {
goto end;
}
/* Always valid if next byte order is unknown */
- if (next_bo == -1) {
+ if (next_bo == CTF_BYTE_ORDER_UNKNOWN) {
goto end;
}
stack_clear(bfcr->stack);
stitch_reset(bfcr);
bfcr->buf.addr = NULL;
- bfcr->last_bo = -1;
+ bfcr->last_bo = CTF_BYTE_ORDER_UNKNOWN;
}
static
};
enum ctf_byte_order {
+ CTF_BYTE_ORDER_UNKNOWN,
CTF_BYTE_ORDER_DEFAULT,
CTF_BYTE_ORDER_LITTLE,
CTF_BYTE_ORDER_BIG,
struct ctf_trace_class *tc = g_new0(struct ctf_trace_class, 1);
BT_ASSERT(tc);
- tc->default_byte_order = -1;
+ tc->default_byte_order = CTF_BYTE_ORDER_UNKNOWN;
tc->clock_classes = g_ptr_array_new_with_free_func(
(GDestroyNotify) ctf_clock_class_destroy);
BT_ASSERT(tc->clock_classes);
struct ctf_node *unary_expr)
{
const char *str;
- enum ctf_byte_order bo = -1;
+ enum ctf_byte_order bo = CTF_BYTE_ORDER_UNKNOWN;
if (unary_expr->u.unary_expression.type != UNARY_STRING) {
_BT_COMP_LOGE_NODE(unary_expr,
}
byte_order = get_real_byte_order(ctx, right);
- if (byte_order == -1) {
+ if (byte_order == CTF_BYTE_ORDER_UNKNOWN) {
_BT_COMP_LOGE_NODE(right,
"Invalid `byte_order` attribute in integer field class: "
"ret=%d", ret);
}
byte_order = get_real_byte_order(ctx, right);
- if (byte_order == -1) {
+ if (byte_order == CTF_BYTE_ORDER_UNKNOWN) {
_BT_COMP_LOGE_NODE(right,
"Invalid `byte_order` attribute in floating point number field class: "
"ret=%d", ret);
goto error;
}
- BT_ASSERT(ctx->ctf_tc->default_byte_order != -1);
+ BT_ASSERT(ctx->ctf_tc->default_byte_order != CTF_BYTE_ORDER_UNKNOWN);
_SET(set, _TRACE_BYTE_ORDER_SET);
} else if (strcmp(left, "packet.header") == 0) {
if (_IS_SET(set, _TRACE_PACKET_HEADER_SET)) {
struct ctf_node, siblings);
bo = byte_order_from_unary_expr(ctx,
right_node);
- if (bo == -1) {
+ if (bo == CTF_BYTE_ORDER_UNKNOWN) {
_BT_COMP_LOGE_NODE(node,
"Invalid `byte_order` attribute in trace (`trace` block): "
"expecting `le`, `be`, or `network`.");
* have the native byte order yet, and we don't have any
* trace block yet, then fail with EINCOMPLETE.
*/
- if (ctx->ctf_tc->default_byte_order == -1) {
+ if (ctx->ctf_tc->default_byte_order == CTF_BYTE_ORDER_UNKNOWN) {
bt_list_for_each_entry(iter, &node->u.root.trace, siblings) {
if (got_trace_decl) {
_BT_COMP_LOGE_NODE(node,