Skip to content

Commit e6a6f8f

Browse files
author
zackcao
committed
Merge branch 'fix-zhiyan-error' into 'master' (merge request !63)
修改智研代码检查问题
2 parents b19b56b + 81e57ab commit e6a6f8f

File tree

8 files changed

+35
-40
lines changed

8 files changed

+35
-40
lines changed

include/op/file_copy_task.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ namespace qcloud_cos {
1313

1414
class FileCopyTask : public Poco::Runnable {
1515
public:
16-
FileCopyTask(const std::string& host,
16+
FileCopyTask(const std::string& host,
1717
const std::string& path,
18-
const bool is_https,
19-
const BaseOpUtil& op_util,
18+
const bool is_https,
19+
const BaseOpUtil& op_util,
2020
uint64_t conn_timeout_in_ms,
2121
uint64_t recv_timeout_in_ms);
2222

include/op/file_upload_task.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ namespace qcloud_cos {
1212

1313
class FileUploadTask : public Poco::Runnable {
1414
public:
15-
FileUploadTask(const std::string& host,
16-
const std::string& path,
17-
const bool is_https,
18-
const BaseOpUtil& op_util,
15+
FileUploadTask(const std::string& host,
16+
const std::string& path,
17+
const bool is_https,
18+
const BaseOpUtil& op_util,
1919
uint64_t conn_timeout_in_ms,
2020
uint64_t recv_timeout_in_ms, unsigned char* pbuf = NULL,
2121
const size_t data_len = 0,
@@ -25,9 +25,9 @@ class FileUploadTask : public Poco::Runnable {
2525
void *user_data = nullptr);
2626

2727
FileUploadTask(const std::string& host,
28-
const std::string& path,
29-
const bool is_https,
30-
const BaseOpUtil& op_util,
28+
const std::string& path,
29+
const bool is_https,
30+
const BaseOpUtil& op_util,
3131
const std::map<std::string, std::string>& headers,
3232
const std::map<std::string, std::string>& params,
3333
uint64_t conn_timeout_in_ms, uint64_t recv_timeout_in_ms,
@@ -38,8 +38,8 @@ class FileUploadTask : public Poco::Runnable {
3838
void *user_data = nullptr);
3939

4040
FileUploadTask(const std::string& host,
41-
const std::string& path,
42-
const bool is_https,
41+
const std::string& path,
42+
const bool is_https,
4343
const BaseOpUtil& op_util,
4444
const std::map<std::string, std::string>& headers,
4545
const std::map<std::string, std::string>& params,

src/op/file_copy_task.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
namespace qcloud_cos {
1010

11-
FileCopyTask::FileCopyTask(const std::string& host,
12-
const std::string& path,
13-
const bool is_https,
11+
FileCopyTask::FileCopyTask(const std::string& host,
12+
const std::string& path,
13+
const bool is_https,
1414
const BaseOpUtil& op_util,
1515
uint64_t conn_timeout_in_ms,
1616
uint64_t recv_timeout_in_ms)

src/op/file_download_task.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace qcloud_cos {
1111

12-
FileDownTask::FileDownTask(const std::string& host,
13-
const std::string& path,
14-
const bool is_https,
12+
FileDownTask::FileDownTask(const std::string& host,
13+
const std::string& path,
14+
const bool is_https,
1515
const BaseOpUtil& op_util,
1616
const std::map<std::string, std::string>& headers,
1717
const std::map<std::string, std::string>& params,

src/op/file_upload_task.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
namespace qcloud_cos {
1616

17-
FileUploadTask::FileUploadTask(const std::string& host,
18-
const std::string& path,
19-
const bool is_https,
17+
FileUploadTask::FileUploadTask(const std::string& host,
18+
const std::string& path,
19+
const bool is_https,
2020
const BaseOpUtil& op_util,
2121
uint64_t conn_timeout_in_ms,
2222
uint64_t recv_timeout_in_ms, unsigned char* pbuf,
@@ -47,7 +47,7 @@ FileUploadTask::FileUploadTask(const std::string& host,
4747

4848
FileUploadTask::FileUploadTask(
4949
const std::string& host,
50-
const std::string& path,
50+
const std::string& path,
5151
const bool is_https,
5252
const BaseOpUtil& op_util,
5353
const std::map<std::string, std::string>& headers,
@@ -82,7 +82,7 @@ FileUploadTask::FileUploadTask(
8282

8383
FileUploadTask::FileUploadTask(
8484
const std::string& host,
85-
const std::string& path,
85+
const std::string& path,
8686
const bool is_https,
8787
const BaseOpUtil& op_util,
8888
const std::map<std::string, std::string>& headers,
@@ -258,7 +258,7 @@ void FileUploadTask::SendRequestOnce(std::string domain, std::string md5_str) {
258258
if (mb_check_crc64) {
259259
std::map<std::string, std::string>::const_iterator c_itr =
260260
m_resp_headers.find(kRespHeaderXCosHashCrc64Ecma);
261-
if (c_itr == m_resp_headers.end() ||
261+
if (c_itr == m_resp_headers.end() ||
262262
StringUtil::StringToUint64(c_itr->second) != m_crc64_value) {
263263
SDK_LOG_ERR(
264264
"Response x-cos-hash-crc64ecma is not correct, try again. Expect crc64 is %" PRIu64 ", but "

src/op/object_op.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,15 +1791,15 @@ CosResult ObjectOp::MultiThreadUpload(
17911791
if (req.CheckCRC64()) {
17921792
// 如果已经计算了part的crc64值,只需要直接流式合并即可
17931793
if (ptask->GetCrc64Value() != 0) {
1794-
crc64_file = CRC64::CombineCRC(crc64_file, ptask->GetCrc64Value(),
1794+
crc64_file = CRC64::CombineCRC(crc64_file, ptask->GetCrc64Value(),
17951795
static_cast<uintmax_t>(part_buf_info[task_index].len));
1796-
SDK_LOG_DBG("Combine Crc64: %" PRIu64 ", Part Crc64: %" PRIu64,
1796+
SDK_LOG_DBG("Combine Crc64: %" PRIu64 ", Part Crc64: %" PRIu64,
17971797
crc64_file, ptask->GetCrc64Value());
17981798
} else {
17991799
// 两种情况都有可能:
18001800
// 1、CheckPartCrc64()为false
18011801
// 2、此part是断点续传已经上传的part
1802-
crc64_file = CRC64::CalcCRC(crc64_file, static_cast<void *>(part_buf_info[task_index].buf),
1802+
crc64_file = CRC64::CalcCRC(crc64_file, static_cast<void *>(part_buf_info[task_index].buf),
18031803
part_buf_info[task_index].len);
18041804
SDK_LOG_DBG("Calc Crc64: %" PRIu64, crc64_file)
18051805
}
@@ -2010,7 +2010,7 @@ uint64_t ObjectOp::GetContent(const std::string& src,
20102010
void ObjectOp::FillUploadTask(const std::string& upload_id,
20112011
const std::string& host, const std::string& path,
20122012
unsigned char* file_content_buf, uint64_t len,
2013-
uint64_t part_number, FileUploadTask* task_ptr,
2013+
uint64_t part_number, FileUploadTask* task_ptr,
20142014
bool sign_header_host, bool check_crc64) {
20152015
std::map<std::string, std::string> req_params;
20162016
req_params.insert(std::make_pair("uploadId", upload_id));

src/util/base_op_util.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
#include "util/base_op_util.h"
33
#include "cos_sys_config.h"
4-
#include <thread>
5-
#include "util/simple_dns_cache.h"
64
#include "util/codec_util.h"
5+
#include "util/simple_dns_cache.h"
6+
#include <thread>
77

88
namespace qcloud_cos {
99
SimpleDnsCache& GetGlobalDnsCacheInstance() {
@@ -12,8 +12,7 @@ SimpleDnsCache& GetGlobalDnsCacheInstance() {
1212
return dns_cache;
1313
}
1414

15-
bool BaseOpUtil::ShouldChangeBackupDomain(const CosResult &result, const uint32_t &request_num, const bool is_ci_req) const
16-
{
15+
bool BaseOpUtil::ShouldChangeBackupDomain(const CosResult &result, const uint32_t &request_num, const bool is_ci_req) const {
1716
if (is_ci_req) {
1817
// 请求到万象的, 不切域名
1918
return false;
@@ -54,8 +53,7 @@ bool BaseOpUtil::UseDefaultDomain() const {
5453
}
5554

5655
std::string BaseOpUtil::GetRealUrl(const std::string& host, const std::string& path,
57-
bool is_https, bool is_generate_presigned_url) const
58-
{
56+
bool is_https, bool is_generate_presigned_url) const {
5957
// 1. host优先级,私有ip > 自定义域名 > DNS cache > 默认域名
6058
std::string dest_uri;
6159
std::string dest_host = host;
@@ -96,8 +94,7 @@ uint64_t BaseOpUtil::GetMaxRetryTimes() const
9694
return m_config->GetMaxRetryTimes();
9795
}
9896

99-
void BaseOpUtil::SleepBeforeRetry(const uint32_t& request_num) const
100-
{
97+
void BaseOpUtil::SleepBeforeRetry(const uint32_t& request_num) const {
10198
const uint32_t interval_ms = m_config->GetRetryIntervalMs() * (request_num + 1);
10299
std::this_thread::sleep_for(std::chrono::milliseconds(interval_ms));
103100
}

src/util/codec_util.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,11 @@ std::string CodecUtil::HexToBin(const std::string& strHex) {
140140
return strBin;
141141
} // end of HexToBin
142142

143-
std::string CodecUtil::DigestToHex(const unsigned char *digest, size_t len)
144-
{
143+
std::string CodecUtil::DigestToHex(const unsigned char *digest, size_t len) {
145144
static const char digits[] = "0123456789abcdef";
146145
std::string result;
147146
result.reserve(len * 2);
148-
for (size_t pos = 0; pos < len; pos++)
149-
{
147+
for (size_t pos = 0; pos < len; pos++) {
150148
unsigned char c = digest[pos];
151149
result += digits[(c >> 4) & 0xF];
152150
result += digits[c & 0xF];

0 commit comments

Comments
 (0)