[poppler] fofi/FoFiType1.cc .gitlab-ci.yml glib/poppler-page.cc poppler/CairoOutputDev.cc poppler/Catalog.cc poppler/Function.cc poppler/GfxState.cc poppler/JBIG2Stream.cc poppler/Lexer.cc poppler/PSTokenizer.cc poppler/Rendition.cc poppler/SplashOutputDev.cc poppler/Stream.cc poppler/TextOutputDev.cc poppler/XRef.cc test/perf-test.cc utils/HtmlLinks.cc utils/HtmlOutputDev.h
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Dec 2 21:31:39 UTC 2019
.gitlab-ci.yml | 2 +-
fofi/FoFiType1.cc | 2 +-
glib/poppler-page.cc | 2 +-
poppler/CairoOutputDev.cc | 2 +-
poppler/Catalog.cc | 2 +-
poppler/Function.cc | 10 +++++-----
poppler/GfxState.cc | 4 ++--
poppler/JBIG2Stream.cc | 12 ++++++------
poppler/Lexer.cc | 12 ++++++------
poppler/PSTokenizer.cc | 2 +-
poppler/Rendition.cc | 2 +-
poppler/SplashOutputDev.cc | 6 +++---
poppler/Stream.cc | 4 ++--
poppler/TextOutputDev.cc | 6 +++---
poppler/XRef.cc | 4 ++--
test/perf-test.cc | 2 +-
utils/HtmlLinks.cc | 4 ++--
utils/HtmlOutputDev.h | 2 +-
18 files changed, 40 insertions(+), 40 deletions(-)
New commits:
commit fc9f0f12e88a21e8f15e9b881351e8515c9b6179
Author: Albert Astals Cid <aacid at kde.org>
Date: Mon Dec 2 22:17:52 2019 +0100
enable modernize-use-bool-literals
No copyright, this is a mechanical change
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 086f2ee7..d3566b21 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -40,7 +40,7 @@ build_clang_libcpp:
script:
- git clone --branch ${CI_COMMIT_REF_NAME} --depth 1 ${TEST_DATA_URL} test-data || git clone --depth 1 ${UPSTREAM_TEST_DATA_URL} test-data
- mkdir -p build && cd build
- - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-deprecated-headers,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation;-warnings-as-errors=*" ..
+ - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-deprecated-headers,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-use-bool-literals,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation;-warnings-as-errors=*" ..
- ninja
- ctest --output-on-failure
diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index 9974753e..a4d82f21 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -277,7 +277,7 @@ void FoFiType1::parse() {
}
for (p = buf; *p == ' ' || *p == '\t'; ++p) ;
if (!strncmp(p, "dup", 3)) {
- while (1) {
+ while (true) {
p += 3;
for (; *p == ' ' || *p == '\t'; ++p) ;
code = 0;
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index bc592f88..06c7f7e1 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1144,7 +1144,7 @@ poppler_page_render_to_ps (PopplerPage *page,
nullptr, pages,
psModePS, (int)ps_file->paper_width,
(int)ps_file->paper_height, ps_file->duplex,
- 0, 0, 0, 0, false, false);
+ false, 0, 0, 0, false, false);
}
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 393093e9..eac8ed09 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1652,7 +1652,7 @@ void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double *
/* we need to track the shape */
cairo_push_group (cairo_shape);
}
- if (0 && forSoftMask)
+ if (false && forSoftMask)
cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA);
else
cairo_push_group (cairo);
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index c25d15df..eb4c9a54 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -246,7 +246,7 @@ bool Catalog::cachePageTree(int page)
kidsIdxList->push_back(0);
}
- while(1) {
+ while(true) {
if (std::size_t(page) <= pages.size()) return true;
diff --git a/poppler/Function.cc b/poppler/Function.cc
index fc2ff39a..cbbaf1aa 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -1257,7 +1257,7 @@ bool PostScriptFunction::parseCode(Stream *str, int *codePtr) {
int opPtr, elsePtr;
int a, b, mid, cmp;
- while (1) {
+ while (true) {
GooString tok = getToken(str);
const char *p = tok.c_str();
if (isdigit(*p) || *p == '.' || *p == '-') {
@@ -1364,7 +1364,7 @@ GooString PostScriptFunction::getToken(Stream *str) {
GooString s;
comment = false;
- while (1) {
+ while (true) {
if ((c = str->getChar()) == EOF) {
break;
}
@@ -1382,7 +1382,7 @@ GooString PostScriptFunction::getToken(Stream *str) {
if (c == '{' || c == '}') {
s.append((char)c);
} else if (isdigit(c) || c == '.' || c == '-') {
- while (1) {
+ while (true) {
s.append((char)c);
c = str->lookChar();
if (c == EOF || !(isdigit(c) || c == '.' || c == '-')) {
@@ -1392,7 +1392,7 @@ GooString PostScriptFunction::getToken(Stream *str) {
codeString->append(c);
}
} else {
- while (1) {
+ while (true) {
s.append((char)c);
c = str->lookChar();
if (c == EOF || !isalnum(c)) {
@@ -1417,7 +1417,7 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) const {
double r1, r2, result;
bool b1, b2;
- while (1) {
+ while (true) {
switch (code[codePtr].type) {
case psInt:
stack->pushInt(code[codePtr++].intg);
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index a50bd2c9..5bf9c92a 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -4767,7 +4767,7 @@ GfxGouraudTriangleShading *GfxGouraudTriangleShading::parse(GfxResources *res, i
state = 0;
flag = 0; // make gcc happy
bitBuf = new GfxShadingBitBuf(str);
- while (1) {
+ while (true) {
if (typeA == 4) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
@@ -5114,7 +5114,7 @@ GfxPatchMeshShading *GfxPatchMeshShading::parse(GfxResources *res, int typeA, Di
patchesA = nullptr;
patchesSize = 0;
auto bitBuf = std::make_unique<GfxShadingBitBuf>(str);
- while (1) {
+ while (true) {
if (!bitBuf->getBits(flagBits, &flag)) {
break;
}
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 47114dfa..1e34bbd7 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -538,7 +538,7 @@ int JBIG2MMRDecoder::getWhiteCode() {
bufLen = 8;
++nBytesRead;
}
- while (1) {
+ while (true) {
if (bufLen >= 11 && ((buf >> (bufLen - 7)) & 0x7f) == 0) {
if (bufLen <= 12) {
code = buf << (12 - bufLen);
@@ -581,7 +581,7 @@ int JBIG2MMRDecoder::getBlackCode() {
bufLen = 8;
++nBytesRead;
}
- while (1) {
+ while (true) {
if (bufLen >= 10 && ((buf >> (bufLen - 6)) & 0x3f) == 0) {
if (bufLen <= 13) {
code = buf << (13 - bufLen);
@@ -1808,7 +1808,7 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length,
j = i;
// read the symbols in this height class
- while (1) {
+ while (true) {
// read the delta width
if (huff) {
@@ -3191,7 +3191,7 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(bool mmr, int w, int h,
// convert the run lengths to a bitmap line
i = 0;
- while (1) {
+ while (true) {
for (x = codingLine[i]; x < codingLine[i+1]; ++x) {
bitmap->setPixel(x, y);
}
@@ -3235,7 +3235,7 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(bool mmr, int w, int h,
}
}
- ltp = 0;
+ ltp = false;
cx = cx0 = cx1 = cx2 = 0; // make gcc happy
for (y = 0; y < h; ++y) {
@@ -3890,7 +3890,7 @@ JBIG2Bitmap *JBIG2Stream::readGenericRefinementRegion(int w, int h,
ltpCX = 0x0010;
}
- ltp = 0;
+ ltp = false;
for (y = 0; y < h; ++y) {
if (templ) {
diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc
index e9fd3cea..b381ea7e 100644
--- a/poppler/Lexer.cc
+++ b/poppler/Lexer.cc
@@ -162,7 +162,7 @@ Object Lexer::getObj(int objNum) {
// skip whitespace and comments
comment = false;
- while (1) {
+ while (true) {
if ((c = getChar()) == EOF) {
return Object(objEOF);
}
@@ -194,7 +194,7 @@ Object Lexer::getObj(int objNum) {
} else if (c != '+') {
xi = c - '0';
}
- while (1) {
+ while (true) {
c = lookChar();
if (isdigit(c)) {
getChar();
@@ -250,7 +250,7 @@ Object Lexer::getObj(int objNum) {
xf = xll;
}
scale = 0.1;
- while (1) {
+ while (true) {
c = lookChar();
if (c == '-') {
// ignore minus signs in the middle of numbers to match
@@ -483,7 +483,7 @@ Object Lexer::getObj(int objNum) {
m = n = 0;
c2 = 0;
s = nullptr;
- while (1) {
+ while (true) {
c = getChar();
if (c == '>') {
break;
@@ -588,7 +588,7 @@ Object Lexer::getObj(const char *cmdA, int objNum) {
const char *cmd1 = tokBuf;
*tokBuf = 0;
while (strcmp(cmdA, cmd1) && (objNum < 0 || (xref && xref->getNumEntry(getPos()) == objNum))) {
- while (1) {
+ while (true) {
if ((c = getChar()) == EOF) {
return Object(objEOF);
}
@@ -621,7 +621,7 @@ Object Lexer::getObj(const char *cmdA, int objNum) {
void Lexer::skipToNextLine() {
int c;
- while (1) {
+ while (true) {
c = getChar();
if (c == EOF || c == '\n') {
return;
diff --git a/poppler/PSTokenizer.cc b/poppler/PSTokenizer.cc
index ac36fc11..df4367cb 100644
--- a/poppler/PSTokenizer.cc
+++ b/poppler/PSTokenizer.cc
@@ -69,7 +69,7 @@ bool PSTokenizer::getToken(char *buf, int size, int *length) {
// skip leading whitespace and comments
comment = false;
- while (1) {
+ while (true) {
if ((c = getChar()) == EOF) {
buf[0] = '\0';
*length = 0;
diff --git a/poppler/Rendition.cc b/poppler/Rendition.cc
index ed3961e3..4ef6a436 100644
--- a/poppler/Rendition.cc
+++ b/poppler/Rendition.cc
@@ -361,7 +361,7 @@ void MediaRendition::outputToFile(FILE* fp) {
embeddedStreamObject.streamReset();
- while (1) {
+ while (true) {
int c = embeddedStreamObject.streamGetChar();
if (c == EOF)
break;
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 02c76786..4dc8ad81 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2739,7 +2739,7 @@ void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
imgMaskData.imgStr = new ImageStream(str, width, 1, 1);
imgMaskData.imgStr->reset();
- imgMaskData.invert = invert ? 0 : 1;
+ imgMaskData.invert = invert ? false : true;
imgMaskData.width = width;
imgMaskData.height = height;
imgMaskData.y = 0;
@@ -2790,7 +2790,7 @@ void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state,
mat[5] = ctm[3] + ctm[5];
imgMaskData.imgStr = new ImageStream(str, width, 1, 1);
imgMaskData.imgStr->reset();
- imgMaskData.invert = invert ? 0 : 1;
+ imgMaskData.invert = invert ? false : true;
imgMaskData.width = width;
imgMaskData.height = height;
imgMaskData.y = 0;
@@ -3620,7 +3620,7 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
mat[5] = 0;
imgMaskData.imgStr = new ImageStream(maskStr, maskWidth, 1, 1);
imgMaskData.imgStr->reset();
- imgMaskData.invert = maskInvert ? 0 : 1;
+ imgMaskData.invert = maskInvert ? false : true;
imgMaskData.width = maskWidth;
imgMaskData.height = maskHeight;
imgMaskData.y = 0;
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index b87d1a34..76a542af 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -248,7 +248,7 @@ Stream *Stream::makeFilter(const char *name, Stream *str, Object *params, int re
rows = 0;
endOfBlock = true;
black = false;
- damagedRowsBeforeError = 0;
+ damagedRowsBeforeError = false;
if (params->isDict()) {
obj = params->dictLookup("K", recursion);
if (obj.isInt()) {
@@ -2053,7 +2053,7 @@ int CCITTFaxStream::lookChar() {
// this if we know the stream contains end-of-line markers because
// the "just plow on" technique tends to work better otherwise
} else if (err && endOfLine) {
- while (1) {
+ while (true) {
code1 = lookBits(13);
if (code1 == EOF) {
eof = true;
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 4622500a..7848cb38 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -1641,7 +1641,7 @@ void TextBlock::coalesce(const UnicodeMap *uMap, double fixedPitch) {
poolMinBaseIdx = pool->minBaseIdx;
charCount = 0;
nLines = 0;
- while (1) {
+ while (true) {
// find the first non-empty line in the pool
for (;
@@ -1683,7 +1683,7 @@ void TextBlock::coalesce(const UnicodeMap *uMap, double fixedPitch) {
wordSpacing = fixedPitch ? fixedPitch : maxWordSpacing * fontSize;
// find the rest of the words in this line
- while (1) {
+ while (true) {
// find the left-most word whose baseline is in the range for
// this line
@@ -3021,7 +3021,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
count[rot] = 0;
// add blocks until no more words are left
- while (1) {
+ while (true) {
// find the first non-empty line in the pool
for (;
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 964f68af..1191ed3d 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -508,7 +508,7 @@ bool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fol
Goffset pos2;
int first, n;
- while (1) {
+ while (true) {
obj = parser->getObj(true);
if (obj.isCmd("trailer")) {
break;
@@ -841,7 +841,7 @@ bool XRef::constructXRef(bool *wasReconstructed, bool needCatalogDict) {
}
str->reset();
- while (1) {
+ while (true) {
pos = str->getPos();
if (!str->getLine(buf, 256)) {
break;
diff --git a/test/perf-test.cc b/test/perf-test.cc
index 0dd0304b..1988d705 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -313,7 +313,7 @@ static void sleep_milliseconds(int milliseconds)
nanosecs = (milliseconds - (secs * 1000)) * 1000;
tv.tv_sec = (time_t) secs;
tv.tv_nsec = (long) nanosecs;
- while (1)
+ while (true)
{
int rval = nanosleep(&tv, &tv);
if (rval == 0)
diff --git a/utils/HtmlLinks.cc b/utils/HtmlLinks.cc
index e86dbf75..5738ad6b 100644
--- a/utils/HtmlLinks.cc
+++ b/utils/HtmlLinks.cc
@@ -132,10 +132,10 @@ bool HtmlLinks::inLink(double xmin,double ymin,double xmax,double ymax,int& p)co
for(std::vector<HtmlLink>::iterator i=accu->begin();i!=accu->end();++i){
if (i->inLink(xmin,ymin,xmax,ymax)) {
p=(i - accu->begin());
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
HtmlLink* HtmlLinks::getLink(int i) const{
diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index 219278a2..348d5d28 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -236,7 +236,7 @@ public:
const char *date,
bool rawOrder,
int firstPage = 1,
- bool outline = 0);
+ bool outline = false);
// Destructor.
~HtmlOutputDev() override;
More information about the poppler
mailing list