mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-21 22:59:16 +02:00
Add 3 new restrictions to the schema compiler
- can not extend schemas that already have paths - can not form list of schemas that already have paths - the path of a list schema, if given, must end with ':/'
This commit is contained in:
parent
7777dd2c39
commit
f8cb2a60b9
@ -1055,7 +1055,9 @@ parse_state_start_schema (ParseState *state,
|
|||||||
|
|
||||||
if (list_of)
|
if (list_of)
|
||||||
{
|
{
|
||||||
if (!g_hash_table_lookup (state->schema_table, list_of))
|
SchemaState *tmp;
|
||||||
|
|
||||||
|
if (!(tmp = g_hash_table_lookup (state->schema_table, list_of)))
|
||||||
{
|
{
|
||||||
g_set_error (error, G_MARKUP_ERROR,
|
g_set_error (error, G_MARKUP_ERROR,
|
||||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||||
@ -1063,10 +1065,24 @@ parse_state_start_schema (ParseState *state,
|
|||||||
"existing schema '%s'"), id, list_of);
|
"existing schema '%s'"), id, list_of);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tmp->path)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||||
|
_("Can not be a list of a schema with a path"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extends)
|
if (extends)
|
||||||
{
|
{
|
||||||
|
if (extends->path)
|
||||||
|
{
|
||||||
|
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||||
|
_("Can not extend a schema with a path"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (list_of)
|
if (list_of)
|
||||||
{
|
{
|
||||||
if (extends->list_of == NULL)
|
if (extends->list_of == NULL)
|
||||||
@ -1104,6 +1120,13 @@ parse_state_start_schema (ParseState *state,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path && list_of && !g_str_has_suffix (path, ":/"))
|
||||||
|
{
|
||||||
|
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||||
|
_("the path of a list must end with ':/'"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
state->schema_state = schema_state_new (path, gettext_domain,
|
state->schema_state = schema_state_new (path, gettext_domain,
|
||||||
extends, extends_name, list_of);
|
extends, extends_name, list_of);
|
||||||
g_hash_table_insert (state->schema_table, g_strdup (id),
|
g_hash_table_insert (state->schema_table, g_strdup (id),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user