From 11339871e4af1d37544aa4f7568d9f6825b7a64c Mon Sep 17 00:00:00 2001 From: jiuker Date: Wed, 5 Aug 2026 10:05:12 +0800 Subject: [PATCH] fix warnings fix warnings --- src/baseclient.cc | 2 +- src/client.cc | 24 ++++++++++++++++++------ tests/tests.cc | 40 ++++++++++++++++++++++++++++++++-------- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/baseclient.cc b/src/baseclient.cc index 78e38fe..24da689 100644 --- a/src/baseclient.cc +++ b/src/baseclient.cc @@ -131,7 +131,7 @@ void BaseClient::HandleRedirectResponse(std::string& code, std::string& message, } Result BaseClient::GetErrorResponse(http::Response resp, - std::string_view resource, + std::string_view, http::Method method, const std::string& bucket_name, const std::string& object_name) { diff --git a/src/client.cc b/src/client.cc index e6bcad8..4923ff2 100644 --- a/src/client.cc +++ b/src/client.cc @@ -269,7 +269,7 @@ struct ScopedRDMARegistration { } // namespace -ListObjectsResult::ListObjectsResult(error::Error err) : failed_(true) { +ListObjectsResult::ListObjectsResult(error::Error) : failed_(true) { resp_ = std::make_shared(); itr_ = resp_->contents.end(); } @@ -384,7 +384,7 @@ void ListObjectsResult::Populate() { } } -RemoveObjectsResult::RemoveObjectsResult(error::Error err) { +RemoveObjectsResult::RemoveObjectsResult(error::Error) { done_ = true; itr_ = resp_.errors.end(); } @@ -1023,7 +1023,10 @@ Result Client::ComposeObject(ComposeObjectArgs args) { amu_args.region = args.region; amu_args.object = args.object; amu_args.upload_id = upload_id; - AbortMultipartUpload(amu_args); + if (auto amu_resp = AbortMultipartUpload(amu_args); !amu_resp) { + std::cerr << "warning: unable to abort multipart upload: " + << amu_resp.error().String() << std::endl; + } } return resp; @@ -1586,7 +1589,10 @@ Result Client::PutObject(PutObjectArgs args) { amu_args.region = std::move(args.region); amu_args.object = std::move(args.object); amu_args.upload_id = upload_id; - AbortMultipartUpload(amu_args); + if (auto amu_resp = AbortMultipartUpload(amu_args); !amu_resp) { + std::cerr << "warning: unable to abort multipart upload: " + << amu_resp.error().String() << std::endl; + } } return tl::make_unexpected(first_err); } @@ -1611,7 +1617,10 @@ Result Client::PutObject(PutObjectArgs args) { amu_args.region = std::move(args.region); amu_args.object = std::move(args.object); amu_args.upload_id = upload_id; - AbortMultipartUpload(amu_args); + if (auto amu_resp = AbortMultipartUpload(amu_args); !amu_resp) { + std::cerr << "warning: unable to abort multipart upload: " + << amu_resp.error().String() << std::endl; + } } if (!cmu_resp) { return tl::make_unexpected(cmu_resp.error()); @@ -1658,7 +1667,10 @@ Result Client::PutObject(PutObjectArgs args) { amu_args.region = std::move(args.region); amu_args.object = std::move(args.object); amu_args.upload_id = upload_id; - AbortMultipartUpload(amu_args); + if (auto amu_resp = AbortMultipartUpload(amu_args); !amu_resp) { + std::cerr << "warning: unable to abort multipart upload: " + << amu_resp.error().String() << std::endl; + } } return resp; diff --git a/tests/tests.cc b/tests/tests.cc index 824fc59..5b00dc0 100644 --- a/tests/tests.cc +++ b/tests/tests.cc @@ -798,7 +798,10 @@ class Tests { try { minio::s3::RemoveBucketArgs args; args.bucket = b; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << b << ": " + << rm_resp.error().String() << std::endl; + } } catch (...) { } }; @@ -1101,7 +1104,10 @@ class Tests { } catch (const std::runtime_error&) { minio::s3::RemoveBucketArgs args; args.bucket = bucket_name; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << bucket_name + << ": " << rm_resp.error().String() << std::endl; + } throw; } } @@ -1243,7 +1249,10 @@ class Tests { } catch (const std::runtime_error&) { minio::s3::RemoveBucketArgs args; args.bucket = bucket_name; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << bucket_name + << ": " << rm_resp.error().String() << std::endl; + } throw; } } @@ -1296,7 +1305,10 @@ class Tests { try { minio::s3::RemoveBucketArgs args; args.bucket = b; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << b << ": " + << rm_resp.error().String() << std::endl; + } } catch (...) { } } @@ -1371,7 +1383,10 @@ class Tests { { minio::s3::RemoveBucketArgs args; args.bucket = bucket_name; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << bucket_name + << ": " << rm_resp.error().String() << std::endl; + } } } @@ -1405,7 +1420,10 @@ class Tests { { minio::s3::RemoveBucketArgs args; args.bucket = bucket_name; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << bucket_name + << ": " << rm_resp.error().String() << std::endl; + } } } @@ -1439,7 +1457,10 @@ class Tests { { minio::s3::RemoveBucketArgs args; args.bucket = bucket_name; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << bucket_name + << ": " << rm_resp.error().String() << std::endl; + } } } @@ -1473,7 +1494,10 @@ class Tests { { minio::s3::RemoveBucketArgs args; args.bucket = bucket_name; - client_.RemoveBucket(args); + if (auto rm_resp = client_.RemoveBucket(args); !rm_resp) { + std::cout << "warning: unable to remove bucket " << bucket_name + << ": " << rm_resp.error().String() << std::endl; + } } }