diff options
Diffstat (limited to 'src/corelib/serialization/qxmlstream.g')
-rw-r--r-- | src/corelib/serialization/qxmlstream.g | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/corelib/serialization/qxmlstream.g b/src/corelib/serialization/qxmlstream.g index 10bfcd491c..e6328a11ac 100644 --- a/src/corelib/serialization/qxmlstream.g +++ b/src/corelib/serialization/qxmlstream.g @@ -41,6 +41,8 @@ %merged_output qxmlstream_p.h +%expect 4 + %token NOTOKEN %token SPACE " " %token LANGLE "<" @@ -144,7 +146,12 @@ %start document + + /. + +#include <QtCore/private/qglobal_p.h> + template <typename T> class QXmlStreamSimpleStack { T *data; int tos, cap; @@ -155,7 +162,8 @@ public: inline void reserve(int extraCapacity) { if (tos + extraCapacity + 1 > cap) { cap = qMax(tos + extraCapacity + 1, cap << 1 ); - data = reinterpret_cast<T *>(realloc(data, cap * sizeof(T))); + void *ptr = realloc(static_cast<void *>(data), cap * sizeof(T)); + data = reinterpret_cast<T *>(ptr); Q_CHECK_PTR(data); } } @@ -753,7 +761,7 @@ bool QXmlStreamReaderPrivate::parse() state_stack[tos] = 0; return true; } else if (act > 0) { - if (++tos == stack_size-1) + if (++tos >= stack_size-1) reallocateStack(); Value &val = sym_stack[tos]; @@ -890,7 +898,7 @@ doctype_decl ::= langle_bang DOCTYPE qname markup space_opt RANGLE; /. case $rule_number: dtdName = symString(3); - // fall through + Q_FALLTHROUGH(); ./ doctype_decl ::= doctype_decl_start external_id space_opt markup space_opt RANGLE; /. |