Skip to content

Commit

Permalink
Fix some cppcheck uninitialized member warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Apr 11, 2023
1 parent 6771b19 commit 212c33f
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 58 deletions.
4 changes: 2 additions & 2 deletions src/3d/chunks/qgschunkloader_p.h
Expand Up @@ -107,9 +107,9 @@ class _3D_EXPORT QgsQuadtreeChunkLoaderFactory : public QgsChunkLoaderFactory
protected:
QgsAABB mRootBbox;
QgsAABB mClippingBbox;
float mRootError;
float mRootError = 0;
//! maximum allowed depth of quad tree
int mMaxLevel;
int mMaxLevel = 0;

};

Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgsskyboxsettings.h
Expand Up @@ -71,7 +71,7 @@ class _3D_EXPORT QgsSkyboxSettings
void setCubeMapFace( const QString &face, const QString &path ) { mCubeMapFacesPaths[face] = path; }

private:
QgsSkyboxEntity::SkyboxType mSkyboxType;
QgsSkyboxEntity::SkyboxType mSkyboxType = QgsSkyboxEntity::PanoramicSkybox;
//
QString mPanoramicTexturePath;
//
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/georeferencing/qgsgcptransformer.h
Expand Up @@ -211,8 +211,8 @@ class ANALYSIS_EXPORT QgsHelmertGeorefTransform : public QgsGcpTransformerInterf
struct HelmertParameters
{
QgsPointXY origin;
double scale;
double angle;
double scale = 0;
double angle = 0;
bool invertYAxis = false;
};
HelmertParameters mHelmertParameters;
Expand Down
24 changes: 12 additions & 12 deletions src/analysis/processing/qgsalgorithmcellstatistics.h
Expand Up @@ -45,16 +45,16 @@ class QgsCellStatisticsAlgorithmBase : public QgsProcessingAlgorithm
virtual void processRasterStack( QgsProcessingFeedback *feedback ) = 0;

std::vector< QgsRasterAnalysisUtils::RasterLogicInput > mInputs;
bool mIgnoreNoData;
Qgis::DataType mDataType;
bool mIgnoreNoData = false;
Qgis::DataType mDataType = Qgis::DataType::UnknownDataType;
double mNoDataValue = -9999;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
QgsRasterDataProvider *mOutputRasterDataProvider;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;
QgsRasterDataProvider *mOutputRasterDataProvider = nullptr;
};

class QgsCellStatisticsAlgorithm : public QgsCellStatisticsAlgorithmBase
Expand All @@ -75,7 +75,7 @@ class QgsCellStatisticsAlgorithm : public QgsCellStatisticsAlgorithmBase
void processRasterStack( QgsProcessingFeedback *feedback ) override;

private:
QgsRasterAnalysisUtils::CellValueStatisticMethods mMethod;
QgsRasterAnalysisUtils::CellValueStatisticMethods mMethod = QgsRasterAnalysisUtils::CellValueStatisticMethods::Sum;

};

Expand All @@ -98,7 +98,7 @@ class QgsCellStatisticsPercentileAlgorithm : public QgsCellStatisticsAlgorithmBa
void processRasterStack( QgsProcessingFeedback *feedback ) override;

private:
QgsRasterAnalysisUtils::CellValuePercentileMethods mMethod;
QgsRasterAnalysisUtils::CellValuePercentileMethods mMethod = QgsRasterAnalysisUtils::CellValuePercentileMethods::NearestRankPercentile;
double mPercentile = 0.0;
};

Expand All @@ -121,7 +121,7 @@ class QgsCellStatisticsPercentRankFromValueAlgorithm : public QgsCellStatisticsA
void processRasterStack( QgsProcessingFeedback *feedback ) override;

private:
QgsRasterAnalysisUtils::CellValuePercentRankMethods mMethod;
QgsRasterAnalysisUtils::CellValuePercentRankMethods mMethod = QgsRasterAnalysisUtils::CellValuePercentRankMethods::InterpolatedPercentRankInc;
double mValue = 0.0;

};
Expand All @@ -145,9 +145,9 @@ class QgsCellStatisticsPercentRankFromRasterAlgorithm : public QgsCellStatistics
void processRasterStack( QgsProcessingFeedback *feedback ) override;

