forked from qt-creator/qt-creator
add ProFile::tokPtr(): centralize nasty cast
This commit is contained in:
@@ -457,9 +457,8 @@ uint ProFileEvaluator::Private::getBlockLen(const ushort *&tokPtr)
|
|||||||
|
|
||||||
ProString ProFileEvaluator::Private::getStr(const ushort *&tokPtr)
|
ProString ProFileEvaluator::Private::getStr(const ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
const QString &str(m_current.pro->items());
|
|
||||||
uint len = *tokPtr++;
|
uint len = *tokPtr++;
|
||||||
ProString ret(str, tokPtr - (const ushort *)str.constData(), len, NoHash);
|
ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, NoHash);
|
||||||
tokPtr += len;
|
tokPtr += len;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -468,8 +467,7 @@ ProString ProFileEvaluator::Private::getHashStr(const ushort *&tokPtr)
|
|||||||
{
|
{
|
||||||
uint hash = getBlockLen(tokPtr);
|
uint hash = getBlockLen(tokPtr);
|
||||||
uint len = *tokPtr++;
|
uint len = *tokPtr++;
|
||||||
const QString &str(m_current.pro->items());
|
ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, hash);
|
||||||
ProString ret(str, tokPtr - (const ushort *)str.constData(), len, hash);
|
|
||||||
tokPtr += len;
|
tokPtr += len;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -914,8 +912,7 @@ void ProFileEvaluator::Private::visitProFunctionDef(
|
|||||||
(tok == TokTestDef
|
(tok == TokTestDef
|
||||||
? &m_functionDefs.testFunctions
|
? &m_functionDefs.testFunctions
|
||||||
: &m_functionDefs.replaceFunctions);
|
: &m_functionDefs.replaceFunctions);
|
||||||
hash->insert(name, FunctionDef(m_current.pro,
|
hash->insert(name, FunctionDef(m_current.pro, tokPtr - m_current.pro->tokPtr()));
|
||||||
tokPtr - (const ushort *)m_current.pro->items().constData()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProLoop(
|
ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProLoop(
|
||||||
@@ -1283,7 +1280,7 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
visitProBlock(pro, (const ushort *)pro->items().constData());
|
visitProBlock(pro, pro->tokPtr());
|
||||||
|
|
||||||
if (m_profileStack.count() == 1) {
|
if (m_profileStack.count() == 1) {
|
||||||
if (m_parsePreAndPostFiles) {
|
if (m_parsePreAndPostFiles) {
|
||||||
@@ -2420,7 +2417,7 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::evaluateCondit
|
|||||||
if (!pro)
|
if (!pro)
|
||||||
return ReturnFalse;
|
return ReturnFalse;
|
||||||
m_locationStack.push(m_current);
|
m_locationStack.push(m_current);
|
||||||
VisitReturn ret = visitProBlock(pro, (const ushort *)pro->items().constData());
|
VisitReturn ret = visitProBlock(pro, pro->tokPtr());
|
||||||
m_current = m_locationStack.pop();
|
m_current = m_locationStack.pop();
|
||||||
pro->deref();
|
pro->deref();
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
ProFile *pro() const { return m_pro; }
|
ProFile *pro() const { return m_pro; }
|
||||||
const ushort *tokPtr() const { return (const ushort *)m_pro->items().constData() + m_offset; }
|
const ushort *tokPtr() const { return m_pro->tokPtr() + m_offset; }
|
||||||
private:
|
private:
|
||||||
ProFile *m_pro;
|
ProFile *m_pro;
|
||||||
int m_offset;
|
int m_offset;
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ public:
|
|||||||
QString directoryName() const { return m_directoryName; }
|
QString directoryName() const { return m_directoryName; }
|
||||||
const QString &items() const { return m_proitems; }
|
const QString &items() const { return m_proitems; }
|
||||||
QString *itemsRef() { return &m_proitems; }
|
QString *itemsRef() { return &m_proitems; }
|
||||||
|
const ushort *tokPtr() const { return (const ushort *)m_proitems.constData(); }
|
||||||
|
|
||||||
void ref() { m_refCount.ref(); }
|
void ref() { m_refCount.ref(); }
|
||||||
void deref() { if (!m_refCount.deref()) delete this; }
|
void deref() { if (!m_refCount.deref()) delete this; }
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ void ProWriter::addVarValues(ProFile *profile, QStringList *lines,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if variable item exists as child of root item
|
// Check if variable item exists as child of root item
|
||||||
const ushort *tokPtr = (const ushort *)profile->items().constData();
|
const ushort *tokPtr = profile->tokPtr();
|
||||||
int lineNo = 0;
|
int lineNo = 0;
|
||||||
QString tmp;
|
QString tmp;
|
||||||
const ushort *lastXpr = 0;
|
const ushort *lastXpr = 0;
|
||||||
@@ -259,7 +259,7 @@ QStringList ProWriter::removeVarValues(ProFile *profile, QStringList *lines,
|
|||||||
QStringList notChanged = values;
|
QStringList notChanged = values;
|
||||||
|
|
||||||
QList<int> varLines;
|
QList<int> varLines;
|
||||||
findProVariables((const ushort *)profile->items().constData(), vars, &varLines);
|
findProVariables(profile->tokPtr(), vars, &varLines);
|
||||||
|
|
||||||
QStringList valuesToFind;
|
QStringList valuesToFind;
|
||||||
if (valuesAreFiles) {
|
if (valuesAreFiles) {
|
||||||
|
|||||||
Reference in New Issue
Block a user