`ctf` plugins: port: cast to intmax_t all off_t variables when printing
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 30 Jul 2019 17:16:31 +0000 (13:16 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 31 Jul 2019 21:19:22 +0000 (17:19 -0400)
This patch fixes new sites since the following commit:

  commit 1974687e6b7a08d8383a4a5c75265d0ed3b8c5c9
  Author: Michael Jeanson <mjeanson@efficios.com>
  Date:   Mon Jul 10 12:39:38 2017 -0400

      Port: handle 'size_t' / 'off_t' on Solaris

      The size of 'size_t' / 'off_t' vary on some platforms, use C99 portable
      macros and print formats to handle them.

      Print 'size_t' with '%zu' and use SIZE_MAX as max value.
      Print 'off_t' casted to 'intmax_t' with '%jd'.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8c0677f5ff590c25df6257c2d3f5142de93d01b0
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1803
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/common/msg-iter/msg-iter.c
src/plugins/ctf/fs-src/data-stream-file.c

index 78a65f1adb631c1cfef61f3c79feca79b1dc5436..7c4756716d3321f22980cefef5e2aa9b58f42032 100644 (file)
@@ -2920,7 +2920,7 @@ enum bt_msg_iter_status bt_msg_iter_seek(struct bt_msg_iter *notit,
 
        BT_ASSERT(notit);
        if (offset < 0) {
-               BT_COMP_LOGE("Cannot seek to negative offset: offset=%jd", offset);
+               BT_COMP_LOGE("Cannot seek to negative offset: offset=%jd", (intmax_t) offset);
                ret = BT_MSG_ITER_STATUS_INVAL;
                goto end;
        }
index 3a82da3046ffdf62d1c6d85d074c6a4c0316a074..4351ae72c1a0566c417c817711ddc8fbca6e8e65 100644 (file)
@@ -216,8 +216,8 @@ enum bt_msg_iter_medium_status medop_seek(enum bt_msg_iter_seek_whence whence,
        if (whence != BT_MSG_ITER_SEEK_WHENCE_SET ||
                offset < 0 || offset > file_size) {
                BT_COMP_LOGE("Invalid medium seek request: whence=%d, offset=%jd, "
-                               "file-size=%jd", (int) whence, offset,
-                               file_size);
+                               "file-size=%jd", (int) whence, (intmax_t) offset,
+                               (intmax_t) file_size);
                ret = BT_MSG_ITER_MEDIUM_STATUS_INVAL;
                goto end;
        }
@@ -236,7 +236,7 @@ enum bt_msg_iter_medium_status medop_seek(enum bt_msg_iter_seek_whence whence,
                int unmap_ret;
                BT_COMP_LOGD("Medium seek request cannot be accomodated by the current "
                                "file mapping: offset=%jd, mmap-offset=%jd, "
-                               "mmap-len=%zu", offset, ds_file->mmap_offset,
+                               "mmap-len=%zu", (intmax_t) offset, (intmax_t) ds_file->mmap_offset,
                                ds_file->mmap_len);
                unmap_ret = ds_file_munmap(ds_file);
                if (unmap_ret) {
@@ -576,9 +576,9 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                                        "packet-offset=%jd, packet-size-bytes=%jd, "
                                        "file-size=%jd",
                                        ds_file->file->path->str,
-                                       current_packet_offset_bytes,
-                                       current_packet_size_bytes,
-                                       ds_file->file->size);
+                                       (intmax_t) current_packet_offset_bytes,
+                                       (intmax_t) current_packet_size_bytes,
+                                       (intmax_t) ds_file->file->size);
                        goto error;
                }
 
@@ -600,8 +600,8 @@ struct ctf_fs_ds_index *build_index_from_stream_file(
                current_packet_offset_bytes += current_packet_size_bytes;
                BT_COMP_LOGD("Seeking to next packet: current-packet-offset=%jd, "
                        "next-packet-offset=%jd",
-                       current_packet_offset_bytes - current_packet_size_bytes,
-                       current_packet_offset_bytes);
+                       (intmax_t) (current_packet_offset_bytes - current_packet_size_bytes),
+                       (intmax_t) current_packet_offset_bytes);
 
        } while (iter_status == BT_MSG_ITER_STATUS_OK);
 
This page took 0.027268 seconds and 4 git commands to generate.