From 54bb06435a4d3129529d26d275047c1094a64167 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Wed, 16 Jan 2013 12:07:29 +0100 Subject: [PATCH] tests: fix compilation with osx/clang, avoid implicit conversion - osx clang does not support sending a newly created string to an ostream, converting it to c_str - avoid std::string(QBytearray), as that skips length (I suppose) Change-Id: I3712df9d5e4a6f96420a8f2bf59c3bec9286b788 Reviewed-by: Erik Verbruggen --- tests/tools/cplusplus-ast2png/cplusplus-ast2png.cpp | 3 ++- tests/tools/qml-ast2dot/main.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tools/cplusplus-ast2png/cplusplus-ast2png.cpp b/tests/tools/cplusplus-ast2png/cplusplus-ast2png.cpp index 51d7c379863..9c2829bbbb0 100644 --- a/tests/tools/cplusplus-ast2png/cplusplus-ast2png.cpp +++ b/tests/tools/cplusplus-ast2png/cplusplus-ast2png.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #ifdef __GNUC__ # include #endif @@ -115,7 +116,7 @@ protected: void alignTerminals() { out<<"{ rank=same;" << std::endl; foreach (const QByteArray &terminalShape, _terminalShapes) { - out << " " << std::string(terminalShape) << ";" << std::endl; + out << " " << std::string(terminalShape.constData(), terminalShape.size()).c_str() << ";" << std::endl; } out<<"}"< #include #include +#include #ifdef __GNUC__ # include #endif @@ -83,7 +84,7 @@ protected: void alignTerminals() { out<<"{ rank=same;" << endl; foreach (const QByteArray &terminalShape, _terminalShapes) { - out << " " << string(terminalShape) << ";" << endl; + out << " " << string(terminalShape.constData(), terminalShape.size()).c_str() << ";" << endl; } out<<"}"<