From 5973a32a0201af8caf9262f3f26c77a6d73b0d1c Mon Sep 17 00:00:00 2001 From: Martin Date: Sat, 2 Apr 2022 22:42:50 +0200 Subject: [PATCH] fix Windows MSVC stupidity again Signed-off-by: Martin --- CMakeLists.txt | 2 +- openhantek/src/OH_BUILD.h | 2 +- openhantek/src/docks/VoltageDock.cpp | 4 +-- openhantek/src/post/spectrumgenerator.cpp | 36 +++++++++++------------ openhantek/translations/openhantek_de.ts | 16 +++++----- openhantek/translations/openhantek_es.ts | 16 +++++----- openhantek/translations/openhantek_fr.ts | 16 +++++----- openhantek/translations/openhantek_it.ts | 16 +++++----- openhantek/translations/openhantek_pl.ts | 16 +++++----- openhantek/translations/openhantek_pt.ts | 16 +++++----- openhantek/translations/openhantek_ru.ts | 16 +++++----- openhantek/translations/openhantek_sv.ts | 16 +++++----- openhantek/translations/openhantek_zh.ts | 16 +++++----- 13 files changed, 93 insertions(+), 95 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 17c6553d..57e90252 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ include(cmake/CPackInfos.cmake) if(MSVC) # NOMINMAX to avoid clash with std::min or std::max due to silly macros min and max - add_compile_options(/W4 /D_CRT_SECURE_NO_WARNINGS) + add_compile_options(/W4 /D_CRT_SECURE_NO_WARNINGS /DNOMINMAX) else() add_compile_options(-Wall -Wextra -pedantic) endif() diff --git a/openhantek/src/OH_BUILD.h b/openhantek/src/OH_BUILD.h index a815e6a8..67033c50 100644 --- a/openhantek/src/OH_BUILD.h +++ b/openhantek/src/OH_BUILD.h @@ -1,2 +1,2 @@ // Do not edit, will be re-created at each commit! -#define OH_BUILD "20220402 - commit 979" +#define OH_BUILD "20220402 - commit 980" diff --git a/openhantek/src/docks/VoltageDock.cpp b/openhantek/src/docks/VoltageDock.cpp index bf86c752..ee5c7025 100644 --- a/openhantek/src/docks/VoltageDock.cpp +++ b/openhantek/src/docks/VoltageDock.cpp @@ -28,8 +28,6 @@ VoltageDock::VoltageDock( DsoSettingsScope *scope, const Dso::ControlSpecificati if ( scope->verboseLevel > 1 ) qDebug() << " VoltageDock::VoltageDock()"; - const size_t MATH = 2; - // Initialize lists for comboboxes for ( Dso::Coupling c : spec->couplings ) if ( c == Dso::Coupling::DC || scope->hasACcoupling || scope->hasACmodification ) @@ -136,7 +134,7 @@ VoltageDock::VoltageDock( DsoSettingsScope *scope, const Dso::ControlSpecificati if ( channel < this->spec->channels ) mask = channel + 1; else - mask = Dso::mathChannelsUsed( Dso::MathMode( this->scope->voltage[ MATH ].couplingOrMathIndex ) ); + mask = Dso::mathChannelsUsed( Dso::MathMode( this->scope->voltage[ 2 ].couplingOrMathIndex ) ); } emit usedChannelChanged( channel, mask ); // channel bit mask 0b01, 0b10, 0b11 } ); diff --git a/openhantek/src/post/spectrumgenerator.cpp b/openhantek/src/post/spectrumgenerator.cpp index a23de65f..3e21d3ef 100644 --- a/openhantek/src/post/spectrumgenerator.cpp +++ b/openhantek/src/post/spectrumgenerator.cpp @@ -211,8 +211,8 @@ void SpectrumGenerator::process( PPresult *result ) { channelData->spectrum.samples.resize( size_t( sampleCount ) ); // calculate the peak-to-peak value of the displayed part of trace - double mini = INT_MAX; - double maxi = INT_MIN; + double min = INT_MAX; + double max = INT_MIN; double horizontalFactor = result->data( channel )->voltage.interval / scope->horizontal.timebase; unsigned dotsOnScreen = unsigned( DIVS_TIME / horizontalFactor + 0.99 ); // round up unsigned preTrigSamples = unsigned( scope->trigger.position * dotsOnScreen ); @@ -226,14 +226,14 @@ void SpectrumGenerator::process( PPresult *result ) { for ( int position = left; // left side of trace position <= right; // right side ++position ) { - if ( channelData->voltage.samples[ unsigned( position ) ] < mini ) - mini = channelData->voltage.samples[ unsigned( position ) ]; - if ( channelData->voltage.samples[ unsigned( position ) ] > maxi ) - maxi = channelData->voltage.samples[ unsigned( position ) ]; + if ( channelData->voltage.samples[ unsigned( position ) ] < min ) + min = channelData->voltage.samples[ unsigned( position ) ]; + if ( channelData->voltage.samples[ unsigned( position ) ] > max ) + max = channelData->voltage.samples[ unsigned( position ) ]; } - channelData->vmin = mini; - channelData->vmax = maxi; - // channelData->vpp = maxi - mini; + channelData->vmin = min; + channelData->vmax = max; + // channelData->vpp = max - min; // calculate the average value double dc = 0.0; @@ -261,7 +261,7 @@ void SpectrumGenerator::process( PPresult *result ) { // Do discrete real to half-complex transformation // Record length should be multiple of 2, 3, 5: done, is 10000 = 2^a * 5^b - fftHcSpectrum = fftw_alloc_real( size_t( qMax( SAMPLESIZE, sampleCount ) ) ); + fftHcSpectrum = fftw_alloc_real( size_t( std::max( SAMPLESIZE, sampleCount ) ) ); if ( nullptr == fftHcSpectrum ) // error break; if ( post->reuseFftPlan ) { // build one optimized plan and reuse it for all transformations @@ -367,8 +367,8 @@ void SpectrumGenerator::process( PPresult *result ) { double peakSpectrum = offsetLimit; // get a start value for peak search int peakFreqPos = 0; // initial position of max spectrum peak position = 0; - mini = INT_MAX; - maxi = INT_MIN; + min = INT_MAX; + max = INT_MIN; for ( auto &oneSample : channelData->spectrum.samples ) { // spectrum is power spectrum, but show amplitude spectrum -> 10 * log... double value = 10 * log10( oneSample ) + offset; @@ -381,14 +381,14 @@ void SpectrumGenerator::process( PPresult *result ) { peakSpectrum = value; peakFreqPos = position; } - if ( value < mini ) - mini = value; - if ( value > maxi ) - maxi = value; + if ( value < min ) + min = value; + if ( value > max ) + max = value; ++position; } - channelData->dBmin = mini; - channelData->dBmax = maxi; + channelData->dBmin = min; + channelData->dBmax = max; // Calculate both peak frequencies (correlation and spectrum) in Hz double pF = channelData->spectrum.interval * peakFreqPos; diff --git a/openhantek/translations/openhantek_de.ts b/openhantek/translations/openhantek_de.ts index 71552e80..90b71f46 100644 --- a/openhantek/translations/openhantek_de.ts +++ b/openhantek/translations/openhantek_de.ts @@ -2312,27 +2312,27 @@ Spannung - + CH&%1 CH&%1 - + MA&TH MA&TH - + Voltage range per vertical screen division Spannung pro vertikaler Teilung - + Select DC or AC coupling Wähle AC- oder DC-Kopplung - + Select the mathematical operation for this channel Berechnungen für diesen Kanal @@ -2341,17 +2341,17 @@ &MATH - + Invert Invertiert - + Set probe attenuation, scroll or type a value to select Wähle Tastkopf-Abschwächung, Mausrad oder direkte Eingabe möglich - + x diff --git a/openhantek/translations/openhantek_es.ts b/openhantek/translations/openhantek_es.ts index 9e069bde..e2fadbee 100644 --- a/openhantek/translations/openhantek_es.ts +++ b/openhantek/translations/openhantek_es.ts @@ -2079,42 +2079,42 @@ Voltaje - + CH&%1 - + MA&TH - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel - + Invert Invertir - + Set probe attenuation, scroll or type a value to select - + x diff --git a/openhantek/translations/openhantek_fr.ts b/openhantek/translations/openhantek_fr.ts index 40ef7c1f..b79c5400 100644 --- a/openhantek/translations/openhantek_fr.ts +++ b/openhantek/translations/openhantek_fr.ts @@ -2247,32 +2247,32 @@ Tension - + CH&%1 - + MA&TH - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel - + Set probe attenuation, scroll or type a value to select @@ -2281,7 +2281,7 @@ &MATH - + Invert Inverser @@ -2290,7 +2290,7 @@ x10 - + x diff --git a/openhantek/translations/openhantek_it.ts b/openhantek/translations/openhantek_it.ts index 77d3e6f2..6cf42031 100644 --- a/openhantek/translations/openhantek_it.ts +++ b/openhantek/translations/openhantek_it.ts @@ -1696,42 +1696,42 @@ Tensione - + CH&%1 - + MA&TH - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel - + Invert Invertire - + Set probe attenuation, scroll or type a value to select - + x diff --git a/openhantek/translations/openhantek_pl.ts b/openhantek/translations/openhantek_pl.ts index 32e960fe..5d4013ad 100644 --- a/openhantek/translations/openhantek_pl.ts +++ b/openhantek/translations/openhantek_pl.ts @@ -2275,27 +2275,27 @@ Napięcie - + CH&%1 CH&%1 - + MA&TH MA&TH - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel @@ -2304,17 +2304,17 @@ &MATH - + Invert Odwróć - + Set probe attenuation, scroll or type a value to select - + x diff --git a/openhantek/translations/openhantek_pt.ts b/openhantek/translations/openhantek_pt.ts index 68558427..6b417681 100644 --- a/openhantek/translations/openhantek_pt.ts +++ b/openhantek/translations/openhantek_pt.ts @@ -2109,42 +2109,42 @@ Voltagem - + CH&%1 - + MA&TH - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel - + Invert - + Set probe attenuation, scroll or type a value to select - + x diff --git a/openhantek/translations/openhantek_ru.ts b/openhantek/translations/openhantek_ru.ts index d1ad5a70..ba673707 100644 --- a/openhantek/translations/openhantek_ru.ts +++ b/openhantek/translations/openhantek_ru.ts @@ -1956,27 +1956,27 @@ Напряжение - + CH&%1 Канал &%1 - + MA&TH Ма&тем. - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel @@ -1985,17 +1985,17 @@ &MATH - + Invert Инверсия - + Set probe attenuation, scroll or type a value to select - + x x diff --git a/openhantek/translations/openhantek_sv.ts b/openhantek/translations/openhantek_sv.ts index c6b18214..18929842 100644 --- a/openhantek/translations/openhantek_sv.ts +++ b/openhantek/translations/openhantek_sv.ts @@ -1700,42 +1700,42 @@ Volt - + CH&%1 KAN&%1 - + MA&TH MA&TTE - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel - + Invert Invertera - + Set probe attenuation, scroll or type a value to select - + x x diff --git a/openhantek/translations/openhantek_zh.ts b/openhantek/translations/openhantek_zh.ts index 40dcdcd8..a727f4cf 100644 --- a/openhantek/translations/openhantek_zh.ts +++ b/openhantek/translations/openhantek_zh.ts @@ -2167,42 +2167,42 @@ 电压 - + CH&%1 CH&%1 - + MA&TH MA&TH - + Voltage range per vertical screen division - + Select DC or AC coupling - + Select the mathematical operation for this channel - + Invert 反转 - + Set probe attenuation, scroll or type a value to select - + x x