Skip to content

Commit

Permalink
fix internal use of deprecated methods and fix related warnings
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15210 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 19, 2011
1 parent ce8e3d5 commit cf0ed8d
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 41 deletions.
5 changes: 5 additions & 0 deletions src/analysis/raster/qgsrastercalcparser.yy
Expand Up @@ -19,6 +19,11 @@
%{
#include "qgsrastercalcnode.h"

#ifdef _MSC_VER
# pragma warnings( disable: 4065 ) // switch statement contains 'default' but no 'case' labels
# pragma warnings( disable: 4701 ) // Potentially uninitialized local variable 'name' used
#endif

// don't redeclare malloc/free
#define YYINCLUDED_STDLIB_H 1

Expand Down
6 changes: 2 additions & 4 deletions src/app/CMakeLists.txt
Expand Up @@ -349,11 +349,9 @@ ENDIF (WIN32)

IF(PEDANTIC)
# disable deprecation warnings
IF(MSVC)
SET_SOURCE_FILES_PROPERTIES(qgisappinterface.cpp PROPERTIES COMPILE_FLAGS /wd4996)
ELSE(MSVC)
IF(NOT MSVC)
SET_SOURCE_FILES_PROPERTIES(qgisappinterface.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated)
ENDIF(MSVC)
ENDIF(NOT MSVC)
ENDIF(PEDANTIC)

INCLUDE_DIRECTORIES(
Expand Down
4 changes: 1 addition & 3 deletions src/app/gps/qwtpolar/qwt_polar_itemdict.cpp
Expand Up @@ -28,9 +28,7 @@ class QwtPolarItemDict::PrivateData
// for lists in Qt4. The implementation below
// is slow, but there shouldn't be many plot items.

#ifdef __GNUC__
#warning binary search missing
#endif
// TODO add binary search

#if QT_VERSION < 0x040000
QValueListIterator<QwtPolarItem *> it;
Expand Down
8 changes: 8 additions & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -24,6 +24,11 @@

class QgisApp;

#ifdef _MSC_VER
# pragma warning( push )
# pragma warning( disable: 4996 ) // declared deprecated
#endif

/** \class QgisAppInterface
* \brief Interface class to provide access to private methods in QgisApp
* for use by plugins.
Expand Down Expand Up @@ -304,5 +309,8 @@ class QgisAppInterface : public QgisInterface
QgsAppLegendInterface legendIface;
};

#ifdef _MSC_VER
# pragma warning( pop )
#endif

#endif //#define QGISAPPINTERFACE_H
14 changes: 0 additions & 14 deletions src/core/CMakeLists.txt
Expand Up @@ -212,20 +212,6 @@ ADD_FLEX_FILES(QGIS_CORE_SRCS qgssearchstringlexer.ll)

ADD_BISON_FILES(QGIS_CORE_SRCS qgssearchstringparser.yy)

# Disable compiler warnings for lex generated sources
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_BINARY_DIR}/src/core/flex_qgssearchstringlexer.cpp
PROPERTIES COMPILE_FLAGS -w)

IF (MSVC AND PEDANTIC)
# disable warnings
# 4065 switch with default and no case
# 4702 unreachable code
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_BINARY_DIR}/src/core/qgssearchstringparser.cpp
PROPERTIES COMPILE_FLAGS "-wd4065 -wd4702")
ENDIF (MSVC AND PEDANTIC)

SET(QGIS_CORE_MOC_HDRS
qgsapplication.h
qgscontexthelp.h
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgssearchstringlexer.ll
Expand Up @@ -20,6 +20,7 @@
%option noyywrap
%option case-insensitive
%option never-interactive
%option nounput

// ensure that lexer will be 8-bit (and not just 7-bit)
%option 8bit
Expand All @@ -35,6 +36,8 @@
// which doesn't in MSVC compiler
#define YY_NEVER_INTERACTIVE 1

#define YY_NO_UNPUT // unused

#ifdef _MSC_VER
#define YY_NO_UNISTD_H
#endif
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgssearchstringparser.yy
Expand Up @@ -23,6 +23,11 @@
#include <cstdlib>
#include "qgssearchtreenode.h"

#ifdef _MSC_VER
# pragma warning( disable: 4065 ) // switch statement contains 'default' but no 'case' labels
# pragma warning( disable: 4702 ) // unreachable code
#endif

// don't redeclare malloc/free
#define YYINCLUDED_STDLIB_H 1

Expand Down
9 changes: 4 additions & 5 deletions src/gui/CMakeLists.txt
Expand Up @@ -104,10 +104,6 @@ qgssearchquerybuilder.h

QT4_WRAP_CPP(QGIS_GUI_MOC_SRCS ${QGIS_GUI_MOC_HDRS})

IF(MSVC AND PEDANTIC)
# disable deprecation warnings for qgisinterface (re-exporting deprecated methods)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/src/gui/moc_qgisinterface.cxx PROPERTIES COMPILE_FLAGS "-wd4996")
ENDIF(MSVC AND PEDANTIC)

INCLUDE_DIRECTORIES(
${QT_QTUITOOLS_INCLUDE_DIR}
Expand Down Expand Up @@ -139,11 +135,14 @@ IF (WIN32)
ENDIF (MSVC)
ENDIF (WIN32)

IF(NOT MSVC)
# disable deprecation warnings for qgisinterface (re-exporting deprecated methods)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/src/gui/moc_qgisinterface.cxx PROPERTIES COMPILE_FLAGS "-w")
ENDIF(NOT MSVC)

#############################################################
# qgis_gui library


ADD_LIBRARY(qgis_gui SHARED ${QGIS_GUI_SRCS} ${QGIS_GUI_MOC_SRCS})

SET_TARGET_PROPERTIES(qgis_gui PROPERTIES VERSION ${COMPLETE_VERSION} SOVERSION ${COMPLETE_VERSION})
Expand Down
13 changes: 9 additions & 4 deletions src/gui/qgisinterface.h
Expand Up @@ -40,6 +40,10 @@ class QgsFeature;

#include <qgis.h>

#ifdef _MSC_VER
# pragma warning( push )
# pragma warning( disable: 4996 ) // was declared deprecated
#endif

/** \ingroup gui
* QgisInterface
Expand Down Expand Up @@ -367,14 +371,15 @@ class GUI_EXPORT QgisInterface : public QObject

};

#ifdef _MSC_VER
# pragma warning( pop )
# pragma warning( disable: 4190 )
#endif

// FIXME: also in core/qgis.h
#ifndef QGISEXTERN
#ifdef WIN32
# define QGISEXTERN extern "C" __declspec( dllexport )
# ifdef _MSC_VER
// do not warn about C bindings returning QString
# pragma warning(disable:4190)
# endif
#else
# define QGISEXTERN extern "C"
#endif
Expand Down
23 changes: 13 additions & 10 deletions src/plugins/diagram_overlay/qgssvgdiagramfactorywidget.cpp
Expand Up @@ -217,19 +217,22 @@ int QgsSVGDiagramFactoryWidget::addDirectoryToPreview( const QString& path )
void QgsSVGDiagramFactoryWidget::addStandardDirectoriesToPreview()
{
//list all directories in $prefix/share/qgis/svg
QDir svgDirectory( QgsApplication::svgPath() );
if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
foreach( QString path, QgsApplication::svgPaths() )
{
return; //error
}
QDir svgDirectory( path );
if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
{
continue; //error
}

QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
QFileInfoList::const_iterator dirIt = directoryList.constBegin();
for ( ; dirIt != directoryList.constEnd(); ++dirIt )
{
if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
QFileInfoList::const_iterator dirIt = directoryList.constBegin();
for ( ; dirIt != directoryList.constEnd(); ++dirIt )
{
mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
{
mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/osm/osmstyle.cpp
Expand Up @@ -139,7 +139,7 @@ void OsmStyle::parse_rule_point( QString line )
QColor mSelectionColor( 255, 255, 0 );

QgsSymbol sym( QGis::Point );
sym.setNamedPointSymbol( QString( "svg:%1%2" ).arg( QgsApplication::svgPath() ).arg( name ) );
sym.setNamedPointSymbol( QString( "svg:%1" ).arg( name ) );
sym.setPointSize( size.toFloat() );

QImage img = sym.getPointSymbolAsImage( widthScale, selected, mSelectionColor );
Expand Down

0 comments on commit cf0ed8d

Please sign in to comment.