From 0c695b73f5bbc9122c8d3c61b883fa3f7fec7900 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 29 Sep 2009 11:49:53 +0200 Subject: fix string builder for QT_NO_CAST_FROM_ASCII on Windows Reviewed-by: thiago --- src/corelib/tools/qstringbuilder.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index e1a0e06..efa39b5 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -198,6 +198,17 @@ template struct QConcatenable } }; +template struct QConcatenable +{ + typedef const char type[N]; + static int size(const char[N]) { return N - 1; } + static inline void appendTo(const char a[N], QChar *&out) + { + for (int i = 0; i < N - 1; ++i) + *out++ = QLatin1Char(a[i]); + } +}; + template <> struct QConcatenable { typedef char const *type; @@ -241,7 +252,7 @@ template QStringBuilder::type, typename QConcatenable::type> operator%(const A &a, const B &b) { - return QStringBuilder(a, b); + return QStringBuilder::type, typename QConcatenable::type>(a, b); } #ifdef QT_USE_FAST_OPERATOR_PLUS @@ -249,7 +260,7 @@ template QStringBuilder::type, typename QConcatenable::type> operator+(const A &a, const B &b) { - return QStringBuilder(a, b); + return QStringBuilder::type, typename QConcatenable::type>(a, b); } #endif -- cgit v0.12