Skip to content

Commit

Permalink
fix windows build including some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Nov 5, 2019
1 parent 375b390 commit 5ee5e37
Show file tree
Hide file tree
Showing 12 changed files with 302 additions and 290 deletions.
4 changes: 4 additions & 0 deletions python/core/auto_generated/qgis.sip.in
Expand Up @@ -293,12 +293,16 @@ QString geoWkt();
Wkt string that represents a geographic coord sys
\since QGIS GEOWkt
%End

//! PROJ4 string that represents a geographic coord sys
QString geoProj4();

//! Geographic coord sys from EPSG authority
QString geoEpsgCrsAuthId();

//! Constant that holds the string representation for "No ellips/No CRS"
QString geoNone();

/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
2 changes: 2 additions & 0 deletions src/analysis/raster/qgsninecellfilter.cpp
Expand Up @@ -76,7 +76,9 @@ int QgsNineCellFilter::processRaster( QgsFeedback *feedback )
{
return processRasterCPU( feedback );
}
#ifndef _MSC_VER
return 1;
#endif
#else
return processRasterCPU( feedback );
#endif
Expand Down
41 changes: 16 additions & 25 deletions src/core/qgis.h
Expand Up @@ -597,15 +597,17 @@ void CORE_EXPORT qgsFree( void *ptr ) SIP_SKIP;

#ifndef SIP_RUN

/**
* Wkt string that represents a geographic coord sys
* \since QGIS GEOWkt
*/
#ifdef _MSC_VER
QString CORE_EXPORT geoWkt()
#define CONSTLATIN1STRING inline const QLatin1String
#else
constexpr QLatin1String CORE_EXPORT geoWkt()
#define CONSTLATIN1STRING constexpr QLatin1String
#endif

