Standardize *get_*() functions
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Apr 2017 21:27:23 +0000 (17:27 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:41 +0000 (12:57 -0400)
Make all getters that also have a "by name" version have the
`_by_index()` suffix. Use uint64_t for all indexes.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
55 files changed:
cli/babeltrace.c
include/babeltrace/ctf-ir/event-class-internal.h
include/babeltrace/ctf-ir/event-class.h
include/babeltrace/ctf-ir/event.h
include/babeltrace/ctf-ir/field-path.h
include/babeltrace/ctf-ir/field-types.h
include/babeltrace/ctf-ir/fields.h
include/babeltrace/ctf-ir/stream-class-internal.h
include/babeltrace/ctf-ir/stream-class.h
include/babeltrace/ctf-ir/trace-internal.h
include/babeltrace/ctf-ir/trace.h
include/babeltrace/graph/clock-class-priority-map.h
include/babeltrace/graph/component-filter.h
include/babeltrace/graph/component-internal.h
include/babeltrace/graph/component-sink.h
include/babeltrace/graph/component-source.h
include/babeltrace/graph/private-component-filter.h
include/babeltrace/graph/private-component-sink.h
include/babeltrace/graph/private-component-source.h
include/babeltrace/plugin/plugin.h
lib/ctf-ir/clock-class.c
lib/ctf-ir/event-class.c
lib/ctf-ir/event.c
lib/ctf-ir/field-path.c
lib/ctf-ir/field-types.c
lib/ctf-ir/fields.c
lib/ctf-ir/stream-class.c
lib/ctf-ir/stream.c
lib/ctf-ir/trace.c
lib/ctf-writer/writer.c
lib/graph/clock-class-priority-map.c
lib/graph/component.c
lib/graph/filter.c
lib/graph/graph.c
lib/graph/notification/event.c
lib/graph/sink.c
lib/graph/source.c
lib/plugin/plugin.c
lib/values.c
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/ctf/common/notif-iter/notif-iter.c
plugins/ctf/fs/fs.c
plugins/debug-info/copy.c
plugins/libctfcopytrace/clock-fields.c
plugins/libctfcopytrace/ctfcopytrace.c
plugins/libctfcopytrace/ctfcopytrace.h
plugins/text/pretty/print.c
plugins/utils/muxer/muxer.c
plugins/utils/trimmer/iterator.c
tests/lib/test_bt_ctf_field_type_validation.c
tests/lib/test_ctf_ir_ref.c
tests/lib/test_ctf_writer.c
tests/lib/test_graph_topo.c
tests/lib/test_plugin.c
tests/plugins/test-utils-muxer.c

index 1a699909b1447bf7d54b7b9f1583ffc9c3a95b5c..0ef2491bd6384d8a01cd15bd704cedca9293b758 100644 (file)
@@ -894,7 +894,7 @@ static int cmd_help(struct bt_config *cfg)
 
        for (i = 0; i < bt_plugin_get_component_class_count(plugin); i++) {
                struct bt_component_class *comp_cls =
-                       bt_plugin_get_component_class(plugin, i);
+                       bt_plugin_get_component_class_by_index(plugin, i);
                const char *comp_class_name =
                        bt_component_class_get_name(comp_cls);
                const char *comp_class_description =
@@ -1000,7 +1000,8 @@ static int cmd_list_plugins(struct bt_config *cfg)
 
                for (j = 0; j < component_classes_count; j++) {
                        struct bt_component_class *comp_class =
-                               bt_plugin_get_component_class(plugin, j);
+                               bt_plugin_get_component_class_by_index(
+                                       plugin, j);
                        const char *comp_class_name =
                                bt_component_class_get_name(comp_class);
                        const char *comp_class_description =
index c6a39162b05a369fe30c6eab903fb878a316179b..e6475fcdc44ec5bd73c861770a2f680dace0e561 100644 (file)
@@ -76,7 +76,7 @@ void bt_ctf_event_class_set_native_byte_order(
 
 BT_HIDDEN
 int bt_ctf_event_class_set_stream_id(struct bt_ctf_event_class *event_class,
-               uint32_t stream_id);
+               uint64_t stream_id);
 
 static inline
 struct bt_ctf_stream_class *bt_ctf_event_class_borrow_stream_class(
index 627919671fcab6117a8c557c0eeef84ab1926a31..5052f70fa551452ef09e745cf222b7f6e583e963 100644 (file)
@@ -216,13 +216,14 @@ of the stream class to which you eventually add \p event_class.
 
 @prenotnull{event_class}
 @prehot{event_class}
+@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX).
 @postrefcountsame{event_class}
 
 @sa bt_ctf_event_class_get_id(): Returns the numeric ID of a given
        event class.
 */
 extern int bt_ctf_event_class_set_id(
-               struct bt_ctf_event_class *event_class, uint32_t id);
+               struct bt_ctf_event_class *event_class, uint64_t id);
 
 /**
 @brief Returns the number of attributes contained in the CTF IR event
@@ -236,10 +237,10 @@ extern int bt_ctf_event_class_set_id(
 @prenotnull{event_class}
 @postrefcountsame{event_class}
 
-@sa bt_ctf_event_class_get_attribute_name(): Returns the name of
-       the attribute of a given event class at a given index.
-@sa bt_ctf_event_class_get_attribute_value(): Returns the value of
-       the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_name_by_index(): Returns the name
+       of the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_value_by_index(): Returns the value
+       of the attribute of a given event class at a given index.
 */
 extern int64_t bt_ctf_event_class_get_attribute_count(
                struct bt_ctf_event_class *event_class);
@@ -261,12 +262,12 @@ string.
        \p event_class.
 @postrefcountsame{event_class}
 
-@sa bt_ctf_event_class_get_attribute_value(): Returns the value of
-       the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_value_by_index(): Returns the value
+       of the attribute of a given event class at a given index.
 */
 extern const char *
-bt_ctf_event_class_get_attribute_name(
-               struct bt_ctf_event_class *event_class, int index);
+bt_ctf_event_class_get_attribute_name_by_index(
+               struct bt_ctf_event_class *event_class, uint64_t index);
 
 /**
 @brief Returns the value of the attribute at the index \p index of the
@@ -283,12 +284,12 @@ bt_ctf_event_class_get_attribute_name(
 @postsuccessrefcountretinc
 @postrefcountsame{event_class}
 
-@sa bt_ctf_event_class_get_attribute_name(): Returns the name of
-       the attribute of a given event class at a given index.
+@sa bt_ctf_event_class_get_attribute_name_by_index(): Returns the name
+       of the attribute of a given event class at a given index.
 */
 extern struct bt_value *
-bt_ctf_event_class_get_attribute_value(struct bt_ctf_event_class *event_class,
-               int index);
+bt_ctf_event_class_get_attribute_value_by_index(
+               struct bt_ctf_event_class *event_class, uint64_t index);
 
 /**
 @brief Returns the value of the attribute named \p name of the CTF IR
@@ -482,7 +483,7 @@ bt_ctf_field_type_structure_get_field_count().
 @prenotnull{event_class}
 @postrefcountsame{event_class}
 */
-extern int64_t bt_ctf_event_class_get_field_count(
+extern int64_t bt_ctf_event_class_get_payload_type_field_count(
                struct bt_ctf_event_class *event_class);
 
 /**
@@ -518,14 +519,15 @@ bt_ctf_field_type_structure_get_field().
 @prenotnull{event_class}
 @pre \p index is lesser than the number of fields contained in the
        payload field type of \p event_class (see
-       bt_ctf_event_class_get_field_count()).
+       bt_ctf_event_class_get_payload_type_field_count()).
 @postrefcountsame{event_class}
 @post <strong>On success, if \p field_type is not \c NULL</strong>, the
        reference count of \p *field_type is incremented.
 */
-extern int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class,
+extern int bt_ctf_event_class_get_payload_type_field_by_index(
+               struct bt_ctf_event_class *event_class,
                const char **field_name, struct bt_ctf_field_type **field_type,
-               int index);
+               uint64_t index);
 
 /**
 @brief  Returns the type of the field named \p name in the payload
@@ -550,9 +552,13 @@ bt_ctf_field_type_structure_get_field_type_by_name().
 @postrefcountsame{event_class}
 @postsuccessrefcountretinc
 */
-extern struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
+extern struct bt_ctf_field_type *
+bt_ctf_event_class_get_payload_type_field_type_by_name(
                struct bt_ctf_event_class *event_class, const char *name);
 
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_event_class_get_field_by_name bt_ctf_event_class_get_payload_type_field_type_by_name
+
 /**
 @brief Adds a field named \p name with the type \p field_type to the
        payload field type of the CTF IR event class \p event_class.
index 42d39269b46b68f2593c469ba8ba4b8890151d34..d42cc91d88233bd91fed716f8717b077cd5bc318 100644 (file)
@@ -140,7 +140,7 @@ struct bt_ctf_packet;
 On success, the four fields of the created event object are not set. You
 can set them with bt_ctf_event_set_header(),
 bt_ctf_event_set_stream_event_context(),
-bt_ctf_event_set_event_context(), and bt_ctf_event_set_payload_field().
+bt_ctf_event_set_event_context(), and bt_ctf_event_set_event_payload().
 
 This function tries to resolve the needed
 \link ctfirfieldtypes CTF IR field type\endlink of the dynamic field
@@ -411,10 +411,10 @@ extern int bt_ctf_event_set_event_context(struct bt_ctf_event *event,
 @postrefcountsame{event}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_event_set_payload_field(): Sets the payload field of a given
+@sa bt_ctf_event_set_event_payload(): Sets the payload field of a given
        event.
 */
-extern struct bt_ctf_field *bt_ctf_event_get_payload_field(
+extern struct bt_ctf_field *bt_ctf_event_get_event_payload(
                struct bt_ctf_event *event);
 
 /**
@@ -440,7 +440,7 @@ bt_ctf_event_class_get_payload_type() for the parent class of \p event.
 
 @sa bt_ctf_event_get_payload(): Returns the payload field of a given event.
 */
-extern int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
+extern int bt_ctf_event_set_event_payload(struct bt_ctf_event *event,
                struct bt_ctf_field *payload);
 
 /** @cond DOCUMENT */
@@ -482,7 +482,7 @@ extern struct bt_ctf_field *bt_ctf_event_get_payload(struct bt_ctf_event *event,
  * Note: Will return an error if the payload's type is not a structure.
  */
 extern struct bt_ctf_field *bt_ctf_event_get_payload_by_index(
-               struct bt_ctf_event *event, int index);
+               struct bt_ctf_event *event, uint64_t index);
 
 /*
  * TODO: Doxygenize.
@@ -536,7 +536,8 @@ extern int bt_ctf_event_set_payload(struct bt_ctf_event *event,
 @sa bt_ctf_event_set_clock_value(): Sets the clock value of a given event.
 */
 extern struct bt_ctf_clock_value *bt_ctf_event_get_clock_value(
-               struct bt_ctf_event *event, struct bt_ctf_clock_class *clock_class);
+               struct bt_ctf_event *event,
+               struct bt_ctf_clock_class *clock_class);
 
 /**
 @brief Sets the value, as of the CTF IR event \p event, of the
index e53b50f13c156ce09bbefb7108999949fd5831b6..cb2466aa666c63377314e33906844c717e9fb3eb 100644 (file)
@@ -130,8 +130,7 @@ extern int64_t bt_ctf_field_path_get_index_count(
 @postrefcountsame{field_path}
 */
 extern int bt_ctf_field_path_get_index(
-               const struct bt_ctf_field_path *field_path,
-               int index);
+               const struct bt_ctf_field_path *field_path, uint64_t index);
 
 /** @} */
 
index 3e35a8d04fa6135f5243b307f6d45782afb4f1af..6391f154e9680e60cba177878fd47c6663a8bdd1 100644 (file)
@@ -1378,7 +1378,7 @@ On success, \p enum_field_type remains the sole owner of \p *name.
        at a given index.
 */
 extern int bt_ctf_field_type_enumeration_get_mapping_signed(
-               struct bt_ctf_field_type *enum_field_type, int index,
+               struct bt_ctf_field_type *enum_field_type, uint64_t index,
                const char **name, int64_t *range_begin, int64_t *range_end);
 
 /**
@@ -1420,7 +1420,7 @@ On success, \p enum_field_type remains the sole owner of \p *name.
        at a given index.
 */
 extern int bt_ctf_field_type_enumeration_get_mapping_unsigned(
-               struct bt_ctf_field_type *enum_field_type, int index,
+               struct bt_ctf_field_type *enum_field_type, uint64_t index,
                const char **name, uint64_t *range_begin,
                uint64_t *range_end);
 
@@ -1955,10 +1955,13 @@ On success, the field's type is placed in \p *field_type if
 @sa bt_ctf_field_type_structure_get_field_type_by_name(): Finds a
        structure field type's field by name.
 */
-extern int bt_ctf_field_type_structure_get_field(
+extern int bt_ctf_field_type_structure_get_field_by_index(
                struct bt_ctf_field_type *struct_field_type,
                const char **field_name, struct bt_ctf_field_type **field_type,
-               int index);
+               uint64_t index);
+
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_type_structure_get_field bt_ctf_field_type_structure_get_field_by_index
 
 /**
 @brief  Returns the type of the field named \p field_name found in
@@ -1977,7 +1980,7 @@ extern int bt_ctf_field_type_structure_get_field(
 @postrefcountsame{struct_field_type}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_field_type_structure_get_field(): Finds a
+@sa bt_ctf_field_type_structure_get_field_by_index(): Finds a
        structure field type's field by index.
 */
 extern
@@ -2436,10 +2439,13 @@ On success, the field's type is placed in \p *field_type if
 @sa bt_ctf_field_type_variant_get_field_type_from_tag(): Finds a variant
        field type's field by current tag value.
 */
-extern int bt_ctf_field_type_variant_get_field(
+extern int bt_ctf_field_type_variant_get_field_by_index(
                struct bt_ctf_field_type *variant_field_type,
                const char **field_name,
-               struct bt_ctf_field_type **field_type, int index);
+               struct bt_ctf_field_type **field_type, uint64_t index);
+
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_type_variant_get_field bt_ctf_field_type_variant_get_field_by_index
 
 /**
 @brief  Returns the type of the field (choice) named \p field_name
@@ -2458,7 +2464,7 @@ extern int bt_ctf_field_type_variant_get_field(
 @postrefcountsame{variant_field_type}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_field_type_variant_get_field(): Finds a variant field type's
+@sa bt_ctf_field_type_variant_get_field_by_index(): Finds a variant field type's
        field by index.
 @sa bt_ctf_field_type_variant_get_field_type_from_tag(): Finds a variant
        field type's field by current tag value.
@@ -2494,7 +2500,7 @@ bt_ctf_field_type_variant_get_tag_type() for \p variant_field_type.
 @postrefcountsame{tag_field}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_field_type_variant_get_field(): Finds a variant field type's
+@sa bt_ctf_field_type_variant_get_field_by_index(): Finds a variant field type's
        field by index.
 @sa bt_ctf_field_type_variant_get_field_type_by_name(): Finds a variant
        field type's field by name.
index abdc3dd1593f7d6bffcdf3231046d7e648ba3723..5a030b356e7d4454b32c7c0d892291c3016b3dc5 100644 (file)
@@ -863,9 +863,12 @@ exist.
 @sa bt_ctf_field_structure_set_field(): Sets the field of a given
        structure field.
 */
-extern struct bt_ctf_field *bt_ctf_field_structure_get_field(
+extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
                struct bt_ctf_field *struct_field, const char *name);
 
+/* Pre-2.0 CTF writer compatibility */
+#define bt_ctf_field_structure_get_field bt_ctf_field_structure_get_field_by_name
+
 /**
 @brief  Returns the @field at index \p index in the @structfield
        \p struct_field.
@@ -890,7 +893,7 @@ extern struct bt_ctf_field *bt_ctf_field_structure_get_field(
        structure field.
 */
 extern struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
-               struct bt_ctf_field *struct_field, int index);
+               struct bt_ctf_field *struct_field, uint64_t index);
 
 /**
 @brief Sets the field of the @structfield \p struct_field named \p name
index b8366aaabd64a757d75384ccb533265b51a53996..0dc33b136420891913a7cc7ec5b15d58c66cb185 100644 (file)
@@ -45,9 +45,9 @@ struct bt_ctf_stream_class {
        /* event class id (int64_t) to event class */
        GHashTable *event_classes_ht;
        int id_set;
