Move to kernel style SPDX license identifiers
[babeltrace.git] / src / plugins / ctf / fs-sink / fs-sink-stream.c
index 717571e0d2f3b903d0692ef295136680529cc21e..1c83562a003c0e249ece3af1bebb8312d5681dd1 100644 (file)
@@ -1,23 +1,7 @@
 /*
- * Copyright 2019 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:
+ * SPDX-License-Identifier: MIT
  *
- * 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.
+ * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
 #define BT_COMP_LOG_SELF_COMP (stream->trace->fs_sink->self_comp)
@@ -250,12 +234,14 @@ int write_float_field(struct fs_sink_stream *stream,
                struct fs_sink_ctf_field_class_float *fc, const bt_field *field)
 {
        int ret;
-       double val = bt_field_real_get_value(field);
+       double val;
 
        if (fc->base.size == 32) {
+               val = (double) bt_field_real_single_precision_get_value(field);
                ret = bt_ctfser_write_float32(&stream->ctfser, val,
                        fc->base.base.alignment, BYTE_ORDER);
        } else {
+               val = bt_field_real_double_precision_get_value(field);
                ret = bt_ctfser_write_float64(&stream->ctfser, val,
                        fc->base.base.alignment, BYTE_ORDER);
        }
@@ -389,7 +375,7 @@ int write_variant_field(struct fs_sink_stream *stream,
                const bt_field *field)
 {
        uint64_t opt_index =
-               bt_field_variant_get_selected_option_field_index(field);
+               bt_field_variant_get_selected_option_index(field);
        int ret;
 
        if (fc->tag_is_before) {
@@ -447,7 +433,7 @@ int write_field(struct fs_sink_stream *stream,
                ret = write_variant_field(stream, (void *) fc, field);
                break;
        default:
-               abort();
+               bt_common_abort();
        }
 
        return ret;
@@ -468,7 +454,7 @@ int write_event_header(struct fs_sink_stream *stream,
 
        /* Time */
        if (stream->sc->default_clock_class) {
-               BT_ASSERT(cs);
+               BT_ASSERT_DBG(cs);
                ret = bt_ctfser_write_byte_aligned_unsigned_int(&stream->ctfser,
                        bt_clock_snapshot_get_value(cs), 8, 64, BYTE_ORDER);
                if (G_UNLIKELY(ret)) {
@@ -497,7 +483,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
        /* Common context */
        if (stream->sc->event_common_context_fc) {
                field = bt_event_borrow_common_context_field_const(event);
-               BT_ASSERT(field);
+               BT_ASSERT_DBG(field);
                ret = write_struct_field(stream,
                        (void *) stream->sc->event_common_context_fc,
                        field, true);
@@ -509,7 +495,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
        /* Specific context */
        if (ec->spec_context_fc) {
                field = bt_event_borrow_specific_context_field_const(event);
-               BT_ASSERT(field);
+               BT_ASSERT_DBG(field);
                ret = write_struct_field(stream, (void *) ec->spec_context_fc,
                        field, true);
                if (G_UNLIKELY(ret)) {
@@ -520,7 +506,7 @@ int fs_sink_stream_write_event(struct fs_sink_stream *stream,
        /* Specific context */
        if (ec->payload_fc) {
                field = bt_event_borrow_payload_field_const(event);
-               BT_ASSERT(field);
+               BT_ASSERT_DBG(field);
                ret = write_struct_field(stream, (void *) ec->payload_fc,
                        field, true);
                if (G_UNLIKELY(ret)) {
This page took 0.025944 seconds and 4 git commands to generate.