Commit 143af284 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Fix excessive warnings by MSVC 2013 64bit about size_t->int truncation



C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data

Change-Id: I91979c685bbbd84359f7f4e19911a21a408f5d23
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
parent 21e9893b
......@@ -70,7 +70,7 @@ void InvokerBase::invoke(QObject *t, const char *slot)
if (paramCount)
sig.append(',');
const char *type = arg[paramCount].name();
sig.append(type, strlen(type));
sig.append(type, int(strlen(type)));
}
sig.append(')');
sig.append('\0');
......
......@@ -210,7 +210,7 @@ void DetailedErrorDelegate::onVerticalScroll()
// Expects "file://some/path[:line[:column]]" - the line/column part is optional
void DetailedErrorDelegate::openLinkInEditor(const QString &link)
{
const QString linkWithoutPrefix = link.mid(strlen("file://"));
const QString linkWithoutPrefix = link.mid(int(strlen("file://")));
const QChar separator = QLatin1Char(':');
const int lineColon = linkWithoutPrefix.indexOf(separator, /*after drive letter + colon =*/ 2);
const QString path = linkWithoutPrefix.left(lineColon);
......
......@@ -52,7 +52,7 @@ static QString pathFromId(Core::Id id)
QByteArray idStr = id.name();
if (!idStr.startsWith(BareMetalRunConfiguration::IdPrefix))
return QString();
return QString::fromUtf8(idStr.mid(strlen(BareMetalRunConfiguration::IdPrefix)));
return QString::fromUtf8(idStr.mid(int(strlen(BareMetalRunConfiguration::IdPrefix))));
}
BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory(QObject *parent) :
......
......@@ -1859,7 +1859,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
if (found)
break;
const int len = strlen(str);
const int len = int(strlen(str));
if (len == 0)
break;
str += len + 1;
......
......@@ -148,7 +148,7 @@ void DebuggerItem::reinitializeFromFile()
// Version
if (ba.startsWith(("lldb version "))) { // Linux typically.
int pos1 = strlen("lldb version ");
int pos1 = int(strlen("lldb version "));
int pos2 = ba.indexOf(' ', pos1);
m_version = QString::fromLatin1(ba.mid(pos1, pos2 - pos1));
} else if (ba.startsWith("lldb-") || ba.startsWith("LLDB-")) { // Mac typically.
......
......@@ -368,7 +368,7 @@ void GdbMi::fromStringMultiple(const QByteArray &ba)
GdbMi GdbMi::operator[](const char *name) const
{
for (int i = 0, n = m_children.size(); i < n; ++i)
for (int i = 0, n = int(m_children.size()); i < n; ++i)
if (m_children.at(i).m_name == name)
return m_children.at(i);
return GdbMi();
......
......@@ -159,7 +159,7 @@ public:
inline QByteArray data() const { return m_data; }
inline const std::vector<GdbMi> &children() const { return m_children; }
inline int childCount() const { return m_children.size(); }
inline int childCount() const { return int(m_children.size()); }
const GdbMi &childAt(int index) const { return m_children[index]; }
GdbMi &childAt(int index) { return m_children[index]; }
......
......@@ -3900,7 +3900,7 @@ void GdbEngine::handleFetchMemory(const DebuggerResponse &response, MemoryAgentC
return;
GdbMi memory0 = memory.children().at(0); // we asked for only one 'row'
GdbMi data = memory0["data"];
for (int i = 0, n = data.children().size(); i != n; ++i) {
for (int i = 0, n = int(data.children().size()); i != n; ++i) {
const GdbMi &child = data.children().at(i);
bool ok = true;
unsigned char c = '?';
......
......@@ -609,7 +609,7 @@ void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
response.lineNumber = bkpt["line"].toInt();
GdbMi locations = bkpt["locations"];
const int numChild = locations.children().size();
const int numChild = int(locations.children().size());
if (numChild > 1) {
foreach (const GdbMi &location, locations.children()) {
const int locid = location["locid"].toInt();
......
......@@ -462,7 +462,7 @@ void ThreadsHandler::updateThreads(const GdbMi &data)
// }
const std::vector<GdbMi> items = data["threads"].children();
const int n = items.size();
const int n = int(items.size());
for (int index = 0; index != n; ++index) {
const GdbMi item = items[index];
const GdbMi frame = item["frame"];
......
......@@ -665,7 +665,7 @@ void parseChildrenData(const WatchData &data0, const GdbMi &item,
childtemplate.address = addressBase;
arrayDecoder(childtemplate, mi.data(), encoding);
} else {
for (int i = 0, n = children.children().size(); i != n; ++i) {
for (int i = 0, n = int(children.children().size()); i != n; ++i) {
const GdbMi &child = children.children().at(i);
WatchData data1 = childtemplate;
data1.sortId = i;
......
......@@ -96,7 +96,7 @@ bool SearchFunction::visit(CPlusPlus::Function * f)
if (const CPlusPlus::Name *name = f->name())
if (const CPlusPlus::Identifier *id = name->identifier())
if (id->size() == m_length)
if (!qstrncmp(m_name, id->chars(), m_length))
if (!qstrncmp(m_name, id->chars(), uint(m_length)))
m_matches.push_back(f);
return true;
}
......
......@@ -61,8 +61,8 @@ public:
FormatToken(Format format, size_t position, size_t length)
:m_format(format)
,m_position(position)
,m_length(length)
,m_position(int(position))
,m_length(int(length))
{}
inline Format format() const { return m_format; }
......
......@@ -52,7 +52,7 @@ QString stringFromId(Core::Id id)
QByteArray idStr = id.name();
if (!idStr.startsWith(RemoteLinuxRunConfiguration::IdPrefix))
return QString();
return QString::fromUtf8(idStr.mid(strlen(RemoteLinuxRunConfiguration::IdPrefix)));
return QString::fromUtf8(idStr.mid(int(strlen(RemoteLinuxRunConfiguration::IdPrefix))));
}
} // namespace
......
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