/**
* Wkt string that represents a geographic coord sys
* \since QGIS GEOWkt
*/
CONSTLATIN1STRING geoWkt()
{
return QLatin1String(
"GEOGCS[\"WGS 84\", "
Expand All @@ -623,34 +625,23 @@ constexpr QLatin1String CORE_EXPORT geoWkt()
}

//! PROJ4 string that represents a geographic coord sys
#ifdef _MSC_VER
QString CORE_EXPORT geoProj4()
#else
constexpr QLatin1String CORE_EXPORT geoProj4()
#endif
CONSTLATIN1STRING geoProj4()
{
return QLatin1String( "+proj=longlat +datum=WGS84 +no_defs" );
}

//! Geographic coord sys from EPSG authority
#ifdef _MSC_VER
QString CORE_EXPORT geoEpsgCrsAuthId()
#else
constexpr QLatin1String CORE_EXPORT geoEpsgCrsAuthId()
#endif
CONSTLATIN1STRING geoEpsgCrsAuthId()
{
return QLatin1String( "EPSG:4326" );
}

//! Constant that holds the string representation for "No ellips/No CRS"
#ifdef _MSC_VER
QString CORE_EXPORT geoNone()
#else
constexpr QLatin1String CORE_EXPORT geoNone()
#endif
CONSTLATIN1STRING geoNone()
{
return QLatin1String( "NONE" );
}

///@cond PRIVATE

//! Delay between the scheduling of 2 preview jobs
Expand Down Expand Up @@ -805,15 +796,15 @@ typedef unsigned long long qgssize;
* Wkt string that represents a geographic coord sys
* \since QGIS GEOWkt
*/
QString CORE_EXPORT geoWkt()
QString CORE_EXPORT geoWkt();

//! PROJ4 string that represents a geographic coord sys
QString CORE_EXPORT geoProj4()
QString CORE_EXPORT geoProj4();

//! Geographic coord sys from EPSG authority
QString CORE_EXPORT geoEpsgCrsAuthId()
QString CORE_EXPORT geoEpsgCrsAuthId();

//! Constant that holds the string representation for "No ellips/No CRS"
QString CORE_EXPORT geoNone()
QString CORE_EXPORT geoNone();

#endif
24 changes: 15 additions & 9 deletions src/core/qgsapplication.cpp
Expand Up @@ -114,7 +114,6 @@ QgsApplication::ApplicationMembers *QgsApplication::sApplicationMembers = nullpt
QgsAuthManager *QgsApplication::sAuthManager = nullptr;
int ABISYM( QgsApplication::sMaxThreads ) = -1;


Q_GLOBAL_STATIC( QStringList, sFileOpenEventList )
Q_GLOBAL_STATIC( QString, sPrefixPath )
Q_GLOBAL_STATIC( QString, sPluginPath )
Expand Down Expand Up @@ -232,14 +231,14 @@ void QgsApplication::init( QString profileFolder )
// we run from source directory - not installed to destination (specified prefix)
*sPrefixPath() = QString(); // set invalid path
#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
setPluginPath( *sBuildOutputPath() + '/' + QString( QGIS_PLUGIN_SUBDIR ) + '/' + ABISYM( mCfgIntDir ) );
setPluginPath( *sBuildOutputPath() + '/' + QString( QGIS_PLUGIN_SUBDIR ) + '/' + *sCfgIntDir() );
#else
setPluginPath( *sBuildOutputPath() + '/' + QStringLiteral( QGIS_PLUGIN_SUBDIR ) );
#endif
setPkgDataPath( *sBuildOutputPath() + QStringLiteral( "/data" ) ); // in buildDir/data - used for: doc, resources, svg
*sLibraryPath() = *sBuildOutputPath() + '/' + QGIS_LIB_SUBDIR + '/';
#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
*sLibexecPath() = *sBuildOutputPath() + '/' + QGIS_LIBEXEC_SUBDIR + '/' + ABISYM( mCfgIntDir ) + '/';
*sLibexecPath() = *sBuildOutputPath() + '/' + QGIS_LIBEXEC_SUBDIR + '/' + *sCfgIntDir() + '/';
#else
*sLibexecPath() = *sBuildOutputPath() + '/' + QGIS_LIBEXEC_SUBDIR + '/';
#endif
Expand Down Expand Up @@ -464,9 +463,9 @@ void QgsApplication::setPrefixPath( const QString &prefixPath, bool useDefaultPa
{
*sPrefixPath() = prefixPath;
#if defined(Q_OS_WIN)
if ( *sPrefixPath().endsWith( "/bin" ) )
if ( sPrefixPath()->endsWith( "/bin" ) )
{
*sPrefixPath().chop( 4 );
sPrefixPath()->chop( 4 );
}
#endif
if ( useDefaultPaths && !ABISYM( mRunningFromBuildDir ) )
Expand Down Expand Up @@ -736,8 +735,8 @@ QString QgsApplication::resolvePkgPath()
QgsDebugMsgLevel( QStringLiteral( "- source directory: %1" ).arg( sBuildSourcePath()->toUtf8().constData() ), 4 );
QgsDebugMsgLevel( QStringLiteral( "- output directory of the build: %1" ).arg( sBuildOutputPath()->toUtf8().constData() ), 4 );
#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
ABISYM( mCfgIntDir ) = appPath.split( '/', QString::SkipEmptyParts ).last();
qDebug( "- cfg: %s", ABISYM( mCfgIntDir ).toUtf8().constData() );
*sCfgIntDir() = appPath.split( '/', QString::SkipEmptyParts ).last();
qDebug( "- cfg: %s", sCfgIntDir()->toUtf8().constData() );
#endif
}
}
Expand Down Expand Up @@ -1101,12 +1100,12 @@ QString QgsApplication::userFullName()
//note - this only works for accounts connected to domain
if ( GetUserNameEx( NameDisplay, ( TCHAR * )name, &size ) )
{
sUserFullName = QString::fromLocal8Bit( name );
*sUserFullName() = QString::fromLocal8Bit( name );
}

//fall back to login name
if ( sUserFullName()->isEmpty() )
sUserFullName = userLoginName();
*sUserFullName() = userLoginName();
#elif defined(Q_OS_ANDROID) || defined(__MINGW32__)
*sUserFullName() = QStringLiteral( "Not available" );
#else
Expand Down Expand Up @@ -1604,6 +1603,13 @@ QString QgsApplication::buildOutputPath()
return *sBuildOutputPath();
}

