avoid some fixes for noisy signedness warnings
This commit is contained in:
parent
0aad8af9ae
commit
40fffddb83
|
@ -552,7 +552,7 @@ bool Token::simpleMatch(const Token *tok, const char pattern[])
|
||||||
next = pattern + std::strlen(pattern);
|
next = pattern + std::strlen(pattern);
|
||||||
|
|
||||||
while (*current) {
|
while (*current) {
|
||||||
std::size_t length = static_cast<std::size_t>(next - current);
|
std::size_t length = next - current;
|
||||||
|
|
||||||
if (!tok || length != tok->_str.length() || std::strncmp(current, tok->_str.c_str(), length))
|
if (!tok || length != tok->_str.length() || std::strncmp(current, tok->_str.c_str(), length))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1043,16 +1043,16 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
|
||||||
std::ostringstream ret;
|
std::ostringstream ret;
|
||||||
|
|
||||||
unsigned int lineNumber = _linenr;
|
unsigned int lineNumber = _linenr;
|
||||||
int fileInd = files ? -1 : static_cast<int>(_fileIndex);
|
unsigned int fileInd = files ? ~0U : _fileIndex;
|
||||||
std::map<int, unsigned int> lineNumbers;
|
std::map<int, unsigned int> lineNumbers;
|
||||||
for (const Token *tok = this; tok != end; tok = tok->next()) {
|
for (const Token *tok = this; tok != end; tok = tok->next()) {
|
||||||
bool fileChange = false;
|
bool fileChange = false;
|
||||||
if (static_cast<int>(tok->_fileIndex) != fileInd) {
|
if (tok->_fileIndex != fileInd) {
|
||||||
if (fileInd != -1) {
|
if (fileInd != ~0U) {
|
||||||
lineNumbers[fileInd] = tok->_fileIndex;
|
lineNumbers[fileInd] = tok->_fileIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileInd = static_cast<int>(tok->_fileIndex);
|
fileInd = tok->_fileIndex;
|
||||||
if (files) {
|
if (files) {
|
||||||
ret << "\n\n##file ";
|
ret << "\n\n##file ";
|
||||||
if (fileNames && fileNames->size() > tok->_fileIndex)
|
if (fileNames && fileNames->size() > tok->_fileIndex)
|
||||||
|
@ -1066,7 +1066,7 @@ std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linebreaks && (lineNumber != tok->linenr() || fileChange)) {
|
if (linebreaks && (lineNumber != tok->linenr() || fileChange)) {
|
||||||
if (lineNumber+4 < tok->linenr() && fileInd == static_cast<int>(tok->_fileIndex)) {
|
if (lineNumber+4 < tok->linenr() && fileInd == tok->_fileIndex) {
|
||||||
ret << '\n' << lineNumber+1 << ":\n|\n";
|
ret << '\n' << lineNumber+1 << ":\n|\n";
|
||||||
ret << tok->linenr()-1 << ":\n";
|
ret << tok->linenr()-1 << ":\n";
|
||||||
ret << tok->linenr() << ": ";
|
ret << tok->linenr() << ": ";
|
||||||
|
|
|
@ -135,7 +135,7 @@ unsigned int Tokenizer::sizeOfType(const Token *type) const
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (type->tokType() == Token::eString)
|
if (type->tokType() == Token::eString)
|
||||||
return static_cast<unsigned int>(Token::getStrLength(type) + 1);
|
return Token::getStrLength(type) + 1U;
|
||||||
|
|
||||||
std::map<std::string, unsigned int>::const_iterator it = _typeSize.find(type->str());
|
std::map<std::string, unsigned int>::const_iterator it = _typeSize.find(type->str());
|
||||||
if (it == _typeSize.end())
|
if (it == _typeSize.end())
|
||||||
|
@ -3052,7 +3052,7 @@ bool Tokenizer::simplifySizeof()
|
||||||
|
|
||||||
Token* tok2 = tok->next();
|
Token* tok2 = tok->next();
|
||||||
do {
|
do {
|
||||||
size *= static_cast<unsigned int>(MathLib::toLongNumber(tok2->strAt(1)));
|
size *= MathLib::toULongNumber(tok2->strAt(1));
|
||||||
tok2 = tok2->tokAt(3);
|
tok2 = tok2->tokAt(3);
|
||||||
} while (Token::Match(tok2, "[ %num% ]"));
|
} while (Token::Match(tok2, "[ %num% ]"));
|
||||||
if (Token::Match(tok2, "[;=]")) {
|
if (Token::Match(tok2, "[;=]")) {
|
||||||
|
@ -3183,7 +3183,7 @@ bool Tokenizer::simplifySizeof()
|
||||||
for (unsigned int i = 0; i < derefs; i++)
|
for (unsigned int i = 0; i < derefs; i++)
|
||||||
tok2 = tok2->linkAt(1); // Skip all dimensions that are derefenced before the sizeof call
|
tok2 = tok2->linkAt(1); // Skip all dimensions that are derefenced before the sizeof call
|
||||||
while (Token::Match(tok2, "] [ %num% ]")) {
|
while (Token::Match(tok2, "] [ %num% ]")) {
|
||||||
sz *= static_cast<size_t>(MathLib::toULongNumber(tok2->strAt(2)));
|
sz *= MathLib::toULongNumber(tok2->strAt(2));
|
||||||
tok2 = tok2->linkAt(1);
|
tok2 = tok2->linkAt(1);
|
||||||
}
|
}
|
||||||
if (Token::simpleMatch(tok2, "] ["))
|
if (Token::simpleMatch(tok2, "] ["))
|
||||||
|
@ -3195,7 +3195,7 @@ bool Tokenizer::simplifySizeof()
|
||||||
continue;
|
continue;
|
||||||
const Token *tok2 = nametok->next();
|
const Token *tok2 = nametok->next();
|
||||||
while (Token::Match(tok2, "[ %num% ]")) {
|
while (Token::Match(tok2, "[ %num% ]")) {
|
||||||
sz *= static_cast<size_t>(MathLib::toLongNumber(tok2->strAt(1)));
|
sz *= MathLib::toULongNumber(tok2->strAt(1));
|
||||||
tok2 = tok2->link()->next();
|
tok2 = tok2->link()->next();
|
||||||
}
|
}
|
||||||
if (!tok2 || tok2->str() != ")")
|
if (!tok2 || tok2->str() != ")")
|
||||||
|
|
|
@ -92,7 +92,7 @@ unsigned int TokenList::appendFileIfNew(const std::string &fileName)
|
||||||
_isCPP = _settings->enforcedLang == Settings::CPP || (_settings->enforcedLang == Settings::None && Path::isCPP(getSourceFilePath()));
|
_isCPP = _settings->enforcedLang == Settings::CPP || (_settings->enforcedLang == Settings::None && Path::isCPP(getSourceFilePath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return static_cast<unsigned int>(_files.size() - 1);
|
return _files.size() - 1U;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TokenList::deleteTokens(Token *tok)
|
void TokenList::deleteTokens(Token *tok)
|
||||||
|
@ -400,7 +400,7 @@ unsigned long long TokenList::calculateChecksum() const
|
||||||
{
|
{
|
||||||
unsigned long long checksum = 0;
|
unsigned long long checksum = 0;
|
||||||
for (const Token* tok = front(); tok; tok = tok->next()) {
|
for (const Token* tok = front(); tok; tok = tok->next()) {
|
||||||
const unsigned int subchecksum1 = tok->flags() + tok->varId() + static_cast<unsigned int>(tok->tokType());
|
const unsigned int subchecksum1 = tok->flags() + tok->varId() + tok->tokType();
|
||||||
unsigned int subchecksum2 = 0;
|
unsigned int subchecksum2 = 0;
|
||||||
for (std::size_t i = 0; i < tok->str().size(); i++)
|
for (std::size_t i = 0; i < tok->str().size(); i++)
|
||||||
subchecksum2 += (unsigned int)tok->str()[i];
|
subchecksum2 += (unsigned int)tok->str()[i];
|
||||||
|
|
Loading…
Reference in New Issue