Fix some compilation warnings (#432)

This commit is contained in:
An Tao 2020-05-16 10:11:50 +08:00 committed by GitHub
parent 84eb05ce38
commit cddd17eb55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 16 deletions

View File

@ -48,6 +48,9 @@ class HttpMessageBody
virtual void append(const char *buf, size_t len)
{
}
virtual ~HttpMessageBody()
{
}
protected:
BodyType type_{BodyType::kNone};

View File

@ -217,7 +217,6 @@ void *SharedLibManager::compileAndLoadLib(const std::string &sourceFile,
auto soFile = sourceFile.substr(0, pos);
soFile.append(".so");
cmd.append(soFile);
void *Handle = nullptr;
LOG_TRACE << cmd;
if (system(cmd.c_str()) == 0)

View File

@ -72,7 +72,6 @@ void StaticFileRouter::route(
for (auto &location : **ioLocationsPtr_)
{
auto &URI = location.uriPrefix_;
auto &defaultContentType = location.defaultContentType_;
if (location.realLocation_.empty())
{
if (!location.alias_.empty())

View File

@ -63,25 +63,27 @@ class Base64CharMap
Base64CharMap()
{
char index = 0;
for (char c = 'A'; c <= 'Z'; ++c)
for (int c = 'A'; c <= 'Z'; ++c)
{
charMap_[c] = index++;
}
for (char c = 'a'; c <= 'z'; ++c)
for (int c = 'a'; c <= 'z'; ++c)
{
charMap_[c] = index++;
}
for (char c = '0'; c <= '9'; ++c)
for (int c = '0'; c <= '9'; ++c)
{
charMap_[c] = index++;
}
charMap_['+'] = charMap_['-'] = index++;
charMap_['/'] = charMap_['_'] = index;
charMap_[static_cast<int>('+')] = charMap_[static_cast<int>('-')] =
index++;
charMap_[static_cast<int>('/')] = charMap_[static_cast<int>('_')] =
index;
charMap_[0] = 0xff;
}
char getIndex(const char c) const noexcept
{
return charMap_[c];
return charMap_[static_cast<int>(c)];
}
private:
@ -120,7 +122,7 @@ std::string genRandomString(int length)
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static std::once_flag once;
static const size_t len = strlen(char_space);
static const size_t randMax = RAND_MAX - (RAND_MAX % len);
static const int randMax = RAND_MAX - (RAND_MAX % len);
std::call_once(once, []() {
std::srand(static_cast<unsigned int>(time(nullptr)));
});

View File

@ -254,18 +254,18 @@ class SqlBinder
SqlBinder(const std::string &sql, DbClient &client, ClientType type)
: sqlPtr_(std::make_shared<std::string>(sql)),
client_(client),
type_(type),
sqlViewPtr_(sqlPtr_->data()),
sqlViewLength_(sqlPtr_->length())
sqlViewLength_(sqlPtr_->length()),
client_(client),
type_(type)
{
}
SqlBinder(std::string &&sql, DbClient &client, ClientType type)
: sqlPtr_(std::make_shared<std::string>(std::move(sql))),
client_(client),
type_(type),
sqlViewPtr_(sqlPtr_->data()),
sqlViewLength_(sqlPtr_->length())
sqlViewLength_(sqlPtr_->length()),
client_(client),
type_(type)
{
}
SqlBinder(const char *sql,

@ -1 +1 @@
Subproject commit bb48ddfcf106874f5b4db9abbd13b9392eba9a23
Subproject commit 5ab4a4c85eb119fae96541d7f6723ba4ecef4791