summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 20:02:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-08 10:17:00 +0200
commite9c327be8f0b4848e9f65687833ed89021907a6a (patch)
treee025e11930725049e9baa778199611763b163c51 /hwpfilter
parent8a84493d1fe92faefecbd3352f911632cbb0e324 (diff)
loplugin:flatten in hwpfilter
Change-Id: Ie3e970ec0fc761cf8a5e16ea72b7e95c28462234 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91846 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hstyle.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx
index e80a9c1a8b0d..e6f1e3999e07 100644
--- a/hwpfilter/source/hstyle.cxx
+++ b/hwpfilter/source/hstyle.cxx
@@ -67,24 +67,24 @@ char *HWPStyle::GetName(int n) const
void HWPStyle::SetName(int n, char const *name)
{
- if (n >= 0 && n < nstyles)
+ if (!(n >= 0 && n < nstyles))
+ return;
+
+ if (name)
{
- if (name)
- {
#if defined __GNUC__ && (__GNUC__ == 8 || __GNUC__ == 9) && !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
- auto const p = DATA[n].name;
- strncpy(p, name, MAXSTYLENAME);
- p[MAXSTYLENAME] = '\0'; // just in case, even though the array is zero-initialized
+ auto const p = DATA[n].name;
+ strncpy(p, name, MAXSTYLENAME);
+ p[MAXSTYLENAME] = '\0'; // just in case, even though the array is zero-initialized
#if defined __GNUC__ && (__GNUC__ == 8 || __GNUC__ == 9) && !defined __clang__
#pragma GCC diagnostic pop
#endif
- }
- else
- DATA[n].name[0] = 0;
}
+ else
+ DATA[n].name[0] = 0;
}