diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-15 16:15:24 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-21 15:43:20 +0000 |
commit | 37b4456fd4cbba25b674a973a920e0d24060d3e4 (patch) | |
tree | 06690188271f87cbdc307d806cd5cbcad6b685d4 /sources/shiboken2/generator/shiboken2/cppgenerator.cpp | |
parent | b84b5a2f35bea95545c19ee313be5ec5db19eca6 (diff) |
shiboken: Fix a warning introduced by g++ 8 in the generated code
PySide2/QtWidgets/PySide2/QtWidgets/qgraphicsscenehoverevent_wrapper.cpp:95:12:
warning: ‘char* strncpy(char*, const char*, size_t)’ output truncated
before terminating nul copying 28 bytes from a string of the same
length [-Wstringop-truncation]
Use the correct length and use memcpy().
Change-Id: I0830cd9b499f2f49a1f3334c2407f877e79738d4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 86a632e78..be9d426b5 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -68,12 +68,14 @@ static const char *typeNameOf(const T &t) size = lastStar - typeName + 1; } #else // g++, Clang: "QPaintDevice *" -> "P12QPaintDevice" - if (size > 2 && typeName[0] == 'P' && std::isdigit(typeName[1])) + if (size > 2 && typeName[0] == 'P' && std::isdigit(typeName[1])) { ++typeName; + --size; + } #endif char *result = new char[size + 1]; result[size] = '\0'; - strncpy(result, typeName, size); + memcpy(result, typeName, size); return result; } )CPP"; |