diff --git a/oscar/Graphs/gSessionTimesChart.cpp b/oscar/Graphs/gSessionTimesChart.cpp index 579614b9..14004373 100644 --- a/oscar/Graphs/gSessionTimesChart.cpp +++ b/oscar/Graphs/gSessionTimesChart.cpp @@ -1074,8 +1074,8 @@ void gTTIAChart::afterDraw(QPainter &, gGraph &graph, QRectF rect) } break; case 2: - if (calc.divisor > 0) { - mid = calc.avg_sum / calc.divisor; + if (calc.cnt > 0) { + mid = calc.avg_sum / calc.cnt; } break; } @@ -1142,7 +1142,8 @@ void gAHIChart::customCalc(Day *day, QVector &list) case 1: calc->wavg_sum += value; calc->divisor += hours; - default: + break; + case 2: calc->avg_sum += value; calc->cnt++; break; diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp index 65769d0b..1069ea22 100644 --- a/oscar/SleepLib/common.cpp +++ b/oscar/SleepLib/common.cpp @@ -802,7 +802,8 @@ QByteArray gUncompress(const QByteArray & data) switch (ret) { case Z_NEED_DICT: - ret = Z_DATA_ERROR; // and fall through + ret = Z_DATA_ERROR; + // fall through case Z_DATA_ERROR: case Z_MEM_ERROR: Q_UNUSED(ret) diff --git a/oscar/SleepLib/loader_plugins/prs1_loader.cpp b/oscar/SleepLib/loader_plugins/prs1_loader.cpp index e44f89f4..5065bcff 100644 --- a/oscar/SleepLib/loader_plugins/prs1_loader.cpp +++ b/oscar/SleepLib/loader_plugins/prs1_loader.cpp @@ -692,8 +692,10 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base, Machin QDateTime datetime; + /* Unused until we get an actual timestamp below. QDateTime ignoreBefore = p_profile->session->ignoreOlderSessionsDate(); bool ignoreOldSessions = p_profile->session->ignoreOlderSessions(); + */ // for each p0/p1/p2/etc... folder for (int p=0; p < size; ++p) { @@ -723,12 +725,14 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base, Machin continue; } + /* This never worked: the filename isn't a timestamp. if (ignoreOldSessions) { datetime = QDateTime::fromTime_t(sid); if (datetime < ignoreBefore) { continue; } } + */ if (m->SessionExists(sid)) { diff --git a/oscar/daily.cpp b/oscar/daily.cpp index 480a1a10..0866b908 100644 --- a/oscar/daily.cpp +++ b/oscar/daily.cpp @@ -424,7 +424,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared) GraphView->setEmptyText(STR_Empty_NoData); previous_date=QDate(); - ui->calButton->setChecked(AppSetting->calendarVisible() ? Qt::Checked : Qt::Unchecked); + ui->calButton->setChecked(AppSetting->calendarVisible() ? true : false); on_calButton_toggled(AppSetting->calendarVisible()); GraphView->resetLayout(); @@ -2350,10 +2350,10 @@ void Daily::updateCube() } -void Daily::on_toggleGraphs_clicked(bool checked) +void Daily::on_toggleGraphs_clicked(bool /*checked*/) { QString s; - QIcon *icon=checked ? icon_off : icon_on; + //QIcon *icon=checked ? icon_off : icon_on; if (ui->graphCombo == nullptr ) qDebug() << "ToggleGraphs clicked with null graphCombo ptr"; else @@ -2414,10 +2414,10 @@ void Daily::on_eventsCombo_activated(int index) GraphView->redraw(); } -void Daily::on_toggleEvents_clicked(bool checked) +void Daily::on_toggleEvents_clicked(bool /*checked*/) { QString s; - QIcon *icon=checked ? icon_on : icon_off; + //QIcon *icon=checked ? icon_on : icon_off; if (ui->toggleEvents == nullptr ) qDebug() << "ToggleEvents clicked with null toggleEvents ptr"; diff --git a/oscar/oscar.pro b/oscar/oscar.pro index a4476e5c..a6410d1f 100644 --- a/oscar/oscar.pro +++ b/oscar/oscar.pro @@ -443,8 +443,8 @@ test { CONFIG += console debug CONFIG -= app_bundle !win32 { # add memory checking on Linux and macOS test builds - QMAKE_CFLAGS += -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope - QMAKE_CXXFLAGS += -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope + QMAKE_CFLAGS += -Werror -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope + QMAKE_CXXFLAGS += -Werror -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope QMAKE_LFLAGS += -fsanitize=address } diff --git a/oscar/update_gitinfo.bat b/oscar/update_gitinfo.bat index 9ffd20b8..3ae5665a 100755 --- a/oscar/update_gitinfo.bat +++ b/oscar/update_gitinfo.bat @@ -1,10 +1,11 @@ @echo off setlocal set DIR=%~dp0 +cd %DIR% -for /f %%i in ('git --work-tree %DIR% rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%i -for /f %%i in ('git --work-tree %DIR% rev-parse --short HEAD') do set GIT_REVISION=%%i -git --work-tree %DIR% diff-index --quiet HEAD || set GIT_REVISION=%GIT_REVISION%+ +for /f %%i in ('git rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%i +for /f %%i in ('git rev-parse --short HEAD') do set GIT_REVISION=%%i +git diff-index --quiet HEAD -- || set GIT_REVISION=%GIT_REVISION%+ if "%GIT_BRANCH"=="" set GIT_BRANCH="Unknown" if "%GIT_REVISION"=="" set GIT_REVISION="Unknown" @@ -13,10 +14,11 @@ echo // This is an auto generated file > %DIR%git_info.new echo const QString GIT_BRANCH="%GIT_BRANCH%"; >> %DIR%git_info.new echo const QString GIT_REVISION="%GIT_REVISION%"; >> %DIR%git_info.new -fc %DIR%git_info.h %DIR%git_info.new > nul -if errorlevel 0 ( - del /q %DIR%git_info.new -) else ( - echo Updating %DIR%git_info.h - move /y %DIR%git_info.new %DIR%git_info.h -) +fc %DIR%git_info.h %DIR%git_info.new >nul 2>nul && del /q %DIR%git_info.new || goto NewFile +goto AllDone + +:NewFile +echo Updating %DIR%git_info.h +move /y %DIR%git_info.new %DIR%git_info.h + +:AllDone diff --git a/oscar/update_gitinfo.sh b/oscar/update_gitinfo.sh index 909ac299..daaab8fb 100755 --- a/oscar/update_gitinfo.sh +++ b/oscar/update_gitinfo.sh @@ -3,9 +3,9 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $DIR -GIT_BRANCH=`git --work-tree $DIR rev-parse --abbrev-ref HEAD` -GIT_REVISION=`git --work-tree $DIR rev-parse --short HEAD` -$(git --work-tree $DIR diff-index --quiet HEAD) +GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` +GIT_REVISION=`git rev-parse --short HEAD` +$(git diff-index --quiet HEAD --) if [ $? -ne 0 ]; then GIT_REVISION="$GIT_REVISION+" # uncommitted changes fi