<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Is it possible to write "const GBool sWords = flags.testFlag(WholeWords);" instead of "const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse;"?<div><br></div><div>It does not give a compile warning with g++ 4.8.3 on Fedora 20, and goo/gtypes.h has "typedef bool GBool; #define gTrue true <span style="font-size: 12pt;">#define gFalse false". In theory, someone could change the definitions, but wouldn't it break a lot of tests if gTrue or gFalse were defined so that C++ considered (gFalse || !gTrue) as true in a condition?</span><div><br></div><div>William</div><br><div>> To: poppler@lists.freedesktop.org<br>> Date: Wed, 21 Jan 2015 13:31:58 -0800<br>> From: aacid@kemper.freedesktop.org<br>> Subject: [poppler] qt4/src qt4/tests qt5/src qt5/tests<br>> <br>> qt4/src/poppler-page.cc | 4 ++--<br>> qt4/src/poppler-qt4.h | 2 +-<br>> qt4/tests/check_search.cpp | 4 ++--<br>> qt5/src/poppler-page.cc | 4 ++--<br>> qt5/src/poppler-qt5.h | 2 +-<br>> qt5/tests/check_search.cpp | 4 ++--<br>> 6 files changed, 10 insertions(+), 10 deletions(-)<br>> <br>> New commits:<br>> commit 78abf540057181b708c546aee421f81a1dd58331<br>> Author: Adam Reichold <adamreichold@myopera.com><br>> Date: Wed Jan 21 22:30:45 2015 +0100<br>> <br>> Worlds -> Words<br>> <br>> diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc<br>> index a4536af..49ad871 100644<br>> --- a/qt4/src/poppler-page.cc<br>> +++ b/qt4/src/poppler-page.cc<br>> @@ -508,7 +508,7 @@ bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRig<br>> bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags, Rotation rotate) const<br>> {<br>> const GBool sCase = flags.testFlag(IgnoreCase) ? gFalse : gTrue;<br>> - const GBool sWords = flags.testFlag(WholeWorlds) ? gTrue : gFalse;<br>> + const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse;<br>> <br>> QVector<Unicode> u;<br>> TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u);<br>> @@ -555,7 +555,7 @@ QList<QRectF> Page::search(const QString &text, SearchMode caseSensitive, Rotati<br>> QList<QRectF> Page::search(const QString &text, SearchFlags flags, Rotation rotate) const<br>> {<br>> const GBool sCase = flags.testFlag(IgnoreCase) ? gFalse : gTrue;<br>> - const GBool sWords = flags.testFlag(WholeWorlds) ? gTrue : gFalse;<br>> + const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse;<br>> <br>> QVector<Unicode> u;<br>> TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u);<br>> diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h<br>> index 48c517a..e5e808d 100644<br>> --- a/qt4/src/poppler-qt4.h<br>> +++ b/qt4/src/poppler-qt4.h<br>> @@ -586,7 +586,7 @@ delete it;<br>> enum SearchFlag<br>> {<br>> IgnoreCase = 0x00000001, ///< Case differences are ignored<br>> - WholeWorlds = 0x00000002 ///< Only whole words are matched<br>> + WholeWords = 0x00000002 ///< Only whole words are matched<br>> };<br>> Q_DECLARE_FLAGS( SearchFlags, SearchFlag )<br>> <br>> diff --git a/qt4/tests/check_search.cpp b/qt4/tests/check_search.cpp<br>> index 77e62e3..99659e0 100644<br>> --- a/qt4/tests/check_search.cpp<br>> +++ b/qt4/tests/check_search.cpp<br>> @@ -152,8 +152,8 @@ void TestSearch::testWholeWordsOnly()<br>> <br>> const Poppler::Page::SearchFlags mode0 = 0;<br>> const Poppler::Page::SearchFlags mode1 = Poppler::Page::IgnoreCase;<br>> - const Poppler::Page::SearchFlags mode2 = Poppler::Page::WholeWorlds;<br>> - const Poppler::Page::SearchFlags mode3 = Poppler::Page::IgnoreCase | Poppler::Page::WholeWorlds;<br>> + const Poppler::Page::SearchFlags mode2 = Poppler::Page::WholeWords;<br>> + const Poppler::Page::SearchFlags mode3 = Poppler::Page::IgnoreCase | Poppler::Page::WholeWords;<br>> <br>> double left, top, right, bottom;<br>> <br>> diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc<br>> index 88f2e73..408099c 100644<br>> --- a/qt5/src/poppler-page.cc<br>> +++ b/qt5/src/poppler-page.cc<br>> @@ -508,7 +508,7 @@ bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRig<br>> bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags, Rotation rotate) const<br>> {<br>> const GBool sCase = flags.testFlag(IgnoreCase) ? gFalse : gTrue;<br>> - const GBool sWords = flags.testFlag(WholeWorlds) ? gTrue : gFalse;<br>> + const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse;<br>> <br>> QVector<Unicode> u;<br>> TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u);<br>> @@ -537,7 +537,7 @@ QList<QRectF> Page::search(const QString &text, SearchMode caseSensitive, Rotati<br>> QList<QRectF> Page::search(const QString &text, SearchFlags flags, Rotation rotate) const<br>> {<br>> const GBool sCase = flags.testFlag(IgnoreCase) ? gFalse : gTrue;<br>> - const GBool sWords = flags.testFlag(WholeWorlds) ? gTrue : gFalse;<br>> + const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse;<br>> <br>> QVector<Unicode> u;<br>> TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u);<br>> diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h<br>> index 9ffecff..79c3f74 100644<br>> --- a/qt5/src/poppler-qt5.h<br>> +++ b/qt5/src/poppler-qt5.h<br>> @@ -587,7 +587,7 @@ delete it;<br>> enum SearchFlag<br>> {<br>> IgnoreCase = 0x00000001, ///< Case differences are ignored<br>> - WholeWorlds = 0x00000002 ///< Only whole words are matched<br>> + WholeWords = 0x00000002 ///< Only whole words are matched<br>> };<br>> Q_DECLARE_FLAGS( SearchFlags, SearchFlag )<br>> <br>> diff --git a/qt5/tests/check_search.cpp b/qt5/tests/check_search.cpp<br>> index 2f6f022..a24cc72 100644<br>> --- a/qt5/tests/check_search.cpp<br>> +++ b/qt5/tests/check_search.cpp<br>> @@ -151,8 +151,8 @@ void TestSearch::testWholeWordsOnly()<br>> <br>> const Poppler::Page::SearchFlags mode0 = 0;<br>> const Poppler::Page::SearchFlags mode1 = Poppler::Page::IgnoreCase;<br>> - const Poppler::Page::SearchFlags mode2 = Poppler::Page::WholeWorlds;<br>> - const Poppler::Page::SearchFlags mode3 = Poppler::Page::IgnoreCase | Poppler::Page::WholeWorlds;<br>> + const Poppler::Page::SearchFlags mode2 = Poppler::Page::WholeWords;<br>> + const Poppler::Page::SearchFlags mode3 = Poppler::Page::IgnoreCase | Poppler::Page::WholeWords;<br>> <br>> double left, top, right, bottom;<br>> <br>> _______________________________________________<br>> poppler mailing list<br>> poppler@lists.freedesktop.org<br>> http://lists.freedesktop.org/mailman/listinfo/poppler<br></div></div> </div></body>
</html>