summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-02-28 12:24:15 +0100
committerMarc Mutz <marc.mutz@kdab.com>2016-03-10 22:42:40 +0000
commit5bc54c878f012e7a2569c2e3cee87be90a38af21 (patch)
treefa13dd28d7fb1eab8f2fcb06842465c049435b39 /src/plugins
parentadb377c89eac50f8de60c0eb363a37de3301d79d (diff)
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>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibustypes.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
index 9462bad335..cc62fef6bb 100644
--- a/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibustypes.cpp
@@ -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();
}