Skip to content

Commit 113e847

Browse files
committed
Fix MSVC warnings in programs and Python mapscript
1 parent 5a48283 commit 113e847

6 files changed

Lines changed: 17 additions & 11 deletions

File tree

mapscript/python/pyextend.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ def fromstring(data, mappath=None):
255255
}
256256

257257
int setLayerOrder(PyObject *order) {
258-
int i, size;
259-
size = PyTuple_Size(order);
258+
int i;
259+
Py_ssize_t size = PyTuple_Size(order);
260260
for (i = 0; i < size; i++) {
261261
self->layerorder[i] = (int)PyInt_AsLong(PyTuple_GetItem(order, i));
262262
}

mapscript/python/pymodule.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
PyErr_SetString(PyExc_TypeError, "not a sequence");
4040
SWIG_fail;
4141
}
42-
$1 = PySequence_Size($input);
42+
$1 = (int) PySequence_Size($input);
4343
$2 = (double*) malloc($1*sizeof(double));
4444
for( i = 0; i<$1; i++ ) {
4545
PyObject *o = PySequence_GetItem($input,i);
@@ -100,7 +100,7 @@ CreateTupleFromDoubleArray( double *first, unsigned int size ) {
100100
if (PyDict_Check($input)) {
101101

102102
int i = 0;
103-
int size = PyDict_Size($input);
103+
int size = (int) PyDict_Size($input);
104104

105105
PyObject* keys = PyDict_Keys($input);
106106
PyObject* values = PyDict_Values($input);

mapserv.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@
2626
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2727
* DEALINGS IN THE SOFTWARE.
2828
****************************************************************************/
29+
30+
#ifndef _XOPEN_SOURCE
31+
#define _XOPEN_SOURCE 500 // for putenv
32+
#endif
33+
2934
#include "mapserver-config.h"
35+
#include <stdlib.h>
36+
3037
#ifdef USE_FASTCGI
3138
#define NO_FCGI_DEFINES
3239
#include "fcgi_stdio.h"
@@ -41,7 +48,6 @@
4148
#endif
4249

4350

44-
4551
/************************************************************************/
4652
/* FastCGI cleanup functions. */
4753
/************************************************************************/
@@ -73,7 +79,7 @@ void msCleanupOnExit( void )
7379
fprintf( fp_out, "In msCleanupOnExit\n" );
7480
fclose( fp_out );
7581
#endif
76-
msCleanup(1);
82+
msCleanup();
7783
}
7884
#endif
7985

@@ -88,7 +94,7 @@ void msCleanupOnExit( void )
8894
static int msIO_fcgiRead( void *cbData, void *data, int byteCount )
8995

9096
{
91-
return FCGI_fread( data, 1, byteCount, (FCGI_FILE *) cbData );
97+
return (int) FCGI_fread( data, 1, byteCount, (FCGI_FILE *) cbData );
9298
}
9399

94100
/************************************************************************/
@@ -100,7 +106,7 @@ static int msIO_fcgiRead( void *cbData, void *data, int byteCount )
100106
static int msIO_fcgiWrite( void *cbData, void *data, int byteCount )
101107

102108
{
103-
return FCGI_fwrite( data, 1, byteCount, (FCGI_FILE *) cbData );
109+
return (int) FCGI_fwrite( data, 1, byteCount, (FCGI_FILE *) cbData );
104110
}
105111

106112
/************************************************************************/

shptree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ char* AddFileSuffix ( const char * Filename, const char * Suffix )
4444
/* -------------------------------------------------------------------- */
4545
pszBasename = (char *) msSmallMalloc(strlen(Filename)+5);
4646
strcpy( pszBasename, Filename );
47-
for( i = strlen(pszBasename)-1;
47+
for( i = (int)strlen(pszBasename)-1;
4848
i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
4949
&& pszBasename[i] != '\\';
5050
i-- ) {}

shptreetst.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ char* AddFileSuffix ( const char * Filename, const char * Suffix )
5555
/* -------------------------------------------------------------------- */
5656
pszBasename = (char *) msSmallMalloc(strlen(Filename)+5);
5757
strcpy( pszBasename, Filename );
58-
for( i = strlen(pszBasename)-1;
58+
for( i = (int)strlen(pszBasename)-1;
5959
i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
6060
&& pszBasename[i] != '\\';
6161
i-- ) {}

sortshp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
131131

132132
for(i=0; i<num_fields; i++) {
133133
msDBFGetFieldInfo(inDBF,i,fName,NULL,NULL);
134-
if(strncasecmp(argv[3],fName,strlen(argv[3])) == 0) { /* ---- Found it ---- */
134+
if(strncasecmp(argv[3],fName,(int)strlen(argv[3])) == 0) { /* ---- Found it ---- */
135135
fieldNumber = i;
136136
break;
137137
}

0 commit comments

Comments
 (0)