- fixed bug in mapping_find
authorMartin Willi <martin@strongswan.org>
Mon, 14 Nov 2005 11:40:02 +0000 (11:40 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 14 Nov 2005 11:40:02 +0000 (11:40 -0000)
Source/charon/definitions.c
Source/charon/definitions.h

index a866cc5..4df8622 100644 (file)
 char *mapping_find(mapping_t * maps, int value)
 {
        int i = 0;
-       while (maps[i].value > MAPPING_END)
+       while (maps[i].value != MAPPING_END)
        {
-               i++;
                if (maps[i].value == value)
                {
                        return maps[i].string;
                }
+               i++;
        }
        return "INVALID MAPPING";
 }
index 7908990..8fe3c1c 100644 (file)
@@ -24,7 +24,7 @@
 #define DEFINITIONS_H_
 
 
-#define MAPPING_END -1
+#define MAPPING_END (-1)
 
 /**
  * @brief mapping entry, where enum-to-string mappings are stored