Revert ABI-breaking enum bt_ctf_string_encoding change
[babeltrace.git] / formats / ctf / ir / field-types.c
index 9af6b21380d20d6188565aaef3386016025d6608..3a23d96e428c8a14d4c9bdf95685e0e1c8dbbe00 100644 (file)
@@ -685,7 +685,8 @@ struct bt_ctf_field_type *bt_ctf_field_type_integer_create(unsigned int size)
        integer->parent.declaration->id = CTF_TYPE_INTEGER;
        integer->declaration.len = size;
        integer->declaration.base = BT_CTF_INTEGER_BASE_DECIMAL;
-       integer->declaration.encoding = BT_CTF_STRING_ENCODING_NONE;
+       integer->declaration.encoding =
+                       (enum ctf_string_encoding) BT_CTF_STRING_ENCODING_NONE;
        bt_ctf_field_type_init(&integer->parent, TRUE);
        return &integer->parent;
 }
@@ -799,21 +800,21 @@ enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
        }
 
        integer = container_of(type, struct bt_ctf_field_type_integer, parent);
-       ret = integer->declaration.encoding;
+       ret = (enum bt_ctf_string_encoding) integer->declaration.encoding;
 end:
        return ret;
 }
 
 int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type,
-               enum bt_ctf_string_encoding encoding)
+               enum ctf_string_encoding encoding)
 {
        int ret = 0;
        struct bt_ctf_field_type_integer *integer;
 
        if (!type || type->frozen ||
                (type->declaration->id != CTF_TYPE_INTEGER) ||
-               (encoding < BT_CTF_STRING_ENCODING_NONE) ||
-               (encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) {
+               (encoding < CTF_STRING_NONE) ||
+               (encoding >= CTF_STRING_UNKNOWN)) {
                ret = -1;
                goto end;
        }
@@ -1974,7 +1975,8 @@ struct bt_ctf_field_type *bt_ctf_field_type_string_create(void)
        string->parent.declaration = &string->declaration.p;
        string->parent.declaration->id = CTF_TYPE_STRING;
        bt_ctf_field_type_init(&string->parent, TRUE);
-       string->declaration.encoding = BT_CTF_STRING_ENCODING_UTF8;
+       string->declaration.encoding =
+                       (enum ctf_string_encoding) BT_CTF_STRING_ENCODING_UTF8;
        string->parent.declaration->alignment = CHAR_BIT;
        return &string->parent;
 }
@@ -1992,20 +1994,20 @@ enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
 
        string = container_of(type, struct bt_ctf_field_type_string,
                parent);
-       ret = string->declaration.encoding;
+       ret = (enum bt_ctf_string_encoding) string->declaration.encoding;
 end:
        return ret;
 }
 
 int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type,
-               enum bt_ctf_string_encoding encoding)
+               enum ctf_string_encoding encoding)
 {
        int ret = 0;
        struct bt_ctf_field_type_string *string;
 
        if (!type || type->declaration->id != CTF_TYPE_STRING ||
-               (encoding != BT_CTF_STRING_ENCODING_UTF8 &&
-               encoding != BT_CTF_STRING_ENCODING_ASCII)) {
+               (encoding != CTF_STRING_UTF8 &&
+               encoding != CTF_STRING_ASCII)) {
                ret = -1;
                goto end;
        }
@@ -2881,7 +2883,7 @@ int bt_ctf_field_type_integer_serialize(struct bt_ctf_field_type *type,
                "integer { size = %zu; align = %zu; signed = %s; encoding = %s; base = %s; byte_order = %s",
                integer->declaration.len, type->declaration->alignment,
                (integer->declaration.signedness ? "true" : "false"),
-               get_encoding_string(integer->declaration.encoding),
+               get_encoding_string((enum bt_ctf_string_encoding) integer->declaration.encoding),
                get_integer_base_string(integer->declaration.base),
                get_byte_order_string(integer->declaration.byte_order));
        if (integer->mapped_clock) {
@@ -3168,7 +3170,7 @@ int bt_ctf_field_type_string_serialize(struct bt_ctf_field_type *type,
 
        g_string_append_printf(context->string,
                "string { encoding = %s; }",
-               get_encoding_string(string->declaration.encoding));
+               get_encoding_string((enum bt_ctf_string_encoding) string->declaration.encoding));
        return 0;
 }
 
This page took 0.024816 seconds and 4 git commands to generate.