-       uint32_t id;
-       uint32_t next_event_id;
-       uint32_t next_stream_id;
+       int64_t id;
+       int64_t next_event_id;
+       int64_t next_stream_id;
        struct bt_ctf_field_type *packet_context_type;
        struct bt_ctf_field_type *event_header_type;
        struct bt_ctf_field_type *event_context_type;
@@ -75,11 +75,11 @@ void bt_ctf_stream_class_set_byte_order(
 /* Set stream_class id without checking if the stream class is frozen */
 BT_HIDDEN
 int _bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class,
-               uint32_t id);
+               int64_t id);
 
 BT_HIDDEN
 int bt_ctf_stream_class_set_id_no_check(
-               struct bt_ctf_stream_class *stream_class, uint32_t id);
+               struct bt_ctf_stream_class *stream_class, int64_t id);
 
 static inline
 struct bt_ctf_trace *bt_ctf_stream_class_borrow_trace(
index dc7b35d6ec436fd99005919ad06d19ac054bb87e..6a0e2e135f11fa1df2d961e2a1f0affedb4aa4e9 100644 (file)
@@ -274,13 +274,14 @@ of the trace class to which you eventually add \p stream_class.
 
 @prenotnull{stream_class}
 @prehot{stream_class}
+@pre \p id is lesser than or equal to 9223372036854775807 (\c INT64_MAX).
 @postrefcountsame{stream_class}
 
 @sa bt_ctf_stream_class_get_id(): Returns the numeric ID of a given
        stream class.
 */
 extern int bt_ctf_stream_class_set_id(
-               struct bt_ctf_stream_class *stream_class, uint32_t id);
+               struct bt_ctf_stream_class *stream_class, uint64_t id);
 
 /** @} */
 
@@ -498,8 +499,8 @@ extern int64_t bt_ctf_stream_class_get_event_class_count(
 @sa bt_ctf_stream_class_get_event_class_by_name(): Finds an event class
        by name.
 */
-extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class(
-               struct bt_ctf_stream_class *stream_class, int index);
+extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index(
+               struct bt_ctf_stream_class *stream_class, uint64_t index);
 
 /**
 @brief  Returns the event class named \c name found in the CTF IR stream
@@ -538,7 +539,7 @@ extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_name(
        by name.
 */
 extern struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id(
-               struct bt_ctf_stream_class *stream_class, uint32_t id);
+               struct bt_ctf_stream_class *stream_class, uint64_t id);
 
 /**
 @brief Adds the CTF IR event class \p event_class to the
index 8b6c1f5a45ec6e99850b3c0de3a9478bb91a56e5..c3121cbd8ba54cbbc85c177a06b4c04ff74ed403 100644 (file)
@@ -58,7 +58,7 @@ struct bt_ctf_trace {
        GPtrArray *stream_classes; /* Array of ptrs to bt_ctf_stream_class */
        GPtrArray *streams; /* Array of ptrs to bt_ctf_stream */
        struct bt_ctf_field_type *packet_header_type;
-       uint64_t next_stream_id;
+       int64_t next_stream_id;
        int is_created_by_writer;
 
        /*
index 16cec454542d7b95c62b3fe2a24616f90d3df512..4286df93c24a43dc68a590bb977df2730eb15a45 100644 (file)
@@ -78,7 +78,7 @@ trace class with bt_ctf_trace_add_stream_class().
 
 You can access the streams of a trace, that is, the streams which were
 created from the trace's stream classes with bt_ctf_stream_create(),
-with bt_ctf_trace_get_stream().
+with bt_ctf_trace_get_stream_by_index().
 
 A trace class owns the <strong>trace packet header</strong>
 \link ctfirfieldtypes field type\endlink, which represents the
@@ -315,7 +315,7 @@ the returned string.
        \p trace_class (see bt_ctf_trace_get_environment_field_count()).
 @postrefcountsame{trace_class}
 
-@sa bt_ctf_trace_get_environment_field_value(): Finds a trace class's
+@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
        environment entry by index.
 @sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
        class's environment entry by name.
@@ -323,8 +323,8 @@ the returned string.
        class's environment entry.
 */
 extern const char *
-bt_ctf_trace_get_environment_field_name(struct bt_ctf_trace *trace_class,
-               int index);
+bt_ctf_trace_get_environment_field_name_by_index(
+               struct bt_ctf_trace *trace_class, uint64_t index);
 
 /**
 @brief Returns the value of the environment entry at index
@@ -348,8 +348,8 @@ bt_ctf_trace_get_environment_field_name(struct bt_ctf_trace *trace_class,
        class's environment entry.
 */
 extern struct bt_value *
-bt_ctf_trace_get_environment_field_value(struct bt_ctf_trace *trace_class,
-               int index);
+bt_ctf_trace_get_environment_field_value_by_index(struct bt_ctf_trace *trace_class,
+               uint64_t index);
 
 /**
 @brief Returns the value of the environment entry named \p name
@@ -367,7 +367,7 @@ bt_ctf_trace_get_environment_field_value(struct bt_ctf_trace *trace_class,
 @postrefcountsame{trace_class}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_trace_get_environment_field_value(): Finds a trace class's
+@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
        environment entry by index.
 @sa bt_ctf_trace_set_environment_field(): Sets the value of a trace
        class's environment entry.
@@ -401,7 +401,7 @@ value is first put, and then replaced by \p value.
 @postrefcountsame{trace_class}
 @postsuccessrefcountinc{value}
 
-@sa bt_ctf_trace_get_environment_field_value(): Finds a trace class's
+@sa bt_ctf_trace_get_environment_field_value_by_index(): Finds a trace class's
        environment entry by index.
 @sa bt_ctf_trace_get_environment_field_value_by_name(): Finds a trace
        class's environment entry by name.
@@ -573,8 +573,8 @@ extern int64_t bt_ctf_trace_get_clock_class_count(
        in a given trace class.
 @sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class.
 */
-extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class(
-               struct bt_ctf_trace *trace_class, int index);
+extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index(
+               struct bt_ctf_trace *trace_class, uint64_t index);
 
 /**
 @brief  Returns the CTF IR clock class named \c name found in the CTF
@@ -591,7 +591,7 @@ extern struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class(
 @postrefcountsame{trace_class}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_trace_get_clock_class(): Returns the clock class contained
+@sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained
        in a given trace class at a given index.
 @sa bt_ctf_trace_add_clock_class(): Adds a clock class to a trace class.
 */
@@ -618,7 +618,7 @@ are frozen.
 @post <strong>On success, if \p trace_class is frozen</strong>,
        \p clock_class is frozen.
 
-@sa bt_ctf_trace_get_clock_class(): Returns the clock class contained
+@sa bt_ctf_trace_get_clock_class_by_index(): Returns the clock class contained
        in a given trace class at a given index.
 @sa bt_ctf_trace_get_clock_class_by_name(): Finds a clock class by name
        in a given trace class.
@@ -667,8 +667,8 @@ extern int64_t bt_ctf_trace_get_stream_class_count(
 @sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID.
 @sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class.
 */
-extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class(
-               struct bt_ctf_trace *trace_class, int index);
+extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
+               struct bt_ctf_trace *trace_class, uint64_t index);
 
 /**
 @brief  Returns the stream class with ID \c id found in the CTF IR
@@ -683,12 +683,12 @@ extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class(
 @postrefcountsame{trace_class}
 @postsuccessrefcountretinc
 
-@sa bt_ctf_trace_get_stream_class(): Returns the stream class contained
+@sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained
        in a given trace class at a given index.
 @sa bt_ctf_trace_add_stream_class(): Adds a stream class to a trace class.
 */
 extern struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
-               struct bt_ctf_trace *trace_class, uint32_t id);
+               struct bt_ctf_trace *trace_class, uint64_t id);
 
 /**
 @brief Adds the CTF IR stream class \p stream_class to the
@@ -717,7 +717,7 @@ resolving fails, then this function fails.
 @postsuccessrefcountinc{stream_class}
 @postsuccessfrozen{stream_class}
 
-@sa bt_ctf_trace_get_stream_class(): Returns the stream class contained
+@sa bt_ctf_trace_get_stream_class_by_index(): Returns the stream class contained
        in a given trace class at a given index.
 @sa bt_ctf_trace_get_stream_class_by_id(): Finds a stream class by ID.
 */
@@ -761,8 +761,8 @@ extern int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace_class);
        bt_ctf_trace_get_stream_count()).
 @postrefcountsame{trace_class}
 */
-extern struct bt_ctf_stream *bt_ctf_trace_get_stream(
-               struct bt_ctf_trace *trace_class, int index);
+extern struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
+               struct bt_ctf_trace *trace_class, uint64_t index);
 
 /** @} */
 
