qmake: Fix qHash-related integer conversion warnings
Use size_t instead of uint. Change-Id: I1dc38f61653f9bfc4ddeddcc65b0271aa4ad1256 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
9ed75b6716
commit
008343a05e
@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
struct FixStringCacheKey
|
struct FixStringCacheKey
|
||||||
{
|
{
|
||||||
mutable uint hash;
|
mutable size_t hash;
|
||||||
QString string, pwd;
|
QString string, pwd;
|
||||||
uchar flags;
|
uchar flags;
|
||||||
FixStringCacheKey(const QString &s, uchar f)
|
FixStringCacheKey(const QString &s, uchar f)
|
||||||
@ -58,7 +58,7 @@ struct FixStringCacheKey
|
|||||||
f.string == string &&
|
f.string == string &&
|
||||||
f.pwd == pwd);
|
f.pwd == pwd);
|
||||||
}
|
}
|
||||||
inline uint hashCode() const {
|
inline size_t hashCode() const {
|
||||||
if(!hash)
|
if(!hash)
|
||||||
hash = qHash(string) ^ qHash(flags) /*^ qHash(pwd)*/;
|
hash = qHash(string) ^ qHash(flags) /*^ qHash(pwd)*/;
|
||||||
return hash;
|
return hash;
|
||||||
@ -69,7 +69,7 @@ inline size_t qHash(const FixStringCacheKey &f) { return f.hashCode(); }
|
|||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
struct FileInfoCacheKey
|
struct FileInfoCacheKey
|
||||||
{
|
{
|
||||||
mutable uint hash;
|
mutable size_t hash;
|
||||||
QString file, pwd;
|
QString file, pwd;
|
||||||
FileInfoCacheKey(const QString &f)
|
FileInfoCacheKey(const QString &f)
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ struct FileInfoCacheKey
|
|||||||
return (hashCode() == f.hashCode() && f.file == file &&
|
return (hashCode() == f.hashCode() && f.file == file &&
|
||||||
f.pwd == pwd);
|
f.pwd == pwd);
|
||||||
}
|
}
|
||||||
inline uint hashCode() const {
|
inline size_t hashCode() const {
|
||||||
if(!hash)
|
if(!hash)
|
||||||
hash = qHash(file) /*^ qHash(pwd)*/;
|
hash = qHash(file) /*^ qHash(pwd)*/;
|
||||||
return hash;
|
return hash;
|
||||||
|
@ -310,7 +310,7 @@ inline bool MakefileGenerator::findLibraries(bool, bool)
|
|||||||
|
|
||||||
struct ReplaceExtraCompilerCacheKey
|
struct ReplaceExtraCompilerCacheKey
|
||||||
{
|
{
|
||||||
mutable uint hash;
|
mutable size_t hash;
|
||||||
QString var, in, out, pwd;
|
QString var, in, out, pwd;
|
||||||
MakefileGenerator::ReplaceFor forShell;
|
MakefileGenerator::ReplaceFor forShell;
|
||||||
ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o, MakefileGenerator::ReplaceFor s);
|
ReplaceExtraCompilerCacheKey(const QString &v, const QStringList &i, const QStringList &o, MakefileGenerator::ReplaceFor s);
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
// from qhash.cpp
|
// from qhash.cpp
|
||||||
uint ProString::hash(const QChar *p, int n)
|
size_t ProString::hash(const QChar *p, int n)
|
||||||
{
|
{
|
||||||
uint h = 0;
|
size_t h = 0;
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
h = (h << 4) + (*p++).unicode();
|
h = (h << 4) + (*p++).unicode();
|
||||||
@ -80,13 +80,13 @@ ProString::ProString(QStringView str) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProString::ProString(const char *str, DoPreHashing) :
|
ProString::ProString(const char *str, DoPreHashing) :
|
||||||
m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0)
|
m_string(QString::fromLatin1(str)), m_offset(0), m_length(int(qstrlen(str))), m_file(0)
|
||||||
{
|
{
|
||||||
updatedHash();
|
updatedHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProString::ProString(const char *str) :
|
ProString::ProString(const char *str) :
|
||||||
m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0), m_hash(0x80000000)
|
m_string(QString::fromLatin1(str)), m_offset(0), m_length(int(qstrlen(str))), m_file(0), m_hash(0x80000000)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ void ProString::setValue(const QString &str)
|
|||||||
m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000;
|
m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint ProString::updatedHash() const
|
size_t ProString::updatedHash() const
|
||||||
{
|
{
|
||||||
return (m_hash = hash(m_string.constData() + m_offset, m_length));
|
return (m_hash = hash(m_string.constData() + m_offset, m_length));
|
||||||
}
|
}
|
||||||
|
@ -155,8 +155,8 @@ public:
|
|||||||
int toInt(bool *ok = nullptr, int base = 10) const { return toQStringView().toInt(ok, base); }
|
int toInt(bool *ok = nullptr, int base = 10) const { return toQStringView().toInt(ok, base); }
|
||||||
short toShort(bool *ok = nullptr, int base = 10) const { return toQStringView().toShort(ok, base); }
|
short toShort(bool *ok = nullptr, int base = 10) const { return toQStringView().toShort(ok, base); }
|
||||||
|
|
||||||
uint hash() const { return m_hash; }
|
size_t hash() const { return m_hash; }
|
||||||
static uint hash(const QChar *p, int n);
|
static size_t hash(const QChar *p, int n);
|
||||||
|
|
||||||
ALWAYS_INLINE QStringView toQStringView() const { return QStringView(m_string).mid(m_offset, m_length); }
|
ALWAYS_INLINE QStringView toQStringView() const { return QStringView(m_string).mid(m_offset, m_length); }
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ private:
|
|||||||
QString m_string;
|
QString m_string;
|
||||||
int m_offset, m_length;
|
int m_offset, m_length;
|
||||||
int m_file;
|
int m_file;
|
||||||
mutable uint m_hash;
|
mutable size_t m_hash;
|
||||||
uint updatedHash() const;
|
size_t updatedHash() const;
|
||||||
friend size_t qHash(const ProString &str);
|
friend size_t qHash(const ProString &str);
|
||||||
friend QString operator+(const ProString &one, const ProString &two);
|
friend QString operator+(const ProString &one, const ProString &two);
|
||||||
friend class ProKey;
|
friend class ProKey;
|
||||||
|
@ -291,7 +291,7 @@ void QMakeParser::putBlock(ushort *&tokPtr, const ushort *buf, uint len)
|
|||||||
|
|
||||||
void QMakeParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len)
|
void QMakeParser::putHashStr(ushort *&pTokPtr, const ushort *buf, uint len)
|
||||||
{
|
{
|
||||||
uint hash = ProString::hash((const QChar *)buf, len);
|
const size_t hash = ProString::hash((const QChar *)buf, len);
|
||||||
ushort *tokPtr = pTokPtr;
|
ushort *tokPtr = pTokPtr;
|
||||||
*tokPtr++ = (ushort)hash;
|
*tokPtr++ = (ushort)hash;
|
||||||
*tokPtr++ = (ushort)(hash >> 16);
|
*tokPtr++ = (ushort)(hash >> 16);
|
||||||
@ -305,7 +305,7 @@ void QMakeParser::finalizeHashStr(ushort *buf, uint len)
|
|||||||
{
|
{
|
||||||
buf[-4] = TokHashLiteral;
|
buf[-4] = TokHashLiteral;
|
||||||
buf[-1] = len;
|
buf[-1] = len;
|
||||||
uint hash = ProString::hash((const QChar *)buf, len);
|
const size_t hash = ProString::hash((const QChar *)buf, len);
|
||||||
buf[-3] = (ushort)hash;
|
buf[-3] = (ushort)hash;
|
||||||
buf[-2] = (ushort)(hash >> 16);
|
buf[-2] = (ushort)(hash >> 16);
|
||||||
}
|
}
|
||||||
@ -581,7 +581,7 @@ void QMakeParser::read(ProFile *pro, QStringView in, int line, SubGrammar gramma
|
|||||||
&buf, &xprBuff, &tokPtr, &tokBuff, cur, in)) {
|
&buf, &xprBuff, &tokPtr, &tokBuff, cur, in)) {
|
||||||
if (rtok == TokVariable || rtok == TokProperty) {
|
if (rtok == TokVariable || rtok == TokProperty) {
|
||||||
xprPtr[-4] = tok;
|
xprPtr[-4] = tok;
|
||||||
uint hash = ProString::hash((const QChar *)xprPtr, tlen);
|
const size_t hash = ProString::hash((const QChar *)xprPtr, tlen);
|
||||||
xprPtr[-3] = (ushort)hash;
|
xprPtr[-3] = (ushort)hash;
|
||||||
xprPtr[-2] = (ushort)(hash >> 16);
|
xprPtr[-2] = (ushort)(hash >> 16);
|
||||||
xprPtr[-1] = tlen;
|
xprPtr[-1] = tlen;
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
TokenStream &operator<<(uint n) { ts += QChar(n & 0xffff); ts += QChar(n >> 16); return *this; }
|
TokenStream &operator<<(uint n) { ts += QChar(n & 0xffff); ts += QChar(n >> 16); return *this; }
|
||||||
TokenStream &operator<<(QStringView s) { ts += s; return *this; }
|
TokenStream &operator<<(QStringView s) { ts += s; return *this; }
|
||||||
TokenStream &operator<<(const ProString &s) { return *this << ushort(s.length()) << s.toQStringView(); }
|
TokenStream &operator<<(const ProString &s) { return *this << ushort(s.length()) << s.toQStringView(); }
|
||||||
TokenStream &operator<<(const ProKey &s) { return *this << s.hash() << s.toString(); }
|
TokenStream &operator<<(const ProKey &s) { return *this << uint(s.hash()) << s.toString(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString ts;
|
QString ts;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user