Address stray warnings (#2237)

This commit is contained in:
Andrew Gaul 2023-07-29 09:19:18 +09:00 committed by GitHub
parent 1f04165a33
commit a7b38a6940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 15 deletions

View File

@ -30,6 +30,7 @@ Checks: '
-modernize-raw-string-literal,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-default-member-init,
-modernize-use-emplace,
-modernize-use-trailing-return-type,
-modernize-use-using,

View File

@ -74,6 +74,12 @@ static const char SPECIAL_DARWIN_MIME_FILE[] = "/etc/apache2/mime.types";
#define CURLSHE_NOT_BUILT_IN 5
#endif
#if LIBCURL_VERSION_NUM >= 0x073100
#define S3FS_CURLOPT_XFERINFOFUNCTION CURLOPT_XFERINFOFUNCTION
#else
#define S3FS_CURLOPT_XFERINFOFUNCTION CURLOPT_PROGRESSFUNCTION
#endif
//-------------------------------------------------------------------
// Class S3fsCurl
//-------------------------------------------------------------------
@ -1949,10 +1955,7 @@ bool S3fsCurl::ResetHandle(AutoLock::Type locktype)
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_NOPROGRESS, 0)){
return false;
}
// [NOTE]
// CURLOPT_PROGRESSFUNCTION should be changed to CURLOPT_XFERINFOFUNCTION,
// but CnetOS7's curl version is old, so it haven't been changed yet.
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_PROGRESSFUNCTION, S3fsCurl::CurlProgress)){
if(CURLE_OK != curl_easy_setopt(hCurl, S3FS_CURLOPT_XFERINFOFUNCTION, S3fsCurl::CurlProgress)){
return false;
}
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_PROGRESSDATA, hCurl)){

View File

@ -2350,7 +2350,7 @@ ssize_t FdEntity::WriteStreamUpload(PseudoFdInfo* pseudo_obj, const char* bytes,
bool isuploading = pseudo_obj->IsUploading();
ssize_t result;
if(0 != (result = pseudo_obj->UploadBoundaryLastUntreatedArea(path.c_str(), tmporgmeta, this))){
S3FS_PRN_ERR("Failed to upload the last untreated parts(area) : result=%d", result);
S3FS_PRN_ERR("Failed to upload the last untreated parts(area) : result=%zd", result);
return result;
}

View File

@ -70,7 +70,7 @@ void* PseudoFdInfo::MultipartUploadThreadWorker(void* arg)
// setup and make curl object
std::unique_ptr<S3fsCurl> s3fscurl(S3fsCurl::CreateParallelS3fsCurl(pthparam->path.c_str(), pthparam->upload_fd, pthparam->start, pthparam->size, pthparam->part_num, pthparam->is_copy, pthparam->petag, pthparam->upload_id, result));
if(nullptr == s3fscurl.get()){
if(nullptr == s3fscurl){
S3FS_PRN_ERR("failed creating s3fs curl object for uploading [path=%s][start=%lld][size=%lld][part=%d]", pthparam->path.c_str(), static_cast<long long>(pthparam->start), static_cast<long long>(pthparam->size), pthparam->part_num);
// set result for exiting

View File

@ -28,12 +28,10 @@ int main(int argc, const char *argv[])
if (argc != 2) {
return 1;
}
long long count = strtoull(argv[1], NULL, 10);
unsigned long long count = strtoull(argv[1], nullptr, 10);
char buf[128 * 1024];
long long i;
for (i = 0; i < count; i += sizeof(buf)) {
long long j;
for (j = 0; j < sizeof(buf) / sizeof(i); ++j) {
for (size_t i = 0; i < count; i += sizeof(buf)) {
for (size_t j = 0; j < sizeof(buf) / sizeof(i); ++j) {
*(reinterpret_cast<long long *>(buf) + j) = i / sizeof(i) + j;
}
fwrite(buf, 1, sizeof(buf) > count - i ? count - i : sizeof(buf), stdout);

View File

@ -53,8 +53,8 @@ const char str_ext_sock[] = "sock";
// issues using on Linux and we also must support for macos, this simple
// test program defines a fixed value for simplicity.
//
#define S3FS_TEST_PATH_MAX 255
int max_base_path_length = S3FS_TEST_PATH_MAX - 5;
static const size_t S3FS_TEST_PATH_MAX = 255;
static const size_t MAX_BASE_PATH_LENGTH = S3FS_TEST_PATH_MAX - 5;
//---------------------------------------------------------
// Test function
@ -146,8 +146,8 @@ int main(int argc, const char *argv[])
fprintf(stdout, "%s\n", usage_string);
exit(EXIT_SUCCESS);
}
if(max_base_path_length < strlen(argv[1])){
fprintf(stderr, "[ERROR] Base file path is too long, it must be less than %d\n", max_base_path_length);
if(MAX_BASE_PATH_LENGTH < strlen(argv[1])){
fprintf(stderr, "[ERROR] Base file path is too long, it must be less than %zu\n", MAX_BASE_PATH_LENGTH);
exit(EXIT_FAILURE);
}