diff --git a/ChartCtrl/ChartCtrl.cpp b/ChartCtrl/ChartCtrl.cpp index 6aecbb86..9c376772 100644 --- a/ChartCtrl/ChartCtrl.cpp +++ b/ChartCtrl/ChartCtrl.cpp @@ -160,7 +160,7 @@ void CChartCtrl::OnPaint() } } -BOOL CChartCtrl::OnEraseBkgnd(CDC* pDC) +BOOL CChartCtrl::OnEraseBkgnd([[maybe_unused]] CDC* pDC) { // To avoid flickering // return CWnd::OnEraseBkgnd(pDC); @@ -406,7 +406,7 @@ CDC* CChartCtrl::GetDC() return &m_BackgroundDC; } -void CChartCtrl::ReleaseDC(CDC* pDC) +void CChartCtrl::ReleaseDC([[maybe_unused]]CDC* pDC) { //CWnd::ReleaseDC(pDC); // delete pDC; diff --git a/ChartCtrl/ChartLegend.cpp b/ChartCtrl/ChartLegend.cpp index 95c66e8c..e1aefa4c 100644 --- a/ChartCtrl/ChartLegend.cpp +++ b/ChartCtrl/ChartLegend.cpp @@ -117,7 +117,7 @@ void CChartLegend::Draw(CDC *pDC) if (!m_bIsVisible) return; - int YPos = 2; + // int YPos = 2; int MaxBitmapWidth = 0; bool bDraw = false; diff --git a/ChartCtrl/ChartSurfaceSerie.cpp b/ChartCtrl/ChartSurfaceSerie.cpp index 2382e29f..319c6497 100644 --- a/ChartCtrl/ChartSurfaceSerie.cpp +++ b/ChartCtrl/ChartSurfaceSerie.cpp @@ -110,7 +110,7 @@ int CChartSurfaceSerie::DrawLegend(CDC* pDC, CPoint UpperLeft, int BitmapWidth) return 0; //Draw Text - int TextHeigh = pDC->GetTextExtent(m_strSerieName.c_str()).cy; + // int TextHeigh = pDC->GetTextExtent(m_strSerieName.c_str()).cy; pDC->ExtTextOut(UpperLeft.x+BitmapWidth+6, UpperLeft.y+1, ETO_CLIPPED, diff --git a/DeepSkyStacker/Bayer.cpp b/DeepSkyStacker/Bayer.cpp index 03a7c874..5b15d3e0 100644 --- a/DeepSkyStacker/Bayer.cpp +++ b/DeepSkyStacker/Bayer.cpp @@ -129,7 +129,6 @@ BAYERCOLOR GetBayerColor(size_t baseX, size_t baseY, CFATYPE CFAType, int xOffse }; }; }; - return BAYER_UNKNOWN; } // diff --git a/DeepSkyStacker/BitMapFiller.cpp b/DeepSkyStacker/BitMapFiller.cpp index 64f545c6..0f268d1d 100644 --- a/DeepSkyStacker/BitMapFiller.cpp +++ b/DeepSkyStacker/BitMapFiller.cpp @@ -85,14 +85,14 @@ void BitmapFillerBase::setGrey(bool grey) this->isGray = grey; } -void BitmapFillerBase::setWidth(int width) +void BitmapFillerBase::setWidth(int w) { - this->width = width; + this->width = w; } -void BitmapFillerBase::setHeight(int height) +void BitmapFillerBase::setHeight(int h) { - this->height = height; + this->height = h; if (pProgress != nullptr) pProgress->Start2(pBitmap->Height()); } @@ -128,7 +128,7 @@ size_t NonAvxBitmapFiller::Write(const void* source, const size_t bytesPerPixel, if (this->isGray) { ZASSERTSTATE(bytesPerPixel == this->bytesPerChannel); - constexpr size_t vectorLen = 16; + // constexpr size_t vectorLen = 16; redBuffer.resize(nrPixels); if (this->bytesPerChannel == 1) diff --git a/DeepSkyStacker/BitmapExt.cpp b/DeepSkyStacker/BitmapExt.cpp index c150a438..c02f8a82 100644 --- a/DeepSkyStacker/BitmapExt.cpp +++ b/DeepSkyStacker/BitmapExt.cpp @@ -1397,7 +1397,7 @@ void FormatMethod(QString& strText, MULTIBITMAPPROCESSMETHOD Method, double fKap return; } -void CYMGToRGB2(double fCyan, double fYellow, double fMagenta, double fGreen2, double& fRed, double& fGreen, double& fBlue) +void CYMGToRGB2(double fCyan, double fYellow, double fMagenta, double, double& fRed, double& fGreen, double& fBlue) { double fR, fG, fB; diff --git a/DeepSkyStacker/BitmapPartFile.h b/DeepSkyStacker/BitmapPartFile.h index 82f625f3..b9eba404 100644 --- a/DeepSkyStacker/BitmapPartFile.h +++ b/DeepSkyStacker/BitmapPartFile.h @@ -1,18 +1,18 @@ #pragma once -class CBitmapPartFile +class CBitmapPartFile final { public: - QString m_strFile; + QString m_tempFileName; int m_lStartRow; int m_lEndRow; - int m_lWidth; - int m_lNrBitmaps; + int m_lWidth{ 0 }; + int m_lNrBitmaps{ 0 }; private: void CopyFrom(const CBitmapPartFile& bp) { - m_strFile = bp.m_strFile; + m_tempFileName = bp.m_tempFileName; m_lStartRow = bp.m_lStartRow; m_lEndRow = bp.m_lEndRow; m_lWidth = bp.m_lWidth; @@ -20,27 +20,15 @@ class CBitmapPartFile }; public: - CBitmapPartFile(const QString& szFile, int lStartRow, int lEndRow) - { - m_strFile = szFile; - m_lStartRow = lStartRow; - m_lEndRow = lEndRow; - m_lWidth = 0; - m_lNrBitmaps = 0; - }; - - CBitmapPartFile(const CBitmapPartFile& bp) - { - CopyFrom(bp); - }; - - const CBitmapPartFile& operator= (const CBitmapPartFile& bp) - { - CopyFrom(bp); - return *this; - }; + CBitmapPartFile(QString&& tmpFile, const int lStartRow, const int lEndRow) noexcept : + m_tempFileName{ std::move(tmpFile) }, + m_lStartRow{ lStartRow }, + m_lEndRow{ lEndRow } + {}; - virtual ~CBitmapPartFile() - {} + CBitmapPartFile(const CBitmapPartFile&) = default; + CBitmapPartFile(CBitmapPartFile&&) noexcept = default; + CBitmapPartFile& operator=(const CBitmapPartFile&) = default; + CBitmapPartFile& operator=(CBitmapPartFile&&) noexcept = default; + ~CBitmapPartFile() = default; }; -typedef std::vector BITMAPPARTFILEVECTOR; diff --git a/DeepSkyStacker/ChannelAlign.cpp b/DeepSkyStacker/ChannelAlign.cpp index 5e2a8e30..7b872ff4 100644 --- a/DeepSkyStacker/ChannelAlign.cpp +++ b/DeepSkyStacker/ChannelAlign.cpp @@ -46,8 +46,8 @@ std::shared_ptr CChannelAlign::AlignChannel(CMemoryBitmap* pBitma if (pProgress != nullptr) { - const QString strText(QCoreApplication::translate("ChannelAlign", "Aligning Channel", "IDS_ALIGNINGCHANNEL")); - pProgress->Start2(strText, lHeight); + const QString text(QCoreApplication::translate("ChannelAlign", "Aligning Channel", "IDS_ALIGNINGCHANNEL")); + pProgress->Start2(text, lHeight); } for (int j = 0; j < lHeight; j++) diff --git a/DeepSkyStacker/CosmeticEngine.cpp b/DeepSkyStacker/CosmeticEngine.cpp index 0eac8ba4..a9af3b23 100644 --- a/DeepSkyStacker/CosmeticEngine.cpp +++ b/DeepSkyStacker/CosmeticEngine.cpp @@ -270,7 +270,7 @@ void CCleanCosmeticTask::process() for (int col = 0; col < m_lWidth; ++col) { - bool changed = false; + // bool changed = false; double delta; m_pDelta->GetPixel(col, row, delta); if (delta > 200) @@ -298,11 +298,12 @@ void CCleanCosmeticTask::ComputeMedian(int x, int y, int lFilterSize, double& fG { // Check that this is a normal pixel bool bAdd = true; - if (m_CFAType != CFAT_NONE) + if (m_CFAType != CFATYPE_NONE) bAdd = (GetBayerColor(i, j, m_CFAType) == BayerColor); if (bAdd) { +#pragma warning (suppress:4457) double fGray; double fDelta; @@ -342,6 +343,7 @@ void CCleanCosmeticTask::ComputeMedian(int x, int y, int lFilterSize, double& fR { for (int j = std::max(0, y-lFilterSize); j <= std::min(m_lHeight-1, y+lFilterSize); j++) { +#pragma warning (suppress:4457) double fRed, fGreen, fBlue; double fDelta; @@ -393,11 +395,12 @@ void CCleanCosmeticTask::ComputeGaussian(int x, int y, int lFilterSize, double& { // Check that this is a normal pixel bool bAdd = true; - if (m_CFAType != CFAT_NONE) + if (m_CFAType != CFATYPE_NONE) bAdd = GetBayerColor(i, j, m_CFAType) == BayerColor; if (bAdd) { +#pragma warning (suppress:4457) double fGray; double fDelta; double fDistance2 = std::pow((i-x) / static_cast(lFilterSize), 2) + std::pow((j-y) / static_cast(lFilterSize), 2); @@ -443,6 +446,7 @@ void CCleanCosmeticTask::ComputeGaussian(int x, int y, int lFilterSize, double& for (int j = std::max(0, y-lFilterSize); j <= std::min(m_lHeight-1, y+lFilterSize); j++) { // Check that this is a normal pixel +#pragma warning (suppress:4457) double fRed, fGreen, fBlue; double fDelta; double fDistance2 = std::pow((i-x)/ static_cast(lFilterSize), 2) + std::pow((j-y) / static_cast(lFilterSize), 2); diff --git a/DeepSkyStacker/DSSMemory.h b/DeepSkyStacker/DSSMemory.h index d1f60595..c84fbb04 100644 --- a/DeepSkyStacker/DSSMemory.h +++ b/DeepSkyStacker/DSSMemory.h @@ -29,12 +29,12 @@ return DllExports::GdipAlloc(in_size); } - void * (operator new)(size_t nSize, LPCSTR lpszFileName, int nLine) + void* (operator new)(size_t nSize, LPCSTR, int) { return DllExports::GdipAlloc(nSize); } - void operator delete(void* p, LPCSTR lpszFileName, int nLine) + void operator delete(void* p, LPCSTR, int) { DllExports::GdipFree(p); } diff --git a/DeepSkyStacker/DarkFrame.cpp b/DeepSkyStacker/DarkFrame.cpp index 9311b8b7..8a35ad24 100644 --- a/DeepSkyStacker/DarkFrame.cpp +++ b/DeepSkyStacker/DarkFrame.cpp @@ -189,10 +189,8 @@ inline bool IsInStdDev(double fValue, double fMean, double fStdDev) static double ComputeMinimumRMSFactor(VALUEPAIRSET & sValuePairs) { ZFUNCTRACE_RUNTIME(); - int lSize = (int)sValuePairs.size(); double fMinRMS = -1.0; double fSelectedk = 0.0; - constexpr int MINNEGATIVE = MAXWORD; std::vector vValues; std::vector vEntropies; double fDarkMean = 0.0; @@ -411,7 +409,6 @@ void CDarkFrame::ComputeOptimalDistributionRatio(CMemoryBitmap * pBitmap, CMemor ZFUNCTRACE_RUNTIME(); EXCLUDEDPIXELVECTOR vExcludedPixels; int i, j; - int lWidth = pBitmap->RealWidth(); int lHeight = pBitmap->RealHeight(); VALUEPAIRSET sRedValuePairs; @@ -516,9 +513,6 @@ void CDarkFrame::ComputeOptimalDistributionRatio(CMemoryBitmap * pBitmap, CMemor GreenStats, BlueStats; - int lNrNegativeReds = 0; - int lNrNegativeBlues = 0; - int lNrNegativeGreens = 0; for (it = sRedValuePairs.begin();it != sRedValuePairs.end();it++) @@ -533,13 +527,6 @@ void CDarkFrame::ComputeOptimalDistributionRatio(CMemoryBitmap * pBitmap, CMemor if ((*it).m_lCount && (*it).m_wLightValue && (*it).m_wDarkValue) BlueStats.AddValue(std::max(0.0, (double)(*it).m_wLightValue - fRatio * (*it).m_wDarkValue), (*it).m_lCount); - double fSigmaRed = RedStats.Sigma(), - fSigmaGreen = GreenStats.Sigma(), - fSigmaBlue = BlueStats.Sigma(); - double fAvgRed = RedStats.Max()-RedStats.Min(), - fAvgGreen = RedStats.Average(), - fAvgBlue = RedStats.Average(); - fRatio -= 0.1; } @@ -1053,8 +1040,6 @@ void CDarkFrameHotParameters::ComputeParameters(CMemoryBitmap* pBitmap, HOTPIXEL void CDarkAmpGlowParameters::ComputeParametersFromPoints(CMemoryBitmap * pBitmap) { ZFUNCTRACE_RUNTIME(); - int lWidth = pBitmap->RealWidth(), - lHeight = pBitmap->RealHeight(); double m_fMedianColdest = -1; m_fMedianHotest = computeMedianValueInRect(pBitmap, m_rcHotest); @@ -1250,9 +1235,9 @@ void CDarkAmpGlowParameters::FindPointsAndComputeParameters(CMemoryBitmap* pBitm else { // Check all the points - double fMaxRed, - fMaxGreen, - fMaxBlue; +#pragma warning (suppress:4456) + double fMaxRed, fMaxGreen, fMaxBlue; + DSSRect rcMaxRed, rcMaxGreen, rcMaxBlue; @@ -1498,7 +1483,7 @@ void CDarkFrame::ComputeDarkFactorFromHotPixels(CMemoryBitmap * pBitmap, STARVEC /* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */ -void CDarkFrame::FindBadVerticalLines(ProgressBase * pProgress) +void CDarkFrame::FindBadVerticalLines(ProgressBase*) { ZFUNCTRACE_RUNTIME(); bool bMonochrome = m_pMasterDark->IsMonochrome(); @@ -1803,7 +1788,7 @@ void CDarkFrame::GetValidNeighbors(int lX, int lY, HOTPIXELVECTOR & vPixels, int /* ------------------------------------------------------------------- */ -void CDarkFrame::InterpolateHotPixels(std::shared_ptr pBitmap, ProgressBase * pProgress) +void CDarkFrame::InterpolateHotPixels(std::shared_ptr pBitmap, ProgressBase*) { ZFUNCTRACE_RUNTIME(); if (static_cast(pBitmap) && !m_vHotPixels.empty()) @@ -1896,9 +1881,6 @@ bool CDarkFrame::Subtract(std::shared_ptr pTarget, ProgressBase* if (m_pMasterDark && m_pMasterDark->IsOk()) { - double fRedDarkFactor = 1.0; - double fGreenDarkFactor = 1.0; - double fBlueDarkFactor = 1.0; if ((m_bHotPixelsDetection || m_bBadLinesDetection) && !m_bHotPixelDetected) { diff --git a/DeepSkyStacker/DeBloom.cpp b/DeepSkyStacker/DeBloom.cpp index c391d4f1..b295840b 100644 --- a/DeepSkyStacker/DeBloom.cpp +++ b/DeepSkyStacker/DeBloom.cpp @@ -35,7 +35,7 @@ inline bool IsEdge(const double pfGray[]) const double fGradient0 = std::abs(pfGray[1] - pfGray[0]) / 256.0; const double fGradient1 = std::abs(pfGray[2] - pfGray[0]) / 256.0; const double fGradient2 = std::abs(pfGray[3] - pfGray[1]) / 256.0; - const double fGradient3 = std::abs(pfGray[4] - pfGray[2]) / 256.0; + // const double fGradient3 = std::abs(pfGray[4] - pfGray[2]) / 256.0; const double fEdge = (fGradient2 - fGradient0) / 2.0 / (fGradient0 - 2.0 * fGradient1 + fGradient2) + 2; @@ -420,17 +420,11 @@ inline double NormalizeAngle(double fAngle) void CDeBloom::RefineStarCenter(CMemoryBitmap * pBitmap, C8BitGrayBitmap * pMask, CBloomedStar & bs) { double fMinimum = NOEDGEANGLE; - double fdX = 0, - fdY = 0, - fdYLeft = 0, - fdYRight = 0; - double fndX = 0, - fndY = 0; + double fdX = 0; + double fndX = 0; + // fndY = 0; double fX = bs.m_ptStar.x(), fY = bs.m_ptStar.y(); - bool bFound = false; - double fOffsetX = 0.0, - fOffsetY = 0.0; // Check that 2 bloomed stars are not side by side bool bLeftBloomed = false, @@ -535,10 +529,8 @@ void CDeBloom::RefineStarCenter2(CMemoryBitmap * pBitmap, C8BitGrayBitmap * pMas bsg.ptStar = bs.m_ptStar; bsgn = bsg; - double fStep = 0.8; double fRadius = bs.m_fRadius; double fMinimum = -1.0; - bool bEnd = true; for (double fdX = -5.0;fdX<=5.0;fdX+=0.2) { @@ -579,7 +571,6 @@ void CDeBloom::ComputeStarCenter(CMemoryBitmap * pBitmap, C8BitGrayBitmap * pMas vValues.reserve(fRadius*2+1); - int lNrColumns = 0; std::vector vYCenters; for (i = std::max(0.0, fX-fRadius-0.5);i<=std::min(static_cast(m_lWidth-1), fX+fRadius+0.5);i++) diff --git a/DeepSkyStacker/DeBloom.h b/DeepSkyStacker/DeBloom.h index 6382fdf0..97e08814 100644 --- a/DeepSkyStacker/DeBloom.h +++ b/DeepSkyStacker/DeBloom.h @@ -88,10 +88,10 @@ public : return (*this); }; - bool operator < (const CBloomedStar & right) const + bool operator<(const CBloomedStar&) const { return true; - }; + } }; typedef std::vector BLOOMEDSTARVECTOR; diff --git a/DeepSkyStacker/DeepSkyStacker.cpp b/DeepSkyStacker/DeepSkyStacker.cpp index 7aa6bb92..32d5124a 100644 --- a/DeepSkyStacker/DeepSkyStacker.cpp +++ b/DeepSkyStacker/DeepSkyStacker.cpp @@ -532,7 +532,7 @@ void DeepSkyStacker::updateTab() void DeepSkyStacker::reportError(const QString& message, DSSBase::Severity severity) { - bool result = QMetaObject::invokeMethod(this, "displayMessage", Qt::QueuedConnection, + QMetaObject::invokeMethod(this, "displayMessage", Qt::QueuedConnection, Q_ARG(const QString&, message), Q_ARG(QMessageBox::Icon, static_cast(severity) )); } @@ -541,7 +541,7 @@ void DeepSkyStacker::reportError(const QString& message, DSSBase::Severity sever BOOL DeepSkyStackerApp::InitInstance() { ZFUNCTRACE_RUNTIME(); - auto result = CWinApp::InitInstance(); + CWinApp::InitInstance(); EnableHtmlHelp(); @@ -838,7 +838,7 @@ int main(int argc, char* argv[]) backPocket = std::make_unique(backPocketSize); for (auto* p = backPocket.get(); p < backPocket.get() + backPocketSize; p += 4096) { - *p = '\xff'; + *p = static_cast('\xff'); } int result{ 0 }; diff --git a/DeepSkyStacker/DeepSkyStacker.vcxproj b/DeepSkyStacker/DeepSkyStacker.vcxproj index 7c858a3f..f05f9682 100644 --- a/DeepSkyStacker/DeepSkyStacker.vcxproj +++ b/DeepSkyStacker/DeepSkyStacker.vcxproj @@ -97,9 +97,12 @@ true - /openmp:experimental /wd4828 + /openmp:experimental /wd4828 /wd4652 /wd4702 false false + Level4 + Level3 + false NDEBUG;%(PreprocessorDefinitions) @@ -164,11 +167,14 @@ $(QtToolsPath)\windeployqt $(TargetPath) true stdcpp20 true - /openmp:experimental /wd4828 + /openmp:experimental /wd4828 /wd4652 /wd4702 false ProgramDatabase + Level4 + Level3 + false _DEBUG;%(PreprocessorDefinitions) @@ -226,27 +232,60 @@ $(QtToolsPath)\windeployqt --pdb $(TargetPath) - - - - - + + Level3 + Level3 + + + Level3 + Level3 + + + Level3 + Level3 + + + Level3 + Level3 + + + Level3 + Level3 + - - + + Level3 + Level3 + + + Level3 + Level3 + - - - + + Level3 + Level3 + + + Level3 + Level3 + + + Level3 + Level3 + - + + Level3 + Level3 + Use Use @@ -309,7 +348,10 @@ $(QtToolsPath)\windeployqt --pdb $(TargetPath) Use Use - + + Level3 + Level3 + Use Use @@ -355,7 +397,6 @@ $(QtToolsPath)\windeployqt --pdb $(TargetPath) Use Use - @@ -818,15 +859,17 @@ $(QtToolsPath)\windeployqt --pdb $(TargetPath) ..\libs\Win64\$(Configuration)Libs;$(LibraryPath) - $(VC_IncludePath);$(WindowsSDK_IncludePath) + + true - $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath) ..\libs\Win64\$(Configuration)Libs;$(LibraryPath) - $(VC_IncludePath);$(WindowsSDK_IncludePath) + + true - $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath) diff --git a/DeepSkyStacker/DeepSkyStacker.vcxproj.filters b/DeepSkyStacker/DeepSkyStacker.vcxproj.filters index a416358c..a1bb4999 100644 --- a/DeepSkyStacker/DeepSkyStacker.vcxproj.filters +++ b/DeepSkyStacker/DeepSkyStacker.vcxproj.filters @@ -237,9 +237,6 @@ Kernel - - Kernel - Kernel @@ -658,9 +655,6 @@ Kernel - - Kernel - Kernel diff --git a/DeepSkyStacker/Delaunay.cpp b/DeepSkyStacker/Delaunay.cpp index 877ac1f6..7a372679 100644 --- a/DeepSkyStacker/Delaunay.cpp +++ b/DeepSkyStacker/Delaunay.cpp @@ -212,7 +212,7 @@ class vertexIsInCircumCircle edgeSet& m_Edges; }; -void Delaunay::Triangulate(const vertexSet& vertices, triangleSet& output) +void Delaunay::Triangulate(const vertexSet& vertices, [[maybe_unused]]triangleSet& output) { if (vertices.size() < 3) return; // nothing to handle diff --git a/DeepSkyStacker/DropFilesDlg.cpp b/DeepSkyStacker/DropFilesDlg.cpp index d6ca72cd..33632143 100644 --- a/DeepSkyStacker/DropFilesDlg.cpp +++ b/DeepSkyStacker/DropFilesDlg.cpp @@ -73,7 +73,7 @@ void DropFilesDlg::onInitDialog() QSettings settings; QString string; size_t fileCount{ 0 }; - bool checked = false; + // bool checked = false; std::vector masters; // diff --git a/DeepSkyStacker/ExceptionHandling.cpp b/DeepSkyStacker/ExceptionHandling.cpp index 64944919..07787d48 100644 --- a/DeepSkyStacker/ExceptionHandling.cpp +++ b/DeepSkyStacker/ExceptionHandling.cpp @@ -58,7 +58,7 @@ namespace { // case STATUS_ASSERTION_FAILURE: return printExc("ASSERTION_FAILURE"); default: return nullptr; } - return nullptr; + // return nullptr; }; std::atomic barrier{ 0 }; diff --git a/DeepSkyStacker/ExplorerBar.cpp b/DeepSkyStacker/ExplorerBar.cpp index a48a1ceb..660d5de8 100644 --- a/DeepSkyStacker/ExplorerBar.cpp +++ b/DeepSkyStacker/ExplorerBar.cpp @@ -323,7 +323,7 @@ void ExplorerBar::onLoadSettings() } else { - ZTRACE_RUNTIME("Loading settings file: %s", a->text().toLocal8Bit()); + ZTRACE_RUNTIME("Loading settings file: %s", a->text().toLocal8Bit().constData()); // // One of the paths in the mruPath must have been selected // In which case the action's text string is the fully qualified name of the file to load @@ -381,7 +381,7 @@ void ExplorerBar::onSaveSettings() } else { - ZTRACE_RUNTIME("Saving settings to file: %s", a->text().toLocal8Bit()); + ZTRACE_RUNTIME("Saving settings to file: %s", a->text().toLocal8Bit().constData()); // // One of the paths in the mruPath must have been selected // In which case the action's text string is the fully qualified name of the file to load @@ -453,7 +453,7 @@ void ExplorerBar::LoadSettingFile() fs::path fileName(files.at(0).toStdU16String()); // as UTF-16 if (status(fileName).type() == fs::file_type::regular) { - ZTRACE_RUNTIME("Loading settings file: %s", fileName.generic_string()); + ZTRACE_RUNTIME("Loading settings file: %s", fileName.generic_string().c_str()); QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); workspace.ReadFromFile(fileName); @@ -497,7 +497,7 @@ void ExplorerBar::SaveSettingFile() if (!file.isEmpty()) { fs::path fileName(file.toStdU16String()); // as UTF-16 - ZTRACE_RUNTIME("Saving settings file: %s", fileName.generic_string()); + ZTRACE_RUNTIME("Saving settings file: %s", fileName.generic_string().c_str()); QGuiApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); workspace.SaveToFile(fileName); diff --git a/DeepSkyStacker/FITSUtil.cpp b/DeepSkyStacker/FITSUtil.cpp index 9ea34df8..68af1a6c 100644 --- a/DeepSkyStacker/FITSUtil.cpp +++ b/DeepSkyStacker/FITSUtil.cpp @@ -242,9 +242,9 @@ bool CFITSReader::Open() fits_get_errstatus(status, error_text); CString errorMessage; errorMessage.Format(_T("fits_open_diskfile %s\nreturned a status of %d, error text is:\n\"%s\""), - m_strFileName, + (LPCTSTR)m_strFileName, status, - CString(error_text)); + &error_text[0]); ZTRACE_RUNTIME((LPCSTR)CT2CA(errorMessage)); @@ -261,7 +261,7 @@ bool CFITSReader::Open() if (m_fits) { CStringA fileName(m_strFileName); - ZTRACE_RUNTIME("Opened %s", fileName); + ZTRACE_RUNTIME("Opened %s", (LPCSTR)fileName); // File ok - move to the first image HDU CString strSimple; @@ -1023,11 +1023,11 @@ bool CFITSReadInMemoryBitmap::OnRead(int lX, int lY, double fRed, double fGreen, errorMessage.Format( _T("Exception %s thrown from %s Function: %s() Line: %lu\n\n%s"), - name, - fileName, - functionName, + (LPCTSTR)name, + (LPCTSTR)fileName, + (LPCTSTR)functionName, e.locationAtIndex(0)->lineNumber(), - text); + (LPCTSTR)text); #if defined(_CONSOLE) std::wcerr << errorMessage; #else @@ -1650,10 +1650,10 @@ bool CFITSWriteFromMemoryBitmap::OnOpen() if (m_pMemoryBitmap && m_pMemoryBitmap->IsCFA()) m_CFAType = m_pMemoryBitmap->GetCFAType(); - if (m_Format == TF_UNKNOWN) + if (m_Format == FF_UNKNOWN) m_Format = GetBestFITSFormat(m_pMemoryBitmap); - if (m_Format != TF_UNKNOWN) + if (m_Format != FF_UNKNOWN) { SetFormat(lWidth, lHeight, m_Format, m_CFAType); if (!m_lISOSpeed) @@ -1697,11 +1697,11 @@ bool CFITSWriteFromMemoryBitmap::OnWrite(int lX, int lY, double& fRed, double& f errorMessage.Format( _T("Exception %s thrown from %s Function: %s() Line: %lu\n\n%s"), - name, - fileName, - functionName, + (LPCTSTR)name, + (LPCTSTR)fileName, + (LPCTSTR)functionName, e.locationAtIndex(0)->lineNumber(), - text); + (LPCTSTR)text); #if defined(_CONSOLE) std::wcerr << errorMessage; #else diff --git a/DeepSkyStacker/FITSUtil.h b/DeepSkyStacker/FITSUtil.h index 00d8dff8..54fd4783 100644 --- a/DeepSkyStacker/FITSUtil.h +++ b/DeepSkyStacker/FITSUtil.h @@ -152,7 +152,7 @@ private : virtual bool Close(); virtual bool OnOpen() { return true; } - virtual bool OnRead(int lX, int lY, double fRed, double fGreen, double fBlue) { return false; } + virtual bool OnRead(int, int, double, double, double) { return false; } virtual bool OnClose() { return true; } }; diff --git a/DeepSkyStacker/Filters.cpp b/DeepSkyStacker/Filters.cpp index 7df14cbf..e32ebf2b 100644 --- a/DeepSkyStacker/Filters.cpp +++ b/DeepSkyStacker/Filters.cpp @@ -79,7 +79,6 @@ void CExtendedMedianImageFilter::AnalyzeImage(CMemoryBitmap * pInBitmap, bool bC { double fRed, fGreen, fBlue; double fPositionRed, fPositionGreen, fPositionBlue; - double fPosition; pInBitmap->GetPixel(i-1, j-1, vReds[0], vGreens[0], vBlues[0]); pInBitmap->GetPixel(i, j-1, vReds[1], vGreens[1], vBlues[1]); @@ -151,7 +150,7 @@ inline void CheckPixel(int X, int Y, EXCLUDEDPIXELVECTOR &vExcluded, EXCLUDEDPIX /* ------------------------------------------------------------------- */ -void CExtendedMedianImageFilter::ApplyFilterInternal(const CMemoryBitmap* pInBitmap, CMemoryBitmap* pOutBitmap, ProgressBase* pProgress) +void CExtendedMedianImageFilter::ApplyFilterInternal(const CMemoryBitmap* pInBitmap, CMemoryBitmap* pOutBitmap, ProgressBase*) { ZFUNCTRACE_RUNTIME(); EXCLUDEDPIXELVECTOR vExcluded = m_vExcludedPixels; @@ -167,7 +166,7 @@ void CExtendedMedianImageFilter::ApplyFilterInternal(const CMemoryBitmap* pInBit for (size_t k = 0; k < vExcluded.size(); k++) { - int lNrNeighbors = 0; + // int lNrNeighbors = 0; CExcludedPixel& Pixel = vExcluded[k]; CExcludedPixel TestPixel; EXCLUDEDPIXELVECTOR vOkPixels; @@ -240,6 +239,10 @@ void CExtendedMedianImageFilter::ApplyFilterInternal(const CMemoryBitmap* pInBit std::shared_ptr CExtendedMedianImageFilter::ApplyFilter(CMemoryBitmap* pInBitmap, ProgressBase* pProgress) { ZFUNCTRACE_RUNTIME(); + // + // Note that if m_bUseRejectThreshold is set it is INTENTIONAL that analyseImage is called TWICE. + // The first run sets m_fHotThreshold and m_fColdThreshold which are used in the second invocation. + // if (m_bUseRejectThreshold) AnalyzeImage(pInBitmap, true); AnalyzeImage(pInBitmap, false); diff --git a/DeepSkyStacker/FlatFrame.cpp b/DeepSkyStacker/FlatFrame.cpp index d1c674ce..e5dd8fb6 100644 --- a/DeepSkyStacker/FlatFrame.cpp +++ b/DeepSkyStacker/FlatFrame.cpp @@ -105,7 +105,7 @@ bool CFlatFrame::ApplyFlat(std::shared_ptr pTarget, ProgressBase { ZTRACE_RUNTIME("Target.RealWidth = %d, Source.RealWidth = %d", pTarget->RealWidth(), m_pFlatFrame->RealWidth()); ZTRACE_RUNTIME("Target.RealHeight = %d, Source.RealHeight = %d", pTarget->RealHeight(), m_pFlatFrame->RealHeight()); - ZTRACE_RUNTIME("Did not perform %s", strText); + ZTRACE_RUNTIME("Did not perform %s", (LPCSTR)strText); } } diff --git a/DeepSkyStacker/FrameList.cpp b/DeepSkyStacker/FrameList.cpp index 02118c3c..da9c95a8 100644 --- a/DeepSkyStacker/FrameList.cpp +++ b/DeepSkyStacker/FrameList.cpp @@ -95,7 +95,7 @@ namespace DSS // If the group number passed in was -1 then want to count the number of // checked images of the relevant type in ALL groups. Otherwise only // count checked images for the passed group number. - if (-1 == id || id == group.index()) + if (-1 == id || id == static_cast(group.index())) { for (auto it = group.pictures->cbegin(); it != group.pictures->cend(); ++it) @@ -502,7 +502,7 @@ namespace DSS // // Check all groups to see if this file has already been loaded // - if (auto groupId = Group::whichGroupContains(filePath); groupId != -1) + if (groupId = Group::whichGroupContains(filePath); groupId != static_cast(-1)) { // // If the file has already been loaded complain @@ -516,7 +516,7 @@ namespace DSS #if defined(_CONSOLE) std::cerr << errorMessage.toUtf8().constData(); #else - int ret = QMessageBox::warning(nullptr, "DeepSkyStacker", + QMessageBox::warning(nullptr, "DeepSkyStacker", errorMessage, QMessageBox::Ok); #endif @@ -567,15 +567,7 @@ namespace DSS { bool bResult = true; bool bFirst = true; - const ListBitMap* lb; - int lNrDarks = 0; - int lNrDarkFlats = 0; - int lNrFlats = 0; - int lNrOffsets = 0; - bool bMasterDark = false; - bool bMasterFlat = false; - bool bMasterDarkFlat = false; - bool bMasterOffset = false; + const ListBitMap* lb{ nullptr }; // Iterate over all groups. for (uint16_t group = 0; group != imageGroups.size() && true == bResult; ++group) @@ -604,32 +596,6 @@ namespace DSS } } -#if (0) - if (bResult) - { - if (bMasterDark && lNrDarks > 1) - { - reason = QCoreApplication::translate("DSS::StackingDlg", "A Master Dark must be the only Dark frame"); - bResult = false; - } - if (bMasterDarkFlat && lNrDarkFlats > 1) - { - reason = QCoreApplication::translate("DSS::StackingDlg", "A Master Dark Flat must be the only Dark Flat frame"); - bResult = false; - } - if (bMasterFlat && lNrFlats > 1) - { - reason = QCoreApplication::translate("DSS::StackingDlg", "A Master Flat must be the only Flat frame"); - bResult = false; - } - if (bMasterOffset && lNrOffsets > 1) - { - reason = QCoreApplication::translate("DSS::StackingDlg", "A Master Offset must be the only Offset frame"); - bResult = false; - } - }; -#endif - return bResult; }; @@ -731,9 +697,9 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int32_t index = 0; index < group.pictures->mydata.size(); ++index) + for (int32_t idx = 0; idx < group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (check) file.m_bChecked = Qt::Checked; else file.m_bChecked = Qt::Unchecked; } @@ -750,9 +716,9 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int32_t index = 0; index < group.pictures->mydata.size(); ++index) + for (int32_t idx = 0; idx < group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (file.IsDarkFrame()) { if (check) file.m_bChecked = Qt::Checked; @@ -774,9 +740,9 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int32_t index = 0; index < group.pictures->mydata.size(); ++index) + for (int32_t idx = 0; idx < group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (file.IsFlatFrame()) { if (check) file.m_bChecked = Qt::Checked; @@ -799,9 +765,9 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int32_t index = 0; index < group.pictures->mydata.size(); ++index) + for (int32_t idx = 0; idx < group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (file.IsOffsetFrame()) { if (check) file.m_bChecked = Qt::Checked; @@ -824,15 +790,15 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int32_t index = 0; index < group.pictures->mydata.size(); ++index) + for (int32_t idx = 0; idx < group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (file.IsLightFrame()) { if (check) file.m_bChecked = Qt::Checked; else file.m_bChecked = Qt::Unchecked; - QModelIndex start{ group.pictures->createIndex(index, 0) }; - QModelIndex end{ group.pictures->createIndex(index, 0) }; + QModelIndex start{ group.pictures->createIndex(idx, 0) }; + QModelIndex end{ group.pictures->createIndex(idx, 0) }; QVector role{ Qt::CheckStateRole }; group.pictures->dataChanged(start, end, role); } @@ -846,16 +812,16 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int32_t index = 0; index < group.pictures->mydata.size(); ++index) + for (int32_t idx = 0; idx < group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (image == file.m_strFile && file.IsLightFrame()) { if (check) file.m_bChecked = Qt::Checked; else file.m_bChecked = Qt::Unchecked; group.setDirty(); - QModelIndex start{ group.pictures->createIndex(index, 0) }; - QModelIndex end{ group.pictures->createIndex(index, 0) }; + QModelIndex start{ group.pictures->createIndex(idx, 0) }; + QModelIndex end{ group.pictures->createIndex(idx, 0) }; QVector role{ Qt::CheckStateRole }; group.pictures->dataChanged(start, end, role); return; @@ -871,15 +837,15 @@ namespace DSS for (int id = 0; id != imageGroups.size(); ++id) { auto& group = imageGroups[id]; - for (int index = 0; index != group.pictures->mydata.size(); ++index) + for (int idx = 0; idx != group.pictures->mydata.size(); ++idx) { - auto& file = group.pictures->mydata[index]; + auto& file = group.pictures->mydata[idx]; if (file.IsLightFrame()) { file.m_bChecked = (file.m_fOverallQuality >= threshold) ? Qt::Checked : Qt::Unchecked; - QModelIndex start{ group.pictures->createIndex(index, 0) }; - QModelIndex end{ group.pictures->createIndex(index, 0) }; + QModelIndex start{ group.pictures->createIndex(idx, 0) }; + QModelIndex end{ group.pictures->createIndex(idx, 0) }; QVector role{ Qt::CheckStateRole }; group.pictures->dataChanged(start, end, role); } @@ -891,7 +857,7 @@ namespace DSS /* ------------------------------------------------------------------- */ - void FrameList::changePictureType(int nItem, PICTURETYPE PictureType) + void FrameList::changePictureType([[maybe_unused]] int nItem, [[maybe_unused]]PICTURETYPE PictureType) { qDebug() << "In " << #ifdef __FUNCSIG__ @@ -936,12 +902,12 @@ namespace DSS for (size_t i = 0; i < lightFrames.size(); i++) { auto id = lightFrames[i].group; - auto index = lightFrames[i].index; + auto idx = lightFrames[i].index; - imageGroups[id].pictures->mydata[index].m_bChecked = + imageGroups[id].pictures->mydata[idx].m_bChecked = (i <= last) ? Qt::Checked : Qt::Unchecked; - QModelIndex start{ imageGroups[id].pictures->createIndex(index, 0) }; - QModelIndex end{ imageGroups[id].pictures->createIndex(index, 0) }; + QModelIndex start { imageGroups[id].pictures->createIndex(idx, 0) }; + QModelIndex end { imageGroups[id].pictures->createIndex(idx, 0) }; QVector role{ Qt::CheckStateRole }; imageGroups[id].pictures->dataChanged(start, end, role); } @@ -1004,7 +970,7 @@ namespace DSS imageGroups[index].pictures->endInsertRows(); return *this; } - bool FrameList::addFile(fs::path file, PICTURETYPE PictureType /* = PICTURETYPE_LIGHTFRAME */, bool bCheck /* = false */, int nItem /* = -1 */) + bool FrameList::addFile(fs::path file, PICTURETYPE PictureType /* = PICTURETYPE_LIGHTFRAME */, bool bCheck /* = false */, int /*nItem = -1 */) { imageGroups[index].addFile(file, PictureType, bCheck); return true; diff --git a/DeepSkyStacker/FrameList.h b/DeepSkyStacker/FrameList.h index 736b7e94..d5d11e69 100644 --- a/DeepSkyStacker/FrameList.h +++ b/DeepSkyStacker/FrameList.h @@ -104,9 +104,9 @@ namespace DSS FrameList& saveListToFile(fs::path file); FrameList& loadFilesFromList(fs::path fileList); - inline FrameList& beginInsertRows(int count); - inline FrameList& endInsertRows(); - virtual bool addFile(fs::path file, PICTURETYPE PictureType = PICTURETYPE_LIGHTFRAME, bool bCheck = false, int nItem = -1); + FrameList& beginInsertRows(int count); + FrameList& endInsertRows(); + virtual bool addFile(fs::path file, PICTURETYPE PictureType = PICTURETYPE_LIGHTFRAME, bool bCheck = false, [[maybe_unused]] int nItem = -1); void blankCheckedItemScores(); diff --git a/DeepSkyStacker/GreyMultiBitmap.cpp b/DeepSkyStacker/GreyMultiBitmap.cpp index 44e55d4c..049a3ccc 100644 --- a/DeepSkyStacker/GreyMultiBitmap.cpp +++ b/DeepSkyStacker/GreyMultiBitmap.cpp @@ -22,8 +22,6 @@ std::shared_ptr CGrayMultiBitmapT::CreateNewM return CreateBitmap(bc); } } - auto pNewBitmap = std::make_shared>(); - return pNewBitmap; return std::make_shared>(); } @@ -82,7 +80,7 @@ bool CGrayMultiBitmapT::SetScanLines(CMemoryBitmap* pBitmap, for (int i = 0; i < lWidth; i++) { TType* pValue; - double fWeight = 1.0; + //double fWeight = 1.0; vValues.resize(0); for (size_t j = 0; j < vScanLines.size(); j++) diff --git a/DeepSkyStacker/Histogram.h b/DeepSkyStacker/Histogram.h index 3455b609..0d6000dc 100644 --- a/DeepSkyStacker/Histogram.h +++ b/DeepSkyStacker/Histogram.h @@ -434,9 +434,9 @@ public : m_BlueAdjust.ToText(strBlueParameters); strParameters.Format(_T("RedAdjust{%s}GreenAdjust{%s}BlueAdjust{%s}"), - strRedParameters, - strGreenParameters, - strBlueParameters); + (LPCTSTR)strRedParameters, + (LPCTSTR)strGreenParameters, + (LPCTSTR)strBlueParameters); }; void FromText(LPCTSTR szParameters) diff --git a/DeepSkyStacker/ImageListModel.cpp b/DeepSkyStacker/ImageListModel.cpp index 3f6545a7..55167173 100644 --- a/DeepSkyStacker/ImageListModel.cpp +++ b/DeepSkyStacker/ImageListModel.cpp @@ -450,8 +450,8 @@ namespace DSS break; case Column::Type: { - int index = value.toInt(); - switch (index) + int idx = value.toInt(); + switch (idx) { case 0: file.m_strType = QCoreApplication::translate("DSS::Group", "Light", "IDS_TYPE_LIGHT"); diff --git a/DeepSkyStacker/ImageListModel.h b/DeepSkyStacker/ImageListModel.h index b3f5b0d3..bd33eabc 100644 --- a/DeepSkyStacker/ImageListModel.h +++ b/DeepSkyStacker/ImageListModel.h @@ -67,20 +67,20 @@ namespace DSS explicit ImageListModel(QObject* parent = nullptr); - inline int rowCount(const QModelIndex& parent = QModelIndex()) const override + inline [[nodiscard]] int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override { // Return number of images we know about return static_cast(mydata.size()); }; - inline int columnCount(const QModelIndex& parent = QModelIndex()) const override + inline [[nodiscard]] int columnCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override { // Pretty simple really return static_cast(Column::MAX_COLS); }; - inline Qt::ItemFlags flags(const QModelIndex& index) const override + inline [[nodiscard]] Qt::ItemFlags flags(const QModelIndex& index) const override { auto flags = Inherited::flags(index); switch (Column(index.column())) diff --git a/DeepSkyStacker/ImageSinks.cpp b/DeepSkyStacker/ImageSinks.cpp index d5d881d3..76e4f7b4 100644 --- a/DeepSkyStacker/ImageSinks.cpp +++ b/DeepSkyStacker/ImageSinks.cpp @@ -707,7 +707,7 @@ bool CEditStarsSink::Image_OnMouseLeave() /* ------------------------------------------------------------------- */ -bool CEditStarsSink::Image_OnLButtonDown(long lX, long lY) +bool CEditStarsSink::Image_OnLButtonDown(long, long) { bool bResult = false; @@ -761,12 +761,10 @@ bool CEditStarsSink::Image_OnLButtonDown(long lX, long lY) /* ------------------------------------------------------------------- */ -bool CEditStarsSink::Image_OnLButtonUp(long lX, long lY) +bool CEditStarsSink::Image_OnLButtonUp(long, long) { - bool bResult = true; - - return bResult; -}; + return true; +} /* ------------------------------------------------------------------- */ @@ -829,6 +827,7 @@ void CEditStarsSink::DrawQualityGrid(Graphics * pGraphics, CRect & rcClient) if (rc3.IntersectRect(&rc1, &rc2)) { // Draw the triangle +#pragma warning (suppress:4456) PointF pt[3]; pt[0] = tr.pt1, @@ -1201,6 +1200,7 @@ Image * CEditStarsSink::GetOverlayImage(CRect & rcClient) { CPoint pt; CRect rc; +#pragma warning (suppress:4456) CStar & star = vStars[i]; double fX, fY; @@ -1430,6 +1430,10 @@ void CQualityGrid::InitGrid(STARVECTOR& vStars) Delaunay delaunay; triangleSet sTriangles; + // + // ### To Do + // March 2023: Delaunay::Triangulate() does nothing. sTriangles will be empty. + // delaunay.Triangulate(sVertices, sTriangles); m_vTriangles.reserve(sTriangles.size()); diff --git a/DeepSkyStacker/ImageSinks.h b/DeepSkyStacker/ImageSinks.h index 50121e6b..347cde19 100644 --- a/DeepSkyStacker/ImageSinks.h +++ b/DeepSkyStacker/ImageSinks.h @@ -194,6 +194,7 @@ class CEditStarsSink : public CWndImageSink if (!m_vVotedPairs.empty()) { //for (size_t i = 0; i < m_vVotedPairs.size() && !bResult; i++) +#pragma warning (suppress:4189) for (const auto& votedPair : m_vVotedPairs) { if constexpr (Refstar) diff --git a/DeepSkyStacker/MatchingStars.cpp b/DeepSkyStacker/MatchingStars.cpp index 41a62dbf..87fb54e4 100644 --- a/DeepSkyStacker/MatchingStars.cpp +++ b/DeepSkyStacker/MatchingStars.cpp @@ -223,9 +223,11 @@ bool CMatchingStars::ComputeTransformation(const VOTINGPAIRVECTOR & vVotingPairs for (i = 0;i vOkAddedPairs; CBilinearParameters OkTransformation; - TRANSFORMATIONTYPE OkTType; + TRANSFORMATIONTYPE OkTType{ TT_LINEAR }; if (!vVotingPairs.empty() && vVotingPairs[0].IsCorner()) lNrExtraPairs = 4; diff --git a/DeepSkyStacker/MemoryBitmap.h b/DeepSkyStacker/MemoryBitmap.h index 8dc5c8d0..26b5058b 100644 --- a/DeepSkyStacker/MemoryBitmap.h +++ b/DeepSkyStacker/MemoryBitmap.h @@ -119,10 +119,10 @@ class CMemoryBitmap virtual void GetPixel(size_t i, size_t j, double& fRed, double& fGreen, double& fBlue) = 0; virtual void GetPixel(size_t i, size_t j, double& fGray) = 0; - virtual void SetValue(size_t i, size_t j, double fRed, double fGreen, double fBlue) {}; - virtual void GetValue(size_t i, size_t j, double& fRed, double& fGreen, double& fBlue) const {}; - virtual void SetValue(size_t i, size_t j, double fGray) {}; - virtual void GetValue(size_t i, size_t j, double& fGray) const {}; + virtual void SetValue(size_t, size_t, double, double, double) {}; + virtual void GetValue(size_t, size_t, double&, double&, double&) const {}; + virtual void SetValue(size_t, size_t, double) {}; + virtual void GetValue(size_t, size_t, double&) const {}; virtual bool GetScanLine(size_t j, void* pScanLine) = 0; virtual bool SetScanLine(size_t j, void* pScanLine) = 0; @@ -176,7 +176,7 @@ class CMemoryBitmap return m_bCFA; } - virtual BAYERCOLOR GetBayerColor(int x, int y) + virtual BAYERCOLOR GetBayerColor(int, int) { return BAYER_UNKNOWN; } @@ -194,7 +194,7 @@ class CMemoryBitmap virtual std::unique_ptr Clone(bool bEmpty = false) const = 0; virtual std::shared_ptr CreateEmptyMultiBitmap() const = 0; - virtual void AverageBitmap(CMemoryBitmap* pBitmap, DSS::ProgressBase* pProgress) {}; + virtual void AverageBitmap(CMemoryBitmap*, DSS::ProgressBase*) {}; virtual void RemoveHotPixels(DSS::ProgressBase* pProgress = nullptr) = 0; virtual std::shared_ptr GetMedianFilterEngine() const = 0; diff --git a/DeepSkyStacker/MultiBitmap.h b/DeepSkyStacker/MultiBitmap.h index ac9e7c1a..989d6138 100644 --- a/DeepSkyStacker/MultiBitmap.h +++ b/DeepSkyStacker/MultiBitmap.h @@ -10,15 +10,15 @@ class CMultiBitmap protected: std::shared_ptr m_pBitmapModel; mutable std::shared_ptr m_pHomBitmap; - MULTIBITMAPPROCESSMETHOD m_Method; + MULTIBITMAPPROCESSMETHOD m_Method; double m_fKappa; int m_lNrIterations; int m_lNrBitmaps; int m_lNrAddedBitmaps; - BITMAPPARTFILEVECTOR m_vFiles; + std::vector m_vFiles; int m_lWidth; int m_lHeight; - bool m_bInitDone; + std::atomic_bool m_bInitDone; bool m_bHomogenization; double m_fMaxWeight; std::vector m_vImageOrder; diff --git a/DeepSkyStacker/MultiBitmapProcess.cpp b/DeepSkyStacker/MultiBitmapProcess.cpp index cde4d7a1..4d5dfe2b 100644 --- a/DeepSkyStacker/MultiBitmapProcess.cpp +++ b/DeepSkyStacker/MultiBitmapProcess.cpp @@ -10,19 +10,17 @@ #include "GrayBitmap.h" #include "ColorBitmap.h" -/* ------------------------------------------------------------------- */ +namespace { -static void GetTempFileName(CString & strFile) +QString GetTempFileName() { - TCHAR szTempFileName[1+_MAX_PATH]; - QString strFolder(CAllStackingTasks::GetTemporaryFilesFolder()); - - GetTempFileName(CString((LPCTSTR)strFolder.utf16()), _T("DSS"), 0, szTempFileName); + TCHAR szTempFileName[1 + _MAX_PATH] = { '\0' }; + ::GetTempFileName(reinterpret_cast(CAllStackingTasks::GetTemporaryFilesFolder().utf16()), _T("DSS"), 0, szTempFileName); + return QString::fromWCharArray(szTempFileName); +} - strFile = szTempFileName; -}; +} -/* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */ void CMultiBitmap::SetBitmapModel(const CMemoryBitmap* pBitmap) @@ -34,132 +32,112 @@ void CMultiBitmap::SetBitmapModel(const CMemoryBitmap* pBitmap) void CMultiBitmap::DestroyTempFiles() { - for (int i = 0;im_vFiles) { - if (m_vFiles[i].m_strFile.length()) - DeleteFile(m_vFiles[i].m_strFile.toStdWString().c_str()); - m_vFiles[i].m_strFile.clear(); - }; + if (!bitmapPart.m_tempFileName.isEmpty()) + DeleteFile(reinterpret_cast(bitmapPart.m_tempFileName.utf16())); + bitmapPart.m_tempFileName.clear(); + } m_vFiles.clear(); -}; +} /* ------------------------------------------------------------------- */ void CMultiBitmap::InitParts() { ZFUNCTRACE_RUNTIME(); - int lNrLinesPerFile; - int lNrLines; - int lNrParts; - int lLineSize; - int lNrRemainingLines; - int lNrOffsetLine = 0; // make files a maximum of 50 Mb - lLineSize = (GetNrBytesPerChannel() * GetNrChannels() * m_lWidth); + const int lLineSize = (GetNrBytesPerChannel() * GetNrChannels() * m_lWidth); - lNrLinesPerFile = 50000000L / lLineSize; - lNrLines = lNrLinesPerFile / m_lNrBitmaps; - lNrRemainingLines = lNrLinesPerFile % m_lNrBitmaps; + const int lNrLinesPerFile = 50000000L / lLineSize; + int lNrLines = lNrLinesPerFile / m_lNrBitmaps; + int lNrRemainingLines = lNrLinesPerFile % m_lNrBitmaps; - if (!lNrLines) + if (lNrLines == 0) lNrLines = 1; - lNrParts = m_lNrBitmaps * m_lHeight/lNrLinesPerFile; + int lNrParts = m_lNrBitmaps * m_lHeight / lNrLinesPerFile; if ((m_lNrBitmaps * m_lHeight) % lNrLinesPerFile != 0) lNrParts++; m_vFiles.clear(); - int lStartRow = -1; - int lEndRow = -1; + int lStartRow = -1; + int lEndRow = -1; - while (lEndRow RealWidth(); - m_lHeight = pBitmap->RealHeight(); - InitParts(); - m_lNrAddedBitmaps = 0; - }; + auto lock = std::scoped_lock{ initMutex }; + if (m_bInitDone.load() == false) + { + m_lWidth = pBitmap->RealWidth(); + m_lHeight = pBitmap->RealHeight(); + InitParts(); // Will set m_bInitDone to true + m_lNrAddedBitmaps = 0; + } + } - { - // Save the bitmap to the file - void * pScanLine = nullptr; - int lScanLineSize; + // Save the bitmap to the file + const size_t lScanLineSize = static_cast(pBitmap->BitPerSample()) * (pBitmap->IsMonochrome() ? 1 : 3) * m_lWidth / 8; + std::vector scanLineBuffer(lScanLineSize); - lScanLineSize = (pBitmap->BitPerSample() * (pBitmap->IsMonochrome() ? 1 : 3) * m_lWidth/8); + if (pProgress) + pProgress->Start2(m_lHeight); - pScanLine = (void*)malloc(lScanLineSize); + for (const auto& file : m_vFiles) + { + auto dtor = [](FILE* fp) { if (fp != nullptr) fclose(fp); }; + std::unique_ptr pFile{ _tfopen(reinterpret_cast(file.m_tempFileName.utf16()), _T("a+b")), dtor }; + if (pFile.get() == nullptr) + return false; - if (pScanLine) - bResult = true; - if (pProgress) - pProgress->Start2(m_lHeight); + fseek(pFile.get(), 0, SEEK_END); - for (int k = 0;kGetScanLine(j, scanLineBuffer.data()); + if (fwrite(scanLineBuffer.data(), lScanLineSize, 1, pFile.get()) != 1) + return false; - hFile = _tfopen(m_vFiles[k].m_strFile.toStdWString().c_str(), _T("a+b")); - if (hFile) - { - bResult = true; - fseek(hFile, 0, SEEK_END); - }; - for (int j = m_vFiles[k].m_lStartRow;j<=m_vFiles[k].m_lEndRow && bResult;j++) - { - pBitmap->GetScanLine(j, pScanLine); - bResult = (fwrite(pScanLine, lScanLineSize, 1, hFile) == 1); + if (pProgress) + pProgress->Progress2(j + 1); + } + } - if (pProgress) - pProgress->Progress2(j+1); - }; - if (hFile) - fclose(hFile); - }; + if (pProgress) + pProgress->End2(); - if (pProgress) - pProgress->End2(); - if (pScanLine) - free(pScanLine); - m_lNrAddedBitmaps++; - }; + m_lNrAddedBitmaps++; - return bResult; -}; + return true; +} /* ------------------------------------------------------------------- */ @@ -202,7 +180,7 @@ void CCombineTask::process() std::vector scanLines(nrBitmaps, nullptr); AvxOutputComposition avxOutputComposition(*m_pMultiBitmap, *m_pBitmap); - const auto handleError = [](const auto& errorMessage, const auto flags) -> void + const auto handleError = [](const auto& errorMessage,[[maybe_unused]] const auto flags) -> void { #if defined(_CONSOLE) std::wcerr << errorMessage; @@ -405,7 +383,7 @@ std::shared_ptr CMultiBitmap::GetResult(ProgressBase* pProgress) if (fileSize > buffer.size()) buffer.resize(fileSize); - FILE* hFile = _tfopen(file.m_strFile.toStdWString().c_str(), _T("rb")); + FILE* hFile = _tfopen(reinterpret_cast(file.m_tempFileName.utf16()), _T("rb")); if (hFile != nullptr) { bResult = fread(buffer.data(), 1, fileSize, hFile) == fileSize; diff --git a/DeepSkyStacker/OutputTab.cpp b/DeepSkyStacker/OutputTab.cpp index 04db0b75..4388d6e4 100644 --- a/DeepSkyStacker/OutputTab.cpp +++ b/DeepSkyStacker/OutputTab.cpp @@ -26,7 +26,6 @@ void OutputTab::onSetActive() CAllStackingTasks::GetOutputSettings(os); bool enable = os.m_bOutput; - bool temp = false; ui->createOutput->setChecked(enable); ui->createHTML->setEnabled(enable); diff --git a/DeepSkyStacker/ProcessingDlg.cpp b/DeepSkyStacker/ProcessingDlg.cpp index 034acc4c..29ec1392 100644 --- a/DeepSkyStacker/ProcessingDlg.cpp +++ b/DeepSkyStacker/ProcessingDlg.cpp @@ -481,7 +481,7 @@ void CProcessingDlg::UpdateInfos() strFrames.Format(IDS_NRFRAMES, lNrFrames); }; - strText.Format(_T("%s\n%s%s%s%s"), m_strCurrentFile, strISO, strGain, strTime, strFrames); + strText.Format(_T("%s\n%s%s%s%s"), m_strCurrentFile.GetString(), strISO.GetString(), strGain.GetString(), strTime.GetString(), strFrames.GetString()); } else strText = m_strCurrentFile; @@ -788,8 +788,6 @@ void CProcessingDlg::CopyPictureToClipboard() void CProcessingDlg::CreateStarMask() { - bool bResult = false; - if (dssApp->deepStack().IsLoaded()) { KillTimer(1); @@ -1058,7 +1056,6 @@ public : void CProcessingDlg::DrawHistoBar(Graphics * pGraphics, int lNrReds, int lNrGreens, int lNrBlues, int X, int lHeight) { - HPEN hOldPen = nullptr; std::vector vColors; int lLastHeight = 0; @@ -1479,55 +1476,55 @@ void CProcessingDlg::OnReset() /* ------------------------------------------------------------------- */ -void CProcessingDlg::OnNotifyRedChangeSelPeg(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyRedChangeSelPeg(NMHDR *, LRESULT *) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyRedPegMove(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyRedPegMove(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyRedPegMoved(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyRedPegMoved(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyGreenChangeSelPeg(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyGreenChangeSelPeg(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyGreenPegMove(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyGreenPegMove(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyGreenPegMoved(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyGreenPegMoved(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyBlueChangeSelPeg(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyBlueChangeSelPeg(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyBluePegMove(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyBluePegMove(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); }; -void CProcessingDlg::OnNotifyBluePegMoved(NMHDR * pNotifyStruct, LRESULT *result) +void CProcessingDlg::OnNotifyBluePegMoved(NMHDR*, LRESULT*) { m_bDirty = true; ShowOriginalHistogram(); diff --git a/DeepSkyStacker/ProcessingDlg.h b/DeepSkyStacker/ProcessingDlg.h index 96a992a7..47caa729 100644 --- a/DeepSkyStacker/ProcessingDlg.h +++ b/DeepSkyStacker/ProcessingDlg.h @@ -259,7 +259,7 @@ public : { bool bResult = false; PROCESSPARAMITERATOR it; - bool bFound = false; + //bool bFound = false; if (!(lIndice >= 0) && (lIndice < size())) return false; diff --git a/DeepSkyStacker/QLinearGradientCtrl.cpp b/DeepSkyStacker/QLinearGradientCtrl.cpp index 7652c9d9..b6757d30 100644 --- a/DeepSkyStacker/QLinearGradientCtrl.cpp +++ b/DeepSkyStacker/QLinearGradientCtrl.cpp @@ -329,7 +329,7 @@ void QLinearGradientCtrl::drawSelPeg(QPainter & painter, QPoint point, int direc void QLinearGradientCtrl::drawSelPeg(QPainter & painter, int peg) { int drawwidth = getDrawWidth() - 23; - bool vertical = isVertical(); + //bool vertical = isVertical(); painter.save(); // @@ -624,7 +624,7 @@ void QLinearGradientCtrl::mouseDoubleClickEvent(QMouseEvent *event) QPoint point(event->pos()); QRect pegrect; bool edit = false; - int drawwidth = getDrawWidth(); + //int drawwidth = getDrawWidth(); if (isVertical()) pos = posFromPoint(point.y()); @@ -950,7 +950,7 @@ int QLinearGradientCtrl::setSelected(int iSel) return lastSelectedPeg; } -int QLinearGradientCtrl::moveSelected(qreal newpos, bool bUpdate) +int QLinearGradientCtrl::moveSelected(qreal newpos, bool) { if (selectedPeg < 0) return -1; @@ -974,7 +974,7 @@ int QLinearGradientCtrl::moveSelected(qreal newpos, bool bUpdate) return selectedPeg; } -QColor QLinearGradientCtrl::setSelectedPegColour(QColor newColour, bool bUpdate) +QColor QLinearGradientCtrl::setSelectedPegColour(QColor newColour, bool) { QColor result(Qt::black); if (selectedPeg < 0) @@ -992,7 +992,7 @@ QColor QLinearGradientCtrl::setSelectedPegColour(QColor newColour, bool bUpdate) return result; } -void QLinearGradientCtrl::setShowToolTips(bool bShow) +void QLinearGradientCtrl::setShowToolTips(bool) { //m_bShowToolTip = bShow; //if (m_Impl->m_ToolTipCtrl.GetSafeHwnd() != nullptr) @@ -1141,9 +1141,9 @@ void QLinearGradientCtrl::getPegRect(int index, QRect *rect, bool right) return; } - auto position = stops[index].first; - int p = pointFromPos(position); - int indent = getPegIndent(index) * 11; + // auto position = stops[index].first; + // int p = pointFromPos(position); + // int indent = getPegIndent(index) * 11; QRegion region{ getPegPoly(index) }; *rect = region.boundingRect(); @@ -1236,8 +1236,8 @@ QRegion QLinearGradientCtrl::getPegRegion() { QRegion result; QPoint pegpoint; - int drawwidth = getDrawWidth(); - bool vertical = isVertical(); + // int drawwidth = getDrawWidth(); + // bool vertical = isVertical(); int colcount = (int)m_LeftDownSide + (int)m_RightUpSide; if (colcount == 0) diff --git a/DeepSkyStacker/RAWUtils.cpp b/DeepSkyStacker/RAWUtils.cpp index f4f95306..ec92c87c 100644 --- a/DeepSkyStacker/RAWUtils.cpp +++ b/DeepSkyStacker/RAWUtils.cpp @@ -123,25 +123,17 @@ bool IsRawBayer() bool IsRawBilinear() { - Workspace workspace; - QString strInterpolation; - - strInterpolation = workspace.value("RawDDP/Interpolation", "").toString(); - + const QString strInterpolation = Workspace{}.value("RawDDP/Interpolation", {}).toString(); return strInterpolation.isEmpty() || (strInterpolation == "Bilinear"); -}; +} /* ------------------------------------------------------------------- */ bool IsRawAHD() { - Workspace workspace; - QString strInterpolation; - - workspace.value("RawDDP/Interpolation", strInterpolation); - + const QString strInterpolation = Workspace{}.value("RawDDP/Interpolation", {}).toString(); return (strInterpolation.isEmpty() || (strInterpolation == "AHD")); -}; +} /* ------------------------------------------------------------------- */ @@ -312,7 +304,7 @@ namespace { // Only use in this .cpp file }; bool IsRawFile() const; - bool LoadRawFile(CMemoryBitmap* pBitmap, ProgressBase* pProgress = nullptr, bool bThumb = false); + bool LoadRawFile(CMemoryBitmap* pBitmap, ProgressBase* pProgress = nullptr); bool GetModel(CString& strModel) { @@ -469,7 +461,7 @@ namespace { // Only use in this .cpp file if (false == result) { CString errorMessage; - errorMessage.Format(IDS_CAMERA_NOT_SUPPORTED, strModel); + errorMessage.Format(IDS_CAMERA_NOT_SUPPORTED, (LPCTSTR)strModel); #if defined(_CONSOLE) std::wcerr << errorMessage; #else @@ -482,7 +474,7 @@ namespace { // Only use in this .cpp file /* ------------------------------------------------------------------- */ - bool CRawDecod::LoadRawFile(CMemoryBitmap* pBitmap, ProgressBase* pProgress, bool bThumb) + bool CRawDecod::LoadRawFile(CMemoryBitmap* pBitmap, ProgressBase* pProgress) { ZFUNCTRACE_RUNTIME(); @@ -509,7 +501,7 @@ namespace { // Only use in this .cpp file pBitmap->SetDescription(strDescription); - const int maxargs = 50; + // const int maxargs = 50; Workspace workspace; double fBrightness = 1.0; double fRedScale = 1.0; @@ -578,7 +570,7 @@ namespace { // Only use in this .cpp file if ((ret = rawProcessor.unpack()) != LIBRAW_SUCCESS) { bResult = false; - ZTRACE_RUNTIME("Cannot unpack %s: %s", m_strFileName, libraw_strerror(ret)); + ZTRACE_RUNTIME("Cannot unpack %s: %s", (LPCSTR)CT2CA(m_strFileName), libraw_strerror(ret)); } if (!bResult) break; @@ -837,7 +829,7 @@ namespace { // Only use in this .cpp file // than the saturation level). // - const double dmax = *std::max_element(&pre_mul[0], &pre_mul[4]); + // const double dmax = *std::max_element(&pre_mul[0], &pre_mul[4]); const double dmin = *std::min_element(&pre_mul[0], &pre_mul[4]); float scale_mul[4]; @@ -894,7 +886,7 @@ namespace { // Only use in this .cpp file // if (LIBRAW_SUCCESS != (ret = rawProcessor.dcraw_process())) { - ZTRACE_RUNTIME("Cannot do postprocessing on %s: %s", m_strFileName, libraw_strerror(ret)); + ZTRACE_RUNTIME("Cannot do postprocessing on %s: %s", (LPCSTR)CT2CA(m_strFileName), libraw_strerror(ret)); if (LIBRAW_FATAL_ERROR(ret)) bResult = false; } @@ -1079,7 +1071,7 @@ bool LoadRAWPicture(LPCTSTR szFileName, std::shared_ptr& rpBitmap } \ }while(0) -int DSSLibRaw::dcraw_ppm_tiff_writer(const char *filename) +int DSSLibRaw::dcraw_ppm_tiff_writer(const char*) { ZFUNCTRACE_RUNTIME(); CHECK_ORDER_LOW(LIBRAW_PROGRESS_LOAD_RAW); diff --git a/DeepSkyStacker/RGBTab.cpp b/DeepSkyStacker/RGBTab.cpp index 122cbcfb..440e6522 100644 --- a/DeepSkyStacker/RGBTab.cpp +++ b/DeepSkyStacker/RGBTab.cpp @@ -112,7 +112,7 @@ BOOL CRGBTab::OnSetActive() m_Settings.SetTooltipText(IDS_MANAGESETTINGS); m_bFirstActivation = false; - }; + } return CChildPropertyPage::OnSetActive(); } @@ -126,11 +126,11 @@ void CRGBTab::OnReset() /* ------------------------------------------------------------------- */ -void CRGBTab::OnNotifyRedChangeSelPeg(NMHDR * pNotifyStruct, LRESULT *result) +void CRGBTab::OnNotifyRedChangeSelPeg(NMHDR *, LRESULT *) { -}; +} -void CRGBTab::OnNotifyRedPegMove(NMHDR * pNotifyStruct, LRESULT *result) +void CRGBTab::OnNotifyRedPegMove(NMHDR * pNotifyStruct, LRESULT *) { if (m_LinkSettings.GetCheck()) { @@ -149,20 +149,20 @@ void CRGBTab::OnNotifyRedPegMove(NMHDR * pNotifyStruct, LRESULT *result) CGradient & BlueGradient = m_BlueGradient.GetGradient(); BlueGradient.SetPeg(BlueGradient.IndexFromId(nID), Position); m_BlueGradient.Invalidate(true); - }; + } GetParentProcessingDlg(this)->UpdateBezierCurve(); -}; +} void CRGBTab::OnNotifyRedPegMoved(NMHDR * pNotifyStruct, LRESULT *result) { OnNotifyRedPegMove(pNotifyStruct, result); -}; +} -void CRGBTab::OnNotifyGreenChangeSelPeg(NMHDR * pNotifyStruct, LRESULT *result) +void CRGBTab::OnNotifyGreenChangeSelPeg(NMHDR *, LRESULT *) { -}; +} -void CRGBTab::OnNotifyGreenPegMove(NMHDR * pNotifyStruct, LRESULT *result) +void CRGBTab::OnNotifyGreenPegMove(NMHDR * pNotifyStruct, LRESULT *) { if (m_LinkSettings.GetCheck()) { @@ -181,21 +181,21 @@ void CRGBTab::OnNotifyGreenPegMove(NMHDR * pNotifyStruct, LRESULT *result) CGradient & BlueGradient = m_BlueGradient.GetGradient(); BlueGradient.SetPeg(BlueGradient.IndexFromId(nID), Position); m_BlueGradient.Invalidate(true); - }; + } GetParentProcessingDlg(this)->UpdateBezierCurve(); -}; +} void CRGBTab::OnNotifyGreenPegMoved(NMHDR * pNotifyStruct, LRESULT *result) { OnNotifyGreenPegMove(pNotifyStruct, result); -}; +} -void CRGBTab::OnNotifyBlueChangeSelPeg(NMHDR * pNotifyStruct, LRESULT *result) +void CRGBTab::OnNotifyBlueChangeSelPeg(NMHDR *, LRESULT *) { -}; +} -void CRGBTab::OnNotifyBluePegMove(NMHDR * pNotifyStruct, LRESULT *result) +void CRGBTab::OnNotifyBluePegMove(NMHDR * pNotifyStruct, LRESULT *) { if (m_LinkSettings.GetCheck()) { @@ -214,15 +214,15 @@ void CRGBTab::OnNotifyBluePegMove(NMHDR * pNotifyStruct, LRESULT *result) CGradient & GreenGradient = m_GreenGradient.GetGradient(); GreenGradient.SetPeg(GreenGradient.IndexFromId(nID), Position); m_GreenGradient.Invalidate(true); - }; + } GetParentProcessingDlg(this)->UpdateBezierCurve(); -}; +} void CRGBTab::OnNotifyBluePegMoved(NMHDR * pNotifyStruct, LRESULT *result) { OnNotifyBluePegMove(pNotifyStruct, result); -}; +} /* ------------------------------------------------------------------- */ @@ -280,7 +280,7 @@ static void PopulateHistoAdjustMenu(CMenu & menu) HistoAdjustTypeText(HAT_ASINH, strText); menu.AppendMenu(MF_STRING, HAT_ASINH, strText); -}; +} void CRGBTab::OnRedHat() { @@ -302,9 +302,9 @@ void CRGBTab::OnRedHat() { SetGreenAdjustMethod(hat); SetBlueAdjustMethod(hat); - }; + } GetParentProcessingDlg(this)->UpdateBezierCurve(); - }; + } } /* ------------------------------------------------------------------- */ @@ -329,9 +329,9 @@ void CRGBTab::OnGreenHat() { SetRedAdjustMethod(hat); SetBlueAdjustMethod(hat); - }; + } GetParentProcessingDlg(this)->UpdateBezierCurve(); - }; + } } /* ------------------------------------------------------------------- */ @@ -356,10 +356,10 @@ void CRGBTab::OnBlueHat() { SetRedAdjustMethod(hat); SetGreenAdjustMethod(hat); - }; + } GetParentProcessingDlg(this)->UpdateBezierCurve(); - }; + } } /* ------------------------------------------------------------------- */ diff --git a/DeepSkyStacker/RecommendedSettings.h b/DeepSkyStacker/RecommendedSettings.h index 8e8c2426..3e3cb4f7 100644 --- a/DeepSkyStacker/RecommendedSettings.h +++ b/DeepSkyStacker/RecommendedSettings.h @@ -133,9 +133,9 @@ typedef QDialog explicit RecommendedSettings(QWidget *parent = nullptr); ~RecommendedSettings(); - inline void setStackingTasks(CAllStackingTasks * stackingTasks) noexcept + inline void setStackingTasks(CAllStackingTasks * tasks) noexcept { - pStackingTasks = stackingTasks; + pStackingTasks = tasks; }; diff --git a/DeepSkyStacker/RegisterEngine.cpp b/DeepSkyStacker/RegisterEngine.cpp index 034e891e..f7e08485 100644 --- a/DeepSkyStacker/RegisterEngine.cpp +++ b/DeepSkyStacker/RegisterEngine.cpp @@ -198,7 +198,6 @@ bool CRegisteredFrame::FindStarShape(CMemoryBitmap* pBitmap, CStar& star) bool CRegisteredFrame::ComputeStarCenter(CMemoryBitmap* pBitmap, double& fX, double& fY, double& fRadius) { - bool bResult = false; int i, j; double fSumX = 0, fSumY = 0; @@ -395,7 +394,7 @@ size_t CRegisteredFrame::RegisterSubRect(CMemoryBitmap* pBitmap, const DSSRect& bool bBrighterPixel = false; bool bMainOk = true; int lMaxRadius = 0; - int lNrBrighterPixels = 0; + // int lNrBrighterPixels = 0; for (int testedRadius = 1; testedRadius < STARMAXSIZE && bMainOk && !bBrighterPixel; ++testedRadius) { @@ -873,7 +872,7 @@ void CLightFrameInfo::RegisterPicture(CGrayBitmap& Bitmap) // Try to find star by studying the variation of luminosity int lSubRectWidth; int lSubRectHeight; - int lProgress = 0; + // int lProgress = 0; // First computed median value m_fBackground = ComputeMedianValue(Bitmap); @@ -1416,8 +1415,11 @@ bool CRegisterEngine::RegisterLightFrames(CAllStackingTasks& tasks, bool bForce, nrRegisteredPictures += it->m_pLightTask == nullptr ? 0 : static_cast(it->m_pLightTask->m_vBitmaps.size()); const QString strText = QCoreApplication::translate("RegisterEngine", "Registering pictures", "IDS_REGISTERING"); + if (pProgress != nullptr) + { pProgress->Start1(strText, nrRegisteredPictures, true); + } bResult = tasks.DoAllPreTasks(pProgress); @@ -1465,8 +1467,8 @@ bool CRegisterEngine::RegisterLightFrames(CAllStackingTasks& tasks, bool bForce, if (pProgress != nullptr) { - const QString strText = QCoreApplication::translate("RegisterEngine", "Registering %1 of %2", "IDS_REGISTERINGPICTURE").arg(static_cast(j + 1)).arg(nrRegisteredPictures); - pProgress->Progress1(strText, static_cast(j)); + const QString strText1 = QCoreApplication::translate("RegisterEngine", "Registering %1 of %2", "IDS_REGISTERINGPICTURE").arg(static_cast(j + 1)).arg(nrRegisteredPictures); + pProgress->Progress1(strText1, static_cast(j)); } if (!success) diff --git a/DeepSkyStacker/RegisterSettings.cpp b/DeepSkyStacker/RegisterSettings.cpp index 3dbdebe9..79dba514 100644 --- a/DeepSkyStacker/RegisterSettings.cpp +++ b/DeepSkyStacker/RegisterSettings.cpp @@ -82,7 +82,7 @@ void RegisterSettings::onInitDialog() { QSettings settings; QString string; - bool checked = false; + // bool checked = false; // // Restore Window position etc.. @@ -242,7 +242,7 @@ void RegisterSettings::on_percentStack_textEdited(const QString &text) void RegisterSettings::on_luminanceThreshold_valueChanged(int newValue) { - if (detectionThreshold != newValue) + if (detectionThreshold != static_cast(newValue)) { detectionThreshold = newValue; // Display new value diff --git a/DeepSkyStacker/SettingsDlg.cpp b/DeepSkyStacker/SettingsDlg.cpp index 4089ba4e..1763dac1 100644 --- a/DeepSkyStacker/SettingsDlg.cpp +++ b/DeepSkyStacker/SettingsDlg.cpp @@ -108,7 +108,7 @@ void CSettingsDlg::OnDelete() m_List.GetText(lCurSel, strSettings); - strText.Format(IDS_ASK_DELETESETTINGS, strSettings); + strText.Format(IDS_ASK_DELETESETTINGS, strSettings.GetString()); if (AfxMessageBox(strText, MB_YESNO | MB_DEFBUTTON2, 0)== IDYES) { m_pSettings->Remove(lCurSel); diff --git a/DeepSkyStacker/StackedBitmap.cpp b/DeepSkyStacker/StackedBitmap.cpp index 2f577d10..e4f4f6bd 100644 --- a/DeepSkyStacker/StackedBitmap.cpp +++ b/DeepSkyStacker/StackedBitmap.cpp @@ -795,12 +795,11 @@ void CStackedBitmap::WriteSpecificTags(CTIFFWriter * tiffWriter, bool bApplySett /* ------------------------------------------------------------------- */ -void CStackedBitmap::WriteSpecificTags(CFITSWriter * fitsWriter, bool bApplySettings) +void CStackedBitmap::WriteSpecificTags(CFITSWriter* fitsWriter, bool) { if (fitsWriter) - { - }; -}; + {} +} /* ------------------------------------------------------------------- */ /* ------------------------------------------------------------------- */ @@ -911,8 +910,6 @@ bool CTIFFWriterStacker::OnOpen() void CTIFFWriterStacker::OnWrite(int lX, int lY, double & fRed, double & fGreen, double & fBlue) { - bool bResult = true; - lX += m_lXStart; lY += m_lYStart; @@ -1262,8 +1259,6 @@ bool CTIFFReadStacker::OnOpen() void CTIFFReadStacker::OnRead(int lX, int lY, double fRed, double fGreen, double fBlue) { - bool bResult = true; - if (m_pStackedBitmap) m_pStackedBitmap->SetPixel(lX, lY, fRed, fGreen, fBlue); diff --git a/DeepSkyStacker/StackingDlg.cpp b/DeepSkyStacker/StackingDlg.cpp index 6f4b2cd0..7ca419de 100644 --- a/DeepSkyStacker/StackingDlg.cpp +++ b/DeepSkyStacker/StackingDlg.cpp @@ -135,7 +135,7 @@ namespace DSS QString IconSizeDelegate::calculateElidedText(const ::QString& text, const QTextOption& textOption, const QFont& font, const QRect& textRect, const Qt::Alignment valign, - Qt::TextElideMode textElideMode, int flags, + Qt::TextElideMode textElideMode, [[maybe_unused]] int flags, bool lastVisibleLineShouldBeElided, QPointF* paintStartPosition) const { QTextLayout textLayout(text, font); @@ -183,15 +183,15 @@ namespace DSS elideLastVisibleLine = true; } - QString text = textLayout.text().mid(start, length); + QString text1 = textLayout.text().mid(start, length); if (drawElided || elideLastVisibleLine) { if (elideLastVisibleLine) { - if (text.endsWith(QChar::LineSeparator)) - text.chop(1); - text += QChar(0x2026); + if (text1.endsWith(QChar::LineSeparator)) + text1.chop(1); + text1 += QChar(0x2026); } QFontMetrics fontMetrics(font); - ret += fontMetrics.elidedText(text, textElideMode, textRect.width()); + ret += fontMetrics.elidedText(text1, textElideMode, textRect.width()); // no newline for the last line (last visible or real) // sometimes drawElided is true but no eliding is done so the text ends @@ -202,7 +202,7 @@ namespace DSS ret += QChar::LineSeparator; } else { - ret += text; + ret += text1; } // below visible text, can stop @@ -235,7 +235,7 @@ namespace DSS // QStyleOptionButton checkBoxStyle; //constexpr int size = 17; - constexpr int space = 6; + //constexpr int space = 6; checkBoxStyle.rect = checkRect; checkBoxStyle.state = (Qt::Checked == opt.checkState) ? QStyle::State_On : QStyle::State_Off; @@ -383,8 +383,8 @@ namespace DSS QString value{ index.model()->data(index, Qt::EditRole).toString() }; combo = qobject_cast(editor); Q_ASSERT(combo); - if (int index = combo->findText(value)) - combo->setCurrentIndex(index); + if (int idx = combo->findText(value)) + combo->setCurrentIndex(idx); else combo->setCurrentText(value); } @@ -793,12 +793,11 @@ namespace DSS ndx = proxyModel->mapToSource(ndx); ImageListModel* imageModel = frameList.currentTableModel(); - int row = ndx.row(); bool indexValid = ndx.isValid(); if (indexValid) { - if (imageModel->mydata[row].m_bUseAsStarting) + if (imageModel->mydata[ndx.row()].m_bUseAsStarting) markAsReference->setChecked(true); else markAsReference->setChecked(false); @@ -1112,8 +1111,7 @@ namespace DSS } - void StackingDlg::tableViewModel_dataChanged(const QModelIndex& first, - [[maybe_unused]] const QModelIndex& last, [[maybe_unused]] const QList&) + void StackingDlg::tableViewModel_dataChanged(const QModelIndex& first, const QModelIndex&, const QList&) { // // Only interested if the user has ticked the check box in column 0 @@ -1278,7 +1276,7 @@ namespace DSS editStarsPtr->setBitmap(nullptr); } } - catch ([[maybe_unused]] ZAccessError& ze) + catch (ZAccessError&) { QApplication::beep(); QMessageBox::warning(this, @@ -1663,7 +1661,7 @@ namespace DSS if (mruPath.paths.size()) { openAnother = false; - QMenu menu(this); + QMenu filelistMenu(this); for (uint32_t i = 0; i < mruPath.paths.size(); i++) { @@ -1674,14 +1672,14 @@ namespace DSS QString name{ QString::fromStdU16String(display.generic_u16string()) }; - QAction* action = menu.addAction(name); + QAction* action = filelistMenu.addAction(name); action->setData(i); // Index into the list of files }; - menu.addSeparator(); - QAction* loadAnother = menu.addAction(tr("Open another File List...", "ID_FILELIST_OPENANOTHERFILELIST")); + filelistMenu.addSeparator(); + QAction* loadAnother = filelistMenu.addAction(tr("Open another File List...", "ID_FILELIST_OPENANOTHERFILELIST")); - QAction* a = menu.exec(pt); + QAction* a = filelistMenu.exec(pt); if (a) { if (loadAnother == a) @@ -1713,7 +1711,7 @@ namespace DSS raise(); show(); } - void StackingDlg::loadList(MRUPath& MRUList, QString& strFileList) + void StackingDlg::loadList(MRUPath& MRUList, [[maybe_unused]] QString& strFileList) { ZFUNCTRACE_RUNTIME(); QSettings settings; @@ -1733,7 +1731,7 @@ namespace DSS fileDialog.setDefaultSuffix(extension); fileDialog.setFileMode(QFileDialog::ExistingFiles); fileDialog.setNameFilters(OUTPUTLIST_FILTERS); - fileDialog.selectNameFilter(OUTPUTLIST_FILTERS[0]); + fileDialog.selectNameFilter(OUTPUTLIST_FILTERS[filterIndex]); fileDialog.setDirectory(directory); ZTRACE_RUNTIME("About to show file open dlg"); @@ -1777,7 +1775,7 @@ namespace DSS /* ------------------------------------------------------------------- */ - void StackingDlg::saveList(MRUPath& MRUList, QString& strFileList) + void StackingDlg::saveList(MRUPath& MRUList, [[maybe_unused]] QString& strFileList) { ZFUNCTRACE_RUNTIME(); QSettings settings; @@ -1798,7 +1796,7 @@ namespace DSS fileDialog.setFileMode(QFileDialog::AnyFile); fileDialog.setAcceptMode(QFileDialog::AcceptSave); fileDialog.setNameFilters(OUTPUTLIST_FILTERS); - fileDialog.selectNameFilter(OUTPUTLIST_FILTERS[0]); + fileDialog.selectNameFilter(OUTPUTLIST_FILTERS[filterIndex]); fileDialog.setDirectory(directory); ZTRACE_RUNTIME("About to show file save dlg"); @@ -1913,7 +1911,7 @@ namespace DSS const auto start{ std::chrono::steady_clock::now() }; - bool bFound = false; + //bool bFound = false; if (frameList.checkedImageCount(PICTURETYPE_LIGHTFRAME)) { @@ -2087,7 +2085,7 @@ namespace DSS /* ------------------------------------------------------------------- */ - bool StackingDlg::checkStacking(CAllStackingTasks& tasks) + bool StackingDlg::checkStacking([[maybe_unused]] CAllStackingTasks& tasks) { bool result = false; QString reason; @@ -2365,13 +2363,11 @@ namespace DSS .arg(__LINE__) .arg(e.what()) ); -#if defined(_CONSOLE) - std::cerr << errorMessage.toUtf8().constData(); -#else - int ret = QMessageBox::warning(this, "DeepSkyStacker", + + QMessageBox::warning(this, "DeepSkyStacker", errorMessage, QMessageBox::Ok); -#endif + } QGuiApplication::restoreOverrideCursor(); }; diff --git a/DeepSkyStacker/StackingDlg.h b/DeepSkyStacker/StackingDlg.h index d6d2f4d6..429efd57 100644 --- a/DeepSkyStacker/StackingDlg.h +++ b/DeepSkyStacker/StackingDlg.h @@ -94,7 +94,7 @@ namespace DSS QString calculateElidedText(const QString& text, const QTextOption& textOption, const QFont& font, const QRect& textRect, const Qt::Alignment valign, - Qt::TextElideMode textElideMode, int flags, + Qt::TextElideMode textElideMode, [[maybe_unused]] int flags, bool lastVisibleLineShouldBeElided, QPointF* paintStartPosition) const; }; @@ -233,7 +233,6 @@ namespace DSS private: PictureList* pictureList; Ui::StackingDlg* ui; - std::unique_ptr workspace; bool initialised; QString m_strShowFile; CGammaTransformation m_GammaTransformation; @@ -293,7 +292,7 @@ namespace DSS bool checkReadOnlyFolders(CAllStackingTasks& tasks); - bool checkStacking(CAllStackingTasks& tasks); + bool checkStacking([[maybe_unused]] CAllStackingTasks& tasks); bool showRecap(CAllStackingTasks& tasks); @@ -311,9 +310,9 @@ namespace DSS void switchGroup(int); - void loadList(MRUPath& MRUList, QString& strFileList); + void loadList(MRUPath& MRUList, [[maybe_unused]] QString& strFileList); - void saveList(MRUPath& MRUList, QString& strFileList); + void saveList(MRUPath& MRUList, [[maybe_unused]] QString& strFileList); void retranslateUi(); }; diff --git a/DeepSkyStacker/StackingEngine.cpp b/DeepSkyStacker/StackingEngine.cpp index 01cc6289..3598d779 100644 --- a/DeepSkyStacker/StackingEngine.cpp +++ b/DeepSkyStacker/StackingEngine.cpp @@ -68,7 +68,7 @@ void CLightFramesStackingInfo::SetReferenceFrame(LPCTSTR szReferenceFrame) lSavedAlignmentTransformation = _ttol((LPCTSTR)strValue); - if (lSavedAlignmentTransformation != dwAlignmentTransformation) + if (lSavedAlignmentTransformation != static_cast(dwAlignmentTransformation)) bEnd = true; } else @@ -268,7 +268,7 @@ void RemoveStars(CMemoryBitmap* pBitmap, CPixelTransform& PixTransform, const ST { const double fWidth = pBitmap->Width(); const double fHeight = pBitmap->Height(); - const bool bMonochrome = pBitmap->IsMonochrome(); + //const bool bMonochrome = pBitmap->IsMonochrome(); //for (int k = 0; k < vStars.size(); k++) for (const auto& star : vStars) @@ -643,7 +643,7 @@ void CStackingEngine::ComputeMissingCometPositions() { CLightFrameInfo* pPreviousComet = nullptr; CLightFrameInfo* pNextComet = nullptr; - ptrdiff_t lPreviousIndex, lNextIndex; + int64_t lPreviousIndex{ 0 }, lNextIndex{ 0 }; for (ptrdiff_t j = i - 1; j >= 0 && pPreviousComet == nullptr; j--) { @@ -1798,7 +1798,8 @@ std::shared_ptr CStackingEngine::CreateMasterLightMultiBitmap(cons /* ------------------------------------------------------------------- */ -bool CStackingEngine::StackLightFrame(std::shared_ptr pInBitmap, CPixelTransform& PixTransform, double fExposure, bool bComet) +template +std::pair CStackingEngine::StackLightFrame(std::shared_ptr pInBitmap, CPixelTransform& PixTransform, double fExposure, bool bComet, T futureForWrite) { ZFUNCTRACE_RUNTIME(); @@ -1820,7 +1821,7 @@ bool CStackingEngine::StackLightFrame(std::shared_ptr pInBitmap, // Start by demosaicing the input bitmap if (m_pProgress != nullptr) { - QString strText(QCoreApplication::translate("StackingEngine", "Interpolating with Adaptive Homogeneity Directed (AHD)", "IDS_AHDDEMOSAICING")); + strText = QCoreApplication::translate("StackingEngine", "Interpolating with Adaptive Homogeneity Directed (AHD)", "IDS_AHDDEMOSAICING"); m_pProgress->Start2(strText, 0); }; AHDDemosaicing(pGrayBitmap, pBitmap, m_pProgress); @@ -1924,7 +1925,7 @@ bool CStackingEngine::StackLightFrame(std::shared_ptr pInBitmap, if (static_cast(StackTask.m_pTempBitmap)) { - int lProgress = 0; + //int lProgress = 0; if (m_pProgress) m_pProgress->Start2(strStart2, lHeight); @@ -2033,7 +2034,13 @@ bool CStackingEngine::StackLightFrame(std::shared_ptr pInBitmap, } else if ((m_pLightTask->m_Method != MBP_ENTROPYAVERAGE) && static_cast(m_pMasterLight) && static_cast(StackTask.m_pTempBitmap)) { - m_pMasterLight->AddBitmap(StackTask.m_pTempBitmap.get(), m_pProgress); + if (futureForWrite.valid()) + futureForWrite.get(); + const auto writeTask = [masterLight = this->m_pMasterLight](std::shared_ptr tempBitmap) -> bool { + return masterLight->AddBitmap(tempBitmap.get(), nullptr); + }; +// m_pMasterLight->AddBitmap(StackTask.m_pTempBitmap.get(), m_pProgress); + futureForWrite = std::async(std::launch::async, writeTask, StackTask.m_pTempBitmap); } if (m_bSaveIntermediate && !m_bCreateCometImage) @@ -2057,7 +2064,7 @@ bool CStackingEngine::StackLightFrame(std::shared_ptr pInBitmap, m_pProgress->End2(); } - return bResult; + return std::make_pair(bResult, std::move(futureForWrite)); } bool CStackingEngine::StackAll(CAllStackingTasks& tasks, std::shared_ptr& rpBitmap) @@ -2169,7 +2176,7 @@ bool CStackingEngine::StackAll(CAllStackingTasks& tasks, std::shared_ptrm_dwTaskID == lFirstTaskID) + if (tasks.m_vStacks[i].m_pLightTask->m_dwTaskID == static_cast(lFirstTaskID)) { bEnd = false; lFirstTaskID = 0; @@ -2219,6 +2226,9 @@ bool CStackingEngine::StackAll(CAllStackingTasks& tasks, std::shared_ptr; + T futureForWriteTempFile{}; + for (size_t i = 0; i < pStackingInfo->m_pLightTask->m_vBitmaps.size() && !bStop; ++i) { auto [pBitmap, bitmapNdx] = futureForRead.get(); @@ -2282,7 +2292,9 @@ bool CStackingEngine::StackAll(CAllStackingTasks& tasks, std::shared_ptrStart2(strText, 0); // Stack - bStop = !StackLightFrame(pBitmap, PixTransform, lightframeInfo.m_fExposure, lightframeInfo.m_bComet); + auto [stackSuccess, f] = StackLightFrame(pBitmap, PixTransform, lightframeInfo.m_fExposure, lightframeInfo.m_bComet, std::move(futureForWriteTempFile)); + futureForWriteTempFile = std::move(f); + bStop = !stackSuccess; m_lNrStacked++; if (m_bCreateCometImage) @@ -2294,6 +2306,8 @@ bool CStackingEngine::StackAll(CAllStackingTasks& tasks, std::shared_ptrIsCanceled(); } } + if (futureForWriteTempFile.valid()) + futureForWriteTempFile.get(); // Wait for last temp file to be written. pStackingInfo->m_pLightTask->m_bDone = true; bEnd = bStop; } @@ -2354,11 +2368,11 @@ bool CStackingEngine::StackAll(CAllStackingTasks& tasks, std::shared_ptrlineNumber(), - text); + text.GetString()); #if defined(_CONSOLE) std::wcerr << errorMessage; #else @@ -2560,8 +2574,6 @@ bool CStackingEngine::GetDefaultOutputFileName(CString & strFileName, LPCTSTR sz if (!strBaseName.GetLength()) { - CString strFileList = szFileList; - if (OutputSettings.m_bAutosave || !strFileList.GetLength()) strBaseName = _T("Autosave"); else @@ -2795,10 +2807,10 @@ void CStackingEngine::WriteDescription(CAllStackingTasks& tasks, LPCTSTR szOutpu strGainText.LoadString(IDS_GAIN); strYesNo.LoadString((CalibrationMode == BCM_RGB) ? IDS_YES : IDS_NO); - strBackgroundCalibration.Format(IDS_RECAP_BACKGROUNDCALIBRATION, strYesNo); + strBackgroundCalibration.Format(IDS_RECAP_BACKGROUNDCALIBRATION, strYesNo.GetString()); strYesNo.LoadString((CalibrationMode == BCM_PERCHANNEL) ? IDS_YES : IDS_NO); - strPerChannelBackgroundCalibration.Format(IDS_RECAP_PERCHANNELBACKGROUNDCALIBRATION, strYesNo); + strPerChannelBackgroundCalibration.Format(IDS_RECAP_PERCHANNELBACKGROUNDCALIBRATION, strYesNo.GetString()); for (i = 0;im_vBitmaps.size(), *pstrISOGainText, strISOGainValue); + strText.Format(IDS_RECAP_STEP, i+1, si.m_pLightTask->m_vBitmaps.size(), pstrISOGainText->GetString(), strISOGainValue.GetString()); fprintf(hFile, "%s", i, (LPCSTR)CT2CA(strText, CP_UTF8)); fprintf(hFile, CT2CA(strExposure, CP_UTF8)); fprintf(hFile, "
"); @@ -2854,7 +2866,7 @@ void CStackingEngine::WriteDescription(CAllStackingTasks& tasks, LPCTSTR szOutpu ExposureToString(si.m_pOffsetTask->m_fExposure, strExposure); GetISOGainStrings(si.m_pOffsetTask, strISOText, strGainText, &pstrISOGainText, &strISOGainValue); - strText.Format(IDS_RECAP_OFFSET, si.m_pOffsetTask->m_vBitmaps.size(), *pstrISOGainText, strISOGainValue, strExposure); + strText.Format(IDS_RECAP_OFFSET, si.m_pOffsetTask->m_vBitmaps.size(), pstrISOGainText->GetString(), strISOGainValue.GetString(), strExposure.GetString()); fprintf(hFile, CT2CA(strText, CP_UTF8)); if (si.m_pOffsetTask->m_vBitmaps.size()>1) @@ -2898,7 +2910,7 @@ void CStackingEngine::WriteDescription(CAllStackingTasks& tasks, LPCTSTR szOutpu ExposureToString(si.m_pDarkTask->m_fExposure, strExposure); GetISOGainStrings(si.m_pDarkTask, strISOText, strGainText, &pstrISOGainText, &strISOGainValue); - strText.Format(IDS_RECAP_DARK, si.m_pDarkTask->m_vBitmaps.size(), *pstrISOGainText, strISOGainValue, strExposure); + strText.Format(IDS_RECAP_DARK, si.m_pDarkTask->m_vBitmaps.size(), pstrISOGainText->GetString(), strISOGainValue.GetString(), strExposure.GetString()); fprintf(hFile, CT2CA(strText, CP_UTF8)); if (si.m_pDarkTask->m_vBitmaps.size()>1) @@ -2957,7 +2969,7 @@ void CStackingEngine::WriteDescription(CAllStackingTasks& tasks, LPCTSTR szOutpu ExposureToString(si.m_pDarkFlatTask->m_fExposure, strExposure); GetISOGainStrings(si.m_pDarkFlatTask, strISOText, strGainText, &pstrISOGainText, &strISOGainValue); - strText.Format(IDS_RECAP_DARKFLAT, si.m_pDarkFlatTask->m_vBitmaps.size(), *pstrISOGainText, strISOGainValue, strExposure); + strText.Format(IDS_RECAP_DARKFLAT, si.m_pDarkFlatTask->m_vBitmaps.size(), pstrISOGainText->GetString(), strISOGainValue.GetString(), strExposure.GetString()); fprintf(hFile, CT2CA(strText, CP_UTF8)); if (si.m_pDarkFlatTask->m_vBitmaps.size()>1) @@ -3001,7 +3013,7 @@ void CStackingEngine::WriteDescription(CAllStackingTasks& tasks, LPCTSTR szOutpu ExposureToString(si.m_pFlatTask->m_fExposure, strExposure); GetISOGainStrings(si.m_pFlatTask, strISOText, strGainText, &pstrISOGainText, &strISOGainValue); - strText.Format(IDS_RECAP_FLAT, si.m_pFlatTask->m_vBitmaps.size(), *pstrISOGainText, strISOGainValue, strExposure); + strText.Format(IDS_RECAP_FLAT, si.m_pFlatTask->m_vBitmaps.size(), pstrISOGainText->GetString(), strISOGainValue.GetString(), strExposure.GetString()); fprintf(hFile, CT2CA(strText, CP_UTF8)); if (si.m_pFlatTask->m_vBitmaps.size()>1) { diff --git a/DeepSkyStacker/StackingEngine.h b/DeepSkyStacker/StackingEngine.h index 60cb94ff..c2ff7e8d 100644 --- a/DeepSkyStacker/StackingEngine.h +++ b/DeepSkyStacker/StackingEngine.h @@ -230,7 +230,8 @@ class CStackingEngine final void ComputeBitmap(); std::shared_ptr CreateMasterLightMultiBitmap(const CMemoryBitmap* pInBitmap, const bool bColor); bool StackAll(CAllStackingTasks & tasks, std::shared_ptr& rpBitmap); - bool StackLightFrame(std::shared_ptr pBitmap, CPixelTransform& PixTransform, double fExposure, bool bComet); + template + std::pair StackLightFrame(std::shared_ptr pBitmap, CPixelTransform& PixTransform, double fExposure, bool bComet, T futureForWrite); bool AdjustEntropyCoverage(); bool AdjustBayerDrizzleCoverage(); bool SaveCalibratedAndRegisteredLightFrame(CMemoryBitmap * pBitmap) const; diff --git a/DeepSkyStacker/StackingParameters.cpp b/DeepSkyStacker/StackingParameters.cpp index 18596527..f896ca9e 100644 --- a/DeepSkyStacker/StackingParameters.cpp +++ b/DeepSkyStacker/StackingParameters.cpp @@ -514,12 +514,13 @@ void StackingParameters::on_iterations_textEdited(const QString &text) void StackingParameters::on_kappa_textEdited(const QString &text) { bool convertedOK{ false }; - double kappa{ 0.0 }; + double temp{ 0.0 }; QLocale locale; - kappa = locale.toDouble(text, &convertedOK); + temp = locale.toDouble(text, &convertedOK); if (convertedOK) { + kappa = temp; switch (type) { case PICTURETYPE_LIGHTFRAME: diff --git a/DeepSkyStacker/StackingTasks.cpp b/DeepSkyStacker/StackingTasks.cpp index 03448754..be6cd276 100644 --- a/DeepSkyStacker/StackingTasks.cpp +++ b/DeepSkyStacker/StackingTasks.cpp @@ -269,8 +269,8 @@ static void BuildMasterFileNames(CTaskInfo *pTaskInfo, TCHAR const *pszType, boo strFileName.Format(_T("%s%s%s_%s%ld"), pszDrive, pszDir, pszType, pszISOGain, lISOGain); - pstrMasterFile->Format(_T("%s.tif"), strFileName); - pstrMasterInfoFile->Format(_T("%s.Description.txt"), strFileName); + pstrMasterFile->Format(_T("%s.tif"), strFileName.GetString()); + pstrMasterInfoFile->Format(_T("%s.Description.txt"), strFileName.GetString()); }; /* ------------------------------------------------------------------- */ @@ -539,7 +539,7 @@ bool CStackingInfo::DoDarkTask(ProgressBase* const pProgress) continue; strText = QCoreApplication::translate("StackingTasks", "Adding Dark frame %1 of %2", "IDS_ADDDARK").arg(static_cast(i)).arg(m_pDarkTask->m_vBitmaps.size()); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); if (pProgress) pProgress->Progress1(strText, static_cast(i)); @@ -553,9 +553,8 @@ bool CStackingInfo::DoDarkTask(ProgressBase* const pProgress) QString strStart2; if (pProgress != nullptr) { - QString strText; strText = QCoreApplication::translate("StackingTasks", "Subtracting Offset Frame", "IDS_SUBSTRACTINGOFFSET"); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); pProgress->Start2(strText, 0); } Subtract(pBitmap, pMasterOffset, pProgress); @@ -646,7 +645,7 @@ bool CStackingInfo::CheckForExistingDarkFlat(CString& strMasterFile) TCHAR szDir[1+_MAX_DIR]; CString strMasterDarkFlat; CString strMasterDarkFlatInfo; - int lExposure = m_pDarkFlatTask->m_fExposure; + //int lExposure = m_pDarkFlatTask->m_fExposure; _tsplitpath(m_pDarkFlatTask->m_vBitmaps[0].filePath.c_str(), szDrive, szDir, nullptr, nullptr); @@ -701,7 +700,7 @@ bool CStackingInfo::DoDarkFlatTask(ProgressBase* const pProgress) std::shared_ptr pMasterOffset; QString strText(QCoreApplication::translate("StackingTasks", "Create Master Dark Flat Frame", "IDS_CREATEMASTERDARKFLAT")); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); if (pProgress) pProgress->Start1(strText, (int)m_pDarkFlatTask->m_vBitmaps.size(), true); @@ -716,7 +715,7 @@ bool CStackingInfo::DoDarkFlatTask(ProgressBase* const pProgress) std::shared_ptr pBitmap; strText = QCoreApplication::translate("StackingTasks", "Adding Dark Flat frame %1 of %2", "IDS_ADDDARKFLAT").arg(static_cast(i)).arg(m_pDarkFlatTask->m_vBitmaps.size()); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); if (pProgress) pProgress->Progress1(strText, static_cast(i)); @@ -731,9 +730,8 @@ bool CStackingInfo::DoDarkFlatTask(ProgressBase* const pProgress) { if (pProgress != nullptr) { - QString strText; strText = QCoreApplication::translate("StackingTasks", "Subtracting Offset Frame", "IDS_SUBSTRACTINGOFFSET"); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); pProgress->Start2(strText, 0); } @@ -1152,7 +1150,7 @@ bool CStackingInfo::DoFlatTask(ProgressBase* const pProgress) continue; strText = QCoreApplication::translate("StackingTasks", "Adding Flat frame %1 of %2", "IDS_ADDFLAT").arg(static_cast(i)).arg(m_pFlatTask->m_vBitmaps.size()); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); if (pProgress) pProgress->Progress1(strText, static_cast(i)); @@ -1163,10 +1161,8 @@ bool CStackingInfo::DoFlatTask(ProgressBase* const pProgress) // Subtract the offset frame from the dark frame if (static_cast(pMasterOffset) && !pBitmap->IsMaster()) { - QString strText; - strText = QCoreApplication::translate("StackingTasks", "Subtracting Offset Frame", "IDS_SUBSTRACTINGOFFSET"); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); if (pProgress != nullptr) pProgress->Start2(strText, 0); @@ -1175,10 +1171,8 @@ bool CStackingInfo::DoFlatTask(ProgressBase* const pProgress) if (static_cast(pMasterDarkFlat) && !pBitmap->IsMaster()) { - QString strText; - strText = QCoreApplication::translate("StackingTasks", "Subtracting Dark Frame", "IDS_SUBSTRACTINGDARK"); - ZTRACE_RUNTIME(strText); + ZTRACE_RUNTIME(strText.toUtf8().constData()); if (pProgress != nullptr) pProgress->Start2(strText, 0); @@ -1758,7 +1752,7 @@ bool CAllStackingTasks::DoDarkTasks(ProgressBase * pProgress) else ZTRACE_RUNTIME("No Master Offset"); - CTaskInfo * pTaskInfo = m_vStacks[i].m_pDarkTask; + // CTaskInfo * pTaskInfo = m_vStacks[i].m_pDarkTask; bResult = m_vStacks[i].DoDarkTask(pProgress); ZTRACE_RUNTIME("--> Output File: %s", (LPCSTR)CT2CA(m_vStacks[i].m_pDarkTask->m_strOutputFile,CP_ACP)); @@ -1791,7 +1785,7 @@ bool CAllStackingTasks::DoDarkFlatTasks(ProgressBase * pProgress) else ZTRACE_RUNTIME("No Master Offset"); - CTaskInfo * pTaskInfo = m_vStacks[i].m_pDarkFlatTask; + // CTaskInfo * pTaskInfo = m_vStacks[i].m_pDarkFlatTask; bResult = m_vStacks[i].DoDarkFlatTask(pProgress); ZTRACE_RUNTIME("--> Output File: %s", (LPCSTR)CT2CA(m_vStacks[i].m_pDarkFlatTask->m_strOutputFile, CP_ACP)); @@ -1836,7 +1830,7 @@ bool CAllStackingTasks::DoFlatTasks(ProgressBase * pProgress) else ZTRACE_RUNTIME("No Master Offset"); - CTaskInfo* pTaskInfo = stack.m_pFlatTask; + // CTaskInfo* pTaskInfo = stack.m_pFlatTask; bResult = stack.DoFlatTask(pProgress); ZTRACE_RUNTIME("--> Output File: %s", (LPCSTR)CT2CA(stack.m_pFlatTask->m_strOutputFile, CP_ACP)); @@ -1916,7 +1910,6 @@ std::int64_t CAllStackingTasks::computeNecessaryDiskSpace(const DSSRect& rcOutpu ulDarkSpace = 0, ulDarkFlatSpace = 0, ulOffsetSpace = 0; - std::int64_t ulNeededSpace = 0; std::int64_t ulPixelSize = 0; ulPixelSize = GetPixelSizeMultiplier(); @@ -2228,9 +2221,9 @@ bool CAllStackingTasks::GetSaveIntermediateCometImages() bool CAllStackingTasks::GetApplyMedianFilterToCometImage() { - Workspace workspace; + //Workspace workspace; - bool value = workspace.value("Stacking/ApplyFilterToCometImages", true).toBool(); + //bool value = workspace.value("Stacking/ApplyFilterToCometImages", true).toBool(); return false; //value; }; diff --git a/DeepSkyStacker/StarMask.cpp b/DeepSkyStacker/StarMask.cpp index ed068543..b12a15dd 100644 --- a/DeepSkyStacker/StarMask.cpp +++ b/DeepSkyStacker/StarMask.cpp @@ -43,8 +43,8 @@ std::shared_ptr CStarMaskEngine::CreateStarMask2(CMemoryBitmap* p if (2 * fRadius >= m_fMinSize && 2 * fRadius <= m_fMaxSize) { - double fFactor1 = 1.0/exp(-0.5); - double fFactor2 = 2*fRadius*fRadius; + //double fFactor1 = 1.0/exp(-0.5); + //double fFactor2 = 2*fRadius*fRadius; fRadius *= m_fPercentIncrease; if (m_fPixelIncrease) diff --git a/DeepSkyStacker/TIFFUtil.cpp b/DeepSkyStacker/TIFFUtil.cpp index 524bb3f0..89618b1d 100644 --- a/DeepSkyStacker/TIFFUtil.cpp +++ b/DeepSkyStacker/TIFFUtil.cpp @@ -696,7 +696,7 @@ bool CTIFFWriter::Write() auto* u32Buff = static_cast(buff); float* floatBuff = static_cast(buff); - int rowProgress = 0; + // int rowProgress = 0; #pragma omp parallel for default(none) for (int row = 0; row < h; row++) @@ -990,11 +990,11 @@ void CTIFFWriteFromMemoryBitmap::OnWrite(int lX, int lY, double & fRed, double & errorMessage.Format( _T("Exception %s thrown from %s Function: %s() Line: %lu\n\n%s"), - name, - fileName, - functionName, + name.GetString(), + fileName.GetString(), + functionName.GetString(), e.locationAtIndex(0)->lineNumber(), - text); + text.GetString()); #if defined(_CONSOLE) std::wcerr << errorMessage; #else @@ -1234,11 +1234,11 @@ void CTIFFReadInMemoryBitmap::OnRead(int lX, int lY, double fRed, double fGreen, errorMessage.Format( _T("Exception %s thrown from %s Function: %s() Line: %lu\n\n%s"), - name, - fileName, - functionName, + name.GetString(), + fileName.GetString(), + functionName.GetString(), e.locationAtIndex(0)->lineNumber(), - text); + text.GetString()); #if defined(_CONSOLE) std::wcerr << errorMessage; #else diff --git a/DeepSkyStacker/TIFFUtil.h b/DeepSkyStacker/TIFFUtil.h index 4d3adda4..5f5e4295 100644 --- a/DeepSkyStacker/TIFFUtil.h +++ b/DeepSkyStacker/TIFFUtil.h @@ -195,7 +195,7 @@ public : // bool getInfo(); virtual bool OnOpen() { return true; }; - virtual void OnRead(int lX, int lY, double fRed, double fGreen, double fBlue) { return;}; + virtual void OnRead(int, int, double, double, double) { return; } virtual bool OnClose() { return true; }; }; diff --git a/DeepSkyStacker/Workspace.cpp b/DeepSkyStacker/Workspace.cpp index cc4d558e..d439cf8f 100644 --- a/DeepSkyStacker/Workspace.cpp +++ b/DeepSkyStacker/Workspace.cpp @@ -331,7 +331,6 @@ void WorkspaceSettings::SaveToFile(FILE * hFile) void WorkspaceSettings::SaveToFile(const fs::path& file) { - const wchar_t* ptr = file.c_str(); if (std::FILE* hFile = #if defined _WINDOWS _wfopen(file.c_str(), L"wt") @@ -452,25 +451,22 @@ void WorkspaceSettings::ResetToDefault() }; }; -/* ------------------------------------------------------------------- */ -/* ------------------------------------------------------------------- */ -Q_GLOBAL_STATIC(QMutex, theLock); -std::shared_ptr g_pSettings; -static std::deque g_WSStack; +namespace { + std::shared_ptr g_pSettings; + std::mutex mutex; + std::deque g_WSStack; +} -/* ------------------------------------------------------------------- */ -Workspace::Workspace() -{ - theLock->lock(); - if (nullptr == g_pSettings) - { +Workspace::Workspace() : pSettings{ g_pSettings } +{ + if (this->pSettings != nullptr) // If g_pSettings was already initialised -> all good and return. + return; + std::unique_lock lock{ mutex }; + if (nullptr == g_pSettings) // After acquiring the lock, we need to check again, if another thread has already initialised g_pSettings. g_pSettings = std::make_shared(); - } - theLock->unlock(); - - pSettings = g_pSettings; + this->pSettings = g_pSettings; } diff --git a/DeepSkyStacker/Workspace.h b/DeepSkyStacker/Workspace.h index 3877fbd6..8a28ffb0 100644 --- a/DeepSkyStacker/Workspace.h +++ b/DeepSkyStacker/Workspace.h @@ -74,7 +74,7 @@ typedef WORKSPACESETTINGVECTOR::iterator WORKSPACESETTINGITERATOR; class Workspace { private: - std::shared_ptr pSettings; + std::shared_ptr pSettings; public: Workspace(); ~Workspace() = default; diff --git a/DeepSkyStacker/avx.cpp b/DeepSkyStacker/avx.cpp index f5ca371b..c7abd8f6 100644 --- a/DeepSkyStacker/avx.cpp +++ b/DeepSkyStacker/avx.cpp @@ -562,10 +562,12 @@ int AvxStacking::backgroundCalibration(const CBackgroundCalibration& backgroundC return backgroundCalibLoop(loop, avxInputSupport, backgroundCalibrationDef.m_liRed, backgroundCalibrationDef.m_liGreen, backgroundCalibrationDef.m_liBlue); } - - return 0; } +#pragma warning( push ) +#pragma warning( disable : 4324 ) // Structure was padded +#pragma warning( disable : 4100 ) // Unreferenced variable + template int AvxStacking::pixelPartitioning() { @@ -630,7 +632,7 @@ int AvxStacking::pixelPartitioning() const auto getColorPointer = [](const std::vector<__m256>& colorPixels, const size_t offset) -> const __m256* { if constexpr (ISRGB) - return &*colorPixels.begin() + offset; + return colorPixels.data() + offset; else return nullptr; }; @@ -847,6 +849,8 @@ int AvxStacking::pixelPartitioning() return 0; } +#pragma warning( pop ) + template inline void AvxStacking::getAvxEntropy(__m256& redEntropy, __m256& greenEntropy, __m256& blueEntropy, const __m256i xIndex, const int row) { diff --git a/DeepSkyStacker/avx_entropy.cpp b/DeepSkyStacker/avx_entropy.cpp index 8cf7a690..4b7b64c2 100644 --- a/DeepSkyStacker/avx_entropy.cpp +++ b/DeepSkyStacker/avx_entropy.cpp @@ -118,6 +118,7 @@ int AvxEntropy::doCalcEntropies(const int squareSize, const int nSquaresX, const const auto calcEntropy = [nSquaresX, nSquaresY, &calcEntropyOfSquare](const T* const pColor, EntropyVectorType& entropyVector) -> void { +#pragma warning (suppress: 4189) const int nrEnabledThreads = CMultitask::GetNrProcessors(); // Returns 1 if multithreading disabled by user, otherwise # HW threads constexpr size_t HistoSize = std::numeric_limits::max() + size_t{ 1 }; std::vector histogram(HistoSize, 0); diff --git a/DeepSkyStacker/avx_filter.cpp b/DeepSkyStacker/avx_filter.cpp index 2fa66cf3..eca1145b 100644 --- a/DeepSkyStacker/avx_filter.cpp +++ b/DeepSkyStacker/avx_filter.cpp @@ -10,10 +10,9 @@ AvxImageFilter::AvxImageFilter(CInternalMedianFilterEngineT* fil } template -AvxImageFilter::AvxImageFilter(CInternalMedianFilterEngineT* filEng) : +AvxImageFilter::AvxImageFilter(CInternalMedianFilterEngineT*) : filterEngine{ nullptr } -{ -} +{} template int AvxImageFilter::filter(const size_t lineStart, const size_t lineEnd) diff --git a/DeepSkyStacker/avx_histogram.cpp b/DeepSkyStacker/avx_histogram.cpp index 89d519d2..d3e11737 100644 --- a/DeepSkyStacker/avx_histogram.cpp +++ b/DeepSkyStacker/avx_histogram.cpp @@ -73,33 +73,35 @@ int AvxHistogram::doCalcHistogram(const size_t lineStart, const size_t lineEnd) { if constexpr (std::is_same::value) // color-double not supported. return 1; - - if (isCFA) - { - avxCfa.init(lineStart, lineEnd); - avxCfa.interpolate(lineStart, lineEnd, 1); - } - - for (size_t row = lineStart, lineNdx = 0; row < lineEnd; ++row, ++lineNdx) + else { - const T* pRedPixels = isCFA ? avxCfa.redCfaLine(lineNdx) : &avxInputSupport.redPixels().at(row * width); - const T* pGreenPixels = isCFA ? avxCfa.greenCfaLine(lineNdx) : &avxInputSupport.greenPixels().at(row * width); - const T* pBluePixels = isCFA ? avxCfa.blueCfaLine(lineNdx) : &avxInputSupport.bluePixels().at(row * width); - - for (size_t counter = 0; counter < nrVectors; ++counter, pRedPixels += vectorLen, pGreenPixels += vectorLen, pBluePixels += vectorLen) + if (isCFA) { - calcHistoOfTwoVectorsEpi32(AvxSupport::read16PackedInt(pRedPixels), redHisto); - calcHistoOfTwoVectorsEpi32(AvxSupport::read16PackedInt(pGreenPixels), greenHisto); - calcHistoOfTwoVectorsEpi32(AvxSupport::read16PackedInt(pBluePixels), blueHisto); + avxCfa.init(lineStart, lineEnd); + avxCfa.interpolate(lineStart, lineEnd, 1); } - for (size_t n = nrVectors * vectorLen; n < width; ++n, ++pRedPixels, ++pGreenPixels, ++pBluePixels) + + for (size_t row = lineStart, lineNdx = 0; row < lineEnd; ++row, ++lineNdx) { - addToHisto(redHisto, *pRedPixels); - addToHisto(greenHisto, *pGreenPixels); - addToHisto(blueHisto, *pBluePixels); + const T* pRedPixels = isCFA ? avxCfa.redCfaLine(lineNdx) : &avxInputSupport.redPixels().at(row * width); + const T* pGreenPixels = isCFA ? avxCfa.greenCfaLine(lineNdx) : &avxInputSupport.greenPixels().at(row * width); + const T* pBluePixels = isCFA ? avxCfa.blueCfaLine(lineNdx) : &avxInputSupport.bluePixels().at(row * width); + + for (size_t counter = 0; counter < nrVectors; ++counter, pRedPixels += vectorLen, pGreenPixels += vectorLen, pBluePixels += vectorLen) + { + calcHistoOfTwoVectorsEpi32(AvxSupport::read16PackedInt(pRedPixels), redHisto); + calcHistoOfTwoVectorsEpi32(AvxSupport::read16PackedInt(pGreenPixels), greenHisto); + calcHistoOfTwoVectorsEpi32(AvxSupport::read16PackedInt(pBluePixels), blueHisto); + } + for (size_t n = nrVectors * vectorLen; n < width; ++n, ++pRedPixels, ++pGreenPixels, ++pBluePixels) + { + addToHisto(redHisto, *pRedPixels); + addToHisto(greenHisto, *pGreenPixels); + addToHisto(blueHisto, *pBluePixels); + } } + return 0; } - return 0; } // Note: diff --git a/DeepSkyStacker/avx_luminance.cpp b/DeepSkyStacker/avx_luminance.cpp index 63cb43b0..3781820f 100644 --- a/DeepSkyStacker/avx_luminance.cpp +++ b/DeepSkyStacker/avx_luminance.cpp @@ -43,7 +43,6 @@ int AvxLuminance::doComputeLuminance(const size_t lineStart, const size_t lineEn AvxSupport avxOutputSupport{ outputBitmap }; const size_t width = inputBitmap.Width(); - const size_t height = inputBitmap.Height(); constexpr size_t vectorLen = 16; const size_t nrVectors = width / vectorLen; diff --git a/DeepSkyStacker/avx_output.cpp b/DeepSkyStacker/avx_output.cpp index bfb0db69..1f031334 100644 --- a/DeepSkyStacker/avx_output.cpp +++ b/DeepSkyStacker/avx_output.cpp @@ -74,6 +74,10 @@ int AvxOutputComposition::processMedianKappaSigma(const int line, std::vector int AvxOutputComposition::doProcessMedianKappaSigma(const int line, std::vector const& lineAddresses) { @@ -311,10 +315,11 @@ int AvxOutputComposition::doProcessMedianKappaSigma(const int line, std::vector< // Rest of line for (int n = nrVectors * 16; n < width; ++n, ++pOut) { - float lowerBound{ 1.0f }; - float upperBound{ static_cast(std::numeric_limits::max()) }; - float my{ 0.0f }; - float median{ 0.0f }; + float lowerBound = 1.0f; + float upperBound = static_cast(std::numeric_limits::max()); + float my = 0.0f; +#pragma warning (suppress: 4189) + float median = 0.0f; if constexpr (Method == MedianKappaSigma) initMedianData(n + colorOffset, 1); // 1 = only 1 pixel. @@ -352,8 +357,8 @@ int AvxOutputComposition::doProcessMedianKappaSigma(const int line, std::vector< my = (N == 0.0f ? 0.0f : (sum / N)); if (N == 0.0f || N == static_cast(nrLightframes)) break; - const float sigma = sqrtf(sumSq / N - my * my); - const float sigmakappa = sigma * static_cast(std::get<0>(parameters)); + const float sig = sqrtf(sumSq / N - my * my); + const float sigmakappa = sig * static_cast(std::get<0>(parameters)); lowerBound = my - sigmakappa; upperBound = my + sigmakappa; } @@ -422,6 +427,7 @@ int AvxOutputComposition::processAutoAdaptiveWeightedAverage(const int line, std return 1; } + template int AvxOutputComposition::doProcessAutoAdaptiveWeightedAverage(const int line, std::vector const& lineAddresses) { @@ -562,3 +568,5 @@ int AvxOutputComposition::doProcessAutoAdaptiveWeightedAverage(const int line, s // Neither gray (1 float) nor color (3 floats). return 1; } + +#pragma warning( pop ) diff --git a/DeepSkyStacker/avx_support.cpp b/DeepSkyStacker/avx_support.cpp index 42e1487e..7942fe95 100644 --- a/DeepSkyStacker/avx_support.cpp +++ b/DeepSkyStacker/avx_support.cpp @@ -44,13 +44,15 @@ bool AvxSupport::isMonochromeBitmapOfType() const if (auto* const p = const_cast(this)->getGrayPtr()) { // Note that Monochrome bitmaps are always topdown -> no extra check required! CF. CGrayBitmap::GetOffset(). - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) return (p->IsFloat() && !p->IsCFA() && p->GetMultiplier() == 256.0); - if constexpr (std::is_same::value) + else if constexpr (std::is_same_v) return (!p->IsCFA() || isMonochromeCfaBitmapOfType()); - return !p->IsCFA(); + else + return !p->IsCFA(); } - return false; + else + return false; } template @@ -193,6 +195,11 @@ void AvxSupport::reportCpuType() else memcpy(brand, "CPU brand not detected", 22); + // + // Also report this on stderr so if we get a SIGILL the information + // will be there along with the exception traceback. + // + std::cerr << "CPU Type: " << brand << std::endl; ZTRACE_RUNTIME("CPU type: %s", brand); } diff --git a/DeepSkyStacker/avx_support.h b/DeepSkyStacker/avx_support.h index 38cbea4f..5af538ee 100644 --- a/DeepSkyStacker/avx_support.h +++ b/DeepSkyStacker/avx_support.h @@ -255,7 +255,7 @@ class AvxSupport _mm256_min_epi32(_mm256_cvttps_epi32(_mm256_loadu_ps(pColor + 8)), _mm256_set1_epi32(0x0000ffff)) }; } - inline static std::tuple<__m256i, __m256i> read16PackedInt(const double* const pColor) + inline static std::tuple<__m256i, __m256i> read16PackedInt(const double*) { throw "read16PackedInt(const double*) is not implemented!"; } diff --git a/DeepSkyStacker/editstars.cpp b/DeepSkyStacker/editstars.cpp index 78a3fa23..d8251c71 100644 --- a/DeepSkyStacker/editstars.cpp +++ b/DeepSkyStacker/editstars.cpp @@ -118,6 +118,10 @@ namespace DSS Delaunay delaunay; triangleSet sTriangles; + // + // ### To Do + // March 2023: Delaunay::Triangulate() does nothing. sTriangles will be empty. + // delaunay.Triangulate(sVertices, sTriangles); triangles.reserve(sTriangles.size()); @@ -208,9 +212,10 @@ namespace DSS }; } - void EditStars::leaveEvent([[maybe_unused]] QEvent* e) + void EditStars::leaveEvent(QEvent*) { - m_ptCursor.setX(-1); m_ptCursor.setY(-1); + m_ptCursor.setX(-1); + m_ptCursor.setY(-1); } void EditStars::mousePressEvent([[maybe_unused]] QMouseEvent* e) @@ -484,12 +489,12 @@ namespace DSS CRegisteredFrame regFrame; DSSRect rcReg{ STARMAXSIZE, STARMAXSIZE, rcCheck.width() - (STARMAXSIZE + 1), rcCheck.height() - (STARMAXSIZE + 1) }; - STARSET stars; + STARSET starsInRect; regFrame.m_fBackground = m_fBackground; - regFrame.RegisterSubRect(&m_GrayBitmap, rcReg, stars); + regFrame.RegisterSubRect(&m_GrayBitmap, rcReg, starsInRect); - vStars.assign(stars.cbegin(), stars.cend()); + vStars.assign(starsInRect.cbegin(), starsInRect.cend()); } void EditStars::drawOnPixmap() @@ -500,7 +505,7 @@ namespace DSS // scaling has to done here. // QRect rcClient{ rect() }; - size_t width = rcClient.width(), height = rcClient.height(); + // size_t width = rcClient.width(), height = rcClient.height(); // // Fill the pixmap with transparency @@ -804,18 +809,18 @@ namespace DSS for (int i = 0; i < vStars.size(); i++) { QRect rc; - CStar& star = vStars[i]; + CStar& theStar = vStars[i]; double fX, fY; - fX = star.m_fX - star.m_fMeanRadius + 0.5 + rcCheck.left(); - fY = star.m_fY - star.m_fMeanRadius + 0.5 + rcCheck.top(); + fX = theStar.m_fX - theStar.m_fMeanRadius + 0.5 + rcCheck.left(); + fY = theStar.m_fY - theStar.m_fMeanRadius + 0.5 + rcCheck.top(); imageView->imageToScreen(fX, fY); rc.setLeft(fX); rc.setTop(fY); - fX = star.m_fX + star.m_fMeanRadius + 0.5 + rcCheck.left(); - fY = star.m_fY + star.m_fMeanRadius + 0.5 + rcCheck.top(); + fX = theStar.m_fX + theStar.m_fMeanRadius + 0.5 + rcCheck.left(); + fY = theStar.m_fY + theStar.m_fMeanRadius + 0.5 + rcCheck.top(); imageView->imageToScreen(fX, fY); rc.setRight(fX); rc.setBottom(fY); @@ -830,8 +835,8 @@ namespace DSS if (rc.width() > 10 && rc.height() > 10) { - fX = star.m_fX + 0.5 + rcCheck.left(); - fY = star.m_fY + 0.5 + rcCheck.top(); + fX = theStar.m_fX + 0.5 + rcCheck.left(); + fY = theStar.m_fY + 0.5 + rcCheck.top(); imageView->imageToScreen(fX, fY); painter.drawLine(QPointF(fX - 5, fY), QPointF(fX + 6, fY)); painter.drawLine(QPointF(fX, fY - 5), QPointF(fX, fY + 6)); @@ -968,7 +973,8 @@ namespace DSS //imageView->update(); } - void EditStars::drawQualityGrid(QPainter& painter, const QRect& rcClient) + //void EditStars::drawQualityGrid(QPainter& painter, const QRect& rcClient) + void EditStars::drawQualityGrid(QPainter&, const QRect&) { #if (0) // Find the first top/left point in the image diff --git a/DeepSkyStacker/editstars.h b/DeepSkyStacker/editstars.h index c8dcb601..c5783566 100644 --- a/DeepSkyStacker/editstars.h +++ b/DeepSkyStacker/editstars.h @@ -213,17 +213,21 @@ namespace DSS for (const auto& votedPair : vVotedPairs) { if constexpr (Refstar) + { if (star == votedPair.m_RefStar) { bResult = true; break; } + } else + { if (star == votedPair.m_TgtStar) { bResult = true; break; } + } } } else diff --git a/DeepSkyStacker/group.cpp b/DeepSkyStacker/group.cpp index 957e44ad..e3d8003e 100644 --- a/DeepSkyStacker/group.cpp +++ b/DeepSkyStacker/group.cpp @@ -68,7 +68,7 @@ size_t Group::size() const noexcept return pictures->rowCount(); } -void Group::addFile(fs::path file, PICTURETYPE PictureType, bool bCheck, [[maybe_unused]] int32_t nItem) +void Group::addFile(fs::path file, PICTURETYPE PictureType, bool bCheck, int) { ZFUNCTRACE_RUNTIME(); diff --git a/DeepSkyStacker/imageview.cpp b/DeepSkyStacker/imageview.cpp index e9685d35..8037c1b6 100644 --- a/DeepSkyStacker/imageview.cpp +++ b/DeepSkyStacker/imageview.cpp @@ -222,7 +222,7 @@ namespace DSS painter.end(); } - void ImageView::paintEvent([[maybe_unused]] QPaintEvent* event) + void ImageView::paintEvent(QPaintEvent*) { QPainter painter(this); @@ -376,8 +376,6 @@ namespace DSS auto pointOfInterest(screenToImage(mouseLocation)); - const qreal width = pPixmap->width(); - const qreal height = pPixmap->height(); const qreal x = pointOfInterest.x(); const qreal y = pointOfInterest.y(); qreal xloc = x - (diameter / (m_scale * m_zoom * extraZoom) / 2.0); diff --git a/DeepSkyStacker/mrulist.cpp b/DeepSkyStacker/mrulist.cpp index c05aaff4..1a8576d2 100644 --- a/DeepSkyStacker/mrulist.cpp +++ b/DeepSkyStacker/mrulist.cpp @@ -50,10 +50,10 @@ void MRUList::readSettings() for (uint32_t i = 0; i < count; i++) { - QString keyName = QString("%1/MRU%2") + QString keyName1 = QString("%1/MRU%2") .arg(baseKeyName).arg(i); - QString value = settings.value(keyName).toString(); + QString value = settings.value(keyName1).toString(); m_vLists.emplace_back(value); }; @@ -75,11 +75,11 @@ void MRUList::saveSettings() settings.setValue(keyName, (uint)m_vLists.size()); for (int i = 0; i < m_vLists.size(); i++) { - QString keyName = QString("%1/MRU%2") + QString keyName1 = QString("%1/MRU%2") .arg(baseKeyName).arg(i); QString value(m_vLists[i]); - settings.setValue(keyName, value); + settings.setValue(keyName1, value); }; }; diff --git a/DeepSkyStacker/qwinwidget.cpp b/DeepSkyStacker/qwinwidget.cpp index 25bcd14a..6b819dbf 100644 --- a/DeepSkyStacker/qwinwidget.cpp +++ b/DeepSkyStacker/qwinwidget.cpp @@ -364,6 +364,7 @@ bool QWinWidget::focusNextPrevChild(bool next) if (!next) { if (!curFocus->isWindow()) { QWidget *nextFocus = curFocus->nextInFocusChain(); +#pragma warning (suppress:4458) QWidget *prevFocus = 0; QWidget *topLevel = 0; while (nextFocus != curFocus) { diff --git a/DeepSkyStackerCL/DeepSkyStackerCL.vcxproj b/DeepSkyStackerCL/DeepSkyStackerCL.vcxproj index 30535eed..fcb010b7 100644 --- a/DeepSkyStackerCL/DeepSkyStackerCL.vcxproj +++ b/DeepSkyStackerCL/DeepSkyStackerCL.vcxproj @@ -70,12 +70,14 @@ $(Platform)\$(Configuration)\ ..\libs\Win64\$(Configuration)Libs;$(VC_LibraryPath_x64);$(WindowsSdk_71A_LibraryPath_x64);$(LibraryPath) $(QTDIR)\include;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); + $(SolutionDir)$(Platform)\$(Configuration)\ $(Platform)\$(Configuration)\ ..\libs\Win64\$(Configuration)Libs;$(VC_LibraryPath_x64);$(WindowsSdk_71A_LibraryPath_x64);$(LibraryPath) $(QTDIR)\include;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); + @@ -88,10 +90,12 @@ MultiThreadedDebugDLL .\GeneratedFiles\$(ConfigurationName);.\GeneratedFiles;C:\Program Files (x86)\Visual Leak Detector\include;.\;..\;..\DeepSkyStacker;../Libraw;..\ZClass;..\tools;..\LibTIFF;..\CFitsIO;..\Zlib;$(Boost_1_80_0);%(AdditionalIncludeDirectories) $(OutDir)$(TargetName).pdb - true stdcpp20 true - /wd4828 %(AdditionalOptions) + /openmp:experimental /wd4828 %(AdditionalOptions) + Level3 + Level4 + false
DSS_COMMANDLINE;%(PreprocessorDefinitions) @@ -104,6 +108,7 @@ MachineX64 gdi32.lib;gdiplus.lib;zlibstat.lib;%(AdditionalDependencies) MSVCRT + Default .\GeneratedFiles\ @@ -128,11 +133,14 @@ _UNICODE;UNICODE;NOMINMAX;LIBRAW_NODLL;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;USE_LIBTIFF_STATIC;%(PreprocessorDefinitions) MultiThreadedDLL $(OutDir)$(TargetName).pdb - true false stdcpp20 true - /wd4828 %(AdditionalOptions) + /openmp:experimental /wd4828 /wd4702 %(AdditionalOptions) + Level3 + Level4 + false + false
DSS_COMMANDLINE;%(PreprocessorDefinitions) @@ -146,6 +154,7 @@ false MachineX64 + Default .\GeneratedFiles\ diff --git a/DeepSkyStackerCL/QtProgressConsole.h b/DeepSkyStackerCL/QtProgressConsole.h index 80da6c4f..8460a398 100644 --- a/DeepSkyStackerCL/QtProgressConsole.h +++ b/DeepSkyStackerCL/QtProgressConsole.h @@ -33,11 +33,11 @@ namespace DSS if(m_total2>0) PrintText(strText, OT_TEXT2); } - virtual void applyProgress1(int lAchieved) override + virtual void applyProgress1([[maybe_unused]] int lAchieved) override { PrintText(GetProgress1Text(), OT_PROGRESS1); } - virtual void applyProgress2(int lAchieved) override + virtual void applyProgress2([[maybe_unused]] int lAchieved) override { PrintText(GetProgress2Text(), OT_PROGRESS2); } @@ -46,8 +46,8 @@ namespace DSS virtual void endProgress2() override {} virtual bool hasBeenCanceled() override { return false; } virtual void closeProgress() { } - virtual bool doWarning(const QString& szText) override { return true; } - virtual void applyProcessorsUsed(int nCount) override {}; + virtual bool doWarning([[maybe_unused]] const QString& szText) override { return true; } + virtual void applyProcessorsUsed([[maybe_unused]] int nCount) override {}; private: void PrintText(const QString& szText, eOutputType type) @@ -105,7 +105,7 @@ namespace DSS } m_out.flush(); } - void PrintFormatted(const QString& szText, eOutputType type) + void PrintFormatted(const QString&, eOutputType) { m_out << "\033[7;0H"; m_out << "\033[036m--------------------------------------------------------------------------------"; diff --git a/DeepSkyStackerLive/DeepSkyStackerLive.cpp b/DeepSkyStackerLive/DeepSkyStackerLive.cpp index acb7af7a..a96f5c83 100644 --- a/DeepSkyStackerLive/DeepSkyStackerLive.cpp +++ b/DeepSkyStackerLive/DeepSkyStackerLive.cpp @@ -103,10 +103,11 @@ bool hasExpired() QTranslator theQtTranslator; QTranslator theAppTranslator; -int WINAPI _tWinMain(HINSTANCE hInstance, // handle to current instance - HINSTANCE hPrevInstance, // handle to previous instance - LPTSTR lpCmdLine, // pointer to command line - int nCmdShow // show state of window +int WINAPI _tWinMain( + [[maybe_unused]] HINSTANCE hInstance, // handle to current instance + [[maybe_unused]] HINSTANCE hPrevInstance, // handle to previous instance + [[maybe_unused]] LPTSTR lpCmdLine, // pointer to command line + [[maybe_unused]] int nCmdShow // show state of window ) { ZFUNCTRACE_RUNTIME(); diff --git a/DeepSkyStackerLive/DeepSkyStackerLive.vcxproj b/DeepSkyStackerLive/DeepSkyStackerLive.vcxproj index 98191012..175dfd16 100644 --- a/DeepSkyStackerLive/DeepSkyStackerLive.vcxproj +++ b/DeepSkyStackerLive/DeepSkyStackerLive.vcxproj @@ -68,12 +68,14 @@ .\$(PlatformTarget)\$(Configuration)\ $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); ..\libs\Win64\$(Configuration)Libs;$(VC_LibraryPath_x64);$(WindowsSdk_71A_LibraryPath_x64);$(LibraryPath) + $(SolutionDir)$(Platform)\$(Configuration)\ .\$(PlatformTarget)\$(Configuration)\ $(QTDIR)\include;$(QTDIR)\include\QtWidgets;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); ..\libs\Win64\$(Configuration)Libs;$(VC_LibraryPath_x64);$(WindowsSdk_71A_LibraryPath_x64);$(LibraryPath) + @@ -86,10 +88,12 @@ _UNICODE;UNICODE;_DEBUG;NOMINMAX;LIBRAW_NODLL;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_LIBTIFF_STATIC;CPJNSMTP_NOSSL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL - true $(OutDir)$(TargetName).pdb stdcpp20 - /wd4828 %(AdditionalOptions) + /openmp:experimental /wd4828 /wd4652 /wd4702 %(AdditionalOptions) + Level3 + false + Level4
_UNICODE;UNICODE;_DEBUG;%(PreprocessorDefinitions) @@ -104,6 +108,7 @@ gdi32.lib;gdiplus.lib;htmlhelp.lib;zlibstat.lib;%(AdditionalDependencies) NotSet MSVCRT + Default @@ -131,11 +136,14 @@ ..\SMTP;..\ZClass;..\tools;..\LibTIFF;..\Libraw;..\CFitsIO;../;..\DeepSkyStacker;..\ChartCtrl;..\zlib;$(Boost_1_80_0);%(AdditionalIncludeDirectories) _UNICODE;UNICODE;NDEBUG;NOMINMAX;LIBRAW_NODLL;WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_LIBTIFF_STATIC;CPJNSMTP_NOSSL;%(PreprocessorDefinitions) MultiThreadedDLL - true false $(OutDir)$(TargetName).pdb stdcpp20 - /wd4828 %(AdditionalOptions) + /openmp:experimental /wd4828 /wd4652 /wd4702 %(AdditionalOptions) + Level3 + true + Level4 + false
_UNICODE;UNICODE;NDEBUG;%(PreprocessorDefinitions) @@ -149,6 +157,7 @@ false MachineX64 + Default false @@ -229,8 +238,14 @@ - - + + Level3 + Level3 + + + Level3 + Level3 + diff --git a/DeepSkyStackerLive/DeepSkyStackerLiveDlg.cpp b/DeepSkyStackerLive/DeepSkyStackerLiveDlg.cpp index 990b4d5d..3f8b7127 100644 --- a/DeepSkyStackerLive/DeepSkyStackerLiveDlg.cpp +++ b/DeepSkyStackerLive/DeepSkyStackerLiveDlg.cpp @@ -47,7 +47,7 @@ END_MESSAGE_MAP() /* ------------------------------------------------------------------- */ -BOOL CDeepSkyStackerLiveDlg::OnEraseBkgnd(CDC * pDC) +BOOL CDeepSkyStackerLiveDlg::OnEraseBkgnd([[maybe_unused]] CDC * pDC) { return 1; }; diff --git a/DeepSkyStackerLive/ImageView.cpp b/DeepSkyStackerLive/ImageView.cpp index aae3f7fb..cea62968 100644 --- a/DeepSkyStackerLive/ImageView.cpp +++ b/DeepSkyStackerLive/ImageView.cpp @@ -138,9 +138,9 @@ void CImageViewTab::OnChangeGamma(NMHDR* pNMHDR, LRESULT* pResult) *pResult = 1; PegNMHDR * pPegNMHDR = (PegNMHDR*)pNMHDR; - double fBlackPoint, - fGrayPoint, - fWhitePoint; + double fBlackPoint { 0.0 }, + fGrayPoint { 0.0 }, + fWhitePoint{ 0.0 }; if ((pPegNMHDR->nmhdr.code == GC_PEGMOVE) || (pPegNMHDR->nmhdr.code == GC_PEGMOVED)) @@ -268,7 +268,7 @@ void CImageViewTab::SetImage(const std::shared_ptr& pBitmap, cons /* ------------------------------------------------------------------- */ -void CImageViewTab::OnFileName(NMHDR* pNMHDR, LRESULT* pResult) +void CImageViewTab::OnFileName([[maybe_unused]] NMHDR* pNMHDR, [[maybe_unused]] LRESULT* pResult) { CLiveSettings LiveSettings; CString strOutputFolder; @@ -317,7 +317,7 @@ void CImageViewTab::OnStackedImageSaved() /* ------------------------------------------------------------------- */ -void CImageViewTab::OnCopyToClipboard(NMHDR* pNMHDR, LRESULT* pResult) +void CImageViewTab::OnCopyToClipboard([[maybe_unused]] NMHDR* pNMHDR, [[maybe_unused]] LRESULT* pResult) { if (m_pWndImage.get()) m_pWndImage->CopyToClipboard(); diff --git a/DeepSkyStackerLive/LiveEngine.cpp b/DeepSkyStackerLive/LiveEngine.cpp index 248ccbd8..71eaaab1 100644 --- a/DeepSkyStackerLive/LiveEngine.cpp +++ b/DeepSkyStackerLive/LiveEngine.cpp @@ -57,7 +57,7 @@ void CLiveEngine::MoveImage(LPCTSTR szFileName) { CString strNewFileName; - strNewFileName.Format(_T("%s\\%s%s"), strSubFolder, szName, szExt); + strNewFileName.Format(_T("%s\\%s%s"), strSubFolder.GetString(), szName, szExt); bResult = MoveFile(szFileName, strNewFileName); }; @@ -65,14 +65,14 @@ void CLiveEngine::MoveImage(LPCTSTR szFileName) { CString strMsg; - strMsg.Format(IDS_FILEMOVED, (LPCTSTR)strFileName, strSubFolder); + strMsg.Format(IDS_FILEMOVED, strFileName.GetString(), strSubFolder.GetString()); PostToLog(QString::fromStdWString(strMsg.GetString()), true, false, false, RGB(128, 0, 0)); } else { CString strMsg; - strMsg.Format(IDS_ERRORMOVINGFILE, (LPCTSTR)strFileName, strSubFolder); + strMsg.Format(IDS_ERRORMOVINGFILE, strFileName.GetString(), strSubFolder.GetString()); PostToLog(QString::fromStdWString(strMsg.GetString()), true, true, false, RGB(255, 0, 0)); }; }; @@ -276,7 +276,7 @@ BOOL CLiveEngine::LoadFile(LPCTSTR szFileName) { QString strText; QString strDescription; - BOOL bOverrideRAW = TRUE; + //BOOL bOverrideRAW = TRUE; bmpInfo.GetDescription(strDescription); if (bmpInfo.m_lNrChannels==3) @@ -1086,7 +1086,7 @@ void CLiveEngine::closeProgress() { PostEndProgress(); } -bool CLiveEngine::doWarning(const QString& szText) +bool CLiveEngine::doWarning([[maybe_unused]] const QString& szText) { return true; } diff --git a/DeepSkyStackerLive/LiveEngine.h b/DeepSkyStackerLive/LiveEngine.h index cd0561d5..39734ab7 100644 --- a/DeepSkyStackerLive/LiveEngine.h +++ b/DeepSkyStackerLive/LiveEngine.h @@ -556,7 +556,7 @@ private : virtual bool hasBeenCanceled() override; virtual void closeProgress() override; virtual bool doWarning(const QString& szText) override; - virtual void applyProcessorsUsed(int nCount) override {}; + virtual void applyProcessorsUsed([[maybe_unused]] int nCount) override {}; private: enum eOutputType diff --git a/DeepSkyStackerLive/MainBoard.cpp b/DeepSkyStackerLive/MainBoard.cpp index 6dc05c42..b282a487 100644 --- a/DeepSkyStackerLive/MainBoard.cpp +++ b/DeepSkyStackerLive/MainBoard.cpp @@ -226,7 +226,7 @@ void CMainBoard::DrawGradientFrameRect(CDC * pDC, LPCTSTR szTitle, const CRect & void CMainBoard::DrawSubFrameRect(CDC * pDC, const CRect & rc) { COLORREF crColor1 = RGB(255, 255, 255); - COLORREF crColor2 = RGB(200, 200, 200); + //COLORREF crColor2 = RGB(200, 200, 200); double fAlpha = 0.8; #ifndef NOGDIPLUS @@ -691,7 +691,7 @@ BOOL CMainBoard::OnEraseBkgnd(CDC* pDC) CBitmap * pOldBitmap; CString strText; CDeepSkyStackerLiveDlg * pDlg = GetDSSLiveDlg(this); - DSSLIVETAB TabID; + DSSLIVETAB TabID{ DLT_NONE }; GetClientRect(&rc); MemDC.CreateCompatibleDC(pDC); @@ -979,7 +979,7 @@ BOOL CMainBoard::ChangeMonitoredFolder() /* ------------------------------------------------------------------- */ -void CMainBoard::OnMonitoredFolder( NMHDR * pNotifyStruct, LRESULT * result ) +void CMainBoard::OnMonitoredFolder([[maybe_unused]] NMHDR * pNotifyStruct, [[maybe_unused]] LRESULT * result ) { ChangeMonitoredFolder(); }; @@ -1132,7 +1132,7 @@ typedef struct DWORD dwItem2; // dwItem2 contains the new PIDL or name of the folder. } SHNOTIFYSTRUCT; -LRESULT CMainBoard::OnFolderChange(WPARAM wParam, LPARAM lParam) +LRESULT CMainBoard::OnFolderChange([[maybe_unused]] WPARAM wParam, [[maybe_unused]] LPARAM lParam) { std::vector vFiles; std::vector vNewFiles; diff --git a/DeepSkyStackerLive/Settings.cpp b/DeepSkyStackerLive/Settings.cpp index edc8f8d5..8ebcd089 100644 --- a/DeepSkyStackerLive/Settings.cpp +++ b/DeepSkyStackerLive/Settings.cpp @@ -430,7 +430,7 @@ void CSettingsTab::UpdateControls() /* ------------------------------------------------------------------- */ -void CSettingsTab::OnWarningFileFolder( NMHDR * pNotifyStruct, LRESULT * result ) +void CSettingsTab::OnWarningFileFolder( NMHDR *, LRESULT *) { BOOL bResult = FALSE; CString strFolder; @@ -456,7 +456,7 @@ void CSettingsTab::OnWarningFileFolder( NMHDR * pNotifyStruct, LRESULT * result /* ------------------------------------------------------------------- */ -void CSettingsTab::OnStackedOutputFolder( NMHDR * pNotifyStruct, LRESULT * result ) +void CSettingsTab::OnStackedOutputFolder( NMHDR *, LRESULT *) { BOOL bResult = FALSE; CString strFolder; @@ -482,7 +482,7 @@ void CSettingsTab::OnStackedOutputFolder( NMHDR * pNotifyStruct, LRESULT * resul /* ------------------------------------------------------------------- */ -void CSettingsTab::OnEmailAddress( NMHDR * pNotifyStruct, LRESULT * result ) +void CSettingsTab::OnEmailAddress( NMHDR *, LRESULT *) { CEmailSettings dlg; diff --git a/DeepSkyStackerTest/AvxHistogramTest.cpp b/DeepSkyStackerTest/AvxHistogramTest.cpp index 2b7c6038..cb238f40 100644 --- a/DeepSkyStackerTest/AvxHistogramTest.cpp +++ b/DeepSkyStackerTest/AvxHistogramTest.cpp @@ -265,7 +265,7 @@ TEST_CASE("AVX Histogram", "[AVX][Histogram]") std::uint32_t i = 0; std::for_each(pGray->m_vPixels.begin(), pGray->m_vPixels.end(), [&i](auto& v) { v = i; i += 65536; }); for (size_t n = 100 * 271; n < 101 * 271; ++n) // One line has constant value 64000. - pGray->m_vPixels[n] = 64000 << 16; + pGray->m_vPixels[n] = static_cast(64000 << 16); REQUIRE(avxHistogram.calcHistogram(0, 200) == 0); REQUIRE(avxHistogram.histogramSuccessful() == true); diff --git a/DeepSkyStackerTest/AvxStackingTest.cpp b/DeepSkyStackerTest/AvxStackingTest.cpp index 44c54747..c426b569 100644 --- a/DeepSkyStackerTest/AvxStackingTest.cpp +++ b/DeepSkyStackerTest/AvxStackingTest.cpp @@ -209,12 +209,14 @@ TEST_CASE("AVX Stacking, transform, no calib", "[AVX][Stacking][transform]") for (int x = 0; x < W; ++x) { const int yn = y + 1; - const int xn = x - 4; + const float xf = x - 3.5f; + const int xn = static_cast(std::floor(xf)); // a0 is -3.5, so 1/2 is added to (x-4), the other half is added to (x-3) - if (yn >= 0 && yn < H && xn >= 0 && xn < W) + if (yn >= 0 && yn <= (H - 1) && xf >= 0 && xf <= (W - 1)) + { expected[yn * W + xn] += 0.5f * pGray->m_vPixels[y * W + x]; - if (yn >= 0 && yn < H && (xn + 1) >= 0 && (xn + 1) < W) expected[yn * W + xn + 1] += 0.5f * pGray->m_vPixels[y * W + x]; + } } REQUIRE(memcmp(expected.data(), pOut->m_vPixels.data(), W * H * sizeof(T)) == 0); } @@ -257,8 +259,11 @@ TEST_CASE("AVX Stacking, transform, no calib", "[AVX][Stacking][transform]") { const float xf = 1.0f - std::abs(xc - xn); const float yf = 1.0f - std::abs(yc - yn); - if (yn >= 0 && yn < H && xn >= 0 && xn < W) + if (xc >= 0 && xc <= (W - 1) && yc >= 0 && yc <= (H - 1) + && xn >= 0 && xn < W && yn >= 0 && yn < H) + { expected[yn * W + xn] += xf * yf * pGray->m_vPixels[y * W + x]; + } }; for (int y = 0; y < H; ++y) for (int x = 0; x < W; ++x) @@ -272,7 +277,6 @@ TEST_CASE("AVX Stacking, transform, no calib", "[AVX][Stacking][transform]") calcFrac(xc, yc, xn, yn + 1, x, y); calcFrac(xc, yc, xn + 1, yn + 1, x, y); } - bool OK = true; for (int i = 0; i < W * H; ++i) { REQUIRE(pOut->m_vPixels[i] == Approx(expected[i]).epsilon(1e-5)); diff --git a/DeepSkyStackerTest/BitMapFillerTest.cpp b/DeepSkyStackerTest/BitMapFillerTest.cpp index 91490aff..aaf6d2c6 100644 --- a/DeepSkyStackerTest/BitMapFillerTest.cpp +++ b/DeepSkyStackerTest/BitMapFillerTest.cpp @@ -79,18 +79,18 @@ TEMPLATE_TEST_CASE("BitmapFiller gray", "[Bitmap][BitmapFiller][gray]", AvxBitma SECTION("2 lines 16 bps and adjust RGGB (this must set the CFA type of the MemoryBitmap") { constexpr size_t W = 17; - auto filler = std::make_unique(pBitmap.get(), nullptr, 2.0, 3.0, 4.0); - filler->setMaxColors(65535); - filler->setWidth(W); - filler->setHeight(2); - filler->SetCFAType(CFATYPE_RGGB); + auto bmFiller = std::make_unique(pBitmap.get(), nullptr, 2.0, 3.0, 4.0); + bmFiller->setMaxColors(65535); + bmFiller->setWidth(W); + bmFiller->setHeight(2); + bmFiller->SetCFAType(CFATYPE_RGGB); std::uint16_t inputData[W * 2] = { 256, 257, 258, 1003, 1075, 2328, 32767, 20000, 5000, 6000, 7000, 9002, 9003, 9004, 10010, 10100, 10101, 8245, 8255, 8256, 8257, 8258, 8259, 8295, 8296, 6928, 6129, 1293, 1294, 1299, 6002, 6001, 6007, 3333 }; be2le(inputData, inputData); pBitmap->Init(W, 2); - filler->Write(inputData, 2, W, 0); - filler->Write(inputData + W, 2, W, 1); + bmFiller->Write(inputData, 2, W, 0); + bmFiller->Write(inputData + W, 2, W, 1); auto* pGray = dynamic_cast*>(pBitmap.get()); WORD data[W * 2]; @@ -109,17 +109,17 @@ TEMPLATE_TEST_CASE("BitmapFiller gray", "[Bitmap][BitmapFiller][gray]", AvxBitma SECTION("2 lines 16 bps with one call fails") { constexpr size_t W = 17; - auto filler = std::make_unique(pBitmap.get(), nullptr, 2.0, 3.0, 4.0); - filler->setMaxColors(65535); - filler->setWidth(W); - filler->setHeight(2); - filler->SetCFAType(CFATYPE_RGGB); + auto bmFiller = std::make_unique(pBitmap.get(), nullptr, 2.0, 3.0, 4.0); + bmFiller->setMaxColors(65535); + bmFiller->setWidth(W); + bmFiller->setHeight(2); + bmFiller->SetCFAType(CFATYPE_RGGB); std::uint16_t inputData[W * 2] = { 256, 257, 258, 1003, 1075, 2328, 32767, 20000, 5000, 6000, 7000, 9002, 9003, 9004, 10010, 10100, 10101, 8245, 8255, 8256, 8257, 8258, 8259, 8295, 8296, 6928, 6129, 1293, 1294, 1299, 6002, 6001, 6007, 3333 }; be2le(inputData, inputData); pBitmap->Init(W, 2); - filler->Write(inputData, 2, 2 * W, 0); + bmFiller->Write(inputData, 2, 2 * W, 0); auto* pGray = dynamic_cast*>(pBitmap.get()); WORD data[W * 2]; @@ -175,16 +175,16 @@ TEMPLATE_TEST_CASE("BitmapFiller gray", "[Bitmap][BitmapFiller][gray]", AvxBitma SECTION("1 line 16 bps adjust green color and limit to maximum") { constexpr size_t W = 17; - auto filler = std::make_unique(pBitmap.get(), nullptr, 2.0, 10.0, 1.0); // Green factor = 10. - filler->setMaxColors(65535); - filler->setWidth(W); - filler->setHeight(1); - filler->SetCFAType(CFATYPE_RGGB); + auto bmFiller = std::make_unique(pBitmap.get(), nullptr, 2.0, 10.0, 1.0); // Green factor = 10. + bmFiller->setMaxColors(65535); + bmFiller->setWidth(W); + bmFiller->setHeight(1); + bmFiller->SetCFAType(CFATYPE_RGGB); std::uint16_t inputData[W] = { 2560, 3249, 29265, 50000, 5, 50002, 6, 7000, 7, 6000, 8, 9000, 9, 10000, 10, 10005, 11 }; // R, G, R, G, ..., R be2le(inputData, inputData); pBitmap->Init(W, 1); - filler->Write(inputData, 2, W, 0); + bmFiller->Write(inputData, 2, W, 0); constexpr WORD MAXIMUM = 65534; // For some strange reason, the old BitMapFiller limited this to MAXWORD - 1 auto* pGray = dynamic_cast*>(pBitmap.get()); WORD data[W] = { 2560 * 2, 3249 * 10, 29265 * 2, MAXIMUM, 5 * 2, MAXIMUM, 6 * 2, MAXIMUM, 7 * 2, 6000 * 10, 8 * 2, MAXIMUM, 9 * 2, MAXIMUM, 10 * 2, MAXIMUM, 11 * 2 }; @@ -308,11 +308,11 @@ TEMPLATE_TEST_CASE("BitmapFiller color", "[Bitmap][BitmapFiller][color]", AvxBit SECTION("Write 1 line 16 bps and adjust colors") { constexpr size_t W = 18; - auto filler = std::make_unique(pBitmap.get(), nullptr, 0.3, 0.24, 1.18); - filler->setGrey(false); - filler->setMaxColors(65535); - filler->setWidth(W); - filler->setHeight(1); + auto bmFiller = std::make_unique(pBitmap.get(), nullptr, 0.3, 0.24, 1.18); + bmFiller->setGrey(false); + bmFiller->setMaxColors(65535); + bmFiller->setWidth(W); + bmFiller->setHeight(1); std::uint16_t inputData[W * 3] = { 1000, 1001, 1002, 255, 256, 257, 243, 244, 245, 2002, 2003, 2004, 16540, 16796, 17052, 11110, 11111, 11112, 9900, 9901, 9902, 24325, 24326, 24327, 6190, 6200, 6210, 750, 760, 770, 8231, 8241, 8251, 9152, 9162, 9172, 10203, 10201, 10202, 36104, 36114, 64000, 9563, 10563, 10163, 2257, 2267, 2277, 10058, 8658, 7758, 85, 58, 63003 }; @@ -320,7 +320,7 @@ TEMPLATE_TEST_CASE("BitmapFiller color", "[Bitmap][BitmapFiller][color]", AvxBit std::uint16_t beData[W * 3]; be2le(beData, inputData); - filler->Write(beData, 3 * 2, W, 0); + bmFiller->Write(beData, 3 * 2, W, 0); auto* pGray = dynamic_cast*>(pBitmap.get()); const WORD* pRed = pGray->m_Red.m_vPixels.data(); @@ -354,23 +354,23 @@ class MyProgress : public ProgressBase int argumentStart2 = -1; std::vector argumentsAchieved2; public: - virtual void applyStart1Text(const QString& strText) override {} - virtual void applyStart2Text(const QString& strText) override { + virtual void applyStart1Text(const QString&) override {} + virtual void applyStart2Text(const QString&) override { ++nrCallsStart2; argumentStart2 = m_total2; } - virtual void applyProgress1(int lAchieved) override {} + virtual void applyProgress1(int) override {} virtual void applyProgress2(int lAchieved) override { ++nrCallsProgress2; argumentsAchieved2.push_back(lAchieved); } - virtual void applyTitleText(const QString& strText) override {} + virtual void applyTitleText(const QString&) override {} virtual void initialise() override {} virtual void endProgress2() override {} virtual bool hasBeenCanceled() override { return false; } virtual void closeProgress() override { } - virtual bool doWarning(const QString& szText) override { return true; } - virtual void applyProcessorsUsed(int nCount) override {}; + virtual bool doWarning(const QString&) override { return true; } + virtual void applyProcessorsUsed(int) override {}; }; TEMPLATE_TEST_CASE("BitmapFiller progress check", "[Bitmap][BitmapFiller][progress]", AvxBitmapFiller, NonAvxBitmapFiller) @@ -396,8 +396,8 @@ TEMPLATE_TEST_CASE("BitmapFiller progress check", "[Bitmap][BitmapFiller][progre for (size_t i = 0; i < H; ++i, pD += 4) filler->Write(pD, 1, 4, i); - REQUIRE(prg.nrCallsStart2 == 1); +// REQUIRE(prg.nrCallsStart2 == 1); REQUIRE(prg.nrCallsProgress2 == 0); // AVX BitmapFiller doesn't make progress callbacks anymore. - REQUIRE(prg.argumentStart2 == H); +// REQUIRE(prg.argumentStart2 == H); } } diff --git a/DeepSkyStackerTest/DeepSkyStackerTest.vcxproj b/DeepSkyStackerTest/DeepSkyStackerTest.vcxproj index 7b14e45e..8e736402 100644 --- a/DeepSkyStackerTest/DeepSkyStackerTest.vcxproj +++ b/DeepSkyStackerTest/DeepSkyStackerTest.vcxproj @@ -65,14 +65,16 @@ true $(QTDIR)\include;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); + false $(QTDIR)\include;$(QTDIR)\include\QtCore;$(VC_IncludePath);$(WindowsSDK_IncludePath); + - Level3 + Level4 true _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true @@ -80,6 +82,9 @@ Use ../zclass;../;$(Boost_1_80_0) /wd4828 %(AdditionalOptions) + Level3 + false + true Console @@ -90,7 +95,7 @@ - Level3 + Level4 true true true @@ -101,6 +106,10 @@ ../zclass;../;$(Boost_1_80_0) true /wd4828 %(AdditionalOptions) + Level3 + false + true + false Console diff --git a/DeepSkyStackerTest/OpenMpTest.cpp b/DeepSkyStackerTest/OpenMpTest.cpp index dcb5c107..211f5dc0 100644 --- a/DeepSkyStackerTest/OpenMpTest.cpp +++ b/DeepSkyStackerTest/OpenMpTest.cpp @@ -181,6 +181,7 @@ TEST_CASE("OpenMP parallelization", "[OpenMP]") pBitmap->Init(3, 2); CopyableSmartPtr filler = std::make_unique(pBitmap.get(), nullptr, 1.0, 1.0, 1.0); filler->setGrey(true); +#pragma warning (suppress: 4189) const bool isThreadSafe = filler->isThreadSafe(); //#pragma omp parallel firstprivate(filler) if(filler->isThreadSafe()) // Visual Studio 2019, V 16.10.4: Access violation here #pragma omp parallel for firstprivate(filler) if(isThreadSafe) @@ -214,12 +215,14 @@ TEST_CASE("OpenMP parallelization", "[OpenMP]") SECTION("Firstprivate with class") { OmpTest tc(3, 2); +#pragma warning (suppress: 4189) const bool isThreadSafe = tc.isThreadSafe(); //#pragma omp parallel for firstprivate(tc) if(tc.isThreadSafe()) // Crashes in VS 2019 V 16.10.4 #pragma omp parallel for firstprivate(tc) if(isThreadSafe) for (int line = 0; line < 2; ++line) { - std::uint8_t data[3] = { 17 + line, 29 + 2 * line, 51 + 3 * line }; + using T = std::uint8_t; + T data[3] = { static_cast(17 + line), static_cast(29 + 2 * line), static_cast(51 + 3 * line) }; REQUIRE(tc.process(line, data) == 3); } } diff --git a/Installers/README.txt b/Installers/README.txt index 975e703f..b4d3e09d 100644 --- a/Installers/README.txt +++ b/Installers/README.txt @@ -5,16 +5,18 @@ Only 64 bit versions of Windows 10 and later are supported in this release. Changes since 5.1.0 -1. Bug fix - active tab jumped back to Main Group after drop of files when another group was active. +1. Possible bug fix - DeepSkyStacker terminated at startup when running on ARM version of Windows 11 in x64 emulation mode. Unable to test. -2. Possible bug fix - DeepSkyStacker terminated at startup when running on ARM version of Windows 11 in x64 emulation mode. Unable to test. +2. Bug fix - A corrupt info.txt file caused an infinite loop. -3. Bug fix - A corrupt info.txt file caused an infinite loop. - -4. Diagnostic added - Report processor architecture in trace file and to stderr at startup. +3. Diagnostic added - Report processor architecture and processor type in trace file and to stderr at startup. 4. Bug fix - Stacked FITS images in SuperPixel mode were displayed only in the top left corner. +5. Bug fix - Resolve occasional odd problems when using edit stars mode. + +6. Bug fix - DeepSkyStackerCL was only displaying the help text regardless of command line input. + Welcome to DeepSkyStacker 5.1.0 =============================== @@ -71,3 +73,4 @@ Here are the main changes that were made for DeepSkyStacker 5.1.0: 18. Update Libraw to 0.21.1 +19. Bug fix - active tab jumped back to Main Group after drop of files when another group was active. diff --git a/README.md b/README.md index 5024035c..cd665762 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ DeepSkyStacker This is the github repository for all the DeepSkyStacker source code. -DeepSkyStacker is a freeware created in 2006 by Luc Coiffier +DeepSkyStacker is freeware created in 2006 by Luc Coiffier It was open sourced in 2018 and is maintained by a small and dedicated team: @@ -12,7 +12,7 @@ It was open sourced in 2018 and is maintained by a small and dedicated team: The code is open source under the terms of the BSD 3-Clause License (see LICENSE). -Copyright (c) 2006-2019, LucCoiffier +Copyright (c) 2006-2019, Luc Coiffier Copyright (c) 2018-2023, David C. Partridge, Tony Cook, Mat Draper, Simon C. Smith, Vitali Pelenjow, Michal Schulz, Martin Toeltsch, Iustin Amihaesei diff --git a/SMTP/PJNSMTP.cpp b/SMTP/PJNSMTP.cpp index df0744fc..cf320428 100644 --- a/SMTP/PJNSMTP.cpp +++ b/SMTP/PJNSMTP.cpp @@ -1389,7 +1389,7 @@ CStringA CPJNSMTPMessage::GetHeader() else { CString sReply; - sReply.Format(_T("Content-Type: %s;\r\n\tcharset=%s\r\n"), m_RootPart.GetContentType(), m_RootPart.GetCharset().operator LPCTSTR()); + sReply.Format(_T("Content-Type: %s;\r\n\tcharset=%s\r\n"), m_RootPart.GetContentType().GetString(), m_RootPart.GetCharset().GetString()); sHeader += sReply; } @@ -2436,7 +2436,7 @@ CString CPJNSMTPConnection::FormMailFromCommand(const CString& sEmailAddress, DW CString sBuf; if (DSN == CPJNSMTPMessage::DSN_NOT_SPECIFIED) - sBuf.Format(_T("MAIL FROM:<%s>\r\n"), sEmailAddress); + sBuf.Format(_T("MAIL FROM:<%s>\r\n"), sEmailAddress.GetString()); else { //Create an envelope ID if one has not been specified @@ -2444,9 +2444,9 @@ CString CPJNSMTPConnection::FormMailFromCommand(const CString& sEmailAddress, DW sENVID = CreateNEWENVID(); if (DSNReturnType == CPJNSMTPMessage::HEADERS_ONLY) - sBuf.Format(_T("MAIL FROM:<%s> RET=HDRS ENVID=%s\r\n"), sEmailAddress, sENVID); + sBuf.Format(_T("MAIL FROM:<%s> RET=HDRS ENVID=%s\r\n"), sEmailAddress.GetString(), sENVID.GetString()); else - sBuf.Format(_T("MAIL FROM:<%s> RET=FULL ENVID=%s\r\n"), sEmailAddress, sENVID); + sBuf.Format(_T("MAIL FROM:<%s> RET=FULL ENVID=%s\r\n"), sEmailAddress.GetString(), sENVID.GetString()); } return sBuf; @@ -2746,7 +2746,7 @@ void CPJNSMTPConnection::SendMessage(const CString& sMessageOnFile, CPJNSMTPAddr } catch(CWSocketException* pEx) { - DWORD dwError = pEx->m_nError; + dwError = pEx->m_nError; pEx->Delete(); ThrowPJNSMTPException(dwError, FACILITY_WIN32); } @@ -2774,7 +2774,7 @@ void CPJNSMTPConnection::SendMessage(const CString& sMessageOnFile, CPJNSMTPAddr } catch(CWSocketException* pEx) { - DWORD dwError = pEx->m_nError; + dwError = pEx->m_nError; pEx->Delete(); ThrowPJNSMTPException(dwError, FACILITY_WIN32); } @@ -2812,7 +2812,7 @@ void CPJNSMTPConnection::SendMessage(const CString& sMessageOnFile, CPJNSMTPAddr } catch(CWSocketException* pEx) { - DWORD dwError = pEx->m_nError; + dwError = pEx->m_nError; pEx->Delete(); ThrowPJNSMTPException(dwError, FACILITY_WIN32); } @@ -2837,7 +2837,7 @@ void CPJNSMTPConnection::SendMessage(const CString& sMessageOnFile, CPJNSMTPAddr } catch(CWSocketException* pEx) { - DWORD dwError = pEx->m_nError; + dwError = pEx->m_nError; pEx->Delete(); ThrowPJNSMTPException(dwError, FACILITY_WIN32); } @@ -2876,10 +2876,10 @@ void CPJNSMTPConnection::SendRCPTForRecipient(DWORD DSN, CPJNSMTPAddress& recipi //form the command to send CString sBuf; if (DSN == CPJNSMTPMessage::DSN_NOT_SPECIFIED) - sBuf.Format(_T("RCPT TO:<%s>\r\n"), recipient.m_sEmailAddress); + sBuf.Format(_T("RCPT TO:<%s>\r\n"), recipient.m_sEmailAddress.GetString()); else { - sBuf.Format(_T("RCPT TO:<%s>\r\n"), recipient.m_sEmailAddress); + sBuf.Format(_T("RCPT TO:<%s>\r\n"), recipient.m_sEmailAddress.GetString()); CString sNotificationTypes; if (DSN & CPJNSMTPMessage::DSN_SUCCESS) @@ -2899,7 +2899,7 @@ void CPJNSMTPConnection::SendRCPTForRecipient(DWORD DSN, CPJNSMTPAddress& recipi if (sNotificationTypes.IsEmpty()) //Not setting DSN_SUCCESS, DSN_FAILURE or DSN_DELAY in m_DSNReturnType implies we do not want DSN's sNotificationTypes += _T("NEVER"); - sBuf.Format(_T("RCPT TO:<%s> NOTIFY=%s\r\n"), recipient.m_sEmailAddress, sNotificationTypes); + sBuf.Format(_T("RCPT TO:<%s> NOTIFY=%s\r\n"), recipient.m_sEmailAddress.GetString(), sNotificationTypes.GetString()); } CT2A szRCPT(sBuf); diff --git a/SMTP/SocMFC.cpp b/SMTP/SocMFC.cpp index 4aeb46d9..7e79ff32 100644 --- a/SMTP/SocMFC.cpp +++ b/SMTP/SocMFC.cpp @@ -465,7 +465,7 @@ void CWSocket::Connect(const SOCKADDR* lpSockAddr, int nSockAddrLen, DWORD dwCon if (nEvents == SOCKET_ERROR) { //Hive away the last error - DWORD dwLastError = GetLastError(); + dwLastError = GetLastError(); //Close the event before we return WSACloseEvent(hConnectedEvent); @@ -831,9 +831,10 @@ void CWSocket::ConnectViaSocks5(LPCTSTR lpszHostAddress, UINT nHostPort, LPCTSTR Send(pUserRequest, static_cast(nUserRequestLength)); //Wait for the login reply +#pragma warning (suppress:4456) WSOCKET_SOCKS5_USERNAME_AUTHENTICATION_REPLY reply; memset(&reply, 0, sizeof(reply)); - int nDataReceived = 0; + nDataReceived = 0; while (nDataReceived < sizeof(reply)) { if (IsReadible(dwConnectionTimeout)) diff --git a/Tools/BitmapSlider.cpp b/Tools/BitmapSlider.cpp index b5b29708..2d5be9aa 100644 --- a/Tools/BitmapSlider.cpp +++ b/Tools/BitmapSlider.cpp @@ -72,7 +72,7 @@ END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CBitmapSlider message handlers -BOOL CBitmapSlider::OnEraseBkgnd(CDC* pDC) +BOOL CBitmapSlider::OnEraseBkgnd([[maybe_unused]] CDC* pDC) { // Do not erase background for the transparency effect return TRUE; @@ -446,7 +446,9 @@ BOOL CBitmapSlider::SetBitmapChannel( // Compare size if( m_bChannelActive ) { +#pragma warning (suppress:4456) BITMAP bitmap; + m_bmChannelActive.GetBitmap( &bitmap ); ASSERT( m_nWidth == bitmap.bmWidth && m_nHeight == bitmap.bmHeight ); @@ -565,7 +567,9 @@ BOOL CBitmapSlider::SetBitmapThumb( // Compare size if( m_bThumbActive ) { +#pragma warning (suppress:4456) BITMAP bitmap; + m_bmThumbActive.GetBitmap( &bitmap ); ASSERT( diff --git a/Tools/BitmapSlider.h b/Tools/BitmapSlider.h index f136cff1..f70e0026 100644 --- a/Tools/BitmapSlider.h +++ b/Tools/BitmapSlider.h @@ -134,7 +134,7 @@ class CBitmapSlider : public CStatic DECLARE_MESSAGE_MAP() private: // This is CStatic method - void SetBitmap( HBITMAP hBitmap ) {}; + void SetBitmap([[maybe_unused]] HBITMAP hBitmap ) {}; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/Tools/BtnST.cpp b/Tools/BtnST.cpp index bcffbe53..fb937dd2 100644 --- a/Tools/BtnST.cpp +++ b/Tools/BtnST.cpp @@ -27,6 +27,7 @@ #ifndef TTS_BALLOON #define TTS_BALLOON 0x40 #endif +#pragma warning (disable:4100) CButtonST::CButtonST() { diff --git a/Tools/ButtonToolbar.cpp b/Tools/ButtonToolbar.cpp index 63f53088..bc56bd37 100644 --- a/Tools/ButtonToolbar.cpp +++ b/Tools/ButtonToolbar.cpp @@ -212,7 +212,7 @@ Image* CButtonToolbar::GetTooltipImage(CRect & rcTooltip) /* ------------------------------------------------------------------- */ -BOOL CButtonToolbar::OnMouseEnter(LONG lX, LONG lY) +BOOL CButtonToolbar::OnMouseEnter([[maybe_unused]] LONG lX, [[maybe_unused]] LONG lY) { BOOL bResult = FALSE; @@ -288,7 +288,7 @@ BOOL CButtonToolbar::OnMouseLeave() BOOL CButtonToolbar::OnLButtonDown(LONG lX, LONG lY) { BOOL bResult = FALSE; - BOOL bFound = FALSE; + // BOOL bFound = FALSE; LONG lIndice; m_bButtonDown = TRUE; @@ -316,7 +316,7 @@ BOOL CButtonToolbar::OnLButtonDown(LONG lX, LONG lY) /* ------------------------------------------------------------------- */ -BOOL CButtonToolbar::OnLButtonUp(LONG lX, LONG lY) +BOOL CButtonToolbar::OnLButtonUp([[maybe_unused]] LONG lX, [[maybe_unused]] LONG lY) { BOOL bResult = FALSE; diff --git a/Tools/ButtonToolbar.h b/Tools/ButtonToolbar.h index 16c57748..a4f454d4 100644 --- a/Tools/ButtonToolbar.h +++ b/Tools/ButtonToolbar.h @@ -115,9 +115,9 @@ public : CButtonToolbarSink() {}; virtual ~CButtonToolbarSink() {}; - virtual void ButtonToolbar_OnCheck(DWORD dwID, CButtonToolbar * pButtonToolbar) {}; - virtual void ButtonToolbar_OnClick(DWORD dwID, CButtonToolbar * pButtonToolbar) {}; - virtual void ButtonToolbar_OnRClick(DWORD dwID, CButtonToolbar * pButtonToolbar) {}; + virtual void ButtonToolbar_OnCheck([[maybe_unused]] DWORD dwID, [[maybe_unused]] CButtonToolbar * pButtonToolbar) {}; + virtual void ButtonToolbar_OnClick([[maybe_unused]] DWORD dwID, [[maybe_unused]] CButtonToolbar * pButtonToolbar) {}; + virtual void ButtonToolbar_OnRClick([[maybe_unused]] DWORD dwID, [[maybe_unused]] CButtonToolbar * pButtonToolbar) {}; }; class CButtonToolbar diff --git a/Tools/CustomTabCtrl.cpp b/Tools/CustomTabCtrl.cpp index c5574ad8..87da5890 100644 --- a/Tools/CustomTabCtrl.cpp +++ b/Tools/CustomTabCtrl.cpp @@ -740,7 +740,9 @@ void CCustomTabCtrl::OnPaint() if(m_nButtonIDDown>=0 && (GetCursor()==m_hCursorMove || GetCursor()==m_hCursorCopy)) { // Draw drag destination marker +#pragma warning (suppress:4456) CPen* pOldPen = dcMem.SelectObject(&blackPen); + int x; if(m_nItemDragDest==m_aItems.GetSize()) x = m_aItems[m_nItemDragDest-1]->m_rectText.right + rCl.Height()/4-3; @@ -760,7 +762,9 @@ void CCustomTabCtrl::OnPaint() } if(IsVertical()) { +#pragma warning (suppress:4456) POINT pts[3]; + if(fRTL) { pts[0].x = -1; diff --git a/Tools/FolderDlg.cpp b/Tools/FolderDlg.cpp index 4e6953c2..c5a85909 100644 --- a/Tools/FolderDlg.cpp +++ b/Tools/FolderDlg.cpp @@ -183,7 +183,7 @@ CString CFolderDlg::GetFolderName() const * @see * SHBrowseForFolder() */ -INT CALLBACK CFolderDlg::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData) +INT CALLBACK CFolderDlg::BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp,[[maybe_unused]] LPARAM pData) { TCHAR szDir[MAX_PATH]; diff --git a/Tools/Gradient.cpp b/Tools/Gradient.cpp index 8267bf28..bb9c8f3c 100644 --- a/Tools/Gradient.cpp +++ b/Tools/Gradient.cpp @@ -82,7 +82,7 @@ int CGradient::AddPeg(CPeg const& peg) } //----- Assorted short functions -----// -void CGradient::RemovePeg(int iIndex) {/*pegs.RemoveAt(iIndex);*/} +void CGradient::RemovePeg([[maybe_unused]] int iIndex) {/*pegs.RemoveAt(iIndex);*/} void CGradient::SortPegs() {std::sort(pegs.begin(), pegs.end());} int CGradient::GetPegCount() const {return (int)pegs.size();} diff --git a/Tools/Label.cpp b/Tools/Label.cpp index 0db0e58d..079db196 100644 --- a/Tools/Label.cpp +++ b/Tools/Label.cpp @@ -403,7 +403,7 @@ void CLabel::OnPaint() Draw(&dc); } -void CLabel::OnMouseMove(UINT nFlags, CPoint pt) +void CLabel::OnMouseMove([[maybe_unused]] UINT nFlags, [[maybe_unused]] CPoint pt) { if (m_bHover) { @@ -1289,7 +1289,7 @@ CLabel& CLabel::SetFont(LOGFONT lf) } -BOOL CLabel::OnEraseBkgnd(CDC* pDC) +BOOL CLabel::OnEraseBkgnd([[maybe_unused]]CDC* pDC) { // TODO: Add your message handler code here and/or call default diff --git a/Tools/ListViewCtrlEx.cpp b/Tools/ListViewCtrlEx.cpp index 91d9cb1d..dc2c362f 100644 --- a/Tools/ListViewCtrlEx.cpp +++ b/Tools/ListViewCtrlEx.cpp @@ -847,7 +847,7 @@ void CLabelTipCtrl::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) } ATLTRACE2( - ListCtrlEx, 1, _T("flags = %s (0x%08X)\n"), strFlags, lpwndpos->flags); + ListCtrlEx, 1, _T("flags = %s (0x%08X)\n"), (LPCTSTR)strFlags, lpwndpos->flags); #endif __super::OnWindowPosChanging(lpwndpos); diff --git a/Tools/RichToolTipCtrl.cpp b/Tools/RichToolTipCtrl.cpp index 73266b17..e3d09a5e 100644 --- a/Tools/RichToolTipCtrl.cpp +++ b/Tools/RichToolTipCtrl.cpp @@ -86,7 +86,7 @@ class _RichToolTipCtrlCookie DWORD _RichToolTipCtrlCookie::Read(LPSTR lpszBuffer, DWORD dwCount) { if (lpszBuffer == nullptr) - return -1; + return static_cast(- 1); // have we already had it all? DWORD dwLeft = m_dwLength - m_dwCount; diff --git a/Tools/RichToolTipCtrl.h b/Tools/RichToolTipCtrl.h index 9758745c..0b2856b6 100644 --- a/Tools/RichToolTipCtrl.h +++ b/Tools/RichToolTipCtrl.h @@ -35,7 +35,7 @@ //////////////////////////////////////////////////////////////////////////// // PLEASE LEAVE THIS HEADER INTACT //////////////////////////////////////////////////////////////////////////// - +#pragma warning (disable:4100) #if !defined(AFX_RICHTOOLTIPCTRL_H__EFAAE1BA_CDFD_4C7B_B778_146FAC4E3309__INCLUDED_) #define AFX_RICHTOOLTIPCTRL_H__EFAAE1BA_CDFD_4C7B_B778_146FAC4E3309__INCLUDED_ diff --git a/Tools/StackWalker.cpp b/Tools/StackWalker.cpp index 04c9f33c..deff724b 100644 --- a/Tools/StackWalker.cpp +++ b/Tools/StackWalker.cpp @@ -1342,6 +1342,8 @@ BOOL __stdcall StackWalker::myReadProcMem(HANDLE hProcess, } } +#pragma warning (push) +#pragma warning (disable:4100) void StackWalker::OnLoadModule(LPCSTR img, LPCSTR mod, DWORD64 baseAddr, @@ -1375,6 +1377,7 @@ void StackWalker::OnLoadModule(LPCSTR img, OnOutput(buffer); #endif } +#pragma warning (pop) void StackWalker::OnCallstackEntry(CallstackEntryType eType, CallstackEntry& entry) { diff --git a/Tools/WndImage.cpp b/Tools/WndImage.cpp index f9e69d8f..37e2d2e3 100644 --- a/Tools/WndImage.cpp +++ b/Tools/WndImage.cpp @@ -139,6 +139,7 @@ END_MESSAGE_MAP() // ================================================================== // OnPaint // ------------------------------------------------------------------ +#pragma warning (disable:4389) static Bitmap * GetBitmap(CRect & rcOut, HBITMAP hBitmap, CRect & rcSrc, CRect & rcDst, BOOL bInterpolate, Bitmap * pInBitmap = nullptr, bool bDarkMode=false) { @@ -701,7 +702,9 @@ void CWndImage::SetImg(HBITMAP bmp, bool shared) if (bmp != 0) { +#pragma warning (push, 3) BITMAP bmp; +#pragma warning (pop) m_bmp.GetBitmap(&bmp); m_bmpSize.cx = bmp.bmWidth; m_bmpSize.cy = bmp.bmHeight; @@ -987,7 +990,7 @@ void CWndImage::OnLButtonDown(UINT nFlags, CPoint point) if (m_pButtonToolbar && m_bmp.m_hObject && !m_4Corners) { CRect rcToolbar; - BOOL bRefresh = FALSE; + // BOOL bRefresh = FALSE; GetToolbarRect(rcToolbar); if (rcToolbar.PtInRect(point)) @@ -1098,12 +1101,12 @@ void CWndImage::OnMouseMove(UINT nFlags, CPoint point) void CWndImage::OnRButtonDown(UINT nFlags, CPoint point) { - BOOL bPass = TRUE; + //BOOL bPass = TRUE; if (m_pButtonToolbar && m_bmp.m_hObject && !m_4Corners) { CRect rcToolbar; - BOOL bRefresh = FALSE; + // BOOL bRefresh = FALSE; GetToolbarRect(rcToolbar); if (rcToolbar.PtInRect(point)) @@ -1241,7 +1244,7 @@ void CWndImage::ReleaseZoom() // ------------------------------------------------------------------ -void CWndImage::OnTimer(UINT_PTR nIDEvent) +void CWndImage::OnTimer([[maybe_unused]] UINT_PTR nIDEvent) { CRect rcWindow; CPoint ptMouse; @@ -1270,7 +1273,7 @@ void CWndImage::OnTimer(UINT_PTR nIDEvent) // ------------------------------------------------------------------ -void CWndImage::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +void CWndImage::OnKeyDown(UINT nChar, [[maybe_unused]] UINT nRepCnt, [[maybe_unused]] UINT nFlags) { POINT ptCursor; diff --git a/Tools/WndImage.h b/Tools/WndImage.h index 640eb82b..822bacc6 100644 --- a/Tools/WndImage.h +++ b/Tools/WndImage.h @@ -54,12 +54,12 @@ public : }; virtual bool Image_OnMouseLeave() { return false; }; - virtual bool Image_OnMouseMove(LONG lX, LONG lY) { return false; }; - virtual bool Image_OnLButtonDown(LONG lX, LONG lY) { return false; }; - virtual bool Image_OnLButtonUp(LONG lX, LONG lY) { return false; }; - virtual bool Image_OnRButtonDown(LONG lX, LONG lY) { return false; }; + virtual bool Image_OnMouseMove([[maybe_unused]] LONG lX, [[maybe_unused]] LONG lY) { return false; }; + virtual bool Image_OnLButtonDown([[maybe_unused]] LONG lX,[[maybe_unused]] LONG lY) { return false; }; + virtual bool Image_OnLButtonUp([[maybe_unused]] LONG lX, [[maybe_unused]] LONG lY) { return false; }; + virtual bool Image_OnRButtonDown([[maybe_unused]] LONG lX, [[maybe_unused]] LONG lY) { return false; }; - virtual Image * GetOverlayImage(CRect & rcClient) { return nullptr; }; + virtual Image * GetOverlayImage([[maybe_unused]] CRect & rcClient) { return nullptr; }; }; // ------------------------------------------------------------------ diff --git a/Tools/cdxCRot90DC.cpp b/Tools/cdxCRot90DC.cpp index 040ea3b8..2cf2cf93 100644 --- a/Tools/cdxCRot90DC.cpp +++ b/Tools/cdxCRot90DC.cpp @@ -338,7 +338,9 @@ void cdxCRot90DC::DrawControl(CRect rect, CString strText, HICON hIcon, UINT nDr else { cdxCRot90DC iconDC(this,CRect(pntIcon.x,pntIcon.y,pntIcon.x + sz.cx,pntIcon.y + sz.cy),-mkAngle(m_Angle),true); +#pragma warning (suppress:4457) CRect rect = iconDC; + if(!rect.IsRectEmpty()) iconDC.DrawState( rect.TopLeft(), rect.Size(), diff --git a/Tools/cdxCRotBevelLine.cpp b/Tools/cdxCRotBevelLine.cpp index 8e63eb82..4ea8b82e 100644 --- a/Tools/cdxCRotBevelLine.cpp +++ b/Tools/cdxCRotBevelLine.cpp @@ -247,7 +247,7 @@ void cdxCRotBevelLine::OnEnable(BOOL bEnable) Invalidate(); } -BOOL cdxCRotBevelLine::OnEraseBkgnd(CDC* pDC) +BOOL cdxCRotBevelLine::OnEraseBkgnd([[maybe_unused]] CDC* pDC) { return TRUE; }