Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
73229006
Commit
73229006
authored
Sep 02, 2010
by
Oswald Buddenhagen
Browse files
make ProFileParser API less bug-prone
QString::isNull() vs. isEmpty() discrimination is a time bomb ...
parent
34a8a57d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemoprofilewrapper.cpp
View file @
73229006
...
...
@@ -227,7 +227,7 @@ void MaemoProFileWrapper::parseProFile(ParseType type) const
m_proFileReader
->
setCumulative
(
false
);
// TODO: Set output dir to build dir?
if
(
type
==
ParseFromLines
)
{
m_proFile
=
m_proFileReader
->
parsedPro
File
(
m_proFileName
,
false
,
m_proFile
=
m_proFileReader
->
parsedPro
Block
(
m_proFileName
,
m_proFileContents
.
join
(
"
\n
"
));
}
else
{
m_proFileContents
.
clear
();
...
...
src/plugins/qt4projectmanager/qt4nodes.cpp
View file @
73229006
...
...
@@ -1050,7 +1050,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
ProMessageHandler
handler
;
ProFileParser
parser
(
0
,
&
handler
);
includeFile
=
parser
.
parsedPro
File
(
m_projectFilePath
,
false
,
contents
);
includeFile
=
parser
.
parsedPro
Block
(
m_projectFilePath
,
contents
);
}
const
QStringList
vars
=
varNames
(
fileType
);
...
...
src/shared/proparser/profileevaluator.cpp
View file @
73229006
...
...
@@ -1274,8 +1274,8 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::visitProFile(
tgt
.
append
(
ProString
(
QFileInfo
(
pro
->
fileName
()).
baseName
(),
NoHash
));
if
(
!
m_cmdArgs
.
isEmpty
())
{
if
(
ProFile
*
pro
=
m_parser
->
parsedPro
File
(
fL1S
(
"(command line)"
),
false
,
m_cmdArgs
.
join
(
fL1S
(
"
\n
"
))))
{
if
(
ProFile
*
pro
=
m_parser
->
parsedPro
Block
(
fL1S
(
"(command line)"
),
m_cmdArgs
.
join
(
fL1S
(
"
\n
"
))))
{
m_locationStack
.
push
(
m_current
);
visitProBlock
(
pro
,
pro
->
tokPtr
());
m_current
=
m_locationStack
.
pop
();
...
...
@@ -2420,8 +2420,8 @@ ProFileEvaluator::Private::VisitReturn ProFileEvaluator::Private::evaluateCondit
case T_REQUIRES:
#endif
case
T_EVAL
:
{
ProFile
*
pro
=
m_parser
->
parsedPro
File
(
fL1S
(
"(eval)"
),
false
,
args
.
join
(
statics
.
field_sep
));
ProFile
*
pro
=
m_parser
->
parsedPro
Block
(
fL1S
(
"(eval)"
),
args
.
join
(
statics
.
field_sep
));
if
(
!
pro
)
return
ReturnFalse
;
m_locationStack
.
push
(
m_current
);
...
...
src/shared/proparser/profileparser.cpp
View file @
73229006
...
...
@@ -124,7 +124,7 @@ ProFileParser::ProFileParser(ProFileCache *cache, ProFileParserHandler *handler)
initialize
();
}
ProFile
*
ProFileParser
::
parsedProFile
(
const
QString
&
fileName
,
bool
cache
,
const
QString
&
contents
)
ProFile
*
ProFileParser
::
parsedProFile
(
const
QString
&
fileName
,
bool
cache
,
const
QString
*
contents
)
{
ProFile
*
pro
;
if
(
cache
&&
m_cache
)
{
...
...
@@ -156,7 +156,7 @@ ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const
locker
.
unlock
();
#endif
pro
=
new
ProFile
(
fileName
);
if
(
!
(
contents
.
isNull
()
?
read
(
pro
)
:
read
(
pro
,
contents
)))
{
if
(
!
(
!
contents
?
read
(
pro
)
:
read
(
pro
,
*
contents
)))
{
delete
pro
;
pro
=
0
;
}
else
{
...
...
@@ -176,7 +176,7 @@ ProFile *ProFileParser::parsedProFile(const QString &fileName, bool cache, const
}
}
else
{
pro
=
new
ProFile
(
fileName
);
if
(
!
(
contents
.
isNull
()
?
read
(
pro
)
:
read
(
pro
,
contents
)))
{
if
(
!
(
!
contents
?
read
(
pro
)
:
read
(
pro
,
*
contents
)))
{
delete
pro
;
pro
=
0
;
}
...
...
src/shared/proparser/profileparser.h
View file @
73229006
...
...
@@ -70,7 +70,9 @@ public:
// fileName is expected to be absolute and cleanPath()ed.
// If contents is non-null, it will be used instead of the file's actual content
ProFile
*
parsedProFile
(
const
QString
&
fileName
,
bool
cache
=
false
,
const
QString
&
contents
=
QString
());
const
QString
*
contents
=
0
);
ProFile
*
parsedProBlock
(
const
QString
&
name
,
const
QString
&
contents
)
{
return
parsedProFile
(
name
,
false
,
&
contents
);
}
private:
struct
BlockScope
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment