Bug 556739 – transfer-ownership attribute should be mandatory in .gir

2008-10-23  Tommi Komulainen  <tommi.komulainen@iki.fi>

	* girepository/girparser.c (parse_param_transfer):
	* giscanner/transformer.py (_create_parameter, _create_return):
	* giscanner/girwriter.py (_write_return, _write_parameter):
	* tools/generate.c (write_callable_info): always write and
	require "transfer-ownership" for return-values and parameters

	* tests/boxed.gir:
	* tests/invoke/testfns-1.0.gir:
	* tests/object.gir:
	* tests/scanner/DrawableAdditions.xml:
	* tests/scanner/GtkFrob-1.0-expected.tgir:
	* tests/scanner/annotation-1.0-expected.tgir:
	* tests/scanner/drawable-1.0-expected.tgir:
	* tests/scanner/drawable-injected-1.0-expected.gir:
	* tests/scanner/drawable-injected-1.0-expected.tgir:
	* tests/scanner/foo-1.0-expected.tgir: Updated

svn path=/trunk/; revision=797
This commit is contained in:
Tommi Komulainen 2008-10-23 17:42:25 +00:00 committed by Tommi Komulainen
parent bb2b5e1ee3
commit 2d0f1b3093

View File

@ -660,30 +660,28 @@ start_function (GMarkupParseContext *context,
static void
parse_param_transfer (GIrNodeParam *param, const gchar *transfer)
{
if (transfer && strcmp (transfer, "none") == 0)
if (transfer == NULL)
{
g_warning ("required attribute 'transfer-ownership' missing");
}
else if (strcmp (transfer, "none") == 0)
{
param->transfer = FALSE;
param->shallow_transfer = FALSE;
}
else if (transfer && strcmp (transfer, "container") == 0)
else if (strcmp (transfer, "container") == 0)
{
param->transfer = FALSE;
param->shallow_transfer = TRUE;
}
else if (strcmp (transfer, "full") == 0)
{
param->transfer = TRUE;
param->shallow_transfer = FALSE;
}
else
{
if (transfer)
{
if (strcmp (transfer, "full") != 0)
g_warning ("Unknown transfer %s", transfer);
else
param->transfer = TRUE;
}
else if (param->in && !param->out)
param->transfer = FALSE;
else
param->transfer = TRUE;
param->shallow_transfer = FALSE;
g_warning ("Unknown transfer-ownership value: %s", transfer);
}
}