From 7c9032a07f6c60afb9422e73bf82d781a771892c Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 15 Apr 2021 13:31:25 +0800 Subject: [PATCH] rgw: cast rgw_max_chunk_size to off_t as the left-hand operator is promoted to off_t which is a signed integer, while rgw_max_chunk_size will be an unsigned after the yaml-to-cxx migration. so let's cast it to `off_t` before comparing them. the same applies to rgw_copy_obj_progress_every_bytes. Signed-off-by: Kefu Chai --- src/rgw/rgw_compression.cc | 4 ++-- src/rgw/rgw_op.cc | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_compression.cc b/src/rgw/rgw_compression.cc index 2eaf9da30d509..fedc46765a5cd 100644 --- a/src/rgw/rgw_compression.cc +++ b/src/rgw/rgw_compression.cc @@ -141,8 +141,8 @@ int RGWGetObj_Decompress::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len return cr; } ++first_block; - while (out_bl.length() - q_ofs >= cct->_conf->rgw_max_chunk_size) - { + while (out_bl.length() - q_ofs >= + static_cast(cct->_conf->rgw_max_chunk_size)) { off_t ch_len = std::min(cct->_conf->rgw_max_chunk_size, q_len); q_len -= ch_len; r = next->handle_data(out_bl, q_ofs, ch_len); diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index f25adc06e50e1..1bb805ed6a983 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -5053,8 +5053,10 @@ void RGWCopyObj::progress_cb(off_t ofs) if (!s->cct->_conf->rgw_copy_obj_progress) return; - if (ofs - last_ofs < s->cct->_conf->rgw_copy_obj_progress_every_bytes) + if (ofs - last_ofs < + static_cast(s->cct->_conf->rgw_copy_obj_progress_every_bytes)) { return; + } send_partial_response(ofs); -- 2.39.5