Fix: pass explicit type to std::min for 32-bit platforms
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 18 Nov 2021 16:15:29 +0000 (11:15 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Nov 2021 19:26:06 +0000 (14:26 -0500)
Provide an explicit type to templates when comparing a 'uint64_t' with a
type that is less than 64-bits on 32-bit platforms.

  main.cpp: In function ‘relay_connection_status relay_process_data_receive_payload(relay_connection*)’:
  main.cpp:3632:44: error: no matching function for call to ‘min(uint64_t&, const size_t&)’
   3632 |                 size_t recv_size = std::min(left_to_receive, chunk_size);
        |                                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I8fe8725c5c888cce9c54d564bd668e9723c0f947
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/main.cpp
src/bin/lttng-relayd/stream.cpp

index 4b7726d4e61b6466616d3e9242f2325cf871a357..1da83086e82b4d7107fc4d36e5c97d1cf173b388 100644 (file)
@@ -3629,7 +3629,7 @@ static enum relay_connection_status relay_process_data_receive_payload(
         *   - the on-stack data buffer
         */
        while (left_to_receive > 0 && !partial_recv) {
-               size_t recv_size = std::min(left_to_receive, chunk_size);
+               size_t recv_size = std::min<uint64_t>(left_to_receive, chunk_size);
                struct lttng_buffer_view packet_chunk;
 
                ret = conn->sock->ops->recvmsg(conn->sock, data_buffer,
index 15800929552fe56242628a7e51a7b79bbc727920..346936d8488f1436186f4b5abf065bf86131d2d7 100644 (file)
@@ -261,7 +261,7 @@ static int rotate_truncate_stream(struct relay_stream *stream)
        while (copy_bytes_left) {
                ssize_t io_ret;
                char copy_buffer[FILE_IO_STACK_BUFFER_SIZE];
-               const off_t copy_size_this_pass = std::min(copy_bytes_left, sizeof(copy_buffer));
+               const off_t copy_size_this_pass = std::min<uint64_t>(copy_bytes_left, sizeof(copy_buffer));
 
                io_ret = fs_handle_read(previous_stream_file, copy_buffer,
                                copy_size_this_pass);
This page took 0.027282 seconds and 4 git commands to generate.