changeset 1837:2bf364642f2e

Improve request parsing to allow "no maps specified".
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 31 Oct 2017 19:41:38 +0200
parents 054e96461c34
children 2d96e2d518d2
files mapsearch.c
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mapsearch.c	Tue Oct 31 18:59:21 2017 +0200
+++ b/mapsearch.c	Tue Oct 31 19:41:38 2017 +0200
@@ -673,23 +673,25 @@
 
         // Check against map list
         if (offs2 > offs)
-        for (int nmap = 0; nmap < optNMaps && !found; nmap++)
         {
-            const char *name = optMaps[nmap].locFile.continent;
-            const size_t slen = strlen(name);
-
-            if (offs2 >= offs + slen && memcmp(data + offs, name, slen) == 0)
+            for (int nmap = 0; nmap < optNMaps && !found; nmap++)
             {
-                mapList[nmap] = TRUE;
-                nmapList++;
-                found = TRUE;
+                const char *name = optMaps[nmap].locFile.continent;
+                const size_t slen = strlen(name);
+
+                if (offs2 >= offs + slen && memcmp(data + offs, name, slen) == 0)
+                {
+                    mapList[nmap] = TRUE;
+                    nmapList++;
+                    found = TRUE;
+                }
             }
-        }
 
-        if (!found)
-        {
-            *verr = "Unknown map spec.";
-            goto out;
+            if (!found)
+            {
+                *verr = "Unknown map spec.";
+                goto out;
+            }
         }
 
         // Check for separator or end