Commit fc9f0f12 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

enable modernize-use-bool-literals

No copyright, this is a mechanical change
parent 77aa3a00
Pipeline #84622 passed with stages
in 19 minutes and 8 seconds
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -361,7 +361,7 @@ void MediaRendition::outputToFile(FILE* fp) {
embeddedStreamObject.streamReset();
while (1) {
while (true) {
int c = embeddedStreamObject.streamGetChar();
if (c == EOF)
break;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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 (;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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{
......
......@@ -236,7 +236,7 @@ public:
const char *date,
bool rawOrder,
int firstPage = 1,
bool outline = 0);
bool outline = false);
// Destructor.
~HtmlOutputDev() override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment