Fix: sink.ctf.fs: writing 64bit real number as 32bit
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 7 May 2019 19:39:41 +0000 (15:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 8 May 2019 18:08:30 +0000 (14:08 -0400)
Both 32bit and 64bit Trace IR real numbers are written as 32bit CTF
floats with the `bt_ctfser_write_float32()`. This is most probably a
copy-paste error.

To fix this, use the `bt_ctfser_write_float64()` in the else branch instead.

Coverity report:
  CID 1401207 (#1 of 1): Identical code for different branches (IDENTICAL_BRANCHES)
  identical_branches: The same code is executed regardless of whether
  fc->base.size == 32U is true, because the 'then' and 'else' branches
  are identical. Should one of the branches be modified, or the entire
  'if' statement replaced?

Reported-by: Coverity (1401207) Identical code for different branches
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I462fd47e968e39f5878431d5ac6cbcbbf1d2ffcf
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1268
Tested-by: jenkins
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
plugins/ctf/fs-sink/fs-sink-stream.c

index 187ce28101b749a80242ac2ee0a151654e922ea7..6e926def2241f9e459bb34146077502c60ef2c81 100644 (file)
@@ -222,7 +222,7 @@ int write_float_field(struct fs_sink_stream *stream,
                ret = bt_ctfser_write_float32(&stream->ctfser, val,
                        fc->base.base.alignment, BYTE_ORDER);
        } else {
-               ret = bt_ctfser_write_float32(&stream->ctfser, val,
+               ret = bt_ctfser_write_float64(&stream->ctfser, val,
                        fc->base.base.alignment, BYTE_ORDER);
        }
 
This page took 0.025995 seconds and 4 git commands to generate.