From df0fc0bf4fc2ca3ab33244726aea49771aeaff3e Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 30 Jul 2019 13:16:31 -0400 Subject: [PATCH] `ctf` plugins: port: cast to intmax_t all off_t variables when printing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch fixes new sites since the following commit: commit 1974687e6b7a08d8383a4a5c75265d0ed3b8c5c9 Author: Michael Jeanson 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 Signed-off-by: Jérémie Galarneau Change-Id: I8c0677f5ff590c25df6257c2d3f5142de93d01b0 Signed-off-by: Jonathan Rajotte Reviewed-on: https://review.lttng.org/c/babeltrace/+/1803 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/plugins/ctf/common/msg-iter/msg-iter.c | 2 +- src/plugins/ctf/fs-src/data-stream-file.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/ctf/common/msg-iter/msg-iter.c b/src/plugins/ctf/common/msg-iter/msg-iter.c index 78a65f1a..7c475671 100644 --- a/src/plugins/ctf/common/msg-iter/msg-iter.c +++ b/src/plugins/ctf/common/msg-iter/msg-iter.c @@ -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; } diff --git a/src/plugins/ctf/fs-src/data-stream-file.c b/src/plugins/ctf/fs-src/data-stream-file.c index 3a82da30..4351ae72 100644 --- a/src/plugins/ctf/fs-src/data-stream-file.c +++ b/src/plugins/ctf/fs-src/data-stream-file.c @@ -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); -- 2.34.1