[mapserver-commits] r10693 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri Oct 29 20:14:26 EDT 2010


Author: warmerdam
Date: 2010-10-29 17:14:26 -0700 (Fri, 29 Oct 2010)
New Revision: 10693

Modified:
   trunk/mapserver/mapogroutput.c
Log:
sort files for dependable ordering in autotests (#3570)

Modified: trunk/mapserver/mapogroutput.c
===================================================================
--- trunk/mapserver/mapogroutput.c	2010-10-30 00:13:46 UTC (rev 10692)
+++ trunk/mapserver/mapogroutput.c	2010-10-30 00:14:26 UTC (rev 10693)
@@ -99,12 +99,35 @@
 {
     char **file_list;
     char **result_list = NULL;
-    int i;
+    int i, count, change;
 
     file_list = CPLReadDir( path );
+    count = CSLCount(file_list);
 
-    for( i = 0; file_list != NULL && file_list[i] != NULL; i++ )
+/* -------------------------------------------------------------------- */
+/*      Sort the file list so we always get them back in the same       */
+/*      order - it makes autotests more stable.                         */
+/* -------------------------------------------------------------------- */
+    do
     {
+        change = 0;
+        for( i = 0; i < count-1; i++ )
+        {
+            if( strcasecmp(file_list[i],file_list[i+1]) > 0 )
+            {
+                char *temp = file_list[i];
+                file_list[i] = file_list[i+1];
+                file_list[i+1] = temp;
+                change = 1;
+            }
+        }
+    } while( change );
+
+/* -------------------------------------------------------------------- */
+/*      collect names we want and process subdirectories.               */
+/* -------------------------------------------------------------------- */
+    for( i = 0; i < count; i++ )
+    {
         char full_filename[MS_MAXPATHLEN];
         VSIStatBufL  sStatBuf;
 



More information about the mapserver-commits mailing list