Commit 2e122f6c authored by Friedemann Kleint's avatar Friedemann Kleint

CE-SDK: Compile with QT_NO_CAST_FROM_ASCII

- Remove qDebug()-output
- Make const-correct

Change-Id: Ie0f81e5d3bcede38c85880c924116dfc722054cc
Reviewed-by: default avatarJoerg Bornemann <joerg.bornemann@nokia.com>
parent f2964ea5
......@@ -49,9 +49,9 @@ CeSdkInfo::CeSdkInfo()
void CeSdkInfo::addToEnvironment(Environment &env)
{
qDebug() << "adding " << name() << "to Environment";
env.set("INCLUDE", m_include);
env.set("LIB", m_lib);
// qDebug() << "adding " << name() << "to Environment";
env.set(QLatin1String("INCLUDE"), m_include);
env.set(QLatin1String("LIB"), m_lib);
env.prependOrSetPath(m_bin);
}
......@@ -68,16 +68,13 @@ bool CeSdkHandler::parse(const QString &vsdir)
VCInstallDir = vsdir;
QDir vStudioDir(VCInstallDir);
if (!vStudioDir.cd("vcpackages"))
if (!vStudioDir.cd(QLatin1String("vcpackages")))
return false;
QFile configFile(vStudioDir.absoluteFilePath(QLatin1String("WCE.VCPlatform.config")));
qDebug()<<"##";
if (!configFile.exists() || !configFile.open(QIODevice::ReadOnly))
return false;
qDebug()<<"parsing";
QString currentElement;
CeSdkInfo currentItem;
QXmlStreamReader xml(&configFile);
......@@ -113,11 +110,12 @@ bool CeSdkHandler::parse(const QString &vsdir)
return m_list.size() > 0 ? true : false;
}
CeSdkInfo CeSdkHandler::find(const QString &name)
CeSdkInfo CeSdkHandler::find(const QString &name) const
{
qDebug() << "looking for platform " << name;
for (QList<CeSdkInfo>::iterator it = m_list.begin(); it != m_list.end(); ++it) {
qDebug() << "...." << it->name();
typedef QList<CeSdkInfo>::const_iterator Iterator;
const Iterator cend = m_list.constEnd();
for (Iterator it = m_list.constBegin(); it != cend; ++it) {
if (it->name() == name)
return *it;
}
......
......@@ -38,9 +38,6 @@
#include <QtCore/QStringList>
#include <QtCore/QDir>
#define VCINSTALL_MACRO "$(VCInstallDir)"
#define VSINSTALL_MACRO "$(VSInstallDir)"
namespace Utils {
class Environment;
}
......@@ -51,15 +48,15 @@ class PROJECTEXPLORER_EXPORT CeSdkInfo
{
public:
CeSdkInfo();
inline QString name();
inline QString binPath();
inline QString includePath();
inline QString libPath();
inline QString name() const;
inline QString binPath() const;
inline QString includePath() const;
inline QString libPath() const;
void addToEnvironment(Utils::Environment &env);
inline bool isValid();
inline int majorVersion();
inline int minorVersion();
inline bool isSupported();
inline bool isValid() const;
inline int majorVersion() const;
inline int minorVersion() const;
inline bool isSupported() const;
private:
friend class CeSdkHandler;
QString m_name;
......@@ -70,14 +67,14 @@ private:
int m_minor;
};
inline QString CeSdkInfo::name() { return m_name; }
inline QString CeSdkInfo::binPath() { return m_bin; }
inline QString CeSdkInfo::includePath() { return m_include; }
inline QString CeSdkInfo::libPath() { return m_lib; }
inline bool CeSdkInfo::isValid() { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); }
inline int CeSdkInfo::majorVersion() { return m_major; }
inline int CeSdkInfo::minorVersion() { return m_minor; }
inline bool CeSdkInfo::isSupported() { return m_major >= 5; }
inline QString CeSdkInfo::name() const { return m_name; }
inline QString CeSdkInfo::binPath() const { return m_bin; }
inline QString CeSdkInfo::includePath() const { return m_include; }
inline QString CeSdkInfo::libPath() const { return m_lib; }
inline bool CeSdkInfo::isValid() const { return !m_name.isEmpty() && !m_bin.isEmpty() && !m_include.isEmpty() && !m_lib.isEmpty(); }
inline int CeSdkInfo::majorVersion() const { return m_major; }
inline int CeSdkInfo::minorVersion() const { return m_minor; }
inline bool CeSdkInfo::isSupported() const { return m_major >= 5; }
class PROJECTEXPLORER_EXPORT CeSdkHandler
{
......@@ -85,7 +82,7 @@ public:
CeSdkHandler();
bool parse(const QString &path);
inline QList<CeSdkInfo> listAll() const;
CeSdkInfo find(const QString &name);
CeSdkInfo find(const QString &name) const;
static QString platformName(const QString &qtpath);
private:
inline QString fixPaths(QString path) const;
......@@ -101,7 +98,13 @@ inline QList<CeSdkInfo> CeSdkHandler::listAll() const
inline QString CeSdkHandler::fixPaths(QString path) const
{
return QDir::toNativeSeparators(QDir::cleanPath(path.replace(VCINSTALL_MACRO, VCInstallDir).replace(VSINSTALL_MACRO, VSInstallDir).replace(QLatin1String(";$(PATH)"), QLatin1String(""))));
const char vcInstallMacro[] = "$(VCInstallDir)";
const char vsInstallMacro[] = "$(VSInstallDir)";
path.replace(QLatin1String(vcInstallMacro), VCInstallDir);
path.replace(QLatin1String(vsInstallMacro), VSInstallDir);
path.remove(QLatin1String(";$(PATH)"));
return QDir::toNativeSeparators(path);
}
} // namespace Qt4ProjectManager
......
......@@ -108,8 +108,8 @@ static QString winExpandDelayedEnvReferences(QString in, const Utils::Environmen
// 1) Having \\ in a path is valid (it is on WinXP)
// 2) We're only replacing in paths. This will cause problems if there's
// a replace of a string
if (!replacement.endsWith('\\'))
replacement += '\\';
if (!replacement.endsWith(QLatin1Char('\\')))
replacement += QLatin1Char('\\');
in.replace(pos, nextPos + 1 - pos, replacement);
pos += replacement.size();
......@@ -137,11 +137,11 @@ Utils::Environment WinCEToolChain::readEnvironmentSetting(Utils::Environment &en
for (envPairIter = envPairs.begin(); envPairIter!=envPairs.end(); ++envPairIter) {
// Replace the env values with those from the WinCE SDK
QString varValue = envPairIter.value();
if ("PATH" == envPairIter.key())
varValue = m_binPath + ";" + varValue;
else if ("INCLUDE" == envPairIter.key())
if (envPairIter.key() == QLatin1String("PATH"))
varValue = m_binPath + QLatin1Char(';') + varValue;
else if (envPairIter.key() == QLatin1String("INCLUDE"))
varValue = m_includePath;
else if ("LIB" == envPairIter.key())
else if (envPairIter.key() == QLatin1String("LIB"))
varValue = m_libPath;
if (!varValue.isEmpty())
......@@ -184,7 +184,7 @@ static bool parseSDK(QXmlStreamReader& theReader,
QString& libPath)
{
sdkArch = Abi::UnknownArchitecture;
sdkName = "";
sdkName.clear();
// Loop through until either the end of the file or until is gets to the next
// end element.
......@@ -197,16 +197,16 @@ static bool parseSDK(QXmlStreamReader& theReader,
return (sdkArch!=Abi::UnknownArchitecture && !sdkName.isEmpty());
} else if (theReader.isStartElement()) {
const QStringRef elemName = theReader.name();
if (elemName == "PlatformName") {
if (elemName == QLatin1String("PlatformName")) {
sdkName = theReader.readElementText();
} else if (elemName == "Directories") {
} else if (elemName == QLatin1String("Directories")) {
// Populate the paths from this element. Note: we remove the
// $(PATH) from the binPath as this will be pre-pended in code
binPath = theReader.attributes().value("Path").toString();
binPath.remove("$(PATH)");
includePath = theReader.attributes().value("Include").toString();
libPath = theReader.attributes().value("Library").toString();
} else if (elemName == "OSMajorVersion") {
binPath = theReader.attributes().value(QLatin1String("Path")).toString();
binPath.remove(QLatin1String("$(PATH)"));
includePath = theReader.attributes().value(QLatin1String("Include")).toString();
libPath = theReader.attributes().value(QLatin1String("Library")).toString();
} else if (elemName == QLatin1String("OSMajorVersion")) {
// Qt only supports CE5 and higher so drop out here if this version is
// invalid
ceVer = theReader.readElementText();
......@@ -215,16 +215,16 @@ static bool parseSDK(QXmlStreamReader& theReader,
qDebug("Ignoring SDK '%s'. Windows CE version %d is unsupported.", qPrintable(sdkName), ceVer.toInt());
return false;
}
} else if (elemName == "Macro") {
} else if (elemName == QLatin1String("Macro")) {
// Pull out the architecture from the macro values.
if (theReader.attributes().value("Name") == "ARCHFAM") {
const QStringRef archFam = theReader.attributes().value("Value");
if (theReader.attributes().value(QLatin1String("Name")) == QLatin1String("ARCHFAM")) {
const QStringRef archFam = theReader.attributes().value(QLatin1String("Value"));
if (archFam == "ARM")
if (archFam == QLatin1String("ARM"))
sdkArch = Abi::ArmArchitecture;
else if (archFam == "x86")
else if (archFam == QLatin1String("x86"))
sdkArch = Abi::X86Architecture;
else if (archFam == "MIPS")
else if (archFam == QLatin1String("MIPS"))
sdkArch = Abi::MipsArchitecture;
}
}
......@@ -303,7 +303,7 @@ QString WinCEToolChain::typeName() const
Utils::FileName WinCEToolChain::mkspec() const
{
const QChar specSeperator('-');
const QChar specSeperator(QLatin1Char('-'));
QString specString = QLatin1String("wince");
......@@ -411,7 +411,7 @@ QList<ToolChain *> WinCEToolChainFactory::autoDetect()
// Check existence of various install scripts
const QString vcvars32bat = path + QLatin1String("bin/vcvars32.bat");
QFile cePlatforms(path + "vcpackages/WCE.VCPlatform.config");
QFile cePlatforms(path + QLatin1String("vcpackages/WCE.VCPlatform.config"));
if (cePlatforms.exists()) {
const QString msvcVer = findMsvcVer(version);
......@@ -422,7 +422,7 @@ QList<ToolChain *> WinCEToolChainFactory::autoDetect()
while (!platformReader.atEnd()) {
platformReader.readNext();
if (platformReader.isStartElement()) {
if (platformReader.name() == "Platform") {
if (platformReader.name() == QLatin1String("Platform")) {
Abi::Architecture theArch;
QString thePlat;
QString binPath;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment