Skip to content
Permalink
Browse files

fix grass tests on windows

  • Loading branch information
jef-n committed Jul 7, 2015
1 parent 92af85b commit fa464111c8337064791a670d9ae2a076ba438705
@@ -390,6 +390,7 @@ IF (PEDANTIC)
# disable warnings
SET(_warnings "${_warnings} /wd4100 ") # unused formal parameters
SET(_warnings "${_warnings} /wd4127 ") # constant conditional expressions (used in Qt template classes)
SET(_warnings "${_warnings} /wd4190 ") # 'identifier' has C-linkage specified, but returns UDT 'identifier2' which is incompatible with C
SET(_warnings "${_warnings} /wd4231 ") # nonstandard extension used : 'identifier' before template explicit instantiation (used in Qt template classes)
SET(_warnings "${_warnings} /wd4244 ") # conversion from '...' to '...' possible loss of data
SET(_warnings "${_warnings} /wd4251 ") # needs to have dll-interface to be used by clients of class (occurs in Qt template classes)
@@ -127,7 +127,7 @@ QString QgsOpenVectorLayerDialog::openDirectory()
//process path if it is grass
if ( cmbDirectoryTypes->currentText() == "Grass Vector" )
{
#ifdef WIN32
#ifdef Q_OS_WIN
//replace backslashes with forward slashes
path.replace( "\\", "/" );
#endif
@@ -47,10 +47,10 @@
// Do we need this?
// #define TESTLIB
#ifdef TESTLIB
// This doesn't work on WIN32 and causes problems with plugins
// This doesn't work on windows and causes problems with plugins
// on OS X (the code doesn't cause a problem but including dlfcn.h
// renders plugins unloadable)
#if !defined(WIN32) && !defined(Q_OS_MACX)
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACX)
#include <dlfcn.h>
#endif
#endif
@@ -291,7 +291,7 @@ void QgsPluginManager::savePluginState( QString id, bool state )
void QgsPluginManager::getCppPluginsMetadata()
{
QString sharedLibExtension;
#if defined(WIN32) || defined(__CYGWIN__)
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
sharedLibExtension = "*.dll";
#else
sharedLibExtension = "*.so*";
@@ -325,12 +325,12 @@ void QgsPluginManager::getCppPluginsMetadata()
QString lib = QString( "%1/%2" ).arg( myPluginDir ).arg( pluginDir[i] );

#ifdef TESTLIB
// This doesn't work on WIN32 and causes problems with plugins
// This doesn't work on windows and causes problems with plugins
// on OS X (the code doesn't cause a problem but including dlfcn.h
// renders plugins unloadable)
#if !defined(WIN32) && !defined(Q_OS_MACX)
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACX)
// test code to help debug loading problems
// This doesn't work on WIN32 and causes problems with plugins
// This doesn't work on windows and causes problems with plugins
// on OS X (the code doesn't cause a problem but including dlfcn.h
// renders plugins unloadable)

@@ -346,7 +346,7 @@ void QgsPluginManager::getCppPluginsMetadata()
QgsDebugMsg( "dlopen suceeded for " + lib );
dlclose( handle );
}
#endif //#ifndef WIN32 && Q_OS_MACX
#endif //#ifndef Q_OS_WIN && Q_OS_MACX
#endif //#ifdef TESTLIB

