Fix warnings about truncations in constants.
Change-Id: I46872c5b2866454112092c1ec5efbfe15db5af33 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
c6272b711f
commit
7108acde8a
|
|
@ -99,11 +99,11 @@ static char *mkdtemp(char *templateName)
|
|||
{
|
||||
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
const int length = strlen(templateName);
|
||||
const size_t length = strlen(templateName);
|
||||
|
||||
char *XXXXXX = templateName + length - 6;
|
||||
|
||||
if ((length < 6) || strncmp(XXXXXX, "XXXXXX", 6))
|
||||
if ((length < 6u) || strncmp(XXXXXX, "XXXXXX", 6))
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
|
|
|
|||
|
|
@ -821,7 +821,7 @@ bool Parser::parseString(bool *latin1)
|
|||
// no unicode string, we are done
|
||||
if (*latin1) {
|
||||
// write string length
|
||||
*(QJsonPrivate::qle_ushort *)(data + stringPos) = current - outStart - sizeof(ushort);
|
||||
*(QJsonPrivate::qle_ushort *)(data + stringPos) = ushort(current - outStart - sizeof(ushort));
|
||||
int pos = reserveSpace((4 - current) & 3);
|
||||
while (pos & 3)
|
||||
data[pos++] = 0;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ Q_CORE_EXPORT QString qAppFileName() // get application file name
|
|||
size = MAX_PATH * i;
|
||||
b = reinterpret_cast<wchar_t *>(realloc(b, (size + 1) * sizeof(wchar_t)));
|
||||
if (b)
|
||||
v = GetModuleFileName(NULL, b, size);
|
||||
v = GetModuleFileName(NULL, b, DWORD(size));
|
||||
} while (b && v == size);
|
||||
|
||||
if (b)
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ QMimeMagicRule::QMimeMagicRule(QMimeMagicRule::Type theType,
|
|||
d->mask = QByteArray::fromHex(QByteArray::fromRawData(d->mask.constData() + 2, d->mask.size() - 2));
|
||||
Q_ASSERT(d->mask.size() == d->pattern.size());
|
||||
} else {
|
||||
d->mask.fill(static_cast<char>(0xff), d->pattern.size());
|
||||
d->mask.fill(char(-1), d->pattern.size());
|
||||
}
|
||||
d->mask.squeeze();
|
||||
d->matchFunction = matchString;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const float smallCapsFraction = 0.7;
|
||||
static const float smallCapsFraction = 0.7f;
|
||||
|
||||
namespace {
|
||||
// Helper class used in QTextEngine::itemize
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ void QZipReaderPrivate::scanFiles()
|
|||
int num_dir_entries = 0;
|
||||
EndOfDirectory eod;
|
||||
while (start_of_directory == -1) {
|
||||
int pos = device->size() - sizeof(EndOfDirectory) - i;
|
||||
const int pos = device->size() - int(sizeof(EndOfDirectory)) - i;
|
||||
if (pos < 0 || i > 65535) {
|
||||
qWarning() << "QZip: EndOfDirectory not found";
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ static bool checkStaticArray(int &val, const QByteArray &dateString, int at, con
|
|||
val = j;
|
||||
return true;
|
||||
}
|
||||
i += strlen(str) + 1;
|
||||
i += int(strlen(str)) + 1;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ static int hashKword(const char *s, int len)
|
|||
|
||||
static void insertKwordIntoHash(const char *s, int number)
|
||||
{
|
||||
int k = hashKword(s, strlen(s));
|
||||
int k = hashKword(s, int(strlen(s)));
|
||||
while (kwordHashTable[k]) {
|
||||
if (++k == KwordHashTableSize)
|
||||
k = 0;
|
||||
|
|
@ -166,7 +166,7 @@ int Tokenizer::getToken()
|
|||
yyCh = getChar();
|
||||
} while (isalnum(yyCh) || yyCh == '_');
|
||||
|
||||
int k = hashKword(yyLex, yyLexLen);
|
||||
int k = hashKword(yyLex, int(yyLexLen));
|
||||
for (;;) {
|
||||
int i = kwordHashTable[k];
|
||||
if (i == 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue