[Libreoffice-commits] core.git: writerperfect/source
David Tardon
dtardon at redhat.com
Fri Apr 27 05:40:33 UTC 2018
writerperfect/source/calc/MSWorksCalcImportFilter.cxx | 36 ++++++++----------
writerperfect/source/writer/MSWorksImportFilter.cxx | 26 ++++++-------
2 files changed, 30 insertions(+), 32 deletions(-)
New commits:
commit e0e8f5f60f9912cd2e12818cd1bc2eb6c3e1e75f
Author: David Tardon <dtardon at redhat.com>
Date: Thu Apr 26 14:41:09 2018 +0200
replace a series of if/else if/ by a switch
Change-Id: I6319971e1a2a4bffa0466fa37a31beff5a349fd1
Reviewed-on: https://gerrit.libreoffice.org/53535
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: David Tardon <dtardon at redhat.com>
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)
More information about the Libreoffice-commits
mailing list