QIBusEngineDesc: initialize all members when deserializing from older versions

De-duplicated code using, as suggested in
previous review, strategic gotos.

Change-Id: I4550dd8eff99789a41d8bb0b015bc4f51e3969fe
Reviewed-by: Takao Fujiwara <takao.fujiwara1@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
bb10
Marc Mutz 2016-02-28 12:24:15 +01:00
parent adb377c89e
commit 5bc54c878f
1 changed files with 21 additions and 17 deletions

View File

@ -346,30 +346,34 @@ void QIBusEngineDesc::deserializeFrom(const QDBusArgument &argument)
argument >> setup;
// Previous IBusEngineDesc supports the arguments between engine_name
// and setup.
if (argument.currentSignature() == "") {
argument.endStructure();
return;
}
if (argument.currentSignature() == "")
goto olderThanV2;
argument >> layout_variant;
argument >> layout_option;
// Previous IBusEngineDesc supports the arguments between engine_name
// and layout_option.
if (argument.currentSignature() == "") {
argument.endStructure();
return;
}
if (argument.currentSignature() == "")
goto olderThanV3;
argument >> version;
if (argument.currentSignature() == "") {
argument.endStructure();
return;
}
if (argument.currentSignature() == "")
goto olderThanV4;
argument >> textdomain;
if (argument.currentSignature() == "") {
argument.endStructure();
return;
}
if (argument.currentSignature() == "")
goto olderThanV5;
argument >> iconpropkey;
// <-- insert new member streaming here (1/2)
goto newest;
olderThanV2:
layout_variant.clear();
layout_option.clear();
olderThanV3:
version.clear();
olderThanV4:
textdomain.clear();
olderThanV5:
iconpropkey.clear();
// <-- insert new members here (2/2)
newest:
argument.endStructure();
}