diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-01-11 10:56:26 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-01-11 14:55:29 +0000 |
commit | 0dd022957ddf3a2c92b796895d7bfec6387b9ca3 (patch) | |
tree | 9c06b065bb07275abc101f46dd6ecf9d4ede7d6d /sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | |
parent | b33f8708fd1d9aee7e4409a91b96fe96d3730764 (diff) |
shiboken: Replace C-style NULL by nullptr
Replace in comments, code and generated code.
Rename variable NULL_VALUE to NULL_PTR and make extern for follow-up
changes.
Rewrite code using NULL in QString::arg() (resulting apparently from
some misunderstanding that it requires a terminating nullptr) to use
printf-formatting to fix a warning: format not a string literal and no
format arguments [-Wformat-security]).
Change-Id: I97c111cadc09192132308924136eb6ede7a6bf44
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/shibokengenerator.cpp')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/shibokengenerator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index b9eea7529..041c042a2 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -41,7 +41,6 @@ #include <limits> #include <memory> -static const char NULL_VALUE[] = "NULL"; static const char AVOID_PROTECTED_HACK[] = "avoid-protected-hack"; static const char PARENT_CTOR_HEURISTIC[] = "enable-parent-ctor-heuristic"; static const char RETURN_VALUE_HEURISTIC[] = "enable-return-value-heuristic"; @@ -53,6 +52,7 @@ const char *CPP_ARG = "cppArg"; const char *CPP_ARG_REMOVED = "removed_cppArg"; const char *CPP_RETURN_VAR = "cppResult"; const char *CPP_SELF_VAR = "cppSelf"; +const char *NULL_PTR = "nullptr"; const char *PYTHON_ARG = "pyArg"; const char *PYTHON_ARGS = "pyArgs"; const char *PYTHON_OVERRIDE_VAR = "pyOverride"; @@ -1396,7 +1396,7 @@ QString ShibokenGenerator::argumentString(const AbstractMetaFunction *func, { QString default_value = argument->originalDefaultValueExpression(); if (default_value == QLatin1String("NULL")) - default_value = QLatin1String(NULL_VALUE); + default_value = QLatin1String(NULL_PTR); //WORKAROUND: fix this please if (default_value.startsWith(QLatin1String("new "))) |