index f810a4436d80fb819f773bbbc2823ddc56997c55..bda9eb3b3246bf226d9d2110f9429f52a284af3d 100644 (file)
@@ -139,9 +139,10 @@ extern int64_t bt_clock_class_priority_map_get_clock_class_count(
 @sa bt_clock_class_priority_map_add_clock_class(): Adds a clock class
        to a clock class priority map.
 */
-extern struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class(
+extern struct bt_ctf_clock_class *
+bt_clock_class_priority_map_get_clock_class_by_index(
                struct bt_clock_class_priority_map *clock_class_priority_map,
-               unsigned int index);
+               uint64_t index);
 
 /**
 @brief  Returns the CTF IR clock class named \c name found in the clock
@@ -161,7 +162,7 @@ extern struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class(
 @postrefcountsame{clock_class_priority_map}
 @postsuccessrefcountretinc
 
-@sa bt_clock_class_priority_map_get_clock_class(): Returns the clock
+@sa bt_clock_class_priority_map_get_clock_class_by_index(): Returns the clock
        class contained in a given clock class priority map at
        a given index.
 @sa bt_clock_class_priority_map_get_highest_priority_clock_class():
@@ -198,7 +199,7 @@ this function returns.
 @postrefcountsame{clock_class_priority_map}
 @postsuccessrefcountretinc
 
-@sa bt_clock_class_priority_map_get_clock_class(): Returns the clock
+@sa bt_clock_class_priority_map_get_clock_class_by_index(): Returns the clock
        class contained in a given clock class priority map at
        a given index.
 @sa bt_clock_class_priority_map_get_clock_class_by_name(): Finds a
@@ -270,7 +271,7 @@ map.
 @postrefcountsame{clock_class_priority_map}
 @postsuccessrefcountinc{clock_class}
 
-@sa bt_clock_class_priority_map_get_clock_class(): Returns the clock
+@sa bt_clock_class_priority_map_get_clock_class_by_index(): Returns the clock
        class contained in a given clock class priority map
        at a given index.
 @sa bt_clock_class_priority_map_get_clock_class_by_name(): Finds a
index 557432d87c5e0451d05dbab0b51d76d221553950..43da9db00e9afd2bb49283f05db3425e2c87d420 100644 (file)
@@ -39,19 +39,19 @@ struct bt_component;
 
 extern int64_t bt_component_filter_get_input_port_count(
                struct bt_component *component);
-extern struct bt_port *bt_component_filter_get_input_port(
+extern struct bt_port *bt_component_filter_get_input_port_by_name(
                struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_filter_get_input_port_at_index(
-               struct bt_component *component, int index);
+extern struct bt_port *bt_component_filter_get_input_port_by_index(
+               struct bt_component *component, uint64_t index);
 extern struct bt_port *bt_component_filter_get_default_input_port(
                struct bt_component *component);
 
 extern int64_t bt_component_filter_get_output_port_count(
                struct bt_component *component);
-extern struct bt_port *bt_component_filter_get_output_port(
+extern struct bt_port *bt_component_filter_get_output_port_by_name(
                struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_filter_get_output_port_at_index(
-               struct bt_component *component, int index);
+extern struct bt_port *bt_component_filter_get_output_port_by_index(
+               struct bt_component *component, uint64_t index);
 extern struct bt_port *bt_component_filter_get_default_output_port(
                struct bt_component *component);
 
index ae08b8b7ddfd61f71d4738210691dc787915cf8d..f6ed6ac77f00d2d00434aa49026429ed4ca673d8 100644 (file)
@@ -112,19 +112,19 @@ BT_HIDDEN
 int64_t bt_component_get_output_port_count(struct bt_component *comp);
 
 BT_HIDDEN
-struct bt_port *bt_component_get_input_port_at_index(struct bt_component *comp,
-               int index);
+struct bt_port *bt_component_get_input_port_by_index(struct bt_component *comp,
+               uint64_t index);
 
 BT_HIDDEN
-struct bt_port *bt_component_get_output_port_at_index(struct bt_component *comp,
-               int index);
+struct bt_port *bt_component_get_output_port_by_index(struct bt_component *comp,
+               uint64_t index);
 
 BT_HIDDEN
-struct bt_port *bt_component_get_input_port(struct bt_component *comp,
+struct bt_port *bt_component_get_input_port_by_name(struct bt_component *comp,
                const char *name);
 
 BT_HIDDEN
-struct bt_port *bt_component_get_output_port(struct bt_component *comp,
+struct bt_port *bt_component_get_output_port_by_name(struct bt_component *comp,
                const char *name);
 
 BT_HIDDEN
index 3c462bffe56e6327cd0fc129d00b746b22317bc4..96a935c51c7caf581b8970e661897ab05cebf18e 100644 (file)
@@ -27,6 +27,7 @@
  * SOFTWARE.
  */
 
+#include <stdint.h>
 #include <babeltrace/graph/component.h>
 
 #ifdef __cplusplus
@@ -38,10 +39,10 @@ struct bt_notification;
 
 extern int64_t bt_component_sink_get_input_port_count(
                struct bt_component *component);
-extern struct bt_port *bt_component_sink_get_input_port(
+extern struct bt_port *bt_component_sink_get_input_port_by_name(
                struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_sink_get_input_port_at_index(
-               struct bt_component *component, int index);
+extern struct bt_port *bt_component_sink_get_input_port_by_index(
+               struct bt_component *component, uint64_t index);
 extern struct bt_port *bt_component_sink_get_default_input_port(
                struct bt_component *component);
 
index 24a8c0069b47bb968f7f9f09550f918293b532b8..75cf02138b15ac4cff5f1f80f4fe6e50ea04018f 100644 (file)
@@ -39,10 +39,10 @@ struct bt_notification_iterator;
 
 extern int64_t bt_component_source_get_output_port_count(
                struct bt_component *component);
-extern struct bt_port *bt_component_source_get_output_port(
+extern struct bt_port *bt_component_source_get_output_port_by_name(
                struct bt_component *component, const char *name);
-extern struct bt_port *bt_component_source_get_output_port_at_index(
-               struct bt_component *component, int index);
+extern struct bt_port *bt_component_source_get_output_port_by_index(
+               struct bt_component *component, uint64_t index);
 extern struct bt_port *bt_component_source_get_default_output_port(
                struct bt_component *component);
 
index 4c52d0f403ded2380591b683405884d3e5563d92..51944afd3c1c2b99b2cc6e9a0c72157f9f2eeef7 100644 (file)
@@ -23,6 +23,7 @@
  * SOFTWARE.
  */
 
+#include <stdint.h>
 #include <babeltrace/graph/component.h>
 
 #ifdef __cplusplus
@@ -33,13 +34,13 @@ struct bt_private_component;
 struct bt_private_port;
 
 extern struct bt_private_port *
-bt_private_component_filter_get_output_private_port(
+bt_private_component_filter_get_output_private_port_by_name(
                struct bt_private_component *private_component,
                const char *name);
 
 extern struct bt_private_port *
-bt_private_component_filter_get_output_private_port_at_index(
-               struct bt_private_component *private_component, int index);
+bt_private_component_filter_get_output_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index);
 
 extern struct bt_private_port *
 bt_private_component_filter_get_default_output_private_port(
@@ -51,13 +52,13 @@ bt_private_component_filter_add_output_private_port(
                const char *name);
 
 extern struct bt_private_port *
-bt_private_component_filter_get_input_private_port(
+bt_private_component_filter_get_input_private_port_by_name(
                struct bt_private_component *private_component,
                const char *name);
 
 extern struct bt_private_port *
-bt_private_component_filter_get_input_private_port_at_index(
-               struct bt_private_component *private_component, int index);
+bt_private_component_filter_get_input_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index);
 
 extern struct bt_private_port *
 bt_private_component_filter_get_default_input_private_port(
index 52178aebc43bf40a4fa7f896380b5d199a4dfcde..db3e71f1d7a109854e7171577713b346c2a20c96 100644 (file)
@@ -23,6 +23,7 @@
  * SOFTWARE.
  */
 
+#include <stdint.h>
 #include <babeltrace/graph/component.h>
 
 #ifdef __cplusplus
@@ -33,13 +34,13 @@ struct bt_private_component;
 struct bt_private_port;
 
 extern struct bt_private_port *
-bt_private_component_sink_get_input_private_port(
+bt_private_component_sink_get_input_private_port_by_name(
                struct bt_private_component *private_component,
                const char *name);
 
 extern struct bt_private_port *
-bt_private_component_sink_get_input_private_port_at_index(
-               struct bt_private_component *private_component, int index);
+bt_private_component_sink_get_input_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index);
 
 extern struct bt_private_port *
 bt_private_component_sink_get_default_input_private_port(
index d74df865feb8a6fdc4352a3da6dea16cfdd32602..257e6485e98ad39d63969fae67dae61eeb6cccbd 100644 (file)
@@ -23,6 +23,7 @@
  * SOFTWARE.
  */
 
+#include <stdint.h>
 #include <babeltrace/graph/component.h>
 
 #ifdef __cplusplus
@@ -33,13 +34,14 @@ struct bt_private_component;
 struct bt_private_port;
 
 extern struct bt_private_port *
-bt_private_component_source_get_output_private_port(
+bt_private_component_source_get_output_private_port_by_name(
                struct bt_private_component *private_component,
                const char *name);
 
 extern struct bt_private_port *
-bt_private_component_source_get_output_private_port_at_index(
-               struct bt_private_component *private_component, int index);
+bt_private_component_source_get_output_private_port_by_index(
+               struct bt_private_component *private_component,
+               uint64_t index);
 
 extern struct bt_private_port *
 bt_private_component_source_get_default_output_private_port(
index 64192b3d3a0a9ec19b26a8c76d0df9a48d24810a..1738c27df0d2e29b3b4e6bf6dc046aa7bbf78d7f 100644 (file)
@@ -112,8 +112,8 @@ extern enum bt_plugin_status bt_plugin_get_version(struct bt_plugin *plugin,
 
 extern int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin);
 
-extern struct bt_component_class *bt_plugin_get_component_class(
-               struct bt_plugin *plugin, size_t index);
+extern struct bt_component_class *bt_plugin_get_component_class_by_index(
+               struct bt_plugin *plugin, uint64_t index);
 
 extern
 struct bt_component_class *bt_plugin_get_component_class_by_name_and_type(
@@ -125,7 +125,7 @@ int64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set);
 
 extern
 struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set,
-               unsigned int index);
+               uint64_t index);
 
 #ifdef __cplusplus
 }
index 9760d731286046ee1677304ad32dbf69dc02e401..96fd2c33ba9071ba8f95407d1d75182cb6dbbf45 100644 (file)
@@ -171,7 +171,7 @@ int bt_ctf_clock_class_set_frequency(struct bt_ctf_clock_class *clock_class,
 {
        int ret = 0;
 
-       if (!clock_class || clock_class->frozen) {
+       if (!clock_class || clock_class->frozen || freq == -1ULL) {
                ret = -1;
                goto end;
        }
@@ -199,7 +199,7 @@ int bt_ctf_clock_class_set_precision(struct bt_ctf_clock_class *clock_class,
 {
        int ret = 0;
 
-       if (!clock_class || clock_class->frozen) {
+       if (!clock_class || clock_class->frozen || precision == -1ULL) {
                ret = -1;
                goto end;
        }
@@ -467,7 +467,7 @@ int bt_ctf_clock_value_get_value_ns_from_epoch(struct bt_ctf_clock_value *value,
        }
 
        /* Initialize nanosecond timestamp to clock's offset in seconds. */
-       ns = value->clock_class->offset_s * 1000000000;
+       ns = value->clock_class->offset_s * (int64_t) 1000000000;
 
        /* Add offset in cycles, converted to nanoseconds. */
        ns += ns_from_value(value->clock_class->frequency,
index c50e39bfa1b8a121bc8e89b2bd1944c14efc2af4..e37331f091ed5bcbf6987d781fbfbf7f738e3fb0 100644 (file)
@@ -140,12 +140,12 @@ int64_t bt_ctf_event_class_get_id(struct bt_ctf_event_class *event_class)
        int64_t ret = 0;
 
        if (!event_class) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
        if (event_class->id >= 0) {
-               ret = event_class->id;
+               ret = (int64_t) event_class->id;
                goto end;
        }
 
@@ -156,12 +156,12 @@ int64_t bt_ctf_event_class_get_id(struct bt_ctf_event_class *event_class)
        }
 
        if (bt_value_integer_get(obj, &ret)) {
-               ret = -1;
+               ret = (int64_t) -1;
        }
 
        if (ret < 0) {
                /* means ID is not set */
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -171,14 +171,14 @@ end:
 }
 
 int bt_ctf_event_class_set_id(struct bt_ctf_event_class *event_class,
-               uint32_t id)
+               uint64_t id_param)
 {
        int ret = 0;
        struct bt_value *obj = NULL;
        struct bt_ctf_stream_class *stream_class = NULL;
+       int64_t id = (int64_t) id_param;
 
-
-       if (!event_class) {
+       if (!event_class || id < 0) {
                ret = -1;
                goto end;
        }
@@ -265,10 +265,10 @@ end:
 int64_t bt_ctf_event_class_get_attribute_count(
                struct bt_ctf_event_class *event_class)
 {
-       int64_t ret = 0;
+       int64_t ret;
 
        if (!event_class) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -279,8 +279,8 @@ end:
 }
 
 const char *
-bt_ctf_event_class_get_attribute_name(
-               struct bt_ctf_event_class *event_class, int index)
+bt_ctf_event_class_get_attribute_name_by_index(
+               struct bt_ctf_event_class *event_class, uint64_t index)
 {
        const char *ret;
 
@@ -296,8 +296,8 @@ end:
 }
 
 struct bt_value *
-bt_ctf_event_class_get_attribute_value(struct bt_ctf_event_class *event_class,
-               int index)
+bt_ctf_event_class_get_attribute_value_by_index(
+               struct bt_ctf_event_class *event_class, uint64_t index)
 {
        struct bt_value *ret;
 
@@ -400,19 +400,19 @@ end:
        return ret;
 }
 
-int64_t bt_ctf_event_class_get_field_count(
+int64_t bt_ctf_event_class_get_payload_type_field_count(
                struct bt_ctf_event_class *event_class)
 {
        int64_t ret;
 
        if (!event_class) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
        if (bt_ctf_field_type_get_type_id(event_class->fields) !=
                BT_CTF_FIELD_TYPE_ID_STRUCT) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -421,13 +421,14 @@ end:
        return ret;
 }
 
-int bt_ctf_event_class_get_field(struct bt_ctf_event_class *event_class,
+int bt_ctf_event_class_get_payload_type_field_by_index(
+               struct bt_ctf_event_class *event_class,
                const char **field_name, struct bt_ctf_field_type **field_type,
-               int index)
+               uint64_t index)
 {
        int ret;
 
-       if (!event_class || index < 0) {
+       if (!event_class) {
                ret = -1;
                goto end;
        }
@@ -444,7 +445,8 @@ end:
        return ret;
 }
 
-struct bt_ctf_field_type *bt_ctf_event_class_get_field_by_name(
+struct bt_ctf_field_type *
+bt_ctf_event_class_get_payload_type_field_type_by_name(
                struct bt_ctf_event_class *event_class, const char *name)
 {
        GQuark name_quark;
@@ -525,10 +527,18 @@ void bt_ctf_event_class_put(struct bt_ctf_event_class *event_class)
 
 BT_HIDDEN
 int bt_ctf_event_class_set_stream_id(struct bt_ctf_event_class *event_class,
-               uint32_t stream_id)
+               uint64_t stream_id_param)
 {
        int ret = 0;
-       struct bt_value *obj;
+       struct bt_value *obj = NULL;
+       int64_t stream_id = (int64_t) stream_id_param;
+
+       assert(event_class);
+
+       if (stream_id < 0) {
+               ret = -1;
+               goto end;
+       }
 
        obj = bt_value_integer_create_init(stream_id);
 
@@ -598,9 +608,9 @@ int bt_ctf_event_class_serialize(struct bt_ctf_event_class *event_class,
        for (i = 0; i < count; ++i) {
                const char *attr_name = NULL;
 
-               attr_name = bt_ctf_event_class_get_attribute_name(
+               attr_name = bt_ctf_event_class_get_attribute_name_by_index(
                        event_class, i);
-               attr_value = bt_ctf_event_class_get_attribute_value(
+               attr_value = bt_ctf_event_class_get_attribute_value_by_index(
                        event_class, i);
 
                if (!attr_name || !attr_value) {
index ff153559ae1962dacf27f562f666112936c4ac89..a92c4301b90bdb6ce859bf755e3b7fdbe302a2f2 100644 (file)
@@ -316,7 +316,7 @@ end:
        return ret;
 }
 
-struct bt_ctf_field *bt_ctf_event_get_payload_field(struct bt_ctf_event *event)
+struct bt_ctf_field *bt_ctf_event_get_event_payload(struct bt_ctf_event *event)
 {
        struct bt_ctf_field *payload = NULL;
 
@@ -330,7 +330,7 @@ end:
        return payload;
 }
 
-int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
+int bt_ctf_event_set_event_payload(struct bt_ctf_event *event,
                struct bt_ctf_field *payload)
 {
        int ret = 0;
@@ -381,11 +381,11 @@ end:
 }
 
 struct bt_ctf_field *bt_ctf_event_get_payload_by_index(
-               struct bt_ctf_event *event, int index)
+               struct bt_ctf_event *event, uint64_t index)
 {
        struct bt_ctf_field *field = NULL;
 
-       if (!event || index < 0) {
+       if (!event) {
                goto end;
        }
 
index a3d42352709410dce141511fbe3b3d46a1b18526..bc991f4070943d5d0c901bdbb81ac5b0d634b5ff 100644 (file)
@@ -115,24 +115,15 @@ end:
 int64_t bt_ctf_field_path_get_index_count(
                const struct bt_ctf_field_path *field_path)
 {
-       int64_t ret = -1;
-
-       if (!field_path) {
-               goto end;
-       }
-
-       ret = field_path->indexes->len;
-
-end:
-       return ret;
+       return field_path ? (int64_t) field_path->indexes->len : (int64_t) -1;
 }
 
 int bt_ctf_field_path_get_index(const struct bt_ctf_field_path *field_path,
-               int index)
+               uint64_t index)
 {
        int ret = INT_MIN;
 
-       if (!field_path || index < 0) {
+       if (!field_path) {
                goto end;
        }
 
index 442aff0e9e2b2b8c990ce3e1ac83dcab130f4114..2c334183ee4b631a60dc1697e189efbee97a40e2 100644 (file)
@@ -599,7 +599,7 @@ int bt_ctf_field_type_structure_validate(struct bt_ctf_field_type *type)
        }
 
        for (i = 0; i < field_count; ++i) {
-               ret = bt_ctf_field_type_structure_get_field(type,
+               ret = bt_ctf_field_type_structure_get_field_by_index(type,
                        NULL, &child_type, i);
                if (ret) {
                        goto end;
@@ -720,7 +720,7 @@ int bt_ctf_field_type_variant_validate(struct bt_ctf_field_type *type)
        }
 
        for (i = 0; i < field_count; ++i) {
-               ret = bt_ctf_field_type_variant_get_field(type,
+               ret = bt_ctf_field_type_variant_get_field_by_index(type,
                        NULL, &child_type, i);
                if (ret) {
                        goto end;
@@ -1201,14 +1201,13 @@ end:
 
 int bt_ctf_field_type_enumeration_get_mapping_signed(
                struct bt_ctf_field_type *enum_field_type,
-               int index,
-               const char **mapping_name, int64_t *range_begin,
+               uint64_t index, const char **mapping_name, int64_t *range_begin,
                int64_t *range_end)
 {
        int ret = 0;
        struct enumeration_mapping *mapping;
 
-       if (!enum_field_type || index < 0) {
+       if (!enum_field_type) {
                ret = -1;
                goto end;
        }
@@ -1236,14 +1235,14 @@ end:
 
 int bt_ctf_field_type_enumeration_get_mapping_unsigned(
                struct bt_ctf_field_type *enum_field_type,
-               int index,
+               uint64_t index,
                const char **mapping_name, uint64_t *range_begin,
                uint64_t *range_end)
 {
        int ret = 0;
        struct enumeration_mapping *mapping;
 
-       if (!enum_field_type || index < 0) {
+       if (!enum_field_type) {
                ret = -1;
                goto end;
        }
@@ -1428,7 +1427,7 @@ int64_t bt_ctf_field_type_enumeration_get_mapping_count(
        struct bt_ctf_field_type_enumeration *enumeration;
 
        if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ENUM)) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -1604,7 +1603,7 @@ int64_t bt_ctf_field_type_structure_get_field_count(
        struct bt_ctf_field_type_structure *structure;
 
        if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT)) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -1615,16 +1614,16 @@ end:
        return ret;
 }
 
-int bt_ctf_field_type_structure_get_field(struct bt_ctf_field_type *type,
+int bt_ctf_field_type_structure_get_field_by_index(
+               struct bt_ctf_field_type *type,
                const char **field_name, struct bt_ctf_field_type **field_type,
-               int index)
+               uint64_t index)
 {
        struct bt_ctf_field_type_structure *structure;
        struct structure_field *field;
        int ret = 0;
 
-       if (!type || index < 0 ||
-                       (type->id != BT_CTF_FIELD_TYPE_ID_STRUCT)) {
+       if (!type || type->id != BT_CTF_FIELD_TYPE_ID_STRUCT) {
                ret = -1;
                goto end;
        }
@@ -1897,7 +1896,7 @@ int64_t bt_ctf_field_type_variant_get_field_count(struct bt_ctf_field_type *type
        struct bt_ctf_field_type_variant *variant;
 
        if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -1909,16 +1908,15 @@ end:
 
 }
 
-int bt_ctf_field_type_variant_get_field(struct bt_ctf_field_type *type,
+int bt_ctf_field_type_variant_get_field_by_index(struct bt_ctf_field_type *type,
                const char **field_name, struct bt_ctf_field_type **field_type,
-               int index)
+               uint64_t index)
 {
        struct bt_ctf_field_type_variant *variant;
        struct structure_field *field;
        int ret = 0;
 
-       if (!type || index < 0 ||
-                       (type->id != BT_CTF_FIELD_TYPE_ID_VARIANT)) {
+       if (!type || type->id != BT_CTF_FIELD_TYPE_ID_VARIANT) {
                ret = -1;
                goto end;
        }
@@ -2016,7 +2014,7 @@ int64_t bt_ctf_field_type_array_get_length(struct bt_ctf_field_type *type)
        struct bt_ctf_field_type_array *array;
 
        if (!type || (type->id != BT_CTF_FIELD_TYPE_ID_ARRAY)) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -2224,8 +2222,8 @@ int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type)
                        struct bt_ctf_field_type *field;
                        int field_alignment;
 
-                       ret = bt_ctf_field_type_structure_get_field(type, NULL,
-                               &field, i);
+                       ret = bt_ctf_field_type_structure_get_field_by_index(
+                               type, NULL, &field, i);
                        if (ret) {
                                goto end;
                        }
@@ -4126,13 +4124,13 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index(
 
        switch (type_id) {
        case CTF_TYPE_STRUCT:
-               bt_ctf_field_type_structure_get_field(field_type, NULL, &field,
-                       index);
+               bt_ctf_field_type_structure_get_field_by_index(field_type,
+                       NULL, &field, index);
                break;
        case CTF_TYPE_VARIANT:
        {
-               int ret = bt_ctf_field_type_variant_get_field(field_type, NULL,
-                       &field, index);
+               int ret = bt_ctf_field_type_variant_get_field_by_index(
+                       field_type, NULL, &field, index);
                if (ret) {
                        field = NULL;
                        goto end;
index c43b4afa4e57da06a5c0890d2a7a7e514551f23f..28a5e9375a883e5e40db47e4babd25c2e1c02bc1 100644 (file)
@@ -469,7 +469,7 @@ end:
        return ret;
 }
 
-struct bt_ctf_field *bt_ctf_field_structure_get_field(
+struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
                struct bt_ctf_field *field, const char *name)
 {
        struct bt_ctf_field *new_field = NULL;
@@ -520,7 +520,7 @@ error:
 }
 
 struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
-               struct bt_ctf_field *field, int index)
+               struct bt_ctf_field *field, uint64_t index)
 {
        int ret;
        const char *field_name;
@@ -674,7 +674,7 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field,
        }
 
        sequence = container_of(field, struct bt_ctf_field_sequence, parent);
-       if (!sequence->elements || sequence->elements->len <= index) {
+       if (!sequence->elements || index >= sequence->elements->len) {
                goto end;
        }
 
index 1cab9590434ef710744e8568dac3de397c4d718e..f9d91aaf651323fbe40611285b90b6896bd9ddc3 100644 (file)
@@ -196,45 +196,45 @@ int64_t bt_ctf_stream_class_get_id(struct bt_ctf_stream_class *stream_class)
        int64_t ret;
 
        if (!stream_class || !stream_class->id_set) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
-       ret = (int64_t) stream_class->id;
+       ret = stream_class->id;
 end:
        return ret;
 }
 
 BT_HIDDEN
 int _bt_ctf_stream_class_set_id(
-               struct bt_ctf_stream_class *stream_class, uint32_t id)
+               struct bt_ctf_stream_class *stream_class, int64_t id)
 {
        stream_class->id = id;
        stream_class->id_set = 1;
        return 0;
 }
 
-struct event_class_set_stream_id_data {
-       uint32_t stream_id;
+struct event_class_set_stream_class_id_data {
+       int64_t stream_class_id;
        int ret;
 };
 
 static
 void event_class_set_stream_id(gpointer event_class, gpointer data)
 {
-       struct event_class_set_stream_id_data *typed_data = data;
+       struct event_class_set_stream_class_id_data *typed_data = data;
 
        typed_data->ret |= bt_ctf_event_class_set_stream_id(event_class,
-               typed_data->stream_id);
+               typed_data->stream_class_id);
 }
 
 BT_HIDDEN
 int bt_ctf_stream_class_set_id_no_check(
-               struct bt_ctf_stream_class *stream_class, uint32_t id)
+               struct bt_ctf_stream_class *stream_class, int64_t id)
 {
        int ret = 0;
-       struct event_class_set_stream_id_data data =
-               { .stream_id = id, .ret = 0 };
+       struct event_class_set_stream_class_id_data data =
+               { .stream_class_id = id, .ret = 0 };
 
        /*
         * Make sure all event classes have their "stream_id" attribute
@@ -256,11 +256,12 @@ end:
 }
 
 int bt_ctf_stream_class_set_id(struct bt_ctf_stream_class *stream_class,
-               uint32_t id)
+               uint64_t id_param)
 {
        int ret = 0;
+       int64_t id = (int64_t) id_param;
 
-       if (!stream_class || stream_class->frozen) {
+       if (!stream_class || stream_class->frozen || id < 0) {
                ret = -1;
                goto end;
        }
@@ -495,22 +496,21 @@ int64_t bt_ctf_stream_class_get_event_class_count(
        int64_t ret;
 
        if (!stream_class) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
-       ret = (int) stream_class->event_classes->len;
+       ret = (int64_t) stream_class->event_classes->len;
 end:
        return ret;
 }
 
-struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class(
-               struct bt_ctf_stream_class *stream_class, int index)
+struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_index(
+               struct bt_ctf_stream_class *stream_class, uint64_t index)
 {
        struct bt_ctf_event_class *event_class = NULL;
 
-       if (!stream_class || index < 0 ||
-               index >= stream_class->event_classes->len) {
+       if (!stream_class || index >= stream_class->event_classes->len) {
                goto end;
        }
 
@@ -547,12 +547,12 @@ end:
 }
 
 struct bt_ctf_event_class *bt_ctf_stream_class_get_event_class_by_id(
-               struct bt_ctf_stream_class *stream_class, uint32_t id)
+               struct bt_ctf_stream_class *stream_class, uint64_t id)
 {
-       int64_t id_key = id;
+       int64_t id_key = (int64_t) id;
        struct bt_ctf_event_class *event_class = NULL;
 
-       if (!stream_class) {
+       if (!stream_class || id_key < 0) {
                goto end;
        }
 
@@ -704,7 +704,7 @@ int64_t get_event_class_count(void *element)
 static
 void *get_event_class(void *element, int i)
 {
-       return bt_ctf_stream_class_get_event_class(
+       return bt_ctf_stream_class_get_event_class_by_index(
                        (struct bt_ctf_stream_class *) element, i);
 }
 
@@ -759,7 +759,7 @@ BT_HIDDEN
 int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class,
                struct metadata_context *context)
 {
-       int64_t ret = 0;
+       int ret = 0;
        size_t i;
 
        g_string_assign(context->field_name, "");
@@ -770,7 +770,7 @@ int bt_ctf_stream_class_serialize(struct bt_ctf_stream_class *stream_class,
        }
 
        g_string_append_printf(context->string,
-               "stream {\n\tid = %" PRIu32 ";\n\tevent.header := ",
+               "stream {\n\tid = %" PRId64 ";\n\tevent.header := ",
                stream_class->id);
        ret = bt_ctf_field_type_serialize(stream_class->event_header_type,
                context);
index 7ab3544a8f41c061780b884248242e9c990ccaaf..98fa25adbb2aff63340e7985438775a3b16e8a63 100644 (file)
@@ -200,8 +200,7 @@ int set_packet_header_uuid(struct bt_ctf_stream *stream)
                                uuid_element, (int64_t) trace->uuid[i]);
                } else {
                        ret = bt_ctf_field_unsigned_integer_set_value(
-                               uuid_element,
-                               (uint64_t) trace->uuid[i]);
+                               uuid_element, (uint64_t) trace->uuid[i]);
                }
                bt_put(uuid_element);
                if (ret) {
@@ -610,6 +609,7 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream,
        }
 
        new_count = previous_count + event_count;
+       assert(new_count >= previous_count);
        if (field_signed) {
                ret = bt_ctf_field_signed_integer_set_value(
                        events_discarded_field, (int64_t) new_count);
index 49c8308a5b32ef864ba36d8aa643ad20e9f2b611..fd464b015e197d7769d4da8a2fb41560eb584077 100644 (file)
@@ -328,7 +328,7 @@ int64_t bt_ctf_trace_get_environment_field_count(struct bt_ctf_trace *trace)
        int64_t ret = 0;
 
        if (!trace) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -339,8 +339,8 @@ end:
 }
 
 const char *
-bt_ctf_trace_get_environment_field_name(struct bt_ctf_trace *trace,
-               int index)
+bt_ctf_trace_get_environment_field_name_by_index(struct bt_ctf_trace *trace,
+               uint64_t index)
 {
        const char *ret = NULL;
 
@@ -354,8 +354,8 @@ end:
        return ret;
 }
 
-struct bt_value *bt_ctf_trace_get_environment_field_value(
-               struct bt_ctf_trace *trace, int index)
+struct bt_value *bt_ctf_trace_get_environment_field_value_by_index(
+               struct bt_ctf_trace *trace, uint64_t index)
 {
        struct bt_value *ret = NULL;
 
@@ -414,7 +414,7 @@ end:
 
 int64_t bt_ctf_trace_get_clock_class_count(struct bt_ctf_trace *trace)
 {
-       int64_t ret = -1;
+       int64_t ret = (int64_t) -1;
 
        if (!trace) {
                goto end;
@@ -425,12 +425,12 @@ end:
        return ret;
 }
 
-struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class(
-               struct bt_ctf_trace *trace, int index)
+struct bt_ctf_clock_class *bt_ctf_trace_get_clock_class_by_index(
+               struct bt_ctf_trace *trace, uint64_t index)
 {
        struct bt_ctf_clock_class *clock_class = NULL;
 
-       if (!trace || index < 0 || index >= trace->clocks->len) {
+       if (!trace || index >= trace->clocks->len) {
                goto end;
        }
 
@@ -589,7 +589,8 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
        /* Validate each event class individually */
        for (i = 0; i < event_class_count; i++) {
                struct bt_ctf_event_class *event_class =
-                       bt_ctf_stream_class_get_event_class(stream_class, i);
+                       bt_ctf_stream_class_get_event_class_by_index(
+                               stream_class, i);
                struct bt_ctf_field_type *event_context_type = NULL;
                struct bt_ctf_field_type *event_payload_type = NULL;
 
@@ -630,6 +631,10 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
        stream_id = bt_ctf_stream_class_get_id(stream_class);
        if (stream_id < 0) {
                stream_id = trace->next_stream_id++;
+               if (stream_id < 0) {
+                       ret = -1;
+                       goto end;
+               }
 
                /* Try to assign a new stream id */
                for (i = 0; i < trace->stream_classes->len; i++) {
@@ -672,7 +677,8 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace,
 
        for (i = 0; i < event_class_count; i++) {
                struct bt_ctf_event_class *event_class =
-                       bt_ctf_stream_class_get_event_class(stream_class, i);
+                       bt_ctf_stream_class_get_event_class_by_index(
+                               stream_class, i);
 
                bt_ctf_validation_replace_types(NULL, NULL, event_class,
                        &ec_validation_outputs[i], ec_validation_flags);
@@ -723,18 +729,19 @@ int64_t bt_ctf_trace_get_stream_count(struct bt_ctf_trace *trace)
        int64_t ret;
 
        if (!trace) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
-       ret = trace->streams->len;
+       ret = (int64_t) trace->streams->len;
 
 end:
        return ret;
 }
 
-struct bt_ctf_stream *bt_ctf_trace_get_stream(struct bt_ctf_trace *trace,
-               int index)
+struct bt_ctf_stream *bt_ctf_trace_get_stream_by_index(
+               struct bt_ctf_trace *trace,
+               uint64_t index)
 {
        struct bt_ctf_stream *stream = NULL;
 
@@ -753,21 +760,21 @@ int64_t bt_ctf_trace_get_stream_class_count(struct bt_ctf_trace *trace)
        int64_t ret;
 
        if (!trace) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
-       ret = trace->stream_classes->len;
+       ret = (int64_t) trace->stream_classes->len;
 end:
        return ret;
 }
 
-struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class(
-               struct bt_ctf_trace *trace, int index)
+struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_index(
+               struct bt_ctf_trace *trace, uint64_t index)
 {
        struct bt_ctf_stream_class *stream_class = NULL;
 
-       if (!trace || index < 0 || index >= trace->stream_classes->len) {
+       if (!trace || index >= trace->stream_classes->len) {
                goto end;
        }
 
@@ -778,12 +785,13 @@ end:
 }
 
 struct bt_ctf_stream_class *bt_ctf_trace_get_stream_class_by_id(
-               struct bt_ctf_trace *trace, uint32_t id)
+               struct bt_ctf_trace *trace, uint64_t id_param)
 {
        int i;
        struct bt_ctf_stream_class *stream_class = NULL;
+       int64_t id = (int64_t) id_param;
 
-       if (!trace) {
+       if (!trace || id < 0) {
                goto end;
        }
 
@@ -1119,7 +1127,7 @@ int64_t get_stream_class_count(void *element)
 static
 void *get_stream_class(void *element, int i)
 {
-       return bt_ctf_trace_get_stream_class(
+       return bt_ctf_trace_get_stream_class_by_index(
                        (struct bt_ctf_trace *) element, i);
 }
 
index c7b658fc9a01d7b5d425aeb4ef243a9030f1ef0d..e9d747317825f7c0ec69fa0282c5fc90775a6346 100644 (file)
@@ -166,7 +166,8 @@ struct bt_ctf_stream *bt_ctf_writer_create_stream(struct bt_ctf_writer *writer,
 
        for (i = 0; i < stream_class_count; i++) {
                struct bt_ctf_stream_class *existing_stream_class =
-                       bt_ctf_trace_get_stream_class(writer->trace, i);
+                       bt_ctf_trace_get_stream_class_by_index(
+                               writer->trace, i);
 
                if (existing_stream_class == stream_class) {
                        stream_class_found = true;
@@ -217,8 +218,7 @@ end:
 }
 
 int bt_ctf_writer_add_environment_field_int64(struct bt_ctf_writer *writer,
-               const char *name,
-               int64_t value)
+               const char *name, int64_t value)
 {
        int ret = -1;
 
index 98e72522121a8b3f2d7d241e56c6dfb44a85d892..f09fd06e304626501f4109ec2f36802a0162cc97 100644 (file)
@@ -29,6 +29,7 @@
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/ref.h>
+#include <stdint.h>
 #include <glib.h>
 
 static
@@ -85,7 +86,7 @@ end:
 int64_t bt_clock_class_priority_map_get_clock_class_count(
                struct bt_clock_class_priority_map *cc_prio_map)
 {
-       int64_t ret = -1;
+       int64_t ret = (int64_t) -1;
 
        if (!cc_prio_map) {
                goto end;
@@ -97,9 +98,9 @@ end:
        return ret;
 }
 
-struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class(
+struct bt_ctf_clock_class *bt_clock_class_priority_map_get_clock_class_by_index(
                struct bt_clock_class_priority_map *cc_prio_map,
-               unsigned int index)
+               uint64_t index)
 {
        struct bt_ctf_clock_class *clock_class = NULL;
 
index e3464f45b646929b43952a78699fb73824d25f92..792a36145bf2aaf8dbf78c34c2fa990de11b56cc 100644 (file)
@@ -41,6 +41,7 @@
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/ref.h>
+#include <stdint.h>
 
 static
 struct bt_component * (* const component_create_funcs[])(
@@ -191,14 +192,14 @@ BT_HIDDEN
 int64_t bt_component_get_input_port_count(struct bt_component *comp)
 {
        assert(comp);
-       return comp->input_ports->len;
+       return (int64_t) comp->input_ports->len;
 }
 
 BT_HIDDEN
 int64_t bt_component_get_output_port_count(struct bt_component *comp)
 {
        assert(comp);
-       return comp->output_ports->len;
+       return (int64_t) comp->output_ports->len;
 }
 
 struct bt_component *bt_component_create_with_init_method_data(
@@ -414,7 +415,8 @@ struct bt_graph *bt_component_get_graph(
 }
 
 static
-struct bt_port *bt_component_get_port(GPtrArray *ports, const char *name)
+struct bt_port *bt_component_get_port_by_name(GPtrArray *ports,
+               const char *name)
 {
        size_t i;
        struct bt_port *ret_port = NULL;
@@ -439,29 +441,29 @@ struct bt_port *bt_component_get_port(GPtrArray *ports, const char *name)
 }
 
 BT_HIDDEN
-struct bt_port *bt_component_get_input_port(struct bt_component *comp,
+struct bt_port *bt_component_get_input_port_by_name(struct bt_component *comp,
                const char *name)
 {
        assert(comp);
 
-       return bt_component_get_port(comp->input_ports, name);
+       return bt_component_get_port_by_name(comp->input_ports, name);
 }
 
 BT_HIDDEN
-struct bt_port *bt_component_get_output_port(struct bt_component *comp,
+struct bt_port *bt_component_get_output_port_by_name(struct bt_component *comp,
                const char *name)
 {
        assert(comp);
 
-       return bt_component_get_port(comp->output_ports, name);
+       return bt_component_get_port_by_name(comp->output_ports, name);
 }
 
 static
-struct bt_port *bt_component_get_port_at_index(GPtrArray *ports, int index)
+struct bt_port *bt_component_get_port_by_index(GPtrArray *ports, uint64_t index)
 {
        struct bt_port *port = NULL;
 
-       if (index < 0 || index >= ports->len) {
+       if (index >= ports->len) {
                goto end;
        }
 
@@ -471,21 +473,21 @@ end:
 }
 
 BT_HIDDEN
-struct bt_port *bt_component_get_input_port_at_index(struct bt_component *comp,
-               int index)
+struct bt_port *bt_component_get_input_port_by_index(struct bt_component *comp,
+               uint64_t index)
 {
        assert(comp);
 
-       return bt_component_get_port_at_index(comp->input_ports, index);
+       return bt_component_get_port_by_index(comp->input_ports, index);
 }
 
 BT_HIDDEN
-struct bt_port *bt_component_get_output_port_at_index(struct bt_component *comp,
-               int index)
+struct bt_port *bt_component_get_output_port_by_index(struct bt_component *comp,
+               uint64_t index)
 {
        assert(comp);
 
-       return bt_component_get_port_at_index(comp->output_ports, index);
+       return bt_component_get_port_by_index(comp->output_ports, index);
 }
 
 BT_HIDDEN
@@ -505,7 +507,7 @@ struct bt_port *bt_component_add_output_port(
 }
 
 static
-void bt_component_remove_port_at_index(struct bt_component *component,
+void bt_component_remove_port_by_index(struct bt_component *component,
                GPtrArray *ports, size_t index)
 {
        struct bt_port *port;
@@ -561,7 +563,7 @@ enum bt_component_status bt_component_remove_port(
                struct bt_port *cur_port = g_ptr_array_index(ports, i);
 
                if (cur_port == port) {
-                       bt_component_remove_port_at_index(component,
+                       bt_component_remove_port_by_index(component,
                                ports, i);
                        goto end;
                }
index f7d2961800e4ed5867402b0d3efa0a30900ca495..81f872e648fe798e658dbf1dacd5bd072a04e2d6 100644 (file)
@@ -81,22 +81,22 @@ end:
 }
 
 int64_t bt_component_filter_get_input_port_count(
-               struct bt_component *component, uint64_t *count)
+               struct bt_component *component)
 {
        int64_t ret;
 
        if (!component ||
                        component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
-       ret = bt_component_get_input_port_count(component);
+       ret = (int64_t) bt_component_get_input_port_count(component);
 end:
        return ret;
 }
 
-struct bt_port *bt_component_filter_get_input_port(
+struct bt_port *bt_component_filter_get_input_port_by_name(
                struct bt_component *component, const char *name)
 {
        struct bt_port *port = NULL;
@@ -106,13 +106,13 @@ struct bt_port *bt_component_filter_get_input_port(
                goto end;
        }
 
-       port = bt_component_get_input_port(component, name);
+       port = bt_component_get_input_port_by_name(component, name);
 end:
        return port;
 }
 
-struct bt_port *bt_component_filter_get_input_port_at_index(
-               struct bt_component *component, int index)
+struct bt_port *bt_component_filter_get_input_port_by_index(
+               struct bt_component *component, uint64_t index)
 {
        struct bt_port *port = NULL;
 
@@ -121,7 +121,7 @@ struct bt_port *bt_component_filter_get_input_port_at_index(
                goto end;
        }
 
-       port = bt_component_get_input_port_at_index(component, index);
+       port = bt_component_get_input_port_by_index(component, index);
 end:
        return port;
 }
@@ -129,18 +129,18 @@ end:
 struct bt_port *bt_component_filter_get_default_input_port(
                struct bt_component *component)
 {
-       return bt_component_filter_get_input_port(component,
+       return bt_component_filter_get_input_port_by_name(component,
                        DEFAULT_INPUT_PORT_NAME);
 }
 
 int64_t bt_component_filter_get_output_port_count(
-               struct bt_component *component, uint64_t *count)
+               struct bt_component *component)
 {
        int64_t ret;
 
-       if (!component || !count ||
+       if (!component ||
                        component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -149,7 +149,7 @@ end:
        return ret;
 }
 
-struct bt_port *bt_component_filter_get_output_port(
+struct bt_port *bt_component_filter_get_output_port_by_name(
                struct bt_component *component, const char *name)
 {
        struct bt_port *port = NULL;
@@ -159,13 +159,13 @@ struct bt_port *bt_component_filter_get_output_port(
                goto end;
        }
 
-       port = bt_component_get_output_port(component, name);
+       port = bt_component_get_output_port_by_name(component, name);
 end:
        return port;
 }
 
-struct bt_port *bt_component_filter_get_output_port_at_index(
-               struct bt_component *component, int index)
+struct bt_port *bt_component_filter_get_output_port_by_index(
+               struct bt_component *component, uint64_t index)
 {
        struct bt_port *port = NULL;
 
@@ -174,7 +174,7 @@ struct bt_port *bt_component_filter_get_output_port_at_index(
                goto end;
        }
 
-       port = bt_component_get_output_port_at_index(component, index);
+       port = bt_component_get_output_port_by_index(component, index);
 end:
        return port;
 }
@@ -182,16 +182,16 @@ end:
 struct bt_port *bt_component_filter_get_default_output_port(
                struct bt_component *component)
 {
-       return bt_component_filter_get_output_port(component,
+       return bt_component_filter_get_output_port_by_name(component,
                        DEFAULT_OUTPUT_PORT_NAME);
 }
 
 struct bt_private_port *
-bt_private_component_filter_get_input_private_port_at_index(
-               struct bt_private_component *private_component, int index)
+bt_private_component_filter_get_input_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index)
 {
        return bt_private_port_from_port(
-               bt_component_filter_get_input_port_at_index(
+               bt_component_filter_get_input_port_by_index(
                        bt_component_from_private(private_component), index));
 }
 
@@ -223,11 +223,11 @@ end:
 }
 
 struct bt_private_port *
-bt_private_component_filter_get_output_private_port_at_index(
-               struct bt_private_component *private_component, int index)
+bt_private_component_filter_get_output_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index)
 {
        return bt_private_port_from_port(
-               bt_component_filter_get_output_port_at_index(
+               bt_component_filter_get_output_port_by_index(
                        bt_component_from_private(private_component), index));
 }
 
index 5a7e9e0bf9a7cc34e6b579a6fad30b835957a86a..35ccde70b75b259be63842247c4912db4d00e6cc 100644 (file)
@@ -349,7 +349,7 @@ enum bt_graph_status bt_graph_add_component_as_sibling(struct bt_graph *graph,
        struct bt_port *downstream_port = NULL;
        struct bt_connection *origin_connection = NULL;
        struct bt_connection *new_connection = NULL;
-        int port_index;
+        int64_t port_index;
 
        if (!graph || !origin || !new_component) {
                status = BT_GRAPH_STATUS_INVALID;
@@ -393,14 +393,14 @@ enum bt_graph_status bt_graph_add_component_as_sibling(struct bt_graph *graph,
 
        /* Replicate input connections. */
        for (port_index = 0; port_index< origin_input_port_count; port_index++) {
-               origin_port = bt_component_get_input_port_at_index(origin,
+               origin_port = bt_component_get_input_port_by_index(origin,
                        port_index);
                if (!origin_port) {
                        status = BT_GRAPH_STATUS_ERROR;
                        goto error_disconnect;
                }
 
-               new_port = bt_component_get_input_port_at_index(new_component,
+               new_port = bt_component_get_input_port_by_index(new_component,
                        port_index);
                if (!new_port) {
                        status = BT_GRAPH_STATUS_ERROR;
@@ -431,13 +431,13 @@ enum bt_graph_status bt_graph_add_component_as_sibling(struct bt_graph *graph,
 
        /* Replicate output connections. */
        for (port_index = 0; port_index < origin_output_port_count; port_index++) {
-               origin_port = bt_component_get_output_port_at_index(origin,
+               origin_port = bt_component_get_output_port_by_index(origin,
                        port_index);
                if (!origin_port) {
                        status = BT_GRAPH_STATUS_ERROR;
                        goto error_disconnect;
                }
-               new_port = bt_component_get_output_port_at_index(new_component,
+               new_port = bt_component_get_output_port_by_index(new_component,
                        port_index);
                if (!new_port) {
                        status = BT_GRAPH_STATUS_ERROR;
index 44bb6f23c73215361692066990d8b40d4740def9..8d9d6f3da9a26c4bba7205ab2de330c1e2a6740f 100644 (file)
@@ -78,7 +78,7 @@ bool validate_clock_classes(struct bt_notification_event *notif)
        for (cc_prio_map_cc_i = 0; cc_prio_map_cc_i < cc_prio_map_cc_count;
                        cc_prio_map_cc_i++) {
                struct bt_ctf_clock_class *clock_class =
-                       bt_clock_class_priority_map_get_clock_class(
+                       bt_clock_class_priority_map_get_clock_class_by_index(
                                notif->cc_prio_map, cc_prio_map_cc_i);
                struct bt_ctf_clock_value *clock_value;
                bool found_in_trace = false;
@@ -96,7 +96,8 @@ bool validate_clock_classes(struct bt_notification_event *notif)
                for (trace_cc_i = 0; trace_cc_i < trace_cc_count;
                                trace_cc_i++) {
                        struct bt_ctf_clock_class *trace_clock_class =
-                               bt_ctf_trace_get_clock_class(trace, trace_cc_i);
+                               bt_ctf_trace_get_clock_class_by_index(trace,
+                                       trace_cc_i);
 
                        assert(trace_clock_class);
 
index 916979adf3a9ba8670585260d7f5c32f071bb039..1bd092835a1687e59b82ae702b7baafb3b4ffdd3 100644 (file)
@@ -106,7 +106,7 @@ int64_t bt_component_sink_get_input_port_count(struct bt_component *component)
 
        if (!component ||
                        component->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -115,7 +115,7 @@ end:
        return ret;
 }
 
-struct bt_port *bt_component_sink_get_input_port(
+struct bt_port *bt_component_sink_get_input_port_by_name(
                struct bt_component *component, const char *name)
 {
        struct bt_port *port = NULL;
@@ -125,13 +125,13 @@ struct bt_port *bt_component_sink_get_input_port(
                goto end;
        }
 
-       port = bt_component_get_input_port(component, name);
+       port = bt_component_get_input_port_by_name(component, name);
 end:
        return port;
 }
 
-struct bt_port *bt_component_sink_get_input_port_at_index(
-               struct bt_component *component, int index)
+struct bt_port *bt_component_sink_get_input_port_by_index(
+               struct bt_component *component, uint64_t index)
 {
        struct bt_port *port = NULL;
 
@@ -140,7 +140,7 @@ struct bt_port *bt_component_sink_get_input_port_at_index(
                goto end;
        }
 
-       port = bt_component_get_input_port_at_index(component, index);
+       port = bt_component_get_input_port_by_index(component, index);
 end:
        return port;
 }
@@ -148,16 +148,16 @@ end:
 struct bt_port *bt_component_sink_get_default_input_port(
                struct bt_component *component)
 {
-       return bt_component_sink_get_input_port(component,
+       return bt_component_sink_get_input_port_by_name(component,
                        DEFAULT_INPUT_PORT_NAME);
 }
 
 struct bt_private_port *
-bt_private_component_sink_get_input_private_port_at_index(
-               struct bt_private_component *private_component, int index)
+bt_private_component_sink_get_input_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index)
 {
        return bt_private_port_from_port(
-               bt_component_sink_get_input_port_at_index(
+               bt_component_sink_get_input_port_by_index(
                        bt_component_from_private(private_component), index));
 }
 
index 7ab4eeae1149afc017ed0a69a01bbbd78a237130..ed052ded0e6360816dd2bf534de7a5217ee5a23e 100644 (file)
@@ -86,7 +86,7 @@ int64_t bt_component_source_get_output_port_count(
 
        if (!component || !count ||
                        component->class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
-               ret = -1;
+               ret = (int64_t) -1;
                goto end;
        }
 
@@ -95,7 +95,7 @@ end:
        return ret;
 }
 
-struct bt_port *bt_component_source_get_output_port(
+struct bt_port *bt_component_source_get_output_port_by_name(
                struct bt_component *component, const char *name)
 {
        struct bt_port *port = NULL;
@@ -105,13 +105,13 @@ struct bt_port *bt_component_source_get_output_port(
                goto end;
        }
 
-       port = bt_component_get_output_port(component, name);
+       port = bt_component_get_output_port_by_name(component, name);
 end:
        return port;
 }
 
-struct bt_port *bt_component_source_get_output_port_at_index(
-               struct bt_component *component, int index)
+struct bt_port *bt_component_source_get_output_port_by_index(
+               struct bt_component *component, uint64_t index)
 {
        struct bt_port *port = NULL;
 
@@ -120,7 +120,7 @@ struct bt_port *bt_component_source_get_output_port_at_index(
                goto end;
        }
 
-       port = bt_component_get_output_port_at_index(component, index);
+       port = bt_component_get_output_port_by_index(component, index);
 end:
        return port;
 }
@@ -128,24 +128,26 @@ end:
 struct bt_port *bt_component_source_get_default_output_port(
                struct bt_component *component)
 {
-       return bt_component_source_get_output_port(component,
+       return bt_component_source_get_output_port_by_name(component,
                        DEFAULT_OUTPUT_PORT_NAME);
 }
 
-struct bt_private_port *bt_private_component_source_get_output_private_port(
+struct bt_private_port *
+bt_private_component_source_get_output_private_port_by_name(
                struct bt_private_component *private_component,
                const char *name)
 {
-       return bt_private_port_from_port(bt_component_source_get_output_port(
-               bt_component_from_private(private_component), name));
+       return bt_private_port_from_port(
+               bt_component_source_get_output_port_by_name(
+                       bt_component_from_private(private_component), name));
 }
 
 struct bt_private_port *
-bt_private_component_source_get_output_private_port_at_index(
-               struct bt_private_component *private_component, int index)
+bt_private_component_source_get_output_private_port_by_index(
+               struct bt_private_component *private_component, uint64_t index)
 {
        return bt_private_port_from_port(
-               bt_component_source_get_output_port_at_index(
+               bt_component_source_get_output_port_by_index(
                        bt_component_from_private(private_component), index));
 }
 
index a55b9843a3a92fa40f298c5082745c3335b91fba..c5dfd03338c325d58b22311419925c8b398084f1 100644 (file)
@@ -36,6 +36,7 @@
 #include <glib.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <sys/stat.h>
 #include <dirent.h>
 
@@ -89,7 +90,7 @@ int64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set)
                goto end;
        }
 
-       count = plugin_set->plugins->len;
+       count = (int64_t) plugin_set->plugins->len;
 
 end:
        return count;
@@ -97,7 +98,7 @@ end:
 
 extern
 struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set,
-               unsigned int index)
+               uint64_t index)
 {
        struct bt_plugin *plugin = NULL;
 
@@ -504,11 +505,11 @@ end:
 
 int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin)
 {
-       return plugin ? plugin->comp_classes->len : -1;
+       return plugin ? plugin->comp_classes->len : (int64_t) -1;
 }
 
-struct bt_component_class *bt_plugin_get_component_class(
-               struct bt_plugin *plugin, size_t index)
+struct bt_component_class *bt_plugin_get_component_class_by_index(
+               struct bt_plugin *plugin, uint64_t index)
 {
        struct bt_component_class *comp_class = NULL;
 
index fb62293e8dd6d06ef868b1dcde0c881bf5f9a615..24b26e11706a73c271be33188030103dbbfd66a7 100644 (file)
@@ -819,7 +819,7 @@ int64_t bt_value_array_size(const struct bt_value *array_obj)
                BT_VALUE_TO_ARRAY(array_obj);
 
        if (!array_obj || !bt_value_is_array(array_obj)) {
-               ret = BT_VALUE_STATUS_INVAL;
+               ret = (int64_t) BT_VALUE_STATUS_INVAL;
                goto end;
        }
 
@@ -987,7 +987,7 @@ int64_t bt_value_map_size(const struct bt_value *map_obj)
        struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj);
 
        if (!map_obj || !bt_value_is_map(map_obj)) {
-               ret = BT_VALUE_STATUS_INVAL;
+               ret = (int64_t) BT_VALUE_STATUS_INVAL;
                goto end;
        }
 
index 050573d72e10ee9f57f97d7deee2db2650e8cfba..cb50a7e767737fdcd622f1012c587cfd413cca8c 100644 (file)
@@ -3437,8 +3437,9 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node)
                        } else {
                                assert(bt_ctf_trace_get_stream_class_count(
                                        ctx->trace) == 1);
-                               stream_class = bt_ctf_trace_get_stream_class(
-                                       ctx->trace, 0);
+                               stream_class =
+                                       bt_ctf_trace_get_stream_class_by_index(
+                                               ctx->trace, 0);
                                assert(stream_class);
                                stream_id = bt_ctf_stream_class_get_id(
                                        stream_class);
index bb629b18940bcdc87997ad4af8269b9d16b30db8..be79603e672525b5f251c203f182040aa5840675 100644 (file)
@@ -2082,7 +2082,7 @@ struct bt_ctf_event *create_event(struct bt_ctf_notif_iter *notit)
                goto error;
        }
 
-       ret = bt_ctf_event_set_payload_field(event,
+       ret = bt_ctf_event_set_event_payload(event,
                notit->dscopes.event_payload);
        if (ret) {
                goto error;
@@ -2249,7 +2249,7 @@ int init_clock_states(GHashTable *clock_states, struct bt_ctf_trace *trace)
        for (i = 0; i < clock_class_count; i++) {
                struct bt_ctf_clock_class *clock_class;
 
-               clock_class = bt_ctf_trace_get_clock_class(trace, i);
+               clock_class = bt_ctf_trace_get_clock_class_by_index(trace, i);
                if (!clock_class) {
                        ret = -1;
                        goto end;
index 808f9ccfeb3bf1f437f3b29e88d5b8dd2befa5dc..e734a1e1fde604187e2c49ebfa84911b31a35334 100644 (file)
@@ -347,8 +347,8 @@ int create_cc_prio_map(struct ctf_fs_component *ctf_fs)
 
        for (i = 0; i < count; i++) {
                struct bt_ctf_clock_class *clock_class =
-                       bt_ctf_trace_get_clock_class(ctf_fs->metadata->trace,
-                               i);
+                       bt_ctf_trace_get_clock_class_by_index(
+                               ctf_fs->metadata->trace, i);
 
                assert(clock_class);
                ret = bt_clock_class_priority_map_add_clock_class(
index 6c392602117a729cdf149f9190a9314ac0ce4b04..55cf1351bfe86017d96b36ab0f162412b1096edf 100644 (file)
@@ -825,7 +825,7 @@ int add_clock_classes(FILE *err, struct bt_ctf_trace *writer_trace,
 
        for (i = 0; i < clock_class_count; i++) {
                struct bt_ctf_clock_class *clock_class =
-                       bt_ctf_trace_get_clock_class(trace, i);
+                       bt_ctf_trace_get_clock_class_by_index(trace, i);
 
                if (!clock_class) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
@@ -1366,7 +1366,7 @@ struct bt_ctf_clock_class *stream_class_get_clock_class(FILE *err,
        }
 
        /* FIXME multi-clock? */
-       clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+       clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
 
        bt_put(trace);
 
@@ -1518,7 +1518,7 @@ struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event
        }
        BT_PUT(field);
 
-       field = bt_ctf_event_get_payload_field(event);
+       field = bt_ctf_event_get_event_payload(event);
        if (!field) {
                fprintf(err, "[error] %s in %s:%d\n", __func__,
                                __FILE__, __LINE__);
@@ -1526,7 +1526,7 @@ struct bt_ctf_event *debug_info_copy_event(FILE *err, struct bt_ctf_event *event
        }
        copy_field = bt_ctf_field_copy(field);
        if (copy_field) {
-               ret = bt_ctf_event_set_payload_field(writer_event, copy_field);
+               ret = bt_ctf_event_set_event_payload(writer_event, copy_field);
                if (ret < 0) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
                                        __FILE__, __LINE__);
index 68fb5b759c24bd3ad36e93d3aa63fb08881fb7b2..f24206a27fb8023f9a279480c2cc27f6fef58a48 100644 (file)
@@ -329,7 +329,7 @@ struct bt_ctf_field_type *override_header_type(FILE *err,
        int ret;
 
        /* FIXME multi-clock? */
-       writer_clock_class = bt_ctf_trace_get_clock_class(writer_trace, 0);
+       writer_clock_class = bt_ctf_trace_get_clock_class_by_index(writer_trace, 0);
        if (!writer_clock_class) {
                fprintf(err, "[error] %s in %s:%d\n",
                                __func__, __FILE__, __LINE__);
@@ -516,7 +516,7 @@ int copy_find_clock_enum_field(FILE *err, struct bt_ctf_event *event,
                                __LINE__);
                goto error;
        }
-       
+
        ret = 0;
        goto end;
 
@@ -818,7 +818,7 @@ struct bt_ctf_clock_class *stream_class_get_clock_class(FILE *err,
        }
 
        /* FIXME multi-clock? */
-       clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+       clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
 
        bt_put(trace);
 end:
index 898e6c4ef2828d4f863fbff728dda9d82128b319..c2d5b4d1450e68bb97b81bec411536855fb11e33 100644 (file)
@@ -39,6 +39,7 @@
 #include "ctfcopytrace.h"
 #include "clock-fields.h"
 
+BT_HIDDEN
 struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err,
                struct bt_ctf_clock_class *clock_class)
 {
@@ -156,6 +157,7 @@ end:
        return writer_clock_class;
 }
 
+BT_HIDDEN
 enum bt_component_status ctf_copy_clock_classes(FILE *err,
                struct bt_ctf_trace *writer_trace,
                struct bt_ctf_stream_class *writer_stream_class,
@@ -169,7 +171,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err,
        for (i = 0; i < clock_class_count; i++) {
                struct bt_ctf_clock_class *writer_clock_class;
                struct bt_ctf_clock_class *clock_class =
-                       bt_ctf_trace_get_clock_class(trace, i);
+                       bt_ctf_trace_get_clock_class_by_index(trace, i);
 
                if (!clock_class) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
@@ -207,6 +209,7 @@ end:
        return ret;
 }
 
+BT_HIDDEN
 struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
                struct bt_ctf_event_class *event_class)
 {
@@ -234,13 +237,15 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
                struct bt_value *attr_value;
                int ret;
 
-               attr_name = bt_ctf_event_class_get_attribute_name(event_class, i);
+               attr_name = bt_ctf_event_class_get_attribute_name_by_index(
+                       event_class, i);
                if (!attr_name) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
                                        __FILE__, __LINE__);
                        goto error;
                }
-               attr_value = bt_ctf_event_class_get_attribute_value(event_class, i);
+               attr_value = bt_ctf_event_class_get_attribute_value_by_index(
+                       event_class, i);
                if (!attr_value) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
                                        __FILE__, __LINE__);
@@ -257,14 +262,14 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
                }
        }
 
-       count = bt_ctf_event_class_get_field_count(event_class);
+       count = bt_ctf_event_class_get_payload_type_field_count(event_class);
        for (i = 0; i < count; i++) {
                const char *field_name;
                struct bt_ctf_field_type *field_type;
                int ret;
 
-               ret = bt_ctf_event_class_get_field(event_class, &field_name,
-                               &field_type, i);
+               ret = bt_ctf_event_class_get_payload_type_field_by_index(
+                               event_class, &field_name, &field_type, i);
                if (ret < 0) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__);
                        goto error;
@@ -288,6 +293,7 @@ end:
        return writer_event_class;
 }
 
+BT_HIDDEN
 enum bt_component_status ctf_copy_event_classes(FILE *err,
                struct bt_ctf_stream_class *stream_class,
                struct bt_ctf_stream_class *writer_stream_class)
@@ -307,7 +313,7 @@ enum bt_component_status ctf_copy_event_classes(FILE *err,
                struct bt_ctf_field_type *context;
                int int_ret;
 
-               event_class = bt_ctf_stream_class_get_event_class(
+               event_class = bt_ctf_stream_class_get_event_class_by_index(
                                stream_class, i);
                if (!event_class) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
@@ -360,6 +366,7 @@ end:
        return ret;
 }
 
+BT_HIDDEN
 struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err,
                struct bt_ctf_stream_class *stream_class,
                struct bt_ctf_trace *writer_trace,
@@ -454,6 +461,7 @@ end:
        return writer_stream_class;
 }
 
+BT_HIDDEN
 enum bt_component_status ctf_copy_packet_context_field(FILE *err,
                struct bt_ctf_field *field, const char *field_name,
                struct bt_ctf_field *writer_packet_context,
@@ -482,8 +490,8 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err,
        }
        BT_PUT(field_type);
 
-       writer_field = bt_ctf_field_structure_get_field(writer_packet_context,
-                       field_name);
+       writer_field = bt_ctf_field_structure_get_field_by_name(
+               writer_packet_context, field_name);
        if (!writer_field) {
                ret = BT_COMPONENT_STATUS_ERROR;
                fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
@@ -519,6 +527,7 @@ end:
        return ret;
 }
 
+BT_HIDDEN
 struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
                struct bt_ctf_packet *packet,
                struct bt_ctf_stream *writer_stream)
@@ -579,7 +588,7 @@ struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
                                        __FILE__, __LINE__);
                        goto error;
                }
-               if (bt_ctf_field_type_structure_get_field(struct_type,
+               if (bt_ctf_field_type_structure_get_field_by_index(struct_type,
                                        &field_name, &field_type, i) < 0) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
                                        __FILE__, __LINE__);
@@ -623,6 +632,7 @@ end:
        return writer_packet_context;
 }
 
+BT_HIDDEN
 int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event,
                struct bt_ctf_event_class *writer_event_class,
                struct bt_ctf_event *writer_event,
@@ -706,6 +716,7 @@ end:
        return ret;
 }
 
+BT_HIDDEN
 struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
                struct bt_ctf_event_class *writer_event_class,
                bool override_ts64)
@@ -788,7 +799,7 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
        BT_PUT(field);
        BT_PUT(copy_field);
 
-       field = bt_ctf_event_get_payload_field(event);
+       field = bt_ctf_event_get_event_payload(event);
        if (!field) {
                fprintf(err, "[error] %s in %s:%d\n", __func__,
                                __FILE__, __LINE__);
@@ -796,7 +807,7 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
        }
        copy_field = bt_ctf_field_copy(field);
        if (copy_field) {
-               ret = bt_ctf_event_set_payload_field(writer_event, copy_field);
+               ret = bt_ctf_event_set_event_payload(writer_event, copy_field);
                if (ret < 0) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
                                        __FILE__, __LINE__);
@@ -816,6 +827,7 @@ end:
        return writer_event;
 }
 
+BT_HIDDEN
 enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
                struct bt_ctf_trace *writer_trace)
 {
@@ -829,14 +841,16 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
                const char *name;
                struct bt_value *value = NULL;
 
-               name = bt_ctf_trace_get_environment_field_name(trace, i);
+               name = bt_ctf_trace_get_environment_field_name_by_index(
+                       trace, i);
                if (!name) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
                                        __LINE__);
                        ret = BT_COMPONENT_STATUS_ERROR;
                        goto end;
                }
-               value = bt_ctf_trace_get_environment_field_value(trace, i);
+               value = bt_ctf_trace_get_environment_field_value_by_index(
+                       trace, i);
                if (!value) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__,
                                        __LINE__);
index b4a60a2aa2e3ab9ea10da05a4a3e736b520818b2..6820a8a2b6c288df1485c498c8f12e3d1d83a63d 100644 (file)
@@ -51,6 +51,7 @@ struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err,
  * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
  * error.
  */
+BT_HIDDEN
 enum bt_component_status ctf_copy_clock_classes(FILE *err,
                struct bt_ctf_trace *writer_trace,
                struct bt_ctf_stream_class *writer_stream_class,
@@ -61,6 +62,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err,
  *
  * Returns NULL on error.
  */
+BT_HIDDEN
 struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
                struct bt_ctf_event_class *event_class);
 
@@ -71,6 +73,7 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err,
  * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
  * error.
  */
+BT_HIDDEN
 enum bt_component_status ctf_copy_event_classes(FILE *err,
                struct bt_ctf_stream_class *stream_class,
                struct bt_ctf_stream_class *writer_stream_class);
@@ -80,6 +83,7 @@ enum bt_component_status ctf_copy_event_classes(FILE *err,
  *
  * Returns NULL or error.
  */
+BT_HIDDEN
 struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err,
                struct bt_ctf_stream_class *stream_class,
                struct bt_ctf_trace *writer_trace,
@@ -92,6 +96,7 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err,
  * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
  * error.
  */
+BT_HIDDEN
 enum bt_component_status ctf_copy_packet_context_field(FILE *err,
                struct bt_ctf_field *field, const char *field_name,
                struct bt_ctf_field *writer_packet_context,
@@ -106,6 +111,7 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err,
  * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
  * error.
  */
+BT_HIDDEN
 struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
                struct bt_ctf_packet *packet,
                struct bt_ctf_stream *writer_stream);
@@ -116,6 +122,7 @@ struct bt_ctf_field *ctf_copy_packet_context(FILE *err,
  *
  * Returns NULL on error.
  */
+BT_HIDDEN
 struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
                struct bt_ctf_event_class *writer_event_class,
                bool override_ts64);
@@ -125,6 +132,7 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event,
  *
  * Returns 0 on success, -1 on error.
  */
+BT_HIDDEN
 int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event,
                struct bt_ctf_event_class *writer_event_class,
                struct bt_ctf_event *writer_event,
@@ -137,6 +145,7 @@ int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event,
  * Returns BT_COMPONENT_STATUS_OK on success, and BT_COMPONENT_STATUS_ERROR on
  * error.
  */
+BT_HIDDEN
 enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
                struct bt_ctf_trace *writer_trace);
 
index fb7bae4f17e44a12c29a438bb9394673968efe14..9a8d002c706851de96ec3b0c5bce25ef0b7d6021 100644 (file)
@@ -1440,7 +1440,7 @@ enum bt_component_status print_event_payload(struct pretty_component *pretty,
        enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
        struct bt_ctf_field *main_field = NULL;
 
-       main_field = bt_ctf_event_get_payload_field(event);
+       main_field = bt_ctf_event_get_event_payload(event);
        if (!main_field) {
                goto end;
        }
index 75b195971ac77049b0e0d5ca9d1f320d39dd3cbd..5db1e426a7205c8361699d340578174d4c18fba7 100644 (file)
@@ -820,7 +820,7 @@ int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp,
 
        for (i = 0; i < count; i++) {
                struct bt_private_port *priv_port =
-                       bt_private_component_filter_get_input_private_port_at_index(
+                       bt_private_component_filter_get_input_private_port_by_index(
                                muxer_comp->priv_comp, i);
                struct bt_port *port;
 
index 8b35cf984a4d9176f604dd47f8b4743b2519004c..6043db92764ac33450f2e4180eb5836fc20883e9 100644 (file)
@@ -214,7 +214,7 @@ struct bt_notification *evaluate_event_notification(
        assert(trace);
 
        /* FIXME multi-clock? */
-       clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+       clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
        if (!clock_class) {
                goto end;
        }
@@ -348,7 +348,8 @@ int64_t get_raw_timestamp(struct bt_ctf_packet *writer_packet,
        assert(writer_trace);
 
        /* FIXME multi-clock? */
-       writer_clock_class = bt_ctf_trace_get_clock_class(writer_trace, 0);
+       writer_clock_class = bt_ctf_trace_get_clock_class_by_index(
+               writer_trace, 0);
        assert(writer_clock_class);
 
        ret = bt_ctf_clock_class_get_offset_s(writer_clock_class, &sec_offset);
index 065d367b696d796c4ee81cafb515206b60cf9d0c..1448566cab5acad5841d43266b70734032a3088a 100644 (file)
@@ -1717,9 +1717,9 @@ void validate_test_pass(struct bt_ctf_trace *trace)
        struct bt_ctf_field_type *ft_target = NULL;
        struct bt_ctf_field_type *ft_tag = NULL;
 
-       sc = bt_ctf_trace_get_stream_class(trace, 0);
+       sc = bt_ctf_trace_get_stream_class_by_index(trace, 0);
        assert(sc);
-       ec = bt_ctf_stream_class_get_event_class(sc, 0);
+       ec = bt_ctf_stream_class_get_event_class_by_index(sc, 0);
        assert(ec);
 
        ph = bt_ctf_trace_get_packet_header_type(trace);
index f82c31458b97e3f2a59119dd7f52cf9e1b90549c..5ffb069a4e707b924ffb6f6962742235ce7a4768 100644 (file)
@@ -348,11 +348,11 @@ static void init_weak_refs(struct bt_ctf_trace *tc,
                struct bt_ctf_event_class **ec3)
 {
        *tc1 = tc;
-       *sc1 = bt_ctf_trace_get_stream_class(tc, 0);
-       *sc2 = bt_ctf_trace_get_stream_class(tc, 1);
-       *ec1 = bt_ctf_stream_class_get_event_class(*sc1, 0);
-       *ec2 = bt_ctf_stream_class_get_event_class(*sc1, 1);
-       *ec3 = bt_ctf_stream_class_get_event_class(*sc2, 0);
+       *sc1 = bt_ctf_trace_get_stream_class_by_index(tc, 0);
+       *sc2 = bt_ctf_trace_get_stream_class_by_index(tc, 1);
+       *ec1 = bt_ctf_stream_class_get_event_class_by_index(*sc1, 0);
+       *ec2 = bt_ctf_stream_class_get_event_class_by_index(*sc1, 1);
+       *ec3 = bt_ctf_stream_class_get_event_class_by_index(*sc2, 0);
        bt_put(*sc1);
        bt_put(*sc2);
        bt_put(*ec1);
@@ -402,7 +402,7 @@ static void test_example_scenario(void)
                        "TC1 reference count is 1");
 
        /* User A acquires a reference to SC2 from TC1. */
-       user_a.sc = bt_ctf_trace_get_stream_class(user_a.tc, 1);
+       user_a.sc = bt_ctf_trace_get_stream_class_by_index(user_a.tc, 1);
        ok(user_a.sc, "User A acquires SC2 from TC1");
        ok(bt_object_get_ref_count(weak_tc1) == 2,
                        "TC1 reference count is 2");
@@ -410,7 +410,7 @@ static void test_example_scenario(void)
                        "SC2 reference count is 1");
 
        /* User A acquires a reference to EC3 from SC2. */
-       user_a.ec = bt_ctf_stream_class_get_event_class(user_a.sc, 0);
+       user_a.ec = bt_ctf_stream_class_get_event_class_by_index(user_a.sc, 0);
        ok(user_a.ec, "User A acquires EC3 from SC2");
        ok(bt_object_get_ref_count(weak_tc1) == 2,
                        "TC1 reference count is 2");
@@ -457,7 +457,7 @@ static void test_example_scenario(void)
 
        /* User C acquires a reference to EC1. */
        diag("User C acquires a reference to EC1");
-       user_c.ec = bt_ctf_stream_class_get_event_class(user_b.sc, 0);
+       user_c.ec = bt_ctf_stream_class_get_event_class_by_index(user_b.sc, 0);
        ok(bt_object_get_ref_count(weak_ec1) == 1,
                        "EC1 reference count is 1");
        ok(bt_object_get_ref_count(weak_sc1) == 2,
index e05b3d285fec49242e47a00317d759614055ca29..7ea4b5831638b646108c1a712d7296f9c38b0d50 100644 (file)
@@ -416,11 +416,11 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_stream_class_get_event_class_count handles NULL correctly");
        ok(bt_ctf_stream_class_get_event_class_count(stream_class) == 1,
                "bt_ctf_stream_class_get_event_class_count returns a correct number of event classes");
-       ok(bt_ctf_stream_class_get_event_class(NULL, 0) == NULL,
+       ok(bt_ctf_stream_class_get_event_class_by_index(NULL, 0) == NULL,
                "bt_ctf_stream_class_get_event_class handles NULL correctly");
-       ok(bt_ctf_stream_class_get_event_class(stream_class, 8724) == NULL,
+       ok(bt_ctf_stream_class_get_event_class_by_index(stream_class, 8724) == NULL,
                "bt_ctf_stream_class_get_event_class handles invalid indexes correctly");
-       ret_event_class = bt_ctf_stream_class_get_event_class(stream_class, 0);
+       ret_event_class = bt_ctf_stream_class_get_event_class_by_index(stream_class, 0);
        ok(ret_event_class == simple_event_class,
                "bt_ctf_stream_class_get_event_class returns the correct event class");
        bt_put(ret_event_class);
@@ -892,21 +892,22 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_event_class_get_attribute_count handles a NULL event class");
        ok(bt_ctf_event_class_get_attribute_count(event_class) == 4,
                "bt_ctf_event_class_get_attribute_count returns the correct count");
-       ok(!bt_ctf_event_class_get_attribute_name(NULL, 0),
+       ok(!bt_ctf_event_class_get_attribute_name_by_index(NULL, 0),
                "bt_ctf_event_class_get_attribute_name handles a NULL event class correctly");
-       ok(!bt_ctf_event_class_get_attribute_name(event_class, 4),
+       ok(!bt_ctf_event_class_get_attribute_name_by_index(event_class, 4),
                "bt_ctf_event_class_get_attribute_name handles a too large index correctly");
-       ok(!bt_ctf_event_class_get_attribute_value(NULL, 0),
+       ok(!bt_ctf_event_class_get_attribute_value_by_index(NULL, 0),
                "bt_ctf_event_class_get_attribute_value handles a NULL event class correctly");
-       ok(!bt_ctf_event_class_get_attribute_value(event_class, 4),
+       ok(!bt_ctf_event_class_get_attribute_value_by_index(event_class, 4),
                "bt_ctf_event_class_get_attribute_value handles a too large index correctly");
 
        memset(&attrs_count, 0, sizeof(attrs_count));
 
        for (i = 0; i < 4; ++i) {
-               ret_string = bt_ctf_event_class_get_attribute_name(event_class,
-                       i);
-               obj = bt_ctf_event_class_get_attribute_value(event_class, i);
+               ret_string = bt_ctf_event_class_get_attribute_name_by_index(
+                       event_class, i);
+               obj = bt_ctf_event_class_get_attribute_value_by_index(
+                       event_class, i);
                assert(ret_string && obj);
 
                if (!strcmp(ret_string, "id")) {
@@ -954,25 +955,25 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class,
                "bt_ctf_event_class_get_stream_class returns the correct stream class");
        bt_put(ret_stream_class);
 
-       ok(bt_ctf_event_class_get_field_count(NULL) < 0,
+       ok(bt_ctf_event_class_get_payload_type_field_count(NULL) < 0,
                "bt_ctf_event_class_get_field_count handles NULL correctly");
-       ok(bt_ctf_event_class_get_field_count(event_class) == 3,
+       ok(bt_ctf_event_class_get_payload_type_field_count(event_class) == 3,
                "bt_ctf_event_class_get_field_count returns a correct value");
 
-       ok(bt_ctf_event_class_get_field(NULL, &ret_string,
+       ok(bt_ctf_event_class_get_payload_type_field_by_index(NULL, &ret_string,
                &ret_field_type, 0) < 0,
                "bt_ctf_event_class_get_field handles a NULL event class correctly");
-       ok(bt_ctf_event_class_get_field(event_class, NULL,
+       ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, NULL,
                &ret_field_type, 0) == 0,
                "bt_ctf_event_class_get_field handles a NULL field name correctly");
        bt_put(ret_field_type);
-       ok(bt_ctf_event_class_get_field(event_class, &ret_string,
+       ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string,
                NULL, 0) == 0,
                "bt_ctf_event_class_get_field handles a NULL field type correctly");
-       ok(bt_ctf_event_class_get_field(event_class, &ret_string,
+       ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string,
                &ret_field_type, 42) < 0,
                "bt_ctf_event_class_get_field handles an invalid index correctly");
-       ok(bt_ctf_event_class_get_field(event_class, &ret_string,
+       ok(bt_ctf_event_class_get_payload_type_field_by_index(event_class, &ret_string,
                &ret_field_type, 0) == 0,
                "bt_ctf_event_class_get_field returns a field");
        ok(bt_ctf_field_type_compare(ret_field_type, uint_35_type) == 0,
@@ -2954,41 +2955,41 @@ int main(int argc, char **argv)
                "bt_ctf_trace_get_environment_field_count returns a correct number of environment fields");
 
        /* Test bt_ctf_trace_get_environment_field_name */
-       ok(bt_ctf_trace_get_environment_field_name(NULL, 0) == NULL,
+       ok(bt_ctf_trace_get_environment_field_name_by_index(NULL, 0) == NULL,
                "bt_ctf_trace_get_environment_field_name handles a NULL trace correctly");
-       ok(bt_ctf_trace_get_environment_field_name(trace, -1) == NULL,
+       ok(bt_ctf_trace_get_environment_field_name_by_index(trace, -1) == NULL,
                "bt_ctf_trace_get_environment_field_name handles an invalid index correctly (negative)");
-       ok(bt_ctf_trace_get_environment_field_name(trace, 5) == NULL,
+       ok(bt_ctf_trace_get_environment_field_name_by_index(trace, 5) == NULL,
                "bt_ctf_trace_get_environment_field_name handles an invalid index correctly (too large)");
-       ret_string = bt_ctf_trace_get_environment_field_name(trace, 0);
+       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 0);
        ok(ret_string && !strcmp(ret_string, "host"),
                "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name(trace, 1);
+       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 1);
        ok(ret_string && !strcmp(ret_string, "test_env_int_obj"),
                "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name(trace, 2);
+       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 2);
        ok(ret_string && !strcmp(ret_string, "test_env_str_obj"),
                "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name(trace, 3);
+       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 3);
        ok(ret_string && !strcmp(ret_string, "test_env_int"),
                "bt_ctf_trace_get_environment_field_name returns a correct field name");
-       ret_string = bt_ctf_trace_get_environment_field_name(trace, 4);
+       ret_string = bt_ctf_trace_get_environment_field_name_by_index(trace, 4);
        ok(ret_string && !strcmp(ret_string, "test_env_str"),
                "bt_ctf_trace_get_environment_field_name returns a correct field name");
 
        /* Test bt_ctf_trace_get_environment_field_value */
-       ok(bt_ctf_trace_get_environment_field_value(NULL, 0) == NULL,
+       ok(bt_ctf_trace_get_environment_field_value_by_index(NULL, 0) == NULL,
                "bt_ctf_trace_get_environment_field_value handles a NULL trace correctly");
-       ok(bt_ctf_trace_get_environment_field_value(trace, -1) == NULL,
+       ok(bt_ctf_trace_get_environment_field_value_by_index(trace, -1) == NULL,
                "bt_ctf_trace_get_environment_field_value handles an invalid index correctly (negative)");
-       ok(bt_ctf_trace_get_environment_field_value(trace, 5) == NULL,
+       ok(bt_ctf_trace_get_environment_field_value_by_index(trace, 5) == NULL,
                "bt_ctf_trace_get_environment_field_value handles an invalid index correctly (too large)");
-       obj = bt_ctf_trace_get_environment_field_value(trace, 1);
+       obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 1);
        ret = bt_value_integer_get(obj, &ret_int64_t);
        ok(!ret && ret_int64_t == 23,
                "bt_ctf_trace_get_environment_field_value succeeds in getting an integer value");
        BT_PUT(obj);
-       obj = bt_ctf_trace_get_environment_field_value(trace, 2);
+       obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 2);
        ret = bt_value_string_get(obj, &ret_string);
        ok(!ret && ret_string && !strcmp(ret_string, "the value"),
                "bt_ctf_trace_get_environment_field_value succeeds in getting a string value");
@@ -3015,7 +3016,7 @@ int main(int argc, char **argv)
                "bt_ctf_trace_set_environment_field_integer succeeds with an existing name");
        ok(bt_ctf_trace_get_environment_field_count(trace) == 5,
                "bt_ctf_trace_set_environment_field_integer with an existing key does not increase the environment size");
-       obj = bt_ctf_trace_get_environment_field_value(trace, 3);
+       obj = bt_ctf_trace_get_environment_field_value_by_index(trace, 3);
        ret = bt_value_integer_get(obj, &ret_int64_t);
        ok(!ret && ret_int64_t == 654321,
                "bt_ctf_trace_get_environment_field_value successfully replaces an existing field");
@@ -3325,9 +3326,9 @@ int main(int argc, char **argv)
        ok(stream1, "Instanciate a stream class from writer");
        ok(bt_ctf_trace_get_stream_count(trace) == 1,
                "bt_ctf_trace_get_stream_count() succeeds and returns the correct value (1)");
-       stream = bt_ctf_trace_get_stream(trace, 0);
+       stream = bt_ctf_trace_get_stream_by_index(trace, 0);
        ok(stream == stream1,
-               "bt_ctf_trace_get_stream() succeeds and returns the correct value");
+               "bt_ctf_trace_get_stream_by_index() succeeds and returns the correct value");
        BT_PUT(stream);
 
        /*
@@ -3339,13 +3340,13 @@ int main(int argc, char **argv)
                "bt_ctf_trace_get_clock_class_count correctly handles NULL");
        ok(bt_ctf_trace_get_clock_class_count(trace) == 1,
                "bt_ctf_trace_get_clock_class_count returns the correct number of clocks");
-       ok(!bt_ctf_trace_get_clock_class(NULL, 0),
+       ok(!bt_ctf_trace_get_clock_class_by_index(NULL, 0),
                "bt_ctf_trace_get_clock_class correctly handles NULL");
-       ok(!bt_ctf_trace_get_clock_class(trace, -1),
+       ok(!bt_ctf_trace_get_clock_class_by_index(trace, -1),
                "bt_ctf_trace_get_clock_class correctly handles negative indexes");
-       ok(!bt_ctf_trace_get_clock_class(trace, 1),
+       ok(!bt_ctf_trace_get_clock_class_by_index(trace, 1),
                "bt_ctf_trace_get_clock_class correctly handles out of bound accesses");
-       ret_clock_class = bt_ctf_trace_get_clock_class(trace, 0);
+       ret_clock_class = bt_ctf_trace_get_clock_class_by_index(trace, 0);
        ok(strcmp(bt_ctf_clock_class_get_name(ret_clock_class),
                bt_ctf_clock_get_name(clock)) == 0,
                "bt_ctf_trace_get_clock_class returns the right clock instance");
index 2f243b0581e3c5dfdb3ea66b52357e2348af3e9a..274f787264148a5fdd45b18035bfaa5d0a654d50 100644 (file)
@@ -946,7 +946,8 @@ void test_src_adds_port_in_port_connected(void)
        assert(sink_def_port);
        conn = bt_graph_connect_ports(graph, src_def_port, sink_def_port);
        assert(conn);
-       src_hello_port = bt_component_source_get_output_port(src, "hello");
+       src_hello_port = bt_component_source_get_output_port_by_name(src,
+               "hello");
        assert(src_hello_port);
 
        /* We're supposed to have 6 events */
index b66cb827ae1fdf6cc9f7b83189fcc85d564ba23c..a256b7cbcb958ed07c566044d7f22949a3823454 100644 (file)
@@ -87,8 +87,8 @@ static void test_invalid(const char *plugin_dir)
                "bt_plugin_get_path() handles NULL correctly");
        ok(bt_plugin_get_component_class_count(NULL) < 0,
                "bt_plugin_get_component_class_count() handles NULL correctly");
-       ok(!bt_plugin_get_component_class(NULL, 0),
-               "bt_plugin_get_component_class() handles NULL correctly");
+       ok(!bt_plugin_get_component_class_by_index(NULL, 0),
+               "bt_plugin_get_component_class_by_index() handles NULL correctly");
        ok(!bt_plugin_get_component_class_by_name_and_type(NULL, NULL, 0),
                "bt_plugin_get_component_class_by_name_and_type() handles NULL correctly");
 }
index 4b78966d6dfc5f8f1f2c4d3547909b5d9bdb5a5f..707672c5c1659e9892ea40d5437d609f4d91e69b 100644 (file)
@@ -1001,10 +1001,10 @@ void do_std_test(enum test test, const char *name,
                assert(count >= 0);
 
                for (i = 0; i < count; i++) {
-                       upstream_port = bt_component_source_get_output_port_at_index(
+                       upstream_port = bt_component_source_get_output_port_by_index(
                                src_comp, i);
                        assert(upstream_port);
-                       downstream_port = bt_component_filter_get_input_port_at_index(
+                       downstream_port = bt_component_filter_get_input_port_by_index(
                                muxer_comp, i);
                        assert(downstream_port);
                        conn = bt_graph_connect_ports(graph,
@@ -1017,7 +1017,7 @@ void do_std_test(enum test test, const char *name,
        }
 
        /* Connect muxer output port to sink input port */
-       upstream_port = bt_component_filter_get_output_port(muxer_comp,
+       upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
                "out");
        assert(upstream_port);
        downstream_port = bt_component_sink_get_default_input_port(sink_comp);
@@ -1351,7 +1351,7 @@ void connect_port_to_first_avail_muxer_port(struct bt_graph *graph,
 
        for (i = 0; i < count; i++) {
                struct bt_port *muxer_port =
-                       bt_component_filter_get_input_port_at_index(
+                       bt_component_filter_get_input_port_by_index(
                                muxer_comp, i);
 
                assert(muxer_port);
@@ -1484,7 +1484,7 @@ void test_single_end_then_multiple_full(void)
        assert(ret == 0);
 
        for (i = 0; i < count; i++) {
-               upstream_port = bt_component_source_get_output_port_at_index(
+               upstream_port = bt_component_source_get_output_port_by_index(
                        src_comp, i);
                assert(upstream_port);
                connect_port_to_first_avail_muxer_port(graph,
@@ -1493,7 +1493,7 @@ void test_single_end_then_multiple_full(void)
        }
 
        /* Connect muxer output port to sink input port */
-       upstream_port = bt_component_filter_get_output_port(muxer_comp,
+       upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
                "out");
        assert(upstream_port);
        downstream_port = bt_component_sink_get_default_input_port(sink_comp);
@@ -1613,7 +1613,7 @@ void test_single_again_end_then_multiple_full(void)
        assert(ret == 0);
 
        for (i = 0; i < count; i++) {
-               upstream_port = bt_component_source_get_output_port_at_index(
+               upstream_port = bt_component_source_get_output_port_by_index(
                        src_comp, i);
                assert(upstream_port);
                connect_port_to_first_avail_muxer_port(graph,
@@ -1622,7 +1622,7 @@ void test_single_again_end_then_multiple_full(void)
        }
 
        /* Connect muxer output port to sink input port */
-       upstream_port = bt_component_filter_get_output_port(muxer_comp,
+       upstream_port = bt_component_filter_get_output_port_by_name(muxer_comp,
                "out");
        assert(upstream_port);
        downstream_port = bt_component_sink_get_default_input_port(sink_comp);
This page took 0.106948 seconds and 4 git commands to generate.