qxmpp
qxmpp copied to clipboard
The value '-1' is out of range of enum values. This causes unspecified or undefined behavior.
I use git commit 88812716073e5f6941843a6f0778319be889dd3b Some of the C++ source code static analysis issues triggered by the fact that you use "-1" as if it were "Optional<T>" or a C# style nullable enum. E.g. by PVS-Studio. /home/n/kde/src/qxmpp/src/base/QXmppBitsOfBinaryContentId.cpp:115: warning: V547 Expression 'int (algo) == - 1' is always false. /home/n/kde/src/qxmpp/src/base/QXmppDataForm.cpp:39: warning: V1016 The value '-1' is out of range of enum values. This causes unspecified or undefined behavior. /home/n/kde/src/qxmpp/src/base/QXmppStanza.cpp:407: warning: V1016 The value '-1' is out of range of enum values. This causes unspecified or undefined behavior. /home/n/kde/src/qxmpp/src/base/QXmppStanza.cpp:431: warning: V547 Expression 'int (cond) < 0' is always false. /home/n/kde/src/qxmpp/src/base/QXmppStanza.cpp:459: warning: V1016 The value '-1' is out of range of enum values. This causes unspecified or undefined behavior. /home/n/kde/src/qxmpp/src/base/QXmppStanza.cpp:503: warning: V547 Expression 'int (type) < 0' is always false. /home/n/kde/src/qxmpp/src/client/QXmppPubSubManager.cpp:964: warning: V785 Constant expression in switch statement. https://pvs-studio.com/en/docs/warnings/v1016/
This is a known issue. We should probably add enumerators for -1
.