From cc07b897d27589341a18cc1851d33c1998fa6c09 Mon Sep 17 00:00:00 2001 From: mark mitchell Date: Mon, 18 Jul 2016 22:47:02 -0700 Subject: [PATCH] Fix OSX compiler warnings --- dev/osx/Info.plist_valid | 4 ++-- help/.gitignore | 1 + src/Color/ColorFilter.cpp | 9 +++++--- src/Color/ColorFilterSettings.cpp | 25 +++++++++++++++-------- src/DigitizeState/DigitizeStateSelect.cpp | 2 +- src/Dlg/DlgImportCroppingNonPdf.cpp | 2 -- src/NonPdf/NonPdf.cpp | 4 ---- src/NonPdf/NonPdfFrameHandle.cpp | 8 ++++---- src/main/MainWindow.cpp | 2 +- src/util/ZValues.cpp | 1 - 10 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 help/.gitignore diff --git a/dev/osx/Info.plist_valid b/dev/osx/Info.plist_valid index 704257ad..06df9cde 100644 --- a/dev/osx/Info.plist_valid +++ b/dev/osx/Info.plist_valid @@ -13,9 +13,9 @@ CFBundleExecutable Engauge Digitizer CFBundleVersion - 8.3 + 9.0 CFBundleShortVersionString - 8.3 + 9.0 LSApplicationCategoryType public.app-category.utilities CFBundleIdentifier diff --git a/help/.gitignore b/help/.gitignore new file mode 100644 index 00000000..e0c3053b --- /dev/null +++ b/help/.gitignore @@ -0,0 +1 @@ +engauge.qch \ No newline at end of file diff --git a/src/Color/ColorFilter.cpp b/src/Color/ColorFilter.cpp index 1df1aad6..cadb4fee 100644 --- a/src/Color/ColorFilter.cpp +++ b/src/Color/ColorFilter.cpp @@ -174,8 +174,10 @@ double ColorFilter::pixelToZeroToOneOrMinusOne (ColorFilterMode colorFilterMode, { if (m_strategies.contains (colorFilterMode)) { - return m_strategies [colorFilterMode]->pixelToZeroToOne (pixel, - rgbBackground); + // Ignore false positive cmake compiler warning about -Wreturn-stack-address in next line (bug #26396) + const ColorFilterStrategyAbstractBase *strategy = m_strategies [colorFilterMode]; + return strategy->pixelToZeroToOne (pixel, + rgbBackground); } else { @@ -190,7 +192,8 @@ int ColorFilter::zeroToOneToValue (ColorFilterMode colorFilterMode, { if (m_strategies.contains (colorFilterMode)) { - return m_strategies [colorFilterMode]->zeroToOneToValue (s); + const ColorFilterStrategyAbstractBase *strategy = m_strategies [colorFilterMode]; + return strategy->zeroToOneToValue (s); } else { diff --git a/src/Color/ColorFilterSettings.cpp b/src/Color/ColorFilterSettings.cpp index 4077c6af..a8bd556a 100644 --- a/src/Color/ColorFilterSettings.cpp +++ b/src/Color/ColorFilterSettings.cpp @@ -136,7 +136,10 @@ int ColorFilterSettings::foregroundLow () const double ColorFilterSettings::high () const { if (m_strategies.contains (m_colorFilterMode)) { - return m_strategies [m_colorFilterMode]->high (*this); + + // Ignore false positive cmake compiler warning about -Wreturn-stack-address in next line (bug #26396) + const ColorFilterSettingsStrategyAbstractBase *strategy = m_strategies.value (m_colorFilterMode); + return strategy->high (*this); } else { ENGAUGE_ASSERT (false); return m_strategies [COLOR_FILTER_MODE_INTENSITY]->high (*this); @@ -215,7 +218,8 @@ void ColorFilterSettings::loadXml(QXmlStreamReader &reader) double ColorFilterSettings::low () const { if (m_strategies.contains (m_colorFilterMode)) { - return m_strategies [m_colorFilterMode]->low (*this); + const ColorFilterSettingsStrategyAbstractBase *strategy = m_strategies.value (m_colorFilterMode); + return strategy->low (*this); } else { ENGAUGE_ASSERT (false); return m_strategies [COLOR_FILTER_MODE_INTENSITY]->low (*this); @@ -230,9 +234,10 @@ void ColorFilterSettings::printStream (QString indentation, indentation += INDENTATION_DELTA; if (m_strategies.contains (m_colorFilterMode)) { - return m_strategies [m_colorFilterMode]->printStream (*this, - indentation, - str); + const ColorFilterSettingsStrategyAbstractBase *strategy = m_strategies.value (m_colorFilterMode); + return strategy->printStream (*this, + indentation, + str); } } @@ -288,8 +293,9 @@ void ColorFilterSettings::setForegroundLow (int foregroundLow) void ColorFilterSettings::setHigh (double s0To1) { if (m_strategies.contains (m_colorFilterMode)) { - return m_strategies [m_colorFilterMode]->setHigh (*this, - s0To1); + ColorFilterSettingsStrategyAbstractBase *strategy = m_strategies [m_colorFilterMode]; + return strategy->setHigh (*this, + s0To1); } else { ENGAUGE_ASSERT (false); } @@ -322,8 +328,9 @@ void ColorFilterSettings::setIntensityLow (int intensityLow) void ColorFilterSettings::setLow (double s0To1) { if (m_strategies.contains (m_colorFilterMode)) { - return m_strategies [m_colorFilterMode]->setLow (*this, - s0To1); + ColorFilterSettingsStrategyAbstractBase *strategy = m_strategies [m_colorFilterMode]; + return strategy->setLow (*this, + s0To1); } else { ENGAUGE_ASSERT (false); } diff --git a/src/DigitizeState/DigitizeStateSelect.cpp b/src/DigitizeState/DigitizeStateSelect.cpp index 375c042e..fded6b05 100644 --- a/src/DigitizeState/DigitizeStateSelect.cpp +++ b/src/DigitizeState/DigitizeStateSelect.cpp @@ -186,7 +186,7 @@ void DigitizeStateSelect::handleContextMenuEventGraph (CmdMediator *cmdMediator, if (y != 0) { delete y; - y = y; + y = 0; } int rtn = dlg->exec (); diff --git a/src/Dlg/DlgImportCroppingNonPdf.cpp b/src/Dlg/DlgImportCroppingNonPdf.cpp index c167359c..d2d913ad 100644 --- a/src/Dlg/DlgImportCroppingNonPdf.cpp +++ b/src/Dlg/DlgImportCroppingNonPdf.cpp @@ -24,8 +24,6 @@ int DlgImportCroppingNonPdf::MINIMUM_DIALOG_WIDTH = 350; int DlgImportCroppingNonPdf::MINIMUM_PREVIEW_HEIGHT = 200; -const int X_TOP_LEFT = 0, Y_TOP_LEFT = 0; -const int WIDTH = -1, HEIGHT = -1; // Negative values give full page DlgImportCroppingNonPdf::DlgImportCroppingNonPdf(const QString &fileName) : m_fileName (fileName), diff --git a/src/NonPdf/NonPdf.cpp b/src/NonPdf/NonPdf.cpp index 72162962..576aff04 100644 --- a/src/NonPdf/NonPdf.cpp +++ b/src/NonPdf/NonPdf.cpp @@ -11,10 +11,6 @@ #include #include -const int X_TOP_LEFT = 0, Y_TOP_LEFT = 0; -const int WIDTH = -1, HEIGHT = -1; // Negative values give full page -const int FIRST_PAGE_1_BASED = 1; - NonPdf::NonPdf () { } diff --git a/src/NonPdf/NonPdfFrameHandle.cpp b/src/NonPdf/NonPdfFrameHandle.cpp index 8bd9e764..ef9bbb0f 100644 --- a/src/NonPdf/NonPdfFrameHandle.cpp +++ b/src/NonPdf/NonPdfFrameHandle.cpp @@ -57,14 +57,14 @@ NonPdfFrameHandle::NonPdfFrameHandle (QGraphicsScene &scene, // Adjust positions of handles that are not at the top left so handles are laid out symmetrically QPointF pointPos = pointReference; - if ((orientationFlags && NonPdfCropping::NON_PDF_CROPPING_LEFT) != 0) { + if ((orientationFlags & NonPdfCropping::NON_PDF_CROPPING_LEFT) != 0) { pointPos.setX (pointPos.x() - handleSize.width() / 2.0); - } else if ((orientationFlags && NonPdfCropping::NON_PDF_CROPPING_RIGHT) != 0) { + } else if ((orientationFlags & NonPdfCropping::NON_PDF_CROPPING_RIGHT) != 0) { pointPos.setX (pointPos.x() + handleSize.width() / 2.0); } - if ((orientationFlags && NonPdfCropping::NON_PDF_CROPPING_TOP) != 0) { + if ((orientationFlags & NonPdfCropping::NON_PDF_CROPPING_TOP) != 0) { pointPos.setY (pointPos.y() - handleSize.height() / 2.0); - } else if ((orientationFlags && NonPdfCropping::NON_PDF_CROPPING_BOTTOM) != 0) { + } else if ((orientationFlags & NonPdfCropping::NON_PDF_CROPPING_BOTTOM) != 0) { pointPos.setY (pointPos.y() + handleSize.height() / 2.0); } diff --git a/src/main/MainWindow.cpp b/src/main/MainWindow.cpp index cd2dc60d..72c12411 100644 --- a/src/main/MainWindow.cpp +++ b/src/main/MainWindow.cpp @@ -2394,9 +2394,9 @@ void MainWindow::settingsReadMainWindow (QSettings &settings) QPoint (200, 200)).toPoint ()); // Help window geometry +#ifndef OSX_RELEASE QSize helpSize = settings.value (SETTINGS_HELP_SIZE, QSize (900, 600)).toSize(); -#ifndef OSX_RELEASE m_helpWindow->resize (helpSize); if (settings.contains (SETTINGS_HELP_POS)) { QPoint helpPos = settings.value (SETTINGS_HELP_POS).toPoint(); diff --git a/src/util/ZValues.cpp b/src/util/ZValues.cpp index c40b72d2..40bfeacb 100644 --- a/src/util/ZValues.cpp +++ b/src/util/ZValues.cpp @@ -7,7 +7,6 @@ #include "ZValues.h" const int Z_VALUE_BACKGROUND = 0; -const int Z_VALUE_GRID_LINE = 100; const int Z_VALUE_CURVE = 200; const int Z_VALUE_POINT = 300;