Fix warnings.
- Initialize variables and pointers. - Enable automatic move in files::get_datadir(). - Remove unused using declarations and includes.
This commit is contained in:
parent
357c5b87a6
commit
dcf8053f2e
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <cgicc/Cgicc.h>
|
||||
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <ios>
|
||||
#include <iostream>
|
||||
|
@ -32,8 +31,6 @@
|
|||
namespace FediBlock::cgi
|
||||
{
|
||||
|
||||
using std::cerr;
|
||||
using std::exception;
|
||||
using std::getline;
|
||||
using std::ios;
|
||||
using std::ofstream;
|
||||
|
|
|
@ -65,7 +65,7 @@ fs::path get_datadir()
|
|||
char *env{getenv("XDG_DATA_HOME")};
|
||||
if (env != nullptr)
|
||||
{
|
||||
const auto path{fs::path(env) / "fediblock-backend"};
|
||||
auto path{fs::path(env) / "fediblock-backend"};
|
||||
fs::create_directories(path);
|
||||
return path;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ void create_branch()
|
|||
const string branch_name{get_branch_name()};
|
||||
const string ref_name{"refs/heads/" + branch_name};
|
||||
git_oid oid_parent;
|
||||
git_commit *commit;
|
||||
git_commit *commit{nullptr};
|
||||
|
||||
// Get SHA1 of HEAD.
|
||||
check(git_reference_name_to_id(&oid_parent, _repo, "HEAD"));
|
||||
|
@ -92,7 +92,7 @@ void create_branch()
|
|||
// Translate SHA-1 to git_commit.
|
||||
check(git_commit_lookup(&commit, _repo, &oid_parent));
|
||||
|
||||
git_reference *branch;
|
||||
git_reference *branch{nullptr};
|
||||
// Create new branch.
|
||||
check(git_branch_create(&branch, _repo, branch_name.c_str(), commit, 0));
|
||||
|
||||
|
@ -127,11 +127,11 @@ void commit(const entry_type &entry)
|
|||
check(git_index_write(index));
|
||||
|
||||
// Create commit.
|
||||
git_signature *sig;
|
||||
git_signature *sig{nullptr};
|
||||
git_oid oid_commit;
|
||||
git_oid oid_tree;
|
||||
git_oid oid_parent;
|
||||
git_tree *tree;
|
||||
git_tree *tree{nullptr};
|
||||
git_object *parent{nullptr};
|
||||
git_reference *ref{nullptr};
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ size_t writer_body(char *data, size_t size, size_t nmemb)
|
|||
string api_request(const http_method method, const string_view path,
|
||||
const string_view body)
|
||||
{
|
||||
CURLcode code;
|
||||
CURLcode code{};
|
||||
string url{string(_forge_baseurl) += path};
|
||||
_curl_buffer_body.clear();
|
||||
|
||||
|
@ -132,7 +132,7 @@ string api_request(const http_method method, const string_view path,
|
|||
throw runtime_error{"libcurl error: " + to_string(code)};
|
||||
}
|
||||
|
||||
long http_status; // NOLINT(google-runtime-int)
|
||||
long http_status{0}; // NOLINT(google-runtime-int)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
|
||||
curl_easy_getinfo(_connection, CURLINFO_RESPONSE_CODE, &http_status);
|
||||
if (http_status < 200 || http_status >= 300)
|
||||
|
|
|
@ -26,12 +26,10 @@
|
|||
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::exception;
|
||||
using std::to_string;
|
||||
|
||||
using namespace FediBlock;
|
||||
|
||||
|
|
Reference in New Issue
Block a user