5#include "qplatformdefs.h"
11#include <QtCore/q26numeric.h>
18
19
20
21
22
23
24
25
26
27
29#if QT_DEPRECATED_SINCE(6
, 9
)
31#if !defined(QT_VSNPRINTF) || defined(Q_QDOC)
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
61int qvsnprintf(
char *str, size_t n,
const char *fmt, va_list ap)
66 const QByteArray ba = QString::vasprintf(fmt, ap).toLocal8Bit();
68 const auto realSize = ba.size();
70 if constexpr (
sizeof(
int) !=
sizeof(realSize)) {
71 result = q26::saturate_cast<
int>(realSize);
72 if (result != realSize) {
81 size_t blen = (std::min)(size_t(realSize), n - 1);
82 memcpy(str, ba.constData(), blen);
91QT_BEGIN_INCLUDE_NAMESPACE
93QT_END_INCLUDE_NAMESPACE
96int qvsnprintf(
char *str, size_t n,
const char *fmt, va_list ap)
98 return QT_VSNPRINTF(str, n, fmt, ap);
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
123int qsnprintf(
char *str, size_t n,
const char *fmt, ...)
128 QT_IGNORE_DEPRECATIONS(
129 int ret = qvsnprintf(str, n, fmt, ap);
Combined button and popup list for selecting options.