dbus/bus desktop-file.c,1.10,1.11
John Palmieri
johnp at freedesktop.org
Wed Nov 30 12:14:32 PST 2005
Update of /cvs/dbus/dbus/bus
In directory gabe:/tmp/cvs-serv12982/bus
Modified Files:
desktop-file.c
Log Message:
* bus/desktop-file.c (parse_key_value): Ignore locales allowing
the parser to continue instead of returning error
(bus_desktop_file_load): Do not free parser data when
parse_section_start or parse_key_value fails because it was
already freed by parser_free (patch from Carlos Garcia Campos
<carlosgc at gnome.org>)
Index: desktop-file.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/desktop-file.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- desktop-file.c 10 Aug 2004 03:06:59 -0000 1.10
+++ desktop-file.c 30 Nov 2005 20:14:30 -0000 1.11
@@ -460,7 +460,7 @@
if (!_dbus_string_find (&parser->data, parser->pos, "\n", &line_end))
line_end = parser->len;
-
+
p = parser->pos;
key_start = p;
while (p < line_end &&
@@ -476,6 +476,17 @@
}
/* We ignore locales for now */
+ if (p < line_end && _dbus_string_get_byte (&parser->data, p) == '[')
+ {
+ if (line_end == parser->len)
+ parser->pos = parser->len;
+ else
+ parser->pos = line_end + 1;
+
+ parser->line_num += 1;
+
+ return TRUE;
+ }
/* Skip space before '=' */
while (p < line_end && _dbus_string_get_byte (&parser->data, p) == ' ')
@@ -647,14 +658,13 @@
parser.pos = 0;
parser.len = _dbus_string_get_length (&parser.data);
parser.current_section = -1;
-
+
while (parser.pos < parser.len)
{
if (_dbus_string_get_byte (&parser.data, parser.pos) == '[')
{
if (!parse_section_start (&parser, error))
{
- _dbus_string_free (&parser.data);
return NULL;
}
}
@@ -665,7 +675,6 @@
{
if (!parse_key_value (&parser, error))
{
- _dbus_string_free (&parser.data);
return NULL;
}
}
More information about the dbus-commit
mailing list