[Libreoffice-commits] core.git: vcl/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 26 06:48:20 UTC 2019
vcl/source/fontsubset/cff.cxx | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
New commits:
commit 29e98888e7e17515d9d4ae60ad27fa30ec374412
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Nov 25 14:16:57 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Nov 26 07:47:23 2019 +0100
Better fix for GCC -Werror=stringop-truncation
...following up on 2679c012115424e2728cfe79f7c6b5b243739b4e "GCC trunk towards
GCC 9 still emits a bogus -Wstringop-truncation" addressing
> In member function ‘void {anonymous}::Type1Emitter::setSubsetName(const char*)’,
> inlined from ‘bool FontSubsetInfo::CreateFontSubsetFromCff(sal_Int32*)’ at vcl/source/fontsubset/cff.cxx:2057:32:
> vcl/source/fontsubset/cff.cxx:1634:16: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 256 equals destination size [-Werror=stringop-truncation]
> 1634 | strncpy( maSubsetName, pSubsetName, sizeof(maSubsetName));
> | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...that at least "gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)" started to emit
with --enable-optimized after f853ec317f6af1b8c65cc5bd758371689c75118d "Extend
loplugin:external to warn about classes"
Change-Id: I7b6f1fc43397cc88cb212041c3ea070941281b25
Reviewed-on: https://gerrit.libreoffice.org/83681
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 208264e7346a..b4ae6809085b 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -1631,14 +1631,7 @@ void Type1Emitter::setSubsetName( const char* pSubsetName)
{
maSubsetName[0] = '\0';
if( pSubsetName)
-#if defined __GNUC__ && (__GNUC__ == 8 || __GNUC__ == 9) && !defined __clang__
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-truncation"
-#endif
- strncpy( maSubsetName, pSubsetName, sizeof(maSubsetName));
-#if defined __GNUC__ && (__GNUC__ == 8 || __GNUC__ == 9) && !defined __clang__
-#pragma GCC diagnostic pop
-#endif
+ strncpy( maSubsetName, pSubsetName, sizeof(maSubsetName) - 1);
maSubsetName[sizeof(maSubsetName)-1] = '\0';
}
More information about the Libreoffice-commits
mailing list