diff options
author | David Tardon <dtardon@redhat.com> | 2018-04-26 14:41:09 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2018-04-27 07:39:15 +0200 |
commit | e0e8f5f60f9912cd2e12818cd1bc2eb6c3e1e75f (patch) | |
tree | 0fd006fc6ceae33c317dd931941ba3aa5f9f429b /writerperfect/source | |
parent | b00d6854f88bb9f071095c89bf2c6d4ded6b4ec6 (diff) |
replace a series of if/else if/ by a switch
Change-Id: I6319971e1a2a4bffa0466fa37a31beff5a349fd1
Reviewed-on: https://gerrit.libreoffice.org/53535
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'writerperfect/source')
-rw-r--r-- | writerperfect/source/calc/MSWorksCalcImportFilter.cxx | 36 | ||||
-rw-r--r-- | writerperfect/source/writer/MSWorksImportFilter.cxx | 26 |
2 files changed, 30 insertions, 32 deletions
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index 0972c97df84e..04dcffcdac48 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -388,29 +388,27 @@ bool MSWorksCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput if ((kind == libwps::WPS_SPREADSHEET || kind == libwps::WPS_DATABASE) && confidence != libwps::WPS_CONFIDENCE_NONE) { - if (creator == libwps::WPS_MSWORKS) - { - rTypeName = "calc_MS_Works_Document"; - return true; - } - if (creator == libwps::WPS_LOTUS || creator == libwps::WPS_SYMPHONY) - { - rTypeName = "calc_WPS_Lotus_Document"; - return true; - } - if (creator == libwps::WPS_QUATTRO_PRO) - { - rTypeName = "calc_WPS_QPro_Document"; - return true; - } - if (creator == libwps::WPS_RESERVED_2) + switch (creator) { - rTypeName = "calc_MS_Multiplan"; - return true; + case libwps::WPS_MSWORKS: + rTypeName = "calc_MS_Works_Document"; + break; + case libwps::WPS_LOTUS: + case libwps::WPS_SYMPHONY: + rTypeName = "calc_WPS_Lotus_Document"; + break; + case libwps::WPS_QUATTRO_PRO: + rTypeName = "calc_WPS_QPro_Document"; + break; + case libwps::WPS_RESERVED_2: + rTypeName = "calc_MS_Multiplan"; + break; + default: + break; } } - return false; + return !rTypeName.isEmpty(); } void MSWorksCalcImportFilter::doRegisterHandlers(OdsGenerator&) {} diff --git a/writerperfect/source/writer/MSWorksImportFilter.cxx b/writerperfect/source/writer/MSWorksImportFilter.cxx index c22474d190bc..4c2c86c5e787 100644 --- a/writerperfect/source/writer/MSWorksImportFilter.cxx +++ b/writerperfect/source/writer/MSWorksImportFilter.cxx @@ -98,23 +98,23 @@ bool MSWorksImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OU if ((kind == libwps::WPS_TEXT) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT)) { - if (creator == libwps::WPS_MSWORKS) + switch (creator) { - rTypeName = "writer_MS_Works_Document"; + case libwps::WPS_MSWORKS: + rTypeName = "writer_MS_Works_Document"; + break; + case libwps::WPS_RESERVED_0: + rTypeName = "writer_MS_Write"; + break; + case libwps::WPS_RESERVED_1: + rTypeName = "writer_DosWord"; + break; + default: + break; } - else if (creator == libwps::WPS_RESERVED_0) - { - rTypeName = "writer_MS_Write"; - } - else - { - rTypeName = "writer_DosWord"; - } - - return true; } - return false; + return !rTypeName.isEmpty(); } void MSWorksImportFilter::doRegisterHandlers(OdtGenerator& rGenerator) |