.gitignore: add some more IDE / tools related file
[babeltrace.git] / src / ctf-writer / stream.c
index 5576628dee3af5617e1fe9b4b48518b76e648f2c..43150a880f2fb722f6b0c1fad6110fc45fdd43c6 100644 (file)
@@ -1,24 +1,8 @@
 /*
+ * SPDX-License-Identifier: MIT
+ *
  * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
  */
 
 #define BT_LOG_TAG "CTF-WRITER/STREAM"
@@ -49,7 +33,6 @@
 #include "trace.h"
 #include "writer.h"
 
-BT_HIDDEN
 void bt_ctf_stream_common_finalize(struct bt_ctf_stream_common *stream)
 {
        BT_LOGD("Finalizing common stream object: addr=%p, name=\"%s\"",
@@ -60,7 +43,6 @@ void bt_ctf_stream_common_finalize(struct bt_ctf_stream_common *stream)
        }
 }
 
-BT_HIDDEN
 int bt_ctf_stream_common_initialize(
                struct bt_ctf_stream_common *stream,
                struct bt_ctf_stream_class_common *stream_class, const char *name,
@@ -496,7 +478,7 @@ static
 void update_clock_value(uint64_t *val, uint64_t new_val,
                unsigned int new_val_size)
 {
-       const uint64_t pow2 = 1ULL << new_val_size;
+       const uint64_t pow2 = new_val_size == 64 ? 0 : 1ULL << new_val_size;
        const uint64_t mask = pow2 - 1;
        uint64_t val_masked;
 
@@ -1046,7 +1028,6 @@ end:
        return ret;
 }
 
-BT_HIDDEN
 struct bt_ctf_stream *bt_ctf_stream_create_with_id(
                struct bt_ctf_stream_class *stream_class,
                const char *name, uint64_t id)
@@ -1177,6 +1158,7 @@ end:
        return stream;
 }
 
+BT_EXPORT
 struct bt_ctf_stream *bt_ctf_stream_create(
                struct bt_ctf_stream_class *stream_class,
                const char *name, uint64_t id_param)
@@ -1185,6 +1167,7 @@ struct bt_ctf_stream *bt_ctf_stream_create(
                name, id_param);
 }
 
+BT_EXPORT
 int bt_ctf_stream_get_discarded_events_count(
                struct bt_ctf_stream *stream, uint64_t *count)
 {
@@ -1239,6 +1222,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream,
                uint64_t event_count)
 {
@@ -1380,6 +1364,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 int bt_ctf_stream_append_event(struct bt_ctf_stream *stream,
                struct bt_ctf_event *event)
 {
@@ -1466,6 +1451,7 @@ error:
        return ret;
 }
 
+BT_EXPORT
 struct bt_ctf_field *bt_ctf_stream_get_packet_context(struct bt_ctf_stream *stream)
 {
        struct bt_ctf_field *packet_context = NULL;
@@ -1483,6 +1469,7 @@ end:
        return packet_context;
 }
 
+BT_EXPORT
 int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream,
                struct bt_ctf_field *field)
 {
@@ -1519,6 +1506,7 @@ end:
        return ret;
 }
 
+BT_EXPORT
 struct bt_ctf_field *bt_ctf_stream_get_packet_header(struct bt_ctf_stream *stream)
 {
        struct bt_ctf_field *packet_header = NULL;
@@ -1536,6 +1524,7 @@ end:
        return packet_header;
 }
 
+BT_EXPORT
 int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream,
                struct bt_ctf_field *field)
 {
@@ -1607,6 +1596,7 @@ void reset_structure_field(struct bt_ctf_field *structure, const char *name)
        }
 }
 
+BT_EXPORT
 int bt_ctf_stream_flush(struct bt_ctf_stream *stream)
 {
        int ret = 0;
@@ -1933,7 +1923,7 @@ end:
  * Returns the following codes:
  * 1 if the field was found and set,
  * 0 if nothing was done (field not found, or was already set),
- * <0 if an error was encoutered
+ * <0 if an error was encountered
  */
 static
 int try_set_structure_field_integer(struct bt_ctf_field *structure, const char *name,
@@ -1942,17 +1932,20 @@ int try_set_structure_field_integer(struct bt_ctf_field *structure, const char *
        return _set_structure_field_integer(structure, name, value, BT_CTF_FALSE);
 }
 
+BT_EXPORT
 struct bt_ctf_stream_class *bt_ctf_stream_get_class(
                struct bt_ctf_stream *stream)
 {
        return bt_ctf_object_get_ref(bt_ctf_stream_common_borrow_class(BT_CTF_TO_COMMON(stream)));
 }
 
+BT_EXPORT
 const char *bt_ctf_stream_get_name(struct bt_ctf_stream *stream)
 {
        return bt_ctf_stream_common_get_name(BT_CTF_TO_COMMON(stream));
 }
 
+BT_EXPORT
 int64_t bt_ctf_stream_get_id(struct bt_ctf_stream *stream)
 {
        return bt_ctf_stream_common_get_id(BT_CTF_TO_COMMON(stream));
This page took 0.025557 seconds and 4 git commands to generate.