[PATCH] Get rid of K&R style functions in sortshp.c
Petter Reinholdtsen
pere at HUNGRY.COM
Mon Jan 24 03:56:48 EST 2005
The code in sortshp.c uses K&R style functions without proper
prototypes. It is better to use ANSI C type prototypes to make sure
the compiler detect incorrect argument usage. This patch fixes the
problem for sortshp.c. Please include in a future version of
mapserver.
Index: sortshp.c
===================================================================
RCS file: /data2/cvsroot/mapserver/sortshp.c,v
retrieving revision 1.3
diff -u -r1.3 sortshp.c
--- sortshp.c 21 Oct 2004 04:30:55 -0000 1.3
+++ sortshp.c 24 Jan 2005 08:45:20 -0000
@@ -47,21 +47,21 @@
int index;
} sortStruct;
-static int compare_string_descending(i,j)
-sortStruct *i, *j;
+static int compare_string_descending(const void *a, const void *b)
{
+ const sortStruct *i = a, *j = b;
return(strcmp(j->string, i->string));
}
-static int compare_string_ascending(i,j)
-sortStruct *i, *j;
+static int compare_string_ascending(const void *a, const void *b)
{
+ const sortStruct *i = a, *j = b;
return(strcmp(i->string, j->string));
}
-static int compare_number_descending(i,j)
-sortStruct *i, *j;
+static int compare_number_descending(const void *a, const void *b)
{
+ const sortStruct *i = a, *j = b;
if(i->number > j->number)
return(-1);
if(i->number < j->number)
@@ -69,9 +69,9 @@
return(0);
}
-static int compare_number_ascending(i,j)
-sortStruct *i, *j;
+static int compare_number_ascending(const void *a, const void *b)
{
+ const sortStruct *i = a, *j = b;
if(i->number > j->number)
return(1);
if(i->number < j->number)
@@ -79,9 +79,7 @@
return(0);
}
-int main(argc,argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
{
SHPHandle inSHP,outSHP; /* ---- Shapefile file pointers ---- */
DBFHandle inDBF,outDBF; /* ---- DBF file pointers ---- */
More information about the mapserver-dev
mailing list