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 <erik.verbruggen@digia.com>
This commit is contained in:
Fawzi Mohamed
2013-01-16 12:07:29 +01:00
committed by Erik Verbruggen
parent 725ecc5f91
commit 54bb06435a
2 changed files with 4 additions and 2 deletions

View File

@@ -57,6 +57,7 @@
#include <cstdlib> #include <cstdlib>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string>
#ifdef __GNUC__ #ifdef __GNUC__
# include <cxxabi.h> # include <cxxabi.h>
#endif #endif
@@ -115,7 +116,7 @@ protected:
void alignTerminals() { void alignTerminals() {
out<<"{ rank=same;" << std::endl; out<<"{ rank=same;" << std::endl;
foreach (const QByteArray &terminalShape, _terminalShapes) { foreach (const QByteArray &terminalShape, _terminalShapes) {
out << " " << std::string(terminalShape) << ";" << std::endl; out << " " << std::string(terminalShape.constData(), terminalShape.size()).c_str() << ";" << std::endl;
} }
out<<"}"<<std::endl; out<<"}"<<std::endl;
} }

View File

@@ -43,6 +43,7 @@
#include <cstdlib> #include <cstdlib>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string>
#ifdef __GNUC__ #ifdef __GNUC__
# include <cxxabi.h> # include <cxxabi.h>
#endif #endif
@@ -83,7 +84,7 @@ protected:
void alignTerminals() { void alignTerminals() {
out<<"{ rank=same;" << endl; out<<"{ rank=same;" << endl;
foreach (const QByteArray &terminalShape, _terminalShapes) { foreach (const QByteArray &terminalShape, _terminalShapes) {
out << " " << string(terminalShape) << ";" << endl; out << " " << string(terminalShape.constData(), terminalShape.size()).c_str() << ";" << endl;
} }
out<<"}"<<endl; out<<"}"<<endl;
} }