Fix some warnings in lwip bertos implementation
[bertos.git] / bertos / mware / ini_reader.c
index d16c41a31bb387a72930d18d3a2200c52d591eea..2f1e3abedd4b6a060ea671ea8a2f5480bfd43c86 100644 (file)
@@ -65,7 +65,11 @@ static int findSection(KFile *fd, const char *section, size_t section_len, char
                        continue;
 
                /* did we find the correct section? */
+#if CONFIG_INI_CASE_INSENSITIVE
+               if(strncasecmp(&line[1], section, section_len))
+#else
                if(strncmp(&line[1], section, section_len))
+#endif
                        continue;
                else
                        return 0;
@@ -79,10 +83,10 @@ static int findSection(KFile *fd, const char *section, size_t section_len, char
 static char *getKey(const char *line, char *key, size_t size)
 {
        /* null-terminated string */
-       while (isspace(*line))
+       while (isspace((unsigned char)*line))
                ++line;
        int i = 0;
-       while (*line != '=' && !isspace(*line) && size)
+       while (*line != '=' && !isspace((unsigned char)*line) && size)
        {
                key[i++] = *line;
                ++line;
@@ -99,7 +103,7 @@ static char *getValue(const char *line, char *value, size_t size)
 {
        while (*line++ != '=')
                ;
-       while (isspace(*line))
+       while (isspace((unsigned char)*line))
                ++line;
        int i = 0;
        while (*line && size)
@@ -127,7 +131,11 @@ static int findKey(KFile *fd, const char *key, char *line, size_t size)
                char curr_key[30];
                getKey(line, curr_key, 30);
                /* check key */
+#if CONFIG_INI_CASE_INSENSITIVE
+               if (!strcasecmp(curr_key, key))
+#else
                if (!strcmp(curr_key, key))
+#endif
                        return 0;
        }
        while (err != EOF && *line != '[');