Skip to content

Commit

Permalink
Fix MSVC warnings in programs and Python mapscript
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Jan 17, 2020
1 parent 5a48283 commit 113e847
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions mapscript/python/pyextend.i
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ def fromstring(data, mappath=None):
}

int setLayerOrder(PyObject *order) {
int i, size;
size = PyTuple_Size(order);
int i;
Py_ssize_t size = PyTuple_Size(order);
for (i = 0; i < size; i++) {
self->layerorder[i] = (int)PyInt_AsLong(PyTuple_GetItem(order, i));
}
Expand Down
4 changes: 2 additions & 2 deletions mapscript/python/pymodule.i
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
PyErr_SetString(PyExc_TypeError, "not a sequence");
SWIG_fail;
}
$1 = PySequence_Size($input);
$1 = (int) PySequence_Size($input);
$2 = (double*) malloc($1*sizeof(double));
for( i = 0; i<$1; i++ ) {
PyObject *o = PySequence_GetItem($input,i);
Expand Down Expand Up @@ -100,7 +100,7 @@ CreateTupleFromDoubleArray( double *first, unsigned int size ) {
if (PyDict_Check($input)) {

int i = 0;
int size = PyDict_Size($input);
int size = (int) PyDict_Size($input);

PyObject* keys = PyDict_Keys($input);
PyObject* values = PyDict_Values($input);
Expand Down
14 changes: 10 additions & 4 deletions mapserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/

#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 500 // for putenv
#endif

#include "mapserver-config.h"
#include <stdlib.h>

#ifdef USE_FASTCGI
#define NO_FCGI_DEFINES
#include "fcgi_stdio.h"
Expand All @@ -41,7 +48,6 @@
#endif



/************************************************************************/
/* FastCGI cleanup functions. */
/************************************************************************/
Expand Down Expand Up @@ -73,7 +79,7 @@ void msCleanupOnExit( void )
fprintf( fp_out, "In msCleanupOnExit\n" );
fclose( fp_out );
#endif
msCleanup(1);
msCleanup();
}
#endif

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

{
return FCGI_fread( data, 1, byteCount, (FCGI_FILE *) cbData );
return (int) FCGI_fread( data, 1, byteCount, (FCGI_FILE *) cbData );
}

/************************************************************************/
Expand All @@ -100,7 +106,7 @@ static int msIO_fcgiRead( void *cbData, void *data, int byteCount )
static int msIO_fcgiWrite( void *cbData, void *data, int byteCount )

{
return FCGI_fwrite( data, 1, byteCount, (FCGI_FILE *) cbData );
return (int) FCGI_fwrite( data, 1, byteCount, (FCGI_FILE *) cbData );
}

/************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion shptree.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ char* AddFileSuffix ( const char * Filename, const char * Suffix )
/* -------------------------------------------------------------------- */
pszBasename = (char *) msSmallMalloc(strlen(Filename)+5);
strcpy( pszBasename, Filename );
for( i = strlen(pszBasename)-1;
for( i = (int)strlen(pszBasename)-1;
i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
&& pszBasename[i] != '\\';
i-- ) {}
Expand Down
2 changes: 1 addition & 1 deletion shptreetst.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ char* AddFileSuffix ( const char * Filename, const char * Suffix )
/* -------------------------------------------------------------------- */
pszBasename = (char *) msSmallMalloc(strlen(Filename)+5);
strcpy( pszBasename, Filename );
for( i = strlen(pszBasename)-1;
for( i = (int)strlen(pszBasename)-1;
i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
&& pszBasename[i] != '\\';
i-- ) {}
Expand Down
2 changes: 1 addition & 1 deletion sortshp.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int main(int argc, char *argv[])

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

0 comments on commit 113e847

Please sign in to comment.