common: fix for when [] is in comment

This commit is contained in:
Jay Sorg 2013-04-25 00:19:14 -07:00
parent 1f1b6e8738
commit 8acdc403e3

View File

@ -242,8 +242,19 @@ l_file_read_section(int fd, int max_file_size, const char *section,
for (index = 0; index < len; index++) for (index = 0; index < len; index++)
{ {
if (!s_check_rem(s, 1))
{
break;
}
in_uint8(s, c); in_uint8(s, c);
if ((c == '#') || (c == ';'))
{
file_read_line(s, text);
in_it = 0;
in_it_index = 0;
g_memset(text, 0, 512);
continue;
}
if (c == '[') if (c == '[')
{ {
in_it = 1; in_it = 1;
@ -253,7 +264,6 @@ l_file_read_section(int fd, int max_file_size, const char *section,
if (g_strcasecmp(section, text) == 0) if (g_strcasecmp(section, text) == 0)
{ {
file_read_line(s, text); file_read_line(s, text);
while (file_read_line(s, text) == 0) while (file_read_line(s, text) == 0)
{ {
if (g_strlen(text) > 0) if (g_strlen(text) > 0)
@ -296,7 +306,6 @@ l_file_read_section(int fd, int max_file_size, const char *section,
} }
} }
} }
free_stream(s); free_stream(s);
return 1; return 1;
} }