forked from qt-creator/qt-creator
Fix compiler warnings on windows.
Ignore some warnings inside 3rd party code and fix a lot of conversion warnings. Change-Id: I909f2f31a4639015bf7dd028d2d435ff1d1167bc Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
2
src/libs/3rdparty/botan/botan.pri
vendored
2
src/libs/3rdparty/botan/botan.pri
vendored
@@ -36,7 +36,7 @@ win32 {
|
||||
|
||||
win32-msvc* {
|
||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -EHs
|
||||
QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250
|
||||
QMAKE_CXXFLAGS += -wd4251 -wd4290 -wd4250 -wd4297 -wd4267 -wd4334
|
||||
DEFINES += BOTAN_BUILD_COMPILER_IS_MSVC BOTAN_TARGET_OS_HAS_GMTIME_S _SCL_SECURE_NO_WARNINGS
|
||||
} else {
|
||||
QMAKE_CFLAGS += -fpermissive -finline-functions -Wno-long-long
|
||||
|
@@ -70,7 +70,7 @@ void ConnectionServer::setIpcServer(IpcServerInterface *ipcServer)
|
||||
|
||||
int ConnectionServer::clientProxyCount() const
|
||||
{
|
||||
return ipcClientProxies.size();
|
||||
return static_cast<int>(ipcClientProxies.size());
|
||||
}
|
||||
|
||||
void ConnectionServer::timerEvent(QTimerEvent *timerEvent)
|
||||
|
@@ -58,30 +58,30 @@ Parser::Parser(Engine *engine, const char *source, unsigned size, int variant)
|
||||
|
||||
switch (tk.kind) {
|
||||
case T_LEFT_PAREN:
|
||||
parenStack.push(_tokens.size());
|
||||
parenStack.push(static_cast<int>(_tokens.size()));
|
||||
break;
|
||||
case T_LEFT_BRACKET:
|
||||
bracketStack.push(_tokens.size());
|
||||
bracketStack.push(static_cast<int>(_tokens.size()));
|
||||
break;
|
||||
case T_LEFT_BRACE:
|
||||
braceStack.push(_tokens.size());
|
||||
braceStack.push(static_cast<int>(_tokens.size()));
|
||||
break;
|
||||
|
||||
case T_RIGHT_PAREN:
|
||||
if (! parenStack.empty()) {
|
||||
_tokens[parenStack.top()].matchingBrace = _tokens.size();
|
||||
_tokens[parenStack.top()].matchingBrace = static_cast<int>(_tokens.size());
|
||||
parenStack.pop();
|
||||
}
|
||||
break;
|
||||
case T_RIGHT_BRACKET:
|
||||
if (! bracketStack.empty()) {
|
||||
_tokens[bracketStack.top()].matchingBrace = _tokens.size();
|
||||
_tokens[bracketStack.top()].matchingBrace = static_cast<int>(_tokens.size());
|
||||
bracketStack.pop();
|
||||
}
|
||||
break;
|
||||
case T_RIGHT_BRACE:
|
||||
if (! braceStack.empty()) {
|
||||
_tokens[braceStack.top()].matchingBrace = _tokens.size();
|
||||
_tokens[braceStack.top()].matchingBrace = static_cast<int>(_tokens.size());
|
||||
braceStack.pop();
|
||||
}
|
||||
break;
|
||||
|
@@ -114,7 +114,7 @@ private:
|
||||
inline int consumeToken() {
|
||||
if (_index < int(_tokens.size()))
|
||||
return _index++;
|
||||
return _tokens.size() - 1;
|
||||
return static_cast<int>(_tokens.size()) - 1;
|
||||
}
|
||||
inline const Token &tokenAt(int index) const {
|
||||
if (index == 0)
|
||||
|
@@ -34,7 +34,9 @@
|
||||
|
||||
#include <windows.h>
|
||||
#define KDEXT_64BIT
|
||||
#pragma warning( disable : 4838 )
|
||||
#include <wdbgexts.h>
|
||||
#pragma warning( default : 4838 )
|
||||
#include <dbgeng.h>
|
||||
|
||||
typedef IDebugControl3 CIDebugControl;
|
||||
|
@@ -45,7 +45,7 @@ inline Botan::byte *convertByteArray(QByteArray &a)
|
||||
|
||||
inline QByteArray convertByteArray(const Botan::SecureVector<Botan::byte> &v)
|
||||
{
|
||||
return QByteArray(reinterpret_cast<const char *>(v.begin()), v.size());
|
||||
return QByteArray(reinterpret_cast<const char *>(v.begin()), static_cast<int>(v.size()));
|
||||
}
|
||||
|
||||
inline const char *botanKeyExchangeAlgoName(const QByteArray &rfcAlgoName)
|
||||
|
@@ -82,11 +82,11 @@ void SshAbstractCryptoFacility::recreateKeys(const SshKeyExchange &kex)
|
||||
BlockCipher * const cipher
|
||||
= af.prototype_block_cipher(botanCryptAlgoName(rfcCryptAlgoName))->clone();
|
||||
|
||||
m_cipherBlockSize = cipher->block_size();
|
||||
m_cipherBlockSize = static_cast<quint32>(cipher->block_size());
|
||||
const QByteArray ivData = generateHash(kex, ivChar(), m_cipherBlockSize);
|
||||
const InitializationVector iv(convertByteArray(ivData), m_cipherBlockSize);
|
||||
|
||||
const quint32 keySize = cipher->key_spec().maximum_keylength();
|
||||
const quint32 keySize = static_cast<quint32>(cipher->key_spec().maximum_keylength());
|
||||
const QByteArray cryptKeyData = generateHash(kex, keyChar(), keySize);
|
||||
SymmetricKey cryptKey(convertByteArray(cryptKeyData), keySize);
|
||||
Keyed_Filter * const cipherMode
|
||||
@@ -118,8 +118,9 @@ void SshAbstractCryptoFacility::convert(QByteArray &data, quint32 offset,
|
||||
}
|
||||
m_pipe->process_msg(reinterpret_cast<const byte *>(data.constData()) + offset,
|
||||
dataSize);
|
||||
quint32 bytesRead = m_pipe->read(reinterpret_cast<byte *>(data.data()) + offset,
|
||||
dataSize, m_pipe->message_count() - 1); // Can't use Pipe::LAST_MESSAGE because of a VC bug.
|
||||
// Can't use Pipe::LAST_MESSAGE because of a VC bug.
|
||||
quint32 bytesRead = static_cast<quint32>(m_pipe->read(
|
||||
reinterpret_cast<byte *>(data.data()) + offset, dataSize, m_pipe->message_count() - 1));
|
||||
if (bytesRead != dataSize) {
|
||||
throw SshClientException(SshInternalError,
|
||||
QLatin1String("Internal error: Botan::Pipe::read() returned unexpected value"));
|
||||
@@ -261,7 +262,8 @@ bool SshEncryptionFacility::createAuthenticationKeyFromPKCS8(const QByteArray &p
|
||||
<< rsaKey->get_d();
|
||||
} else if (auto * const ecdsaKey = dynamic_cast<ECDSA_PrivateKey *>(m_authKey.data())) {
|
||||
const BigInt value = ecdsaKey->private_value();
|
||||
m_authKeyAlgoName = SshCapabilities::ecdsaPubKeyAlgoForKeyWidth(value.bytes());
|
||||
m_authKeyAlgoName = SshCapabilities::ecdsaPubKeyAlgoForKeyWidth(
|
||||
static_cast<int>(value.bytes()));
|
||||
pubKeyParams << ecdsaKey->public_point().get_affine_x()
|
||||
<< ecdsaKey->public_point().get_affine_y();
|
||||
allKeyParams << pubKeyParams << value;
|
||||
@@ -346,7 +348,8 @@ bool SshEncryptionFacility::createAuthenticationKeyFromOpenSSL(const QByteArray
|
||||
} else {
|
||||
BigInt privKey;
|
||||
sequence.decode_octet_string_bigint(privKey);
|
||||
m_authKeyAlgoName = SshCapabilities::ecdsaPubKeyAlgoForKeyWidth(privKey.bytes());
|
||||
m_authKeyAlgoName = SshCapabilities::ecdsaPubKeyAlgoForKeyWidth(
|
||||
static_cast<int>(privKey.bytes()));
|
||||
const EC_Group group(SshCapabilities::oid(m_authKeyAlgoName));
|
||||
auto * const key = new ECDSA_PrivateKey(m_rng, group, privKey);
|
||||
m_authKey.reset(key);
|
||||
|
@@ -115,7 +115,7 @@ void SshKeyGenerator::generatePkcs8KeyString(const KeyPtr &key, bool privateKey,
|
||||
keyData = &m_publicKey;
|
||||
}
|
||||
pipe.end_msg();
|
||||
keyData->resize(pipe.remaining(pipe.message_count() - 1));
|
||||
keyData->resize(static_cast<int>(pipe.remaining(pipe.message_count()) - 1));
|
||||
pipe.read(convertByteArray(*keyData), keyData->size(),
|
||||
pipe.message_count() - 1);
|
||||
}
|
||||
@@ -147,7 +147,8 @@ void SshKeyGenerator::generateOpenSslPublicKeyString(const KeyPtr &key)
|
||||
case Ecdsa: {
|
||||
const auto ecdsaKey = key.dynamicCast<ECDSA_PrivateKey>();
|
||||
q = convertByteArray(EC2OSP(ecdsaKey->public_point(), PointGFp::UNCOMPRESSED));
|
||||
keyId = SshCapabilities::ecdsaPubKeyAlgoForKeyWidth(ecdsaKey->private_value().bytes());
|
||||
keyId = SshCapabilities::ecdsaPubKeyAlgoForKeyWidth(
|
||||
static_cast<int>(ecdsaKey->private_value().bytes()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ QByteArray AbstractSshPacket::encodeMpInt(const Botan::BigInt &number)
|
||||
if (number.is_zero())
|
||||
return QByteArray(4, 0);
|
||||
|
||||
int stringLength = number.bytes();
|
||||
int stringLength = static_cast<int>(number.bytes());
|
||||
const bool positiveAndMsbSet = number.sign() == Botan::BigInt::Positive
|
||||
&& (number.byte_at(stringLength - 1) & 0x80);
|
||||
if (positiveAndMsbSet)
|
||||
|
@@ -296,7 +296,7 @@ void blockingContainerMapReduce(QFutureInterface<ReduceResult> &futureInterface,
|
||||
std::forward<InitFunction>(init), std::forward<MapFunction>(map),
|
||||
std::forward<ReduceFunction>(reduce),
|
||||
std::forward<CleanUpFunction>(cleanup),
|
||||
option, container.size());
|
||||
option, static_cast<int>(container.size()));
|
||||
}
|
||||
|
||||
template <typename Container, typename InitFunction, typename MapFunction, typename ReduceResult,
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "fileutils.h"
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
# include <sys/stat.h>
|
||||
@@ -97,7 +98,7 @@ bool SaveFile::commit()
|
||||
return false;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
FlushFileBuffers(reinterpret_cast<HANDLE>(handle()));
|
||||
FlushFileBuffers(reinterpret_cast<HANDLE>(_get_osfhandle(handle())));
|
||||
#elif _POSIX_SYNCHRONIZED_IO > 0
|
||||
fdatasync(handle());
|
||||
#else
|
||||
|
@@ -203,7 +203,7 @@ int alignedSize(int size) { return (size + 3) & ~3; }
|
||||
|
||||
static int qStringSize(const std::string &ba)
|
||||
{
|
||||
int l = 4 + ba.length();
|
||||
int l = 4 + static_cast<int>(ba.length());
|
||||
return alignedSize(l);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
|
||||
void operator=(const std::string &ba)
|
||||
{
|
||||
d->length = ba.length();
|
||||
d->length = static_cast<int>(ba.length());
|
||||
memcpy(d->utf8, ba.data(), ba.length());
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ public:
|
||||
int objectPosition;
|
||||
std::vector<uint32_t> offsets;
|
||||
|
||||
Entry *entryAt(int i) const {
|
||||
Entry *entryAt(size_t i) const {
|
||||
return reinterpret_cast<Entry *>(parser->data + objectPosition + offsets[i]);
|
||||
}
|
||||
};
|
||||
@@ -2505,7 +2505,8 @@ JsonObject::iterator JsonObject::insert(const std::string &key, const JsonValue
|
||||
Internal::Entry *e = o->entryAt(pos);
|
||||
e->value.type = val.t;
|
||||
e->value.intValue = isIntValue;
|
||||
e->value.value = Internal::Value::valueToStore(val, (char *)e - (char *)o + valueOffset);
|
||||
e->value.value = Internal::Value::valueToStore(val, static_cast<uint32_t>((char *)e - (char *)o)
|
||||
+ valueOffset);
|
||||
Internal::copyString((char *)(e + 1), key);
|
||||
if (valueSize)
|
||||
Internal::Value::copyData(val, (char *)e + valueOffset, isIntValue);
|
||||
@@ -3475,7 +3476,7 @@ std::string JsonDocument::toJson(JsonFormat format) const
|
||||
*/
|
||||
JsonDocument JsonDocument::fromJson(const std::string &json, JsonParseError *error)
|
||||
{
|
||||
Internal::Parser parser(json.data(), json.length());
|
||||
Internal::Parser parser(json.data(), static_cast<int>(json.length()));
|
||||
return parser.parse(error);
|
||||
}
|
||||
|
||||
@@ -4008,7 +4009,7 @@ JsonDocument Parser::parse(JsonParseError *error)
|
||||
std::cerr << ">>>>> parser begin";
|
||||
#endif
|
||||
// allocate some space
|
||||
dataLength = std::max(end - json, std::ptrdiff_t(256));
|
||||
dataLength = static_cast<int>(std::max(end - json, std::ptrdiff_t(256)));
|
||||
data = (char *)malloc(dataLength);
|
||||
|
||||
// fill in Header data
|
||||
@@ -4054,7 +4055,7 @@ error:
|
||||
std::cerr << ">>>>> parser error";
|
||||
#endif
|
||||
if (error) {
|
||||
error->offset = json - head;
|
||||
error->offset = static_cast<int>(json - head);
|
||||
error->error = lastError;
|
||||
}
|
||||
free(data);
|
||||
@@ -4068,8 +4069,8 @@ void Parser::ParsedObject::insert(uint32_t offset)
|
||||
size_t min = 0;
|
||||
size_t n = offsets.size();
|
||||
while (n > 0) {
|
||||
int half = n >> 1;
|
||||
int middle = min + half;
|
||||
size_t half = n >> 1;
|
||||
size_t middle = min + half;
|
||||
if (*entryAt(middle) >= *newEntry) {
|
||||
n = half;
|
||||
} else {
|
||||
@@ -4127,7 +4128,7 @@ bool Parser::parseObject()
|
||||
int table = objectOffset;
|
||||
// finalize the object
|
||||
if (parsedObject.offsets.size()) {
|
||||
int tableSize = parsedObject.offsets.size()*sizeof(uint32_t);
|
||||
int tableSize = static_cast<int>(parsedObject.offsets.size()) * sizeof(uint32_t);
|
||||
table = reserveSpace(tableSize);
|
||||
memcpy(data + table, &*parsedObject.offsets.begin(), tableSize);
|
||||
}
|
||||
@@ -4136,7 +4137,7 @@ bool Parser::parseObject()
|
||||
o->tableOffset = table - objectOffset;
|
||||
o->size = current - objectOffset;
|
||||
o->is_object = true;
|
||||
o->length = parsedObject.offsets.size();
|
||||
o->length = static_cast<int>(parsedObject.offsets.size());
|
||||
|
||||
DEBUG << "current=" << current;
|
||||
END;
|
||||
@@ -4218,7 +4219,7 @@ bool Parser::parseArray()
|
||||
int table = arrayOffset;
|
||||
// finalize the object
|
||||
if (values.size()) {
|
||||
int tableSize = values.size()*sizeof(Value);
|
||||
int tableSize = static_cast<int>(values.size() * sizeof(Value));
|
||||
table = reserveSpace(tableSize);
|
||||
memcpy(data + table, values.data(), tableSize);
|
||||
}
|
||||
@@ -4227,7 +4228,7 @@ bool Parser::parseArray()
|
||||
a->tableOffset = table - arrayOffset;
|
||||
a->size = current - arrayOffset;
|
||||
a->is_object = false;
|
||||
a->length = values.size();
|
||||
a->length = static_cast<int>(values.size());
|
||||
|
||||
DEBUG << "current=" << current;
|
||||
END;
|
||||
@@ -4558,7 +4559,7 @@ bool Parser::parseString()
|
||||
const char c = *json;
|
||||
if (c == '"') {
|
||||
// write string length and padding.
|
||||
const int len = json - inStart;
|
||||
const int len = static_cast<int>(json - inStart);
|
||||
const int pos = reserveSpace(4 + alignedSize(len));
|
||||
toInternal(data + pos, inStart, len);
|
||||
END;
|
||||
|
@@ -236,6 +236,7 @@ void dummyStatement(...) {}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#include <basetsd.h>
|
||||
#undef min
|
||||
#undef max
|
||||
#endif
|
||||
@@ -276,7 +277,11 @@ void dummyStatement(...) {}
|
||||
QT_BEGIN_NAMESPACE
|
||||
uint qHash(const QMap<int, int> &) { return 0; }
|
||||
uint qHash(const double & f) { return int(f); }
|
||||
uint qHash(const QPointer<QObject> &p) { return (ulong)p.data(); }
|
||||
#ifdef Q_OS_WIN
|
||||
uint qHash(const QPointer<QObject> &p) { return PtrToUint(p.data()); }
|
||||
#else
|
||||
uint qHash(const QPointer<QObject> &p) { (ulong)p.data(); }
|
||||
#endif
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@@ -3336,7 +3341,7 @@ namespace lambda {
|
||||
{
|
||||
std::string x;
|
||||
auto f = [&] () -> const std::string & {
|
||||
int z = x.size();
|
||||
size_t z = x.size();
|
||||
Q_UNUSED(z);
|
||||
return x;
|
||||
};
|
||||
|
Reference in New Issue
Block a user