From e9c327be8f0b4848e9f65687833ed89021907a6a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 7 Apr 2020 20:02:36 +0200 Subject: loplugin:flatten in hwpfilter Change-Id: Ie3e970ec0fc761cf8a5e16ea72b7e95c28462234 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91846 Tested-by: Jenkins Reviewed-by: Noel Grandin --- hwpfilter/source/hstyle.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'hwpfilter/source') 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; } -- cgit v1.2.3