1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

chore(codestyle): mark virtual methods as override

This commit is contained in:
Aleksei Antipovskii
2024-09-12 12:27:02 +02:00
committed by Leonid Fedorov
parent ad80ab40aa
commit 0ab03c7258
303 changed files with 4085 additions and 4886 deletions

View File

@ -28,7 +28,7 @@
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
#include <cinttypes>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/tokenizer.hpp>
@ -40,9 +40,7 @@
#ifndef ULONGLONG_MAX
#define ULONGLONG_MAX ulonglong_max
#endif
namespace funcexp
{
namespace helpers
namespace funcexp::helpers
{
// 10 ** i
const int64_t powerOf10_c[] = {1ll,
@ -242,7 +240,7 @@ inline int16_t convert_mysql_mode_to_modeflags(int16_t mode)
//
// This is a mirror of calc_week, at a later date we should use sql_time.h
inline uint32_t calc_mysql_week(uint32_t year, uint32_t month, uint32_t day, int16_t modeflags,
uint32_t* weekyear = 0)
uint32_t* weekyear = nullptr)
{
// need to make sure that the date is valid
if (!dataconvert::isDateValid(day, month, year))
@ -268,7 +266,7 @@ inline uint32_t calc_mysql_week(uint32_t year, uint32_t month, uint32_t day, int
if (!week_year && ((first_weekday && weekday != 0) || (!first_weekday && weekday >= 4)))
return 0;
week_year = 1;
week_year = true;
if (weekyear)
{
@ -360,12 +358,12 @@ inline bool calc_time_diff(int64_t time1, int64_t time2, int l_sign, long long*
(long long)(1000000) +
(long long)msec1 - l_sign * (long long)msec2;
neg = 0;
neg = false;
if (microseconds < 0)
{
microseconds = -microseconds;
neg = 1;
neg = true;
}
*seconds_out = microseconds / 1000000L;
@ -485,7 +483,7 @@ inline int getNumbers(const std::string& expr, int64_t* array, execplan::OpType
if (funcType == execplan::OP_SUB)
funcNeg = -1;
if (expr.size() == 0)
if (expr.empty())
return 0;
// @bug 4703 reworked this code to avoid use of incrementally
@ -496,10 +494,8 @@ inline int getNumbers(const std::string& expr, int64_t* array, execplan::OpType
int64_t number = 0;
int neg = 1;
for (unsigned int i = 0; i < expr.size(); i++)
for (auto value : expr)
{
char value = expr[i];
if ((value >= '0' && value <= '9'))
{
foundNumber = true;
@ -553,7 +549,7 @@ inline int getNumbers(const std::string& expr, int* array, execplan::OpType func
if (funcType == execplan::OP_SUB)
funcNeg = -1;
if (expr.size() == 0)
if (expr.empty())
return 0;
// @bug 4703 reworked this code to avoid use of incrementally
@ -564,10 +560,8 @@ inline int getNumbers(const std::string& expr, int* array, execplan::OpType func
int number = 0;
int neg = 1;
for (unsigned int i = 0; i < expr.size(); i++)
for (char value : expr)
{
char value = expr[i];
if ((value >= '0' && value <= '9'))
{
foundNumber = true;
@ -614,56 +608,51 @@ inline int getNumbers(const std::string& expr, int* array, execplan::OpType func
inline int dayOfWeek(std::string day) // Sunday = 0
{
int value = -1;
boost::to_lower(day);
if (day == "sunday" || day == "sun")
{
value = 0;
return 0;
}
else if (day == "monday" || day == "mon")
{
value = 1;
return 1;
}
else if (day == "tuesday" || day == "tue")
{
value = 2;
return 2;
}
else if (day == "wednesday" || day == "wed")
{
value = 3;
return 3;
}
else if (day == "thursday" || day == "thu")
{
value = 4;
return 4;
}
else if (day == "friday" || day == "fri")
{
value = 5;
return 5;
}
else if (day == "saturday" || day == "sat")
{
value = 6;
}
else
{
value = -1;
return 6;
}
return value;
return -1;
}
inline string intToString(int64_t i)
{
char buf[32];
snprintf(buf, 32, "%" PRId64 "", i);
snprintf(buf, sizeof(buf), "%" PRId64 "", i);
return buf;
}
inline string uintToString(uint64_t i)
{
char buf[32];
snprintf(buf, 32, "%" PRIu64 "", i);
snprintf(buf, sizeof(buf), "%" PRIu64 "", i);
return buf;
}
@ -672,7 +661,7 @@ inline string doubleToString(double d)
// double's can be *really* long to print out. Max mysql
// is e308 so allow for 308 + 36 decimal places minimum.
char buf[384];
snprintf(buf, 384, "%f", d);
snprintf(buf, sizeof(buf), "%f", d);
return buf;
}
@ -681,7 +670,7 @@ inline string longDoubleToString(long double ld)
// long double's can be *really* long to print out. Max mysql
// is e308 so allow for 308 + 36 decimal places minimum.
char buf[384];
snprintf(buf, 384, "%Lf", ld);
snprintf(buf, sizeof(buf), "%Lf", ld);
return buf;
}
@ -691,5 +680,4 @@ const std::string IDB_date_format(const dataconvert::DateTime&, const std::strin
const std::string timediff(int64_t, int64_t, bool isDateTime = true);
const char* convNumToStr(int64_t, char*, int);
} // namespace helpers
} // namespace funcexp
} // namespace funcexp::helpers