[Libreoffice-commits] core.git: hwpfilter/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 8 08:17:34 UTC 2020
hwpfilter/source/hstyle.cxx | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
New commits:
commit e9c327be8f0b4848e9f65687833ed89021907a6a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Apr 7 20:02:36 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 8 10:17:00 2020 +0200
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 at collabora.co.uk>
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;
}
More information about the Libreoffice-commits
mailing list