aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-09-12 09:54:27 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2013-09-12 15:34:09 +0200
commit1901a1c7d402cd4fe1eaf3a9107fe6d56348acb5 (patch)
treebbaee31a20c7464b67f1203e3d2df7c26cfd527f /src/libs
parent5c33742375219d86572dd989e3be07595a162a7b (diff)
Fix MSVC-64 warnings about size_t -> int truncations in C++-lib.
Change-Id: Ibe6f41ac15df1ec685b0d0766ff568abf6f3ae7e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/3rdparty/cplusplus/Bind.cpp12
-rw-r--r--src/libs/3rdparty/cplusplus/Control.cpp6
-rw-r--r--src/libs/3rdparty/cplusplus/Names.cpp4
-rw-r--r--src/libs/3rdparty/cplusplus/Symbols.cpp6
-rw-r--r--src/libs/3rdparty/cplusplus/Templates.cpp4
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.cpp8
-rw-r--r--src/libs/3rdparty/cplusplus/TranslationUnit.h2
-rw-r--r--src/libs/cplusplus/PPToken.cpp2
-rw-r--r--src/libs/cplusplus/pp-engine.cpp12
9 files changed, 28 insertions, 28 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp
index cb69289770..0defcc0a1f 100644
--- a/src/libs/3rdparty/cplusplus/Bind.cpp
+++ b/src/libs/3rdparty/cplusplus/Bind.cpp
@@ -1146,7 +1146,7 @@ const StringLiteral *Bind::asStringLiteral(unsigned firstToken, unsigned lastTok
buffer += ' ';
buffer += tk.spell();
}
- return control()->stringLiteral(buffer.c_str(), buffer.size());
+ return control()->stringLiteral(buffer.c_str(), unsigned(buffer.size()));
}
// StatementAST
@@ -1168,7 +1168,7 @@ bool Bind::visit(QtMemberDeclarationAST *ast)
privateClass += nameId->identifier()->chars();
privateClass += "Private";
- const Name *privName = control()->identifier(privateClass.c_str(), privateClass.size());
+ const Name *privName = control()->identifier(privateClass.c_str(), unsigned(privateClass.size()));
declTy.setType(control()->namedType(privName));
}
}
@@ -1262,7 +1262,7 @@ bool Bind::visit(ForeachStatementAST *ast)
unsigned endOfExpression = ast->expression->lastToken();
const StringLiteral *sl = asStringLiteral(startOfExpression, endOfExpression);
const std::string buff = std::string("*") + sl->chars() + ".begin()";
- initializer = control()->stringLiteral(buff.c_str(), buff.size());
+ initializer = control()->stringLiteral(buff.c_str(), unsigned(buff.size()));
}
}
@@ -1312,7 +1312,7 @@ bool Bind::visit(RangeBasedForStatementAST *ast)
unsigned endOfExpression = ast->expression->lastToken();
const StringLiteral *sl = asStringLiteral(startOfExpression, endOfExpression);
const std::string buff = std::string("*") + sl->chars() + ".begin()";
- initializer = control()->stringLiteral(buff.c_str(), buff.size());
+ initializer = control()->stringLiteral(buff.c_str(), unsigned(buff.size()));
}
}
@@ -2591,7 +2591,7 @@ bool Bind::visit(ObjCSelectorAST *ast) // ### review
}
if (! arguments.empty()) {
- _name = control()->selectorNameId(&arguments[0], arguments.size(), hasArgs);
+ _name = control()->selectorNameId(&arguments[0], unsigned(arguments.size()), hasArgs);
ast->name = _name;
}
@@ -2676,7 +2676,7 @@ bool Bind::visit(TemplateIdAST *ast)
_name = control()->templateNameId(id, isSpecialization);
else
_name = control()->templateNameId(id, isSpecialization, &templateArguments[0],
- templateArguments.size());
+ unsigned(templateArguments.size()));
ast->name = _name;
return false;
diff --git a/src/libs/3rdparty/cplusplus/Control.cpp b/src/libs/3rdparty/cplusplus/Control.cpp
index e274a20906..42028ae4ed 100644
--- a/src/libs/3rdparty/cplusplus/Control.cpp
+++ b/src/libs/3rdparty/cplusplus/Control.cpp
@@ -584,7 +584,7 @@ const Identifier *Control::identifier(const char *chars, unsigned size)
const Identifier *Control::identifier(const char *chars)
{
- unsigned length = std::strlen(chars);
+ const unsigned length = unsigned(std::strlen(chars));
return identifier(chars, length);
}
@@ -611,7 +611,7 @@ const StringLiteral *Control::stringLiteral(const char *chars, unsigned size)
const StringLiteral *Control::stringLiteral(const char *chars)
{
- unsigned length = std::strlen(chars);
+ const unsigned length = unsigned(std::strlen(chars));
return stringLiteral(chars, length);
}
@@ -620,7 +620,7 @@ const NumericLiteral *Control::numericLiteral(const char *chars, unsigned size)
const NumericLiteral *Control::numericLiteral(const char *chars)
{
- unsigned length = std::strlen(chars);
+ const unsigned length = unsigned(std::strlen(chars));
return numericLiteral(chars, length);
}
diff --git a/src/libs/3rdparty/cplusplus/Names.cpp b/src/libs/3rdparty/cplusplus/Names.cpp
index 4d92110284..41bd890312 100644
--- a/src/libs/3rdparty/cplusplus/Names.cpp
+++ b/src/libs/3rdparty/cplusplus/Names.cpp
@@ -100,7 +100,7 @@ const Identifier *TemplateNameId::identifier() const
{ return _identifier; }
unsigned TemplateNameId::templateArgumentCount() const
-{ return _templateArguments.size(); }
+{ return unsigned(_templateArguments.size()); }
const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const
{ return _templateArguments[index]; }
@@ -217,7 +217,7 @@ const Identifier *SelectorNameId::identifier() const
}
unsigned SelectorNameId::nameCount() const
-{ return _names.size(); }
+{ return unsigned(_names.size()); }
const Name *SelectorNameId::nameAt(unsigned index) const
{ return _names[index]; }
diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp
index 6101e51485..dc20da15aa 100644
--- a/src/libs/3rdparty/cplusplus/Symbols.cpp
+++ b/src/libs/3rdparty/cplusplus/Symbols.cpp
@@ -722,7 +722,7 @@ bool Class::matchType0(const Type *otherType, TypeMatcher *matcher) const
}
unsigned Class::baseClassCount() const
-{ return _baseClasses.size(); }
+{ return unsigned(_baseClasses.size()); }
BaseClass *Class::baseClassAt(unsigned index) const
{ return _baseClasses.at(index); }
@@ -885,7 +885,7 @@ void ObjCClass::setBaseClass(ObjCBaseClass *baseClass)
{ _baseClass = baseClass; }
unsigned ObjCClass::protocolCount() const
-{ return _protocols.size(); }
+{ return unsigned(_protocols.size()); }
ObjCBaseProtocol *ObjCClass::protocolAt(unsigned index) const
{ return _protocols.at(index); }
@@ -951,7 +951,7 @@ ObjCProtocol::~ObjCProtocol()
{}
unsigned ObjCProtocol::protocolCount() const
-{ return _protocols.size(); }
+{ return unsigned(_protocols.size()); }
ObjCBaseProtocol *ObjCProtocol::protocolAt(unsigned index) const
{ return _protocols.at(index); }
diff --git a/src/libs/3rdparty/cplusplus/Templates.cpp b/src/libs/3rdparty/cplusplus/Templates.cpp
index 557ac7d08e..2e9772e191 100644
--- a/src/libs/3rdparty/cplusplus/Templates.cpp
+++ b/src/libs/3rdparty/cplusplus/Templates.cpp
@@ -443,7 +443,7 @@ void CloneName::visit(const TemplateNameId *name)
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization());
else
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization(),
- &args[0], args.size());
+ &args[0], unsigned(args.size()));
}
void CloneName::visit(const DestructorNameId *name)
@@ -473,7 +473,7 @@ void CloneName::visit(const SelectorNameId *name)
std::vector<const Name *> names(name->nameCount());
for (unsigned i = 0; i < names.size(); ++i)
names[i] = _clone->name(name->nameAt(i), _subst);
- _name = _control->selectorNameId(&names[0], names.size(), name->hasArguments());
+ _name = _control->selectorNameId(&names[0], unsigned(names.size()), name->hasArguments());
}
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
index e8d278e221..0ecb9827f8 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.cpp
@@ -117,7 +117,7 @@ const char *TranslationUnit::spell(unsigned index) const
}
unsigned TranslationUnit::commentCount() const
-{ return _comments->size(); }
+{ return unsigned(_comments->size()); }
const Token &TranslationUnit::commentAt(unsigned index) const
{ return _comments->at(index); }
@@ -266,11 +266,11 @@ void TranslationUnit::tokenize()
}
goto _Lrecognize;
} else if (tk.f.kind == T_LBRACE) {
- braces.push(_tokens->size());
+ braces.push(unsigned(_tokens->size()));
} else if (tk.f.kind == T_RBRACE && ! braces.empty()) {
const unsigned open_brace_index = braces.top();
braces.pop();
- (*_tokens)[open_brace_index].close_brace = _tokens->size();
+ (*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
} else if (tk.isComment()) {
_comments->push_back(tk);
continue; // comments are not in the regular token stream
@@ -298,7 +298,7 @@ void TranslationUnit::tokenize()
for (; ! braces.empty(); braces.pop()) {
unsigned open_brace_index = braces.top();
- (*_tokens)[open_brace_index].close_brace = _tokens->size();
+ (*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
}
}
diff --git a/src/libs/3rdparty/cplusplus/TranslationUnit.h b/src/libs/3rdparty/cplusplus/TranslationUnit.h
index bf182b0801..d6816b99a2 100644
--- a/src/libs/3rdparty/cplusplus/TranslationUnit.h
+++ b/src/libs/3rdparty/cplusplus/TranslationUnit.h
@@ -63,7 +63,7 @@ public:
void setSource(const char *source, unsigned size);
- unsigned tokenCount() const { return _tokens->size(); }
+ unsigned tokenCount() const { return unsigned(_tokens->size()); }
const Token &tokenAt(unsigned index) const { return _tokens->at(index); }
int tokenKind(unsigned index) const { return _tokens->at(index).f.kind; }
const char *spell(unsigned index) const;
diff --git a/src/libs/cplusplus/PPToken.cpp b/src/libs/cplusplus/PPToken.cpp
index e635d5ffe0..b3e41103bb 100644
--- a/src/libs/cplusplus/PPToken.cpp
+++ b/src/libs/cplusplus/PPToken.cpp
@@ -35,7 +35,7 @@ using namespace CPlusPlus;
bool ByteArrayRef::startsWith(const char *s) const
{
- int l = std::strlen(s);
+ const int l = int(std::strlen(s));
if (l > m_length)
return false;
return !qstrncmp(start(), s, l);
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 0f678adf02..15beba1771 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -1064,7 +1064,7 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
// This is not the most beautiful approach but it's quite reasonable. What we do here
// is to create a fake identifier token which is only composed by whitespaces. It's
// also not marked as expanded so it it can be treated as a regular token.
- QByteArray content(idTk.f.length + computeDistance(idTk), ' ');
+ const QByteArray content(int(idTk.f.length + computeDistance(idTk)), ' ');
PPToken fakeIdentifier = generateToken(T_IDENTIFIER,
content.constData(), content.length(),
idTk.lineno, false, false);
@@ -1131,7 +1131,7 @@ bool Preprocessor::handleFunctionLikeMacro(const Macro *macro,
for (size_t i = 0; i < bodySize && expanded.size() < MAX_TOKEN_EXPANSION_COUNT;
++i) {
int expandedSize = expanded.size();
- PPToken bodyTk = body.at(i);
+ PPToken bodyTk = body.at(int(i));
if (bodyTk.is(T_IDENTIFIER)) {
const ByteArrayRef id = bodyTk.asByteArrayRef();
@@ -1152,7 +1152,7 @@ bool Preprocessor::handleFunctionLikeMacro(const Macro *macro,
const int actualsSize = actualsForThisParam.size();
- if (i > 0 && body[i - 1].is(T_POUND)) {
+ if (i > 0 && body[int(i) - 1].is(T_POUND)) {
QByteArray enclosedString;
enclosedString.reserve(256);
@@ -1205,7 +1205,7 @@ bool Preprocessor::handleFunctionLikeMacro(const Macro *macro,
expanded.push_back(bodyTk);
}
- if (i > 1 && body[i - 1].is(T_POUND_POUND)) {
+ if (i > 1 && body[int(i) - 1].is(T_POUND_POUND)) {
if (expandedSize < 1 || expanded.size() == expandedSize) //### TODO: [cpp.concat] placemarkers
continue;
const PPToken &leftTk = expanded[expandedSize - 1];
@@ -1414,7 +1414,7 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
unsigned trackedColumn = 0;
if (tk.expanded() && !tk.generated()) {
trackedLine = tk.lineno;
- trackedColumn = computeDistance(tk, true);
+ trackedColumn = unsigned(computeDistance(tk, true));
}
m_state.m_expandedTokensInfo.append(qMakePair(trackedLine, trackedColumn));
} else if (m_state.m_expansionStatus == JustFinishedExpansion) {
@@ -1985,7 +1985,7 @@ PPToken Preprocessor::generateToken(enum Kind kind,
else if (kind == T_NUMERIC_LITERAL)
tk.number = m_state.m_lexer->control()->numericLiteral(m_scratchBuffer.constData() + pos, length);
}
- tk.offset = pos;
+ tk.offset = unsigned(pos);
tk.f.length = length;
tk.f.generated = true;
tk.f.expanded = true;