#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
QString QgsApplication::cfgIntDir()
{
return *sCfgIntDir();
}
#endif

void QgsApplication::skipGdalDriver( const QString &driver )
{
if ( sGdalSkipList()->contains( driver ) || driver.isEmpty() )
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsapplication.h
Expand Up @@ -514,7 +514,7 @@ class CORE_EXPORT QgsApplication : public QApplication
//! Indicates whether running from build directory (not installed)
static bool isRunningFromBuildDir() { return ABISYM( mRunningFromBuildDir ); }
#if defined(_MSC_VER) && !defined(USING_NMAKE) && !defined(USING_NINJA)
static QString cfgIntDir() { return ABISYM( mCfgIntDir ); } SIP_SKIP
static QString cfgIntDir() SIP_SKIP;
#endif
//! Returns path to the source directory. Valid only when running from build directory
static QString buildSourcePath();
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -1755,7 +1755,7 @@ QString QgsCoordinateReferenceSystem::toWkt( WktVariant variant, bool multiline,
#if PROJ_VERSION_MAJOR>=6
if ( d->mPj )
{
PJ_WKT_TYPE type;
PJ_WKT_TYPE type = PJ_WKT1_GDAL;
switch ( variant )
{
case WKT1_GDAL:
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsprojutils.cpp
Expand Up @@ -181,7 +181,9 @@ QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToSingleCrs( const PJ *crs )
return QgsProjUtils::proj_pj_unique_ptr( proj_clone( context, crs ) );
}

#ifndef _MSC_VER // unreachable
return nullptr;
#endif
}

bool QgsProjUtils::coordinateOperationIsAvailable( const QString &projDef )
Expand Down
5 changes: 5 additions & 0 deletions src/gui/editorwidgets/qgsdoublespinbox.cpp
Expand Up @@ -29,7 +29,12 @@
// This is required because private implementation of
// QAbstractSpinBoxPrivate checks for specialText emptiness
// and skips specialText handling if it's empty
#ifdef _MSC_VER
static QChar SPECIAL_TEXT_WHEN_EMPTY = QChar( 0x2063 );
#else
static constexpr QChar SPECIAL_TEXT_WHEN_EMPTY = QChar( 0x2063 );
#endif


QgsDoubleSpinBox::QgsDoubleSpinBox( QWidget *parent )
: QDoubleSpinBox( parent )
Expand Down
4 changes: 4 additions & 0 deletions src/gui/editorwidgets/qgsspinbox.cpp
Expand Up @@ -29,7 +29,11 @@
// This is required because private implementation of
// QAbstractSpinBoxPrivate checks for specialText emptiness
// and skips specialText handling if it's empty
#ifdef _MSC_VER
static QChar SPECIAL_TEXT_WHEN_EMPTY = QChar( 0x2063 );
#else
static constexpr QChar SPECIAL_TEXT_WHEN_EMPTY = QChar( 0x2063 );
#endif

QgsSpinBox::QgsSpinBox( QWidget *parent )
: QSpinBox( parent )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/layertree/qgslayertreeviewitemdelegate.h
Expand Up @@ -48,7 +48,7 @@ class QgsLayerTreeViewProxyStyle : public QgsProxyStyle

QRect subElementRect( SubElement element, const QStyleOption *option, const QWidget *widget ) const override;

static const unsigned long SE_LayerTreeItemIndicator = SE_CustomBase + 1;
static const auto SE_LayerTreeItemIndicator = SE_CustomBase + 1;

private:
QgsLayerTreeView *mLayerTreeView;
Expand Down

0 comments on commit 5ee5e37

Please sign in to comment.