Skip to content

Commit

Permalink
Ported GRASS version.h workarounds from trunk.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6925 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 3, 2007
1 parent a39e6a7 commit 9f1b42c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/plugins/grass/qgsgrassnewmapset.cpp
Expand Up @@ -61,6 +61,16 @@
// For bug in GPJ_osr_to_grass()
#include "grass/version.h"

// Prevents some compiler warnings from the version.h include
#ifndef GRASS_VERSION_RELEASE
// When using newer version of GRASS (cvs >= 26.4.2007),
// these variables are #defined instead of being static variables.
QString temp1(GRASS_VERSION_STRING);
QString temp2(GRASS_VERSION_MAJOR);
QString temp3(GRASS_VERSION_MINOR);
QString temp4(GRASS_VERSION_RELEASE);
#endif

bool QgsGrassNewMapset::mRunning = false;

QgsGrassNewMapset::QgsGrassNewMapset ( QgisApp *qgisApp, QgisIface *iface,
Expand Down
25 changes: 25 additions & 0 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -979,13 +979,38 @@ bool QgsGrass::mapRegion( int type, QString gisbase,
return true;
}

// GRASS version constants have been changed on 26.4.2007
// http://freegis.org/cgi-bin/viewcvs.cgi/grass6/include/version.h.in.diff?r1=1.4&r2=1.5
// The following lines workaround this change

int QgsGrass::versionMajor()
{
#ifdef GRASS_VERSION_MAJOR
return GRASS_VERSION_MAJOR;
#else
return QString(GRASS_VERSION_MAJOR).toInt();
#endif
}
int QgsGrass::versionMinor()
{
#ifdef GRASS_VERSION_MINOR
return GRASS_VERSION_MINOR;
#else
return QString(GRASS_VERSION_MINOR).toInt();
#endif
}
int QgsGrass::versionRelease()
{
#ifdef GRASS_VERSION_RELEASE
#define QUOTE(x) #x
return QString(QUOTE(GRASS_VERSION_RELEASE)).toInt();
#else
return QString(GRASS_VERSION_RELEASE).toInt();
#endif
}
QString QgsGrass::versionString()
{
return QString(GRASS_VERSION_STRING);
}

bool QgsGrass::isMapset ( QString path )
Expand Down
2 changes: 2 additions & 0 deletions src/providers/grass/qgsgrass.h
Expand Up @@ -149,6 +149,8 @@ class QgsGrass {
//! Library version
static int versionMajor();
static int versionMinor();
static int versionRelease();
static QString versionString();

private:
static int initialized; // Set to 1 after initialization
Expand Down

0 comments on commit 9f1b42c

Please sign in to comment.