mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
[GRASS] prepared off_t fix on windows
This commit is contained in:
parent
c41852649c
commit
d896c01393
@ -71,6 +71,30 @@ extern "C"
|
||||
#undef __STDC__
|
||||
#endif
|
||||
|
||||
// Vect_rewrite_line and Vect_delete_line use int in GRASS 6 and off_t in GRASS 7 for line id argument.
|
||||
// off_t size is not specified by C, POSIX specifies it as signed integer and its size depends on compiler.
|
||||
// In OSGeo4W 32bit the off_t size is 8 bytes in GRASS (compiled with MinGW), and 4 bytes QGIS (compiled with MSVC), which is causing crashes.
|
||||
// The problem with off_t size was also reported for custom build of QGIS on Xubuntu 14.04 LTS using GRASS 7.0.1-2~ubuntu14.04.1.
|
||||
// See: https://lists.osgeo.org/pipermail/grass-dev/2015-June/075539.html
|
||||
// https://lists.osgeo.org/pipermail/grass-dev/2015-September/076338.html
|
||||
// TODO: get real off_t size from GRASS, probably contribute a patch which will save 'g.version -g' to a header file during compilation
|
||||
#if GRASS_VERSION_MAJOR < 7
|
||||
typedef int Vect_rewrite_line_function_type( struct Map_info *, int, int, struct line_pnts *, struct line_cats * );
|
||||
typedef int Vect_delete_line_function_type( struct Map_info *, int );
|
||||
#else
|
||||
#ifdef Q_OS_WIN
|
||||
// TODO: switch to qint64 and compile with msvc (expected comilation error or warning)
|
||||
typedef off_t grass_off_t;
|
||||
//typedef qint64 grass_off_t;
|
||||
#else
|
||||
typedef off_t grass_off_t;
|
||||
#endif
|
||||
typedef off_t Vect_rewrite_line_function_type( struct Map_info *, grass_off_t, int, const struct line_pnts *, const struct line_cats * );
|
||||
typedef int Vect_delete_line_function_type( struct Map_info *, grass_off_t );
|
||||
#endif
|
||||
Vect_rewrite_line_function_type *Vect_rewrite_line_function_pointer = Vect_rewrite_line;
|
||||
Vect_delete_line_function_type *Vect_delete_line_function_pointer = Vect_delete_line;
|
||||
|
||||
static QString GRASS_KEY = "grass";
|
||||
|
||||
QgsGrassProvider::QgsGrassProvider( QString uri )
|
||||
@ -748,7 +772,7 @@ int QgsGrassProvider::rewriteLine( int oldLid, int type, struct line_pnts *Point
|
||||
int newLid = -1;
|
||||
G_TRY
|
||||
{
|
||||
newLid = Vect_rewrite_line( map(), oldLid, type, Points, Cats );
|
||||
newLid = Vect_rewrite_line_function_pointer( map(), oldLid, type, Points, Cats );
|
||||
|
||||
// oldLids are maping to the very first, original version (used by undo)
|
||||
int oldestLid = oldLid;
|
||||
@ -778,7 +802,7 @@ int QgsGrassProvider::deleteLine( int line )
|
||||
if ( !isEdited() )
|
||||
return -1;
|
||||
|
||||
return ( Vect_delete_line( map(), line ) );
|
||||
return ( Vect_delete_line_function_pointer( map(), line ) );
|
||||
}
|
||||
|
||||
int QgsGrassProvider::findLine( double x, double y, int type, double threshold )
|
||||
|
Loading…
x
Reference in New Issue
Block a user