@@ -639,7 +639,7 @@ void setMSSQL2008LayerInfo(layerObj *layer, msMSSQL2008LayerInfo *MSSQL2008layer
639
639
void handleSQLError (layerObj * layer )
640
640
{
641
641
SQLCHAR SqlState [6 ], Msg [SQL_MAX_MESSAGE_LENGTH ];
642
- SQLLEN NativeError ;
642
+ SQLINTEGER NativeError ;
643
643
SQLSMALLINT i , MsgLen ;
644
644
SQLRETURN rc ;
645
645
msMSSQL2008LayerInfo * layerinfo = getMSSQL2008LayerInfo (layer );
@@ -662,7 +662,7 @@ void handleSQLError(layerObj *layer)
662
662
/* dont send in empty strings or strings with just " " in them! */
663
663
static char * removeWhite (char * str )
664
664
{
665
- int initial ;
665
+ size_t initial ;
666
666
char * orig , * loc ;
667
667
668
668
initial = strspn (str , " " );
@@ -690,10 +690,10 @@ static char *strstrIgnoreCase(const char *haystack, const char *needle)
690
690
{
691
691
char * hay_lower ;
692
692
char * needle_lower ;
693
- int len_hay ,len_need ;
693
+ size_t len_hay ,len_need , match ;
694
+ int found = -1 ;
694
695
int t ;
695
696
char * loc ;
696
- int match = -1 ;
697
697
698
698
len_hay = strlen (haystack );
699
699
len_need = strlen (needle );
@@ -715,12 +715,13 @@ static char *strstrIgnoreCase(const char *haystack, const char *needle)
715
715
loc = strstr (hay_lower , needle_lower );
716
716
if (loc ) {
717
717
match = loc - hay_lower ;
718
+ found = 1 ;
718
719
}
719
720
720
721
msFree (hay_lower );
721
722
msFree (needle_lower );
722
723
723
- return (char * ) (match < 0 ? NULL : haystack + match );
724
+ return (char * ) (found < 0 ? NULL : haystack + match );
724
725
}
725
726
726
727
static int msMSSQL2008LayerParseData (layerObj * layer , char * * geom_column_name , char * * geom_column_type , char * * table_name , char * * urid_name , char * * user_srid , char * * index_name , char * * sort_spec , int debug );
@@ -759,7 +760,7 @@ static void setConnError(msODBCconn *conn)
759
760
}
760
761
761
762
/* Connect to db */
762
- static msODBCconn * mssql2008Connect (const char * connString )
763
+ static msODBCconn * mssql2008Connect (char * connString )
763
764
{
764
765
SQLCHAR outConnString [1024 ];
765
766
SQLSMALLINT outConnStringLen ;
@@ -906,7 +907,7 @@ static int columnName(msODBCconn *conn, int index, char *buffer, int bufferLengt
906
907
}
907
908
908
909
if ( columnSize > 0 )
909
- sprintf ( gml_width , "%d " , columnSize );
910
+ sprintf ( gml_width , "%u " , ( unsigned int ) columnSize );
910
911
911
912
snprintf ( md_item_name , sizeof (md_item_name ), "gml_%s_type" , buffer );
912
913
if ( msOWSLookupMetadata (& (layer -> metadata ), "G" , "type" ) == NULL )
@@ -1352,7 +1353,6 @@ static int prepare_database(layerObj *layer, rectObj rect, char **query_string)
1352
1353
int t ;
1353
1354
1354
1355
char * pos_from , * pos_ftab , * pos_space , * pos_paren ;
1355
- rectObj extent ;
1356
1356
int hasFilter = MS_FALSE ;
1357
1357
1358
1358
layerinfo = getMSSQL2008LayerInfo (layer );
@@ -2289,7 +2289,7 @@ int msMSSQL2008LayerGetShapeRandom(layerObj *layer, shapeObj *shape, long *recor
2289
2289
2290
2290
if (layerinfo -> geometry_format == MSSQLGEOMETRY_NATIVE ) {
2291
2291
layerinfo -> gpi .pszData = (unsigned char * )wkbBuffer ;
2292
- layerinfo -> gpi .nLen = retLen ;
2292
+ layerinfo -> gpi .nLen = ( int ) retLen ;
2293
2293
2294
2294
if (!ParseSqlGeometry (layerinfo , shape )) {
2295
2295
switch (layer -> type ) {
@@ -2559,7 +2559,7 @@ int msMSSQL2008LayerGetShapeCount(layerObj *layer, rectObj rect, projectionObj *
2559
2559
{
2560
2560
// If we cannot guess the EPSG code of the rectProjection, fallback on slow implementation
2561
2561
if (rectProjection -> numargs < 1 ||
2562
- strncasecmp (rectProjection -> args [0 ], "init=epsg:" , strlen ("init=epsg:" )) != 0 )
2562
+ strncasecmp (rectProjection -> args [0 ], "init=epsg:" , ( int ) strlen ("init=epsg:" )) != 0 )
2563
2563
{
2564
2564
if (layer -> debug ) {
2565
2565
msDebug ("msMSSQL2008LayerGetShapeCount(): cannot find EPSG code of rectProjection. Falling back on client-side feature count.\n" );
@@ -2655,9 +2655,9 @@ int msMSSQL2008LayerGetItems(layerObj *layer)
2655
2655
{
2656
2656
msMSSQL2008LayerInfo * layerinfo ;
2657
2657
char * sql = NULL ;
2658
- int t , sqlSize ;
2658
+ size_t sqlSize ;
2659
2659
char found_geom = 0 ;
2660
- int item_num ;
2660
+ int t , item_num ;
2661
2661
SQLSMALLINT cols = 0 ;
2662
2662
const char * value ;
2663
2663
/*
@@ -2826,7 +2826,7 @@ int msMSSQL2008LayerRetrievePK(layerObj *layer, char **urid_name, char* table_na
2826
2826
static int msMSSQL2008LayerParseData (layerObj * layer , char * * geom_column_name , char * * geom_column_type , char * * table_name , char * * urid_name , char * * user_srid , char * * index_name , char * * sort_spec , int debug )
2827
2827
{
2828
2828
char * pos_opt , * pos_scn , * tmp , * pos_srid , * pos_urid , * pos_geomtype , * pos_geomtype2 , * pos_indexHint , * data , * pos_order ;
2829
- int slength ;
2829
+ size_t slength ;
2830
2830
2831
2831
data = msStrdup (layer -> data );
2832
2832
/* replace tabs with spaces */
@@ -2965,7 +2965,7 @@ char *msMSSQL2008LayerEscapePropertyName(layerObj *layer, const char* pszString)
2965
2965
int i , j = 0 ;
2966
2966
2967
2967
if (pszString && strlen (pszString ) > 0 ) {
2968
- int nLength = strlen (pszString );
2968
+ size_t nLength = strlen (pszString );
2969
2969
2970
2970
pszEscapedStr = (char * ) msSmallMalloc ( 1 + nLength + 1 + 1 );
2971
2971
pszEscapedStr [j ++ ] = '[' ;
0 commit comments