ir: rename ctf_string_encoding -> bt_ctf_string_encoding
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 8 Feb 2016 08:43:06 +0000 (03:43 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 19 Feb 2016 21:24:47 +0000 (16:24 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-types.c
include/babeltrace/ctf-ir/event-types.h
tests/lib/test_ctf_writer.c

index f4ac0ecfd0b774925960fb0da06f0e7f41b6f083..67200dac0a31b15e1a08c14df64278ca1f70238b 100644 (file)
@@ -662,7 +662,7 @@ 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 = CTF_STRING_NONE;
+       integer->declaration.encoding = BT_CTF_STRING_ENCODING_NONE;
        bt_ctf_field_type_init(&integer->parent, TRUE);
        return &integer->parent;
 }
@@ -762,10 +762,10 @@ end:
        return ret;
 }
 
-enum ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
+enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
                struct bt_ctf_field_type *type)
 {
-       enum ctf_string_encoding ret = CTF_STRING_UNKNOWN;
+       enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
        struct bt_ctf_field_type_integer *integer;
 
        if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
@@ -779,15 +779,15 @@ end:
 }
 
 int bt_ctf_field_type_integer_set_encoding(struct bt_ctf_field_type *type,
-               enum ctf_string_encoding encoding)
+               enum bt_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 < CTF_STRING_NONE) ||
-               (encoding >= CTF_STRING_UNKNOWN)) {
+               (encoding < BT_CTF_STRING_ENCODING_NONE) ||
+               (encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) {
                ret = -1;
                goto end;
        }
@@ -1922,16 +1922,16 @@ 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 = CTF_STRING_UTF8;
+       string->declaration.encoding = BT_CTF_STRING_ENCODING_UTF8;
        string->parent.declaration->alignment = CHAR_BIT;
        return &string->parent;
 }
 
-enum ctf_string_encoding bt_ctf_field_type_string_get_encoding(
+enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
                struct bt_ctf_field_type *type)
 {
        struct bt_ctf_field_type_string *string;
-       enum ctf_string_encoding ret = CTF_STRING_UNKNOWN;
+       enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
 
        if (!type || (type->declaration->id != CTF_TYPE_STRING)) {
                goto end;
@@ -1945,14 +1945,14 @@ end:
 }
 
 int bt_ctf_field_type_string_set_encoding(struct bt_ctf_field_type *type,
-               enum ctf_string_encoding encoding)
+               enum bt_ctf_string_encoding encoding)
 {
        int ret = 0;
        struct bt_ctf_field_type_string *string;
 
        if (!type || type->declaration->id != CTF_TYPE_STRING ||
-               (encoding != CTF_STRING_UTF8 &&
-               encoding != CTF_STRING_ASCII)) {
+               (encoding != BT_CTF_STRING_ENCODING_UTF8 &&
+               encoding != BT_CTF_STRING_ENCODING_ASCII)) {
                ret = -1;
                goto end;
        }
@@ -2740,18 +2740,18 @@ void bt_ctf_field_type_sequence_freeze(struct bt_ctf_field_type *type)
 }
 
 static