private:
QgsRasterAnalysisUtils::CellValuePercentRankMethods mMethod;
QgsRasterAnalysisUtils::CellValuePercentRankMethods mMethod = QgsRasterAnalysisUtils::CellValuePercentRankMethods::InterpolatedPercentRankInc;
std::unique_ptr< QgsRasterInterface > mValueRasterInterface;
int mValueRasterBand;
int mValueRasterBand = 1;

};

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmfieldcalculator.h
Expand Up @@ -57,11 +57,11 @@ class QgsFieldCalculatorAlgorithm : public QgsProcessingFeatureBasedAlgorithm

private:
QgsFields mFields;
int mFieldIdx;
int mFieldIdx = -1;
QgsExpression mExpression;
QgsExpressionContext mExpressionContext;
QgsDistanceArea mDa;
int mRowNumber;
int mRowNumber = 0;
};

///@endcond PRIVATE
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/processing/qgsalgorithmfillnodata.h
Expand Up @@ -55,17 +55,17 @@ class QgsFillNoDataAlgorithm : public QgsProcessingAlgorithm
QgsProcessingFeedback *feedback ) override;

private:
QgsRasterLayer *mInputRaster;
QgsRasterLayer *mInputRaster = nullptr;
double mFillValue = 0;
int mBand;
int mBand = 1;
std::unique_ptr< QgsRasterInterface > mInterface;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
int mNbCellsXProvider = 0;
int mNbCellsYProvider = 0;
double mInputNoDataValue;
double mInputNoDataValue = 0;
};

///@endcond PRIVATE
Expand Down
10 changes: 5 additions & 5 deletions src/analysis/processing/qgsalgorithmgrid.h
Expand Up @@ -56,13 +56,13 @@ class QgsGridAlgorithm : public QgsProcessingAlgorithm


private:
int mIdx;
int mIdx = 0;
QgsRectangle mGridExtent;
QgsCoordinateReferenceSystem mCrs;
double mHSpacing;
double mVSpacing;
double mHOverlay;
double mVOverlay;
double mHSpacing = 1;
double mVSpacing = 1;
double mHOverlay = 0;
double mVOverlay = 0;

//define grid creation methods
void createPointGrid( std::unique_ptr< QgsFeatureSink > &sink, QgsProcessingFeedback *feedback );
Expand Down
4 changes: 2 additions & 2 deletions src/analysis/processing/qgsalgorithmlinedensity.h
Expand Up @@ -60,8 +60,8 @@ class QgsLineDensityAlgorithm : public QgsProcessingAlgorithm
private:
std::unique_ptr< QgsFeatureSource > mSource;
QString mWeightField;
double mSearchRadius;
double mPixelSize;
double mSearchRadius = 0;
double mPixelSize = 0;
QgsGeometry mSearchGeometry;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/processing/qgsalgorithmrandompointsextent.h
Expand Up @@ -57,9 +57,9 @@ class QgsRandomPointsExtentAlgorithm : public QgsProcessingAlgorithm

private:
QgsRectangle mExtent;
int mNumPoints;
double mDistance;
int mMaxAttempts;
int mNumPoints = 0;
double mDistance = 0;
int mMaxAttempts = 0;
QgsCoordinateReferenceSystem mCrs;

};
Expand Down
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmrasterlayerproperties.h
Expand Up @@ -55,12 +55,12 @@ class QgsRasterLayerPropertiesAlgorithm : public QgsProcessingAlgorithm
int mBandCount = 0;
bool mHasNoDataValue = false;
QVariant mNoDataValue;
int mLayerWidth;
int mLayerHeight;
int mLayerWidth = 0;
int mLayerHeight = 0;
QgsRectangle mExtent;
QgsCoordinateReferenceSystem mCrs;
double mRasterUnitsPerPixelX;
double mRasterUnitsPerPixelY;
double mRasterUnitsPerPixelX = 0;
double mRasterUnitsPerPixelY = 0;

};

Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmrastersampling.h
Expand Up @@ -53,7 +53,7 @@ class QgsRasterSamplingAlgorithm : public QgsProcessingAlgorithm
private:

std::unique_ptr< QgsRasterDataProvider > mDataProvider;
int mBandCount;
int mBandCount = 1;
QgsCoordinateReferenceSystem mCrs;

};
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsstoredexpressionmanager.h
Expand Up @@ -82,7 +82,7 @@ struct CORE_EXPORT QgsStoredExpression
//! expression text
QString expression;
//! category of the expression use case
Category tag;
Category tag = Category::FilterExpression;
};

/**
Expand Down
24 changes: 12 additions & 12 deletions src/core/qgstiles.h
Expand Up @@ -54,9 +54,9 @@ class CORE_EXPORT QgsTileXYZ
QString toString() const { return QStringLiteral( "X=%1 Y=%2 Z=%3" ).arg( mColumn ).arg( mRow ).arg( mZoomLevel ); }

private:
int mColumn;
int mRow;
int mZoomLevel;
int mColumn = -1;
int mRow = -1;
int mZoomLevel = -1;
};


Expand Down Expand Up @@ -87,10 +87,10 @@ class CORE_EXPORT QgsTileRange
int endRow() const { return mEndRow; }

private:
int mStartColumn;
int mEndColumn;
int mStartRow;
int mEndRow;
int mStartColumn = -1;
int mEndColumn = -1;
int mStartRow = -1;
int mEndRow = -1;
};


Expand Down Expand Up @@ -198,17 +198,17 @@ class CORE_EXPORT QgsTileMatrix
//! Zoom level index associated with the tile matrix
int mZoomLevel = -1;
//! Number of columns of the tile matrix
int mMatrixWidth;
int mMatrixWidth = 0;
//! Number of rows of the tile matrix
int mMatrixHeight;
int mMatrixHeight = 0;
//! Matrix extent in map units in the CRS of tile matrix set
QgsRectangle mExtent;
//! Scale denominator of the map scale associated with the tile matrix
double mScaleDenom;
double mScaleDenom = 0;
//! Width of a single tile in map units (derived from extent and matrix size)
double mTileXSpan;
double mTileXSpan = 0;
//! Height of a single tile in map units (derived from extent and matrix size)
double mTileYSpan;
double mTileYSpan = 0;

friend class QgsTileMatrixSet;
};
Expand Down
2 changes: 1 addition & 1 deletion src/providers/hana/qgshanaconnectionstringbuilder.h
Expand Up @@ -89,7 +89,7 @@ class QgsHanaConnectionStringBuilder
bool mProxyEnabled = false;
bool mProxyHttp = false;
QString mProxyHost;
uint mProxyPort;
uint mProxyPort = 0;
QString mProxyUsername;
QString mProxyPassword;
};
Expand Down
10 changes: 5 additions & 5 deletions src/providers/wms/qgswmscapabilities.h
Expand Up @@ -478,11 +478,11 @@ struct QgsWmtsTileMatrix
QStringList keywords;
double scaleDenom = 0;
QgsPointXY topLeft; //!< Top-left corner of the tile matrix in map units
int tileWidth; //!< Width of a tile in pixels
int tileHeight; //!< Height of a tile in pixels
int matrixWidth; //!< Number of tiles horizontally
int matrixHeight; //!< Number of tiles vertically
double tres; //!< Pixel span in map units
int tileWidth = 0; //!< Width of a tile in pixels
int tileHeight = 0; //!< Height of a tile in pixels
int matrixWidth = 0; //!< Number of tiles horizontally
int matrixHeight = 0; //!< Number of tiles vertically
double tres = 0; //!< Pixel span in map units

/**
* Returns extent of a tile in map coordinates.
Expand Down
3 changes: 3 additions & 0 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -1799,6 +1799,9 @@ void QgsWmsProvider::setupXyzCapabilities( const QString &uri, const QgsRectangl
tl.tileMode = XYZ;
tl.identifier = QStringLiteral( "xyz" ); // as set in parseUri
tl.boundingBoxes << bbox;
// suppress cppcheck warnings
tl.dpi = -1;
tl.timeFormat = QgsWmtsTileLayer::WmtsTimeFormat::yyyyMMdd;

double tilePixelRatio = sourceTilePixelRatio; // by default 0 = unknown
if ( parsedUri.hasParam( QStringLiteral( "tilePixelRatio" ) ) )
Expand Down

0 comments on commit 212c33f

Please sign in to comment.