[CodeFormat] Clang-format cpp sources (#4965)

Clang-format all c++ source files.
This commit is contained in:
sduzh
2020-11-28 18:36:49 +08:00
committed by GitHub
parent f944bf4d44
commit 6fedf5881b
1331 changed files with 62548 additions and 68514 deletions

View File

@ -15,20 +15,21 @@
// specific language governing permissions and limitations
// under the License.
#include <boost/algorithm/string/predicate.hpp>
#include <string.h>
#include "plugin/plugin_zip.h"
#include "http/http_client.h"
#include "gutil/strings/util.h"
#include <string.h>
#include <boost/algorithm/string/predicate.hpp>
#include "env/env.h"
#include "gutil/strings/substitute.h"
#include "gutil/strings/util.h"
#include "http/http_client.h"
#include "util/file_utils.h"
#include "util/md5.h"
#include "util/slice.h"
#include "util/time.h"
#include "util/zip_util.h"
#include "util/slice.h"
#include "env/env.h"
namespace doris {
@ -48,7 +49,6 @@ PluginZip::~PluginZip() {
}
}
Status PluginZip::extract(const std::string& target_dir, const std::string& plugin_name) {
// check plugin install path
std::string plugin_install_path = strings::Substitute("$0/$1", target_dir, plugin_name);
@ -60,10 +60,11 @@ Status PluginZip::extract(const std::string& target_dir, const std::string& plug
if (!FileUtils::check_exist(target_dir)) {
RETURN_IF_ERROR(FileUtils::create_dir(target_dir));
}
std::string zip_path = _source;
if (!is_local_source(_source)) {
zip_path = strings::Substitute("$0/.temp_$1_$2.zip", target_dir, GetCurrentTimeMicros(), plugin_name);
zip_path = strings::Substitute("$0/.temp_$1_$2.zip", target_dir, GetCurrentTimeMicros(),
plugin_name);
_clean_paths.push_back(zip_path);
RETURN_IF_ERROR(download(zip_path));
@ -88,17 +89,17 @@ Status PluginZip::download(const std::string& zip_path) {
RETURN_IF_ERROR(client.init(_source));
auto download_cb = [&status, &digest, &file](const void* data, size_t length) {
digest.update(data, length);
digest.update(data, length);
Slice slice((const char *)data, length);
status = file->append(slice);
if (!status.ok()) {
LOG(WARNING) << "fail to download data, file: " << file->filename()
<< ", error: " << status.to_string();
return false;
}
Slice slice((const char*)data, length);
status = file->append(slice);
if (!status.ok()) {
LOG(WARNING) << "fail to download data, file: " << file->filename()
<< ", error: " << status.to_string();
return false;
}
return true;
return true;
};
RETURN_IF_ERROR(client.execute(download_cb));
@ -113,19 +114,19 @@ Status PluginZip::download(const std::string& zip_path) {
std::string expect;
auto download_md5_cb = [&status, &expect](const void* data, size_t length) {
expect = std::string((const char*) data, length);
return true;
expect = std::string((const char*)data, length);
return true;
};
RETURN_IF_ERROR(md5_client.execute(download_md5_cb));
digest.digest();
if (0 != strncmp(digest.hex().c_str(), expect.c_str(), 32)) {
return Status::InternalError(
strings::Substitute("plugin install checksum failed. expect: $0, actual:$1", expect, digest.hex()));
return Status::InternalError(strings::Substitute(
"plugin install checksum failed. expect: $0, actual:$1", expect, digest.hex()));
}
return Status::OK();
}
}
} // namespace doris