From: Martin Willi Date: Mon, 14 Nov 2005 11:40:02 +0000 (-0000) Subject: - fixed bug in mapping_find X-Git-Tag: 4.0.0~543 X-Git-Url: https://git.strongswan.org/?p=strongswan.git;a=commitdiff_plain;h=346fd9f2711393966de12264229865d74a9e1b69 - fixed bug in mapping_find --- diff --git a/Source/charon/definitions.c b/Source/charon/definitions.c index a866cc5..4df8622 100644 --- a/Source/charon/definitions.c +++ b/Source/charon/definitions.c @@ -28,13 +28,13 @@ 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"; } diff --git a/Source/charon/definitions.h b/Source/charon/definitions.h index 7908990..8fe3c1c 100644 --- a/Source/charon/definitions.h +++ b/Source/charon/definitions.h @@ -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