Skip to content

Commit

Permalink
s3select:clang-tidying of s3select_oper.h
Browse files Browse the repository at this point in the history
... and some undoing of formatting changes

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
  • Loading branch information
ronen-fr committed Dec 22, 2020
1 parent 86a344a commit 0e392f5
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 80 deletions.
13 changes: 6 additions & 7 deletions include/s3select.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <boost/bind.hpp>
#include <functional>

using namespace std::string_literals;

#define _DEBUG_TERM {string token(a,b);std::cout << __FUNCTION__ << token << std::endl;}

Expand Down Expand Up @@ -732,23 +731,23 @@ void push_compare_operator::operator()(s3select* self, const char* a, const char
std::string token(a, b);
arithmetic_operand::cmp_t c;

if (token =="=="s)
if (token =="==")
{
c = arithmetic_operand::cmp_t::EQ;
}
else if (token =="!="s)
else if (token =="!=")
{
c = arithmetic_operand::cmp_t::NE;
}
else if (token ==">="s)
else if (token ==">=")
{
c = arithmetic_operand::cmp_t::GE;
}
else if (token == "<="s)
else if (token == "<=")
{
c = arithmetic_operand::cmp_t::LE;
}
else if (token == ">"s)
else if (token == ">")
{
c = arithmetic_operand::cmp_t::GT;
}
Expand Down Expand Up @@ -840,7 +839,7 @@ void push_negation::operator()(s3select* self, const char* a, const char* b) con
//upon NOT operator, the logical and arithmetical operators are "tagged" to negate result.
if (dynamic_cast<logical_operand*>(pred))
{
logical_operand* f = S3SELECT_NEW(self, logical_operand, pred); // todo: marked as "empty statemant"
logical_operand* f = S3SELECT_NEW(self, logical_operand, pred);
self->getAction()->condQ.push_back(f);
}
else if (dynamic_cast<__function*>(pred) || dynamic_cast<negate_function_operation*>(pred))
Expand Down
21 changes: 10 additions & 11 deletions include/s3select_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <regex>
using namespace std::string_literals;


#define BOOST_BIND_ACTION_PARAM( push_name ,param ) boost::bind( &push_name::operator(), g_ ## push_name , _1 ,_2, param)
namespace s3selectEngine
{
Expand Down Expand Up @@ -349,7 +348,7 @@ struct _fn_avg : public base_function
return true;
}

void get_aggregate_result(variable *result) override
void get_aggregate_result(variable *result) override
{
if(count == 0) {
throw base_s3select_exception("count cannot be zero!");
Expand Down Expand Up @@ -381,7 +380,7 @@ struct _fn_min : public base_function
return true;
}

void get_aggregate_result(variable* result) override
void get_aggregate_result(variable* result) override
{
*result = min;
}
Expand Down Expand Up @@ -411,7 +410,7 @@ struct _fn_max : public base_function
return true;
}

void get_aggregate_result(variable* result) override
void get_aggregate_result(variable* result) override
{
*result = max;
}
Expand All @@ -437,13 +436,13 @@ struct _fn_to_int : public base_function
if ((errno == ERANGE && (i == LONG_MAX || i == LONG_MIN)) || (errno != 0 && i == 0)) {
throw base_s3select_exception("converted value would fall out of the range of the result type!");
return false;
}
}

if (*perr != '\0') {
throw base_s3select_exception("characters after int!");
return false;
if (*perr != '\0') {
throw base_s3select_exception("characters after int!");
return false;
}
}
}
else if (func_arg.type == value::value_En_t::FLOAT)
{
i = func_arg.dbl();
Expand Down Expand Up @@ -488,8 +487,8 @@ struct _fn_to_float : public base_function
}

var_result = d;
break;
}
break;

case value::value_En_t::FLOAT:
var_result = v.dbl();
Expand Down Expand Up @@ -586,7 +585,7 @@ struct _fn_to_timestamp : public base_function

bsc::parse_info<> info_dig = bsc::parse(v_str.str(), d_yyyymmdd_dig >> *(separator) >> d_time_dig);

if(!datetime_validation() or !info_dig.full)
if(!datetime_validation() || !info_dig.full)
{
throw base_s3select_exception("input date-time is illegal");
}
Expand Down

0 comments on commit 0e392f5

Please sign in to comment.