Fixed OSX compilation issues

This commit is contained in:
Valentino Orlandi 2023-04-16 01:03:10 +02:00
parent 362cd17ad6
commit e00a0cf514
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
7 changed files with 22 additions and 7 deletions

View File

@ -36,6 +36,10 @@ fi
echo "Starting compilation process"
# Make a build folder
if [ -d build ]
then
rm -r build
fi
mkdir build && cd build
# Prepare the cmake files

View File

@ -545,6 +545,8 @@ void Snake::collectData( std::vector<float>& data, Direction& direction, const S
case Entity::A:
blocked_way = 1u;
break;
default:
break;
}
if ( ! blocked_way ) {
@ -842,6 +844,8 @@ const std::vector<unsigned> Snake::checkAround( const Direction& direction, cons
case Entity::A:
around.at(i) = 2u;
break;
default:
break;
}
}
}

View File

@ -540,6 +540,8 @@ void Craplog::scanLogsDir()
case LogType::Discarded:
// skip
continue;
default:
break;
}
std::string hash;

View File

@ -240,7 +240,7 @@ void checkIisString( std::string_view string )
for ( const char& chr : string ) {
if ( !(StringOps::isAlnum( chr ) || chr == ' ' || chr == '-' || chr == ',' || chr == ':' || chr == '(' || chr == ')' || chr == '[' || chr == ']') ) {
// unwanted character
throw LogFormatException( "Unexpected character found: "+chr );
throw LogFormatException( "Unexpected character found: "+std::string{chr} );
}
}
}

View File

@ -5,8 +5,12 @@
#include "lib.h"
#include <unordered_map> // leave this here for OSX
class QSqlDatabase;
typedef std::unordered_map<int, BWlist> bw_lists_t; // leave this here for OSX
class CraplogWorker : public QObject
{
@ -16,7 +20,6 @@ private:
using worker_files_t = std::vector<std::tuple<std::string,std::string>>;
using log_line_data_t = std::map<int, std::string>;
using bw_lists_t = std::unordered_map<int, BWlist>;
public:

View File

@ -913,7 +913,7 @@ const bool Crapview::calcGlobals( std::vector<std::tuple<QString,QString>>& recu
traffic_list.push_back( std::make_tuple( std::get<0>(traf_date), QString("%1").arg( std::get<1>(traf_date) ) ) );
// max day of the week
double max{ 0.d };
double max{ 0.0 };
int max_{ 0 };
for ( const auto& [d,c] : traf_day ) {
if ( c > max ) {
@ -921,11 +921,11 @@ const bool Crapview::calcGlobals( std::vector<std::tuple<QString,QString>>& recu
max_ = d;
}
}
if ( max_ == 0.d ) {
if ( max_ == 0.0 ) {
traffic_list.push_back( std::make_tuple( "-", "0" ) );
} else {
const int f{ static_cast<int>(max) };
const int d{ (max<10.d) ? static_cast<int>(max*100.d)%100 : static_cast<int>(max*10.d)%10 };
const int d{ (max<10.0) ? static_cast<int>(max*100.0)%100 : static_cast<int>(max*10.0)%10 };
QString count{ QString("%1").arg( f ) };
if ( d > 0 ) {
count += QString(".%1").arg( d );
@ -934,7 +934,7 @@ const bool Crapview::calcGlobals( std::vector<std::tuple<QString,QString>>& recu
}
// max hour of the day
max=0.d, max_=-1.d;
max=0.0, max_=-1.0;
for ( const auto& [h,c] : traf_hour ) {
if ( c > max ) {
max = c;
@ -945,7 +945,7 @@ const bool Crapview::calcGlobals( std::vector<std::tuple<QString,QString>>& recu
traffic_list.push_back( std::make_tuple( "", "0" ) );
} else {
const int f{ static_cast<int>(max) };
const int d{ (max<10.d) ? static_cast<int>(max*100.d)%100 : static_cast<int>(max*10.d)%10 };
const int d{ (max<10.0) ? static_cast<int>(max*100.0)%100 : static_cast<int>(max*10.0)%10 };
QString count = QString("%1").arg( f );
if ( d > 0 ) {
count += QString(".%1").arg( d );

View File

@ -3,6 +3,8 @@
#include "modules/exceptions.h"
#include <unordered_map> // leave this here for OSX
//! Result
/*!