Skip to content

Commit

Permalink
Fix OSX compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
markummitchell-tu committed Jul 19, 2016
1 parent 45081f6 commit cc07b89
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions dev/osx/Info.plist_valid
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<key>CFBundleExecutable</key>
<string>Engauge Digitizer</string>
<key>CFBundleVersion</key>
<string>8.3</string>
<string>9.0</string>
<key>CFBundleShortVersionString</key>
<string>8.3</string>
<string>9.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>CFBundleIdentifier</key>
Expand Down
1 change: 1 addition & 0 deletions help/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engauge.qch
9 changes: 6 additions & 3 deletions src/Color/ColorFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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 {

Expand Down
25 changes: 16 additions & 9 deletions src/Color/ColorFilterSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DigitizeState/DigitizeStateSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void DigitizeStateSelect::handleContextMenuEventGraph (CmdMediator *cmdMediator,

if (y != 0) {
delete y;
y = y;
y = 0;
}

int rtn = dlg->exec ();
Expand Down
2 changes: 0 additions & 2 deletions src/Dlg/DlgImportCroppingNonPdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 0 additions & 4 deletions src/NonPdf/NonPdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
#include <QImage>
#include <QString>

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 ()
{
}
Expand Down
8 changes: 4 additions & 4 deletions src/NonPdf/NonPdfFrameHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/util/ZValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit cc07b89

Please sign in to comment.