-const char *get_encoding_string(enum ctf_string_encoding encoding)
+const char *get_encoding_string(enum bt_ctf_string_encoding encoding)
 {
        const char *encoding_string;
 
        switch (encoding) {
-       case CTF_STRING_NONE:
+       case BT_CTF_STRING_ENCODING_NONE:
                encoding_string = "none";
                break;
-       case CTF_STRING_ASCII:
+       case BT_CTF_STRING_ENCODING_ASCII:
                encoding_string = "ASCII";
                break;
-       case CTF_STRING_UTF8:
+       case BT_CTF_STRING_ENCODING_UTF8:
                encoding_string = "UTF8";
                break;
        default:
index a07d5e568b74ee57cf1d92c6c5487771556d1899..054615f121d4001bc37f281005463365321f7751 100644 (file)
@@ -64,6 +64,13 @@ enum bt_ctf_byte_order {
        BT_CTF_BYTE_ORDER_NETWORK,
 };
 
+enum bt_ctf_string_encoding {
+       BT_CTF_STRING_ENCODING_NONE = CTF_STRING_NONE,
+       BT_CTF_STRING_ENCODING_UTF8 = CTF_STRING_UTF8,
+       BT_CTF_STRING_ENCODING_ASCII = CTF_STRING_ASCII,
+       BT_CTF_STRING_ENCODING_UNKNOWN = CTF_STRING_UNKNOWN,
+};
+
 enum bt_ctf_scope {
        BT_CTF_SCOPE_UNKNOWN = -1,
        BT_CTF_SCOPE_ENV = 0,
@@ -156,9 +163,10 @@ extern int bt_ctf_field_type_integer_set_base(struct bt_ctf_field_type *integer,
  *
  * @param integer Integer type.
  *
- * Returns the string field's encoding on success, CTF_STRING_UNKNOWN on error.
+ * Returns the string field's encoding on success,
+ * BT_CTF_STRING_ENCODING_UNKNOWN on error.
  */
-extern enum ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
+extern enum bt_ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
                struct bt_ctf_field_type *integer);
 
 /*
@@ -168,13 +176,14 @@ extern enum ctf_string_encoding bt_ctf_field_type_integer_get_encoding(
  * a text character.
  *
  * @param integer Integer type.
- * @param encoding Integer output encoding, defaults to CTF_STRING_ENCODING_NONE
+ * @param encoding Integer output encoding, defaults to
+ *     BT_CTF_STRING_ENCODING_NONE
  *
  * Returns 0 on success, a negative value on error.
  */
 extern int bt_ctf_field_type_integer_set_encoding(
                struct bt_ctf_field_type *integer,
-               enum ctf_string_encoding encoding);
+               enum bt_ctf_string_encoding encoding);
 
 /**
  * bt_ctf_field_type_integer_get_mapped_clock: get an integer type's mapped clock.
@@ -682,9 +691,10 @@ extern struct bt_ctf_field_type *bt_ctf_field_type_string_create(void);
  *
  * @param string_type String type.
  *
- * Returns the string's encoding on success, a CTF_STRING_UNKNOWN on error.
+ * Returns the string's encoding on success, a BT_CTF_STRING_ENCODING_UNKNOWN
+ * on error.
  */
-extern enum ctf_string_encoding bt_ctf_field_type_string_get_encoding(
+extern enum bt_ctf_string_encoding bt_ctf_field_type_string_get_encoding(
                struct bt_ctf_field_type *string_type);
 
 /*
@@ -693,14 +703,15 @@ extern enum ctf_string_encoding bt_ctf_field_type_string_get_encoding(
  * Set the string type's encoding.
  *
  * @param string_type String type.
- * @param encoding String field encoding, default CTF_STRING_ENCODING_ASCII.
- *     Valid values are CTF_STRING_ENCODING_ASCII and CTF_STRING_ENCODING_UTF8.
+ * @param encoding String field encoding, default BT_CTF_STRING_ENCODING_ASCII.
+ *     Valid values are BT_CTF_STRING_ENCODING_ASCII and
+ *     BT_CTF_STRING_ENCODING_UTF8.
  *
  * Returns 0 on success, a negative value on error.
  */
 extern int bt_ctf_field_type_string_set_encoding(
                struct bt_ctf_field_type *string_type,
-               enum ctf_string_encoding encoding);
+               enum bt_ctf_string_encoding encoding);
 
 /*
  * bt_ctf_field_type_get_alignment: get a field type's alignment.
index f75daba95de4d8f407a000c133b2766e24a94d2a..86940d2d849be25a7e31e6bf728b1fb2c8f32231 100644 (file)
@@ -1961,17 +1961,20 @@ void type_field_tests()
                BT_CTF_INTEGER_BASE_HEXADECIMAL,
                "bt_ctf_field_type_integer_get_base returns a correct value");
 
-       ok(bt_ctf_field_type_integer_set_encoding(NULL, CTF_STRING_ASCII) < 0,
+       ok(bt_ctf_field_type_integer_set_encoding(NULL,
+               BT_CTF_STRING_ENCODING_ASCII) < 0,
                "bt_ctf_field_type_integer_set_encoding handles NULL correctly");
        ok(bt_ctf_field_type_integer_set_encoding(uint_12_type,
-               (enum ctf_string_encoding) 123) < 0,
+               (enum bt_ctf_string_encoding) 123) < 0,
                "bt_ctf_field_type_integer_set_encoding handles invalid encodings correctly");
        ok(bt_ctf_field_type_integer_set_encoding(uint_12_type,
-               CTF_STRING_UTF8) == 0,
+               BT_CTF_STRING_ENCODING_UTF8) == 0,
                "Set integer type encoding to UTF8");
-       ok(bt_ctf_field_type_integer_get_encoding(NULL) == CTF_STRING_UNKNOWN,
+       ok(bt_ctf_field_type_integer_get_encoding(NULL) ==
+               BT_CTF_STRING_ENCODING_UNKNOWN,
                "bt_ctf_field_type_integer_get_encoding handles NULL correctly");
-       ok(bt_ctf_field_type_integer_get_encoding(uint_12_type) == CTF_STRING_UTF8,
+       ok(bt_ctf_field_type_integer_get_encoding(uint_12_type) ==
+               BT_CTF_STRING_ENCODING_UTF8,
                "bt_ctf_field_type_integer_get_encoding returns a correct value");
 
        int_16_type = bt_ctf_field_type_integer_create(16);
@@ -2003,20 +2006,20 @@ void type_field_tests()
        string_type = bt_ctf_field_type_string_create();
        ok(string_type, "Create a string type");
        ok(bt_ctf_field_type_string_set_encoding(string_type,
-               CTF_STRING_NONE),
+               BT_CTF_STRING_ENCODING_NONE),
                "Reject invalid \"None\" string encoding");
        ok(bt_ctf_field_type_string_set_encoding(string_type,
                42),
                "Reject invalid string encoding");
        ok(bt_ctf_field_type_string_set_encoding(string_type,
-               CTF_STRING_ASCII) == 0,
+               BT_CTF_STRING_ENCODING_ASCII) == 0,
                "Set string encoding to ASCII");
 
        ok(bt_ctf_field_type_string_get_encoding(NULL) ==
-               CTF_STRING_UNKNOWN,
+               BT_CTF_STRING_ENCODING_UNKNOWN,
                "bt_ctf_field_type_string_get_encoding handles NULL correctly");
        ok(bt_ctf_field_type_string_get_encoding(string_type) ==
-               CTF_STRING_ASCII,
+               BT_CTF_STRING_ENCODING_ASCII,
                "bt_ctf_field_type_string_get_encoding returns the correct value");
 
        structure_seq_type = bt_ctf_field_type_structure_create();
This page took 0.030224 seconds and 4 git commands to generate.