QgsDebugMsg( "Examining: " + lib );
@@ -219,7 +219,7 @@ void QgisAppStyleSheet::setActiveValues()
#else
mLinuxOS = false;
#endif
#ifdef Q_OS_WIN32
#ifdef Q_OS_WIN
mWinOS = true;
#else
mWinOS = false;
@@ -351,7 +351,7 @@ void QgsPluginRegistry::loadCppPlugin( QString theFullPathName )
QgsDebugMsg( QString( "plugin object name: %1" ).arg( o->objectName() ) );
if ( o->objectName().isEmpty() )
{
#ifndef WIN32
#ifndef Q_OS_WIN
baseName = baseName.mid( 3 );
#endif
QgsDebugMsg( QString( "object name to %1" ).arg( baseName ) );
@@ -449,7 +449,7 @@ void QgsPluginRegistry::restoreSessionPlugins( QString thePluginDirString )
{
QSettings mySettings;

#if defined(WIN32) || defined(__CYGWIN__)
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
QString pluginExt = "*.dll";
#elif ANDROID
QString pluginExt = "*plugin.so";
@@ -76,7 +76,7 @@ void QgsTicksScaleBarStyle::draw( QPainter* p, double xOffset ) const
if ( !segmentInfo.isEmpty() )
{
double lastTickPositionX = segmentInfo.last().first + mScaleBar->segmentMillimeters() + xOffset;
double verticalPos;
double verticalPos = 0.0;
switch ( mTickPosition )
{
case TicksDown:
@@ -203,21 +203,21 @@ class CORE_EXPORT QGis
*/
enum DataType
{
/*! Unknown or unspecified type */ UnknownDataType = 0,
/*! Eight bit unsigned integer (quint8) */ Byte = 1,
/*! Sixteen bit unsigned integer (quint16) */ UInt16 = 2,
/*! Sixteen bit signed integer (qint16) */ Int16 = 3,
/*! Thirty two bit unsigned integer (quint32) */ UInt32 = 4,
/*! Thirty two bit signed integer (qint32) */ Int32 = 5,
/*! Thirty two bit floating point (float) */ Float32 = 6,
/*! Sixty four bit floating point (double) */ Float64 = 7,
/*! Complex Int16 */ CInt16 = 8,
/*! Complex Int32 */ CInt32 = 9,
/*! Complex Float32 */ CFloat32 = 10,
/*! Complex Float64 */ CFloat64 = 11,
/*! Color, alpha, red, green, blue, 4 bytes the same as
/** Unknown or unspecified type */ UnknownDataType = 0,
/** Eight bit unsigned integer (quint8) */ Byte = 1,
/** Sixteen bit unsigned integer (quint16) */ UInt16 = 2,
/** Sixteen bit signed integer (qint16) */ Int16 = 3,
/** Thirty two bit unsigned integer (quint32) */ UInt32 = 4,
/** Thirty two bit signed integer (qint32) */ Int32 = 5,
/** Thirty two bit floating point (float) */ Float32 = 6,
/** Sixty four bit floating point (double) */ Float64 = 7,
/** Complex Int16 */ CInt16 = 8,
/** Complex Int32 */ CInt32 = 9,
/** Complex Float32 */ CFloat32 = 10,
/** Complex Float64 */ CFloat64 = 11,
/** Color, alpha, red, green, blue, 4 bytes the same as
QImage::Format_ARGB32 */ ARGB32 = 12,
/*! Color, alpha, red, green, blue, 4 bytes the same as
/** Color, alpha, red, green, blue, 4 bytes the same as
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied = 13
};

@@ -435,12 +435,12 @@ const double MINIMUM_POINT_SIZE = 0.1;
const double DEFAULT_POINT_SIZE = 2.0;
const double DEFAULT_LINE_WIDTH = 0.26;

/** default snapping tolerance for segments */
/** Default snapping tolerance for segments */
const double DEFAULT_SEGMENT_EPSILON = 1e-8;

typedef QMap<QString, QString> QgsStringMap;

/** qgssize is used instead of size_t, because size_t is stdlib type, unknown
/** Qgssize is used instead of size_t, because size_t is stdlib type, unknown
* by SIP, and it would be hard to define size_t correctly in SIP.
* Currently used "unsigned long long" was introduced in C++11 (2011)
* but it was supported already before C++11 on common platforms.
@@ -466,7 +466,7 @@ typedef unsigned long long qgssize;
#endif

#ifndef QGISEXTERN
#ifdef WIN32
#ifdef Q_OS_WIN
# define QGISEXTERN extern "C" __declspec( dllexport )
# ifdef _MSC_VER
// do not warn about C bindings returing QString
@@ -154,7 +154,7 @@ void QgsApplication::init( QString customConfigPath )
char *prefixPath = getenv( "QGIS_PREFIX_PATH" );
if ( !prefixPath )
{
#if defined(Q_OS_MACX) || defined(Q_OS_WIN32) || defined(WIN32)
#if defined(Q_OS_MACX) || defined(Q_OS_WIN)
setPrefixPath( applicationDirPath(), true );
#elif defined(ANDROID)
// this is "/data/data/org.qgis.qgis" in android
@@ -924,7 +924,7 @@ bool QgsApplication::createDB( QString *errorMessage )
myDir.mkpath( myPamPath ); //fail silently
}

#if defined(Q_OS_WIN32) || defined(WIN32)
#if defined(Q_OS_WIN)
CPLSetConfigOption( "GDAL_PAM_PROXY_DIR", myPamPath.toUtf8() );
#else
//under other OS's we use an environment var so the user can
@@ -783,7 +783,7 @@ bool QgsCoordinateTransform::writeXML( QDomNode & theNode, QDomDocument & theDoc
const char *finder( const char *name )
{
QString proj;
#ifdef WIN32
#ifdef Q_OS_WIN
proj = QApplication::applicationDirPath()
+ "/share/proj/" + QString( name );
#else
@@ -731,7 +731,9 @@ QgsDataCollectionItem::~QgsDataCollectionItem()

//-----------------------------------------------------------------------
// QVector<QgsDataProvider*> QgsDirectoryItem::mProviders = QVector<QgsDataProvider*>();
Q_NOWARN_DEPRECATED_PUSH
QVector<QLibrary*> QgsDirectoryItem::mLibraries = QVector<QLibrary*>();
Q_NOWARN_DEPRECATED_POP

QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, QString name, QString path )
: QgsDataCollectionItem( parent, name, path )
@@ -39,7 +39,7 @@
#include "qgslabel.h"

// use M_PI define PI 3.141592654
#ifdef WIN32
#ifdef Q_OS_WIN
#undef M_PI
#define M_PI 4*atan(1.0)
#endif
@@ -72,7 +72,7 @@ QgsProviderRegistry::QgsProviderRegistry( QString pluginPath )
mLibraryDirectory.setSorting( QDir::Name | QDir::IgnoreCase );
mLibraryDirectory.setFilter( QDir::Files | QDir::NoSymLinks );

#if defined(WIN32) || defined(__CYGWIN__)
#if defined(Q_OS_WIN) || defined(__CYGWIN__)
mLibraryDirectory.setNameFilters( QStringList( "*.dll" ) );
#elif ANDROID
mLibraryDirectory.setNameFilters( QStringList( "*provider.so" ) );
@@ -242,7 +242,7 @@ QgsProviderRegistry::~QgsProviderRegistry()
}


/** convenience function for finding any existing data providers that match "providerKey"
/** Convenience function for finding any existing data providers that match "providerKey"
Necessary because [] map operator will create a QgsProviderMetadata
instance. Also you cannot use the map [] operator in const members for that
@@ -46,7 +46,7 @@
#include "qwt5_histogram_item.h"
#endif

#ifdef WIN32
#ifdef Q_OS_WIN
#include <time.h>
#endif

@@ -75,7 +75,7 @@ void QgsHelpViewer::showHelp( QString help )
webView->setHtml( helpContents );
setWindowTitle( tr( "QGIS Help" ) );

#ifndef WIN32
#ifndef Q_OS_WIN
setWindowState( windowState() & ~Qt::WindowMinimized );
#endif
raise();
@@ -65,7 +65,7 @@ eVisDatabaseConnectionGui::eVisDatabaseConnectionGui( QList<QTemporaryFile*>* th
connect( mDatabaseLayerFieldSelector, SIGNAL( eVisDatabaseLayerFieldsSelected( QString, QString, QString ) ), this, SLOT( drawNewVectorLayer( QString, QString, QString ) ) );

//Populate gui components
#ifdef WIN32
#ifdef Q_OS_WIN
cboxDatabaseType->insertItem( 0, "MSAccess" );
#endif
cboxDatabaseType->insertItem( 0, "MYSQL" );
@@ -788,14 +788,14 @@ void GlobePlugin::setupProxy()
if ( !settings.value( "/proxyUser" ).toString().isEmpty() )
{
QString auth = settings.value( "/proxyUser" ).toString() + ":" + settings.value( "/proxyPassword" ).toString();
#ifdef WIN32
#ifdef Q_OS_WIN
putenv( QString( "OSGEARTH_CURL_PROXYAUTH=%1" ).arg( auth ).toAscii() );
#else
setenv( "OSGEARTH_CURL_PROXYAUTH", auth.toStdString().c_str(), 0 );
#endif
}
//TODO: settings.value("/proxyType")
//TODO: URL exlusions
//TODO: URL exclusions
HTTPClient::setProxySettings( proxySettings );
}
settings.endGroup();
@@ -72,7 +72,7 @@ QString QgsGrassModule::findExec( QString file )
QString path = getenv( "PATH" );
QgsDebugMsg( "path = " + path );

#ifdef WIN32
#ifdef Q_OS_WIN
mExecPath = path.split( ";" );
mExecPath.prepend( QgsGrass::shortPath( QgsApplication::applicationDirPath() ) );
#else
@@ -85,7 +85,7 @@ QString QgsGrassModule::findExec( QString file )
if ( QFile::exists( file ) )
return file; // full path

#ifdef WIN32
#ifdef Q_OS_WIN
// On windows try .bat first
for ( QStringList::iterator it = mExecPath.begin();
it != mExecPath.end(); ++it )
@@ -141,7 +141,7 @@ QStringList QgsGrassModule::execArguments( QString module )
return arguments;
}

#if defined(WIN32)
#ifdef Q_OS_WIN
if ( exe.endsWith( ".py" ) )
{
arguments.append( "python" );
@@ -213,7 +213,7 @@ QgsGrassModule::QgsGrassModule( QgsGrassTools *tools, QString moduleName, QgisIn
// but not all modules have to be binary (can be scripts)
// => test if the module is in path and if it is not
// add .exe and test again
#ifdef WIN32
#ifdef Q_OS_WIN
if ( inExecPath( xName ) )
{
mXName = xName;
@@ -749,7 +749,7 @@ void QgsGrassModuleStandardOptions::freezeOutput()
{
QgsDebugMsg( "called." );

#ifdef WIN32
#ifdef Q_OS_WIN
for ( unsigned int i = 0; i < mItems.size(); i++ )
{
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
@@ -824,7 +824,7 @@ void QgsGrassModuleStandardOptions::thawOutput()
{
QgsDebugMsg( "called." );

#ifdef WIN32
#ifdef Q_OS_WIN
for ( unsigned int i = 0; i < mItems.size(); i++ )
{
QgsGrassModuleOption *opt = dynamic_cast<QgsGrassModuleOption *>( mItems[i] );
@@ -1695,7 +1695,7 @@ void QgsGrassModule::run()
return;
}

#if defined(WIN32)
#ifdef Q_OS_WIN
// we already know it exists from execArguments()
QString exe = QgsGrassModule::findExec( mXName );
QFileInfo fi( exe );
@@ -1268,7 +1268,7 @@ void QgsGrassNewMapset::createMapset()
// database path
( void )QgsGrass::activeMode(); // because it calls private QgsGrass::init()

#if defined(WIN32)
#ifdef Q_OS_WIN
G__setenv(( char * ) "GISDBASE", QgsGrass::shortPath( mDatabaseLineEdit->text() ).toUtf8().data() );
#else
G__setenv(( char * ) "GISDBASE", mDatabaseLineEdit->text().toUtf8().data() );
@@ -173,7 +173,7 @@ void QgsGrassElementDialog::textChanged()
return;
}

#ifdef WIN32
#ifdef Q_OS_WIN
if ( !mSource.isNull() && text.toLower() == mSource.toLower() )
#else
if ( !mSource.isNull() && text == mSource )
@@ -201,7 +201,7 @@ static int cell_draw( char *name,
set = G_malloc( ncols );

/* some buggy C libraries require BOTH setmode() and fdopen(bin) */
#ifdef WIN32
#ifdef Q_OS_WIN
if ( _setmode( _fileno( stdout ), _O_BINARY ) == -1 )
G_fatal_error( "Cannot set stdout mode" );
#endif
@@ -19,7 +19,6 @@ extern "C"
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#ifdef WIN32
#include <fcntl.h>
#include <io.h>
@@ -93,7 +92,7 @@ int main( int argc, char **argv )

name = map->answer;

#ifdef Q_OS_WIN32
#ifdef Q_OS_WIN
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
//setvbuf( stdin, NULL, _IONBF, BUFSIZ );
@@ -176,9 +175,9 @@ int main( int argc, char **argv )
return 1;
}

qint32 *cell;
float *fcell;
double *dcell;
qint32 *cell = 0;
float *fcell = 0;
double *dcell = 0;
if ( grass_type == CELL_TYPE )
cell = ( qint32* ) byteArray.data();
else if ( grass_type == FCELL_TYPE )
@@ -134,7 +134,7 @@ int main( int argc, char **argv )
if ( G_parser( argc, argv ) )
exit( EXIT_FAILURE );

#ifdef Q_OS_WIN32
#ifdef Q_OS_WIN
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif

0 comments on commit fa46411

Please sign in to comment.
You can’t perform that action at this time.