diff options
219 files changed, 5479 insertions, 5491 deletions
diff --git a/cpp/poppler-page-renderer.cpp b/cpp/poppler-page-renderer.cpp index fd28d9b1..4713cb17 100644 --- a/cpp/poppler-page-renderer.cpp +++ b/cpp/poppler-page-renderer.cpp @@ -292,14 +292,14 @@ image page_renderer::render_page(const page *p, bgColor[0] = d->paper_color & 0xff; bgColor[1] = (d->paper_color >> 8) & 0xff; bgColor[2] = (d->paper_color >> 16) & 0xff; - SplashOutputDev splashOutputDev(colorMode, 4, gFalse, bgColor, gTrue, lineMode); - splashOutputDev.setFontAntialias(d->hints & text_antialiasing ? gTrue : gFalse); - splashOutputDev.setVectorAntialias(d->hints & antialiasing ? gTrue : gFalse); - splashOutputDev.setFreeTypeHinting(d->hints & text_hinting ? gTrue : gFalse, gFalse); + SplashOutputDev splashOutputDev(colorMode, 4, false, bgColor, true, lineMode); + splashOutputDev.setFontAntialias(d->hints & text_antialiasing ? true : false); + splashOutputDev.setVectorAntialias(d->hints & antialiasing ? true : false); + splashOutputDev.setFreeTypeHinting(d->hints & text_hinting ? true : false, false); splashOutputDev.startDoc(pdfdoc); pdfdoc->displayPageSlice(&splashOutputDev, pp->index + 1, xres, yres, int(rotate) * 90, - gFalse, gTrue, gFalse, + false, true, false, x, y, w, h); SplashBitmap *bitmap = splashOutputDev.getBitmap(); diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp index ed9d2300..bc7dcfdc 100644 --- a/cpp/poppler-page.cpp +++ b/cpp/poppler-page.cpp @@ -206,7 +206,7 @@ bool page::search(const ustring &text, rectf &r, search_direction_enum direction u[i] = text[i]; } - const GBool sCase = case_sensitivity == case_sensitive ? gTrue : gFalse; + const bool sCase = case_sensitivity == case_sensitive; const int rotation_value = (int)rotation * 90; bool found = false; @@ -215,24 +215,24 @@ bool page::search(const ustring &text, rectf &r, search_direction_enum direction double rect_right = r.right(); double rect_bottom = r.bottom(); - TextOutputDev td(nullptr, gTrue, 0, gFalse, gFalse); + TextOutputDev td(nullptr, true, 0, false, false); d->doc->doc->displayPage(&td, d->index + 1, 72, 72, rotation_value, false, true, false); TextPage *text_page = td.takeText(); switch (direction) { case search_from_top: found = text_page->findText(&u[0], len, - gTrue, gTrue, gFalse, gFalse, sCase, gFalse, gFalse, + true, true, false, false, sCase, false, false, &rect_left, &rect_top, &rect_right, &rect_bottom); break; case search_next_result: found = text_page->findText(&u[0], len, - gFalse, gTrue, gTrue, gFalse, sCase, gFalse, gFalse, + false, true, true, false, sCase, false, false, &rect_left, &rect_top, &rect_right, &rect_bottom); break; case search_previous_result: found = text_page->findText(&u[0], len, - gFalse, gTrue, gTrue, gFalse, sCase, gTrue, gFalse, + false, true, true, false, sCase, true, false, &rect_left, &rect_top, &rect_right, &rect_bottom); break; } @@ -273,8 +273,8 @@ ustring page::text(const rectf &r) const ustring page::text(const rectf &r, text_layout_enum layout_mode) const { std::unique_ptr<GooString> s; - const GBool use_raw_order = (layout_mode == raw_order_layout); - TextOutputDev td(nullptr, gFalse, 0, use_raw_order, gFalse); + const bool use_raw_order = (layout_mode == raw_order_layout); + TextOutputDev td(nullptr, false, 0, use_raw_order, false); d->doc->doc->displayPage(&td, d->index + 1, 72, 72, 0, false, true, false); if (r.is_empty()) { PDFRectangle rect = *d->page->getCropBox(); @@ -338,10 +338,10 @@ std::vector<text_box> page::text_list() const /* config values are same with Qt5 Page::TextList() */ auto output_dev = std::make_unique<TextOutputDev>( nullptr, /* char* fileName */ - gFalse, /* GBool physLayoutA */ + false, /* bool physLayoutA */ 0, /* double fixedPitchA */ - gFalse, /* GBool rawOrderA */ - gFalse /* GBool append */ + false, /* bool rawOrderA */ + false /* bool append */ ); /* @@ -352,11 +352,11 @@ std::vector<text_box> page::text_list() const d->doc->doc->displayPageSlice(output_dev.get(), d->index + 1, /* page */ 72, 72, 0, /* hDPI, vDPI, rot */ - gFalse, gFalse, gFalse, /* useMediaBox, crop, printing */ + false, false, false, /* useMediaBox, crop, printing */ -1, -1, -1, -1, /* sliceX, sliceY, sliceW, sliceH */ nullptr, nullptr, /* abortCheckCbk(), abortCheckCbkData */ nullptr, nullptr, /* annotDisplayDecideCbk(), annotDisplayDecideCbkData */ - gTrue); /* copyXRef */ + true); /* copyXRef */ if (std::unique_ptr< TextWordList > word_list{output_dev->makeWordList()}) { @@ -375,7 +375,7 @@ std::vector<text_box> page::text_list() const {xMin, yMin, xMax-xMin, yMax-yMin}, word->getRotation(), {}, - word->hasSpaceAfter() == gTrue + word->hasSpaceAfter() == true }}; tb.m_data->char_bboxes.reserve(word->getLength()); diff --git a/fofi/FoFiBase.cc b/fofi/FoFiBase.cc index 713d071d..ff1d92ca 100644 --- a/fofi/FoFiBase.cc +++ b/fofi/FoFiBase.cc @@ -34,7 +34,7 @@ // FoFiBase //------------------------------------------------------------------------ -FoFiBase::FoFiBase(const char *fileA, int lenA, GBool freeFileDataA) { +FoFiBase::FoFiBase(const char *fileA, int lenA, bool freeFileDataA) { file = (const Guchar *)fileA; len = lenA; freeFileData = freeFileDataA; @@ -82,11 +82,11 @@ char *FoFiBase::readFile(const char *fileName, int *fileLen) { return buf; } -int FoFiBase::getS8(int pos, GBool *ok) const { +int FoFiBase::getS8(int pos, bool *ok) const { int x; if (pos < 0 || pos >= len) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -96,19 +96,19 @@ int FoFiBase::getS8(int pos, GBool *ok) const { return x; } -int FoFiBase::getU8(int pos, GBool *ok) const { +int FoFiBase::getU8(int pos, bool *ok) const { if (pos < 0 || pos >= len) { - *ok = gFalse; + *ok = false; return 0; } return file[pos]; } -int FoFiBase::getS16BE(int pos, GBool *ok) const { +int FoFiBase::getS16BE(int pos, bool *ok) const { int x; if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -119,11 +119,11 @@ int FoFiBase::getS16BE(int pos, GBool *ok) const { return x; } -int FoFiBase::getU16BE(int pos, GBool *ok) const { +int FoFiBase::getU16BE(int pos, bool *ok) const { int x; if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -131,11 +131,11 @@ int FoFiBase::getU16BE(int pos, GBool *ok) const { return x; } -int FoFiBase::getS32BE(int pos, GBool *ok) const { +int FoFiBase::getS32BE(int pos, bool *ok) const { int x; if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -148,11 +148,11 @@ int FoFiBase::getS32BE(int pos, GBool *ok) const { return x; } -Guint FoFiBase::getU32BE(int pos, GBool *ok) const { +Guint FoFiBase::getU32BE(int pos, bool *ok) const { Guint x; if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos]; @@ -162,11 +162,11 @@ Guint FoFiBase::getU32BE(int pos, GBool *ok) const { return x; } -Guint FoFiBase::getU32LE(int pos, GBool *ok) const { +Guint FoFiBase::getU32LE(int pos, bool *ok) const { Guint x; if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) { - *ok = gFalse; + *ok = false; return 0; } x = file[pos+3]; @@ -176,12 +176,12 @@ Guint FoFiBase::getU32LE(int pos, GBool *ok) const { return x; } -Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) const { +Guint FoFiBase::getUVarBE(int pos, int size, bool *ok) const { Guint x; int i; if (pos < 0 || pos + size > len || pos > INT_MAX - size) { - *ok = gFalse; + *ok = false; return 0; } x = 0; @@ -191,7 +191,7 @@ Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) const { return x; } -GBool FoFiBase::checkRegion(int pos, int size) const { +bool FoFiBase::checkRegion(int pos, int size) const { return pos >= 0 && pos < INT_MAX - size && size < INT_MAX - pos && diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h index 51652985..73842769 100644 --- a/fofi/FoFiBase.h +++ b/fofi/FoFiBase.h @@ -42,26 +42,26 @@ public: protected: - FoFiBase(const char *fileA, int lenA, GBool freeFileDataA); + FoFiBase(const char *fileA, int lenA, bool freeFileDataA); static char *readFile(const char *fileName, int *fileLen); // S = signed / U = unsigned // 8/16/32/Var = word length, in bytes // BE = big endian - int getS8(int pos, GBool *ok) const; - int getU8(int pos, GBool *ok) const; - int getS16BE(int pos, GBool *ok) const; - int getU16BE(int pos, GBool *ok) const; - int getS32BE(int pos, GBool *ok) const; - Guint getU32BE(int pos, GBool *ok) const; - Guint getU32LE(int pos, GBool *ok) const; - Guint getUVarBE(int pos, int size, GBool *ok) const; + int getS8(int pos, bool *ok) const; + int getU8(int pos, bool *ok) const; + int getS16BE(int pos, bool *ok) const; + int getU16BE(int pos, bool *ok) const; + int getS32BE(int pos, bool *ok) const; + Guint getU32BE(int pos, bool *ok) const; + Guint getU32LE(int pos, bool *ok) const; + Guint getUVarBE(int pos, int size, bool *ok) const; - GBool checkRegion(int pos, int size) const; + bool checkRegion(int pos, int size) const; const Guchar *file; int len; - GBool freeFileData; + bool freeFileData; }; #endif diff --git a/fofi/FoFiIdentifier.cc b/fofi/FoFiIdentifier.cc index ded16e23..5cd7506a 100644 --- a/fofi/FoFiIdentifier.cc +++ b/fofi/FoFiIdentifier.cc @@ -44,22 +44,22 @@ public: // Read a big-endian unsigned 16-bit integer. Fills in *val and // returns true if successful. - virtual GBool getU16BE(int pos, int *val) = 0; + virtual bool getU16BE(int pos, int *val) = 0; // Read a big-endian unsigned 32-bit integer. Fills in *val and // returns true if successful. - virtual GBool getU32BE(int pos, Guint *val) = 0; + virtual bool getU32BE(int pos, Guint *val) = 0; // Read a little-endian unsigned 32-bit integer. Fills in *val and // returns true if successful. - virtual GBool getU32LE(int pos, Guint *val) = 0; + virtual bool getU32LE(int pos, Guint *val) = 0; // Read a big-endian unsigned <size>-byte integer, where 1 <= size // <= 4. Fills in *val and returns true if successful. - virtual GBool getUVarBE(int pos, int size, Guint *val) = 0; + virtual bool getUVarBE(int pos, int size, Guint *val) = 0; // Compare against a string. Returns true if equal. - virtual GBool cmp(int pos, const char *s) = 0; + virtual bool cmp(int pos, const char *s) = 0; }; @@ -71,11 +71,11 @@ public: static MemReader *make(const char *bufA, int lenA); ~MemReader(); int getByte(int pos) override; - GBool getU16BE(int pos, int *val) override; - GBool getU32BE(int pos, Guint *val) override; - GBool getU32LE(int pos, Guint *val) override; - GBool getUVarBE(int pos, int size, Guint *val) override; - GBool cmp(int pos, const char *s) override; + bool getU16BE(int pos, int *val) override; + bool getU32BE(int pos, Guint *val) override; + bool getU32LE(int pos, Guint *val) override; + bool getUVarBE(int pos, int size, Guint *val) override; + bool cmp(int pos, const char *s) override; private: @@ -104,56 +104,56 @@ int MemReader::getByte(int pos) { return buf[pos] & 0xff; } -GBool MemReader::getU16BE(int pos, int *val) { +bool MemReader::getU16BE(int pos, int *val) { if (pos < 0 || pos > len - 2) { - return gFalse; + return false; } *val = ((buf[pos] & 0xff) << 8) + (buf[pos+1] & 0xff); - return gTrue; + return true; } -GBool MemReader::getU32BE(int pos, Guint *val) { +bool MemReader::getU32BE(int pos, Guint *val) { if (pos < 0 || pos > len - 4) { - return gFalse; + return false; } *val = ((buf[pos] & 0xff) << 24) + ((buf[pos+1] & 0xff) << 16) + ((buf[pos+2] & 0xff) << 8) + (buf[pos+3] & 0xff); - return gTrue; + return true; } -GBool MemReader::getU32LE(int pos, Guint *val) { +bool MemReader::getU32LE(int pos, Guint *val) { if (pos < 0 || pos > len - 4) { - return gFalse; + return false; } *val = (buf[pos] & 0xff) + ((buf[pos+1] & 0xff) << 8) + ((buf[pos+2] & 0xff) << 16) + ((buf[pos+3] & 0xff) << 24); - return gTrue; + return true; } -GBool MemReader::getUVarBE(int pos, int size, Guint *val) { +bool MemReader::getUVarBE(int pos, int size, Guint *val) { int i; if (size < 1 || size > 4 || pos < 0 || pos > len - size) { - return gFalse; + return false; } *val = 0; for (i = 0; i < size; ++i) { *val = (*val << 8) + (buf[pos + i] & 0xff); } - return gTrue; + return true; } -GBool MemReader::cmp(int pos, const char *s) { +bool MemReader::cmp(int pos, const char *s) { int n; n = (int)strlen(s); if (pos < 0 || len < n || pos > len - n) { - return gFalse; + return false; } return !memcmp(buf + pos, s, n); } @@ -166,16 +166,16 @@ public: static FileReader *make(const char *fileName); ~FileReader(); int getByte(int pos) override; - GBool getU16BE(int pos, int *val) override; - GBool getU32BE(int pos, Guint *val) override; - GBool getU32LE(int pos, Guint *val) override; - GBool getUVarBE(int pos, int size, Guint *val) override; - GBool cmp(int pos, const char *s) override; + bool getU16BE(int pos, int *val) override; + bool getU32BE(int pos, Guint *val) override; + bool getU32LE(int pos, Guint *val) override; + bool getUVarBE(int pos, int size, Guint *val) override; + bool cmp(int pos, const char *s) override; private: FileReader(FILE *fA); - GBool fillBuf(int pos, int len); + bool fillBuf(int pos, int len); FILE *f; char buf[1024]; @@ -208,77 +208,77 @@ int FileReader::getByte(int pos) { return buf[pos - bufPos] & 0xff; } -GBool FileReader::getU16BE(int pos, int *val) { +bool FileReader::getU16BE(int pos, int *val) { if (!fillBuf(pos, 2)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 8) + (buf[pos - bufPos + 1] & 0xff); - return gTrue; + return true; } -GBool FileReader::getU32BE(int pos, Guint *val) { +bool FileReader::getU32BE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 24) + ((buf[pos - bufPos + 1] & 0xff) << 16) + ((buf[pos - bufPos + 2] & 0xff) << 8) + (buf[pos - bufPos + 3] & 0xff); - return gTrue; + return true; } -GBool FileReader::getU32LE(int pos, Guint *val) { +bool FileReader::getU32LE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = (buf[pos - bufPos] & 0xff) + ((buf[pos - bufPos + 1] & 0xff) << 8) + ((buf[pos - bufPos + 2] & 0xff) << 16) + ((buf[pos - bufPos + 3] & 0xff) << 24); - return gTrue; + return true; } -GBool FileReader::getUVarBE(int pos, int size, Guint *val) { +bool FileReader::getUVarBE(int pos, int size, Guint *val) { int i; if (size < 1 || size > 4 || !fillBuf(pos, size)) { - return gFalse; + return false; } *val = 0; for (i = 0; i < size; ++i) { *val = (*val << 8) + (buf[pos - bufPos + i] & 0xff); } - return gTrue; + return true; } -GBool FileReader::cmp(int pos, const char *s) { +bool FileReader::cmp(int pos, const char *s) { int n; n = (int)strlen(s); if (!fillBuf(pos, n)) { - return gFalse; + return false; } return !memcmp(buf - bufPos + pos, s, n); } -GBool FileReader::fillBuf(int pos, int len) { +bool FileReader::fillBuf(int pos, int len) { if (pos < 0 || len < 0 || len > (int)sizeof(buf) || pos > INT_MAX - (int)sizeof(buf)) { - return gFalse; + return false; } if (pos >= bufPos && pos + len <= bufPos + bufLen) { - return gTrue; + return true; } if (fseek(f, pos, SEEK_SET)) { - return gFalse; + return false; } bufPos = pos; bufLen = (int)fread(buf, 1, sizeof(buf), f); if (bufLen < len) { - return gFalse; + return false; } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -289,16 +289,16 @@ public: static StreamReader *make(int (*getCharA)(void *data), void *dataA); ~StreamReader(); int getByte(int pos) override; - GBool getU16BE(int pos, int *val) override; - GBool getU32BE(int pos, Guint *val) override; - GBool getU32LE(int pos, Guint *val) override; - GBool getUVarBE(int pos, int size, Guint *val) override; - GBool cmp(int pos, const char *s) override; + bool getU16BE(int pos, int *val) override; + bool getU32BE(int pos, Guint *val) override; + bool getU32LE(int pos, Guint *val) override; + bool getUVarBE(int pos, int size, Guint *val) override; + bool cmp(int pos, const char *s) override; private: StreamReader(int (*getCharA)(void *data), void *dataA); - GBool fillBuf(int pos, int len); + bool fillBuf(int pos, int len); int (*getChar)(void *data); void *data; @@ -329,68 +329,68 @@ int StreamReader::getByte(int pos) { return buf[pos - bufPos] & 0xff; } -GBool StreamReader::getU16BE(int pos, int *val) { +bool StreamReader::getU16BE(int pos, int *val) { if (!fillBuf(pos, 2)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 8) + (buf[pos - bufPos + 1] & 0xff); - return gTrue; + return true; } -GBool StreamReader::getU32BE(int pos, Guint *val) { +bool StreamReader::getU32BE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = ((buf[pos - bufPos] & 0xff) << 24) + ((buf[pos - bufPos + 1] & 0xff) << 16) + ((buf[pos - bufPos + 2] & 0xff) << 8) + (buf[pos - bufPos + 3] & 0xff); - return gTrue; + return true; } -GBool StreamReader::getU32LE(int pos, Guint *val) { +bool StreamReader::getU32LE(int pos, Guint *val) { if (!fillBuf(pos, 4)) { - return gFalse; + return false; } *val = (buf[pos - bufPos] & 0xff) + ((buf[pos - bufPos + 1] & 0xff) << 8) + ((buf[pos - bufPos + 2] & 0xff) << 16) + ((buf[pos - bufPos + 3] & 0xff) << 24); - return gTrue; + return true; } -GBool StreamReader::getUVarBE(int pos, int size, Guint *val) { +bool StreamReader::getUVarBE(int pos, int size, Guint *val) { int i; if (size < 1 || size > 4 || !fillBuf(pos, size)) { - return gFalse; + return false; } *val = 0; for (i = 0; i < size; ++i) { *val = (*val << 8) + (buf[pos - bufPos + i] & 0xff); } - return gTrue; + return true; } -GBool StreamReader::cmp(int pos, const char *s) { +bool StreamReader::cmp(int pos, const char *s) { const int n = (int)strlen(s); if (!fillBuf(pos, n)) { - return gFalse; + return false; } const int posDiff = pos - bufPos; return !memcmp(buf + posDiff, s, n); } -GBool StreamReader::fillBuf(int pos, int len) { +bool StreamReader::fillBuf(int pos, int len) { int c; if (pos < 0 || len < 0 || len > (int)sizeof(buf) || pos > INT_MAX - (int)sizeof(buf)) { - return gFalse; + return false; } if (pos < bufPos) { - return gFalse; + return false; } // if requested region will not fit in the current buffer... @@ -410,7 +410,7 @@ GBool StreamReader::fillBuf(int pos, int len) { bufLen = 0; while (bufPos < pos) { if ((c = (*getChar)(data)) < 0) { - return gFalse; + return false; } ++bufPos; } @@ -420,12 +420,12 @@ GBool StreamReader::fillBuf(int pos, int len) { // read the rest of the requested data while (bufPos + bufLen < pos + len) { if ((c = (*getChar)(data)) < 0) { - return gFalse; + return false; } buf[bufLen++] = (char)c; } - return gTrue; + return true; } } diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index f7b9ab58..612adc3c 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -166,24 +166,24 @@ struct cmpTrueTypeTableTagFunctor { struct T42Table { const char *tag; // 4-byte tag - GBool required; // required by the TrueType spec? + bool required; // required by the TrueType spec? }; // TrueType tables to be embedded in Type 42 fonts. // NB: the table names must be in alphabetical order here. #define nT42Tables 11 static T42Table t42Tables[nT42Tables] = { - { "cvt ", gTrue }, - { "fpgm", gTrue }, - { "glyf", gTrue }, - { "head", gTrue }, - { "hhea", gTrue }, - { "hmtx", gTrue }, - { "loca", gTrue }, - { "maxp", gTrue }, - { "prep", gTrue }, - { "vhea", gFalse }, - { "vmtx", gFalse } + { "cvt ", true }, + { "fpgm", true }, + { "glyf", true }, + { "head", true }, + { "hhea", true }, + { "hmtx", true }, + { "loca", true }, + { "maxp", true }, + { "prep", true }, + { "vhea", false }, + { "vmtx", false } }; #define t42HeadTable 3 #define t42LocaTable 6 @@ -270,7 +270,7 @@ static const char *macGlyphNames[258] = { FoFiTrueType *FoFiTrueType::make(const char *fileA, int lenA, int faceIndexA) { FoFiTrueType *ff; - ff = new FoFiTrueType(fileA, lenA, gFalse, faceIndexA); + ff = new FoFiTrueType(fileA, lenA, false, faceIndexA); if (!ff->parsedOk) { delete ff; return nullptr; @@ -286,7 +286,7 @@ FoFiTrueType *FoFiTrueType::load(const char *fileName, int faceIndexA) { if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { return nullptr; } - ff = new FoFiTrueType(fileA, lenA, gTrue, faceIndexA); + ff = new FoFiTrueType(fileA, lenA, true, faceIndexA); if (!ff->parsedOk) { delete ff; return nullptr; @@ -294,14 +294,14 @@ FoFiTrueType *FoFiTrueType::load(const char *fileName, int faceIndexA) { return ff; } -FoFiTrueType::FoFiTrueType(const char *fileA, int lenA, GBool freeFileDataA, int faceIndexA): +FoFiTrueType::FoFiTrueType(const char *fileA, int lenA, bool freeFileDataA, int faceIndexA): FoFiBase(fileA, lenA, freeFileDataA) { tables = nullptr; nTables = 0; cmaps = nullptr; nCmaps = 0; - parsedOk = gFalse; + parsedOk = false; faceIndex = faceIndexA; gsubFeatureTable = 0; gsubLookupList = 0; @@ -342,12 +342,12 @@ int FoFiTrueType::mapCodeToGID(int i, Guint c) const { Guint segCnt, segEnd, segStart, segDelta, segOffset; Guint cmapFirst, cmapLen; int pos, a, b, m; - GBool ok; + bool ok; if (i < 0 || i >= nCmaps) { return 0; } - ok = gTrue; + ok = true; pos = cmaps[i].offset; switch (cmaps[i].fmt) { case 0: @@ -442,19 +442,19 @@ int FoFiTrueType::mapNameToGID(const char *name) const { return gid->second; } -GBool FoFiTrueType::getCFFBlock(char **start, int *length) const { +bool FoFiTrueType::getCFFBlock(char **start, int *length) const { int i; if (!openTypeCFF || !tables) { - return gFalse; + return false; } i = seekTable("CFF "); if (!checkRegion(tables[i].offset, tables[i].len)) { - return gFalse; + return false; } *start = (char *)file + tables[i].offset; *length = tables[i].len; - return gTrue; + return true; } int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) const { @@ -477,12 +477,12 @@ int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) const { int FoFiTrueType::getEmbeddingRights() const { int i, fsType; - GBool ok; + bool ok; if ((i = seekTable("OS/2")) < 0) { return 4; } - ok = gTrue; + ok = true; fsType = getU16BE(tables[i].offset + 8, &ok); if (!ok) { return 4; @@ -520,14 +520,14 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding, void *outputStream) const { GooString *buf; int maxUsedGlyph; - GBool ok; + bool ok; if (openTypeCFF) { return; } // write the header - ok = gTrue; + ok = true; buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n", (double)getS32BE(0, &ok) / 65536.0); (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); @@ -549,14 +549,14 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding, // write the guts of the dictionary cvtEncoding(encoding, outputFunc, outputStream); cvtCharStrings(encoding, codeToGID, outputFunc, outputStream); - cvtSfnts(outputFunc, outputStream, nullptr, gFalse, &maxUsedGlyph); + cvtSfnts(outputFunc, outputStream, nullptr, false, &maxUsedGlyph); // end the dictionary and define the font (*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40); } void FoFiTrueType::convertToType1(const char *psName, const char **newEncoding, - GBool ascii, FoFiOutputFunc outputFunc, + bool ascii, FoFiOutputFunc outputFunc, void *outputStream) const { char *start; int length; @@ -574,12 +574,12 @@ void FoFiTrueType::convertToType1(const char *psName, const char **newEncoding, void FoFiTrueType::convertToCIDType2(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const { GooString *buf; int cid, maxUsedGlyph; - GBool ok; + bool ok; int i, j, k; if (openTypeCFF) { @@ -587,7 +587,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, } // write the header - ok = gTrue; + ok = true; buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n", (double)getS32BE(0, &ok) / 65536.0); (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); @@ -720,7 +720,7 @@ void FoFiTrueType::convertToCIDType0(const char *psName, int *cidMap, int nCIDs, } void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const { @@ -934,14 +934,14 @@ void FoFiTrueType::cvtCharStrings(char **encoding, void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, void *outputStream, GooString *name, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxUsedGlyph) const { Guchar headData[54]; TrueTypeLoca *locaTable; Guchar *locaData; TrueTypeTable newTables[nT42Tables]; Guchar tableDir[12 + nT42Tables*16]; - GBool ok; + bool ok; Guint checksum; int nNewTables; int glyfTableLen, length, pos, glyfPos, i, j, k, vmtxTabLength; @@ -965,7 +965,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, 0, 1 // number of advance heights in vmtx table }; Guchar *vmtxTab; - GBool needVhea, needVmtx; + bool needVhea, needVmtx; int advance; // construct the 'head' table, zero out the font checksum @@ -999,7 +999,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, pos = tables[i].offset; i = seekTable("glyf"); glyfTableLen = tables[i].len; - ok = gTrue; + ok = true; for (i = 0; i <= nGlyphs; ++i) { locaTable[i].idx = i; if (locaFmt) { @@ -1318,7 +1318,7 @@ void FoFiTrueType::parse() { Guint topTag; int pos, ver, i, j; - parsedOk = gTrue; + parsedOk = true; // look for a collection (TTC) topTag = getU32BE(0, &parsedOk); @@ -1333,7 +1333,7 @@ void FoFiTrueType::parse() { if (!parsedOk) return; if (! dircount) { - parsedOk = gFalse; + parsedOk = false; return; } @@ -1392,7 +1392,7 @@ void FoFiTrueType::parse() { (!openTypeCFF && seekTable("loca") < 0) || (!openTypeCFF && seekTable("glyf") < 0) || (openTypeCFF && seekTable("CFF ") < 0)) { - parsedOk = gFalse; + parsedOk = false; return; } @@ -1445,10 +1445,10 @@ void FoFiTrueType::parse() { void FoFiTrueType::readPostTable() { std::string name; int tablePos, postFmt, stringIdx, stringPos; - GBool ok; + bool ok; int i, j, n, m; - ok = gTrue; + ok = true; if ((i = seekTable("post")) < 0) { return; } @@ -1474,7 +1474,7 @@ void FoFiTrueType::readPostTable() { stringIdx = 0; stringPos = tablePos + 34 + 2*n; for (i = 0; i < n; ++i) { - ok = gTrue; + ok = true; j = getU16BE(tablePos + 34 + 2*i, &ok); if (j < 258) { nameToGID[macGlyphNames[j]] = i; diff --git a/fofi/FoFiTrueType.h b/fofi/FoFiTrueType.h index e364112c..3f2a1b7d 100644 --- a/fofi/FoFiTrueType.h +++ b/fofi/FoFiTrueType.h @@ -55,7 +55,7 @@ public: // Returns true if this an OpenType font containing CFF data, false // if it's a TrueType font (or OpenType font with TrueType data). - GBool isOpenTypeCFF() const { return openTypeCFF; } + bool isOpenTypeCFF() const { return openTypeCFF; } // Return the number of cmaps defined by this font. int getNumCmaps() const; @@ -118,7 +118,7 @@ public: // otherwise it will be left as binary data. If <psName> is // non-NULL, it will be used as the PostScript font name. (Only // useful for OpenType CFF fonts.) - void convertToType1(const char *psName, const char **newEncoding, GBool ascii, + void convertToType1(const char *psName, const char **newEncoding, bool ascii, FoFiOutputFunc outputFunc, void *outputStream) const; // Convert to a Type 2 CIDFont, suitable for embedding in a @@ -127,7 +127,7 @@ public: // font). The <cidMap> array maps CIDs to GIDs; it has <nCIDs> // entries. (Not useful for OpenType CFF fonts.) void convertToCIDType2(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, FoFiOutputFunc outputFunc, void *outputStream) const; // Convert to a Type 0 CIDFont, suitable for embedding in a @@ -142,7 +142,7 @@ public: // table in the font). The <cidMap> array maps CIDs to GIDs; it has // <nCIDs> entries. (Not useful for OpenType CFF fonts.) void convertToType0(const char *psName, int *cidMap, int nCIDs, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxValidGlyph, FoFiOutputFunc outputFunc, void *outputStream) const; @@ -155,7 +155,7 @@ public: // Returns a pointer to the CFF font embedded in this OpenType font. // If successful, sets *<start> and *<length>, and returns true. // Otherwise returns false. (Only useful for OpenType CFF fonts). - GBool getCFFBlock(char **start, int *length) const; + bool getCFFBlock(char **start, int *length) const; // setup vert/vrt2 GSUB for default lang int setupGSUB(const char *scriptName); @@ -165,7 +165,7 @@ public: private: - FoFiTrueType(const char *fileA, int lenA, GBool freeFileDataA, int faceIndexA); + FoFiTrueType(const char *fileA, int lenA, bool freeFileDataA, int faceIndexA); void cvtEncoding(char **encoding, FoFiOutputFunc outputFunc, void *outputStream) const; @@ -175,7 +175,7 @@ private: void *outputStream) const; void cvtSfnts(FoFiOutputFunc outputFunc, void *outputStream, GooString *name, - GBool needVerticalMetrics, + bool needVerticalMetrics, int *maxUsedGlyph) const; void dumpString(const Guchar *s, int length, FoFiOutputFunc outputFunc, @@ -198,9 +198,9 @@ private: int locaFmt; int bbox[4]; std::unordered_map<std::string,int> nameToGID; - GBool openTypeCFF; + bool openTypeCFF; - GBool parsedOk; + bool parsedOk; int faceIndex; Guint gsubFeatureTable; Guint gsubLookupList; diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc index 83faa4a1..00fb9591 100644 --- a/fofi/FoFiType1.cc +++ b/fofi/FoFiType1.cc @@ -42,7 +42,7 @@ //------------------------------------------------------------------------ FoFiType1 *FoFiType1::make(const char *fileA, int lenA) { - return new FoFiType1(fileA, lenA, gFalse); + return new FoFiType1(fileA, lenA, false); } FoFiType1 *FoFiType1::load(const char *fileName) { @@ -52,10 +52,10 @@ FoFiType1 *FoFiType1::load(const char *fileName) { if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { return nullptr; } - return new FoFiType1(fileA, lenA, gTrue); + return new FoFiType1(fileA, lenA, true); } -FoFiType1::FoFiType1(const char *fileA, int lenA, GBool freeFileDataA): +FoFiType1::FoFiType1(const char *fileA, int lenA, bool freeFileDataA): FoFiBase(fileA, lenA, freeFileDataA) { name = nullptr; @@ -66,7 +66,7 @@ FoFiType1::FoFiType1(const char *fileA, int lenA, GBool freeFileDataA): fontMatrix[3] = 0.001; fontMatrix[4] = 0; fontMatrix[5] = 0; - parsed = gFalse; + parsed = false; undoPFB(); } @@ -214,9 +214,9 @@ void FoFiType1::parse() { char c; int n, code, base, i, j; char *tokptr; - GBool gotMatrix, continueLine; + bool gotMatrix, continueLine; - gotMatrix = gFalse; + gotMatrix = false; for (i = 1, line = (char *)file; i <= 100 && line && (!name || !encoding); ++i) { @@ -247,7 +247,7 @@ void FoFiType1::parse() { for (j = 0; j < 256; ++j) { encoding[j] = nullptr; } - continueLine = gFalse; + continueLine = false; for (j = 0, line = getNextLine(line); j < 300 && line && (line1 = getNextLine(line)); ++j, line = line1) { @@ -256,7 +256,7 @@ void FoFiType1::parse() { n = 255; } if (continueLine) { - continueLine = gFalse; + continueLine = false; if ((line1 - firstLine) + 1 > (int)sizeof(buf)) break; p = firstLine; @@ -287,7 +287,7 @@ void FoFiType1::parse() { } else if (*p >= '0' && *p <= '9') { base = 10; } else if (*p == '\n' || *p == '\r') { - continueLine = gTrue; + continueLine = true; break; } else { break; @@ -297,7 +297,7 @@ void FoFiType1::parse() { } for (; *p == ' ' || *p == '\t'; ++p) ; if (*p == '\n' || *p == '\r') { - continueLine = gTrue; + continueLine = true; break; } else if (*p != '/') { break; @@ -313,7 +313,7 @@ void FoFiType1::parse() { } for (p = p2; *p == ' ' || *p == '\t'; ++p) ; if (*p == '\n' || *p == '\r') { - continueLine = gTrue; + continueLine = true; break; } if (strncmp(p, "put", 3)) { @@ -353,24 +353,24 @@ void FoFiType1::parse() { } } } - gotMatrix = gTrue; + gotMatrix = true; } else { line = getNextLine(line); } } - parsed = gTrue; + parsed = true; } // Undo the PFB encoding, i.e., remove the PFB headers. void FoFiType1::undoPFB() { - GBool ok; + bool ok; Guchar *file2; int pos1, pos2, type; Guint segLen; - ok = gTrue; + ok = true; if (getU8(0, &ok) != 0x80 || !ok) { return; } @@ -394,6 +394,6 @@ void FoFiType1::undoPFB() { gfree((char*)file); } file = file2; - freeFileData = gTrue; + freeFileData = true; len = pos2; } diff --git a/fofi/FoFiType1.h b/fofi/FoFiType1.h index 7902be53..313b2981 100644 --- a/fofi/FoFiType1.h +++ b/fofi/FoFiType1.h @@ -57,7 +57,7 @@ public: private: - FoFiType1(const char *fileA, int lenA, GBool freeFileDataA); + FoFiType1(const char *fileA, int lenA, bool freeFileDataA); char *getNextLine(char *line) const; void parse(); @@ -66,7 +66,7 @@ private: char *name; char **encoding; double fontMatrix[6]; - GBool parsed; + bool parsed; }; #endif diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc index 2312f3af..d079f0b5 100644 --- a/fofi/FoFiType1C.cc +++ b/fofi/FoFiType1C.cc @@ -46,7 +46,7 @@ static char hexChars[17] = "0123456789ABCDEF"; FoFiType1C *FoFiType1C::make(const char *fileA, int lenA) { FoFiType1C *ff; - ff = new FoFiType1C(fileA, lenA, gFalse); + ff = new FoFiType1C(fileA, lenA, false); if (!ff->parse()) { delete ff; return nullptr; @@ -62,7 +62,7 @@ FoFiType1C *FoFiType1C::load(const char *fileName) { if (!(fileA = FoFiBase::readFile(fileName, &lenA))) { return nullptr; } - ff = new FoFiType1C(fileA, lenA, gTrue); + ff = new FoFiType1C(fileA, lenA, true); if (!ff->parse()) { delete ff; return nullptr; @@ -70,7 +70,7 @@ FoFiType1C *FoFiType1C::load(const char *fileName) { return ff; } -FoFiType1C::FoFiType1C(const char *fileA, int lenA, GBool freeFileDataA): +FoFiType1C::FoFiType1C(const char *fileA, int lenA, bool freeFileDataA): FoFiBase(fileA, lenA, freeFileDataA) { name = nullptr; @@ -119,9 +119,9 @@ char **FoFiType1C::getEncoding() const { GooString *FoFiType1C::getGlyphName(int gid) const { char buf[256]; - GBool ok; + bool ok; - ok = gTrue; + ok = true; if (gid < 0 || gid >= charsetLength) return nullptr; getString(charset[gid], buf, &ok); @@ -188,7 +188,7 @@ void FoFiType1C::getFontMatrix(double *mat) const { } } -void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GBool ascii, +void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bool ascii, FoFiOutputFunc outputFunc, void *outputStream) { int psNameLen; @@ -198,7 +198,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB GooString *buf; char buf2[256]; const char **enc; - GBool ok; + bool ok; int i; if (psName) { @@ -209,7 +209,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB } // write header and font dictionary, up to encoding - ok = gTrue; + ok = true; (*outputFunc)(outputStream, "%!FontType1-1.0: ", 17); (*outputFunc)(outputStream, psName, psNameLen); if (topDict.versionSID != 0) { @@ -450,7 +450,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB } // set up subroutines - ok = gTrue; + ok = true; getIndex(privateDicts[0].subrsOffset, &subrIdx, &ok); if (!ok) { subrIdx.pos = -1; @@ -462,7 +462,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GB eexecWrite(&eb, buf->getCString()); delete buf; for (i = 0; i < nGlyphs; ++i) { - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, i, &val, &ok); if (ok && i < charsetLength) { getString(charset[i], buf2, &ok); @@ -499,7 +499,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, int nCIDs, gdBytes; GooString *buf; char buf2[256]; - GBool ok; + bool ok; int gid, offset, n, i, j, k; // compute the CID count and build the CID-to-GID mapping @@ -541,7 +541,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (i = 0; i < nCIDs; ++i) { charStringOffsets[i] = charStrings->getLength(); if ((gid = cidMap[i]) >= 0) { - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, gid, &val, &ok); if (ok) { getIndex(privateDicts[fdSelect ? fdSelect[gid] : 0].subrsOffset, @@ -550,7 +550,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, subrIdx.pos = -1; } cvtGlyph(val.pos, val.len, charStrings, - &subrIdx, &privateDicts[fdSelect ? fdSelect[gid] : 0], gTrue); + &subrIdx, &privateDicts[fdSelect ? fdSelect[gid] : 0], true); } } } @@ -580,14 +580,14 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "/CIDFontType 0 def\n", 19); (*outputFunc)(outputStream, "/CIDSystemInfo 3 dict dup begin\n", 32); if (topDict.registrySID > 0 && topDict.orderingSID > 0) { - ok = gTrue; + ok = true; getString(topDict.registrySID, buf2, &ok); if (ok) { (*outputFunc)(outputStream, " /Registry (", 13); (*outputFunc)(outputStream, buf2, strlen(buf2)); (*outputFunc)(outputStream, ") def\n", 6); } - ok = gTrue; + ok = true; getString(topDict.orderingSID, buf2, &ok); if (ok) { (*outputFunc)(outputStream, " /Ordering (", 13); @@ -842,7 +842,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, int nCIDs; GooString *buf; Type1CEexecBuf eb; - GBool ok; + bool ok; int fd, i, j, k; // compute the CID count and build the CID-to-GID mapping @@ -955,7 +955,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "currentfile eexec\n", 18); eb.outputFunc = outputFunc; eb.outputStream = outputStream; - eb.ascii = gTrue; + eb.ascii = true; eb.r1 = 55665; eb.line = 0; @@ -1084,7 +1084,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, } // set up the subroutines - ok = gTrue; + ok = true; getIndex(privateDicts[fd].subrsOffset, &subrIdx, &ok); if (!ok) { subrIdx.pos = -1; @@ -1094,7 +1094,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, eexecWrite(&eb, "2 index /CharStrings 256 dict dup begin\n"); // write the .notdef CharString - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, 0, &val, &ok); if (ok) { eexecCvtGlyph(&eb, ".notdef", val.pos, val.len, @@ -1104,7 +1104,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, // write the CharStrings for (j = 0; j < 256 && i+j < nCIDs; ++j) { if (cidMap[i+j] >= 0) { - ok = gTrue; + ok = true; getIndexVal(&charStringsIdx, cidMap[i+j], &val, &ok); if (ok) { buf = GooString::format("c{0:02x}", j); @@ -1181,7 +1181,7 @@ void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, // generate the charstring charBuf = new GooString(); - cvtGlyph(offset, nBytes, charBuf, subrIdx, pDict, gTrue); + cvtGlyph(offset, nBytes, charBuf, subrIdx, pDict, true); buf = GooString::format("/{0:s} {1:d} RD ", glyphName, charBuf->getLength()); eexecWrite(eb, buf->getCString()); @@ -1195,9 +1195,9 @@ void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, Type1CIndex *subrIdx, Type1CPrivateDict *pDict, - GBool top) { + bool top) { Type1CIndexVal val; - GBool ok, dFP; + bool ok, dFP; double d, dx, dy; Gushort r2; Guchar byte; @@ -1211,14 +1211,14 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)134); nOps = 0; nHints = 0; - firstOp = gTrue; - openPath = gFalse; + firstOp = true; + openPath = false; } pos = offset; while (pos < offset + nBytes) { - ok = gTrue; - pos = getOp(pos, gTrue, &ok); + ok = true; + pos = getOp(pos, true, &ok); if (!ok) { break; } @@ -1228,13 +1228,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0001: // hstem if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 hstem", nOps); } d = 0; - dFP = gFalse; + dFP = false; for (k = 0; k < nOps; k += 2) { // convert Type 2 edge hints (-20 or -21) to Type 1 ghost hints if (ops[k+1].num < 0) { @@ -1258,13 +1258,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0003: // vstem if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 vstem", nOps); } d = 0; - dFP = gFalse; + dFP = false; for (k = 0; k < nOps; k += 2) { // convert Type 2 edge hints (-20 or -21) to Type 1 ghost hints if (ops[k+1].num < 0) { @@ -1288,11 +1288,11 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0004: // vmoveto if (firstOp) { cvtGlyphWidth(nOps == 2, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps != 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 vmoveto", nOps); @@ -1311,7 +1311,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)5); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0006: // hlineto if (nOps < 1) { @@ -1322,7 +1322,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)((k & 1) ? 7 : 6)); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0007: // vlineto if (nOps < 1) { @@ -1333,7 +1333,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)((k & 1) ? 6 : 7)); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0008: // rrcurveto if (nOps < 6 || nOps % 6 != 0) { @@ -1349,7 +1349,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x000a: // callsubr if (nOps >= 1) { @@ -1357,10 +1357,10 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, ? 107 : (subrIdx->len < 33900) ? 1131 : 32768; k = subrBias + (int)ops[nOps - 1].num; --nOps; - ok = gTrue; + ok = true; getIndexVal(subrIdx, k, &val, &ok); if (likely(ok && val.pos != offset)) { - cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse); + cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, false); } } else { //~ error(-1, "Too few args to Type 2 callsubr"); @@ -1373,14 +1373,14 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x000e: // endchar / seac if (firstOp) { cvtGlyphWidth(nOps == 1 || nOps == 5, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps == 4) { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[0].num, ops[0].isFP, charBuf); cvtNum(ops[1].num, ops[1].isFP, charBuf); cvtNum(ops[2].num, ops[2].isFP, charBuf); @@ -1397,7 +1397,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // this op is ignored, but we need the glyph width if (firstOp) { cvtGlyphWidth(nOps > 0, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } nOps = 0; break; @@ -1409,7 +1409,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 hstemhm", nOps); @@ -1421,7 +1421,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps > 0) { if (nOps & 1) { @@ -1437,7 +1437,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps > 0) { if (nOps & 1) { @@ -1452,11 +1452,11 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0015: // rmoveto if (firstOp) { cvtGlyphWidth(nOps == 3, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps != 2) { //~ error(-1, "Wrong number of args (%d) to Type 2 rmoveto", nOps); @@ -1469,11 +1469,11 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, case 0x0016: // hmoveto if (firstOp) { cvtGlyphWidth(nOps == 2, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (openPath) { charBuf->append((char)9); - openPath = gFalse; + openPath = false; } if (nOps != 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 hmoveto", nOps); @@ -1486,7 +1486,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, // ignored if (firstOp) { cvtGlyphWidth(nOps & 1, charBuf, pDict); - firstOp = gFalse; + firstOp = false; } if (nOps & 1) { //~ error(-1, "Wrong number of args (%d) to Type 2 vstemhm", nOps); @@ -1511,7 +1511,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[k+1].num, ops[k].isFP, charBuf); charBuf->append((char)5); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0019: // rlinecurve if (nOps < 8 || (nOps - 6) % 2 != 0) { @@ -1530,7 +1530,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[k+5].num, ops[k+5].isFP, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001a: // vvcurveto if (nOps < 4 || !(nOps % 4 == 0 || (nOps-1) % 4 == 0)) { @@ -1541,7 +1541,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[1].num, ops[1].isFP, charBuf); cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[4].num, ops[4].isFP, charBuf); charBuf->append((char)8); k = 5; @@ -1549,16 +1549,16 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, k = 0; } for (; k < nOps; k += 4) { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k].num, ops[k].isFP, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+3].num, ops[k+3].isFP, charBuf); charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001b: // hhcurveto if (nOps < 4 || !(nOps % 4 == 0 || (nOps-1) % 4 == 0)) { @@ -1570,7 +1570,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); cvtNum(ops[4].num, ops[4].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); k = 5; } else { @@ -1578,24 +1578,24 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } for (; k < nOps; k += 4) { cvtNum(ops[k].num, ops[k].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); cvtNum(ops[k+3].num, ops[k+3].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001d: // callgsubr if (nOps >= 1) { k = gsubrBias + (int)ops[nOps - 1].num; --nOps; - ok = gTrue; + ok = true; getIndexVal(&gsubrIdx, k, &val, &ok); if (likely(ok && val.pos != offset)) { - cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, gFalse); + cvtGlyph(val.pos, val.len, charBuf, subrIdx, pDict, false); } } else { //~ error(-1, "Too few args to Type 2 callgsubr"); @@ -1623,7 +1623,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } if (k == nOps-5) { if (k % 8 == 0) { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k].num, ops[k].isFP, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); @@ -1631,7 +1631,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[k+4].num, ops[k+4].isFP, charBuf); } else { cvtNum(ops[k].num, ops[k].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); cvtNum(ops[k+4].num, ops[k+4].isFP, charBuf); @@ -1640,7 +1640,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x001f: // hvcurveto if (nOps < 4 || !(nOps % 4 == 0 || (nOps-1) % 4 == 0)) { @@ -1664,13 +1664,13 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, if (k == nOps-5) { if (k % 8 == 0) { cvtNum(ops[k].num, ops[k].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); cvtNum(ops[k+4].num, ops[k+4].isFP, charBuf); cvtNum(ops[k+3].num, ops[k+3].isFP, charBuf); } else { - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[k].num, ops[k].isFP, charBuf); cvtNum(ops[k+1].num, ops[k+1].isFP, charBuf); cvtNum(ops[k+2].num, ops[k+2].isFP, charBuf); @@ -1680,7 +1680,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, charBuf->append((char)8); } nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c00: // dotsection (should be Type 1 only?) // ignored @@ -1716,21 +1716,21 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, //~ error(-1, "Wrong number of args (%d) to Type 2 hflex", nOps); } cvtNum(ops[0].num, ops[0].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[1].num, ops[1].isFP, charBuf); cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); cvtNum(ops[4].num, ops[4].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[5].num, ops[5].isFP, charBuf); cvtNum(-ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[6].num, ops[6].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c23: // flex if (nOps != 13) { @@ -1751,7 +1751,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[11].num, ops[11].isFP, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c24: // hflex1 if (nOps != 9) { @@ -1762,10 +1762,10 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, cvtNum(ops[2].num, ops[2].isFP, charBuf); cvtNum(ops[3].num, ops[3].isFP, charBuf); cvtNum(ops[4].num, ops[4].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); charBuf->append((char)8); cvtNum(ops[5].num, ops[5].isFP, charBuf); - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(ops[6].num, ops[6].isFP, charBuf); cvtNum(ops[7].num, ops[7].isFP, charBuf); cvtNum(ops[8].num, ops[8].isFP, charBuf); @@ -1773,7 +1773,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, ops[1].isFP | ops[3].isFP | ops[7].isFP, charBuf); charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; case 0x0c25: // flex1 if (nOps != 11) { @@ -1803,7 +1803,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } charBuf->append((char)8); nOps = 0; - openPath = gTrue; + openPath = true; break; default: //~ error(-1, "Illegal Type 2 charstring op: %04x", @@ -1825,10 +1825,10 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, } } -void FoFiType1C::cvtGlyphWidth(GBool useOp, GooString *charBuf, +void FoFiType1C::cvtGlyphWidth(bool useOp, GooString *charBuf, Type1CPrivateDict *pDict) { double w; - GBool wFP; + bool wFP; int i; if (useOp) { @@ -1842,12 +1842,12 @@ void FoFiType1C::cvtGlyphWidth(GBool useOp, GooString *charBuf, w = pDict->defaultWidthX; wFP = pDict->defaultWidthXFP; } - cvtNum(0, gFalse, charBuf); + cvtNum(0, false, charBuf); cvtNum(w, wFP, charBuf); charBuf->append((char)13); } -void FoFiType1C::cvtNum(double x, GBool isFP, GooString *charBuf) const { +void FoFiType1C::cvtNum(double x, bool isFP, GooString *charBuf) const { Guchar buf[12]; int y, n; @@ -1974,12 +1974,12 @@ void FoFiType1C::writePSString(const char *s, FoFiOutputFunc outputFunc, (*outputFunc)(outputStream, buf, i); } -GBool FoFiType1C::parse() { +bool FoFiType1C::parse() { Type1CIndex fdIdx; Type1CIndexVal val; int i; - parsedOk = gTrue; + parsedOk = true; // some tools embed Type 1C fonts with an extra whitespace char at // the beginning @@ -1994,7 +1994,7 @@ GBool FoFiType1C::parse() { getIndex(topDictIdx.endPos, &stringIdx, &parsedOk); getIndex(stringIdx.endPos, &gsubrIdx, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } gsubrBias = (gsubrIdx.len < 1240) ? 107 : (gsubrIdx.len < 33900) ? 1131 : 32768; @@ -2002,7 +2002,7 @@ GBool FoFiType1C::parse() { // read the first font name getIndexVal(&nameIdx, 0, &val, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } name = new GooString((char *)&file[val.pos], val.len); @@ -2018,7 +2018,7 @@ GBool FoFiType1C::parse() { } else { getIndex(topDict.fdArrayOffset, &fdIdx, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } nFDs = fdIdx.len; privateDicts = (Type1CPrivateDict *) @@ -2026,7 +2026,7 @@ GBool FoFiType1C::parse() { for (i = 0; i < nFDs; ++i) { getIndexVal(&fdIdx, i, &val, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } readFD(val.pos, val.len, &privateDicts[i]); } @@ -2042,17 +2042,17 @@ GBool FoFiType1C::parse() { // check for parse errors in the private dict(s) if (!parsedOk) { - return gFalse; + return false; } // get the charstrings index if (topDict.charStringsOffset <= 0) { - parsedOk = gFalse; - return gFalse; + parsedOk = false; + return false; } getIndex(topDict.charStringsOffset, &charStringsIdx, &parsedOk); if (!parsedOk) { - return gFalse; + return false; } nGlyphs = charStringsIdx.len; @@ -2060,21 +2060,21 @@ GBool FoFiType1C::parse() { if (topDict.firstOp == 0x0c1e) { readFDSelect(); if (!parsedOk) { - return gFalse; + return false; } } // read the charset if (!readCharset()) { - parsedOk = gFalse; - return gFalse; + parsedOk = false; + return false; } // for 8-bit fonts: build the encoding if (topDict.firstOp != 0x0c14 && topDict.firstOp != 0x0c1e) { buildEncoding(); if (!parsedOk) { - return gFalse; + return false; } } @@ -2104,7 +2104,7 @@ void FoFiType1C::readTopDict() { topDict.fontMatrix[3] = 0.001; topDict.fontMatrix[4] = 0; topDict.fontMatrix[5] = 0; - topDict.hasFontMatrix = gFalse; + topDict.hasFontMatrix = false; topDict.uniqueID = 0; topDict.fontBBox[0] = 0; topDict.fontBBox[1] = 0; @@ -2129,7 +2129,7 @@ void FoFiType1C::readTopDict() { pos = topDictPtr.pos; nOps = 0; while (pos < topDictPtr.pos + topDictPtr.len) { - pos = getOp(pos, gFalse, &parsedOk); + pos = getOp(pos, false, &parsedOk); if (!parsedOk) { break; } @@ -2157,7 +2157,7 @@ void FoFiType1C::readTopDict() { topDict.fontMatrix[3] = ops[3].num; topDict.fontMatrix[4] = ops[4].num; topDict.fontMatrix[5] = ops[5].num; - topDict.hasFontMatrix = gTrue; break; + topDict.hasFontMatrix = true; break; case 0x000d: topDict.uniqueID = (int)ops[0].num; break; case 0x0005: topDict.fontBBox[0] = ops[0].num; topDict.fontBBox[1] = ops[1].num; @@ -2186,9 +2186,9 @@ void FoFiType1C::readTopDict() { void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { int pSize, pOffset; double fontMatrix[6] = {0}; - GBool hasFontMatrix; + bool hasFontMatrix; - hasFontMatrix = gFalse; + hasFontMatrix = false; fontMatrix[0] = fontMatrix[1] = fontMatrix[2] = 0; // make gcc happy fontMatrix[3] = fontMatrix[4] = fontMatrix[5] = 0; pSize = pOffset = 0; @@ -2201,14 +2201,14 @@ void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { int pos = offset; nOps = 0; while (pos < posEnd) { - pos = getOp(pos, gFalse, &parsedOk); + pos = getOp(pos, false, &parsedOk); if (!parsedOk) { return; } if (!ops[nOps - 1].isNum) { if (ops[nOps - 1].op == 0x0012) { if (nOps < 3) { - parsedOk = gFalse; + parsedOk = false; return; } pSize = (int)ops[0].num; @@ -2221,7 +2221,7 @@ void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { fontMatrix[3] = ops[3].num; fontMatrix[4] = ops[4].num; fontMatrix[5] = ops[5].num; - hasFontMatrix = gTrue; + hasFontMatrix = true; } nOps = 0; } @@ -2234,13 +2234,13 @@ void FoFiType1C::readFD(int offset, int length, Type1CPrivateDict *pDict) { pDict->fontMatrix[3] = fontMatrix[3]; pDict->fontMatrix[4] = fontMatrix[4]; pDict->fontMatrix[5] = fontMatrix[5]; - pDict->hasFontMatrix = gTrue; + pDict->hasFontMatrix = true; } } void FoFiType1C::readPrivateDict(int offset, int length, Type1CPrivateDict *pDict) { - pDict->hasFontMatrix = gFalse; + pDict->hasFontMatrix = false; pDict->nBlueValues = 0; pDict->nOtherBlues = 0; pDict->nFamilyBlues = 0; @@ -2248,20 +2248,20 @@ void FoFiType1C::readPrivateDict(int offset, int length, pDict->blueScale = 0.039625; pDict->blueShift = 7; pDict->blueFuzz = 1; - pDict->hasStdHW = gFalse; - pDict->hasStdVW = gFalse; + pDict->hasStdHW = false; + pDict->hasStdVW = false; pDict->nStemSnapH = 0; pDict->nStemSnapV = 0; - pDict->hasForceBold = gFalse; + pDict->hasForceBold = false; pDict->forceBoldThreshold = 0; pDict->languageGroup = 0; pDict->expansionFactor = 0.06; pDict->initialRandomSeed = 0; pDict->subrsOffset = 0; pDict->defaultWidthX = 0; - pDict->defaultWidthXFP = gFalse; + pDict->defaultWidthXFP = false; pDict->nominalWidthX = 0; - pDict->nominalWidthXFP = gFalse; + pDict->nominalWidthXFP = false; // no dictionary if (offset == 0 || length == 0) { @@ -2276,7 +2276,7 @@ void FoFiType1C::readPrivateDict(int offset, int length, int pos = offset; nOps = 0; while (pos < posEnd) { - pos = getOp(pos, gFalse, &parsedOk); + pos = getOp(pos, false, &parsedOk); if (!parsedOk) { break; } @@ -2310,11 +2310,11 @@ void FoFiType1C::readPrivateDict(int offset, int length, break; case 0x000a: pDict->stdHW = ops[0].num; - pDict->hasStdHW = gTrue; + pDict->hasStdHW = true; break; case 0x000b: pDict->stdVW = ops[0].num; - pDict->hasStdVW = gTrue; + pDict->hasStdVW = true; break; case 0x0c0c: pDict->nStemSnapH = getDeltaFPArray(pDict->stemSnapH, @@ -2326,7 +2326,7 @@ void FoFiType1C::readPrivateDict(int offset, int length, break; case 0x0c0e: pDict->forceBold = ops[0].num != 0; - pDict->hasForceBold = gTrue; + pDict->hasForceBold = true; break; case 0x0c0f: pDict->forceBoldThreshold = ops[0].num; @@ -2373,7 +2373,7 @@ void FoFiType1C::readFDSelect() { } if (fdSelectFmt == 0) { if (!checkRegion(pos, nGlyphs)) { - parsedOk = gFalse; + parsedOk = false; return; } memcpy(fdSelect, file + pos, nGlyphs); @@ -2391,7 +2391,7 @@ void FoFiType1C::readFDSelect() { pos += 2; if (gid0 > gid1 || gid1 > nGlyphs) { //~ error(-1, "Bad FDSelect table in CID font"); - parsedOk = gFalse; + parsedOk = false; return; } for (j = gid0; j < gid1; ++j) { @@ -2496,7 +2496,7 @@ void FoFiType1C::buildEncoding() { } } -GBool FoFiType1C::readCharset() { +bool FoFiType1C::readCharset() { int charsetFormat, c, pos; int nLeft, i, j; @@ -2557,13 +2557,13 @@ GBool FoFiType1C::readCharset() { gfree(charset); charset = nullptr; charsetLength = 0; - return gFalse; + return false; } } - return gTrue; + return true; } -int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) { +int FoFiType1C::getOp(int pos, bool charstring, bool *ok) { static char nybChars[16] = "0123456789.ee -"; Type1COp op; char buf[65]; @@ -2621,7 +2621,7 @@ int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) { } while (i < 64); buf[i] = '\0'; op.num = gatof(buf); - op.isFP = gTrue; + op.isFP = true; } else if (b0 >= 32 && b0 <= 246) { op.num = b0 - 139; @@ -2641,14 +2641,14 @@ int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) { x |= ~0xffffffff; } op.num = (double)x / 65536.0; - op.isFP = gTrue; + op.isFP = true; } else if (b0 == 12) { - op.isNum = gFalse; + op.isNum = false; op.op = 0x0c00 + getU8(pos++, ok); } else { - op.isNum = gFalse; + op.isNum = false; op.op = b0; } @@ -2698,7 +2698,7 @@ int FoFiType1C::getDeltaFPArray(double *arr, int maxLen) const { return n; } -void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) const { +void FoFiType1C::getIndex(int pos, Type1CIndex *idx, bool *ok) const { idx->pos = pos; idx->len = getU16BE(pos, ok); if (idx->len == 0) { @@ -2708,26 +2708,26 @@ void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) const { } else { idx->offSize = getU8(pos + 2, ok); if (idx->offSize < 1 || idx->offSize > 4) { - *ok = gFalse; + *ok = false; } idx->startPos = pos + 3 + (idx->len + 1) * idx->offSize - 1; if (idx->startPos < 0 || idx->startPos >= len) { - *ok = gFalse; + *ok = false; } idx->endPos = idx->startPos + getUVarBE(pos + 3 + idx->len * idx->offSize, idx->offSize, ok); if (idx->endPos < idx->startPos || idx->endPos > len) { - *ok = gFalse; + *ok = false; } } } void FoFiType1C::getIndexVal(const Type1CIndex *idx, int i, - Type1CIndexVal *val, GBool *ok) const { + Type1CIndexVal *val, bool *ok) const { int pos0, pos1; if (i < 0 || i >= idx->len) { - *ok = gFalse; + *ok = false; return; } pos0 = idx->startPos + getUVarBE(idx->pos + 3 + i * idx->offSize, @@ -2737,14 +2737,14 @@ void FoFiType1C::getIndexVal(const Type1CIndex *idx, int i, if (pos0 < idx->startPos || pos0 > idx->endPos || pos1 <= idx->startPos || pos1 > idx->endPos || pos1 < pos0) { - *ok = gFalse; + *ok = false; return; } val->pos = pos0; val->len = pos1 - pos0; } -char *FoFiType1C::getString(int sid, char *buf, GBool *ok) const { +char *FoFiType1C::getString(int sid, char *buf, bool *ok) const { Type1CIndexVal val; int n; diff --git a/fofi/FoFiType1C.h b/fofi/FoFiType1C.h index 131fa311..0c7884fe 100644 --- a/fofi/FoFiType1C.h +++ b/fofi/FoFiType1C.h @@ -61,7 +61,7 @@ struct Type1CTopDict { int paintType; int charstringType; double fontMatrix[6]; - GBool hasFontMatrix; // CID fonts are allowed to put their + bool hasFontMatrix; // CID fonts are allowed to put their // FontMatrix in the FD instead of the // top dict int uniqueID; @@ -87,7 +87,7 @@ struct Type1CTopDict { struct Type1CPrivateDict { double fontMatrix[6]; - GBool hasFontMatrix; + bool hasFontMatrix; int blueValues[type1CMaxBlueValues]; int nBlueValues; int otherBlues[type1CMaxOtherBlues]; @@ -100,29 +100,29 @@ struct Type1CPrivateDict { int blueShift; int blueFuzz; double stdHW; - GBool hasStdHW; + bool hasStdHW; double stdVW; - GBool hasStdVW; + bool hasStdVW; double stemSnapH[type1CMaxStemSnap]; int nStemSnapH; double stemSnapV[type1CMaxStemSnap]; int nStemSnapV; - GBool forceBold; - GBool hasForceBold; + bool forceBold; + bool hasForceBold; double forceBoldThreshold; int languageGroup; double expansionFactor; int initialRandomSeed; int subrsOffset; double defaultWidthX; - GBool defaultWidthXFP; + bool defaultWidthXFP; double nominalWidthX; - GBool nominalWidthXFP; + bool nominalWidthXFP; }; struct Type1COp { - GBool isNum = gTrue; // true -> number, false -> operator - GBool isFP = gFalse; // true -> floating point number, false -> int + bool isNum = true; // true -> number, false -> operator + bool isFP = false; // true -> floating point number, false -> int union { double num = 0; // if num is true int op; // if num is false @@ -132,7 +132,7 @@ struct Type1COp { struct Type1CEexecBuf { FoFiOutputFunc outputFunc; void *outputStream; - GBool ascii; // ASCII encoding? + bool ascii; // ASCII encoding? Gushort r1; // eexec encryption key int line; // number of eexec chars left on current line }; @@ -176,7 +176,7 @@ public: // font. If <ascii> is true the eexec section will be hex-encoded, // otherwise it will be left as binary data. If <psName> is non-NULL, // it will be used as the PostScript font name. - void convertToType1(const char *psName, const char **newEncoding, GBool ascii, + void convertToType1(const char *psName, const char **newEncoding, bool ascii, FoFiOutputFunc outputFunc, void *outputStream); // Convert to a Type 0 CIDFont, suitable for embedding in a @@ -204,33 +204,33 @@ public: private: - FoFiType1C(const char *fileA, int lenA, GBool freeFileDataA); + FoFiType1C(const char *fileA, int lenA, bool freeFileDataA); void eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, int offset, int nBytes, Type1CIndex *subrIdx, Type1CPrivateDict *pDict); void cvtGlyph(int offset, int nBytes, GooString *charBuf, Type1CIndex *subrIdx, Type1CPrivateDict *pDict, - GBool top); - void cvtGlyphWidth(GBool useOp, GooString *charBuf, + bool top); + void cvtGlyphWidth(bool useOp, GooString *charBuf, Type1CPrivateDict *pDict); - void cvtNum(double x, GBool isFP, GooString *charBuf) const; + void cvtNum(double x, bool isFP, GooString *charBuf) const; void eexecWrite(Type1CEexecBuf *eb, const char *s) const; void eexecWriteCharstring(Type1CEexecBuf *eb, const Guchar *s, int n) const; void writePSString(const char *s, FoFiOutputFunc outputFunc, void *outputStream) const; - GBool parse(); + bool parse(); void readTopDict(); void readFD(int offset, int length, Type1CPrivateDict *pDict); void readPrivateDict(int offset, int length, Type1CPrivateDict *pDict); void readFDSelect(); void buildEncoding(); - GBool readCharset(); - int getOp(int pos, GBool charstring, GBool *ok); + bool readCharset(); + int getOp(int pos, bool charstring, bool *ok); int getDeltaIntArray(int *arr, int maxLen) const; int getDeltaFPArray(double *arr, int maxLen) const; - void getIndex(int pos, Type1CIndex *idx, GBool *ok) const; - void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, GBool *ok) const; - char *getString(int sid, char *buf, GBool *ok) const; + void getIndex(int pos, Type1CIndex *idx, bool *ok) const; + void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, bool *ok) const; + char *getString(int sid, char *buf, bool *ok) const; GooString *name; char **encoding; @@ -251,13 +251,13 @@ private: Gushort charsetLength; int gsubrBias; - GBool parsedOk; + bool parsedOk; Type1COp ops[49]; // operands and operator int nOps; // number of operands int nHints; // number of hints for the current glyph - GBool firstOp; // true if we haven't hit the first op yet - GBool openPath; // true if there is an unclosed path + bool firstOp; // true if we haven't hit the first op yet + bool openPath; // true if there is an unclosed path }; #endif diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc index 3fbd3984..679e8301 100644 --- a/glib/poppler-action.cc +++ b/glib/poppler-action.cc @@ -444,7 +444,7 @@ find_annot_movie_for_action (PopplerDocument *document, Object annots = p->getAnnotsObject (); if (annots.isArray ()) { int j; - GBool found = gFalse; + bool found = false; for (j = 0; j < annots.arrayGetLength () && !found; ++j) { annotObj = annots.arrayGet(j); @@ -459,7 +459,7 @@ find_annot_movie_for_action (PopplerDocument *document, const GooString *t = obj1.getString (); if (title->cmp(t) == 0) - found = gTrue; + found = true; } } if (!found) @@ -578,7 +578,7 @@ build_ocg_state (PopplerDocument *document, const LinkOCGState *ocg_state) { const GooList *st_list = ocg_state->getStateList(); - GBool preserve_rb = ocg_state->getPreserveRB(); + bool preserve_rb = ocg_state->getPreserveRB(); gint i, j; GList *layer_state = nullptr; diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 8567856a..eb620609 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -306,10 +306,10 @@ poppler_document_new_from_stream (GInputStream *stream, } if (stream_is_memory_buffer_or_local_file(stream)) { - str = new PopplerInputStream(stream, cancellable, 0, gFalse, 0, Object(objNull)); + str = new PopplerInputStream(stream, cancellable, 0, false, 0, Object(objNull)); } else { CachedFile *cachedFile = new CachedFile(new PopplerCachedFileLoader(stream, cancellable, length), new GooString()); - str = new CachedFileStream(cachedFile, 0, gFalse, cachedFile->getLength(), Object(objNull)); + str = new CachedFileStream(cachedFile, 0, false, cachedFile->getLength(), Object(objNull)); } password_g = poppler_password_to_latin1(password); diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc index 816cb896..2e1244b0 100644 --- a/glib/poppler-form-field.cc +++ b/glib/poppler-form-field.cc @@ -254,7 +254,7 @@ poppler_form_field_button_set_state (PopplerFormField *field, { g_return_if_fail (field->widget->getType () == formButton); - static_cast<FormWidgetButton*>(field->widget)->setState ((GBool)state); + static_cast<FormWidgetButton*>(field->widget)->setState ((bool)state); } /** diff --git a/glib/poppler-input-stream.cc b/glib/poppler-input-stream.cc index 20336826..c4bab01e 100644 --- a/glib/poppler-input-stream.cc +++ b/glib/poppler-input-stream.cc @@ -21,7 +21,7 @@ #include "poppler-input-stream.h" PopplerInputStream::PopplerInputStream(GInputStream *inputStreamA, GCancellable *cancellableA, - Goffset startA, GBool limitedA, Goffset lengthA, Object &&dictA) + Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) : BaseStream(std::move(dictA), lengthA) { inputStream = (GInputStream *)g_object_ref(inputStreamA); @@ -32,7 +32,7 @@ PopplerInputStream::PopplerInputStream(GInputStream *inputStreamA, GCancellable bufPtr = bufEnd = buf; bufPos = start; savePos = 0; - saved = gFalse; + saved = false; } PopplerInputStream::~PopplerInputStream() @@ -47,7 +47,7 @@ BaseStream *PopplerInputStream::copy() { return new PopplerInputStream(inputStream, cancellable, start, limited, length, dict.copy()); } -Stream *PopplerInputStream::makeSubStream(Goffset startA, GBool limitedA, +Stream *PopplerInputStream::makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) { return new PopplerInputStream(inputStream, cancellable, startA, limitedA, lengthA, std::move(dictA)); @@ -59,7 +59,7 @@ void PopplerInputStream::reset() savePos = (Guint)g_seekable_tell(seekable); g_seekable_seek(seekable, start, G_SEEK_SET, cancellable, nullptr); - saved = gTrue; + saved = true; bufPtr = bufEnd = buf; bufPos = start; } @@ -69,7 +69,7 @@ void PopplerInputStream::close() if (!saved) return; g_seekable_seek(G_SEEKABLE(inputStream), savePos, G_SEEK_SET, cancellable, nullptr); - saved = gFalse; + saved = false; } void PopplerInputStream::setPos(Goffset pos, int dir) @@ -100,14 +100,14 @@ void PopplerInputStream::moveStart(Goffset delta) bufPos = start; } -GBool PopplerInputStream::fillBuf() +bool PopplerInputStream::fillBuf() { int n; bufPos += bufEnd - buf; bufPtr = bufEnd = buf; if (limited && bufPos >= start + length) { - return gFalse; + return false; } if (limited && bufPos + inputStreamBufSize > start + length) { @@ -119,10 +119,10 @@ GBool PopplerInputStream::fillBuf() n = g_input_stream_read(inputStream, buf, n, cancellable, nullptr); bufEnd = buf + n; if (bufPtr >= bufEnd) { - return gFalse; + return false; } - return gTrue; + return true; } int PopplerInputStream::getChars(int nChars, Guchar *buffer) diff --git a/glib/poppler-input-stream.h b/glib/poppler-input-stream.h index 536487a4..97448d2f 100644 --- a/glib/poppler-input-stream.h +++ b/glib/poppler-input-stream.h @@ -31,10 +31,10 @@ class PopplerInputStream: public BaseStream { public: PopplerInputStream(GInputStream *inputStream, GCancellable *cancellableA, - Goffset startA, GBool limitedA, Goffset lengthA, Object &&dictA); + Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA); ~PopplerInputStream(); BaseStream *copy() override; - Stream *makeSubStream(Goffset start, GBool limited, + Stream *makeSubStream(Goffset start, bool limited, Goffset lengthA, Object &&dictA) override; StreamKind getKind() override { return strWeird; } void reset() override; @@ -53,21 +53,21 @@ public: private: - GBool fillBuf(); + bool fillBuf(); - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; GInputStream *inputStream; GCancellable *cancellable; Goffset start; - GBool limited; + bool limited; char buf[inputStreamBufSize]; char *bufPtr; char *bufEnd; Goffset bufPos; int savePos; - GBool saved; + bool saved; }; #endif /* __GI_SCANNER__ */ diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 2934aba5..6a592fbc 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -265,13 +265,13 @@ poppler_page_get_text_page (PopplerPage *page) TextOutputDev *text_dev; Gfx *gfx; - text_dev = new TextOutputDev (nullptr, gTrue, 0, gFalse, gFalse); + text_dev = new TextOutputDev (nullptr, true, 0, false, false); gfx = page->page->createGfx(text_dev, 72.0, 72.0, 0, - gFalse, /* useMediaBox */ - gTrue, /* Crop */ + false, /* useMediaBox */ + true, /* Crop */ -1, -1, -1, -1, - gFalse, /* printing */ + false, /* printing */ nullptr, nullptr); page->page->display(gfx); text_dev->endPage(); @@ -304,13 +304,13 @@ annot_is_markup (Annot *annot) } } -static GBool +static bool poppler_print_annot_cb (Annot *annot, void *user_data) { PopplerPrintFlags user_print_flags = (PopplerPrintFlags)GPOINTER_TO_INT (user_data); if (annot->getFlags () & Annot::flagHidden) - return gFalse; + return false; if (user_print_flags & POPPLER_PRINT_STAMP_ANNOTS_ONLY) { return (annot->getType() == Annot::typeStamp) ? @@ -331,7 +331,7 @@ poppler_print_annot_cb (Annot *annot, void *user_data) static void _poppler_page_render (PopplerPage *page, cairo_t *cairo, - GBool printing, + bool printing, PopplerPrintFlags print_flags) { CairoOutputDev *output_dev; @@ -344,7 +344,7 @@ _poppler_page_render (PopplerPage *page, if (!printing && page->text == nullptr) { - page->text = new TextPage (gFalse); + page->text = new TextPage (false); output_dev->setTextPage (page->text); } /* NOTE: instead of passing -1 we should/could use cairo_clip_extents() @@ -352,8 +352,8 @@ _poppler_page_render (PopplerPage *page, cairo_save (cairo); page->page->displaySlice(output_dev, 72.0, 72.0, 0, - gFalse, /* useMediaBox */ - gTrue, /* Crop */ + false, /* useMediaBox */ + true, /* Crop */ -1, -1, -1, -1, printing, @@ -382,7 +382,7 @@ poppler_page_render (PopplerPage *page, { g_return_if_fail (POPPLER_IS_PAGE (page)); - _poppler_page_render (page, cairo, gFalse, (PopplerPrintFlags)0); + _poppler_page_render (page, cairo, false, (PopplerPrintFlags)0); } /** @@ -403,7 +403,7 @@ poppler_page_render_for_printing_with_options (PopplerPage *page, { g_return_if_fail (POPPLER_IS_PAGE (page)); - _poppler_page_render (page, cairo, gTrue, options); + _poppler_page_render (page, cairo, true, options); } /** @@ -419,7 +419,7 @@ poppler_page_render_for_printing (PopplerPage *page, { g_return_if_fail (POPPLER_IS_PAGE (page)); - _poppler_page_render (page, cairo, gTrue, POPPLER_PRINT_ALL); + _poppler_page_render (page, cairo, true, POPPLER_PRINT_ALL); } static cairo_surface_t * @@ -911,9 +911,9 @@ poppler_page_find_text_with_options (PopplerPage *page, yMin = backwards ? height : 0; while (text_dev->findText (ucs4, ucs4_len, - gFalse, gTrue, // startAtTop, stopAtBottom + false, true, // startAtTop, stopAtBottom start_at_last, - gFalse, //stopAtLast + false, //stopAtLast options & POPPLER_FIND_CASE_SENSITIVE, backwards, options & POPPLER_FIND_WHOLE_WORDS_ONLY, @@ -953,7 +953,7 @@ poppler_page_find_text (PopplerPage *page, static CairoImageOutputDev * poppler_page_get_image_output_dev (PopplerPage *page, - GBool (*imgDrawDeviceCbk)(int img_id, void *data), + bool (*imgDrawDeviceCbk)(int img_id, void *data), void *imgDrawCbkData) { CairoImageOutputDev *image_dev; @@ -968,10 +968,10 @@ poppler_page_get_image_output_dev (PopplerPage *page, gfx = page->page->createGfx(image_dev, 72.0, 72.0, 0, - gFalse, /* useMediaBox */ - gTrue, /* Crop */ + false, /* useMediaBox */ + true, /* Crop */ -1, -1, -1, -1, - gFalse, /* printing */ + false, /* printing */ nullptr, nullptr); page->page->display(gfx); delete gfx; @@ -1026,7 +1026,7 @@ poppler_page_get_image_mapping (PopplerPage *page) return map_list; } -static GBool +static bool image_draw_decide_cb (int image_id, void *data) { return (image_id == GPOINTER_TO_INT (data)); @@ -1116,12 +1116,12 @@ 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, gFalse, gFalse); + 0, 0, 0, 0, false, false); } ps_file->document->doc->displayPage (ps_file->out, page->index + 1, 72.0, 72.0, - 0, gFalse, gTrue, gFalse); + 0, false, true, false); } static void diff --git a/glib/poppler-structure-element.cc b/glib/poppler-structure-element.cc index 6ee8bc65..0e71285f 100644 --- a/glib/poppler-structure-element.cc +++ b/glib/poppler-structure-element.cc @@ -400,7 +400,7 @@ static EnumType attr_to_enum (PopplerStructureElement *poppler_structure_element) { const Attribute *attr = - poppler_structure_element->elem->findAttribute (EnumNameValue<EnumType>::attribute_type, gTrue); + poppler_structure_element->elem->findAttribute (EnumNameValue<EnumType>::attribute_type, true); return name_to_enum<EnumType> ((attr != nullptr) ? attr->getValue () : Attribute::getDefaultValue (EnumNameValue<EnumType>::attribute_type)); @@ -412,7 +412,7 @@ attr_value_or_default (PopplerStructureElement *poppler_structure_element, Attribute::Type attribute_type) { const Attribute *attr = - poppler_structure_element->elem->findAttribute (attribute_type, gTrue); + poppler_structure_element->elem->findAttribute (attribute_type, true); return attr ? attr->getValue () : Attribute::getDefaultValue (attribute_type); } diff --git a/goo/FixedPoint.cc b/goo/FixedPoint.cc index 565b86c2..31e04b68 100644 --- a/goo/FixedPoint.cc +++ b/goo/FixedPoint.cc @@ -117,19 +117,19 @@ int FixedPoint::div(int x, int y) { } } -GBool FixedPoint::divCheck(FixedPoint x, FixedPoint y, FixedPoint *result) { +bool FixedPoint::divCheck(FixedPoint x, FixedPoint y, FixedPoint *result) { FixPtInt64 z; z = ((FixPtInt64)x.val << fixptShift) / y.val; if ((z == 0 && x != 0) || z >= ((FixPtInt64)1 << 31) || z < -((FixPtInt64)1 << 31)) { - return gFalse; + return false; } result->val = z; - return gTrue; + return true; } -GBool FixedPoint::checkDet(FixedPoint m11, FixedPoint m12, +bool FixedPoint::checkDet(FixedPoint m11, FixedPoint m12, FixedPoint m21, FixedPoint m22, FixedPoint epsilon) { FixPtInt64 det, e; diff --git a/goo/FixedPoint.h b/goo/FixedPoint.h index a7b406ec..9ba5ed7a 100644 --- a/goo/FixedPoint.h +++ b/goo/FixedPoint.h @@ -154,11 +154,11 @@ public: // Compute *result = x/y; return false if there is an underflow or // overflow. - static GBool divCheck(FixedPoint x, FixedPoint y, FixedPoint *result); + static bool divCheck(FixedPoint x, FixedPoint y, FixedPoint *result); // Compute abs(m11*m22 - m12*m21) >= epsilon, handling the case // where the multiplications overflow. - static GBool checkDet(FixedPoint m11, FixedPoint m12, + static bool checkDet(FixedPoint m11, FixedPoint m12, FixedPoint m21, FixedPoint m22, FixedPoint epsilon); diff --git a/goo/GooString.cc b/goo/GooString.cc index 42bf604e..b1a7ae86 100644 --- a/goo/GooString.cc +++ b/goo/GooString.cc @@ -228,7 +228,7 @@ GooString *GooString::fromInt(int x) { char buf[24]; // enough space for 64-bit ints plus a little extra const char *p; int len; - formatInt(x, buf, sizeof(buf), gFalse, 0, 10, &p, &len); + formatInt(x, buf, sizeof(buf), false, 0, 10, &p, &len); return new GooString(p, len); } @@ -292,7 +292,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { int argsLen, argsSize; GooStringFormatArg arg; int idx, width, prec; - GBool reverseAlign, zeroFill; + bool reverseAlign, zeroFill; GooStringFormatType ft; char buf[65]; int len, i; @@ -326,10 +326,10 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { } ++p0; if (*p0 == '-') { - reverseAlign = gTrue; + reverseAlign = true; ++p0; } else { - reverseAlign = gFalse; + reverseAlign = false; } width = 0; zeroFill = *p0 == '0'; @@ -452,7 +452,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { break; case fmtIntHexUpper: formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 16, &str, &len, - gTrue); + true); break; case fmtIntOctal: formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 8, &str, &len); @@ -470,7 +470,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { break; case fmtUIntHexUpper: formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 16, - &str, &len, gTrue); + &str, &len, true); break; case fmtUIntOctal: formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 8, &str, &len); @@ -486,7 +486,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { break; case fmtLongHexUpper: formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 16, &str, &len, - gTrue); + true); break; case fmtLongOctal: formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 8, &str, &len); @@ -504,7 +504,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { break; case fmtULongHexUpper: formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 16, - &str, &len, gTrue); + &str, &len, true); break; case fmtULongOctal: formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 8, &str, &len); @@ -520,7 +520,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { break; case fmtLongLongHexUpper: formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 16, &str, &len, - gTrue); + true); break; case fmtLongLongOctal: formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 8, &str, &len); @@ -538,7 +538,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { break; case fmtULongLongHexUpper: formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 16, - &str, &len, gTrue); + &str, &len, true); break; case fmtULongLongOctal: formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 8, @@ -549,13 +549,13 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { &str, &len); break; case fmtDouble: - formatDouble(arg.f, buf, sizeof(buf), prec, gFalse, &str, &len); + formatDouble(arg.f, buf, sizeof(buf), prec, false, &str, &len); break; case fmtDoubleTrim: - formatDouble(arg.f, buf, sizeof(buf), prec, gTrue, &str, &len); + formatDouble(arg.f, buf, sizeof(buf), prec, true, &str, &len); break; case fmtDoubleTrimSmallAware: - formatDoubleSmallAware(arg.f, buf, sizeof(buf), prec, gTrue, &str, &len); + formatDoubleSmallAware(arg.f, buf, sizeof(buf), prec, true, &str, &len); break; case fmtChar: buf[0] = arg.c; @@ -619,10 +619,10 @@ static const char lowerCaseDigits[17] = "0123456789abcdef"; static const char upperCaseDigits[17] = "0123456789ABCDEF"; void GooString::formatInt(long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - const char **p, int *len, GBool upperCase) { + bool zeroFill, int width, int base, + const char **p, int *len, bool upperCase) { const char *vals = upperCase ? upperCaseDigits : lowerCaseDigits; - GBool neg; + bool neg; int start, i, j; unsigned long long abs_x; @@ -654,8 +654,8 @@ void GooString::formatInt(long long x, char *buf, int bufSize, } void GooString::formatUInt(unsigned long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - const char **p, int *len, GBool upperCase) { + bool zeroFill, int width, int base, + const char **p, int *len, bool upperCase) { const char *vals = upperCase ? upperCaseDigits : lowerCaseDigits; int i, j; @@ -678,8 +678,8 @@ void GooString::formatUInt(unsigned long long x, char *buf, int bufSize, } void GooString::formatDouble(double x, char *buf, int bufSize, int prec, - GBool trim, const char **p, int *len) { - GBool neg, started; + bool trim, const char **p, int *len) { + bool neg, started; double x2; int d, i, j; @@ -694,7 +694,7 @@ void GooString::formatDouble(double x, char *buf, int bufSize, int prec, d = (int)floor(x - 10 * x2 + 0.5); if (started || d != 0) { buf[--i] = '0' + d; - started = gTrue; + started = true; } x = x2; } @@ -717,7 +717,7 @@ void GooString::formatDouble(double x, char *buf, int bufSize, int prec, } void GooString::formatDoubleSmallAware(double x, char *buf, int bufSize, int prec, - GBool trim, const char **p, int *len) + bool trim, const char **p, int *len) { double absX = fabs(x); if (absX >= 0.1) { @@ -864,16 +864,16 @@ int GooString::cmpN(const char *sA, int n) const { return 0; } -GBool GooString::endsWith(const char *suffix) const { +bool GooString::endsWith(const char *suffix) const { int suffixLen = strlen(suffix); if (length < suffixLen) - return gFalse; + return false; return strcmp(s + length - suffixLen, suffix) == 0; } -GBool GooString::hasUnicodeMarker(void) const +bool GooString::hasUnicodeMarker(void) const { return length > 1 && (s[0] & 0xff) == 0xfe && (s[1] & 0xff) == 0xff; } @@ -884,7 +884,7 @@ void GooString::prependUnicodeMarker() insert(0, (char)0xfe); } -GooString *GooString::sanitizedName(GBool psmode) const +GooString *GooString::sanitizedName(bool psmode) const { GooString *name; char buf[8]; diff --git a/goo/GooString.h b/goo/GooString.h index 4755526a..4b040942 100644 --- a/goo/GooString.h +++ b/goo/GooString.h @@ -155,17 +155,17 @@ public: int cmpN(const char *sA, int n) const; // Return true if string ends with suffix - GBool endsWith(const char *suffix) const; + bool endsWith(const char *suffix) const; - GBool hasUnicodeMarker(void) const; + bool hasUnicodeMarker(void) const; void prependUnicodeMarker(); - GBool hasJustUnicodeMarker(void) const { return length == 2 && hasUnicodeMarker(); } + bool hasJustUnicodeMarker(void) const { return length == 2 && hasUnicodeMarker(); } // Sanitizes the string so that it does // not contain any ( ) < > [ ] { } / % // The postscript mode also has some more strict checks // The caller owns the return value - GooString *sanitizedName(GBool psmode) const; + GooString *sanitizedName(bool psmode) const; // Conversion from and to std::string explicit GooString(const std::string& str) : GooString(str.data(), str.size()) {} @@ -189,15 +189,15 @@ private: void resize(int newLength); static void formatInt(long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - const char **p, int *len, GBool upperCase = gFalse); + bool zeroFill, int width, int base, + const char **p, int *len, bool upperCase = false); static void formatUInt(unsigned long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - const char **p, int *len, GBool upperCase = gFalse); + bool zeroFill, int width, int base, + const char **p, int *len, bool upperCase = false); static void formatDouble(double x, char *buf, int bufSize, int prec, - GBool trim, const char **p, int *len); + bool trim, const char **p, int *len); static void formatDoubleSmallAware(double x, char *buf, int bufSize, int prec, - GBool trim, const char **p, int *len); + bool trim, const char **p, int *len); }; #endif diff --git a/goo/GooTimer.h b/goo/GooTimer.h index be0b6ff1..9df747b7 100644 --- a/goo/GooTimer.h +++ b/goo/GooTimer.h @@ -52,7 +52,7 @@ private: LARGE_INTEGER start_time; LARGE_INTEGER end_time; #endif - GBool active; + bool active; }; #endif @@ -46,11 +46,11 @@ class GooString; class GDirEntry { public: - GDirEntry(const char *dirPath, const char *nameA, GBool doStat); + GDirEntry(const char *dirPath, const char *nameA, bool doStat); ~GDirEntry(); const GooString *getName() const { return name; } const GooString *getFullPath() const { return fullPath; } - GBool isDir() const { return dir; } + bool isDir() const { return dir; } private: GDirEntry(const GDirEntry &other); @@ -58,13 +58,13 @@ private: GooString *name; // dir/file name GooString *fullPath; - GBool dir; // is it a directory? + bool dir; // is it a directory? }; class GDir { public: - GDir(const char *name, GBool doStatA = gTrue); + GDir(const char *name, bool doStatA = true); ~GDir(); GDirEntry *getNextEntry(); void rewind(); @@ -74,7 +74,7 @@ private: GDir& operator=(const GDir &other); GooString *path; // directory path - GBool doStat; // call stat() for each entry? + bool doStat; // call stat() for each entry? #if defined(_WIN32) WIN32_FIND_DATAA ffd; HANDLE hnd; @@ -83,7 +83,7 @@ private: #else DIR *dir; // the DIR structure from opendir() #ifdef VMS - GBool needParent; // need to return an entry for [-] + bool needParent; // need to return an entry for [-] #endif #endif }; diff --git a/goo/gfile.cc b/goo/gfile.cc index dcfd1124..125cbed2 100644 --- a/goo/gfile.cc +++ b/goo/gfile.cc @@ -513,7 +513,7 @@ bool GooFile::modificationTimeChangedSinceOpen() const // GDir and GDirEntry //------------------------------------------------------------------------ -GDirEntry::GDirEntry(const char *dirPath, const char *nameA, GBool doStat) { +GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) { #ifdef VMS char *p; #elif defined(_WIN32) @@ -524,14 +524,14 @@ GDirEntry::GDirEntry(const char *dirPath, const char *nameA, GBool doStat) { #endif name = new GooString(nameA); - dir = gFalse; + dir = false; fullPath = new GooString(dirPath); appendToPath(fullPath, nameA); if (doStat) { #ifdef VMS if (!strcmp(nameA, "-") || ((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5))) - dir = gTrue; + dir = true; #elif defined(ACORN) #else #ifdef _WIN32 @@ -550,7 +550,7 @@ GDirEntry::~GDirEntry() { delete name; } -GDir::GDir(const char *name, GBool doStatA) { +GDir::GDir(const char *name, bool doStatA) { path = new GooString(name); doStat = doStatA; #if defined(_WIN32) @@ -603,7 +603,7 @@ GDirEntry *GDir::getNextEntry() { if (dir) { if (needParent) { e = new GDirEntry(path->getCString(), "-", doStat); - needParent = gFalse; + needParent = false; return e; } ent = readdir(dir); diff --git a/goo/gtypes.h b/goo/gtypes.h index a8d45194..922cf905 100644 --- a/goo/gtypes.h +++ b/goo/gtypes.h @@ -28,18 +28,6 @@ #include "poppler-config.h" /* - * These have stupid names to avoid conflicts with some (but not all) - * C++ compilers which define them. - */ -typedef bool GBool; -#define gTrue true -#define gFalse false - -#ifdef _MSC_VER -#pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */ -#endif - -/* * These have stupid names to avoid conflicts with <sys/types.h>, * which on various systems defines some random subset of these. */ diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 4f7a18c4..d5c6ec0c 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -468,8 +468,8 @@ AnnotBorder::AnnotBorder() { style = borderSolid; } -GBool AnnotBorder::parseDashArray(Object *dashObj) { - GBool correct = gTrue; +bool AnnotBorder::parseDashArray(Object *dashObj) { + bool correct = true; const int tempLength = dashObj->arrayGetLength(); double *tempDash = (double *) gmallocn (tempLength, sizeof (double)); @@ -481,7 +481,7 @@ GBool AnnotBorder::parseDashArray(Object *dashObj) { correct = tempDash[i] >= 0; } else { - correct = gFalse; + correct = false; } } @@ -514,7 +514,7 @@ AnnotBorderArray::AnnotBorderArray(Array *array) { Object obj1; int arrayLength = array->getLength(); - GBool correct = gTrue; + bool correct = true; if (arrayLength == 3 || arrayLength == 4) { // implementation note 81 in Appendix H. @@ -522,29 +522,29 @@ AnnotBorderArray::AnnotBorderArray(Array *array) { if (obj1.isNum()) horizontalCorner = obj1.getNum(); else - correct = gFalse; + correct = false; obj1 = array->get(1); if (obj1.isNum()) verticalCorner = obj1.getNum(); else - correct = gFalse; + correct = false; obj1 = array->get(2); if (obj1.isNum()) width = obj1.getNum(); else - correct = gFalse; + correct = false; if (arrayLength == 4) { obj1 = array->get(3); if (obj1.isArray()) correct = parseDashArray(&obj1); else - correct = gFalse; + correct = false; } } else { - correct = gFalse; + correct = false; } if (!correct) { @@ -800,7 +800,7 @@ void DefaultAppearance::setFontColor(std::unique_ptr<AnnotColor> fontColorA) { GooString *DefaultAppearance::toAppearanceString() const { AnnotAppearanceBuilder appearBuilder; if (fontColor) { - appearBuilder.setDrawColor(fontColor.get(), gTrue); + appearBuilder.setDrawColor(fontColor.get(), true); } appearBuilder.setTextFont(fontName, fontPtSize); return appearBuilder.buffer()->copy(); @@ -863,7 +863,7 @@ AnnotIconFit::AnnotIconFit(Dict* dict) { if (obj1.isBool()) { fullyBounds = obj1.getBool(); } else { - fullyBounds = gFalse; + fullyBounds = false; } } @@ -926,11 +926,11 @@ int AnnotAppearance::getNumStates() { } // Test if stateObj (a Ref or a Dict) points to the specified stream -GBool AnnotAppearance::referencesStream(Object *stateObj, Ref refToStream) { +bool AnnotAppearance::referencesStream(Object *stateObj, Ref refToStream) { if (stateObj->isRef()) { Ref r = stateObj->getRef(); if (r.num == refToStream.num && r.gen == refToStream.gen) { - return gTrue; + return true; } } else if (stateObj->isDict()) { // Test each value const int size = stateObj->dictGetLength(); @@ -939,29 +939,29 @@ GBool AnnotAppearance::referencesStream(Object *stateObj, Ref refToStream) { if (obj1.isRef()) { Ref r = obj1.getRef(); if (r.num == refToStream.num && r.gen == refToStream.gen) { - return gTrue; + return true; } } } } - return gFalse; // Not found + return false; // Not found } // Test if this AnnotAppearance references the specified stream -GBool AnnotAppearance::referencesStream(Ref refToStream) { +bool AnnotAppearance::referencesStream(Ref refToStream) { Object obj1; - GBool found; + bool found; // Scan each state's ref/subdictionary obj1 = appearDict.dictLookupNF("N"); found = referencesStream(&obj1, refToStream); if (found) - return gTrue; + return true; obj1 = appearDict.dictLookupNF("R"); found = referencesStream(&obj1, refToStream); if (found) - return gTrue; + return true; obj1 = appearDict.dictLookupNF("D"); found = referencesStream(&obj1, refToStream); @@ -1167,10 +1167,10 @@ Annot::Annot(PDFDoc *docA, Object *dictObject) { Annot::Annot(PDFDoc *docA, Object *dictObject, Object *obj) { refCnt = 1; if (obj->isRef()) { - hasRef = gTrue; + hasRef = true; ref = obj->getRef(); } else { - hasRef = gFalse; + hasRef = false; } flags = flagUnknown; type = typeUnknown; @@ -1181,7 +1181,7 @@ Annot::Annot(PDFDoc *docA, Object *dictObject, Object *obj) { void Annot::initialize(PDFDoc *docA, Dict *dict) { Object apObj, asObj, obj1; - ok = gTrue; + ok = true; doc = docA; xref = doc->getXRef(); @@ -1212,7 +1212,7 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) { rect->x1 = rect->y1 = 0; rect->x2 = rect->y2 = 1; error(errSyntaxError, -1, "Bad bounding box for annotation"); - ok = gFalse; + ok = false; } obj1 = dict->lookup("Contents"); @@ -1341,7 +1341,7 @@ void Annot::setRect(double x1, double y1, double x2, double y2) { invalidateAppearance(); } -GBool Annot::inRect(double x, double y) const { +bool Annot::inRect(double x, double y) const { return rect->contains(x, y); } @@ -1430,7 +1430,7 @@ void Annot::setColor(std::unique_ptr<AnnotColor> &&new_color) { invalidateAppearance(); } -void Annot::setPage(int pageIndex, GBool updateP) { +void Annot::setPage(int pageIndex, bool updateP) { annotLocker(); Page *pageobj = doc->getPage(pageIndex); Object obj1(objNull); @@ -1507,7 +1507,7 @@ void Annot::readArrayNum(Object *pdfArray, int key, double *value) { *value = valueObject.getNum(); } else { *value = 0; - ok = gFalse; + ok = false; } } @@ -1528,7 +1528,7 @@ void Annot::decRefCnt() { Annot::~Annot() {} -void AnnotAppearanceBuilder::setDrawColor(const AnnotColor *drawColor, GBool fill) { +void AnnotAppearanceBuilder::setDrawColor(const AnnotColor *drawColor, bool fill) { const double *values = drawColor->getValues(); switch (drawColor->getSpace()) { @@ -1580,7 +1580,7 @@ void AnnotAppearanceBuilder::setLineStyleForBorder(const AnnotBorder *border) { // Draw an (approximate) circle of radius <r> centered at (<cx>, <cy>). // If <fill> is true, the circle is filled; otherwise it is stroked. -void AnnotAppearanceBuilder::drawCircle(double cx, double cy, double r, GBool fill) { +void AnnotAppearanceBuilder::drawCircle(double cx, double cy, double r, bool fill) { appearBuf->appendf("{0:.2f} {1:.2f} m\n", cx + r, cy); appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c\n", @@ -1652,11 +1652,11 @@ void AnnotAppearanceBuilder::drawCircleBottomRight(double cx, double cy, double appearBuf->append("S\n"); } -Object Annot::createForm(const GooString *appearBuf, double *bbox, GBool transparencyGroup, Dict *resDict) { +Object Annot::createForm(const GooString *appearBuf, double *bbox, bool transparencyGroup, Dict *resDict) { return createForm(appearBuf, bbox, transparencyGroup, resDict ? Object(resDict) : Object()); } -Object Annot::createForm(const GooString *appearBuf, double *bbox, GBool transparencyGroup, Object &&resDictObject) { +Object Annot::createForm(const GooString *appearBuf, double *bbox, bool transparencyGroup, Object &&resDictObject) { Dict *appearDict = new Dict(xref); appearDict->set("Length", Object(appearBuf->getLength())); appearDict->set("Subtype", Object(objName, "Form")); @@ -1717,22 +1717,22 @@ Object Annot::getAppearanceResDict() { return Object(objNull); } -GBool Annot::isVisible(GBool printing) { +bool Annot::isVisible(bool printing) { // check the flags if ((flags & flagHidden) || (printing && !(flags & flagPrint)) || (!printing && (flags & flagNoView))) { - return gFalse; + return false; } // check the OC OCGs *optContentConfig = doc->getCatalog()->getOptContentConfig(); if (optContentConfig) { if (! optContentConfig->optContentIsVisible(&oc)) - return gFalse; + return false; } - return gTrue; + return true; } int Annot::getRotation() const @@ -1747,7 +1747,7 @@ int Annot::getRotation() const } } -void Annot::draw(Gfx *gfx, GBool printing) { +void Annot::draw(Gfx *gfx, bool printing) { annotLocker(); if (!isVisible (printing)) return; @@ -1789,7 +1789,7 @@ void AnnotPopup::initialize(PDFDoc *docA, Dict *dict) { if (obj1.isBool()) { open = obj1.getBool(); } else { - open = gFalse; + open = false; } } @@ -1802,7 +1802,7 @@ void AnnotPopup::setParent(Annot *parentA) { update ("Parent", Object(parentRef.num, parentRef.gen)); } -void AnnotPopup::setOpen(GBool openA) { +void AnnotPopup::setOpen(bool openA) { open = openA; update ("Open", Object(open)); } @@ -1987,7 +1987,7 @@ void AnnotText::initialize(PDFDoc *docA, Dict *dict) { if (obj1.isBool()) open = obj1.getBool(); else - open = gFalse; + open = false; obj1 = dict->lookup("Name"); if (obj1.isName()) { @@ -2060,7 +2060,7 @@ void AnnotText::initialize(PDFDoc *docA, Dict *dict) { } } -void AnnotText::setOpen(GBool openA) { +void AnnotText::setOpen(bool openA) { open = openA; update ("Open", Object(open)); } @@ -2323,7 +2323,7 @@ void AnnotText::setIcon(GooString *new_icon) { "16.641 7.859 20 12 20 c 16.141 20 19.5 16.641 19.5 12.5 c h\n" \ "19.5 12.5 m S\n" -void AnnotText::draw(Gfx *gfx, GBool printing) { +void AnnotText::draw(Gfx *gfx, bool printing) { double ca = 1; if (!isVisible (printing)) @@ -2337,7 +2337,7 @@ void AnnotText::draw(Gfx *gfx, GBool printing) { appearBuilder.append ("q\n"); if (color) - appearBuilder.setDrawColor(color.get(), gTrue); + appearBuilder.setDrawColor(color.get(), true); else appearBuilder.append ("1 1 1 rg\n"); if (!icon->cmp("Note")) @@ -2366,13 +2366,13 @@ void AnnotText::draw(Gfx *gfx, GBool printing) { double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, false, nullptr); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } @@ -2463,7 +2463,7 @@ void AnnotLink::initialize(PDFDoc *docA, Dict *dict) { } } -void AnnotLink::draw(Gfx *gfx, GBool printing) { +void AnnotLink::draw(Gfx *gfx, bool printing) { if (!isVisible (printing)) return; @@ -2505,7 +2505,7 @@ void AnnotFreeText::initialize(PDFDoc *docA, Dict *dict) { } else { appearanceString = std::make_unique<GooString>(); error(errSyntaxError, -1, "Bad appearance for annotation"); - ok = gFalse; + ok = false; } obj1 = dict->lookup("Q"); @@ -2707,15 +2707,15 @@ void AnnotFreeText::generateFreeTextAppearance() contents = std::make_unique<GooString>(); // Draw box - GBool doFill = (color && color->getSpace() != AnnotColor::colorTransparent); - GBool doStroke = (borderWidth != 0); + bool doFill = (color && color->getSpace() != AnnotColor::colorTransparent); + bool doStroke = (borderWidth != 0); if (doFill || doStroke) { if (doStroke) { - appearBuilder.setDrawColor(da.getFontColor(), gFalse); // Border color: same as font color + appearBuilder.setDrawColor(da.getFontColor(), false); // Border color: same as font color } appearBuilder.appendf ("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re\n", borderWidth/2, width-borderWidth, height-borderWidth); if (doFill) { - appearBuilder.setDrawColor(color.get(), gTrue); + appearBuilder.setDrawColor(color.get(), true); appearBuilder.append(doStroke ? "B\n" : "f\n"); } else { appearBuilder.append("S\n"); @@ -2768,7 +2768,7 @@ void AnnotFreeText::generateFreeTextAppearance() } // Set font state - appearBuilder.setDrawColor(da.getFontColor(), gTrue); + appearBuilder.setDrawColor(da.getFontColor(), true); appearBuilder.appendf ("BT 1 0 0 1 {0:.2f} {1:.2f} Tm\n", textmargin, height - textmargin - da.getFontPtSize() * font->getDescent()); appearBuilder.setTextFont(da.getFontName(), da.getFontPtSize()); @@ -2777,7 +2777,7 @@ void AnnotFreeText::generateFreeTextAppearance() while (i < contents->getLength()) { GooString out; double linewidth, xpos; - layoutText(contents.get(), &out, &i, font, &linewidth, textwidth/da.getFontPtSize(), nullptr, gFalse); + layoutText(contents.get(), &out, &i, font, &linewidth, textwidth/da.getFontPtSize(), nullptr, false); linewidth *= da.getFontPtSize(); switch (quadding) { case quaddingCentered: @@ -2805,17 +2805,17 @@ void AnnotFreeText::generateFreeTextAppearance() bbox[3] = rect->y2 - rect->y1; if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, std::move(resourceObj)); + appearance = createForm(appearBuilder.buffer(), bbox, false, std::move(resourceObj)); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, std::move(resourceObj)); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, std::move(resourceObj)); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } -void AnnotFreeText::draw(Gfx *gfx, GBool printing) { +void AnnotFreeText::draw(Gfx *gfx, bool printing) { if (!isVisible (printing)) return; @@ -2925,7 +2925,7 @@ void AnnotLine::initialize(PDFDoc *docA, Dict *dict) { if (obj1.isBool()) { caption = obj1.getBool(); } else { - caption = gFalse; + caption = false; } obj1 = dict->lookup("IT"); @@ -3078,7 +3078,7 @@ void AnnotLine::generateLineAppearance() AnnotAppearanceBuilder appearBuilder; appearBuilder.append ("q\n"); if (color) { - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); } appearBuilder.setLineStyleForBorder(border.get()); @@ -3120,7 +3120,7 @@ void AnnotLine::generateLineAppearance() while (i < contents->getLength()) { GooString out; double linewidth; - layoutText(contents.get(), &out, &i, font, &linewidth, 0, nullptr, gFalse); + layoutText(contents.get(), &out, &i, font, &linewidth, 0, nullptr, false); linewidth *= fontsize; if (linewidth > captionwidth) { captionwidth = linewidth; @@ -3189,7 +3189,7 @@ void AnnotLine::generateLineAppearance() while (i < contents->getLength()) { GooString out; double linewidth, xpos; - layoutText(contents.get(), &out, &i, font, &linewidth, 0, nullptr, gFalse); + layoutText(contents.get(), &out, &i, font, &linewidth, 0, nullptr, false); linewidth *= fontsize; xpos = (captionwidth - linewidth) / 2; appearBuilder.appendf("{0:.2f} {1:.2f} Td\n", xpos - xposPrev, -fontsize); @@ -3225,17 +3225,17 @@ void AnnotLine::generateLineAppearance() double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, fontResDict); + appearance = createForm(appearBuilder.buffer(), bbox, false, fontResDict); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, fontResDict); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, fontResDict); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } -void AnnotLine::draw(Gfx *gfx, GBool printing) { +void AnnotLine::draw(Gfx *gfx, bool printing) { if (!isVisible (printing)) return; @@ -3329,7 +3329,7 @@ void AnnotTextMarkup::initialize(PDFDoc *docA, Dict *dict) { quadrilaterals = std::make_unique<AnnotQuadrilaterals>(obj1.getArray(), rect.get()); } else { error(errSyntaxError, -1, "Bad Annot Text Markup QuadPoints"); - ok = gFalse; + ok = false; } } @@ -3378,7 +3378,7 @@ void AnnotTextMarkup::setQuadrilaterals(AnnotQuadrilaterals *quadPoints) { invalidateAppearance(); } -void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { +void AnnotTextMarkup::draw(Gfx *gfx, bool printing) { double ca = 1; int i; @@ -3387,7 +3387,7 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { annotLocker(); if (appearance.isNull() || type == typeHighlight) { - GBool blendMultiply = gTrue; + bool blendMultiply = true; ca = opacity; AnnotAppearanceBuilder appearBuilder; @@ -3405,7 +3405,7 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { switch (type) { case typeUnderline: if (color) { - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); } appearBuilder.append ("[] 0 d 1 w\n"); @@ -3424,9 +3424,9 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { break; case typeStrikeOut: if (color) { - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); } - blendMultiply = gFalse; + blendMultiply = false; appearBuilder.append ("[] 0 d 1 w\n"); for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { @@ -3450,7 +3450,7 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { break; case typeSquiggly: if (color) { - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); } appearBuilder.append ("[] 0 d 1 w\n"); @@ -3477,7 +3477,7 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { default: case typeHighlight: if (color) - appearBuilder.setDrawColor(color.get(), gTrue); + appearBuilder.setDrawColor(color.get(), true); double biggestBorder = 0; for (i = 0; i < quadrilaterals->getQuadrilateralsLength(); ++i) { @@ -3516,17 +3516,17 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) { bbox[1] = appearBBox->getPageYMin(); bbox[2] = appearBBox->getPageXMax(); bbox[3] = appearBBox->getPageYMax(); - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", 1, blendMultiply ? "Multiply" : nullptr); if (ca == 1) { - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } else { - aStream = createForm(&appearBuf, bbox, gTrue, resDict); + aStream = createForm(&appearBuf, bbox, true, resDict); Dict *resDict2 = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict2); + appearance = createForm(&appearBuf, bbox, false, resDict2); } } @@ -3648,7 +3648,7 @@ LinkAction* AnnotWidget::getFormAdditionalAction(FormAdditionalActionsType type) // Doesn't handle vertical fonts--should it? void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, const GfxFont *font, double *width, double widthLimit, - int *charCount, GBool noReencode) + int *charCount, bool noReencode) { CharCode c; Unicode uChar, *uAux; @@ -3658,8 +3658,8 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, if (!text) { return; } - GBool unicode = text->hasUnicodeMarker(); - GBool spacePrev; // previous character was a space + bool unicode = text->hasUnicodeMarker(); + bool spacePrev; // previous character was a space // State for backtracking when more text has been processed than fits within // widthLimit. We track for both input (text) and output (outBuf) the offset @@ -3687,7 +3687,7 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, // can backtrack if we exceed the maximum width. last_i1 = last_i2 = *i; last_o1 = last_o2 = 0; - spacePrev = gFalse; + spacePrev = false; outBuf->clear(); while (*i < text->getLength()) { @@ -3748,9 +3748,9 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, last_i1 = *i; if (!spacePrev) last_o1 = last_o2; - spacePrev = gTrue; + spacePrev = true; } else { - spacePrev = gFalse; + spacePrev = false; } // Compute width of character just output @@ -3865,10 +3865,10 @@ void AnnotAppearanceBuilder::writeString(const GooString &str) // Draw the variable text or caption for a field. bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da, const GfxResources *resources, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, - GBool multiline, int comb, int quadding, - GBool txField, GBool forceZapfDingbats, + bool multiline, int comb, int quadding, + bool txField, bool forceZapfDingbats, XRef *xref, bool *addedDingbatsResource, - GBool password) { + bool password) { GooList *daToks; GooString *tok; GooString convertedText; @@ -3877,7 +3877,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da double fontSize, fontSize2, borderWidth, x, xPrev, y, w, wMax; int tfPos, tmPos, i, j; int rot; - GBool freeText = gFalse; // true if text should be freed before return + bool freeText = false; // true if text should be freed before return GfxFont *fontToFree = nullptr; //~ if there is no MK entry, this should use the existing content stream, @@ -3978,7 +3978,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da for (i = 0; i < len; ++i) newText->append('*'); text = newText; - freeText = gTrue; + freeText = true; } // setup @@ -4359,7 +4359,7 @@ bool AnnotAppearanceBuilder::drawListBox(const FormFieldChoice *fieldChoice, con } return false; } - Annot::layoutText(fieldChoice->getChoice(i), &convertedText, &j, font, &w, 0.0, nullptr, gFalse); + Annot::layoutText(fieldChoice->getChoice(i), &convertedText, &j, font, &w, 0.0, nullptr, false); if (w > wMax) { wMax = w; } @@ -4397,7 +4397,7 @@ bool AnnotAppearanceBuilder::drawListBox(const FormFieldChoice *fieldChoice, con // compute text width and start position j = 0; - Annot::layoutText(fieldChoice->getChoice(i), &convertedText, &j, font, &w, 0.0, nullptr, gFalse); + Annot::layoutText(fieldChoice->getChoice(i), &convertedText, &j, font, &w, 0.0, nullptr, false); w *= fontSize; switch (quadding) { case quaddingLeftJustified: @@ -4474,7 +4474,7 @@ void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const Annot const double dy = rect->y2 - rect->y1; // radio buttons with no caption have a round border - const GBool hasCaption = appearCharacs->getNormalCaption() != nullptr; + const bool hasCaption = appearCharacs->getNormalCaption() != nullptr; if (field->getType() == formButton && static_cast<const FormFieldButton*>(field)->getButtonType() == formButtonRadio && !hasCaption) { double r = 0.5 * (dx < dy ? dx : dy); @@ -4491,21 +4491,21 @@ void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const Annot case AnnotBorder::borderSolid: case AnnotBorder::borderUnderlined: appearBuf->appendf("{0:.2f} w\n", w); - setDrawColor(aColor, gFalse); - drawCircle(0.5 * dx, 0.5 * dy, r - 0.5 * w, gFalse); + setDrawColor(aColor, false); + drawCircle(0.5 * dx, 0.5 * dy, r - 0.5 * w, false); break; case AnnotBorder::borderBeveled: case AnnotBorder::borderInset: appearBuf->appendf("{0:.2f} w\n", 0.5 * w); - setDrawColor(aColor, gFalse); - drawCircle(0.5 * dx, 0.5 * dy, r - 0.25 * w, gFalse); + setDrawColor(aColor, false); + drawCircle(0.5 * dx, 0.5 * dy, r - 0.25 * w, false); adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? 1 : -1); - setDrawColor(&adjustedColor, gFalse); + setDrawColor(&adjustedColor, false); drawCircleTopLeft(0.5 * dx, 0.5 * dy, r - 0.75 * w); adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? -1 : 1); - setDrawColor(&adjustedColor, gFalse); + setDrawColor(&adjustedColor, false); drawCircleBottomRight(0.5 * dx, 0.5 * dy, r - 0.75 * w); break; } @@ -4522,7 +4522,7 @@ void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const Annot // fallthrough case AnnotBorder::borderSolid: appearBuf->appendf("{0:.2f} w\n", w); - setDrawColor(aColor, gFalse); + setDrawColor(aColor, false); appearBuf->appendf("{0:.2f} {0:.2f} {1:.2f} {2:.2f} re s\n", 0.5 * w, dx - w, dy - w); break; @@ -4530,7 +4530,7 @@ void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const Annot case AnnotBorder::borderInset: adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? 1 : -1); - setDrawColor(&adjustedColor, gTrue); + setDrawColor(&adjustedColor, true); appearBuf->append("0 0 m\n"); appearBuf->appendf("0 {0:.2f} l\n", dy); appearBuf->appendf("{0:.2f} {1:.2f} l\n", dx, dy); @@ -4540,7 +4540,7 @@ void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const Annot appearBuf->append("f\n"); adjustedColor = AnnotColor(*aColor); adjustedColor.adjustColor(border->getStyle() == AnnotBorder::borderBeveled ? -1 : 1); - setDrawColor(&adjustedColor, gTrue); + setDrawColor(&adjustedColor, true); appearBuf->append("0 0 m\n"); appearBuf->appendf("{0:.2f} 0 l\n", dx); appearBuf->appendf("{0:.2f} {1:.2f} l\n", dx, dy); @@ -4551,7 +4551,7 @@ void AnnotAppearanceBuilder::drawFieldBorder(const FormField *field, const Annot break; case AnnotBorder::borderUnderlined: appearBuf->appendf("{0:.2f} w\n", w); - setDrawColor(aColor, gFalse); + setDrawColor(aColor, false); appearBuf->appendf("0 0 m {0:.2f} 0 l s\n", dx); break; } @@ -4597,14 +4597,14 @@ bool AnnotAppearanceBuilder::drawFormFieldButton(const FormFieldButton *field, c if (appearState && appearState->cmp("Off") != 0 && field->getState(appearState->getCString())) { if (caption) { - return drawText(caption, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gTrue, xref, addedDingbatsResource, gFalse); + return drawText(caption, da, resources, border, appearCharacs, rect, false, 0, fieldQuadCenter, false, true, xref, addedDingbatsResource, false); } else if (appearCharacs) { const AnnotColor *aColor = appearCharacs->getBorderColor(); if (aColor) { const double dx = rect->x2 - rect->x1; const double dy = rect->y2 - rect->y1; - setDrawColor(aColor, gTrue); - drawCircle(0.5 * dx, 0.5 * dy, 0.2 * (dx < dy ? dx : dy), gTrue); + setDrawColor(aColor, true); + drawCircle(0.5 * dx, 0.5 * dy, 0.2 * (dx < dy ? dx : dy), true); } return true; } @@ -4613,15 +4613,15 @@ bool AnnotAppearanceBuilder::drawFormFieldButton(const FormFieldButton *field, c break; case formButtonPush: if (caption) - return drawText(caption, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gFalse, xref, addedDingbatsResource, gFalse); + return drawText(caption, da, resources, border, appearCharacs, rect, false, 0, fieldQuadCenter, false, false, xref, addedDingbatsResource, false); break; case formButtonCheck: if (appearState && appearState->cmp("Off") != 0) { if (!caption) { GooString checkMark("3"); - return drawText(&checkMark, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gTrue, xref, addedDingbatsResource, gFalse); + return drawText(&checkMark, da, resources, border, appearCharacs, rect, false, 0, fieldQuadCenter, false, true, xref, addedDingbatsResource, false); } else { - return drawText(caption, da, resources, border, appearCharacs, rect, gFalse, 0, fieldQuadCenter, gFalse, gTrue, xref, addedDingbatsResource, gFalse); + return drawText(caption, da, resources, border, appearCharacs, rect, false, 0, fieldQuadCenter, false, true, xref, addedDingbatsResource, false); } } break; @@ -4643,7 +4643,7 @@ bool AnnotAppearanceBuilder::drawFormFieldText(const FormFieldText *fieldText, c comb = fieldText->getMaxLen(); return drawText(contents, da, resources, border, appearCharacs, rect, - fieldText->isMultiline(), comb, quadding, gTrue, gFalse, nullptr, nullptr, fieldText->isPassword()); + fieldText->isMultiline(), comb, quadding, true, false, nullptr, nullptr, fieldText->isPassword()); } return true; @@ -4658,7 +4658,7 @@ bool AnnotAppearanceBuilder::drawFormFieldChoice(const FormFieldChoice *fieldCho if (fieldChoice->isCombo()) { selected = fieldChoice->getSelectedChoice(); if (selected) { - return drawText(selected, da, resources, border, appearCharacs, rect, gFalse, 0, quadding, gTrue, gFalse, nullptr, nullptr, gFalse); + return drawText(selected, da, resources, border, appearCharacs, rect, false, 0, quadding, true, false, nullptr, nullptr, false); //~ Acrobat draws a popup icon on the right side } // list box @@ -4679,7 +4679,7 @@ void AnnotWidget::generateFieldAppearance(bool *addedDingbatsResource) { if (appearCharacs) { const AnnotColor *aColor = appearCharacs->getBackColor(); if (aColor) { - appearBuilder.setDrawColor(aColor, gTrue); + appearBuilder.setDrawColor(aColor, true); appearBuilder.appendf("0 0 {0:.2f} {1:.2f} re f\n", rect->x2 - rect->x1, rect->y2 - rect->y1); } @@ -4767,7 +4767,7 @@ void AnnotWidget::updateAppearanceStream() } } -void AnnotWidget::draw(Gfx *gfx, GBool printing) { +void AnnotWidget::draw(Gfx *gfx, bool printing) { if (!isVisible (printing)) return; @@ -4846,15 +4846,15 @@ void AnnotMovie::initialize(PDFDoc *docA, Dict* dict) { movie = std::make_unique<Movie>(&movieDict); if (!movie->isOk()) { movie = nullptr; - ok = gFalse; + ok = false; } } else { error(errSyntaxError, -1, "Bad Annot Movie"); - ok = gFalse; + ok = false; } } -void AnnotMovie::draw(Gfx *gfx, GBool printing) { +void AnnotMovie::draw(Gfx *gfx, bool printing) { if (!isVisible (printing)) return; @@ -4920,7 +4920,7 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) { bbox[0] = bbox[1] = 0; bbox[2] = width; bbox[3] = height; - appearance = createForm(appearBuf.get(), bbox, gFalse, resDict2); + appearance = createForm(appearBuf.get(), bbox, false, resDict2); } } @@ -4963,7 +4963,7 @@ void AnnotScreen::initialize(PDFDoc *docA, Dict* dict) { if (action && action->getKind() == actionRendition && page == 0) { error (errSyntaxError, -1, "Invalid Rendition action: associated screen annotation without P"); action = nullptr; - ok = gFalse; + ok = false; } } @@ -5116,7 +5116,7 @@ void AnnotGeometry::setInteriorColor(std::unique_ptr<AnnotColor> &&new_color) { invalidateAppearance(); } -void AnnotGeometry::draw(Gfx *gfx, GBool printing) { +void AnnotGeometry::draw(Gfx *gfx, bool printing) { double ca = 1; if (!isVisible (printing)) @@ -5129,13 +5129,13 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { AnnotAppearanceBuilder appearBuilder; appearBuilder.append ("q\n"); if (color) - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); double borderWidth = border->getWidth(); appearBuilder.setLineStyleForBorder(border.get()); if (interiorColor) - appearBuilder.setDrawColor(interiorColor.get(), gTrue); + appearBuilder.setDrawColor(interiorColor.get(), true); if (type == typeSquare) { appearBuilder.appendf ("{0:.2f} {1:.2f} {2:.2f} {3:.2f} re\n", @@ -5202,13 +5202,13 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) { bbox[2] = rect->x2 - rect->x1; bbox[3] = rect->y2 - rect->y1; if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, false, nullptr); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } @@ -5271,7 +5271,7 @@ void AnnotPolygon::initialize(PDFDoc *docA, Dict* dict) { } else { vertices = std::make_unique<AnnotPath>(); error(errSyntaxError, -1, "Bad Annot Polygon Vertices"); - ok = gFalse; + ok = false; } obj1 = dict->lookup("LE"); @@ -5391,7 +5391,7 @@ void AnnotPolygon::setIntent(AnnotPolygonIntent new_intent) { update ("IT", Object(objName, intentName)); } -void AnnotPolygon::draw(Gfx *gfx, GBool printing) { +void AnnotPolygon::draw(Gfx *gfx, bool printing) { double ca = 1; if (!isVisible (printing)) @@ -5406,14 +5406,14 @@ void AnnotPolygon::draw(Gfx *gfx, GBool printing) { appearBuilder.append ("q\n"); if (color) { - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); } appearBuilder.setLineStyleForBorder(border.get()); appearBBox->setBorderWidth(std::max(1., border->getWidth())); if (interiorColor) { - appearBuilder.setDrawColor(interiorColor.get(), gTrue); + appearBuilder.setDrawColor(interiorColor.get(), true); } if (vertices->getCoordsLength() != 0) { @@ -5441,13 +5441,13 @@ void AnnotPolygon::draw(Gfx *gfx, GBool printing) { double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, false, nullptr); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } @@ -5549,7 +5549,7 @@ void AnnotInk::initialize(PDFDoc *docA, Dict* dict) { inkListLength = 0; inkList = nullptr; error(errSyntaxError, -1, "Bad Annot Ink List"); - ok = gFalse; + ok = false; } obj1 = dict->lookup("BS"); @@ -5602,7 +5602,7 @@ void AnnotInk::setInkList(AnnotPath **paths, int n_paths) { invalidateAppearance(); } -void AnnotInk::draw(Gfx *gfx, GBool printing) { +void AnnotInk::draw(Gfx *gfx, bool printing) { double ca = 1; if (!isVisible (printing)) @@ -5617,7 +5617,7 @@ void AnnotInk::draw(Gfx *gfx, GBool printing) { appearBuilder.append ("q\n"); if (color) { - appearBuilder.setDrawColor(color.get(), gFalse); + appearBuilder.setDrawColor(color.get(), false); } appearBuilder.setLineStyleForBorder(border.get()); @@ -5643,13 +5643,13 @@ void AnnotInk::draw(Gfx *gfx, GBool printing) { double bbox[4]; appearBBox->getBBoxRect(bbox); if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, false, nullptr); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } @@ -5695,7 +5695,7 @@ void AnnotFileAttachment::initialize(PDFDoc *docA, Dict* dict) { file = obj1.copy(); } else { error(errSyntaxError, -1, "Bad Annot File Attachment"); - ok = gFalse; + ok = false; } obj1 = dict->lookup("Name"); @@ -5818,7 +5818,7 @@ void AnnotFileAttachment::initialize(PDFDoc *docA, Dict* dict) { "6.93 16.141 m 8 21 14.27 21.5 16 21.5 c 18.094 21.504 19.5 21 19.5 19 c\n" \ "19.5 17.699 20.91 17.418 22.5 17.5 c S\n" -void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { +void AnnotFileAttachment::draw(Gfx *gfx, bool printing) { double ca = 1; if (!isVisible (printing)) @@ -5832,7 +5832,7 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { appearBuilder.append ("q\n"); if (color) - appearBuilder.setDrawColor(color.get(), gTrue); + appearBuilder.setDrawColor(color.get(), true); else appearBuilder.append ("1 1 1 rg\n"); if (!name->cmp("PushPin")) @@ -5849,13 +5849,13 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) { bbox[0] = bbox[1] = 0; bbox[2] = bbox[3] = 24; if (ca == 1) { - appearance = createForm (appearBuilder.buffer(), bbox, gFalse, nullptr); + appearance = createForm (appearBuilder.buffer(), bbox, false, nullptr); } else { - Object aStream = createForm (appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm (appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } @@ -5892,7 +5892,7 @@ void AnnotSound::initialize(PDFDoc *docA, Dict* dict) { sound.reset(Sound::parseSound(&obj1)); if (!sound) { error(errSyntaxError, -1, "Bad Annot Sound"); - ok = gFalse; + ok = false; } obj1 = dict->lookup("Name"); @@ -5966,7 +5966,7 @@ void AnnotSound::initialize(PDFDoc *docA, Dict* dict) { "1 J\n" \ "8 4 m 16 4 l S\n" -void AnnotSound::draw(Gfx *gfx, GBool printing) { +void AnnotSound::draw(Gfx *gfx, bool printing) { Object obj; double ca = 1; @@ -5981,7 +5981,7 @@ void AnnotSound::draw(Gfx *gfx, GBool printing) { appearBuilder.append ("q\n"); if (color) - appearBuilder.setDrawColor(color.get(), gTrue); + appearBuilder.setDrawColor(color.get(), true); else appearBuilder.append ("1 1 1 rg\n"); if (!name->cmp("Speaker")) @@ -5994,13 +5994,13 @@ void AnnotSound::draw(Gfx *gfx, GBool printing) { bbox[0] = bbox[1] = 0; bbox[2] = bbox[3] = 24; if (ca == 1) { - appearance = createForm(appearBuilder.buffer(), bbox, gFalse, nullptr); + appearance = createForm(appearBuilder.buffer(), bbox, false, nullptr); } else { - Object aStream = createForm(appearBuilder.buffer(), bbox, gTrue, nullptr); + Object aStream = createForm(appearBuilder.buffer(), bbox, true, nullptr); GooString appearBuf("/GS0 gs\n/Fm0 Do"); Dict *resDict = createResourcesDict("Fm0", std::move(aStream), "GS0", ca, nullptr); - appearance = createForm(&appearBuf, bbox, gFalse, resDict); + appearance = createForm(&appearBuf, bbox, false, resDict); } } @@ -6110,14 +6110,14 @@ Annot3D::Activation::Activation(Dict *dict) { if (obj1.isBool()) { displayToolbar = obj1.getBool(); } else { - displayToolbar = gTrue; + displayToolbar = true; } obj1 = dict->lookup("NP"); if (obj1.isBool()) { displayNavigation = obj1.getBool(); } else { - displayNavigation = gFalse; + displayNavigation = false; } } @@ -6485,7 +6485,7 @@ Annots::Annots(PDFDoc *docA, int page, Object *annotsObj) { annot = createAnnot (&obj1, &obj2); if (annot) { if (annot->isOk()) { - annot->setPage(page, gFalse); // Don't change /P + annot->setPage(page, false); // Don't change /P appendAnnot(annot); } annot->decRefCnt(); @@ -6502,7 +6502,7 @@ void Annots::appendAnnot(Annot *annot) { } } -GBool Annots::removeAnnot(Annot *annot) { +bool Annots::removeAnnot(Annot *annot) { auto idx = std::find(annots.begin(), annots.end(), annot); if (idx == annots.end()) { diff --git a/poppler/Annot.h b/poppler/Annot.h index 7f4d9796..3216f02e 100644 --- a/poppler/Annot.h +++ b/poppler/Annot.h @@ -264,7 +264,7 @@ public: protected: AnnotBorder(); - GBool parseDashArray(Object *dashObj); + bool parseDashArray(Object *dashObj); AnnotBorderType type; double width; @@ -443,10 +443,10 @@ public: void removeAllStreams(); // Test if this AnnotAppearance references the specified stream - GBool referencesStream(Ref targetStreamRef); + bool referencesStream(Ref targetStreamRef); private: - static GBool referencesStream(Object *stateObj, Ref targetStreamRef); + static bool referencesStream(Object *stateObj, Ref targetStreamRef); void removeStream(Ref refToStream); void removeStateStreams(Object *state); @@ -541,10 +541,10 @@ public: AnnotAppearanceBuilder(const AnnotAppearanceBuilder &) = delete; AnnotAppearanceBuilder& operator=(const AnnotAppearanceBuilder &) = delete; - void setDrawColor(const AnnotColor *color, GBool fill); + void setDrawColor(const AnnotColor *color, bool fill); void setLineStyleForBorder(const AnnotBorder *border); void setTextFont(const Object &fontName, double fontSize); - void drawCircle(double cx, double cy, double r, GBool fill); + void drawCircle(double cx, double cy, double r, bool fill); void drawCircleTopLeft(double cx, double cy, double r); void drawCircleBottomRight(double cx, double cy, double r); void drawFieldBorder(const FormField *field, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect); @@ -565,10 +565,10 @@ private: bool drawFormFieldChoice(const FormFieldChoice *fieldChoice, const Form *form, const GfxResources *resources, const GooString *da, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect); bool drawText(const GooString *text, const GooString *da, const GfxResources *resources, const AnnotBorder *border, const AnnotAppearanceCharacs *appearCharacs, const PDFRectangle *rect, - GBool multiline, int comb, int quadding, - GBool txField, GBool forceZapfDingbats, + bool multiline, int comb, int quadding, + bool txField, bool forceZapfDingbats, XRef *xref, bool *addedDingbatsResource, // xref and addedDingbatsResource both must not be null if forceZapfDingbats is passed - GBool password); + bool password); GooString *appearBuf; }; @@ -651,16 +651,16 @@ public: Annot(PDFDoc *docA, PDFRectangle *rectA); Annot(PDFDoc *docA, Object *dictObject); Annot(PDFDoc *docA, Object *dictObject, Object *obj); - GBool isOk() { return ok; } + bool isOk() { return ok; } void incRefCnt(); void decRefCnt(); - virtual void draw(Gfx *gfx, GBool printing); + virtual void draw(Gfx *gfx, bool printing); // Get the resource dict of the appearance stream virtual Object getAppearanceResDict(); - GBool match(Ref *refA) + bool match(Ref *refA) { return ref.num == refA->num && ref.gen == refA->gen; } double getXMin(); @@ -686,7 +686,7 @@ public: // getters PDFDoc *getDoc() const { return doc; } XRef *getXRef() const { return xref; } - GBool getHasRef() const { return hasRef; } + bool getHasRef() const { return hasRef; } Ref getRef() const { return ref; } AnnotSubtype getType() const { return type; } PDFRectangle *getRect() const { return rect.get(); } @@ -705,28 +705,28 @@ public: int getId() { return ref.num; } // Check if point is inside the annot rectangle. - GBool inRect(double x, double y) const; + bool inRect(double x, double y) const; static void layoutText(const GooString *text, GooString *outBuf, int *i, const GfxFont *font, double *width, double widthLimit, int *charCount, - GBool noReencode); + bool noReencode); private: void readArrayNum(Object *pdfArray, int key, double *value); // write vStr[i:j[ in appearBuf void initialize (PDFDoc *docA, Dict *dict); - void setPage (int new_page, GBool updateP); // Called by Page::addAnnot and Annots ctor + void setPage (int new_page, bool updateP); // Called by Page::addAnnot and Annots ctor protected: virtual ~Annot(); virtual void removeReferencedObjects(); // Called by Page::removeAnnot - Object createForm(const GooString *appearBuf, double *bbox, GBool transparencyGroup, Dict *resDict); - Object createForm(const GooString *appearBuf, double *bbox, GBool transparencyGroup, Object &&resDictObject); // overload to support incRef/decRef + Object createForm(const GooString *appearBuf, double *bbox, bool transparencyGroup, Dict *resDict); + Object createForm(const GooString *appearBuf, double *bbox, bool transparencyGroup, Object &&resDictObject); // overload to support incRef/decRef Dict *createResourcesDict(const char *formName, Object &&formStream, const char *stateName, double opacity, const char *blendMode); - GBool isVisible(GBool printing); + bool isVisible(bool printing); int getRotation() const; // Updates the field key of the annotation dictionary @@ -763,7 +763,7 @@ protected: Ref ref; // object ref identifying this annotation std::unique_ptr<AnnotBorder> border; // Border, BS std::unique_ptr<AnnotColor> color; // C - GBool ok; + bool ok; bool hasRef; mutable std::recursive_mutex mutex; @@ -782,14 +782,14 @@ public: Object *getParentNF() { return &parent; } void setParent(Object *parentA); void setParent(Annot *parentA); - GBool getOpen() const { return open; } - void setOpen(GBool openA); + bool getOpen() const { return open; } + void setOpen(bool openA); protected: void initialize(PDFDoc *docA, Dict *dict); Object parent; // Parent - GBool open; // Open + bool open; // Open }; //------------------------------------------------------------------------ @@ -867,21 +867,21 @@ public: AnnotText(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotText(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; // getters - GBool getOpen() const { return open; } + bool getOpen() const { return open; } const GooString *getIcon() const { return icon.get(); } AnnotTextState getState() const { return state; } - void setOpen(GBool openA); + void setOpen(bool openA); void setIcon(GooString *new_icon); private: void initialize(PDFDoc *docA, Dict *dict); - GBool open; // Open (Default false) + bool open; // Open (Default false) std::unique_ptr<GooString> icon; // Name (Default Note) AnnotTextState state; // State (Default Umarked if // StateModel Marked @@ -900,7 +900,7 @@ class AnnotMovie: public Annot { AnnotMovie(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotMovie(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; const GooString* getTitle() const { return title.get(); } Movie* getMovie() { return movie.get(); } @@ -960,7 +960,7 @@ public: AnnotLink(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotLink(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; // getters LinkAction *getAction() const { return action.get(); } @@ -1001,7 +1001,7 @@ public: AnnotFreeText(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotFreeText(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; Object getAppearanceResDict() override; void setContents(GooString *new_content) override; @@ -1064,7 +1064,7 @@ public: AnnotLine(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotLine(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; Object getAppearanceResDict() override; void setContents(GooString *new_content) override; @@ -1131,7 +1131,7 @@ public: AnnotTextMarkup(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotTextMarkup(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; // typeHighlight, typeUnderline, typeSquiggly or typeStrikeOut void setType(AnnotSubtype new_type); @@ -1181,7 +1181,7 @@ public: AnnotGeometry(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotGeometry(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; void setType(AnnotSubtype new_type); // typeSquare or typeCircle void setInteriorColor(std::unique_ptr<AnnotColor> &&new_color); @@ -1217,7 +1217,7 @@ public: AnnotPolygon(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotPolygon(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; void setType(AnnotSubtype new_type); // typePolygon or typePolyLine void setVertices(AnnotPath *path); @@ -1292,7 +1292,7 @@ public: AnnotInk(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotInk(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; void setInkList(AnnotPath **paths, int n_paths); @@ -1327,7 +1327,7 @@ public: AnnotFileAttachment(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotFileAttachment(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; // getters Object *getFile() { return &file; } @@ -1355,7 +1355,7 @@ public: AnnotSound(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotSound(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; // getters Sound *getSound() { return sound.get(); } @@ -1390,7 +1390,7 @@ public: AnnotWidget(PDFDoc *docA, Object *dictObject, Object *obj, FormField *fieldA); ~AnnotWidget(); - void draw(Gfx *gfx, GBool printing) override; + void draw(Gfx *gfx, bool printing) override; void generateFieldAppearance (bool *addDingbatsResource); void updateAppearanceStream (); @@ -1459,8 +1459,8 @@ class Annot3D: public Annot { ActivationAState aState; // AIS (Default L) ActivationDTrigger dTrigger; // D (Default PI) ActivationDState dState; // DIS (Default U) - GBool displayToolbar; // TB (Default true) - GBool displayNavigation; // NP (Default false); + bool displayToolbar; // TB (Default true) + bool displayNavigation; // NP (Default false); }; public: @@ -1682,7 +1682,7 @@ public: int getNumAnnots() const { return annots.size(); } Annot *getAnnot(int i) { return annots[i]; } void appendAnnot(Annot *annot); - GBool removeAnnot(Annot *annot); + bool removeAnnot(Annot *annot); private: Annot* createAnnot(Object* dictObject, Object *obj); diff --git a/poppler/Array.cc b/poppler/Array.cc index 5809fb2f..ca4a03d5 100644 --- a/poppler/Array.cc +++ b/poppler/Array.cc @@ -84,14 +84,14 @@ Object Array::getNF(int i) const { return elems[i].copy(); } -GBool Array::getString(int i, GooString *string) const +bool Array::getString(int i, GooString *string) const { Object obj = getNF(i); if (obj.isString()) { string->clear(); string->append(obj.getString()); - return gTrue; + return true; } else { - return gFalse; + return false; } } diff --git a/poppler/Array.h b/poppler/Array.h index fb2aa798..0eb4e780 100644 --- a/poppler/Array.h +++ b/poppler/Array.h @@ -69,7 +69,7 @@ public: // Accessors. Object get(int i, int resursion = 0) const; Object getNF(int i) const; - GBool getString(int i, GooString *string) const; + bool getString(int i, GooString *string) const; private: friend class Object; // for incRef/decRef diff --git a/poppler/BuiltinFont.cc b/poppler/BuiltinFont.cc index a0e9d094..20ddeccd 100644 --- a/poppler/BuiltinFont.cc +++ b/poppler/BuiltinFont.cc @@ -35,7 +35,7 @@ BuiltinFontWidths::~BuiltinFontWidths() { gfree(tab); } -GBool BuiltinFontWidths::getWidth(const char *name, Gushort *width) { +bool BuiltinFontWidths::getWidth(const char *name, Gushort *width) { int h; BuiltinFontWidth *p; @@ -43,10 +43,10 @@ GBool BuiltinFontWidths::getWidth(const char *name, Gushort *width) { for (p = tab[h]; p; p = p->next) { if (!strcmp(p->name, name)) { *width = p->width; - return gTrue; + return true; } } - return gFalse; + return false; } int BuiltinFontWidths::hash(const char *name) { diff --git a/poppler/BuiltinFont.h b/poppler/BuiltinFont.h index 0c580d18..3821d6ad 100644 --- a/poppler/BuiltinFont.h +++ b/poppler/BuiltinFont.h @@ -56,7 +56,7 @@ public: BuiltinFontWidths(const BuiltinFontWidths &) = delete; BuiltinFontWidths& operator=(const BuiltinFontWidths &) = delete; - GBool getWidth(const char *name, Gushort *width); + bool getWidth(const char *name, Gushort *width); private: diff --git a/poppler/CMap.cc b/poppler/CMap.cc index a8fea41b..c5db68a4 100644 --- a/poppler/CMap.cc +++ b/poppler/CMap.cc @@ -42,7 +42,7 @@ //------------------------------------------------------------------------ struct CMapVectorEntry { - GBool isVector; + bool isVector; union { CMapVectorEntry *vector; CID cid; @@ -302,11 +302,11 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA) { collection = collectionA; cMapName = cMapNameA; - isIdent = gFalse; + isIdent = false; wMode = 0; vector = (CMapVectorEntry *)gmallocn(256, sizeof(CMapVectorEntry)); for (i = 0; i < 256; ++i) { - vector[i].isVector = gFalse; + vector[i].isVector = false; vector[i].cid = 0; } refCnt = 1; @@ -315,7 +315,7 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA) { CMap::CMap(GooString *collectionA, GooString *cMapNameA, int wModeA) { collection = collectionA; cMapName = cMapNameA; - isIdent = gTrue; + isIdent = true; wMode = wModeA; vector = nullptr; refCnt = 1; @@ -366,11 +366,11 @@ void CMap::copyVector(CMapVectorEntry *dest, CMapVectorEntry *src) { for (i = 0; i < 256; ++i) { if (src[i].isVector) { if (!dest[i].isVector) { - dest[i].isVector = gTrue; + dest[i].isVector = true; dest[i].vector = (CMapVectorEntry *)gmallocn(256, sizeof(CMapVectorEntry)); for (j = 0; j < 256; ++j) { - dest[i].vector[j].isVector = gFalse; + dest[i].vector[j].isVector = false; dest[i].vector[j].cid = 0; } } @@ -395,11 +395,11 @@ void CMap::addCIDs(Guint start, Guint end, Guint nBytes, CID firstCID) { for (i = nBytes - 1; i >= 1; --i) { byte = (start >> (8 * i)) & 0xff; if (!vec[byte].isVector) { - vec[byte].isVector = gTrue; + vec[byte].isVector = true; vec[byte].vector = (CMapVectorEntry *)gmallocn(256, sizeof(CMapVectorEntry)); for (j = 0; j < 256; ++j) { - vec[byte].vector[j].isVector = gFalse; + vec[byte].vector[j].isVector = false; vec[byte].vector[j].cid = 0; } } @@ -447,7 +447,7 @@ void CMap::decRefCnt() { } } -GBool CMap::match(const GooString *collectionA, const GooString *cMapNameA) { +bool CMap::match(const GooString *collectionA, const GooString *cMapNameA) { return !collection->cmp(collectionA) && !cMapName->cmp(cMapNameA); } diff --git a/poppler/CMap.h b/poppler/CMap.h index 17544d4c..4cb7a537 100644 --- a/poppler/CMap.h +++ b/poppler/CMap.h @@ -79,7 +79,7 @@ public: // Return true if this CMap matches the specified <collectionA>, and // <cMapNameA>. - GBool match(const GooString *collectionA, const GooString *cMapNameA); + bool match(const GooString *collectionA, const GooString *cMapNameA); // Return the CID corresponding to the character code starting at // <s>, which contains <len> bytes. Sets *<c> to the char code, and @@ -106,7 +106,7 @@ private: GooString *collection; GooString *cMapName; - GBool isIdent; // true if this CMap is an identity mapping, + bool isIdent; // true if this CMap is an identity mapping, // or is based on one (via usecmap) int wMode; // writing mode (0=horizontal, 1=vertical) CMapVectorEntry *vector; // vector for first byte (NULL for diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index e9cc924e..4114fa7b 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -65,8 +65,8 @@ CairoFont::CairoFont(Ref refA, cairo_font_face_t *cairo_font_faceA, int *codeToGIDA, Guint codeToGIDLenA, - GBool substituteA, - GBool printingA) : ref(refA), + bool substituteA, + bool printingA) : ref(refA), cairo_font_face(cairo_font_faceA), codeToGID(codeToGIDA), codeToGIDLen(codeToGIDLenA), @@ -78,8 +78,8 @@ CairoFont::~CairoFont() { gfree(codeToGID); } -GBool -CairoFont::matches(Ref &other, GBool printingA) { +bool +CairoFont::matches(Ref &other, bool printingA) { return (other.num == ref.num && other.gen == ref.gen); } @@ -161,7 +161,7 @@ _ft_done_face_uncached (void *closure) FT_Done_Face (face); } -static GBool +static bool _ft_new_face_uncached (FT_Library lib, const char *filename, char *font_data, @@ -174,10 +174,10 @@ _ft_new_face_uncached (FT_Library lib, if (font_data == nullptr) { if (FT_New_Face (lib, filename, 0, &face)) - return gFalse; + return false; } else { if (FT_New_Memory_Face (lib, (unsigned char *)font_data, font_data_len, 0, &face)) - return gFalse; + return false; } font_face = cairo_ft_font_face_create_for_ft_face (face, @@ -190,12 +190,12 @@ _ft_new_face_uncached (FT_Library lib, { _ft_done_face_uncached (face); cairo_font_face_destroy (font_face); - return gFalse; + return false; } *face_out = face; *font_face_out = font_face; - return gTrue; + return true; } #ifdef CAN_CHECK_OPEN_FACES @@ -224,15 +224,15 @@ _djb_hash (const unsigned char *bytes, size_t len) return hash; } -static GBool +static bool _ft_face_data_equal (struct _ft_face_data *a, struct _ft_face_data *b) { if (a->lib != b->lib) - return gFalse; + return false; if (a->size != b->size) - return gFalse; + return false; if (a->hash != b->hash) - return gFalse; + return false; return memcmp (a->bytes, b->bytes, a->size) == 0; } @@ -264,7 +264,7 @@ _ft_done_face (void *closure) gfree (data); } -static GBool +static bool _ft_new_face (FT_Library lib, const char *filename, char *font_data, @@ -320,7 +320,7 @@ _ft_new_face (FT_Library lib, } *face_out = l->face; *font_face_out = cairo_font_face_reference (l->font_face); - return gTrue; + return true; } } @@ -338,7 +338,7 @@ _ft_new_face (FT_Library lib, close (tmpl.fd); } - return gFalse; + return false; } l = (struct _ft_face_data *) gmallocn (1, sizeof (struct _ft_face_data)); @@ -359,12 +359,12 @@ _ft_new_face (FT_Library lib, { cairo_font_face_destroy (l->font_face); _ft_done_face (l); - return gFalse; + return false; } *face_out = l->face; *font_face_out = l->font_face; - return gTrue; + return true; } #else #define _ft_new_face _ft_new_face_uncached @@ -374,17 +374,17 @@ CairoFreeTypeFont::CairoFreeTypeFont(Ref refA, cairo_font_face_t *cairo_font_faceA, int *codeToGIDA, Guint codeToGIDLenA, - GBool substituteA) : CairoFont(refA, + bool substituteA) : CairoFont(refA, cairo_font_faceA, codeToGIDA, codeToGIDLenA, substituteA, - gTrue) { } + true) { } CairoFreeTypeFont::~CairoFreeTypeFont() { } CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, - FT_Library lib, GBool useCIDs) { + FT_Library lib, bool useCIDs) { GooString *fileName; const char *fileNameC; char *font_data; @@ -410,7 +410,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, fileName = nullptr; fileNameC = nullptr; - GBool substitute = gFalse; + bool substitute = false; ref = *gfxFont->getID(); fontType = gfxFont->getType(); @@ -432,7 +432,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, } else { // gfxFontLocExternal fileName = fontLoc->path; fontType = fontLoc->fontType; - substitute = gTrue; + substitute = true; } if (fileName != nullptr) { @@ -607,7 +607,7 @@ typedef struct _type3_font_info { GfxFont *font; PDFDoc *doc; CairoFontEngine *fontEngine; - GBool printing; + bool printing; XRef *xref; } type3_font_info_t; @@ -696,7 +696,7 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font, gfx = new Gfx(info->doc, output_dev, resDict, &box, nullptr); output_dev->startDoc(info->doc, info->fontEngine); output_dev->startPage (1, gfx->getState(), gfx->getXRef()); - output_dev->setInType3Char(gTrue); + output_dev->setInType3Char(true); charProc = charProcs->getVal(glyph); gfx->display(&charProc); @@ -724,7 +724,7 @@ _render_type3_glyph (cairo_scaled_font_t *scaled_font, CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, CairoFontEngine *fontEngine, - GBool printing, XRef *xref) { + bool printing, XRef *xref) { type3_font_info_t *info; cairo_font_face_t *font_face; Ref ref; @@ -771,18 +771,18 @@ CairoType3Font::CairoType3Font(Ref refA, cairo_font_face_t *cairo_font_faceA, int *codeToGIDA, Guint codeToGIDLenA, - GBool printingA, XRef *xref) : CairoFont(refA, + bool printingA, XRef *xref) : CairoFont(refA, cairo_font_faceA, codeToGIDA, codeToGIDLenA, - gFalse, + false, printingA) { } CairoType3Font::~CairoType3Font() { } -GBool -CairoType3Font::matches(Ref &other, GBool printingA) { +bool +CairoType3Font::matches(Ref &other, bool printingA) { return (other.num == ref.num && other.gen == ref.gen && printing == printingA); } @@ -818,7 +818,7 @@ CairoFontEngine::~CairoFontEngine() { } CairoFont * -CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xref) { +CairoFontEngine::getFont(GfxFont *gfxFont, PDFDoc *doc, bool printing, XRef *xref) { int i, j; Ref ref; CairoFont *font; diff --git a/poppler/CairoFontEngine.h b/poppler/CairoFontEngine.h index 75049804..b58a2b86 100644 --- a/poppler/CairoFontEngine.h +++ b/poppler/CairoFontEngine.h @@ -47,18 +47,18 @@ public: cairo_font_face_t *face, int *codeToGID, Guint codeToGIDLen, - GBool substitute, - GBool printing); + bool substitute, + bool printing); virtual ~CairoFont(); CairoFont(const CairoFont &) = delete; CairoFont& operator=(const CairoFont &other) = delete; - virtual GBool matches(Ref &other, GBool printing); + virtual bool matches(Ref &other, bool printing); cairo_font_face_t *getFontFace(void); unsigned long getGlyph(CharCode code, Unicode *u, int uLen); double getSubstitutionCorrection(GfxFont *gfxFont); - GBool isSubstitute() { return substitute; } + bool isSubstitute() { return substitute; } protected: Ref ref; cairo_font_face_t *cairo_font_face; @@ -66,20 +66,20 @@ protected: int *codeToGID; Guint codeToGIDLen; - GBool substitute; - GBool printing; + bool substitute; + bool printing; }; //------------------------------------------------------------------------ class CairoFreeTypeFont : public CairoFont { public: - static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, GBool useCIDs); + static CairoFreeTypeFont *create(GfxFont *gfxFont, XRef *xref, FT_Library lib, bool useCIDs); ~CairoFreeTypeFont(); private: CairoFreeTypeFont(Ref ref, cairo_font_face_t *cairo_font_face, - int *codeToGID, Guint codeToGIDLen, GBool substitute); + int *codeToGID, Guint codeToGIDLen, bool substitute); }; //------------------------------------------------------------------------ @@ -88,16 +88,16 @@ class CairoType3Font : public CairoFont { public: static CairoType3Font *create(GfxFont *gfxFont, PDFDoc *doc, CairoFontEngine *fontEngine, - GBool printing, XRef *xref); + bool printing, XRef *xref); ~CairoType3Font(); - GBool matches(Ref &other, GBool printing) override; + bool matches(Ref &other, bool printing) override; private: CairoType3Font(Ref ref, cairo_font_face_t *cairo_font_face, int *codeToGID, Guint codeToGIDLen, - GBool printing, XRef *xref); + bool printing, XRef *xref); }; //------------------------------------------------------------------------ @@ -117,12 +117,12 @@ public: CairoFontEngine(const CairoFontEngine &) = delete; CairoFontEngine& operator=(const CairoFontEngine &other) = delete; - CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, GBool printing, XRef *xref); + CairoFont *getFont(GfxFont *gfxFont, PDFDoc *doc, bool printing, XRef *xref); private: CairoFont *fontCache[cairoFontCacheSize]; FT_Library lib; - GBool useCIDs; + bool useCIDs; mutable std::recursive_mutex mutex; }; diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index a58dab1d..b8a3e491 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -117,18 +117,18 @@ void CairoImage::setImage (cairo_surface_t *image) { // FT_Library instance; to avoid leaks, just use a single global instance // initialized the first time it is needed. FT_Library CairoOutputDev::ft_lib; -GBool CairoOutputDev::ft_lib_initialized = gFalse; +bool CairoOutputDev::ft_lib_initialized = false; CairoOutputDev::CairoOutputDev() { doc = nullptr; if (!ft_lib_initialized) { FT_Init_FreeType(&ft_lib); - ft_lib_initialized = gTrue; + ft_lib_initialized = true; } fontEngine = nullptr; - fontEngine_owner = gFalse; + fontEngine_owner = false; glyphs = nullptr; fill_pattern = nullptr; fill_color.r = fill_color.g = fill_color.b = 0; @@ -141,16 +141,16 @@ CairoOutputDev::CairoOutputDev() { cairo = nullptr; currentFont = nullptr; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - prescaleImages = gFalse; + prescaleImages = false; #else - prescaleImages = gTrue; + prescaleImages = true; #endif - printing = gTrue; - use_show_text_glyphs = gFalse; - inUncoloredPattern = gFalse; - inType3Char = gFalse; - t3_glyph_has_bbox = gFalse; - text_matrix_valid = gTrue; + printing = true; + use_show_text_glyphs = false; + inUncoloredPattern = false; + inType3Char = false; + t3_glyph_has_bbox = false; + text_matrix_valid = true; antialias = CAIRO_ANTIALIAS_DEFAULT; groupColorSpaceStack = nullptr; @@ -166,9 +166,9 @@ CairoOutputDev::CairoOutputDev() { // the SA parameter supposedly defaults to false, but Acrobat // apparently hardwires it to true - stroke_adjust = gTrue; - align_stroke_coords = gFalse; - adjusted_stroke_width = gFalse; + stroke_adjust = true; + align_stroke_coords = false; + adjusted_stroke_width = false; xref = nullptr; } @@ -261,7 +261,7 @@ void CairoOutputDev::startDoc(PDFDoc *docA, delete fontEngine; } fontEngine = new CairoFontEngine(ft_lib); - fontEngine_owner = gTrue; + fontEngine_owner = true; } xref = doc->getXRef(); } @@ -286,7 +286,7 @@ void CairoOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { void CairoOutputDev::endPage() { if (text) { text->endPage(); - text->coalesce(gTrue, 0, gFalse); + text->coalesce(true, 0, false); } } @@ -312,7 +312,7 @@ void CairoOutputDev::restoreState(GfxState *state) { if (cairo_shape) cairo_restore (cairo_shape); - text_matrix_valid = gTrue; + text_matrix_valid = true; /* These aren't restored by cairo_restore() since we keep them in * the output device. */ @@ -353,7 +353,7 @@ void CairoOutputDev::updateAll(GfxState *state) { updateFillOpacity(state); updateStrokeOpacity(state); updateBlendMode(state); - needFontUpdate = gTrue; + needFontUpdate = true; if (text) text->updateFont(state); } @@ -464,7 +464,7 @@ void CairoOutputDev::updateMiterLimit(GfxState *state) { void CairoOutputDev::updateLineWidth(GfxState *state) { LOG(printf ("line width: %f\n", state->getLineWidth())); - adjusted_stroke_width = gFalse; + adjusted_stroke_width = false; double width = state->getLineWidth(); if (stroke_adjust && !printing) { double x, y; @@ -477,7 +477,7 @@ void CairoOutputDev::updateLineWidth(GfxState *state) { x = y = 1.0; cairo_device_to_user_distance(cairo, &x, &y); width = MIN(fabs(x),fabs(y)); - adjusted_stroke_width = gTrue; + adjusted_stroke_width = true; } } else if (width == 0.0) { /* Cairo does not support 0 line width == 1 device pixel. Find out @@ -656,7 +656,7 @@ void CairoOutputDev::updateFont(GfxState *state) { LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->getCString())); - needFontUpdate = gFalse; + needFontUpdate = false; //FIXME: use cairo font engine? if (text) @@ -697,12 +697,12 @@ void CairoOutputDev::updateFont(GfxState *state) { invert_matrix = matrix; if (cairo_matrix_invert(&invert_matrix)) { error(errSyntaxWarning, -1, "font matrix not invertible"); - text_matrix_valid = gFalse; + text_matrix_valid = false; return; } cairo_set_font_matrix (cairo, &matrix); - text_matrix_valid = gTrue; + text_matrix_valid = true; } /* Tolerance in pixels for checking if strokes are horizontal or vertical @@ -714,7 +714,7 @@ void CairoOutputDev::updateFont(GfxState *state) { void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y) { double x1, y1, x2, y2; - GBool align = gFalse; + bool align = false; x1 = subpath->getX(i); y1 = subpath->getY(i); @@ -726,7 +726,7 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do y2 = subpath->getY(i - 1); cairo_user_to_device (cairo, &x2, &y2); if (fabs(x2 - x1) < STROKE_COORD_TOLERANCE || fabs(y2 - y1) < STROKE_COORD_TOLERANCE) - align = gTrue; + align = true; } // Does the current coord and next coord form a horiz or vert line? @@ -735,7 +735,7 @@ void CairoOutputDev::alignStrokeCoords(GfxSubpath *subpath, int i, double *x, do y2 = subpath->getY(i + 1); cairo_user_to_device (cairo, &x2, &y2); if (fabs(x2 - x1) < STROKE_COORD_TOLERANCE || fabs(y2 - y1) < STROKE_COORD_TOLERANCE) - align = gTrue; + align = true; } *x = subpath->getX(i); @@ -809,9 +809,9 @@ void CairoOutputDev::stroke(GfxState *state) { } if (adjusted_stroke_width) - align_stroke_coords = gTrue; + align_stroke_coords = true; doPath (cairo, state, state->getPath()); - align_stroke_coords = gFalse; + align_stroke_coords = false; cairo_set_source (cairo, stroke_pattern); LOG(printf ("stroke\n")); if (strokePathClip) { @@ -887,7 +887,7 @@ void CairoOutputDev::eoFill(GfxState *state) { } -GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, +bool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, const double *pmat, int paintType, int /*tilingType*/, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -905,14 +905,14 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat double scaleX, scaleY; int surface_width, surface_height; StrokePathClip *strokePathTmp; - GBool adjusted_stroke_width_tmp; + bool adjusted_stroke_width_tmp; cairo_pattern_t *maskTmp; width = bbox[2] - bbox[0]; height = bbox[3] - bbox[1]; if (xStep != width || yStep != height) - return gFalse; + return false; /* TODO: implement the other cases here too */ // Find the width and height of the transformed pattern @@ -934,7 +934,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat CAIRO_CONTENT_COLOR_ALPHA, surface_width, surface_height); if (cairo_surface_status (surface)) - return gFalse; + return false; old_cairo = cairo; cairo = cairo_create (surface); @@ -953,10 +953,10 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat mask = nullptr; gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA); if (paintType == 2) - inUncoloredPattern = gTrue; + inUncoloredPattern = true; gfx->display(str); if (paintType == 2) - inUncoloredPattern = gFalse; + inUncoloredPattern = false; delete gfx; strokePathClip = strokePathTmp; adjusted_stroke_width = adjusted_stroke_width_tmp; @@ -966,7 +966,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat cairo_destroy (cairo); cairo = old_cairo; if (cairo_pattern_status (pattern)) - return gFalse; + return false; state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin); @@ -986,11 +986,11 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat cairo_pattern_destroy (pattern); - return gTrue; + return true; } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) -GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) +bool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { // Function shaded fills are subdivided to rectangles that are the // following size in device space. Note when printing this size is @@ -1014,7 +1014,7 @@ GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh mat.y0 = matrix[5]; if (cairo_matrix_invert(&mat)) { error(errSyntaxWarning, -1, "matrix not invertible\n"); - return gFalse; + return false; } // get cell size in pattern space @@ -1085,11 +1085,11 @@ GBool CairoOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *sh fill(state); state->clearPath(); - return gTrue; + return true; } #endif /* CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) */ -GBool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { +bool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { double x0, y0, x1, y1; double dx, dy; @@ -1109,15 +1109,15 @@ GBool CairoOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, // TODO: use the actual stops in the shading in the case // of linear interpolation (Type 2 Exponential functions with N=1) - return gFalse; + return false; } -GBool CairoOutputDev::axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) +bool CairoOutputDev::axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); } -GBool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) { +bool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) { double x0, y0, r0, x1, y1, r1; double dx, dy, dr; cairo_matrix_t matrix; @@ -1153,16 +1153,16 @@ GBool CairoOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shadin LOG (printf ("radial-sh\n")); - return gFalse; + return false; } -GBool CairoOutputDev::radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) +bool CairoOutputDev::radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) { return (shading->getExtend0() == shading->getExtend1()); } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) -GBool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) +bool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) { double x0, y0, x1, y1, x2, y2; GfxColor color[3]; @@ -1217,10 +1217,10 @@ GBool CairoOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTrian fill(state); state->clearPath(); - return gTrue; + return true; } -GBool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) +bool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) { int i, j, k; @@ -1307,7 +1307,7 @@ GBool CairoOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading * fill(state); state->clearPath(); - return gTrue; + return true; } #endif /* CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) */ @@ -1509,7 +1509,7 @@ finish: } -GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, +bool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { @@ -1535,7 +1535,7 @@ GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y, cairo_pattern_destroy(stroke_pattern); cairo_pattern_reference(fill_pattern); stroke_pattern = fill_pattern; - return gFalse; + return false; } void CairoOutputDev::endType3Char(GfxState *state) { @@ -1558,7 +1558,7 @@ void CairoOutputDev::type3D1(GfxState *state, double wx, double wy, t3_glyph_bbox[1] = lly; t3_glyph_bbox[2] = urx; t3_glyph_bbox[3] = ury; - t3_glyph_has_bbox = gTrue; + t3_glyph_has_bbox = true; } void CairoOutputDev::beginTextObject(GfxState *state) { @@ -1620,8 +1620,8 @@ cairo_surface_t *cairo_surface_create_similar_clip (cairo_t *cairo, cairo_conten void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * blendingColorSpace, - GBool /*isolated*/, GBool knockout, - GBool forSoftMask) { + bool /*isolated*/, bool knockout, + bool forSoftMask) { /* push color space */ ColorSpaceStack* css = new ColorSpaceStack; css->cs = blendingColorSpace; @@ -1746,7 +1746,7 @@ static int luminocity(uint32_t x) /* XXX: do we need to deal with shape here? */ -void CairoOutputDev::setSoftMask(GfxState * state, const double * bbox, GBool alpha, +void CairoOutputDev::setSoftMask(GfxState * state, const double * bbox, bool alpha, Function * transferFunc, GfxColor * backdropColor) { cairo_pattern_destroy(mask); @@ -1956,7 +1956,7 @@ void CairoOutputDev::getScaledSize(const cairo_matrix_t *matrix, cairo_filter_t CairoOutputDev::getFilterForSurface(cairo_surface_t *image, - GBool interpolate) + bool interpolate) { if (interpolate) return CAIRO_FILTER_GOOD; @@ -1983,8 +1983,8 @@ CairoOutputDev::getFilterForSurface(cairo_surface_t *image, } void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); @@ -2037,8 +2037,8 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, } void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) { + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) { /* FIXME: Doesn't the image mask support any colorspace? */ cairo_set_source (cairo, fill_pattern); @@ -2078,9 +2078,9 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre //XXX: it is possible that we should only do sub pixel positioning if // we are rendering fonts */ if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) { - drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg); + drawImageMaskPrescaled(state, ref, str, width, height, invert, false, inlineImg); } else { - drawImageMaskRegular(state, ref, str, width, height, invert, gFalse, inlineImg); + drawImageMaskRegular(state, ref, str, width, height, invert, false, inlineImg); } if (state->getFillColorSpace()->getMode() == csPattern) { @@ -2097,7 +2097,7 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre saveState(state); double bbox[4] = {0,0,1,1}; // dummy beginTransparencyGroup(state, bbox, state->getFillColorSpace(), - gTrue, gFalse, gFalse); + true, false, false); } void CairoOutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) { @@ -2110,8 +2110,8 @@ void CairoOutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMat } void CairoOutputDev::drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { unsigned char *buffer; unsigned char *dest; cairo_surface_t *image; @@ -2219,8 +2219,8 @@ cleanup: void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { unsigned char *buffer; cairo_surface_t *image; cairo_pattern_t *pattern; @@ -2515,10 +2515,10 @@ void CairoOutputDev::drawImageMaskPrescaled(GfxState *state, Object *ref, Stream void CairoOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert, - GBool maskInterpolate) + int maskHeight, bool maskInvert, + bool maskInterpolate) { ImageStream *maskImgStr, *imgStr; ptrdiff_t row_stride; @@ -2672,11 +2672,11 @@ cleanup: void CairoOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) + bool maskInterpolate) { ImageStream *maskImgStr, *imgStr; ptrdiff_t row_stride; @@ -2833,7 +2833,7 @@ cleanup: delete imgStr; } -GBool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) +bool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) { int len, i; char *strBuffer; @@ -2843,7 +2843,7 @@ GBool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) str->reset(); while (str->getChar() != EOF) len++; if (len == 0) - return gFalse; + return false; strBuffer = (char *)gmalloc (len); @@ -2855,16 +2855,16 @@ GBool CairoOutputDev::getStreamData (Stream *str, char **buffer, int *length) *buffer = strBuffer; *length = len; - return gTrue; + return true; } -static GBool colorMapHasIdentityDecodeMap(GfxImageColorMap *colorMap) +static bool colorMapHasIdentityDecodeMap(GfxImageColorMap *colorMap) { for (int i = 0; i < colorMap->getNumPixelComps(); i++) { if (colorMap->getDecodeLow(i) != 0.0 || colorMap->getDecodeHigh(i) != 1.0) - return gFalse; + return false; } - return gTrue; + return true; } #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) @@ -2897,7 +2897,7 @@ static cairo_status_t setMimeIdFromRef(cairo_surface_t *surface, #endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) -GBool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, +bool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, cairo_surface_t *image) { JBIG2Stream *jb2Str = static_cast<JBIG2Stream *>(str); @@ -2907,14 +2907,14 @@ GBool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, // nothing to do for JBIG2 stream without Globals if (!globalsStr->isStream()) - return gTrue; + return true; if (setMimeIdFromRef(image, CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID, nullptr, jb2Str->getGlobalsStreamRef())) - return gFalse; + return false; if (!getStreamData(globalsStr->getStream(), &globalsBuffer, &globalsLength)) - return gFalse; + return false; if (cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_JBIG2_GLOBAL, (const unsigned char*)globalsBuffer, @@ -2922,15 +2922,15 @@ GBool CairoOutputDev::setMimeDataForJBIG2Globals(Stream *str, gfree, (void*)globalsBuffer)) { gfree (globalsBuffer); - return gFalse; + return false; } - return gTrue; + return true; } #endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) -GBool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, +bool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height) { CCITTFaxStream *ccittStr = static_cast<CCITTFaxStream *>(str); @@ -2952,10 +2952,10 @@ GBool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, gfree, (void*)p)) { gfree (p); - return gFalse; + return false; } - return gTrue; + return true; } #endif @@ -3064,13 +3064,13 @@ private: GfxImageColorMap *colorMap; int *maskColors; int current_row; - GBool imageError; + bool imageError; public: cairo_surface_t *getSourceImage(Stream *str, int widthA, int height, int scaledWidth, int scaledHeight, - GBool printing, + bool printing, GfxImageColorMap *colorMapA, int *maskColorsA) { cairo_surface_t *image = nullptr; @@ -3081,7 +3081,7 @@ public: maskColors = maskColorsA; width = widthA; current_row = -1; - imageError = gFalse; + imageError = false; /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, @@ -3196,7 +3196,7 @@ public: memset(row_data, 0, width*4); if (!imageError) { error(errInternal, -1, "Bad image stream"); - imageError = gTrue; + imageError = true; } } else if (lookup) { Guchar *p = pix; @@ -3239,8 +3239,8 @@ public: void CairoOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int widthA, int heightA, GfxImageColorMap *colorMap, - GBool interpolate, - int *maskColors, GBool inlineImg) + bool interpolate, + int *maskColors, bool inlineImg) { cairo_surface_t *image; cairo_pattern_t *pattern, *maskPattern; @@ -3397,8 +3397,8 @@ void CairoImageOutputDev::getBBox(GfxState *state, int width, int height, } void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) + int width, int height, bool invert, + bool interpolate, bool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -3427,8 +3427,8 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st } void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) { cairo_t *cr; cairo_surface_t *surface; @@ -3447,7 +3447,7 @@ void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, cairo_translate (cr, 0, height); cairo_scale (cr, width, -height); - CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg, gFalse); + CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg, false); if (state->getFillColorSpace()->getMode() == csPattern) { cairo_mask (cairo, mask); } @@ -3461,7 +3461,7 @@ void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) + bool interpolate, int *maskColors, bool inlineImg) { cairo_t *cr; cairo_surface_t *surface; @@ -3492,11 +3492,11 @@ void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) + bool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; @@ -3528,10 +3528,10 @@ void CairoImageOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stre void CairoImageOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) + bool maskInvert, bool maskInterpolate) { cairo_t *cr; cairo_surface_t *surface; diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index a484e3b6..00b0d7d1 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -98,35 +98,35 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - GBool useShadedFills(int type) override { return type <= 7; } + bool useShadedFills(int type) override { return type <= 7; } #else - GBool useShadedFills(int type) override { return type > 1 && type < 4; } + bool useShadedFills(int type) override { return type > 1 && type < 4; } #endif // Does this device use FillColorStop()? - GBool useFillColorStop() override { return gTrue; } + bool useFillColorStop() override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need to clip pages to the crop box even when the // box is the crop box? - GBool needClipToCropBox() override { return gTrue; } + bool needClipToCropBox() override { return true; } //----- initialization and control @@ -166,21 +166,21 @@ public: void fill(GfxState *state) override; void eoFill(GfxState *state) override; void clipToStrokePath(GfxState *state) override; - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) override; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; + bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; #endif - GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; - GBool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override; - GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override; - GBool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override; + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; + bool axialShadedSupportExtend(GfxState *state, GfxAxialShading *shading) override; + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double sMin, double sMax) override; + bool radialShadedSupportExtend(GfxState *state, GfxRadialShading *shading) override; #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0) - GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; - GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; + bool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; + bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; #endif //----- path clipping @@ -197,7 +197,7 @@ public: void beginActualText(GfxState *state, const GooString *text) override; void endActualText(GfxState *state) override; - GBool beginType3Char(GfxState *state, double x, double y, + bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override; void endType3Char(GfxState *state) override; @@ -206,49 +206,49 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg) override; + int width, int height, bool invert, bool interpolate, + bool inlineImg) override; void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) override; + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) override; void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override; void drawImageMaskPrescaled(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg); + int width, int height, bool invert, bool interpolate, + bool inlineImg); void drawImageMaskRegular(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg); + int width, int height, bool invert, bool interpolate, + bool inlineImg); void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; //----- transparency groups and soft masks void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) override; + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) override; void endTransparencyGroup(GfxState * /*state*/) override; void popTransparencyGroup(); void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override; - void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/, + void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override; void clearSoftMask(GfxState * /*state*/) override; @@ -262,16 +262,16 @@ public: // Called to indicate that a new PDF document has been loaded. void startDoc(PDFDoc *docA, CairoFontEngine *fontEngine = nullptr); - GBool isReverseVideo() { return gFalse; } + bool isReverseVideo() { return false; } void setCairo (cairo_t *cr); void setTextPage (TextPage *text); - void setPrinting (GBool printingA) { printing = printingA; needFontUpdate = gTrue; } + void setPrinting (bool printingA) { printing = printingA; needFontUpdate = true; } void setAntialias(cairo_antialias_t antialias); - void setInType3Char(GBool inType3CharA) { inType3Char = inType3CharA; } + void setInType3Char(bool inType3CharA) { inType3Char = inType3CharA; } void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; } - GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; } + bool hasType3GlyphBBox () { return t3_glyph_has_bbox; } double *getType3GlyphBBox () { return t3_glyph_bbox; } protected: @@ -281,17 +281,17 @@ protected: int orig_width, int orig_height, int *scaledWidth, int *scaledHeight); cairo_filter_t getFilterForSurface(cairo_surface_t *image, - GBool interpolate); - GBool getStreamData (Stream *str, char **buffer, int *length); + bool interpolate); + bool getStreamData (Stream *str, char **buffer, int *length); void setMimeData(GfxState *state, Stream *str, Object *ref, GfxImageColorMap *colorMap, cairo_surface_t *image, int height); void fillToStrokePathClip(GfxState *state); void alignStrokeCoords(GfxSubpath *subpath, int i, double *x, double *y); #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0) - GBool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); + bool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image); #endif #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 15, 10) - GBool setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height); + bool setMimeDataForCCITTParams(Stream *str, cairo_surface_t *image, int height); #endif static void setContextAntialias(cairo_t *cr, cairo_antialias_t antialias); @@ -299,9 +299,9 @@ protected: cairo_pattern_t *fill_pattern, *stroke_pattern; double fill_opacity; double stroke_opacity; - GBool stroke_adjust; - GBool adjusted_stroke_width; - GBool align_stroke_coords; + bool stroke_adjust; + bool adjusted_stroke_width; + bool align_stroke_coords; CairoFont *currentFont; XRef *xref; @@ -321,17 +321,17 @@ protected: PDFDoc *doc; // the current document static FT_Library ft_lib; - static GBool ft_lib_initialized; + static bool ft_lib_initialized; CairoFontEngine *fontEngine; - GBool fontEngine_owner; + bool fontEngine_owner; cairo_t *cairo; cairo_matrix_t orig_matrix; - GBool needFontUpdate; // set when the font needs to be updated - GBool printing; - GBool use_show_text_glyphs; - GBool text_matrix_valid; + bool needFontUpdate; // set when the font needs to be updated + bool printing; + bool use_show_text_glyphs; + bool text_matrix_valid; cairo_glyph_t *glyphs; int glyphCount; cairo_text_cluster_t *clusters; @@ -340,13 +340,13 @@ protected: int utf8Count; int utf8Max; cairo_path_t *textClipPath; - GBool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) - GBool inType3Char; // inside a Type 3 CharProc + bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) + bool inType3Char; // inside a Type 3 CharProc double t3_glyph_wx, t3_glyph_wy; - GBool t3_glyph_has_bbox; + bool t3_glyph_has_bbox; double t3_glyph_bbox[4]; cairo_antialias_t antialias; - GBool prescaleImages; + bool prescaleImages; TextPage *text; // text for the current page ActualText *actualText; @@ -358,7 +358,7 @@ protected: cairo_t *cairo_shape; int knockoutCount; struct ColorSpaceStack { - GBool knockout; + bool knockout; GfxColorSpace *cs; cairo_matrix_t group_matrix; struct ColorSpaceStack *next; @@ -390,34 +390,34 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gFalse; } + bool useDrawChar() override { return false; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) - GBool useShadedFills(int type) override { return type <= 7; } + bool useShadedFills(int type) override { return type <= 7; } #else - GBool useShadedFills(int type) override { return type < 4; } + bool useShadedFills(int type) override { return type < 4; } #endif // Does this device use FillColorStop()? - GBool useFillColorStop() override { return gFalse; } + bool useFillColorStop() override { return false; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need non-text content? - GBool needNonText() override { return gTrue; } + bool needNonText() override { return true; } //----- save/restore graphics state void saveState(GfxState *state) override { } @@ -448,17 +448,17 @@ public: void fill(GfxState *state) override { } void eoFill(GfxState *state) override { } void clipToStrokePath(GfxState *state) override { } - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, - double xStep, double yStep) override { return gTrue; } - GBool axialShadedFill(GfxState *state, + double xStep, double yStep) override { return true; } + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, - double tMin, double tMax) override { return gTrue; } - GBool radialShadedFill(GfxState *state, + double tMin, double tMax) override { return true; } + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, - double sMin, double sMax) override { return gTrue; } + double sMin, double sMax) override { return true; } //----- path clipping void clip(GfxState *state) override { } @@ -466,46 +466,46 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) override; + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) override; void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override {} //----- transparency groups and soft masks void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) override {} + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) override {} void endTransparencyGroup(GfxState * /*state*/) override {} void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) override {} - void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/, + void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) override {} void clearSoftMask(GfxState * /*state*/) override {} //----- Image list // By default images are not rendred - void setImageDrawDecideCbk(GBool (*cbk)(int img_id, void *data), + void setImageDrawDecideCbk(bool (*cbk)(int img_id, void *data), void *data) { imgDrawCbk = cbk; imgDrawCbkData = data; } // Iterate through list of images. int getNumImages() const { return numImages; } @@ -519,7 +519,7 @@ private: CairoImage **images; int numImages; int size; - GBool (*imgDrawCbk)(int img_id, void *data); + bool (*imgDrawCbk)(int img_id, void *data); void *imgDrawCbkData; }; diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc index 59a5c190..d59eefd8 100644 --- a/poppler/CairoRescaleBox.cc +++ b/poppler/CairoRescaleBox.cc @@ -263,7 +263,7 @@ static int compute_coverage (int coverage[], int src_length, int dest_length) } -GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, +bool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, signed scaled_width, signed scaled_height, unsigned short int start_column, unsigned short int start_row, unsigned short int width, unsigned short int height, @@ -275,7 +275,7 @@ GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, int *x_coverage = nullptr; int *y_coverage = nullptr; uint32_t *temp_buf = nullptr; - GBool retval = gFalse; + bool retval = false; unsigned int *dest; int dst_stride; @@ -365,7 +365,7 @@ GBool CairoRescaleBox::downScaleImage(unsigned orig_width, unsigned orig_height, } // assert (src_y<=orig_height); - retval = gTrue; + retval = true; cleanup: free (x_coverage); diff --git a/poppler/CairoRescaleBox.h b/poppler/CairoRescaleBox.h index ca307cb7..3c94724a 100644 --- a/poppler/CairoRescaleBox.h +++ b/poppler/CairoRescaleBox.h @@ -52,7 +52,7 @@ public: CairoRescaleBox(const CairoRescaleBox &) = delete; CairoRescaleBox& operator=(const CairoRescaleBox &) = delete; - virtual GBool downScaleImage(unsigned orig_width, unsigned orig_height, + virtual bool downScaleImage(unsigned orig_width, unsigned orig_height, signed scaled_width, signed scaled_height, unsigned short int start_column, unsigned short int start_row, unsigned short int width, unsigned short int height, diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 78f419e2..6048cc42 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -69,7 +69,7 @@ #define catalogLocker() std::unique_lock<std::recursive_mutex> locker(mutex) Catalog::Catalog(PDFDoc *docA) { - ok = gTrue; + ok = true; doc = docA; xref = doc->getXRef(); numPages = -1; @@ -94,7 +94,7 @@ Catalog::Catalog(PDFDoc *docA) { Object catDict = xref->getCatalog(); if (!catDict.isDict()) { error(errSyntaxError, -1, "Catalog object is wrong type ({0:s})", catDict.getTypeName()); - ok = gFalse; + ok = false; return; } // get the AcroForm dictionary @@ -182,8 +182,8 @@ Page *Catalog::getPage(int i) catalogLocker(); if (std::size_t(i) > pages.size()) { - GBool cached = cachePageTree(i); - if ( cached == gFalse) { + bool cached = cachePageTree(i); + if ( cached == false) { return nullptr; } } @@ -196,15 +196,15 @@ Ref *Catalog::getPageRef(int i) catalogLocker(); if (std::size_t(i) > pages.size()) { - GBool cached = cachePageTree(i); - if ( cached == gFalse) { + bool cached = cachePageTree(i); + if ( cached == false) { return nullptr; } } return &pages[i-1].second; } -GBool Catalog::cachePageTree(int page) +bool Catalog::cachePageTree(int page) { if (pagesList == nullptr) { @@ -220,11 +220,11 @@ GBool Catalog::cachePageTree(int page) pagesRef = pagesDictRef.getRef(); } else { error(errSyntaxError, -1, "Catalog dictionary does not contain a valid \"Pages\" entry"); - return gFalse; + return false; } } else { error(errSyntaxError, -1, "Could not find catalog dictionary"); - return gFalse; + return false; } Object obj = catDict.dictLookup("Pages"); @@ -232,7 +232,7 @@ GBool Catalog::cachePageTree(int page) // PDF file where the /Type entry is missing. if (!obj.isDict()) { error(errSyntaxError, -1, "Top-level pages object is wrong type ({0:s})", obj.getTypeName()); - return gFalse; + return false; } pages.clear(); @@ -248,16 +248,16 @@ GBool Catalog::cachePageTree(int page) while(1) { - if (std::size_t(page) <= pages.size()) return gTrue; + if (std::size_t(page) <= pages.size()) return true; - if (pagesList->empty()) return gFalse; + if (pagesList->empty()) return false; Object pagesDict = pagesList->back().copy(); Object kids = pagesDict.dictLookup("Kids"); if (!kids.isArray()) { error(errSyntaxError, -1, "Kids object (page {0:uld}) is wrong type ({1:s})", pages.size()+1, kids.getTypeName()); - return gFalse; + return false; } int kidsIdx = kidsIdxList->back(); @@ -275,13 +275,13 @@ GBool Catalog::cachePageTree(int page) if (!kidRef.isRef()) { error(errSyntaxError, -1, "Kid object (page {0:uld}) is not an indirect reference ({1:s})", pages.size()+1, kidRef.getTypeName()); - return gFalse; + return false; } - GBool loop = gFalse;; + bool loop = false;; for (size_t i = 0; i < pagesRefList->size(); i++) { if (((*pagesRefList)[i]).num == kidRef.getRefNum()) { - loop = gTrue; + loop = true; break; } } @@ -298,12 +298,12 @@ GBool Catalog::cachePageTree(int page) kidRef.getRef(), attrs, form); if (!p->isOk()) { error(errSyntaxError, -1, "Failed to create page (page {0:uld})", pages.size()+1); - return gFalse; + return false; } if (pages.size() >= std::size_t(numPages)) { error(errSyntaxError, -1, "Page count in top-level pages object is incorrect"); - return gFalse; + return false; } pages.emplace_back(std::move(p), kidRef.getRef()); @@ -324,7 +324,7 @@ GBool Catalog::cachePageTree(int page) } } - return gFalse; + return false; } int Catalog::findPage(int num, int gen) { @@ -672,32 +672,32 @@ GooString *NameTree::getName(int index) } } -GBool Catalog::labelToIndex(GooString *label, int *index) +bool Catalog::labelToIndex(GooString *label, int *index) { char *end; PageLabelInfo *pli = getPageLabelInfo(); if (pli != nullptr) { if (!pli->labelToIndex(label, index)) - return gFalse; + return false; } else { *index = strtol(label->getCString(), &end, 10) - 1; if (*end != '\0') - return gFalse; + return false; } if (*index < 0 || *index >= getNumPages()) - return gFalse; + return false; - return gTrue; + return true; } -GBool Catalog::indexToLabel(int index, GooString *label) +bool Catalog::indexToLabel(int index, GooString *label) { char buffer[32]; if (index < 0 || index >= getNumPages()) - return gFalse; + return false; PageLabelInfo *pli = getPageLabelInfo(); if (pli != nullptr) { @@ -705,7 +705,7 @@ GBool Catalog::indexToLabel(int index, GooString *label) } else { snprintf(buffer, sizeof (buffer), "%d", index + 1); label->append(buffer); - return gTrue; + return true; } } diff --git a/poppler/Catalog.h b/poppler/Catalog.h index 05d2146c..5c638dcf 100644 --- a/poppler/Catalog.h +++ b/poppler/Catalog.h @@ -116,7 +116,7 @@ public: Catalog& operator=(const Catalog &) = delete; // Is catalog valid? - GBool isOk() { return ok; } + bool isOk() { return ok; } // Get number of pages. int getNumPages(); @@ -188,8 +188,8 @@ public: GooString *getJS(int i); // Convert between page indices and page labels. - GBool labelToIndex(GooString *label, int *index); - GBool indexToLabel(int index, GooString *label); + bool labelToIndex(GooString *label, int *index); + bool indexToLabel(int index, GooString *label); Object *getOutline(); @@ -271,13 +271,13 @@ private: Object acroForm; // AcroForm dictionary Object viewerPreferences; // ViewerPreference dictionary OCGs *optContent; // Optional Content groups - GBool ok; // true if catalog is valid + bool ok; // true if catalog is valid PageLabelInfo *pageLabelInfo; // info about page labels PageMode pageMode; // page mode PageLayout pageLayout; // page layout Object additionalActions; // page additional actions - GBool cachePageTree(int page); // Cache first <page> pages. + bool cachePageTree(int page); // Cache first <page> pages. Object *findDestInTree(Object *tree, GooString *name, Object *obj); Object *getNames(); diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc index ecd620f8..237f8103 100644 --- a/poppler/CharCodeToUnicode.cc +++ b/poppler/CharCodeToUnicode.cc @@ -99,25 +99,25 @@ static int hexCharVals[256] = { // Parse a <len>-byte hex string <s> into *<val>. Returns false on // error. -static GBool parseHex(const char *s, int len, Guint *val) { +static bool parseHex(const char *s, int len, Guint *val) { int i, x; *val = 0; for (i = 0; i < len; ++i) { x = hexCharVals[s[i] & 0xff]; if (x < 0) { - return gFalse; + return false; } *val = (*val << 4) + x; } - return gTrue; + return true; } //------------------------------------------------------------------------ CharCodeToUnicode *CharCodeToUnicode::makeIdentityMapping() { CharCodeToUnicode *ctu = new CharCodeToUnicode(); - ctu->isIdentity = gTrue; + ctu->isIdentity = true; ctu->mapLen = 1; ctu->map = (Unicode *)gmallocn(ctu->mapLen, sizeof(Unicode)); return ctu; @@ -158,7 +158,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseCIDToUnicode(const char *fileName, } fclose(f); - ctu = new CharCodeToUnicode(collection->copy(), mapA, mapLenA, gTrue, + ctu = new CharCodeToUnicode(collection->copy(), mapA, mapLenA, true, nullptr, 0, 0); gfree(mapA); return ctu; @@ -252,7 +252,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseUnicodeToUnicode( } fclose(f); - ctu = new CharCodeToUnicode(fileName->copy(), mapA, len, gTrue, + ctu = new CharCodeToUnicode(fileName->copy(), mapA, len, true, sMapA, sMapLenA, sMapSizeA); gfree(mapA); gfree(uBuf); @@ -260,7 +260,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseUnicodeToUnicode( } CharCodeToUnicode *CharCodeToUnicode::make8BitToUnicode(Unicode *toUnicode) { - return new CharCodeToUnicode(nullptr, toUnicode, 256, gTrue, nullptr, 0, 0); + return new CharCodeToUnicode(nullptr, toUnicode, 256, true, nullptr, 0, 0); } CharCodeToUnicode *CharCodeToUnicode::parseCMap(GooString *buf, int nBits) { @@ -480,7 +480,7 @@ CharCodeToUnicode::CharCodeToUnicode() { sMap = nullptr; sMapLen = sMapSize = 0; refCnt = 1; - isIdentity = gFalse; + isIdentity = false; } CharCodeToUnicode::CharCodeToUnicode(GooString *tagA) { @@ -495,11 +495,11 @@ CharCodeToUnicode::CharCodeToUnicode(GooString *tagA) { sMap = nullptr; sMapLen = sMapSize = 0; refCnt = 1; - isIdentity = gFalse; + isIdentity = false; } CharCodeToUnicode::CharCodeToUnicode(GooString *tagA, Unicode *mapA, - CharCode mapLenA, GBool copyMap, + CharCode mapLenA, bool copyMap, CharCodeToUnicodeString *sMapA, int sMapLenA, int sMapSizeA) { tag = tagA; @@ -514,7 +514,7 @@ CharCodeToUnicode::CharCodeToUnicode(GooString *tagA, Unicode *mapA, sMapLen = sMapLenA; sMapSize = sMapSizeA; refCnt = 1; - isIdentity = gFalse; + isIdentity = false; } CharCodeToUnicode::~CharCodeToUnicode() { @@ -538,7 +538,7 @@ void CharCodeToUnicode::decRefCnt() { } } -GBool CharCodeToUnicode::match(GooString *tagA) { +bool CharCodeToUnicode::match(GooString *tagA) { return tag && !tag->cmp(tagA); } diff --git a/poppler/CharCodeToUnicode.h b/poppler/CharCodeToUnicode.h index 062f5a26..0f998b1d 100644 --- a/poppler/CharCodeToUnicode.h +++ b/poppler/CharCodeToUnicode.h @@ -81,7 +81,7 @@ public: void decRefCnt(); // Return true if this mapping matches the specified <tagA>. - GBool match(GooString *tagA); + bool match(GooString *tagA); // Set the mapping for <c>. void setMapping(CharCode c, Unicode *u, int len); @@ -105,7 +105,7 @@ private: CharCodeToUnicode(); CharCodeToUnicode(GooString *tagA); CharCodeToUnicode(GooString *tagA, Unicode *mapA, - CharCode mapLenA, GBool copyMap, + CharCode mapLenA, bool copyMap, CharCodeToUnicodeString *sMapA, int sMapLenA, int sMapSizeA); @@ -115,7 +115,7 @@ private: CharCodeToUnicodeString *sMap; int sMapLen, sMapSize; std::atomic_int refCnt; - GBool isIdentity; + bool isIdentity; }; //------------------------------------------------------------------------ diff --git a/poppler/CurlPDFDocBuilder.cc b/poppler/CurlPDFDocBuilder.cc index 4dae58e7..8405109c 100644 --- a/poppler/CurlPDFDocBuilder.cc +++ b/poppler/CurlPDFDocBuilder.cc @@ -34,17 +34,17 @@ CurlPDFDocBuilder::buildPDFDoc(const GooString &uri, } BaseStream *str = new CachedFileStream( - cachedFile, 0, gFalse, cachedFile->getLength(), Object(objNull)); + cachedFile, 0, false, cachedFile->getLength(), Object(objNull)); return new PDFDoc(str, ownerPassword, userPassword, guiDataA); } -GBool CurlPDFDocBuilder::supports(const GooString &uri) +bool CurlPDFDocBuilder::supports(const GooString &uri) { if (uri.cmpN("http://", 7) == 0 || uri.cmpN("https://", 8) == 0) { - return gTrue; + return true; } else { - return gFalse; + return false; } } diff --git a/poppler/CurlPDFDocBuilder.h b/poppler/CurlPDFDocBuilder.h index 37c73a1c..ce421e21 100644 --- a/poppler/CurlPDFDocBuilder.h +++ b/poppler/CurlPDFDocBuilder.h @@ -26,7 +26,7 @@ public: PDFDoc *buildPDFDoc(const GooString &uri, GooString *ownerPassword = nullptr, GooString *userPassword = nullptr, void *guiDataA = nullptr) override; - GBool supports(const GooString &uri) override; + bool supports(const GooString &uri) override; }; diff --git a/poppler/DCTStream.cc b/poppler/DCTStream.cc index 4665ca83..b7bc1c68 100644 --- a/poppler/DCTStream.cc +++ b/poppler/DCTStream.cc @@ -260,6 +260,6 @@ GooString *DCTStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool DCTStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool DCTStream::isBinary(bool last) { + return str->isBinary(true); } diff --git a/poppler/DCTStream.h b/poppler/DCTStream.h index 41a4759d..6bb81cc4 100644 --- a/poppler/DCTStream.h +++ b/poppler/DCTStream.h @@ -62,12 +62,12 @@ public: int getChar() override; int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; private: void init(); - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; int colorXform; diff --git a/poppler/DateInfo.cc b/poppler/DateInfo.cc index b2251004..d0988f24 100644 --- a/poppler/DateInfo.cc +++ b/poppler/DateInfo.cc @@ -30,10 +30,10 @@ #include <string.h> /* See PDF Reference 1.3, Section 3.8.2 for PDF Date representation */ -GBool parseDateString(const char *dateString, int *year, int *month, int *day, int *hour, int *minute, int *second, char *tz, int *tzHour, int *tzMinute) +bool parseDateString(const char *dateString, int *year, int *month, int *day, int *hour, int *minute, int *second, char *tz, int *tzHour, int *tzMinute) { - if ( dateString == nullptr ) return gFalse; - if ( strlen(dateString) < 2 ) return gFalse; + if ( dateString == nullptr ) return false; + if ( strlen(dateString) < 2 ) return false; if ( dateString[0] == 'D' && dateString[1] == ':' ) dateString += 2; @@ -64,16 +64,16 @@ GBool parseDateString(const char *dateString, int *year, int *month, int *day, i } else { - return gFalse; + return false; } } - if (*year <= 0) return gFalse; + if (*year <= 0) return false; - return gTrue; + return true; } - return gFalse; + return false; } // Convert time to PDF date string diff --git a/poppler/DateInfo.h b/poppler/DateInfo.h index 90570d42..653e677c 100644 --- a/poppler/DateInfo.h +++ b/poppler/DateInfo.h @@ -28,7 +28,7 @@ #include "goo/GooString.h" #include <time.h> -GBool parseDateString(const char *string, int *year, int *month, int *day, int *hour, int *minute, int *second, char *tz, int *tzHour, int *tzMinute); +bool parseDateString(const char *string, int *year, int *month, int *day, int *hour, int *minute, int *second, char *tz, int *tzHour, int *tzMinute); /* Converts the time_t into a PDF Date format string. * If timet is NULL, current time is used. diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc index e679f299..8c1196b0 100644 --- a/poppler/Decrypt.cc +++ b/poppler/Decrypt.cc @@ -40,15 +40,15 @@ static void rc4InitKey(Guchar *key, int keyLen, Guchar *state); static Guchar rc4DecryptByte(Guchar *state, Guchar *x, Guchar *y, Guchar c); -static GBool aesReadBlock(Stream *str, Guchar *in, GBool addPadding); +static bool aesReadBlock(Stream *str, Guchar *in, bool addPadding); -static void aesKeyExpansion(DecryptAESState *s, Guchar *objKey, int objKeyLen, GBool decrypt); +static void aesKeyExpansion(DecryptAESState *s, Guchar *objKey, int objKeyLen, bool decrypt); static void aesEncryptBlock(DecryptAESState *s, Guchar *in); -static void aesDecryptBlock(DecryptAESState *s, Guchar *in, GBool last); +static void aesDecryptBlock(DecryptAESState *s, Guchar *in, bool last); -static void aes256KeyExpansion(DecryptAES256State *s, Guchar *objKey, int objKeyLen, GBool decrypt); +static void aes256KeyExpansion(DecryptAES256State *s, Guchar *objKey, int objKeyLen, bool decrypt); static void aes256EncryptBlock(DecryptAES256State *s, Guchar *in); -static void aes256DecryptBlock(DecryptAES256State *s, Guchar *in, GBool last); +static void aes256DecryptBlock(DecryptAES256State *s, Guchar *in, bool last); static void sha256(Guchar *msg, int msgLen, Guchar *hash); static void sha384(Guchar *msg, int msgLen, Guchar *hash); @@ -67,13 +67,13 @@ static const Guchar passwordPad[32] = { // Decrypt //------------------------------------------------------------------------ -GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, +bool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, const GooString *ownerKey, const GooString *userKey, const GooString *ownerEnc, const GooString *userEnc, int permissions, const GooString *fileID, const GooString *ownerPassword, const GooString *userPassword, - Guchar *fileKey, GBool encryptMetadata, - GBool *ownerPasswordOk) { + Guchar *fileKey, bool encryptMetadata, + bool *ownerPasswordOk) { DecryptAES256State state; Guchar test[127 + 56], test2[32]; GooString *userPassword2; @@ -82,7 +82,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, Guchar fx, fy; int len, i, j; - *ownerPasswordOk = gFalse; + *ownerPasswordOk = false; if (encRevision == 5 || encRevision == 6) { @@ -112,18 +112,18 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, //test contains the initial SHA-256 hash input K. revision6Hash(ownerPassword, test, userKey->getCString()); } - aes256KeyExpansion(&state, test, 32, gTrue); + aes256KeyExpansion(&state, test, 32, true); for (i = 0; i < 16; ++i) { state.cbc[i] = 0; } - aes256DecryptBlock(&state, (Guchar *)ownerEnc->getCString(), gFalse); + aes256DecryptBlock(&state, (Guchar *)ownerEnc->getCString(), false); memcpy(fileKey, state.buf, 16); aes256DecryptBlock(&state, (Guchar *)ownerEnc->getCString() + 16, - gFalse); + false); memcpy(fileKey + 16, state.buf, 16); - *ownerPasswordOk = gTrue; - return gTrue; + *ownerPasswordOk = true; + return true; } } @@ -153,21 +153,21 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, //user key is not used in computing intermediate user key. revision6Hash(userPassword, test, nullptr); } - aes256KeyExpansion(&state, test, 32, gTrue); + aes256KeyExpansion(&state, test, 32, true); for (i = 0; i < 16; ++i) { state.cbc[i] = 0; } - aes256DecryptBlock(&state, (Guchar *)userEnc->getCString(), gFalse); + aes256DecryptBlock(&state, (Guchar *)userEnc->getCString(), false); memcpy(fileKey, state.buf, 16); aes256DecryptBlock(&state, (Guchar *)userEnc->getCString() + 16, - gFalse); + false); memcpy(fileKey + 16, state.buf, 16); - return gTrue; + return true; } } - return gFalse; + return false; } else { // try using the supplied owner password to generate the user password @@ -208,9 +208,9 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, if (makeFileKey2(encVersion, encRevision, keyLength, ownerKey, userKey, permissions, fileID, userPassword2, fileKey, encryptMetadata)) { - *ownerPasswordOk = gTrue; + *ownerPasswordOk = true; delete userPassword2; - return gTrue; + return true; } delete userPassword2; } @@ -222,18 +222,18 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, } } -GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, +bool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, const GooString *ownerKey, const GooString *userKey, int permissions, const GooString *fileID, const GooString *userPassword, Guchar *fileKey, - GBool encryptMetadata) { + bool encryptMetadata) { Guchar *buf; Guchar test[32]; Guchar fState[256]; Guchar tmpKey[16]; Guchar fx, fy; int len, i, j; - GBool ok; + bool ok; // generate file key buf = (Guchar *)gmalloc(72 + fileID->getLength()); @@ -293,7 +293,7 @@ GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, md5(buf, 32 + fileID->getLength(), buf); ok = memcmp(test, buf, 16) == 0; } else { - ok = gFalse; + ok = false; } gfree(buf); @@ -355,7 +355,7 @@ BaseCryptStream::BaseCryptStream(Stream *strA, const Guchar *fileKey, CryptAlgor } charactersRead = 0; - autoDelete = gTrue; + autoDelete = true; } BaseCryptStream::~BaseCryptStream() { @@ -384,11 +384,11 @@ int BaseCryptStream::getChar() { return c; } -GBool BaseCryptStream::isBinary(GBool last) { +bool BaseCryptStream::isBinary(bool last) { return str->isBinary(last); } -void BaseCryptStream::setAutoDelete(GBool val) { +void BaseCryptStream::setAutoDelete(bool val) { autoDelete = val; } @@ -425,16 +425,16 @@ void EncryptStream::reset() { rc4InitKey(objKey, objKeyLength, state.rc4.state); break; case cryptAES: - aesKeyExpansion(&state.aes, objKey, objKeyLength, gFalse); + aesKeyExpansion(&state.aes, objKey, objKeyLength, false); memcpy(state.aes.buf, state.aes.cbc, 16); // Copy CBC IV to buf state.aes.bufIdx = 0; - state.aes.paddingReached = gFalse; + state.aes.paddingReached = false; break; case cryptAES256: - aes256KeyExpansion(&state.aes256, objKey, objKeyLength, gFalse); + aes256KeyExpansion(&state.aes256, objKey, objKeyLength, false); memcpy(state.aes256.buf, state.aes256.cbc, 16); // Copy CBC IV to buf state.aes256.bufIdx = 0; - state.aes256.paddingReached = gFalse; + state.aes256.paddingReached = false; break; case cryptNone: break; @@ -458,7 +458,7 @@ int EncryptStream::lookChar() { break; case cryptAES: if (state.aes.bufIdx == 16 && !state.aes.paddingReached) { - state.aes.paddingReached = !aesReadBlock(str, in, gTrue); + state.aes.paddingReached = !aesReadBlock(str, in, true); aesEncryptBlock(&state.aes, in); } if (state.aes.bufIdx == 16) { @@ -469,7 +469,7 @@ int EncryptStream::lookChar() { break; case cryptAES256: if (state.aes256.bufIdx == 16 && !state.aes256.paddingReached) { - state.aes256.paddingReached = !aesReadBlock(str, in, gTrue); + state.aes256.paddingReached = !aesReadBlock(str, in, true); aes256EncryptBlock(&state.aes256, in); } if (state.aes256.bufIdx == 16) { @@ -507,14 +507,14 @@ void DecryptStream::reset() { rc4InitKey(objKey, objKeyLength, state.rc4.state); break; case cryptAES: - aesKeyExpansion(&state.aes, objKey, objKeyLength, gTrue); + aesKeyExpansion(&state.aes, objKey, objKeyLength, true); for (i = 0; i < 16; ++i) { state.aes.cbc[i] = str->getChar(); } state.aes.bufIdx = 16; break; case cryptAES256: - aes256KeyExpansion(&state.aes256, objKey, objKeyLength, gTrue); + aes256KeyExpansion(&state.aes256, objKey, objKeyLength, true); for (i = 0; i < 16; ++i) { state.aes256.cbc[i] = str->getChar(); } @@ -541,7 +541,7 @@ int DecryptStream::lookChar() { break; case cryptAES: if (state.aes.bufIdx == 16) { - if (aesReadBlock(str, in, gFalse)) { + if (aesReadBlock(str, in, false)) { aesDecryptBlock(&state.aes, in, str->lookChar() == EOF); } } @@ -553,7 +553,7 @@ int DecryptStream::lookChar() { break; case cryptAES256: if (state.aes256.bufIdx == 16) { - if (aesReadBlock(str, in, gFalse)) { + if (aesReadBlock(str, in, false)) { aes256DecryptBlock(&state.aes256, in, str->lookChar() == EOF); } } @@ -610,8 +610,8 @@ static Guchar rc4DecryptByte(Guchar *state, Guchar *x, Guchar *y, Guchar c) { // AES decryption //------------------------------------------------------------------------ -// Returns gFalse if EOF was reached, gTrue otherwise -static GBool aesReadBlock(Stream *str, Guchar *in, GBool addPadding) +// Returns false if EOF was reached, true otherwise +static bool aesReadBlock(Stream *str, Guchar *in, bool addPadding) { int c, i; @@ -624,7 +624,7 @@ static GBool aesReadBlock(Stream *str, Guchar *in, GBool addPadding) } if (i == 16) { - return gTrue; + return true; } else { if (addPadding) { c = 16 - i; @@ -632,7 +632,7 @@ static GBool aesReadBlock(Stream *str, Guchar *in, GBool addPadding) in[i++] = (Guchar)c; } } - return gFalse; + return false; } } @@ -872,7 +872,7 @@ static inline void addRoundKey(Guchar *state, Guint *w) { } static void aesKeyExpansion(DecryptAESState *s, - Guchar *objKey, int /*objKeyLen*/, GBool decrypt) { + Guchar *objKey, int /*objKeyLen*/, bool decrypt) { Guint temp; int i, round; @@ -935,7 +935,7 @@ static void aesEncryptBlock(DecryptAESState *s, Guchar *in) { s->bufIdx = 0; } -static void aesDecryptBlock(DecryptAESState *s, Guchar *in, GBool last) { +static void aesDecryptBlock(DecryptAESState *s, Guchar *in, bool last) { int c, round, n, i; // initial state @@ -994,7 +994,7 @@ static void aesDecryptBlock(DecryptAESState *s, Guchar *in, GBool last) { //------------------------------------------------------------------------ static void aes256KeyExpansion(DecryptAES256State *s, - Guchar *objKey, int objKeyLen, GBool decrypt) { + Guchar *objKey, int objKeyLen, bool decrypt) { Guint temp; int i, round; @@ -1059,7 +1059,7 @@ static void aes256EncryptBlock(DecryptAES256State *s, Guchar *in) { s->bufIdx = 0; } -static void aes256DecryptBlock(DecryptAES256State *s, Guchar *in, GBool last) { +static void aes256DecryptBlock(DecryptAES256State *s, Guchar *in, bool last) { int c, round, n, i; // initial state @@ -1728,8 +1728,8 @@ static void revision6Hash(const GooString *inputPassword, Guchar *K, const char memcpy(state.cbc,K + 16,16); memcpy(state.buf, state.cbc, 16); // Copy CBC IV to buf state.bufIdx = 0; - state.paddingReached = gFalse; - aesKeyExpansion(&state,aesKey,16,gFalse); + state.paddingReached = false; + aesKeyExpansion(&state,aesKey,16,false); for(int i = 0; i < (4 * sequenceLength); i++) { aesEncryptBlock(&state,K1 + (16 * i)); diff --git a/poppler/Decrypt.h b/poppler/Decrypt.h index a92859c4..c974d0a9 100644 --- a/poppler/Decrypt.h +++ b/poppler/Decrypt.h @@ -45,21 +45,21 @@ public: // and returns true if either is correct. Sets <ownerPasswordOk> if // the owner password was correct. Either or both of the passwords // may be NULL, which is treated as an empty string. - static GBool makeFileKey(int encVersion, int encRevision, int keyLength, + static bool makeFileKey(int encVersion, int encRevision, int keyLength, const GooString *ownerKey, const GooString *userKey, const GooString *ownerEnc, const GooString *userEnc, int permissions, const GooString *fileID, const GooString *ownerPassword, const GooString *userPassword, - Guchar *fileKey, GBool encryptMetadata, - GBool *ownerPasswordOk); + Guchar *fileKey, bool encryptMetadata, + bool *ownerPasswordOk); private: - static GBool makeFileKey2(int encVersion, int encRevision, int keyLength, + static bool makeFileKey2(int encVersion, int encRevision, int keyLength, const GooString *ownerKey, const GooString *userKey, int permissions, const GooString *fileID, const GooString *userPassword, Guchar *fileKey, - GBool encryptMetadata); + bool encryptMetadata); }; //------------------------------------------------------------------------ @@ -83,7 +83,7 @@ struct DecryptAESState { Guchar state[16]; Guchar cbc[16]; Guchar buf[16]; - GBool paddingReached; // encryption only + bool paddingReached; // encryption only int bufIdx; }; @@ -92,7 +92,7 @@ struct DecryptAES256State { Guchar state[16]; Guchar cbc[16]; Guchar buf[16]; - GBool paddingReached; // encryption only + bool paddingReached; // encryption only int bufIdx; }; @@ -107,9 +107,9 @@ public: int getChar() override; int lookChar() override = 0; Goffset getPos() override; - GBool isBinary(GBool last) override; + bool isBinary(bool last) override; Stream *getUndecodedStream() override { return this; } - void setAutoDelete(GBool val); + void setAutoDelete(bool val); protected: CryptAlgorithm algo; @@ -117,7 +117,7 @@ protected: Guchar objKey[32]; Goffset charactersRead; // so that getPos() can be correct int nextCharBuff; // EOF means not read yet - GBool autoDelete; + bool autoDelete; union { DecryptRC4State rc4; diff --git a/poppler/Dict.cc b/poppler/Dict.cc index 9f3f9f43..768d70b1 100644 --- a/poppler/Dict.cc +++ b/poppler/Dict.cc @@ -154,11 +154,11 @@ void Dict::set(const char *key, Object &&val) { } -GBool Dict::is(const char *type) const { +bool Dict::is(const char *type) const { if (const auto *entry = find("Type")) { return entry->second.isName(type); } - return gFalse; + return false; } Object Dict::lookup(const char *key, int recursion) const { @@ -175,7 +175,7 @@ Object Dict::lookupNF(const char *key) const { return Object(objNull); } -GBool Dict::lookupInt(const char *key, const char *alt_key, int *value) const +bool Dict::lookupInt(const char *key, const char *alt_key, int *value) const { auto obj1 = lookup(key); if (obj1.isNull() && alt_key != nullptr) { @@ -183,11 +183,11 @@ GBool Dict::lookupInt(const char *key, const char *alt_key, int *value) const } if (obj1.isInt()) { *value = obj1.getInt(); - return gTrue; + return true; } - return gFalse; + return false; } -GBool Dict::hasKey(const char *key) const { +bool Dict::hasKey(const char *key) const { return find(key) != nullptr; } diff --git a/poppler/Dict.h b/poppler/Dict.h index 893f3981..bdb08cd7 100644 --- a/poppler/Dict.h +++ b/poppler/Dict.h @@ -71,13 +71,13 @@ public: void remove(const char *key); // Check if dictionary is of specified type. - GBool is(const char *type) const; + bool is(const char *type) const; // Look up an entry and return the value. Returns a null object // if <key> is not in the dictionary. Object lookup(const char *key, int recursion = 0) const; Object lookupNF(const char *key) const; - GBool lookupInt(const char *key, const char *alt_key, int *value) const; + bool lookupInt(const char *key, const char *alt_key, int *value) const; // Iterative accessors. const char *getKey(int i) const { return entries[i].first.c_str(); } @@ -91,7 +91,7 @@ public: XRef *getXRef() const { return xref; } - GBool hasKey(const char *key) const; + bool hasKey(const char *key) const; private: friend class Object; // for incRef/decRef diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc index 2628c363..7479c2d2 100644 --- a/poppler/FileSpec.cc +++ b/poppler/FileSpec.cc @@ -78,31 +78,31 @@ EmbFile::~EmbFile() delete m_mimetype; } -GBool EmbFile::save(const char *path) { +bool EmbFile::save(const char *path) { FILE *f; - GBool ret; + bool ret; if (!(f = fopen(path, "wb"))) { - return gFalse; + return false; } ret = save2(f); fclose(f); return ret; } -GBool EmbFile::save2(FILE *f) { +bool EmbFile::save2(FILE *f) { int c; m_objStr.streamReset(); while ((c = m_objStr.streamGetChar()) != EOF) { fputc(c, f); } - return gTrue; + return true; } FileSpec::FileSpec(const Object *fileSpecA) { - ok = gTrue; + ok = true; fileName = nullptr; platformFileName = nullptr; embFile = nullptr; @@ -111,7 +111,7 @@ FileSpec::FileSpec(const Object *fileSpecA) Object obj1 = getFileSpecName(fileSpecA); if (!obj1.isString()) { - ok = gFalse; + ok = false; error(errSyntaxError, -1, "Invalid FileSpec"); return; } @@ -123,7 +123,7 @@ FileSpec::FileSpec(const Object *fileSpecA) if (obj1.isDict()) { fileStream = obj1.dictLookupNF("F"); if (!fileStream.isRef()) { - ok = gFalse; + ok = false; fileStream.setToNull(); error(errSyntaxError, -1, "Invalid FileSpec: Embedded file stream is not an indirect reference"); return; diff --git a/poppler/FileSpec.h b/poppler/FileSpec.h index d156c884..58c9e481 100644 --- a/poppler/FileSpec.h +++ b/poppler/FileSpec.h @@ -33,11 +33,11 @@ public: const GooString *mimeType() const { return m_mimetype; } Object *streamObject() { return &m_objStr; } Stream *stream() { return isOk() ? m_objStr.getStream() : nullptr; } - GBool isOk() const { return m_objStr.isStream(); } - GBool save(const char *path); + bool isOk() const { return m_objStr.isStream(); } + bool save(const char *path); private: - GBool save2(FILE *f); + bool save2(FILE *f); int m_size; GooString *m_createDate; @@ -55,7 +55,7 @@ public: FileSpec(const FileSpec &) = delete; FileSpec& operator=(const FileSpec &) = delete; - GBool isOk() const { return ok; } + bool isOk() const { return ok; } const GooString *getFileName() const { return fileName; } GooString *getFileNameForPlatform(); @@ -63,7 +63,7 @@ public: EmbFile *getEmbeddedFile(); private: - GBool ok; + bool ok; Object fileSpec; diff --git a/poppler/FlateEncoder.cc b/poppler/FlateEncoder.cc index a0a7c45b..bd4b36dd 100644 --- a/poppler/FlateEncoder.cc +++ b/poppler/FlateEncoder.cc @@ -23,7 +23,7 @@ FlateEncoder::FlateEncoder(Stream *strA): int zlib_status; outBufPtr = outBufEnd = outBuf; - inBufEof = outBufEof = gFalse; + inBufEof = outBufEof = false; zlib_stream.zalloc = Z_NULL; zlib_stream.zfree = Z_NULL; @@ -32,7 +32,7 @@ FlateEncoder::FlateEncoder(Stream *strA): zlib_status = deflateInit(&zlib_stream, Z_DEFAULT_COMPRESSION); if (zlib_status != Z_OK) { - inBufEof = outBufEof = gTrue; + inBufEof = outBufEof = true; error(errInternal, -1, "Internal: deflateInit() failed in FlateEncoder::FlateEncoder()"); } @@ -53,14 +53,14 @@ void FlateEncoder::reset() { str->reset(); outBufPtr = outBufEnd = outBuf; - inBufEof = outBufEof = gFalse; + inBufEof = outBufEof = false; deflateEnd(&zlib_stream); zlib_status = deflateInit(&zlib_stream, Z_DEFAULT_COMPRESSION); if (zlib_status != Z_OK) { - inBufEof = outBufEof = gTrue; + inBufEof = outBufEof = true; error(errInternal, -1, "Internal: deflateInit() failed in FlateEncoder::reset()"); } @@ -68,7 +68,7 @@ void FlateEncoder::reset() { zlib_stream.avail_out = 1; /* anything but 0 to trigger a read */ } -GBool FlateEncoder::fillBuf() { +bool FlateEncoder::fillBuf() { int n; unsigned int starting_avail_out; int zlib_status; @@ -76,7 +76,7 @@ GBool FlateEncoder::fillBuf() { /* If the output is done, don't try to read more. */ if (outBufEof) { - return gFalse; + return false; } /* The output buffer should be empty. */ @@ -108,7 +108,7 @@ GBool FlateEncoder::fillBuf() { n = (inBufEof? 0: str->doGetChars(inBufSize, inBuf)); if (n == 0) { - inBufEof = gTrue; + inBufEof = true; } zlib_stream.next_in = inBuf; @@ -126,9 +126,9 @@ GBool FlateEncoder::fillBuf() { if (zlib_status == Z_STREAM_ERROR || zlib_stream.avail_out > starting_avail_out) { /* Unrecoverable error */ - inBufEof = outBufEof = gTrue; + inBufEof = outBufEof = true; error(errInternal, -1, "Internal: deflate() failed in FlateEncoder::fillBuf()"); - return gFalse; + return false; } } while (zlib_stream.avail_out == outBufSize && !inBufEof); @@ -136,7 +136,7 @@ GBool FlateEncoder::fillBuf() { outBufEnd = &outBuf[ outBufSize ] - zlib_stream.avail_out; if (inBufEof && zlib_stream.avail_out != 0) { - outBufEof = gTrue; + outBufEof = true; } return outBufPtr < outBufEnd; diff --git a/poppler/FlateEncoder.h b/poppler/FlateEncoder.h index 69053c9c..b9d6e509 100644 --- a/poppler/FlateEncoder.h +++ b/poppler/FlateEncoder.h @@ -49,8 +49,8 @@ public: int lookChar() override { return (outBufPtr >= outBufEnd && !fillBuf()) ? EOF : (*outBufPtr & 0xff); } GooString *getPSFilter(int psLevel, const char *indent) override { return nullptr; } - GBool isBinary(GBool last = gTrue) override { return gTrue; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool last = true) override { return true; } + bool isEncoder() override { return true; } private: @@ -60,11 +60,11 @@ private: Guchar outBuf[ outBufSize ]; Guchar *outBufPtr; Guchar *outBufEnd; - GBool inBufEof; - GBool outBufEof; + bool inBufEof; + bool outBufEof; z_stream zlib_stream; - GBool fillBuf(); + bool fillBuf(); }; #endif diff --git a/poppler/FlateStream.cc b/poppler/FlateStream.cc index e861acb8..dca20d63 100644 --- a/poppler/FlateStream.cc +++ b/poppler/FlateStream.cc @@ -133,8 +133,8 @@ GooString *FlateStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool FlateStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool FlateStream::isBinary(bool last) { + return str->isBinary(true); } #endif diff --git a/poppler/FlateStream.h b/poppler/FlateStream.h index 117196ec..c8ab0763 100644 --- a/poppler/FlateStream.h +++ b/poppler/FlateStream.h @@ -44,7 +44,7 @@ public: virtual int getRawChar() override; virtual void getRawChars(int nChars, int *buffer) override; virtual GooString *getPSFilter(int psLevel, const char *indent) override; - virtual GBool isBinary(GBool last = gTrue) override; + virtual bool isBinary(bool last = true) override; private: inline int doGetRawChar() { diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc index a3884b07..e64fa158 100644 --- a/poppler/FontInfo.cc +++ b/poppler/FontInfo.cc @@ -172,7 +172,7 @@ FontInfo::FontInfo(GfxFont *font, XRef *xref) { // check for an embedded font if (font->getType() == fontType3) { - emb = gTrue; + emb = true; } else { emb = font->getEmbeddedFontID(&embRef); } @@ -191,7 +191,7 @@ FontInfo::FontInfo(GfxFont *font, XRef *xref) { encoding = font->getEncodingName()->copy(); // look for a ToUnicode map - hasToUnicode = gFalse; + hasToUnicode = false; Object fontObj = xref->fetch(fontRef.num, fontRef.gen); if (fontObj.isDict()) { hasToUnicode = fontObj.dictLookup("ToUnicode").isStream(); @@ -199,7 +199,7 @@ FontInfo::FontInfo(GfxFont *font, XRef *xref) { // check for a font subset name: capital letters followed by a '+' // sign - subset = gFalse; + subset = false; if (name) { int i; for (i = 0; i < name->getLength(); ++i) { diff --git a/poppler/FontInfo.h b/poppler/FontInfo.h index f6501466..48eaefd6 100644 --- a/poppler/FontInfo.h +++ b/poppler/FontInfo.h @@ -63,9 +63,9 @@ public: GooString *getFile() { return file; }; GooString *getEncoding() { return encoding; }; Type getType() { return type; }; - GBool getEmbedded() { return emb; }; - GBool getSubset() { return subset; }; - GBool getToUnicode() { return hasToUnicode; }; + bool getEmbedded() { return emb; }; + bool getSubset() { return subset; }; + bool getToUnicode() { return hasToUnicode; }; Ref getRef() { return fontRef; }; Ref getEmbRef() { return embRef; }; @@ -75,9 +75,9 @@ private: GooString *file; GooString *encoding; Type type; - GBool emb; - GBool subset; - GBool hasToUnicode; + bool emb; + bool subset; + bool hasToUnicode; Ref fontRef; Ref embRef; }; diff --git a/poppler/Form.cc b/poppler/Form.cc index 808e59f9..50ed0120 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -115,8 +115,8 @@ void FormWidget::createWidgetAnnotation() { widget = new AnnotWidget(doc, &obj, &obj1, field); } -GBool FormWidget::inRect(double x, double y) const { - return widget ? widget->inRect(x, y) : gFalse; +bool FormWidget::inRect(double x, double y) const { + return widget ? widget->inRect(x, y) : false; } void FormWidget::getRect(double *x1, double *y1, double *x2, double *y2) const { @@ -228,7 +228,7 @@ void FormWidgetButton::updateWidgetAppearance() // The appearance stream must NOT be regenerated for this widget type } -void FormWidgetButton::setState (GBool astate) +void FormWidgetButton::setState (bool astate) { //pushButtons don't have state if (parent()->getButtonType() == formButtonPush) @@ -242,9 +242,9 @@ void FormWidgetButton::setState (GBool astate) // Parent will call setAppearanceState() } -GBool FormWidgetButton::getState () const +bool FormWidgetButton::getState () const { - return onStr ? parent()->getState(onStr->getCString()) : gFalse; + return onStr ? parent()->getState(onStr->getCString()) : false; } FormFieldButton *FormWidgetButton::parent() const @@ -624,7 +624,7 @@ FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *par defaultAppearance = nullptr; fullyQualifiedName = nullptr; quadding = quaddingLeftJustified; - hasQuadding = gFalse; + hasQuadding = false; ref = aref; @@ -707,7 +707,7 @@ FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *par obj1 = Form::fieldLookup(dict, "Q"); if (obj1.isInt()) { quadding = static_cast<VariableTextQuadding>(obj1.getInt()); - hasQuadding = gTrue; + hasQuadding = true; } obj1 = dict->lookup("T"); @@ -846,7 +846,7 @@ GooString* FormField::getFullyQualifiedName() { Object parent; const GooString *parent_name; GooString *full_name; - GBool unicode_encoded = gFalse; + bool unicode_encoded = false; if (fullyQualifiedName) return fullyQualifiedName; @@ -872,7 +872,7 @@ GooString* FormField::getFullyQualifiedName() { } else { full_name->insert(0, '.'); // 1-byte ascii period if (parent_name->hasUnicodeMarker()) { - unicode_encoded = gTrue; + unicode_encoded = true; full_name = convertToUtf16(full_name); full_name->insert(0, parent_name->getCString() + 2, parent_name->getLength() - 2); // Remove the unicode BOM } else { @@ -895,7 +895,7 @@ GooString* FormField::getFullyQualifiedName() { } } else { if (partialName->hasUnicodeMarker()) { - unicode_encoded = gTrue; + unicode_encoded = true; full_name = convertToUtf16(full_name); full_name->append(partialName->getCString() + 2, partialName->getLength() - 2); // Remove the unicode BOM } else { @@ -1051,28 +1051,28 @@ void FormFieldButton::fillChildrenSiblingsID() } } -GBool FormFieldButton::setState(const char *state) +bool FormFieldButton::setState(const char *state) { // A check button could behave as a radio button // when it's in a set of more than 1 buttons if (btype != formButtonRadio && btype != formButtonCheck) - return gFalse; + return false; if (terminal && parent && parent->getType() == formButton && appearanceState.isNull()) { // It's button in a set, set state on parent if (static_cast<FormFieldButton*>(parent)->setState(state)) { - return gTrue; + return true; } - return gFalse; + return false; } - GBool isOn = strcmp(state, "Off") != 0; + bool isOn = strcmp(state, "Off") != 0; if (!isOn && noAllOff) - return gFalse; // Don't allow to set all radio to off + return false; // Don't allow to set all radio to off const char *current = getAppearanceState(); - GBool currentFound = gFalse, newFound = gFalse; + bool currentFound = false, newFound = false; for (int i = 0; i < numChildren; i++) { FormWidgetButton *widget; @@ -1093,12 +1093,12 @@ GBool FormFieldButton::setState(const char *state) widget->setAppearanceState("Off"); if (!isOn) break; - currentFound = gTrue; + currentFound = true; } if (isOn && strcmp(state, onStr) == 0) { widget->setAppearanceState(state); - newFound = gTrue; + newFound = true; } if (currentFound && newFound) @@ -1107,14 +1107,14 @@ GBool FormFieldButton::setState(const char *state) updateState(state); - return gTrue; + return true; } -GBool FormFieldButton::getState(const char *state) const { +bool FormFieldButton::getState(const char *state) const { if (appearanceState.isName(state)) - return gTrue; + return true; - return (parent && parent->getType() == formButton) ? static_cast<FormFieldButton*>(parent)->getState(state) : gFalse; + return (parent && parent->getType() == formButton) ? static_cast<FormFieldButton*>(parent)->getState(state) : false; } void FormFieldButton::updateState(const char *state) { @@ -1378,16 +1378,16 @@ FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, For // seems to expect the exportVal instead of the optionName and so we do too. obj1 = Form::fieldLookup(dict, "V"); if (obj1.isString()) { - GBool optionFound = gFalse; + bool optionFound = false; for (int i = 0; i < numChoices; i++) { if (choices[i].exportVal) { if (choices[i].exportVal->cmp(obj1.getString()) == 0) { - optionFound = gTrue; + optionFound = true; } } else if (choices[i].optionName) { if (choices[i].optionName->cmp(obj1.getString()) == 0) { - optionFound = gTrue; + optionFound = true; } } @@ -1405,15 +1405,15 @@ FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, For for (int i = 0; i < numChoices; i++) { for (int j = 0; j < obj1.arrayGetLength(); j++) { Object obj2 = obj1.arrayGet(j); - GBool matches = gFalse; + bool matches = false; if (choices[i].exportVal) { if (choices[i].exportVal->cmp(obj2.getString()) == 0) { - matches = gTrue; + matches = true; } } else if (choices[i].optionName) { if (choices[i].optionName->cmp(obj2.getString()) == 0) { - matches = gTrue; + matches = true; } } diff --git a/poppler/Form.h b/poppler/Form.h index 76af74d3..43f07164 100644 --- a/poppler/Form.h +++ b/poppler/Form.h @@ -89,7 +89,7 @@ public: virtual ~FormWidget(); // Check if point is inside the field bounding rect - GBool inRect(double x, double y) const; + bool inRect(double x, double y) const; // Get the field bounding rect void getRect(double *x1, double *y1, double *x2, double *y2) const; @@ -112,7 +112,7 @@ public: const GooString *getMappingName() const; GooString *getFullyQualifiedName(); - GBool isModified () const; + bool isModified () const; bool isReadOnly() const; void setReadOnly(bool value); @@ -168,8 +168,8 @@ public: FormButtonType getButtonType() const; - void setState (GBool state); - GBool getState () const; + void setState (bool state); + bool getState () const; const char* getOnStr() const; void setAppearanceState(const char *state); @@ -300,7 +300,7 @@ public: bool isReadOnly () const { return readOnly; } GooString* getDefaultAppearance() const { return defaultAppearance; } - GBool hasTextQuadding() const { return hasQuadding; } + bool hasTextQuadding() const { return hasQuadding; } VariableTextQuadding getTextQuadding() const { return quadding; } const GooString *getPartialName() const { return partialName; } @@ -345,7 +345,7 @@ public: // Variable Text GooString *defaultAppearance; - GBool hasQuadding; + bool hasQuadding; VariableTextQuadding quadding; private: @@ -365,9 +365,9 @@ public: bool noToggleToOff () const { return noAllOff; } - // returns gTrue if the state modification is accepted - GBool setState (const char *state); - GBool getState(const char *state) const; + // returns true if the state modification is accepted + bool setState (const char *state); + bool getState(const char *state) const; const char *getAppearanceState() const { return appearanceState.isName() ? appearanceState.getName() : nullptr; } @@ -560,7 +560,7 @@ public: static FormField *createFieldFromDict (Object* obj, PDFDoc *docA, const Ref& aref, FormField *parent, std::set<int> *usedParents); Object *getObj () const { return acroForm; } - GBool getNeedAppearances () const { return needAppearances; } + bool getNeedAppearances () const { return needAppearances; } int getNumFields() const { return numFields; } FormField* getRootField(int i) const { return rootFields[i]; } const GooString* getDefaultAppearance() const { return defaultAppearance; } @@ -581,7 +581,7 @@ private: PDFDoc *doc; XRef* xref; Object *acroForm; - GBool needAppearances; + bool needAppearances; GfxResources *defaultResources; Object resDict; std::vector<Ref> calculateOrder; diff --git a/poppler/Function.cc b/poppler/Function.cc index b8f5fdc7..c70c32d2 100644 --- a/poppler/Function.cc +++ b/poppler/Function.cc @@ -112,7 +112,7 @@ Function::Function(const Function *func) { hasRange = func->hasRange; } -GBool Function::init(Dict *dict) { +bool Function::init(Dict *dict) { Object obj1; int i; @@ -120,58 +120,58 @@ GBool Function::init(Dict *dict) { obj1 = dict->lookup("Domain"); if (!obj1.isArray()) { error(errSyntaxError, -1, "Function is missing domain"); - return gFalse; + return false; } m = obj1.arrayGetLength() / 2; if (m > funcMaxInputs) { error(errSyntaxError, -1, "Functions with more than {0:d} inputs are unsupported", funcMaxInputs); - return gFalse; + return false; } for (i = 0; i < m; ++i) { Object obj2 = obj1.arrayGet(2*i); if (!obj2.isNum()) { error(errSyntaxError, -1, "Illegal value in function domain array"); - return gFalse; + return false; } domain[i][0] = obj2.getNum(); obj2 = obj1.arrayGet(2*i+1); if (!obj2.isNum()) { error(errSyntaxError, -1, "Illegal value in function domain array"); - return gFalse; + return false; } domain[i][1] = obj2.getNum(); } //----- Range - hasRange = gFalse; + hasRange = false; n = 0; obj1 = dict->lookup("Range"); if (obj1.isArray()) { - hasRange = gTrue; + hasRange = true; n = obj1.arrayGetLength() / 2; if (n > funcMaxOutputs) { error(errSyntaxError, -1, "Functions with more than {0:d} outputs are unsupported", funcMaxOutputs); - return gFalse; + return false; } for (i = 0; i < n; ++i) { Object obj2 = obj1.arrayGet(2*i); if (!obj2.isNum()) { error(errSyntaxError, -1, "Illegal value in function range array"); - return gFalse; + return false; } range[i][0] = obj2.getNum(); obj2 = obj1.arrayGet(2*i+1); if (!obj2.isNum()) { error(errSyntaxError, -1, "Illegal value in function range array"); - return gFalse; + return false; } range[i][1] = obj2.getNum(); } } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -189,7 +189,7 @@ IdentityFunction::IdentityFunction() { domain[i][0] = 0; domain[i][1] = 1; } - hasRange = gFalse; + hasRange = false; } IdentityFunction::~IdentityFunction() { @@ -221,7 +221,7 @@ SampledFunction::SampledFunction(Object *funcObj, Dict *dict) { idxOffset = nullptr; samples = nullptr; sBuf = nullptr; - ok = gFalse; + ok = false; //----- initialize the generic stuff if (!init(dict)) { @@ -397,7 +397,7 @@ SampledFunction::SampledFunction(Object *funcObj, Dict *dict) { } transform(in, cacheOut); - ok = gTrue; + ok = true; } SampledFunction::~SampledFunction() { @@ -518,18 +518,18 @@ void SampledFunction::transform(const double *in, double *out) const { } } -GBool SampledFunction::hasDifferentResultSet(const Function *func) const { +bool SampledFunction::hasDifferentResultSet(const Function *func) const { if (func->getType() == 0) { SampledFunction *compTo = (SampledFunction *) func; if (compTo->getSampleNumber() != nSamples) - return gTrue; + return true; const double *compSamples = compTo->getSamples(); for (int i = 0; i < nSamples; i++) { if (samples[i] != compSamples[i]) - return gTrue; + return true; } } - return gFalse; + return false; } //------------------------------------------------------------------------ @@ -539,7 +539,7 @@ GBool SampledFunction::hasDifferentResultSet(const Function *func) const { ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { Object obj1; - ok = gFalse; + ok = false; //----- initialize the generic stuff if (!init(dict)) { @@ -611,7 +611,7 @@ ExponentialFunction::ExponentialFunction(Object *funcObj, Dict *dict) { e = obj1.getNum(); isLinear = fabs(e-1.) < 1e-10; - ok = gTrue; + ok = true; } ExponentialFunction::~ExponentialFunction() { @@ -658,7 +658,7 @@ StitchingFunction::StitchingFunction(Object *funcObj, Dict *dict, std::set<int> Object obj1; int i; - ok = gFalse; + ok = false; funcs = nullptr; bounds = nullptr; encode = nullptr; @@ -754,7 +754,7 @@ StitchingFunction::StitchingFunction(Object *funcObj, Dict *dict, std::set<int> } n = funcs[0]->getOutputSize(); - ok = gTrue; + ok = true; return; } @@ -945,7 +945,7 @@ enum PSObjectType { struct PSObject { PSObjectType type; union { - GBool booln; // boolean (stack only) + bool booln; // boolean (stack only) int intg; // integer (stack and code) double real; // real (stack and code) PSOp op; // operator (code only) @@ -960,7 +960,7 @@ public: PSStack() {sp = psStackSize; } void clear() { sp = psStackSize; } - void pushBool(GBool booln) + void pushBool(bool booln) { if (checkOverflow()) { stack[--sp].type = psBool; @@ -981,12 +981,12 @@ public: stack[sp].real = real; } } - GBool popBool() + bool popBool() { if (checkUnderflow() && checkType(psBool, psBool)) { return stack[sp++].booln; } - return gFalse; + return false; } int popInt() { @@ -1006,14 +1006,14 @@ public: } return 0; } - GBool empty() { return sp == psStackSize; } - GBool topIsInt() { return sp < psStackSize && stack[sp].type == psInt; } - GBool topTwoAreInts() + bool empty() { return sp == psStackSize; } + bool topIsInt() { return sp < psStackSize && stack[sp].type == psInt; } + bool topTwoAreInts() { return sp < psStackSize - 1 && stack[sp].type == psInt && stack[sp+1].type == psInt; } - GBool topIsReal() { return sp < psStackSize && stack[sp].type == psReal; } - GBool topTwoAreNums() + bool topIsReal() { return sp < psStackSize && stack[sp].type == psReal; } + bool topTwoAreNums() { return sp < psStackSize - 1 && (stack[sp].type == psInt || stack[sp].type == psReal) && (stack[sp+1].type == psInt || stack[sp+1].type == psReal); } @@ -1045,29 +1045,29 @@ public: private: - GBool checkOverflow(int n = 1) + bool checkOverflow(int n = 1) { if (sp - n < 0) { error(errSyntaxError, -1, "Stack overflow in PostScript function"); - return gFalse; + return false; } - return gTrue; + return true; } - GBool checkUnderflow() + bool checkUnderflow() { if (sp == psStackSize) { error(errSyntaxError, -1, "Stack underflow in PostScript function"); - return gFalse; + return false; } - return gTrue; + return true; } - GBool checkType(PSObjectType t1, PSObjectType t2) + bool checkType(PSObjectType t1, PSObjectType t2) { if (stack[sp].type != t1 && stack[sp].type != t2) { error(errSyntaxError, -1, "Type mismatch in PostScript function"); - return gFalse; + return false; } - return gTrue; + return true; } PSObject stack[psStackSize]; int sp; @@ -1142,7 +1142,7 @@ PostScriptFunction::PostScriptFunction(Object *funcObj, Dict *dict) { code = nullptr; codeString = nullptr; codeSize = 0; - ok = gFalse; + ok = false; //----- initialize the generic stuff if (!init(dict)) { @@ -1184,7 +1184,7 @@ PostScriptFunction::PostScriptFunction(Object *funcObj, Dict *dict) { } transform(in, cacheOut); - ok = gTrue; + ok = true; err2: str->close(); @@ -1257,23 +1257,23 @@ void PostScriptFunction::transform(const double *in, double *out) const { } } -GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { +bool PostScriptFunction::parseCode(Stream *str, int *codePtr) { GooString *tok; - GBool isReal; + bool isReal; int opPtr, elsePtr; int a, b, mid, cmp; while (1) { if (!(tok = getToken(str))) { error(errSyntaxError, -1, "Unexpected end of PostScript function stream"); - return gFalse; + return false; } const char *p = tok->getCString(); if (isdigit(*p) || *p == '.' || *p == '-') { - isReal = gFalse; + isReal = false; for (; *p; ++p) { if (*p == '.') { - isReal = gTrue; + isReal = true; break; } } @@ -1293,22 +1293,22 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { *codePtr += 3; resizeCode(opPtr + 2); if (!parseCode(str, codePtr)) { - return gFalse; + return false; } if (!(tok = getToken(str))) { error(errSyntaxError, -1, "Unexpected end of PostScript function stream"); - return gFalse; + return false; } if (!tok->cmp("{")) { elsePtr = *codePtr; if (!parseCode(str, codePtr)) { delete tok; - return gFalse; + return false; } delete tok; if (!(tok = getToken(str))) { error(errSyntaxError, -1, "Unexpected end of PostScript function stream"); - return gFalse; + return false; } } else { elsePtr = -1; @@ -1317,7 +1317,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { if (elsePtr >= 0) { error(errSyntaxError, -1, "Got 'if' operator with two blocks in PostScript function"); - return gFalse; + return false; } code[opPtr].type = psOperator; code[opPtr].op = psOpIf; @@ -1327,7 +1327,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { if (elsePtr < 0) { error(errSyntaxError, -1, "Got 'ifelse' operator with one block in PostScript function"); - return gFalse; + return false; } code[opPtr].type = psOperator; code[opPtr].op = psOpIfelse; @@ -1339,7 +1339,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { error(errSyntaxError, -1, "Expected if/ifelse operator in PostScript function"); delete tok; - return gFalse; + return false; } delete tok; } else if (!tok->cmp("}")) { @@ -1370,7 +1370,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { "Unknown operator '{0:t}' in PostScript function", tok); delete tok; - return gFalse; + return false; } delete tok; resizeCode(*codePtr); @@ -1379,16 +1379,16 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) { ++*codePtr; } } - return gTrue; + return true; } GooString *PostScriptFunction::getToken(Stream *str) { GooString *s; int c; - GBool comment; + bool comment; s = new GooString(); - comment = gFalse; + comment = false; while (1) { if ((c = str->getChar()) == EOF) { break; @@ -1396,10 +1396,10 @@ GooString *PostScriptFunction::getToken(Stream *str) { codeString->append(c); if (comment) { if (c == '\x0a' || c == '\x0d') { - comment = gFalse; + comment = false; } } else if (c == '%') { - comment = gTrue; + comment = true; } else if (!isspace(c)) { break; } @@ -1440,7 +1440,7 @@ void PostScriptFunction::resizeCode(int newSize) { void PostScriptFunction::exec(PSStack *stack, int codePtr) const { int i1, i2; double r1, r2, result; - GBool b1, b2; + bool b1, b2; while (1) { switch (code[codePtr].type) { @@ -1552,7 +1552,7 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) const { stack->pushReal(pow(r1, r2)); break; case psOpFalse: - stack->pushBool(gFalse); + stack->pushBool(false); break; case psOpFloor: if (!stack->topIsInt()) { @@ -1710,7 +1710,7 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) const { } break; case psOpTrue: - stack->pushBool(gTrue); + stack->pushBool(true); break; case psOpTruncate: if (!stack->topIsInt()) { diff --git a/poppler/Function.h b/poppler/Function.h index 87480dcc..16d91401 100644 --- a/poppler/Function.h +++ b/poppler/Function.h @@ -58,7 +58,7 @@ public: static Function *parse(Object *funcObj); // Initialize the entries common to all function types. - GBool init(Dict *dict); + bool init(Dict *dict); virtual Function *copy() const = 0; @@ -78,13 +78,13 @@ public: double getDomainMax(int i) const { return domain[i][1]; } double getRangeMin(int i) const { return range[i][0]; } double getRangeMax(int i) const { return range[i][1]; } - GBool getHasRange() const { return hasRange; } - virtual GBool hasDifferentResultSet(const Function *func) const { return gFalse; } + bool getHasRange() const { return hasRange; } + virtual bool hasDifferentResultSet(const Function *func) const { return false; } // Transform an input tuple into an output tuple. virtual void transform(const double *in, double *out) const = 0; - virtual GBool isOk() const = 0; + virtual bool isOk() const = 0; protected: static Function *parse(Object *funcObj, std::set<int> *usedParents); @@ -96,7 +96,7 @@ protected: domain[funcMaxInputs][2]; double // min and max values for function range range[funcMaxOutputs][2]; - GBool hasRange; // set if range is defined + bool hasRange; // set if range is defined }; //------------------------------------------------------------------------ @@ -111,7 +111,7 @@ public: Function *copy() const override { return new IdentityFunction(); } int getType() const override { return -1; } void transform(const double *in, double *out) const override; - GBool isOk() const override { return gTrue; } + bool isOk() const override { return true; } private: }; @@ -128,8 +128,8 @@ public: Function *copy() const override { return new SampledFunction(this); } int getType() const override { return 0; } void transform(const double *in, double *out) const override; - GBool isOk() const override { return ok; } - GBool hasDifferentResultSet(const Function *func) const override; + bool isOk() const override { return ok; } + bool hasDifferentResultSet(const Function *func) const override; int getSampleSize(int i) const { return sampleSize[i]; } double getEncodeMin(int i) const { return encode[i][0]; } @@ -157,7 +157,7 @@ private: double *sBuf; // buffer for the transform function mutable double cacheIn[funcMaxInputs]; mutable double cacheOut[funcMaxOutputs]; - GBool ok; + bool ok; }; //------------------------------------------------------------------------ @@ -172,7 +172,7 @@ public: Function *copy() const override { return new ExponentialFunction(this); } int getType() const override { return 2; } void transform(const double *in, double *out) const override; - GBool isOk() const override { return ok; } + bool isOk() const override { return ok; } const double *getC0() const { return c0; } const double *getC1() const { return c1; } @@ -186,7 +186,7 @@ private: double c1[funcMaxOutputs]; double e; bool isLinear; - GBool ok; + bool ok; }; //------------------------------------------------------------------------ @@ -201,7 +201,7 @@ public: Function *copy() const override { return new StitchingFunction(this); } int getType() const override { return 3; } void transform(const double *in, double *out) const override; - GBool isOk() const override { return ok; } + bool isOk() const override { return ok; } int getNumFuncs() const { return k; } const Function *getFunc(int i) const { return funcs[i]; } @@ -218,7 +218,7 @@ private: double *bounds; double *encode; double *scale; - GBool ok; + bool ok; }; //------------------------------------------------------------------------ @@ -233,14 +233,14 @@ public: Function *copy() const override { return new PostScriptFunction(this); } int getType() const override { return 4; } void transform(const double *in, double *out) const override; - GBool isOk() const override { return ok; } + bool isOk() const override { return ok; } const GooString *getCodeString() const { return codeString; } private: PostScriptFunction(const PostScriptFunction *func); - GBool parseCode(Stream *str, int *codePtr); + bool parseCode(Stream *str, int *codePtr); GooString *getToken(Stream *str); void resizeCode(int newSize); void exec(PSStack *stack, int codePtr) const; @@ -250,7 +250,7 @@ private: int codeSize; mutable double cacheIn[funcMaxInputs]; mutable double cacheOut[funcMaxOutputs]; - GBool ok; + bool ok; }; #endif diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 1c055e63..3dfc08e8 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -302,7 +302,7 @@ Operator Gfx::opTab[] = { #define numOps (sizeof(opTab) / sizeof(Operator)) -static inline GBool isSameGfxColor(const GfxColor &colorA, const GfxColor &colorB, Guint nComps, double delta) { +static inline bool isSameGfxColor(const GfxColor &colorA, const GfxColor &colorB, Guint nComps, double delta) { for (Guint k = 0; k < nComps; ++k) { if (abs(colorA.c[k] - colorB.c[k]) > delta) { return false; @@ -532,7 +532,7 @@ Object GfxResources::lookupGStateNF(const char *name) { Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, double hDPI, double vDPI, const PDFRectangle *box, const PDFRectangle *cropBox, int rotate, - GBool (*abortCheckCbkA)(void *data), + bool (*abortCheckCbkA)(void *data), void *abortCheckCbkDataA, XRef *xrefA) { int i; @@ -540,7 +540,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, doc = docA; xref = (xrefA == nullptr) ? doc->getXRef() : xrefA; catalog = doc->getCatalog(); - subPage = gFalse; + subPage = false; printCommands = globalParams->getPrintCommands(); profileCommands = globalParams->getProfileCommands(); mcStack = nullptr; @@ -554,7 +554,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, state = new GfxState(hDPI, vDPI, box, rotate, out->upsideDown()); stackHeight = 1; pushStateGuard(); - fontChanged = gFalse; + fontChanged = false; clip = clipNone; ignoreUndef = 0; out->startPage(pageNum, state, xref); @@ -564,7 +564,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, baseMatrix[i] = state->getCTM()[i]; } formDepth = 0; - ocState = gTrue; + ocState = true; parser = nullptr; abortCheckCbk = abortCheckCbkA; abortCheckCbkData = abortCheckCbkDataA; @@ -587,7 +587,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, const PDFRectangle *box, const PDFRectangle *cropBox, - GBool (*abortCheckCbkA)(void *data), + bool (*abortCheckCbkA)(void *data), void *abortCheckCbkDataA, Gfx *gfxA) { int i; @@ -601,7 +601,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, xref = doc->getXRef(); } catalog = doc->getCatalog(); - subPage = gTrue; + subPage = true; printCommands = globalParams->getPrintCommands(); profileCommands = globalParams->getProfileCommands(); mcStack = nullptr; @@ -612,17 +612,17 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, // initialize out = outA; - state = new GfxState(72, 72, box, 0, gFalse); + state = new GfxState(72, 72, box, 0, false); stackHeight = 1; pushStateGuard(); - fontChanged = gFalse; + fontChanged = false; clip = clipNone; ignoreUndef = 0; for (i = 0; i < 6; ++i) { baseMatrix[i] = state->getCTM()[i]; } formDepth = 0; - ocState = gTrue; + ocState = true; parser = nullptr; abortCheckCbk = abortCheckCbkA; abortCheckCbkData = abortCheckCbkDataA; @@ -695,7 +695,7 @@ Gfx::~Gfx() { } } -void Gfx::display(Object *obj, GBool topLevel) { +void Gfx::display(Object *obj, bool topLevel) { int i; if (obj->isArray()) { @@ -710,13 +710,13 @@ void Gfx::display(Object *obj, GBool topLevel) { error(errSyntaxError, -1, "Weird page contents"); return; } - parser = new Parser(xref, new Lexer(xref, obj), gFalse); + parser = new Parser(xref, new Lexer(xref, obj), false); go(topLevel); delete parser; parser = nullptr; } -void Gfx::go(GBool topLevel) { +void Gfx::go(bool topLevel) { Object obj; Object args[maxArgs]; int numArgs, i; @@ -729,7 +729,7 @@ void Gfx::go(GBool topLevel) { numArgs = 0; obj = parser->getObj(); while (!obj.isEOF()) { - commandAborted = gFalse; + commandAborted = false; // got a command - execute it if (obj.isCmd()) { @@ -774,7 +774,7 @@ void Gfx::go(GBool topLevel) { if (commandAborted) { // don't propogate; recursive drawing comes from Form XObjects which // should probably be drawn in a separate context anyway for caching - commandAborted = gFalse; + commandAborted = false; break; } @@ -846,7 +846,7 @@ void Gfx::execOp(Object *cmd, Object args[], int numArgs) { if (op->numArgs >= 0) { if (numArgs < op->numArgs) { error(errSyntaxError, getPos(), "Too few ({0:d}) args to '{1:s}' operator", numArgs, name); - commandAborted = gTrue; + commandAborted = true; return; } if (numArgs > op->numArgs) { @@ -898,7 +898,7 @@ Operator *Gfx::findOp(const char *name) { return &opTab[a]; } -GBool Gfx::checkArg(Object *arg, TchkType type) { +bool Gfx::checkArg(Object *arg, TchkType type) { switch (type) { case tchkBool: return arg->isBool(); case tchkInt: return arg->isInt(); @@ -908,9 +908,9 @@ GBool Gfx::checkArg(Object *arg, TchkType type) { case tchkArray: return arg->isArray(); case tchkProps: return arg->isDict() || arg->isName(); case tchkSCN: return arg->isNum() || arg->isName(); - case tchkNone: return gFalse; + case tchkNone: return false; } - return gFalse; + return false; } Goffset Gfx::getPos() { @@ -936,7 +936,7 @@ void Gfx::opConcat(Object args[], int numArgs) { out->updateCTM(state, args[0].getNum(), args[1].getNum(), args[2].getNum(), args[3].getNum(), args[4].getNum(), args[5].getNum()); - fontChanged = gTrue; + fontChanged = true; } void Gfx::opSetDash(Object args[], int numArgs) { @@ -989,11 +989,11 @@ void Gfx::opSetLineWidth(Object args[], int numArgs) { void Gfx::opSetExtGState(Object args[], int numArgs) { Object obj1, obj2; GfxBlendMode mode; - GBool haveFillOP; + bool haveFillOP; Function *funcs[4]; GfxColor backdropColor; - GBool haveBackdropColor; - GBool alpha, isolated, knockout; + bool haveBackdropColor; + bool alpha, isolated, knockout; double opac; int i; @@ -1161,9 +1161,9 @@ void Gfx::opSetExtGState(Object args[], int numArgs) { } else if (obj2.isDict()) { Object obj3 = obj2.dictLookup("S"); if (obj3.isName("Alpha")) { - alpha = gTrue; + alpha = true; } else { // "Luminosity" - alpha = gFalse; + alpha = false; } funcs[0] = nullptr; obj3 = obj2.dictLookup("TR"); @@ -1200,7 +1200,7 @@ void Gfx::opSetExtGState(Object args[], int numArgs) { Object obj4 = obj3.streamGetDict()->lookup("Group"); if (obj4.isDict()) { GfxColorSpace *blendingColorSpace = nullptr; - isolated = knockout = gFalse; + isolated = knockout = false; Object obj5 = obj4.dictLookup("CS"); if (!obj5.isNull()) { blendingColorSpace = GfxColorSpace::parse(res, &obj5, out, state); @@ -1249,7 +1249,7 @@ void Gfx::opSetExtGState(Object args[], int numArgs) { Ref r = fargs0.getRef(); font = GfxFont::makeFont(xref,args[0].getName(),r,fobj.getDict()); state->setFont(font,fargs1.getNum()); - fontChanged = gTrue; + fontChanged = true; } } } else { @@ -1296,9 +1296,9 @@ void Gfx::opSetExtGState(Object args[], int numArgs) { } } -void Gfx::doSoftMask(Object *str, GBool alpha, +void Gfx::doSoftMask(Object *str, bool alpha, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, + bool isolated, bool knockout, Function *transferFunc, GfxColor *backdropColor) { Dict *dict, *resDict; double m[6], bbox[4]; @@ -1354,7 +1354,7 @@ void Gfx::doSoftMask(Object *str, GBool alpha, // draw it ++formDepth; - drawForm(str, resDict, m, bbox, gTrue, gTrue, + drawForm(str, resDict, m, bbox, true, true, blendingColorSpace, isolated, knockout, alpha, transferFunc, backdropColor); --formDepth; @@ -1806,7 +1806,7 @@ void Gfx::opFill(Object args[], int numArgs) { if (state->isPath()) { if (ocState) { if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gFalse); + doPatternFill(false); } else { out->fill(state); } @@ -1823,7 +1823,7 @@ void Gfx::opEOFill(Object args[], int numArgs) { if (state->isPath()) { if (ocState) { if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gTrue); + doPatternFill(true); } else { out->eoFill(state); } @@ -1840,7 +1840,7 @@ void Gfx::opFillStroke(Object args[], int numArgs) { if (state->isPath()) { if (ocState) { if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gFalse); + doPatternFill(false); } else { out->fill(state); } @@ -1863,7 +1863,7 @@ void Gfx::opCloseFillStroke(Object args[], int numArgs) { state->closePath(); if (ocState) { if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gFalse); + doPatternFill(false); } else { out->fill(state); } @@ -1885,7 +1885,7 @@ void Gfx::opEOFillStroke(Object args[], int numArgs) { if (state->isPath()) { if (ocState) { if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gTrue); + doPatternFill(true); } else { out->eoFill(state); } @@ -1908,7 +1908,7 @@ void Gfx::opCloseEOFillStroke(Object args[], int numArgs) { state->closePath(); if (ocState) { if (state->getFillColorSpace()->getMode() == csPattern) { - doPatternFill(gTrue); + doPatternFill(true); } else { out->eoFill(state); } @@ -1922,7 +1922,7 @@ void Gfx::opCloseEOFillStroke(Object args[], int numArgs) { doEndPath(); } -void Gfx::doPatternFill(GBool eoFill) { +void Gfx::doPatternFill(bool eoFill) { GfxPattern *pattern; // this is a bit of a kludge -- patterns can be really slow, so we @@ -1937,10 +1937,10 @@ void Gfx::doPatternFill(GBool eoFill) { } switch (pattern->getType()) { case 1: - doTilingPatternFill((GfxTilingPattern *)pattern, gFalse, eoFill, gFalse); + doTilingPatternFill((GfxTilingPattern *)pattern, false, eoFill, false); break; case 2: - doShadingPatternFill((GfxShadingPattern *)pattern, gFalse, eoFill, gFalse); + doShadingPatternFill((GfxShadingPattern *)pattern, false, eoFill, false); break; default: error(errSyntaxError, getPos(), "Unknown pattern type ({0:d}) in fill", @@ -1964,10 +1964,10 @@ void Gfx::doPatternStroke() { } switch (pattern->getType()) { case 1: - doTilingPatternFill((GfxTilingPattern *)pattern, gTrue, gFalse, gFalse); + doTilingPatternFill((GfxTilingPattern *)pattern, true, false, false); break; case 2: - doShadingPatternFill((GfxShadingPattern *)pattern, gTrue, gFalse, gFalse); + doShadingPatternFill((GfxShadingPattern *)pattern, true, false, false); break; default: error(errSyntaxError, getPos(), "Unknown pattern type ({0:d}) in stroke", @@ -1991,10 +1991,10 @@ void Gfx::doPatternText() { } switch (pattern->getType()) { case 1: - doTilingPatternFill((GfxTilingPattern *)pattern, gFalse, gFalse, gTrue); + doTilingPatternFill((GfxTilingPattern *)pattern, false, false, true); break; case 2: - doShadingPatternFill((GfxShadingPattern *)pattern, gFalse, gFalse, gTrue); + doShadingPatternFill((GfxShadingPattern *)pattern, false, false, true); break; default: error(errSyntaxError, getPos(), "Unknown pattern type ({0:d}) in fill", @@ -2004,7 +2004,7 @@ void Gfx::doPatternText() { } void Gfx::doPatternImageMask(Object *ref, Stream *str, int width, int height, - GBool invert, GBool inlineImg) { + bool invert, bool inlineImg) { saveState(); out->setSoftMaskFromImageMask(state, ref, str, @@ -2023,7 +2023,7 @@ void Gfx::doPatternImageMask(Object *ref, Stream *str, int width, int height, } void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, - GBool stroke, GBool eoFill, GBool text) { + bool stroke, bool eoFill, bool text) { GfxPatternColorSpace *patCS; GfxColorSpace *cs; GfxColor color; @@ -2207,14 +2207,14 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, m1[4] = m[4]; m1[5] = m[5]; { - bool shouldDrawPattern = gTrue; + bool shouldDrawPattern = true; std::set<int>::iterator patternRefIt; const int patternRefNum = tPat->getPatternRefNum(); if (patternRefNum != -1) { if (formsDrawing.find(patternRefNum) == formsDrawing.end()) { patternRefIt = formsDrawing.insert(patternRefNum).first; } else { - shouldDrawPattern = gFalse; + shouldDrawPattern = false; } } if (shouldDrawPattern) { @@ -2250,7 +2250,7 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, } void Gfx::doShadingPatternFill(GfxShadingPattern *sPat, - GBool stroke, GBool eoFill, GBool text) { + bool stroke, bool eoFill, bool text) { GfxShading *shading; GfxState *savedState; const double *ctm, *btm, *ptm; @@ -2346,9 +2346,9 @@ void Gfx::doShadingPatternFill(GfxShadingPattern *sPat, } #if 1 //~tmp: turn off anti-aliasing temporarily - GBool vaa = out->getVectorAntialias(); + bool vaa = out->getVectorAntialias(); if (vaa) { - out->setVectorAntialias(gFalse); + out->setVectorAntialias(false); } #endif @@ -2375,7 +2375,7 @@ void Gfx::doShadingPatternFill(GfxShadingPattern *sPat, #if 1 //~tmp: turn off anti-aliasing temporarily if (vaa) { - out->setVectorAntialias(gTrue); + out->setVectorAntialias(true); } #endif @@ -2417,9 +2417,9 @@ void Gfx::opShFill(Object args[], int numArgs) { out->updateFillColorSpace(state); #if 1 //~tmp: turn off anti-aliasing temporarily - GBool vaa = out->getVectorAntialias(); + bool vaa = out->getVectorAntialias(); if (vaa) { - out->setVectorAntialias(gFalse); + out->setVectorAntialias(false); } #endif @@ -2446,7 +2446,7 @@ void Gfx::opShFill(Object args[], int numArgs) { #if 1 //~tmp: turn off anti-aliasing temporarily if (vaa) { - out->setVectorAntialias(gTrue); + out->setVectorAntialias(true); } #endif @@ -2599,7 +2599,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { double xMin, yMin, xMax, yMax; double x0, y0, x1, y1; double dx, dy, mul; - GBool dxZero, dyZero; + bool dxZero, dyZero; double bboxIntersections[4]; double tMin, tMax, tx, ty; double s[4], sMin, sMax, tmp; @@ -2610,7 +2610,7 @@ void Gfx::doAxialShFill(GfxAxialShading *shading) { GfxColor color0 = {}, color1 = {}; int nComps; int i, j, k; - GBool needExtend = gTrue; + bool needExtend = true; // get the clip region bbox state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); @@ -2911,10 +2911,10 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) { double xa, ya, xb, yb, ra, rb; double ta, tb, sa, sb; double sz, xz, yz, sMin, sMax; - GBool enclosed; + bool enclosed; int ia, ib, k, n; double theta, alpha, angle, t; - GBool needExtend = gTrue; + bool needExtend = true; // get the shading info shading->getCoords(&x0, &y0, &r0, &x1, &y1, &r1); @@ -2925,11 +2925,11 @@ void Gfx::doRadialShFill(GfxRadialShading *shading) { // Compute the point at which r(s) = 0; check for the enclosed // circles case; and compute the angles for the tangent lines. if (x0 == x1 && y0 == y1) { - enclosed = gTrue; + enclosed = true; theta = 0; // make gcc happy sz = 0; // make gcc happy } else if (r0 == r1) { - enclosed = gFalse; + enclosed = false; theta = 0; sz = 0; // make gcc happy } else { @@ -3644,7 +3644,7 @@ void Gfx::opBeginText(Object args[], int numArgs) { state->textMoveTo(0, 0); out->updateTextMat(state); out->updateTextPos(state); - fontChanged = gTrue; + fontChanged = true; } void Gfx::opEndText(Object args[], int numArgs) { @@ -3667,7 +3667,7 @@ void Gfx::opSetFont(Object args[], int numArgs) { // unsetting the font (drawing no text) is better than using the // previous one and drawing random glyphs from it state->setFont(nullptr, args[1].getNum()); - fontChanged = gTrue; + fontChanged = true; return; } if (printCommands) { @@ -3680,7 +3680,7 @@ void Gfx::opSetFont(Object args[], int numArgs) { font->incRefCnt(); state->setFont(font, args[1].getNum()); - fontChanged = gTrue; + fontChanged = true; } void Gfx::opSetTextLeading(Object args[], int numArgs) { @@ -3705,7 +3705,7 @@ void Gfx::opSetWordSpacing(Object args[], int numArgs) { void Gfx::opSetHorizScaling(Object args[], int numArgs) { state->setHorizScaling(args[0].getNum()); out->updateHorizScaling(state); - fontChanged = gTrue; + fontChanged = true; } //------------------------------------------------------------------------ @@ -3739,7 +3739,7 @@ void Gfx::opSetTextMatrix(Object args[], int numArgs) { state->textMoveTo(0, 0); out->updateTextMat(state); out->updateTextPos(state); - fontChanged = gTrue; + fontChanged = true; } void Gfx::opTextNextLine(Object args[], int numArgs) { @@ -3762,7 +3762,7 @@ void Gfx::opShowText(Object args[], int numArgs) { } if (fontChanged) { out->updateFont(state); - fontChanged = gFalse; + fontChanged = false; } out->beginStringOp(state); doShowText(args[0].getString()); @@ -3781,7 +3781,7 @@ void Gfx::opMoveShowText(Object args[], int numArgs) { } if (fontChanged) { out->updateFont(state); - fontChanged = gFalse; + fontChanged = false; } tx = state->getLineX(); ty = state->getLineY() - state->getLeading(); @@ -3804,7 +3804,7 @@ void Gfx::opMoveSetShowText(Object args[], int numArgs) { } if (fontChanged) { out->updateFont(state); - fontChanged = gFalse; + fontChanged = false; } state->setWordSpace(args[0].getNum()); state->setCharSpace(args[1].getNum()); @@ -3833,7 +3833,7 @@ void Gfx::opShowSpaceText(Object args[], int numArgs) { } if (fontChanged) { out->updateFont(state); - fontChanged = gFalse; + fontChanged = false; } out->beginStringOp(state); wMode = state->getFont()->getWMode(); @@ -3887,7 +3887,7 @@ void Gfx::doShowText(const GooString *s) { GfxState *savedState; const char *p; int render; - GBool patternFill; + bool patternFill; int len, n, uLen, nChars, nSpaces; font = state->getFont(); @@ -3901,7 +3901,7 @@ void Gfx::doShowText(const GooString *s) { render = state->getRender(); if (!(render & 1) && state->getFillColorSpace()->getMode() == csPattern) { - patternFill = gTrue; + patternFill = true; saveState(); // disable fill, enable clipping, leave stroke unchanged if ((render ^ (render >> 1)) & 1) { @@ -3912,7 +3912,7 @@ void Gfx::doShowText(const GooString *s) { state->setRender(render); out->updateRender(state); } else { - patternFill = gFalse; + patternFill = false; } state->textTransformDelta(0, state->getRise(), &riseX, &riseY); @@ -3983,7 +3983,7 @@ void Gfx::doShowText(const GooString *s) { } } if (displayCharProc) { - display(&charProc, gFalse); + display(&charProc, false); if (refNum != -1) { charProcDrawing.erase(charProcDrawingIt); @@ -4157,18 +4157,18 @@ void Gfx::opXObject(Object args[], int numArgs) { if (obj2.isName("Image")) { if (out->needNonText()) { Object refObj = res->lookupXObjectNF(name); - doImage(&refObj, obj1.getStream(), gFalse); + doImage(&refObj, obj1.getStream(), false); } } else if (obj2.isName("Form")) { Object refObj = res->lookupXObjectNF(name); - GBool shouldDoForm = gTrue; + bool shouldDoForm = true; std::set<int>::iterator drawingFormIt; if (refObj.isRef()) { const int num = refObj.getRef().num; if (formsDrawing.find(num) == formsDrawing.end()) { drawingFormIt = formsDrawing.insert(num).first; } else { - shouldDoForm = gFalse; + shouldDoForm = false; } } if (shouldDoForm) { @@ -4197,20 +4197,20 @@ void Gfx::opXObject(Object args[], int numArgs) { #endif } -void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { +void Gfx::doImage(Object *ref, Stream *str, bool inlineImg) { Dict *dict, *maskDict; int width, height; int bits, maskBits; - GBool interpolate; + bool interpolate; StreamColorSpaceMode csMode; - GBool mask; - GBool invert; + bool mask; + bool invert; GfxColorSpace *colorSpace, *maskColorSpace; - GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; + bool haveColorKeyMask, haveExplicitMask, haveSoftMask; int maskColors[2*gfxColorMaxComps] = {}; int maskWidth, maskHeight; - GBool maskInvert; - GBool maskInterpolate; + bool maskInvert; + bool maskInterpolate; Stream *maskStr; Object obj1; int i, n; @@ -4264,15 +4264,15 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (obj1.isBool()) interpolate = obj1.getBool(); else - interpolate = gFalse; - maskInterpolate = gFalse; + interpolate = false; + maskInterpolate = false; // image or mask? obj1 = dict->lookup("ImageMask"); if (obj1.isNull()) { obj1 = dict->lookup("IM"); } - mask = gFalse; + mask = false; if (obj1.isBool()) mask = obj1.getBool(); else if (!obj1.isNull()) @@ -4299,7 +4299,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // check for inverted mask if (bits != 1) goto err1; - invert = gFalse; + invert = false; obj1 = dict->lookup("Decode"); if (obj1.isNull()) { obj1 = dict->lookup("D"); @@ -4310,7 +4310,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // Table 4.39 says /Decode must be [1 0] or [0 1]. Adobe // accepts [1.0 0.0] as well. if (obj2.isNum() && obj2.getNum() >= 0.9) - invert = gTrue; + invert = true; } else if (!obj1.isNull()) { goto err1; } @@ -4400,10 +4400,10 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } // get the mask - haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; + haveColorKeyMask = haveExplicitMask = haveSoftMask = false; maskStr = nullptr; // make gcc happy maskWidth = maskHeight = 0; // make gcc happy - maskInvert = gFalse; // make gcc happy + maskInvert = false; // make gcc happy std::unique_ptr<GfxImageColorMap> maskColorMap; Object maskObj = dict->lookup("Mask"); Object smaskObj = dict->lookup("SMask"); @@ -4437,7 +4437,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (obj1.isBool()) maskInterpolate = obj1.getBool(); else - maskInterpolate = gFalse; + maskInterpolate = false; obj1 = maskDict->lookup("BitsPerComponent"); if (obj1.isNull()) { obj1 = maskDict->lookup("BPC"); @@ -4494,7 +4494,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { } } } - haveSoftMask = gTrue; + haveSoftMask = true; } else if (maskObj.isArray()) { // color key mask for (i = 0; @@ -4511,7 +4511,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { goto err1; } } - haveColorKeyMask = gTrue; + haveColorKeyMask = true; } else if (maskObj.isStream()) { // explicit mask if (inlineImg) { @@ -4542,7 +4542,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (obj1.isBool()) maskInterpolate = obj1.getBool(); else - maskInterpolate = gFalse; + maskInterpolate = false; obj1 = maskDict->lookup("ImageMask"); if (obj1.isNull()) { obj1 = maskDict->lookup("IM"); @@ -4550,7 +4550,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { if (!obj1.isBool() || !obj1.getBool()) { goto err1; } - maskInvert = gFalse; + maskInvert = false; obj1 = maskDict->lookup("Decode"); if (obj1.isNull()) { obj1 = maskDict->lookup("D"); @@ -4560,12 +4560,12 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { // Table 4.39 says /Decode must be [1 0] or [0 1]. Adobe // accepts [1.0 0.0] as well. if (obj2.isNum() && obj2.getNum() >= 0.9) { - maskInvert = gTrue; + maskInvert = true; } } else if (!obj1.isNull()) { goto err1; } - haveExplicitMask = gTrue; + haveExplicitMask = true; } // if drawing is disabled, skip over inline image data @@ -4604,14 +4604,14 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { error(errSyntaxError, getPos(), "Bad image parameters"); } -GBool Gfx::checkTransparencyGroup(Dict *resDict) { +bool Gfx::checkTransparencyGroup(Dict *resDict) { // check the effect of compositing objects as a group: // look for ExtGState entries with ca != 1 or CA != 1 or BM != normal - GBool transpGroup = gFalse; + bool transpGroup = false; double opac; if (resDict == nullptr) - return gFalse; + return false; pushResources(resDict); Object extGStates = resDict->lookup("ExtGState"); if (extGStates.isDict()) { @@ -4625,7 +4625,7 @@ GBool Gfx::checkTransparencyGroup(Dict *resDict) { if (!obj2.isNull()) { if (state->parseBlendMode(&obj2, &mode)) { if (mode != gfxBlendNormal) - transpGroup = gTrue; + transpGroup = true; } else { error(errSyntaxError, getPos(), "Invalid blend mode in ExtGState"); } @@ -4635,14 +4635,14 @@ GBool Gfx::checkTransparencyGroup(Dict *resDict) { opac = obj2.getNum(); opac = opac < 0 ? 0 : opac > 1 ? 1 : opac; if (opac != 1) - transpGroup = gTrue; + transpGroup = true; } obj2 = obj1.dictLookup("CA"); if (obj2.isNum()) { opac = obj2.getNum(); opac = opac < 0 ? 0 : opac > 1 ? 1 : opac; if (opac != 1) - transpGroup = gTrue; + transpGroup = true; } // alpha is shape obj2 = obj1.dictLookup("AIS"); @@ -4653,7 +4653,7 @@ GBool Gfx::checkTransparencyGroup(Dict *resDict) { obj2 = obj1.dictLookup("SMask"); if (!transpGroup && !obj2.isNull()) { if (!obj2.isName("None")) { - transpGroup = gTrue; + transpGroup = true; } } } @@ -4665,11 +4665,11 @@ GBool Gfx::checkTransparencyGroup(Dict *resDict) { void Gfx::doForm(Object *str) { Dict *dict; - GBool transpGroup, isolated, knockout; + bool transpGroup, isolated, knockout; GfxColorSpace *blendingColorSpace; double m[6], bbox[4]; Dict *resDict; - GBool ocSaved; + bool ocSaved; Object obj1; int i; @@ -4692,7 +4692,7 @@ void Gfx::doForm(Object *str) { obj1 = dict->lookupNF("OC"); if (catalog->getOptContentConfig() && !catalog->getOptContentConfig()->optContentIsVisible(&obj1)) { if (out->needCharCount()) { - ocState = gFalse; + ocState = false; } else { return; } @@ -4734,7 +4734,7 @@ void Gfx::doForm(Object *str) { resDict = resObj.isDict() ? resObj.getDict() : nullptr; // check for a transparency group - transpGroup = isolated = knockout = gFalse; + transpGroup = isolated = knockout = false; blendingColorSpace = nullptr; obj1 = dict->lookup("Group"); if (obj1.isDict()) { @@ -4759,7 +4759,7 @@ void Gfx::doForm(Object *str) { // draw it ++formDepth; drawForm(str, resDict, m, bbox, - transpGroup, gFalse, blendingColorSpace, isolated, knockout); + transpGroup, false, blendingColorSpace, isolated, knockout); --formDepth; if (blendingColorSpace) { @@ -4770,10 +4770,10 @@ void Gfx::doForm(Object *str) { } void Gfx::drawForm(Object *str, Dict *resDict, const double *matrix, const double *bbox, - GBool transpGroup, GBool softMask, + bool transpGroup, bool softMask, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, - GBool alpha, Function *transferFunc, + bool isolated, bool knockout, + bool alpha, Function *transferFunc, GfxColor *backdropColor) { Parser *oldParser; GfxState *savedState; @@ -4835,7 +4835,7 @@ void Gfx::drawForm(Object *str, Dict *resDict, const double *matrix, const doubl GfxState *stateBefore = state; // draw the form - display(str, gFalse); + display(str, false); if (stateBefore != state) { if (state->isParentState(stateBefore)) { @@ -4891,7 +4891,7 @@ void Gfx::opBeginImage(Object args[], int numArgs) { // display the image if (str) { - doImage(nullptr, str, gTrue); + doImage(nullptr, str, true); // skip 'EI' tag c1 = str->getUndecodedStream()->getChar(); @@ -4929,7 +4929,7 @@ Stream *Gfx::buildImageStream() { // make stream if (parser->getStream()) { - str = new EmbedStream(parser->getStream(), std::move(dict), gFalse, 0, gTrue); + str = new EmbedStream(parser->getStream(), std::move(dict), false, 0, true); str = str->addFilters(str->getDict()); } else { str = nullptr; @@ -4985,7 +4985,7 @@ enum GfxMarkedContentKind { struct MarkedContentStack { GfxMarkedContentKind kind; - GBool ocSuppressed; // are we ignoring content based on OptionalContent? + bool ocSuppressed; // are we ignoring content based on OptionalContent? MarkedContentStack *next; // next object on stack }; @@ -4997,13 +4997,13 @@ void Gfx::popMarkedContent() { void Gfx::pushMarkedContent() { MarkedContentStack *mc = new MarkedContentStack(); - mc->ocSuppressed = gFalse; + mc->ocSuppressed = false; mc->kind = gfxMCOther; mc->next = mcStack; mcStack = mc; } -GBool Gfx::contentIsHidden() { +bool Gfx::contentIsHidden() { MarkedContentStack *mc = mcStack; bool hidden = mc && mc->ocSuppressed; while (!hidden && mc && mc->next) { @@ -5345,7 +5345,7 @@ void Gfx::saveState() { void Gfx::restoreState() { if (stackHeight <= bottomGuard() || !state->hasSaves()) { error(errSyntaxError, -1, "Restoring state when no valid states to pop"); - commandAborted = gTrue; + commandAborted = true; return; } state = state->restore(); @@ -5360,7 +5360,7 @@ GfxState *Gfx::saveStateStack() { out->saveState(state); oldState = state; - state = state->copy(gTrue); + state = state->copy(true); return oldState; } diff --git a/poppler/Gfx.h b/poppler/Gfx.h index d25411e0..f966e8f6 100644 --- a/poppler/Gfx.h +++ b/poppler/Gfx.h @@ -152,13 +152,13 @@ public: Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, double hDPI, double vDPI, const PDFRectangle *box, const PDFRectangle *cropBox, int rotate, - GBool (*abortCheckCbkA)(void *data) = nullptr, + bool (*abortCheckCbkA)(void *data) = nullptr, void *abortCheckCbkDataA = nullptr, XRef *xrefA = nullptr); // Constructor for a sub-page object. Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, const PDFRectangle *box, const PDFRectangle *cropBox, - GBool (*abortCheckCbkA)(void *data) = nullptr, + bool (*abortCheckCbkA)(void *data) = nullptr, void *abortCheckCbkDataA = nullptr, Gfx *gfxA = nullptr); #ifdef USE_CMS void initDisplayProfile(); @@ -171,7 +171,7 @@ public: XRef *getXRef() { return xref; } // Interpret a stream or array of streams. - void display(Object *obj, GBool topLevel = gTrue); + void display(Object *obj, bool topLevel = true); // Display an annotation, given its appearance (a Form XObject), // border style, and bounding box (in default user space). @@ -193,13 +193,13 @@ public: // Get the current graphics state object. GfxState *getState() { return state; } - GBool checkTransparencyGroup(Dict *resDict); + bool checkTransparencyGroup(Dict *resDict); void drawForm(Object *str, Dict *resDict, const double *matrix, const double *bbox, - GBool transpGroup = gFalse, GBool softMask = gFalse, + bool transpGroup = false, bool softMask = false, GfxColorSpace *blendingColorSpace = nullptr, - GBool isolated = gFalse, GBool knockout = gFalse, - GBool alpha = gFalse, Function *transferFunc = nullptr, + bool isolated = false, bool knockout = false, + bool alpha = false, Function *transferFunc = nullptr, GfxColor *backdropColor = nullptr); void pushResources(Dict *resDict); @@ -211,23 +211,23 @@ private: XRef *xref; // the xref table for this PDF file Catalog *catalog; // the Catalog for this PDF file OutputDev *out; // output device - GBool subPage; // is this a sub-page object? - GBool printCommands; // print the drawing commands (for debugging) - GBool profileCommands; // profile the drawing commands (for debugging) - GBool commandAborted; // did the previous command abort the drawing? + bool subPage; // is this a sub-page object? + bool printCommands; // print the drawing commands (for debugging) + bool profileCommands; // profile the drawing commands (for debugging) + bool commandAborted; // did the previous command abort the drawing? GfxResources *res; // resource stack int updateLevel; GfxState *state; // current graphics state int stackHeight; // the height of the current graphics stack std::vector<int> stateGuards; // a stack of state limits; to guard against unmatched pops - GBool fontChanged; // set if font or text matrix has changed + bool fontChanged; // set if font or text matrix has changed GfxClipType clip; // do a clip? int ignoreUndef; // current BX/EX nesting level double baseMatrix[6]; // default matrix for most recent // page/form/pattern int formDepth; - GBool ocState; // true if drawing is enabled, false if + bool ocState; // true if drawing is enabled, false if // disabled MarkedContentStack *mcStack; // current BMC/EMC stack @@ -237,16 +237,16 @@ private: std::set<int> formsDrawing; // the forms/patterns that are being drawn std::set<int> charProcDrawing; // the charProc that are being drawn - GBool // callback to check for an abort + bool // callback to check for an abort (*abortCheckCbk)(void *data); void *abortCheckCbkData; static Operator opTab[]; // table of operators - void go(GBool topLevel); + void go(bool topLevel); void execOp(Object *cmd, Object args[], int numArgs); Operator *findOp(const char *name); - GBool checkArg(Object *arg, TchkType type); + bool checkArg(Object *arg, TchkType type); Goffset getPos(); int bottomGuard(); @@ -262,9 +262,9 @@ private: void opSetMiterLimit(Object args[], int numArgs); void opSetLineWidth(Object args[], int numArgs); void opSetExtGState(Object args[], int numArgs); - void doSoftMask(Object *str, GBool alpha, + void doSoftMask(Object *str, bool alpha, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, + bool isolated, bool knockout, Function *transferFunc, GfxColor *backdropColor); void opSetRenderingIntent(Object args[], int numArgs); @@ -301,15 +301,15 @@ private: void opCloseFillStroke(Object args[], int numArgs); void opEOFillStroke(Object args[], int numArgs); void opCloseEOFillStroke(Object args[], int numArgs); - void doPatternFill(GBool eoFill); + void doPatternFill(bool eoFill); void doPatternStroke(); void doPatternText(); void doPatternImageMask(Object *ref, Stream *str, int width, int height, - GBool invert, GBool inlineImg); + bool invert, bool inlineImg); void doTilingPatternFill(GfxTilingPattern *tPat, - GBool stroke, GBool eoFill, GBool text); + bool stroke, bool eoFill, bool text); void doShadingPatternFill(GfxShadingPattern *sPat, - GBool stroke, GBool eoFill, GBool text); + bool stroke, bool eoFill, bool text); void opShFill(Object args[], int numArgs); void doFunctionShFill(GfxFunctionShading *shading); void doFunctionShFill1(GfxFunctionShading *shading, @@ -364,7 +364,7 @@ private: // XObject operators void opXObject(Object args[], int numArgs); - void doImage(Object *ref, Stream *str, GBool inlineImg); + void doImage(Object *ref, Stream *str, bool inlineImg); void doForm(Object *str); // in-line image operators @@ -387,7 +387,7 @@ private: void opMarkPoint(Object args[], int numArgs); GfxState *saveStateStack(); void restoreStateStack(GfxState *oldState); - GBool contentIsHidden(); + bool contentIsHidden(); void pushMarkedContent(); void popMarkedContent(); }; diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index 20388519..a23d46f3 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -170,8 +170,8 @@ static const char *base14SubstFonts[14] = { //------------------------------------------------------------------------ static int parseCharName(char *charName, Unicode *uBuf, int uLen, - GBool names, GBool ligatures, - GBool numeric, GBool hex, GBool variants); + bool names, bool ligatures, + bool numeric, bool hex, bool variants); //------------------------------------------------------------------------ @@ -234,7 +234,7 @@ GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict GfxFont::GfxFont(const char *tagA, Ref idA, GooString *nameA, GfxFontType typeA, Ref embFontIDA) { - ok = gFalse; + ok = false; tag = new GooString(tagA); id = idA; name = nameA; @@ -246,7 +246,7 @@ GfxFont::GfxFont(const char *tagA, Ref idA, GooString *nameA, weight = WeightNotDefined; refCnt = 1; encodingName = new GooString(""); - hasToUnicode = gFalse; + hasToUnicode = false; } GfxFont::~GfxFont() { @@ -286,15 +286,15 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { GfxFontType t, expectedType; FoFiIdentifierType fft; Dict *fontDict2; - GBool isType0, err; + bool isType0, err; t = fontUnknownType; embID->num = embID->gen = -1; - err = gFalse; + err = false; Object subtype = fontDict->lookup("Subtype"); expectedType = fontUnknownType; - isType0 = gFalse; + isType0 = false; if (subtype.isName("Type1") || subtype.isName("MMType1")) { expectedType = fontType1; } else if (subtype.isName("Type1C")) { @@ -304,7 +304,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { } else if (subtype.isName("TrueType")) { expectedType = fontTrueType; } else if (subtype.isName("Type0")) { - isType0 = gTrue; + isType0 = true; } else { error(errSyntaxWarning, -1, "Unknown font type: '{0:s}'", subtype.isName() ? subtype.getName() : "???"); @@ -344,7 +344,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { if (obj3.isRef()) { *embID = obj3.getRef(); if (expectedType != fontType1) { - err = gTrue; + err = true; } } if (embID->num == -1 && (obj3 = fontDesc.dictLookupNF("FontFile2"), obj3.isRef())) { @@ -352,7 +352,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { if (isType0) { expectedType = fontCIDType2; } else if (expectedType != fontTrueType) { - err = gTrue; + err = true; } } if (embID->num == -1 && (obj3 = fontDesc.dictLookupNF("FontFile3"), obj3.isRef())) { @@ -362,26 +362,26 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { subtype = obj4.streamGetDict()->lookup("Subtype"); if (subtype.isName("Type1")) { if (expectedType != fontType1) { - err = gTrue; + err = true; expectedType = isType0 ? fontCIDType0 : fontType1; } } else if (subtype.isName("Type1C")) { if (expectedType == fontType1) { expectedType = fontType1C; } else if (expectedType != fontType1C) { - err = gTrue; + err = true; expectedType = isType0 ? fontCIDType0C : fontType1C; } } else if (subtype.isName("TrueType")) { if (expectedType != fontTrueType) { - err = gTrue; + err = true; expectedType = isType0 ? fontCIDType2 : fontTrueType; } } else if (subtype.isName("CIDFontType0C")) { if (expectedType == fontCIDType0) { expectedType = fontCIDType0C; } else { - err = gTrue; + err = true; expectedType = isType0 ? fontCIDType0C : fontType1C; } } else if (subtype.isName("OpenType")) { @@ -394,7 +394,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { } else if (expectedType == fontCIDType2) { expectedType = fontCIDType2OT; } else { - err = gTrue; + err = true; } } else { error(errSyntaxError, -1, "Unknown font type '{0:s}'", @@ -445,7 +445,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { } if (t != expectedType) { - err = gTrue; + err = true; } if (err) { @@ -583,7 +583,7 @@ CharCodeToUnicode *GfxFont::readToUnicodeCMap(Dict *fontDict, int nBits, } else { ctu = CharCodeToUnicode::parseCMap(buf, nBits); } - hasToUnicode = gTrue; + hasToUnicode = true; delete buf; return ctu; } @@ -593,7 +593,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { SysFontType sysFontType; GooString *path, *base14Name, *substName; int substIdx, fontNum; - GBool embed; + bool embed; if (type == fontType3) { return nullptr; @@ -601,12 +601,12 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { //----- embedded font if (embFontID.num >= 0) { - embed = gTrue; + embed = true; Object refObj(embFontID.num, embFontID.gen); Object embFontObj = refObj.fetch(xref); if (!embFontObj.isStream()) { error(errSyntaxError, -1, "Embedded font object is wrong type"); - embed = gFalse; + embed = false; } if (embed) { if (ps) { @@ -671,7 +671,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { if (!ps && !isCIDFont() && ((Gfx8BitFont *)this)->base14) { base14Name = new GooString(((Gfx8BitFont *)this)->base14->base14Name); if ((path = globalParams->findBase14FontFile(base14Name, this))) { - if ((fontLoc = getExternalFont(path, gFalse))) { + if ((fontLoc = getExternalFont(path, false))) { delete base14Name; return fontLoc; } @@ -740,7 +740,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { path = globalParams->findFontFile(substName); delete substName; if (path) { - if ((fontLoc = getExternalFont(path, gFalse))) { + if ((fontLoc = getExternalFont(path, false))) { error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'", base14SubstFonts[substIdx], name ? name->getCString() : ""); name = new GooString(base14SubstFonts[substIdx]); @@ -765,10 +765,10 @@ GfxFontLoc *GfxFont::locateBase14Font(GooString *base14Name) { if (!path) { return nullptr; } - return getExternalFont(path, gFalse); + return getExternalFont(path, false); } -GfxFontLoc *GfxFont::getExternalFont(GooString *path, GBool cid) { +GfxFontLoc *GfxFont::getExternalFont(GooString *path, bool cid) { FoFiIdentifierType fft; GfxFontType fontType; GfxFontLoc *fontLoc; @@ -868,7 +868,7 @@ const char *GfxFont::getAlternateName(const char *name) { // Parse character names of the form 'Axx', 'xx', 'Ann', 'ABnn', or // 'nn', where 'A' and 'B' are any letters, 'xx' is two hex digits, // and 'nn' is decimal digits. -static GBool parseNumericName(const char *s, GBool hex, unsigned int *u) { +static bool parseNumericName(const char *s, bool hex, unsigned int *u) { char *endptr; // Strip leading alpha characters. @@ -883,7 +883,7 @@ static GBool parseNumericName(const char *s, GBool hex, unsigned int *u) { if (n == 3 && isalpha(*s)) { ++s; } else if (n != 2) { - return gFalse; + return false; } } else { // Strip up to two alpha characters. @@ -894,7 +894,7 @@ static GBool parseNumericName(const char *s, GBool hex, unsigned int *u) { int v = strtol(s, &endptr, hex ? 16 : 10); if (endptr == s) - return gFalse; + return false; // Skip trailing junk characters. while (*endptr != '\0' && !isalnum(*endptr)) @@ -903,24 +903,24 @@ static GBool parseNumericName(const char *s, GBool hex, unsigned int *u) { if (*endptr == '\0') { if (u) *u = v; - return gTrue; + return true; } - return gFalse; + return false; } -// Returns gTrue if the font has character names like xx or Axx which +// Returns true if the font has character names like xx or Axx which // should be parsed for hex or decimal values. -static GBool testForNumericNames(Dict *fontDict, GBool hex) { - GBool numeric = gTrue; +static bool testForNumericNames(Dict *fontDict, bool hex) { + bool numeric = true; Object enc = fontDict->lookup("Encoding"); if (!enc.isDict()) { - return gFalse; + return false; } Object diff = enc.dictLookup("Differences"); if (!diff.isArray()) { - return gFalse; + return false; } for (int i = 0; i < diff.arrayGetLength() && numeric; ++i) { @@ -928,13 +928,13 @@ static GBool testForNumericNames(Dict *fontDict, GBool hex) { if (obj.isInt()) { // All sequences must start between character codes 0 and 5. if (obj.getInt() > 5) - numeric = gFalse; + numeric = false; } else if (obj.isName()) { // All character names must sucessfully parse. if (!parseNumericName(obj.getName(), hex, nullptr)) - numeric = gFalse; + numeric = false; } else { - numeric = gFalse; + numeric = false; } } @@ -947,15 +947,15 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA GooString *name2; BuiltinFont *builtinFont; const char **baseEnc; - GBool baseEncFromFontFile; + bool baseEncFromFontFile; char *buf; int len; FoFiType1 *ffT1; FoFiType1C *ffT1C; int code; char *charName; - GBool missing, hex; - GBool numeric; + bool missing, hex; + bool numeric; Unicode toUnicode[256]; Unicode uBuf[8]; double mul; @@ -1087,33 +1087,33 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA // FontDict.Encoding.Differences. // check FontDict for base encoding - hasEncoding = gFalse; - usesMacRomanEnc = gFalse; + hasEncoding = false; + usesMacRomanEnc = false; baseEnc = nullptr; - baseEncFromFontFile = gFalse; + baseEncFromFontFile = false; obj1 = fontDict->lookup("Encoding"); if (obj1.isDict()) { Object obj2 = obj1.dictLookup("BaseEncoding"); if (obj2.isName("MacRomanEncoding")) { - hasEncoding = gTrue; - usesMacRomanEnc = gTrue; + hasEncoding = true; + usesMacRomanEnc = true; baseEnc = macRomanEncoding; } else if (obj2.isName("MacExpertEncoding")) { - hasEncoding = gTrue; + hasEncoding = true; baseEnc = macExpertEncoding; } else if (obj2.isName("WinAnsiEncoding")) { - hasEncoding = gTrue; + hasEncoding = true; baseEnc = winAnsiEncoding; } } else if (obj1.isName("MacRomanEncoding")) { - hasEncoding = gTrue; - usesMacRomanEnc = gTrue; + hasEncoding = true; + usesMacRomanEnc = true; baseEnc = macRomanEncoding; } else if (obj1.isName("MacExpertEncoding")) { - hasEncoding = gTrue; + hasEncoding = true; baseEnc = macExpertEncoding; } else if (obj1.isName("WinAnsiEncoding")) { - hasEncoding = gTrue; + hasEncoding = true; baseEnc = winAnsiEncoding; } @@ -1134,7 +1134,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA } if (!baseEnc) { baseEnc = (const char **)ffT1->getEncoding(); - baseEncFromFontFile = gTrue; + baseEncFromFontFile = true; } } gfree(buf); @@ -1150,7 +1150,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA } if (!baseEnc) { baseEnc = (const char **)ffT1C->getEncoding(); - baseEncFromFontFile = gTrue; + baseEncFromFontFile = true; } } gfree(buf); @@ -1161,7 +1161,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA if (!baseEnc) { if (builtinFont && embFontID.num < 0) { baseEnc = builtinFont->defaultBaseEnc; - hasEncoding = gTrue; + hasEncoding = true; } else if (type == fontTrueType) { baseEnc = winAnsiEncoding; } else { @@ -1201,7 +1201,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA for (i = 0; i < 256; ++i) { if (!enc[i] && standardEncoding[i]) { enc[i] = (char *)standardEncoding[i]; - encFree[i] = gFalse; + encFree[i] = false; } } } @@ -1211,7 +1211,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA Object obj2 = obj1.dictLookup("Differences"); if (obj2.isArray()) { encodingName->Set("Custom"); - hasEncoding = gTrue; + hasEncoding = true; code = 0; for (i = 0; i < obj2.arrayGetLength(); ++i) { Object obj3 = obj2.arrayGet(i); @@ -1223,7 +1223,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA gfree(enc[code]); } enc[code] = copyString(obj3.getName()); - encFree[code] = gTrue; + encFree[code] = true; } ++code; } else { @@ -1240,8 +1240,8 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA //----- build the mapping to Unicode ----- // pass 1: use the name-to-Unicode mapping table - missing = hex = gFalse; - GBool isZapfDingbats = name && name->endsWith("ZapfDingbats"); + missing = hex = false; + bool isZapfDingbats = name && name->endsWith("ZapfDingbats"); for (code = 0; code < 256; ++code) { if ((charName = enc[code])) { if (isZapfDingbats) { @@ -1267,9 +1267,9 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA // number like a0 ((charName[1] >= 'a' && charName[1] <= 'f') || (charName[1] >= 'A' && charName[1] <= 'F')))) { - hex = gTrue; + hex = true; } - missing = gTrue; + missing = true; } } else { toUnicode[code] = 0; @@ -1299,11 +1299,11 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA if (!toUnicode[code]) { if ((charName = enc[code]) && strcmp(charName, ".notdef") && (n = parseCharName(charName, uBuf, sizeof(uBuf)/sizeof(*uBuf), - gFalse, // don't check simple names (pass 1) - gTrue, // do check ligatures + false, // don't check simple names (pass 1) + true, // do check ligatures numeric, hex, - gTrue))) { // do check variants + true))) { // do check variants ctu->setMapping((CharCode)code, uBuf, n); continue; } @@ -1401,7 +1401,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA } } - ok = gTrue; + ok = true; } Gfx8BitFont::~Gfx8BitFont() { @@ -1420,8 +1420,8 @@ Gfx8BitFont::~Gfx8BitFont() { // Algorithmic comments are excerpted from that document to aid // maintainability. static int parseCharName(char *charName, Unicode *uBuf, int uLen, - GBool names, GBool ligatures, - GBool numeric, GBool hex, GBool variants) + bool names, bool ligatures, + bool numeric, bool hex, bool variants) { if (uLen <= 0) { error(errInternal, -1, "Zero-length output buffer (recursion overflow?) in " @@ -1437,7 +1437,7 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen, } else if (var_part != nullptr) { // parse names of the form 7.oldstyle, P.swash, s.sc, etc. char *main_part = copyString(charName, var_part - charName); - GBool namesRecurse = gTrue, variantsRecurse = gFalse; + bool namesRecurse = true, variantsRecurse = false; int n = parseCharName(main_part, uBuf, uLen, namesRecurse, ligatures, numeric, hex, variantsRecurse); gfree(main_part); @@ -1455,7 +1455,7 @@ static int parseCharName(char *charName, Unicode *uBuf, int uLen, if ((lig_end = strchr(lig_part, '_'))) *lig_end = '\0'; if (lig_part[0] != '\0') { - GBool namesRecurse = gTrue, ligaturesRecurse = gFalse; + bool namesRecurse = true, ligaturesRecurse = false; if ((m = parseCharName(lig_part, uBuf + n, uLen - n, namesRecurse, ligaturesRecurse, numeric, hex, variants))) n += m; @@ -1549,7 +1549,7 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) { int *map; int cmapPlatform, cmapEncoding; int unicodeCmap, macRomanCmap, msSymbolCmap, cmap; - GBool useMacRoman, useUnicode; + bool useMacRoman, useUnicode; char *charName; Unicode u; int code, i, n; @@ -1598,22 +1598,22 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) { } } cmap = 0; - useMacRoman = gFalse; - useUnicode = gFalse; + useMacRoman = false; + useUnicode = false; if (hasEncoding || type == fontType1) { if (unicodeCmap >= 0) { cmap = unicodeCmap; - useUnicode = gTrue; + useUnicode = true; } else if (usesMacRomanEnc && macRomanCmap >= 0) { cmap = macRomanCmap; - useMacRoman = gTrue; + useMacRoman = true; } else if ((flags & fontSymbolic) && msSymbolCmap >= 0) { cmap = msSymbolCmap; } else if ((flags & fontSymbolic) && macRomanCmap >= 0) { cmap = macRomanCmap; } else if (macRomanCmap >= 0) { cmap = macRomanCmap; - useMacRoman = gTrue; + useMacRoman = true; } } else { if (msSymbolCmap >= 0) { @@ -1729,7 +1729,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, collection = nullptr; cMap = nullptr; ctu = nullptr; - ctuUsesCharCode = gTrue; + ctuUsesCharCode = true; widths.defWidth = 1.0; widths.defHeight = -1.0; widths.defVY = 0.880; @@ -1774,7 +1774,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, // look for a ToUnicode CMap if (!(ctu = readToUnicodeCMap(fontDict, 16, nullptr))) { - ctuUsesCharCode = gFalse; + ctuUsesCharCode = false; // use an identity mapping for the "Adobe-Identity" and // "Adobe-UCS" collections @@ -1985,7 +1985,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, cmpWidthExcepVFunctor()); } - ok = gTrue; + ok = true; } GfxCIDFont::~GfxCIDFont() { @@ -2088,7 +2088,7 @@ const GooString *GfxCIDFont::getCollection() const { } int GfxCIDFont::mapCodeToGID(FoFiTrueType *ff, int cmapi, - Unicode unicode, GBool wmode) { + Unicode unicode, bool wmode) { Gushort gid = ff->mapCodeToGID(cmapi,unicode); if (wmode) { Gushort vgid = ff->mapToVertGID(gid); @@ -2301,23 +2301,23 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) { if (humap != nullptr) { for (i = 0;i < N_UCS_CANDIDATES && gid == 0 && (unicode = humap[code*N_UCS_CANDIDATES+i]) != 0;i++) { - gid = mapCodeToGID(ff,cmap,unicode,gFalse); + gid = mapCodeToGID(ff,cmap,unicode,false); } } if (gid == 0 && vumap != nullptr) { unicode = vumap[code]; if (unicode != 0) { - gid = mapCodeToGID(ff,cmap,unicode,gTrue); + gid = mapCodeToGID(ff,cmap,unicode,true); if (gid == 0 && tumap != nullptr) { if ((unicode = tumap[code]) != 0) { - gid = mapCodeToGID(ff,cmap,unicode,gTrue); + gid = mapCodeToGID(ff,cmap,unicode,true); } } } } if (gid == 0 && tumap != nullptr) { if ((unicode = tumap[code]) != 0) { - gid = mapCodeToGID(ff,cmap,unicode,gFalse); + gid = mapCodeToGID(ff,cmap,unicode,false); } } if (gid == 0) { diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h index bad8af5f..5a52e058 100644 --- a/poppler/GfxFont.h +++ b/poppler/GfxFont.h @@ -180,7 +180,7 @@ public: GfxFont(const GfxFont &) = delete; GfxFont& operator=(const GfxFont &other) = delete; - GBool isOk() const { return ok; } + bool isOk() const { return ok; } void incRefCnt(); void decRefCnt(); @@ -192,7 +192,7 @@ public: const Ref *getID() const { return &id; } // Does this font match the tag? - GBool matches(const char *tagA) const { return !tag->cmp(tagA); } + bool matches(const char *tagA) const { return !tag->cmp(tagA); } // Get font family name. GooString *getFamily() const { return family; } @@ -209,21 +209,21 @@ public: // Get font type. GfxFontType getType() const { return type; } - virtual GBool isCIDFont() const { return gFalse; } + virtual bool isCIDFont() const { return false; } // Get embedded font ID, i.e., a ref for the font file stream. // Returns false if there is no embedded font. - GBool getEmbeddedFontID(Ref *embID) const + bool getEmbeddedFontID(Ref *embID) const { *embID = embFontID; return embFontID.num >= 0; } // Invalidate an embedded font // Returns false if there is no embedded font. - GBool invalidateEmbeddedFont() { + bool invalidateEmbeddedFont() { if (embFontID.num >= 0) { embFontID.num = -1; - return gTrue; + return true; } - return gFalse; + return false; } // Get the PostScript font name for the embedded font. Returns @@ -232,11 +232,11 @@ public: // Get font descriptor flags. int getFlags() const { return flags; } - GBool isFixedWidth() const { return flags & fontFixedWidth; } - GBool isSerif() const { return flags & fontSerif; } - GBool isSymbolic() const { return flags & fontSymbolic; } - GBool isItalic() const { return flags & fontItalic; } - GBool isBold() const { return flags & fontBold; } + bool isFixedWidth() const { return flags & fontFixedWidth; } + bool isSerif() const { return flags & fontSerif; } + bool isSymbolic() const { return flags & fontSymbolic; } + bool isItalic() const { return flags & fontItalic; } + bool isBold() const { return flags & fontBold; } // Return the Unicode map. virtual const CharCodeToUnicode *getToUnicode() const = 0; @@ -275,7 +275,7 @@ public: double *dx, double *dy, double *ox, double *oy) const = 0; // Does this font have a toUnicode map? - GBool hasToUnicodeCMap() const { return hasToUnicode; } + bool hasToUnicodeCMap() const { return hasToUnicode; } // Return the name of the encoding GooString *getEncodingName() const { return encodingName; } @@ -293,7 +293,7 @@ protected: void readFontDescriptor(XRef *xref, Dict *fontDict); CharCodeToUnicode *readToUnicodeCMap(Dict *fontDict, int nBits, CharCodeToUnicode *ctu); - static GfxFontLoc *getExternalFont(GooString *path, GBool cid); + static GfxFontLoc *getExternalFont(GooString *path, bool cid); GooString *tag; // PDF font tag Ref id; // reference (used as unique ID) @@ -311,8 +311,8 @@ protected: double ascent; // max height above baseline double descent; // max depth below baseline int refCnt; - GBool ok; - GBool hasToUnicode; + bool ok; + bool hasToUnicode; GooString *encodingName; }; @@ -340,10 +340,10 @@ public: const char *getCharName(int code) const { return enc[code]; } // Returns true if the PDF font specified an encoding. - GBool getHasEncoding() const { return hasEncoding; } + bool getHasEncoding() const { return hasEncoding; } // Returns true if the PDF font specified MacRomanEncoding. - GBool getUsesMacRomanEnc() const { return usesMacRomanEnc; } + bool getUsesMacRomanEnc() const { return usesMacRomanEnc; } // Get width of a character. double getWidth(Guchar c) const { return widths[c]; } @@ -370,8 +370,8 @@ private: char encFree[256]; // boolean for each char name: if set, // the string is malloc'ed CharCodeToUnicode *ctu; // char code --> Unicode - GBool hasEncoding; - GBool usesMacRomanEnc; + bool hasEncoding; + bool usesMacRomanEnc; double widths[256]; // character widths Object charProcs; // Type 3 CharProcs dictionary Object resources; // Type 3 Resources dictionary @@ -389,7 +389,7 @@ public: GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, GfxFontType typeA, Ref embFontIDA, Dict *fontDict); - GBool isCIDFont() const override { return gTrue; } + bool isCIDFont() const override { return true; } int getNextChar(const char *s, int len, CharCode *code, Unicode **u, int *uLen, @@ -417,13 +417,13 @@ private: ~GfxCIDFont(); int mapCodeToGID(FoFiTrueType *ff, int cmapi, - Unicode unicode, GBool wmode); + Unicode unicode, bool wmode); double getWidth(CID cid) const; // Get width of a character. GooString *collection; // collection name CMap *cMap; // char code --> CID CharCodeToUnicode *ctu; // CID --> Unicode - GBool ctuUsesCharCode; // true: ctu maps char code to Unicode; + bool ctuUsesCharCode; // true: ctu maps char code to Unicode; // false: ctu maps CID to Unicode GfxFontCIDWidths widths; // character widths int *cidToGID; // CID --> GID mapping (for embedded diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 09fc9793..b8f93429 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -68,12 +68,12 @@ //------------------------------------------------------------------------ -GBool Matrix::invertTo(Matrix *other) const +bool Matrix::invertTo(Matrix *other) const { const double det_denominator = determinant(); if (unlikely(det_denominator == 0)) { *other = {1, 0, 0, 1, 0, 0}; - return gFalse; + return false; } const double det = 1 / det_denominator; @@ -84,7 +84,7 @@ GBool Matrix::invertTo(Matrix *other) const other->m[4] = (m[2] * m[5] - m[3] * m[4]) * det; other->m[5] = (m[1] * m[4] - m[0] * m[5]) * det; - return gTrue; + return true; } void Matrix::translate(double tx, double ty) @@ -477,13 +477,13 @@ static void CMSError(cmsContext /*contextId*/, cmsUInt32Number /*ecode*/, const int GfxColorSpace::setupColorProfiles() { - static GBool initialized = gFalse; + static bool initialized = false; cmsHTRANSFORM transform; unsigned int nChannels; // do only once if (initialized) return 0; - initialized = gTrue; + initialized = true; // set error handlor cmsSetLogErrorHandler(CMSError); @@ -2351,7 +2351,7 @@ void GfxICCBasedColorSpace::getCMYK(const GfxColor *color, GfxCMYK *cmyk) const #endif } -GBool GfxICCBasedColorSpace::useGetRGBLine() const { +bool GfxICCBasedColorSpace::useGetRGBLine() const { #ifdef USE_CMS return lineTransform != nullptr || alt->useGetRGBLine(); #else @@ -2359,7 +2359,7 @@ GBool GfxICCBasedColorSpace::useGetRGBLine() const { #endif } -GBool GfxICCBasedColorSpace::useGetCMYKLine() const { +bool GfxICCBasedColorSpace::useGetCMYKLine() const { #ifdef USE_CMS return lineTransform != nullptr || alt->useGetCMYKLine(); #else @@ -2367,7 +2367,7 @@ GBool GfxICCBasedColorSpace::useGetCMYKLine() const { #endif } -GBool GfxICCBasedColorSpace::useGetDeviceNLine() const { +bool GfxICCBasedColorSpace::useGetDeviceNLine() const { #ifdef USE_CMS return lineTransform != nullptr || alt->useGetDeviceNLine(); #else @@ -2673,7 +2673,7 @@ GfxSeparationColorSpace::GfxSeparationColorSpace(GooString *nameA, GfxSeparationColorSpace::GfxSeparationColorSpace(GooString *nameA, GfxColorSpace *altA, Function *funcA, - GBool nonMarkingA, + bool nonMarkingA, Guint overprintMaskA, int *mappingA) { name = nameA; @@ -2910,13 +2910,13 @@ GfxDeviceNColorSpace::GfxDeviceNColorSpace(int nCompsA, alt = altA; func = funcA; sepsCS = sepsCSA; - nonMarking = gTrue; + nonMarking = true; overprintMask = 0; mapping = nullptr; for (i = 0; i < nComps; ++i) { names[i] = namesA[i]; if (names[i]->cmp("None")) { - nonMarking = gFalse; + nonMarking = false; } if (!names[i]->cmp("Cyan")) { overprintMask |= 0x01; @@ -2940,7 +2940,7 @@ GfxDeviceNColorSpace::GfxDeviceNColorSpace(int nCompsA, Function *funcA, GooList *sepsCSA, int *mappingA, - GBool nonMarkingA, + bool nonMarkingA, Guint overprintMaskA) { int i; @@ -3162,7 +3162,7 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp mapping[i] = 3; } else { Guint startOverprintMask = 0x10; - GBool found = gFalse; + bool found = false; const Function *sepFunc = nullptr; if (nComps == 1) sepFunc = func; @@ -3188,7 +3188,7 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp } mapping[i] = j+4; newOverprintMask |= startOverprintMask; - found = gTrue; + found = true; break; } startOverprintMask <<=1; @@ -3210,7 +3210,7 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp for (int k = 0; k < sepsCS->getLength(); k++) { GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)sepsCS->get(k); if (!sepCS->getName()->cmp(names[i])) { - found = gTrue; + found = true; separationList->push_back(sepCS->copy()); break; } @@ -3598,24 +3598,24 @@ GfxShading *GfxShading::parse(GfxResources *res, Object *obj, OutputDev *out, Gf return nullptr; } -GBool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state) { +bool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state) { Object obj1; int i; obj1 = dict->lookup("ColorSpace"); if (!(colorSpace = GfxColorSpace::parse(res, &obj1, out, state))) { error(errSyntaxWarning, -1, "Bad color space in shading dictionary"); - return gFalse; + return false; } for (i = 0; i < gfxColorMaxComps; ++i) { background.c[i] = 0; } - hasBackground = gFalse; + hasBackground = false; obj1 = dict->lookup("Background"); if (obj1.isArray()) { if (obj1.arrayGetLength() == colorSpace->getNComps()) { - hasBackground = gTrue; + hasBackground = true; for (i = 0; i < colorSpace->getNComps(); ++i) { Object obj2 = obj1.arrayGet(i); background.c[i] = dblToCol(obj2.getNum()); @@ -3626,7 +3626,7 @@ GBool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState * } xMin = yMin = xMax = yMax = 0; - hasBBox = gFalse; + hasBBox = false; obj1 = dict->lookup("BBox"); if (obj1.isArray()) { if (obj1.arrayGetLength() == 4) { @@ -3636,7 +3636,7 @@ GBool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState * Object obj5 = obj1.arrayGet(3); if (obj2.isNum() && obj3.isNum() && obj4.isNum() && obj5.isNum()) { - hasBBox = gTrue; + hasBBox = true; xMin = obj2.getNum(); yMin = obj3.getNum(); xMax = obj4.getNum(); @@ -3649,7 +3649,7 @@ GBool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState * } } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -3811,7 +3811,7 @@ void GfxFunctionShading::getColor(double x, double y, GfxColor *color) const { GfxUnivariateShading::GfxUnivariateShading(int typeA, double t0A, double t1A, Function **funcsA, int nFuncsA, - GBool extend0A, GBool extend1A): + bool extend0A, bool extend1A): GfxShading(typeA) { int i; @@ -4012,7 +4012,7 @@ GfxAxialShading::GfxAxialShading(double x0A, double y0A, double x1A, double y1A, double t0A, double t1A, Function **funcsA, int nFuncsA, - GBool extend0A, GBool extend1A): + bool extend0A, bool extend1A): GfxUnivariateShading(2, t0A, t1A, funcsA, nFuncsA, extend0A, extend1A) { x0 = x0A; @@ -4039,7 +4039,7 @@ GfxAxialShading *GfxAxialShading::parse(GfxResources *res, Dict *dict, OutputDev double t0A, t1A; Function *funcsA[gfxColorMaxComps]; int nFuncsA; - GBool extend0A, extend1A; + bool extend0A, extend1A; Object obj1; x0A = y0A = x1A = y1A = 0; @@ -4094,7 +4094,7 @@ GfxAxialShading *GfxAxialShading::parse(GfxResources *res, Dict *dict, OutputDev } } - extend0A = extend1A = gFalse; + extend0A = extend1A = false; obj1 = dict->lookup("Extend"); if (obj1.isArray() && obj1.arrayGetLength() == 2) { Object obj2 = obj1.arrayGet(0); @@ -4202,7 +4202,7 @@ GfxRadialShading::GfxRadialShading(double x0A, double y0A, double r0A, double x1A, double y1A, double r1A, double t0A, double t1A, Function **funcsA, int nFuncsA, - GBool extend0A, GBool extend1A): + bool extend0A, bool extend1A): GfxUnivariateShading(3, t0A, t1A, funcsA, nFuncsA, extend0A, extend1A) { x0 = x0A; @@ -4233,7 +4233,7 @@ GfxRadialShading *GfxRadialShading::parse(GfxResources *res, Dict *dict, OutputD double t0A, t1A; Function *funcsA[gfxColorMaxComps]; int nFuncsA; - GBool extend0A, extend1A; + bool extend0A, extend1A; Object obj1; int i; @@ -4282,12 +4282,12 @@ GfxRadialShading *GfxRadialShading::parse(GfxResources *res, Dict *dict, OutputD } } - extend0A = extend1A = gFalse; + extend0A = extend1A = false; obj1 = dict->lookup("Extend"); if (obj1.isArray() && obj1.arrayGetLength() == 2) { Object obj2; - extend0A = (obj2 = obj1.arrayGet(0), obj2.isBool() ? obj2.getBool() : gFalse); - extend1A = (obj2 = obj1.arrayGet(1), obj2.isBool() ? obj2.getBool() : gFalse); + extend0A = (obj2 = obj1.arrayGet(0), obj2.isBool() ? obj2.getBool() : false); + extend1A = (obj2 = obj1.arrayGet(1), obj2.isBool() ? obj2.getBool() : false); } shading = new GfxRadialShading(x0A, y0A, r0A, x1A, y1A, r1A, t0A, t1A, @@ -4318,8 +4318,8 @@ double GfxRadialShading::getDistance(double sMin, double sMax) { } // extend range, adapted from cairo, radialExtendRange -static GBool -radialExtendRange (double range[2], double value, GBool valid) +static bool +radialExtendRange (double range[2], double value, bool valid) { if (!valid) range[0] = range[1] = value; @@ -4328,11 +4328,11 @@ radialExtendRange (double range[2], double value, GBool valid) else if (value > range[1]) range[1] = value; - return gTrue; + return true; } inline void radialEdge(double num, double den, double delta, double lower, double upper, - double dr, double mindr, GBool &valid, double *range) + double dr, double mindr, bool &valid, double *range) { if (fabs (den) >= RADIAL_EPSILON) { double t_edge, v; @@ -4344,7 +4344,7 @@ inline void radialEdge(double num, double den, double delta, double lower, doubl } inline void radialCorner1(double x, double y, double &b, double dx, double dy, double cr, - double dr, double mindr, GBool &valid, double *range) + double dr, double mindr, bool &valid, double *range) { b = (x) * dx + (y) * dy + cr * dr; if (fabs (b) >= RADIAL_EPSILON) { @@ -4361,7 +4361,7 @@ inline void radialCorner1(double x, double y, double &b, double dx, double dy, d } inline void radialCorner2(double x, double y, double a, double &b, double &c, double &d, double dx, double dy, double cr, - double inva, double dr, double mindr, GBool &valid, double *range) + double inva, double dr, double mindr, bool &valid, double *range) { b = (x) * dx + (y) * dy + cr * dr; c = (x) * (x) + (y) * (y) - cr * cr; @@ -4385,7 +4385,7 @@ void GfxRadialShading::getParameterRange(double *lower, double *upper, double a, x_focus, y_focus; double mindr, minx, miny, maxx, maxy; double range[2]; - GBool valid; + bool valid; // A radial pattern is considered degenerate if it can be // represented as a solid or clear pattern. This corresponds to one @@ -4408,7 +4408,7 @@ void GfxRadialShading::getParameterRange(double *lower, double *upper, } range[0] = range[1] = 0; - valid = gFalse; + valid = false; x_focus = y_focus = 0; // silence gcc @@ -4623,7 +4623,7 @@ public: ~GfxShadingBitBuf(); GfxShadingBitBuf(const GfxShadingBitBuf &) = delete; GfxShadingBitBuf& operator=(const GfxShadingBitBuf &) = delete; - GBool getBits(int n, Guint *val); + bool getBits(int n, Guint *val); void flushBits(); private: @@ -4644,7 +4644,7 @@ GfxShadingBitBuf::~GfxShadingBitBuf() { str->close(); } -GBool GfxShadingBitBuf::getBits(int n, Guint *val) { +bool GfxShadingBitBuf::getBits(int n, Guint *val) { int x; if (nBits >= n) { @@ -4660,7 +4660,7 @@ GBool GfxShadingBitBuf::getBits(int n, Guint *val) { while (n > 0) { if ((bitBuf = str->getChar()) == EOF) { nBits = 0; - return gFalse; + return false; } if (n >= 8) { x = (x << 8) | bitBuf; @@ -4673,7 +4673,7 @@ GBool GfxShadingBitBuf::getBits(int n, Guint *val) { } } *val = x; - return gTrue; + return true; } void GfxShadingBitBuf::flushBits() { @@ -5665,10 +5665,10 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, double y[gfxColorMaxComps] = {}; int i, j, k; double mapped; - GBool useByteLookup; + bool useByteLookup; - ok = gTrue; - useMatte = gFalse; + ok = true; + useMatte = false; colorSpace = colorSpaceA; @@ -5738,7 +5738,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, // color values colorSpace2 = nullptr; nComps2 = 0; - useByteLookup = gFalse; + useByteLookup = false; switch (colorSpace->getMode()) { case csIndexed: // Note that indexHigh may not be the same as maxPixel -- @@ -5752,7 +5752,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, colorSpace2->getDefaultRanges(x, y, indexHigh); if (colorSpace2->useGetGrayLine() || colorSpace2->useGetRGBLine() || colorSpace2->useGetCMYKLine() || colorSpace2->useGetDeviceNLine()) { byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2); - useByteLookup = gTrue; + useByteLookup = true; } for (k = 0; k < nComps2; ++k) { lookup2[k] = (GfxColorComp *)gmallocn(maxPixel + 1, @@ -5779,7 +5779,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, sepFunc = sepCS->getFunc(); if (colorSpace2->useGetGrayLine() || colorSpace2->useGetRGBLine() || colorSpace2->useGetCMYKLine() || colorSpace2->useGetDeviceNLine()) { byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps2); - useByteLookup = gTrue; + useByteLookup = true; } for (k = 0; k < nComps2; ++k) { lookup2[k] = (GfxColorComp *)gmallocn(maxPixel + 1, @@ -5796,7 +5796,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, default: if (colorSpace->useGetGrayLine() || colorSpace->useGetRGBLine() || colorSpace->useGetCMYKLine() || colorSpace->useGetDeviceNLine()) { byte_lookup = (Guchar *)gmallocn ((maxPixel + 1), nComps); - useByteLookup = gTrue; + useByteLookup = true; } for (k = 0; k < nComps; ++k) { lookup2[k] = (GfxColorComp *)gmallocn(maxPixel + 1, @@ -5821,7 +5821,7 @@ GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode, return; err1: - ok = gFalse; + ok = false; } GfxImageColorMap::GfxImageColorMap(GfxImageColorMap *colorMap) { @@ -5872,7 +5872,7 @@ GfxImageColorMap::GfxImageColorMap(GfxImageColorMap *colorMap) { decodeLow[i] = colorMap->decodeLow[i]; decodeRange[i] = colorMap->decodeRange[i]; } - ok = gTrue; + ok = true; } GfxImageColorMap::~GfxImageColorMap() { @@ -6235,12 +6235,12 @@ GfxSubpath::GfxSubpath(double x1, double y1) { size = 16; x = (double *)gmallocn(size, sizeof(double)); y = (double *)gmallocn(size, sizeof(double)); - curve = (GBool *)gmallocn(size, sizeof(GBool)); + curve = (bool *)gmallocn(size, sizeof(bool)); n = 1; x[0] = x1; y[0] = y1; - curve[0] = gFalse; - closed = gFalse; + curve[0] = false; + closed = false; } GfxSubpath::~GfxSubpath() { @@ -6255,10 +6255,10 @@ GfxSubpath::GfxSubpath(const GfxSubpath *subpath) { n = subpath->n; x = (double *)gmallocn(size, sizeof(double)); y = (double *)gmallocn(size, sizeof(double)); - curve = (GBool *)gmallocn(size, sizeof(GBool)); + curve = (bool *)gmallocn(size, sizeof(bool)); memcpy(x, subpath->x, n * sizeof(double)); memcpy(y, subpath->y, n * sizeof(double)); - memcpy(curve, subpath->curve, n * sizeof(GBool)); + memcpy(curve, subpath->curve, n * sizeof(bool)); closed = subpath->closed; } @@ -6267,11 +6267,11 @@ void GfxSubpath::lineTo(double x1, double y1) { size *= 2; x = (double *)greallocn(x, size, sizeof(double)); y = (double *)greallocn(y, size, sizeof(double)); - curve = (GBool *)greallocn(curve, size, sizeof(GBool)); + curve = (bool *)greallocn(curve, size, sizeof(bool)); } x[n] = x1; y[n] = y1; - curve[n] = gFalse; + curve[n] = false; ++n; } @@ -6281,7 +6281,7 @@ void GfxSubpath::curveTo(double x1, double y1, double x2, double y2, size *= 2; x = (double *)greallocn(x, size, sizeof(double)); y = (double *)greallocn(y, size, sizeof(double)); - curve = (GBool *)greallocn(curve, size, sizeof(GBool)); + curve = (bool *)greallocn(curve, size, sizeof(bool)); } x[n] = x1; y[n] = y1; @@ -6289,8 +6289,8 @@ void GfxSubpath::curveTo(double x1, double y1, double x2, double y2, y[n+1] = y2; x[n+2] = x3; y[n+2] = y3; - curve[n] = curve[n+1] = gTrue; - curve[n+2] = gFalse; + curve[n] = curve[n+1] = true; + curve[n+2] = false; n += 3; } @@ -6298,7 +6298,7 @@ void GfxSubpath::close() { if (x[n-1] != x[0] || y[n-1] != y[0]) { lineTo(x[0], y[0]); } - closed = gTrue; + closed = true; } void GfxSubpath::offset(double dx, double dy) { @@ -6311,7 +6311,7 @@ void GfxSubpath::offset(double dx, double dy) { } GfxPath::GfxPath() { - justMoved = gFalse; + justMoved = false; size = 16; n = 0; firstX = firstY = 0; @@ -6327,7 +6327,7 @@ GfxPath::~GfxPath() { } // Used for copy(). -GfxPath::GfxPath(GBool justMoved1, double firstX1, double firstY1, +GfxPath::GfxPath(bool justMoved1, double firstX1, double firstY1, GfxSubpath **subpaths1, int n1, int size1) { int i; @@ -6342,7 +6342,7 @@ GfxPath::GfxPath(GBool justMoved1, double firstX1, double firstY1, } void GfxPath::moveTo(double x, double y) { - justMoved = gTrue; + justMoved = true; firstX = x; firstY = y; } @@ -6361,7 +6361,7 @@ void GfxPath::lineTo(double x, double y) { subpaths[n-1]->getLastY()); } ++n; - justMoved = gFalse; + justMoved = false; } subpaths[n-1]->lineTo(x, y); } @@ -6381,7 +6381,7 @@ void GfxPath::curveTo(double x1, double y1, double x2, double y2, subpaths[n-1]->getLastY()); } ++n; - justMoved = gFalse; + justMoved = false; } subpaths[n-1]->curveTo(x1, y1, x2, y2, x3, y3); } @@ -6397,7 +6397,7 @@ void GfxPath::close() { } subpaths[n] = new GfxSubpath(firstX, firstY); ++n; - justMoved = gFalse; + justMoved = false; } subpaths[n-1]->close(); } @@ -6413,7 +6413,7 @@ void GfxPath::append(GfxPath *path) { for (i = 0; i < path->n; ++i) { subpaths[n++] = path->subpaths[i]->copy(); } - justMoved = gFalse; + justMoved = false; } void GfxPath::offset(double dx, double dy) { @@ -6469,7 +6469,7 @@ void GfxState::ReusablePathIterator::reset() { } GfxState::GfxState(double hDPIA, double vDPIA, const PDFRectangle *pageBox, - int rotateA, GBool upsideDown) { + int rotateA, bool upsideDown) { double kx, ky; hDPI = hDPIA; @@ -6528,8 +6528,8 @@ GfxState::GfxState(double hDPIA, double vDPIA, const PDFRectangle *pageBox, blendMode = gfxBlendNormal; fillOpacity = 1; strokeOpacity = 1; - fillOverprint = gFalse; - strokeOverprint = gFalse; + fillOverprint = false; + strokeOverprint = false; overprintMode = 0; transfer[0] = transfer[1] = transfer[2] = transfer[3] = nullptr; @@ -6541,9 +6541,9 @@ GfxState::GfxState(double hDPIA, double vDPIA, const PDFRectangle *pageBox, lineJoin = 0; lineCap = 0; miterLimit = 10; - strokeAdjust = gFalse; - alphaIsShape = gFalse; - textKnockout = gFalse; + strokeAdjust = false; + alphaIsShape = false; + textKnockout = false; font = nullptr; fontSize = 0; @@ -6632,7 +6632,7 @@ GfxState::~GfxState() { } // Used for copy(); -GfxState::GfxState(const GfxState *state, GBool copyPath) { +GfxState::GfxState(const GfxState *state, bool copyPath) { int i; memcpy(this, state, sizeof(GfxState)); @@ -7155,33 +7155,33 @@ GfxState *GfxState::restore() { return oldState; } -GBool GfxState::parseBlendMode(Object *obj, GfxBlendMode *mode) { +bool GfxState::parseBlendMode(Object *obj, GfxBlendMode *mode) { int i, j; if (obj->isName()) { for (i = 0; i < nGfxBlendModeNames; ++i) { if (!strcmp(obj->getName(), gfxBlendModeNames[i].name)) { *mode = gfxBlendModeNames[i].mode; - return gTrue; + return true; } } - return gFalse; + return false; } else if (obj->isArray()) { for (i = 0; i < obj->arrayGetLength(); ++i) { Object obj2 = obj->arrayGet(i); if (!obj2.isName()) { - return gFalse; + return false; } for (j = 0; j < nGfxBlendModeNames; ++j) { if (!strcmp(obj2.getName(), gfxBlendModeNames[j].name)) { *mode = gfxBlendModeNames[j].mode; - return gTrue; + return true; } } } *mode = gfxBlendNormal; - return gTrue; + return true; } else { - return gFalse; + return false; } } diff --git a/poppler/GfxState.h b/poppler/GfxState.h index cd8e3a12..f5f3d0ca 100644 --- a/poppler/GfxState.h +++ b/poppler/GfxState.h @@ -60,7 +60,7 @@ public: void init(double xx, double yx, double xy, double yy, double x0, double y0) { m[0] = xx; m[1] = yx; m[2] = xy; m[3] = yy; m[4] = x0; m[5] = y0; } - GBool invertTo(Matrix *other) const; + bool invertTo(Matrix *other) const; void translate(double tx, double ty); void scale(double sx, double sy); void transform(double x, double y, double *tx, double *ty) const; @@ -239,13 +239,13 @@ public: virtual void createMapping(GooList *separationList, int maxSepComps); // Does this ColorSpace support getRGBLine? - virtual GBool useGetRGBLine() const { return gFalse; } + virtual bool useGetRGBLine() const { return false; } // Does this ColorSpace support getGrayLine? - virtual GBool useGetGrayLine() const { return gFalse; } + virtual bool useGetGrayLine() const { return false; } // Does this ColorSpace support getCMYKLine? - virtual GBool useGetCMYKLine() const { return gFalse; } + virtual bool useGetCMYKLine() const { return false; } // Does this ColorSpace support getDeviceNLine? - virtual GBool useGetDeviceNLine() const { return gFalse; } + virtual bool useGetDeviceNLine() const { return false; } // Return the number of color components. virtual int getNComps() const = 0; @@ -260,7 +260,7 @@ public: // Returns true if painting operations in this color space never // mark the page (e.g., the "None" colorant). - virtual GBool isNonMarking() const { return gFalse; } + virtual bool isNonMarking() const { return false; } // Return the color space's overprint mask. Guint getOverprintMask() const { return overprintMask; } @@ -310,10 +310,10 @@ public: void getCMYKLine(Guchar *in, Guchar *out, int length) override; void getDeviceNLine(Guchar *in, Guchar *out, int length) override; - GBool useGetRGBLine() const override { return gTrue; } - GBool useGetGrayLine() const override { return gTrue; } - GBool useGetCMYKLine() const override { return gTrue; } - GBool useGetDeviceNLine() const override { return gTrue; } + bool useGetRGBLine() const override { return true; } + bool useGetGrayLine() const override { return true; } + bool useGetCMYKLine() const override { return true; } + bool useGetDeviceNLine() const override { return true; } int getNComps() const override { return 1; } void getDefaultColor(GfxColor *color) override; @@ -388,10 +388,10 @@ public: void getCMYKLine(Guchar *in, Guchar *out, int length) override; void getDeviceNLine(Guchar *in, Guchar *out, int length) override; - GBool useGetRGBLine() const override { return gTrue; } - GBool useGetGrayLine() const override { return gTrue; } - GBool useGetCMYKLine() const override { return gTrue; } - GBool useGetDeviceNLine() const override { return gTrue; } + bool useGetRGBLine() const override { return true; } + bool useGetGrayLine() const override { return true; } + bool useGetCMYKLine() const override { return true; } + bool useGetDeviceNLine() const override { return true; } int getNComps() const override { return 3; } void getDefaultColor(GfxColor *color) override; @@ -468,9 +468,9 @@ public: void getRGBXLine(Guchar *in, Guchar *out, int length) override; void getCMYKLine(Guchar *in, Guchar *out, int length) override; void getDeviceNLine(Guchar *in, Guchar *out, int length) override; - GBool useGetRGBLine() const override { return gTrue; } - GBool useGetCMYKLine() const override { return gTrue; } - GBool useGetDeviceNLine() const override { return gTrue; } + bool useGetRGBLine() const override { return true; } + bool useGetCMYKLine() const override { return true; } + bool useGetDeviceNLine() const override { return true; } int getNComps() const override { return 4; } void getDefaultColor(GfxColor *color) override; @@ -554,9 +554,9 @@ public: void getCMYKLine(Guchar *in, Guchar *out, int length) override; void getDeviceNLine(Guchar *in, Guchar *out, int length) override; - GBool useGetRGBLine() const override; - GBool useGetCMYKLine() const override; - GBool useGetDeviceNLine() const override; + bool useGetRGBLine() const override; + bool useGetCMYKLine() const override; + bool useGetDeviceNLine() const override; int getNComps() const override { return nComps; } void getDefaultColor(GfxColor *color) override; @@ -606,9 +606,9 @@ public: void getCMYKLine(Guchar *in, Guchar *out, int length) override; void getDeviceNLine(Guchar *in, Guchar *out, int length) override; - GBool useGetRGBLine() const override { return gTrue; } - GBool useGetCMYKLine() const override { return gTrue; } - GBool useGetDeviceNLine() const override { return gTrue; } + bool useGetRGBLine() const override { return true; } + bool useGetCMYKLine() const override { return true; } + bool useGetDeviceNLine() const override { return true; } int getNComps() const override { return 1; } void getDefaultColor(GfxColor *color) override; @@ -659,7 +659,7 @@ public: int getNComps() const override { return 1; } void getDefaultColor(GfxColor *color) override; - GBool isNonMarking() const override { return nonMarking; } + bool isNonMarking() const override { return nonMarking; } // Separation-specific access. GooString *getName() { return name; } @@ -669,13 +669,13 @@ public: private: GfxSeparationColorSpace(GooString *nameA, GfxColorSpace *altA, - Function *funcA, GBool nonMarkingA, + Function *funcA, bool nonMarkingA, Guint overprintMaskA, int *mappingA); GooString *name; // colorant name GfxColorSpace *alt; // alternate color space Function *func; // tint transform (into alternate color space) - GBool nonMarking; + bool nonMarking; }; //------------------------------------------------------------------------ @@ -704,7 +704,7 @@ public: int getNComps() const override { return nComps; } void getDefaultColor(GfxColor *color) override; - GBool isNonMarking() const override { return nonMarking; } + bool isNonMarking() const override { return nonMarking; } // DeviceN-specific access. const GooString *getColorantName(int i) const { return names[i]; } @@ -715,14 +715,14 @@ private: GfxDeviceNColorSpace(int nCompsA, GooString **namesA, GfxColorSpace *alt, Function *func, GooList *sepsCSA, - int *mappingA, GBool nonMarkingA, Guint overprintMaskA); + int *mappingA, bool nonMarkingA, Guint overprintMaskA); int nComps; // number of components GooString // colorant names *names[gfxColorMaxComps]; GfxColorSpace *alt; // alternate color space Function *func; // tint transform (into alternate color space) - GBool nonMarking; + bool nonMarking; GooList *sepsCS; // list of separation cs for spot colorants; }; @@ -867,14 +867,14 @@ public: int getType() const { return type; } GfxColorSpace *getColorSpace() { return colorSpace; } const GfxColor *getBackground() const { return &background; } - GBool getHasBackground() const { return hasBackground; } + bool getHasBackground() const { return hasBackground; } void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA) const { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; } - GBool getHasBBox() const { return hasBBox; } + bool getHasBBox() const { return hasBBox; } protected: - GBool init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state); + bool init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *state); // 1: Function-based shading // 2: Axial shading @@ -884,8 +884,8 @@ protected: // 6: Coons patch mesh // 7: Tensor-product patch mesh int type; - GBool hasBackground; - GBool hasBBox; + bool hasBackground; + bool hasBBox; GfxColorSpace *colorSpace; GfxColor background; double xMin, yMin, xMax, yMax; @@ -901,14 +901,14 @@ public: GfxUnivariateShading(int typeA, double t0A, double t1A, Function **funcsA, int nFuncsA, - GBool extend0A, GBool extend1A); + bool extend0A, bool extend1A); GfxUnivariateShading(GfxUnivariateShading *shading); ~GfxUnivariateShading(); double getDomain0() const { return t0; } double getDomain1() const { return t1; } - GBool getExtend0() const { return extend0; } - GBool getExtend1() const { return extend1; } + bool getExtend0() const { return extend0; } + bool getExtend1() const { return extend1; } int getNFuncs() const { return nFuncs; } const Function *getFunc(int i) const { return funcs[i]; } // returns the nComps of the shading @@ -930,7 +930,7 @@ private: double t0, t1; Function *funcs[gfxColorMaxComps]; int nFuncs; - GBool extend0, extend1; + bool extend0, extend1; int cacheSize, lastMatch; double *cacheBounds; @@ -982,7 +982,7 @@ public: double x1A, double y1A, double t0A, double t1A, Function **funcsA, int nFuncsA, - GBool extend0A, GBool extend1A); + bool extend0A, bool extend1A); GfxAxialShading(GfxAxialShading *shading); ~GfxAxialShading(); @@ -1015,7 +1015,7 @@ public: double x1A, double y1A, double r1A, double t0A, double t1A, Function **funcsA, int nFuncsA, - GBool extend0A, GBool extend1A); + bool extend0A, bool extend1A); GfxRadialShading(GfxRadialShading *shading); ~GfxRadialShading(); @@ -1192,7 +1192,7 @@ public: GfxImageColorMap *copy() { return new GfxImageColorMap(this); } // Is color map valid? - GBool isOk() const { return ok; } + bool isOk() const { return ok; } // Get the color space. GfxColorSpace *getColorSpace() { return colorSpace; } @@ -1223,7 +1223,7 @@ public: void getColor(Guchar *x, GfxColor *color); // Matte color ops - void setMatteColor(const GfxColor *color) { useMatte = gTrue; matteColor = *color; } + void setMatteColor(const GfxColor *color) { useMatte = true; matteColor = *color; } const GfxColor *getMatteColor() const { return (useMatte) ? &matteColor : nullptr; } private: @@ -1243,9 +1243,9 @@ private: decodeLow[gfxColorMaxComps]; double // max - min value for each component decodeRange[gfxColorMaxComps]; - GBool useMatte; + bool useMatte; GfxColor matteColor; - GBool ok; + bool ok; }; //------------------------------------------------------------------------ @@ -1271,7 +1271,7 @@ public: int getNumPoints() const { return n; } double getX(int i) const { return x[i]; } double getY(int i) const { return y[i]; } - GBool getCurve(int i) const { return curve[i]; } + bool getCurve(int i) const { return curve[i]; } void setX(int i, double a) { x[i] = a; } void setY(int i, double a) { y[i] = a; } @@ -1289,7 +1289,7 @@ public: // Close the subpath. void close(); - GBool isClosed() const { return closed; } + bool isClosed() const { return closed; } // Add (<dx>, <dy>) to each point in the subpath. void offset(double dx, double dy); @@ -1297,11 +1297,11 @@ public: private: double *x, *y; // points - GBool *curve; // curve[i] => point i is a control point + bool *curve; // curve[i] => point i is a control point // for a Bezier curve int n; // number of points int size; // size of x/y arrays - GBool closed; // set if path is closed + bool closed; // set if path is closed GfxSubpath(const GfxSubpath *subpath); }; @@ -1323,10 +1323,10 @@ public: { return new GfxPath(justMoved, firstX, firstY, subpaths, n, size); } // Is there a current point? - GBool isCurPt() const { return n > 0 || justMoved; } + bool isCurPt() const { return n > 0 || justMoved; } // Is the path non-empty, i.e., is there at least one segment? - GBool isPath() const { return n > 0; } + bool isPath() const { return n > 0; } // Get subpaths. int getNumSubpaths() const { return n; } @@ -1357,13 +1357,13 @@ public: private: - GBool justMoved; // set if a new subpath was just started + bool justMoved; // set if a new subpath was just started double firstX, firstY; // first point in new subpath GfxSubpath **subpaths; // subpaths int n; // number of subpaths int size; // size of subpaths array - GfxPath(GBool justMoved1, double firstX1, double firstY1, + GfxPath(bool justMoved1, double firstX1, double firstY1, GfxSubpath **subpaths1, int n1, int size1); }; @@ -1433,7 +1433,7 @@ public: // x <vDPI>, page box <pageBox>, page rotation <rotateA>, and // coordinate system specified by <upsideDown>. GfxState(double hDPIA, double vDPIA, const PDFRectangle *pageBox, - int rotateA, GBool upsideDown); + int rotateA, bool upsideDown); // Destructor. ~GfxState(); @@ -1442,7 +1442,7 @@ public: GfxState& operator=(const GfxState &) = delete; // Copy. - GfxState *copy(GBool copyPath = gFalse) const + GfxState *copy(bool copyPath = false) const { return new GfxState(this, copyPath); } // Accessors. @@ -1482,8 +1482,8 @@ public: GfxBlendMode getBlendMode() const { return blendMode; } double getFillOpacity() const { return fillOpacity; } double getStrokeOpacity() const { return strokeOpacity; } - GBool getFillOverprint() const { return fillOverprint; } - GBool getStrokeOverprint() const { return strokeOverprint; } + bool getFillOverprint() const { return fillOverprint; } + bool getStrokeOverprint() const { return strokeOverprint; } int getOverprintMode() const { return overprintMode; } Function **getTransfer() { return transfer; } double getLineWidth() const { return lineWidth; } @@ -1493,9 +1493,9 @@ public: int getLineJoin() const { return lineJoin; } int getLineCap() const { return lineCap; } double getMiterLimit() const { return miterLimit; } - GBool getStrokeAdjust() const { return strokeAdjust; } - GBool getAlphaIsShape() const { return alphaIsShape; } - GBool getTextKnockout() const { return textKnockout; } + bool getStrokeAdjust() const { return strokeAdjust; } + bool getAlphaIsShape() const { return alphaIsShape; } + bool getTextKnockout() const { return textKnockout; } GfxFont *getFont() { return font; } double getFontSize() const { return fontSize; } const double *getTextMat() const { return textMat; } @@ -1517,8 +1517,8 @@ public: double getLineY() const { return lineY; } // Is there a current point/path? - GBool isCurPt() const { return path->isCurPt(); } - GBool isPath() const { return path->isPath(); } + bool isCurPt() const { return path->isCurPt(); } + bool isPath() const { return path->isPath(); } // Transforms. void transform(double x1, double y1, double *x2, double *y2) @@ -1554,8 +1554,8 @@ public: void setBlendMode(GfxBlendMode mode) { blendMode = mode; } void setFillOpacity(double opac) { fillOpacity = opac; } void setStrokeOpacity(double opac) { strokeOpacity = opac; } - void setFillOverprint(GBool op) { fillOverprint = op; } - void setStrokeOverprint(GBool op) { strokeOverprint = op; } + void setFillOverprint(bool op) { fillOverprint = op; } + void setStrokeOverprint(bool op) { strokeOverprint = op; } void setOverprintMode(int op) { overprintMode = op; } void setTransfer(Function **funcs); void setLineWidth(double width) { lineWidth = width; } @@ -1564,9 +1564,9 @@ public: void setLineJoin(int lineJoin1) { lineJoin = lineJoin1; } void setLineCap(int lineCap1) { lineCap = lineCap1; } void setMiterLimit(double limit) { miterLimit = limit; } - void setStrokeAdjust(GBool sa) { strokeAdjust = sa; } - void setAlphaIsShape(GBool ais) { alphaIsShape = ais; } - void setTextKnockout(GBool tk) { textKnockout = tk; } + void setStrokeAdjust(bool sa) { strokeAdjust = sa; } + void setAlphaIsShape(bool ais) { alphaIsShape = ais; } + void setTextKnockout(bool tk) { textKnockout = tk; } void setFont(GfxFont *fontA, double fontSizeA); void setTextMat(double a, double b, double c, double d, double e, double f) @@ -1620,11 +1620,11 @@ public: // Push/pop GfxState on/off stack. GfxState *save(); GfxState *restore(); - GBool hasSaves() const { return saved != nullptr; } - GBool isParentState(GfxState *state) { return saved == state || (saved && saved->isParentState(state)); } + bool hasSaves() const { return saved != nullptr; } + bool isParentState(GfxState *state) { return saved == state || (saved && saved->isParentState(state)); } // Misc - GBool parseBlendMode(Object *obj, GfxBlendMode *mode); + bool parseBlendMode(Object *obj, GfxBlendMode *mode); ReusablePathIterator *getReusablePath() { return new ReusablePathIterator(path); } private: @@ -1644,8 +1644,8 @@ private: GfxBlendMode blendMode; // transparency blend mode double fillOpacity; // fill opacity double strokeOpacity; // stroke opacity - GBool fillOverprint; // fill overprint - GBool strokeOverprint; // stroke overprint + bool fillOverprint; // fill overprint + bool strokeOverprint; // stroke overprint int overprintMode; // overprint mode Function *transfer[4]; // transfer function (entries may be: all // nullptr = identity; last three nullptr = @@ -1660,9 +1660,9 @@ private: int lineJoin; // line join style int lineCap; // line cap style double miterLimit; // line miter limit - GBool strokeAdjust; // stroke adjustment - GBool alphaIsShape; // alpha is shape - GBool textKnockout; // text knockout + bool strokeAdjust; // stroke adjustment + bool alphaIsShape; // alpha is shape + bool textKnockout; // text knockout GfxFont *font; // font double fontSize; // font size @@ -1684,7 +1684,7 @@ private: GfxState *saved; // next GfxState on stack - GfxState(const GfxState *state, GBool copyPath); + GfxState(const GfxState *state, bool copyPath); #ifdef USE_CMS void *localDisplayProfile; diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index 0a1db73d..b0d5e5df 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -166,26 +166,26 @@ class SysFontInfo { public: GooString *name; - GBool bold; - GBool italic; - GBool oblique; - GBool fixedWidth; + bool bold; + bool italic; + bool oblique; + bool fixedWidth; GooString *path; SysFontType type; int fontNum; // for TrueType collections GooString *substituteName; - SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA, + SysFontInfo(GooString *nameA, bool boldA, bool italicA, bool obliqueA, bool fixedWidthA, GooString *pathA, SysFontType typeA, int fontNumA, GooString *substituteNameA); ~SysFontInfo(); SysFontInfo(const SysFontInfo &) = delete; SysFontInfo& operator=(const SysFontInfo&) = delete; - GBool match(SysFontInfo *fi); - GBool match(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA); - GBool match(GooString *nameA, GBool boldA, GBool italicA); + bool match(SysFontInfo *fi); + bool match(GooString *nameA, bool boldA, bool italicA, bool obliqueA, bool fixedWidthA); + bool match(GooString *nameA, bool boldA, bool italicA); }; -SysFontInfo::SysFontInfo(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA, +SysFontInfo::SysFontInfo(GooString *nameA, bool boldA, bool italicA, bool obliqueA, bool fixedWidthA, GooString *pathA, SysFontType typeA, int fontNumA, GooString *substituteNameA) { name = nameA; bold = boldA; @@ -204,17 +204,17 @@ SysFontInfo::~SysFontInfo() { delete substituteName; } -GBool SysFontInfo::match(SysFontInfo *fi) { +bool SysFontInfo::match(SysFontInfo *fi) { return !strcasecmp(name->getCString(), fi->name->getCString()) && bold == fi->bold && italic == fi->italic && oblique == fi->oblique && fixedWidth == fi->fixedWidth; } -GBool SysFontInfo::match(GooString *nameA, GBool boldA, GBool italicA, GBool obliqueA, GBool fixedWidthA) { +bool SysFontInfo::match(GooString *nameA, bool boldA, bool italicA, bool obliqueA, bool fixedWidthA) { return !strcasecmp(name->getCString(), nameA->getCString()) && bold == boldA && italic == italicA && oblique == obliqueA && fixedWidth == fixedWidthA; } -GBool SysFontInfo::match(GooString *nameA, GBool boldA, GBool italicA) { +bool SysFontInfo::match(GooString *nameA, bool boldA, bool italicA) { return !strcasecmp(name->getCString(), nameA->getCString()) && bold == boldA && italic == italicA; } @@ -230,7 +230,7 @@ public: ~SysFontList(); SysFontList(const SysFontList &) = delete; SysFontList& operator=(const SysFontList &) = delete; - SysFontInfo *find(const GooString *name, GBool isFixedWidth, GBool exact); + SysFontInfo *find(const GooString *name, bool isFixedWidth, bool exact); #ifdef _WIN32 void scanWindowsFonts(GooString *winFontDir); @@ -256,9 +256,9 @@ SysFontList::~SysFontList() { deleteGooList<SysFontInfo>(fonts); } -SysFontInfo *SysFontList::find(const GooString *name, GBool fixedWidth, GBool exact) { +SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exact) { GooString *name2; - GBool bold, italic, oblique; + bool bold, italic, oblique; SysFontInfo *fi; char c; int n, i; @@ -292,28 +292,28 @@ SysFontInfo *SysFontList::find(const GooString *name, GBool fixedWidth, GBool ex // look for "Italic" if (n > 6 && !strcmp(name2->getCString() + n - 6, "Italic")) { name2->del(n - 6, 6); - italic = gTrue; + italic = true; n -= 6; } else { - italic = gFalse; + italic = false; } // look for "Oblique" if (n > 6 && !strcmp(name2->getCString() + n - 7, "Oblique")) { name2->del(n - 7, 7); - oblique = gTrue; + oblique = true; n -= 6; } else { - oblique = gFalse; + oblique = false; } // look for "Bold" if (n > 4 && !strcmp(name2->getCString() + n - 4, "Bold")) { name2->del(n - 4, 4); - bold = gTrue; + bold = true; n -= 4; } else { - bold = gFalse; + bold = false; } // remove trailing "MT" (FooMT-Bold, etc.) @@ -347,7 +347,7 @@ SysFontInfo *SysFontList::find(const GooString *name, GBool fixedWidth, GBool ex // try ignoring the bold flag for (i = 0; i < fonts->getLength(); ++i) { fi = (SysFontInfo *)fonts->get(i); - if (fi->match(name2, gFalse, italic)) { + if (fi->match(name2, false, italic)) { break; } fi = nullptr; @@ -357,7 +357,7 @@ SysFontInfo *SysFontList::find(const GooString *name, GBool fixedWidth, GBool ex // try ignoring the bold and italic flags for (i = 0; i < fonts->getLength(); ++i) { fi = (SysFontInfo *)fonts->get(i); - if (fi->match(name2, gFalse, gFalse)) { + if (fi->match(name2, false, false)) { break; } fi = nullptr; @@ -395,8 +395,8 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) nameToUnicodeText = new NameToCharCode(); toUnicodeDirs = new GooList(); sysFonts = new SysFontList(); - psExpandSmaller = gFalse; - psShrinkLarger = gTrue; + psExpandSmaller = false; + psShrinkLarger = true; psLevel = psLevel2; textEncoding = new GooString("UTF-8"); #if defined(_WIN32) @@ -406,12 +406,12 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) #else textEOL = eolUnix; #endif - textPageBreaks = gTrue; - enableFreeType = gTrue; - overprintPreview = gFalse; - printCommands = gFalse; - profileCommands = gFalse; - errQuiet = gFalse; + textPageBreaks = true; + enableFreeType = true; + overprintPreview = false; + printCommands = false; + profileCommands = false; + errQuiet = false; cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize); unicodeToUnicodeCache = @@ -419,7 +419,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) unicodeMapCache = new UnicodeMapCache(); cMapCache = new CMapCache(); - baseFontsInitialized = gFalse; + baseFontsInitialized = false; // set up the initial nameToUnicode tables for (int i = 0; nameToUnicodeZapfDingbatsTab[i].name; ++i) { @@ -432,17 +432,17 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) // set up the residentUnicodeMaps table residentUnicodeMaps.reserve(6); - UnicodeMap map = {"Latin1", gFalse, latin1UnicodeMapRanges, latin1UnicodeMapLen}; + UnicodeMap map = {"Latin1", false, latin1UnicodeMapRanges, latin1UnicodeMapLen}; residentUnicodeMaps.emplace(map.getEncodingName()->toStr(), std::move(map)); - map = {"ASCII7", gFalse, ascii7UnicodeMapRanges, ascii7UnicodeMapLen}; + map = {"ASCII7", false, ascii7UnicodeMapRanges, ascii7UnicodeMapLen}; residentUnicodeMaps.emplace(map.getEncodingName()->toStr(), std::move(map)); - map = {"Symbol", gFalse, symbolUnicodeMapRanges, symbolUnicodeMapLen}; + map = {"Symbol", false, symbolUnicodeMapRanges, symbolUnicodeMapLen}; residentUnicodeMaps.emplace(map.getEncodingName()->toStr(), std::move(map)); - map = {"ZapfDingbats", gFalse, zapfDingbatsUnicodeMapRanges, zapfDingbatsUnicodeMapLen}; + map = {"ZapfDingbats", false, zapfDingbatsUnicodeMapRanges, zapfDingbatsUnicodeMapLen}; residentUnicodeMaps.emplace(map.getEncodingName()->toStr(), std::move(map)); - map = {"UTF-8", gTrue, &mapUTF8}; + map = {"UTF-8", true, &mapUTF8}; residentUnicodeMaps.emplace(map.getEncodingName()->toStr(), std::move(map)); - map = {"UTF-16", gTrue, &mapUTF16}; + map = {"UTF-16", true, &mapUTF16}; residentUnicodeMaps.emplace(map.getEncodingName()->toStr(), std::move(map)); scanEncodingDirs(); @@ -458,7 +458,7 @@ void GlobalParams::scanEncodingDirs() { char *dataPathBuffer = new char[bufSize]; snprintf(dataPathBuffer, bufSize, "%s/nameToUnicode", dataRoot); - dir = new GDir(dataPathBuffer, gTrue); + dir = new GDir(dataPathBuffer, true); while (entry = dir->getNextEntry(), entry != nullptr) { if (!entry->isDir()) { parseNameToUnicode(entry->getFullPath()); @@ -468,7 +468,7 @@ void GlobalParams::scanEncodingDirs() { delete dir; snprintf(dataPathBuffer, bufSize, "%s/cidToUnicode", dataRoot); - dir = new GDir(dataPathBuffer, gFalse); + dir = new GDir(dataPathBuffer, false); while (entry = dir->getNextEntry(), entry != nullptr) { addCIDToUnicode(entry->getName(), entry->getFullPath()); delete entry; @@ -476,7 +476,7 @@ void GlobalParams::scanEncodingDirs() { delete dir; snprintf(dataPathBuffer, bufSize, "%s/unicodeMap", dataRoot); - dir = new GDir(dataPathBuffer, gFalse); + dir = new GDir(dataPathBuffer, false); while (entry = dir->getNextEntry(), entry != nullptr) { addUnicodeMap(entry->getName(), entry->getFullPath()); delete entry; @@ -484,7 +484,7 @@ void GlobalParams::scanEncodingDirs() { delete dir; snprintf(dataPathBuffer, bufSize, "%s/cMap", dataRoot); - dir = new GDir(dataPathBuffer, gFalse); + dir = new GDir(dataPathBuffer, false); while (entry = dir->getNextEntry(), entry != nullptr) { addCMapDir(entry->getName(), entry->getFullPath()); toUnicodeDirs->push_back(entry->getFullPath()->copy()); @@ -536,15 +536,15 @@ void GlobalParams::addCMapDir(const GooString *collection, const GooString *dir) cMapDirs.emplace(collection->toStr(), dir->toStr()); } -GBool GlobalParams::parseYesNo2(const char *token, GBool *flag) { +bool GlobalParams::parseYesNo2(const char *token, bool *flag) { if (!strcmp(token, "yes")) { - *flag = gTrue; + *flag = true; } else if (!strcmp(token, "no")) { - *flag = gFalse; + *flag = false; } else { - return gFalse; + return false; } - return gTrue; + return true; } GlobalParams::~GlobalParams() { @@ -648,21 +648,21 @@ FILE *GlobalParams::findToUnicodeFile(const GooString *name) { } #ifdef WITH_FONTCONFIGURATION_FONTCONFIG -static GBool findModifier(const char *name, const char *modifier, const char **start) +static bool findModifier(const char *name, const char *modifier, const char **start) { const char *match; if (name == nullptr) - return gFalse; + return false; match = strstr(name, modifier); if (match) { if (*start == nullptr || match < *start) *start = match; - return gTrue; + return true; } else { - return gFalse; + return false; } } @@ -857,7 +857,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, globalParamsLocker(); - if ((fi = sysFonts->find(fontName, font->isFixedWidth(), gTrue))) { + if ((fi = sysFonts->find(fontName, font->isFixedWidth(), true))) { path = fi->path->copy(); *type = fi->type; *fontNum = fi->fontNum; @@ -932,20 +932,20 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, if (!strncasecmp(ext,".ttf",4) || !strncasecmp(ext, ".ttc", 4) || !strncasecmp(ext, ".otf", 4)) { int weight, slant; - GBool bold = font->isBold(); - GBool italic = font->isItalic(); - GBool oblique = gFalse; + bool bold = font->isBold(); + bool italic = font->isItalic(); + bool oblique = false; FcPatternGetInteger(set->fonts[i], FC_WEIGHT, 0, &weight); FcPatternGetInteger(set->fonts[i], FC_SLANT, 0, &slant); if (weight == FC_WEIGHT_DEMIBOLD || weight == FC_WEIGHT_BOLD || weight == FC_WEIGHT_EXTRABOLD || weight == FC_WEIGHT_BLACK) { - bold = gTrue; + bold = true; } if (slant == FC_SLANT_ITALIC) - italic = gTrue; + italic = true; if (slant == FC_SLANT_OBLIQUE) - oblique = gTrue; + oblique = true; *fontNum = 0; *type = (!strncasecmp(ext,".ttc",4)) ? sysFontTTC : sysFontTTF; FcPatternGetInteger(set->fonts[i], FC_INDEX, 0, fontNum); @@ -957,20 +957,20 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, else if (!strncasecmp(ext,".pfa",4) || !strncasecmp(ext,".pfb",4)) { int weight, slant; - GBool bold = font->isBold(); - GBool italic = font->isItalic(); - GBool oblique = gFalse; + bool bold = font->isBold(); + bool italic = font->isItalic(); + bool oblique = false; FcPatternGetInteger(set->fonts[i], FC_WEIGHT, 0, &weight); FcPatternGetInteger(set->fonts[i], FC_SLANT, 0, &slant); if (weight == FC_WEIGHT_DEMIBOLD || weight == FC_WEIGHT_BOLD || weight == FC_WEIGHT_EXTRABOLD || weight == FC_WEIGHT_BLACK) { - bold = gTrue; + bold = true; } if (slant == FC_SLANT_ITALIC) - italic = gTrue; + italic = true; if (slant == FC_SLANT_OBLIQUE) - oblique = gTrue; + oblique = true; *fontNum = 0; *type = (!strncasecmp(ext,".pfa",4)) ? sysFontPFA : sysFontPFB; FcPatternGetInteger(set->fonts[i], FC_INDEX, 0, fontNum); @@ -993,7 +993,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, } FcFontSetDestroy(set); } - if (path == nullptr && (fi = sysFonts->find(fontName, font->isFixedWidth(), gFalse))) { + if (path == nullptr && (fi = sysFonts->find(fontName, font->isFixedWidth(), false))) { path = fi->path->copy(); *type = fi->type; *fontNum = fi->fontNum; @@ -1104,7 +1104,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, path = nullptr; globalParamsLocker(); - if ((fi = sysFonts->find(fontName, font->isFixedWidth(), gFalse))) { + if ((fi = sysFonts->find(fontName, font->isFixedWidth(), false))) { path = fi->path->copy(); *type = fi->type; *fontNum = fi->fontNum; @@ -1114,12 +1114,12 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, } #endif -GBool GlobalParams::getPSExpandSmaller() { +bool GlobalParams::getPSExpandSmaller() { globalParamsLocker(); return psExpandSmaller; } -GBool GlobalParams::getPSShrinkLarger() { +bool GlobalParams::getPSShrinkLarger() { globalParamsLocker(); return psShrinkLarger; } @@ -1139,27 +1139,27 @@ EndOfLineKind GlobalParams::getTextEOL() { return textEOL; } -GBool GlobalParams::getTextPageBreaks() { +bool GlobalParams::getTextPageBreaks() { globalParamsLocker(); return textPageBreaks; } -GBool GlobalParams::getEnableFreeType() { +bool GlobalParams::getEnableFreeType() { globalParamsLocker(); return enableFreeType; } -GBool GlobalParams::getPrintCommands() { +bool GlobalParams::getPrintCommands() { globalParamsLocker(); return printCommands; } -GBool GlobalParams::getProfileCommands() { +bool GlobalParams::getProfileCommands() { globalParamsLocker(); return profileCommands; } -GBool GlobalParams::getErrQuiet() { +bool GlobalParams::getErrQuiet() { // no locking -- this function may get called from inside a locked // section return errQuiet; @@ -1226,12 +1226,12 @@ void GlobalParams::addFontFile(GooString *fontName, GooString *path) { fontFiles[fontName->toStr()] = path->toStr(); } -void GlobalParams::setPSExpandSmaller(GBool expand) { +void GlobalParams::setPSExpandSmaller(bool expand) { globalParamsLocker(); psExpandSmaller = expand; } -void GlobalParams::setPSShrinkLarger(GBool shrink) { +void GlobalParams::setPSShrinkLarger(bool shrink) { globalParamsLocker(); psShrinkLarger = shrink; } @@ -1247,7 +1247,7 @@ void GlobalParams::setTextEncoding(char *encodingName) { textEncoding = new GooString(encodingName); } -GBool GlobalParams::setTextEOL(char *s) { +bool GlobalParams::setTextEOL(char *s) { globalParamsLocker(); if (!strcmp(s, "unix")) { textEOL = eolUnix; @@ -1256,37 +1256,37 @@ GBool GlobalParams::setTextEOL(char *s) { } else if (!strcmp(s, "mac")) { textEOL = eolMac; } else { - return gFalse; + return false; } - return gTrue; + return true; } -void GlobalParams::setTextPageBreaks(GBool pageBreaks) { +void GlobalParams::setTextPageBreaks(bool pageBreaks) { globalParamsLocker(); textPageBreaks = pageBreaks; } -GBool GlobalParams::setEnableFreeType(char *s) { +bool GlobalParams::setEnableFreeType(char *s) { globalParamsLocker(); return parseYesNo2(s, &enableFreeType); } -void GlobalParams::setOverprintPreview(GBool overprintPreviewA) { +void GlobalParams::setOverprintPreview(bool overprintPreviewA) { globalParamsLocker(); overprintPreview = overprintPreviewA; } -void GlobalParams::setPrintCommands(GBool printCommandsA) { +void GlobalParams::setPrintCommands(bool printCommandsA) { globalParamsLocker(); printCommands = printCommandsA; } -void GlobalParams::setProfileCommands(GBool profileCommandsA) { +void GlobalParams::setProfileCommands(bool profileCommandsA) { globalParamsLocker(); profileCommands = profileCommandsA; } -void GlobalParams::setErrQuiet(GBool errQuietA) { +void GlobalParams::setErrQuiet(bool errQuietA) { globalParamsLocker(); errQuiet = errQuietA; } diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h index 4f477dea..4c0b28d9 100644 --- a/poppler/GlobalParams.h +++ b/poppler/GlobalParams.h @@ -129,17 +129,17 @@ public: GooString *findSystemFontFile(GfxFont *font, SysFontType *type, int *fontNum, GooString *substituteFontName = nullptr, const GooString *base14Name = nullptr); - GBool getPSExpandSmaller(); - GBool getPSShrinkLarger(); + bool getPSExpandSmaller(); + bool getPSShrinkLarger(); PSLevel getPSLevel(); GooString *getTextEncodingName(); EndOfLineKind getTextEOL(); - GBool getTextPageBreaks(); - GBool getEnableFreeType(); - GBool getOverprintPreview() { return overprintPreview; } - GBool getPrintCommands(); - GBool getProfileCommands(); - GBool getErrQuiet(); + bool getTextPageBreaks(); + bool getEnableFreeType(); + bool getOverprintPreview() { return overprintPreview; } + bool getPrintCommands(); + bool getProfileCommands(); + bool getErrQuiet(); CharCodeToUnicode *getCIDToUnicode(GooString *collection); UnicodeMap *getUnicodeMap(GooString *encodingName); @@ -150,19 +150,19 @@ public: //----- functions to set parameters void addFontFile(GooString *fontName, GooString *path); - void setPSExpandSmaller(GBool expand); - void setPSShrinkLarger(GBool shrink); + void setPSExpandSmaller(bool expand); + void setPSShrinkLarger(bool shrink); void setPSLevel(PSLevel level); void setTextEncoding(char *encodingName); - GBool setTextEOL(char *s); - void setTextPageBreaks(GBool pageBreaks); - GBool setEnableFreeType(char *s); - void setOverprintPreview(GBool overprintPreviewA); - void setPrintCommands(GBool printCommandsA); - void setProfileCommands(GBool profileCommandsA); - void setErrQuiet(GBool errQuietA); + bool setTextEOL(char *s); + void setTextPageBreaks(bool pageBreaks); + bool setEnableFreeType(char *s); + void setOverprintPreview(bool overprintPreviewA); + void setPrintCommands(bool printCommandsA); + void setProfileCommands(bool profileCommandsA); + void setErrQuiet(bool errQuietA); - static GBool parseYesNo2(const char *token, GBool *flag); + static bool parseYesNo2(const char *token, bool *flag); private: @@ -197,7 +197,7 @@ private: // list of CMap dirs, indexed by collection std::unordered_multimap<std::string, std::string> cMapDirs; GooList *toUnicodeDirs; // list of ToUnicode CMap dirs [GooString] - GBool baseFontsInitialized; + bool baseFontsInitialized; #ifdef _WIN32 // windows font substitutes (for CID fonts) std::unordered_map<std::string, std::string> substFiles; @@ -205,19 +205,19 @@ private: // font files: font name mapped to path std::unordered_map<std::string, std::string> fontFiles; SysFontList *sysFonts; // system fonts - GBool psExpandSmaller; // expand smaller pages to fill paper - GBool psShrinkLarger; // shrink larger pages to fit paper + bool psExpandSmaller; // expand smaller pages to fill paper + bool psShrinkLarger; // shrink larger pages to fit paper PSLevel psLevel; // PostScript level to generate GooString *textEncoding; // encoding (unicodeMap) to use for text // output EndOfLineKind textEOL; // type of EOL marker to use for text // output - GBool textPageBreaks; // insert end-of-page markers? - GBool enableFreeType; // FreeType enable flag - GBool overprintPreview; // enable overprint preview - GBool printCommands; // print the drawing commands - GBool profileCommands; // profile the drawing commands - GBool errQuiet; // suppress error messages? + bool textPageBreaks; // insert end-of-page markers? + bool enableFreeType; // FreeType enable flag + bool overprintPreview; // enable overprint preview + bool printCommands; // print the drawing commands + bool profileCommands; // profile the drawing commands + bool errQuiet; // suppress error messages? CharCodeToUnicodeCache *cidToUnicodeCache; CharCodeToUnicodeCache *unicodeToUnicodeCache; diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc index f975483c..2df46aef 100644 --- a/poppler/GlobalParamsWin.cc +++ b/poppler/GlobalParamsWin.cc @@ -62,98 +62,98 @@ static const struct { const char *name; const char *t1FileName; const char *ttFileName; - GBool warnIfMissing; + bool warnIfMissing; } displayFontTab[] = { - {"Courier", "n022003l.pfb", "cour.ttf", gTrue}, - {"Courier-Bold", "n022004l.pfb", "courbd.ttf", gTrue}, - {"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf", gTrue}, - {"Courier-Oblique", "n022023l.pfb", "couri.ttf", gTrue}, - {"Helvetica", "n019003l.pfb", "arial.ttf", gTrue}, - {"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf", gTrue}, - {"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf", gTrue}, - {"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf", gTrue}, + {"Courier", "n022003l.pfb", "cour.ttf", true}, + {"Courier-Bold", "n022004l.pfb", "courbd.ttf", true}, + {"Courier-BoldOblique", "n022024l.pfb", "courbi.ttf", true}, + {"Courier-Oblique", "n022023l.pfb", "couri.ttf", true}, + {"Helvetica", "n019003l.pfb", "arial.ttf", true}, + {"Helvetica-Bold", "n019004l.pfb", "arialbd.ttf", true}, + {"Helvetica-BoldOblique", "n019024l.pfb", "arialbi.ttf", true}, + {"Helvetica-Oblique", "n019023l.pfb", "ariali.ttf", true}, // TODO: not sure if "symbol.ttf" is right - {"Symbol", "s050000l.pfb", "symbol.ttf", gTrue}, - {"Times-Bold", "n021004l.pfb", "timesbd.ttf", gTrue}, - {"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf", gTrue}, - {"Times-Italic", "n021023l.pfb", "timesi.ttf", gTrue}, - {"Times-Roman", "n021003l.pfb", "times.ttf", gTrue}, + {"Symbol", "s050000l.pfb", "symbol.ttf", true}, + {"Times-Bold", "n021004l.pfb", "timesbd.ttf", true}, + {"Times-BoldItalic", "n021024l.pfb", "timesbi.ttf", true}, + {"Times-Italic", "n021023l.pfb", "timesi.ttf", true}, + {"Times-Roman", "n021003l.pfb", "times.ttf", true}, // TODO: not sure if "wingding.ttf" is right - {"ZapfDingbats", "d050000l.pfb", "wingding.ttf", gTrue}, + {"ZapfDingbats", "d050000l.pfb", "wingding.ttf", true}, // those seem to be frequently accessed by PDF files and I kind of guess // which font file do the refer to - {"Palatino", nullptr, "pala.ttf", gTrue}, - {"Palatino-Roman", nullptr, "pala.ttf", gTrue}, - {"Palatino-Bold", nullptr, "palab.ttf", gTrue}, - {"Palatino-Italic", nullptr, "palai.ttf", gTrue}, - {"Palatino,Italic", nullptr, "palai.ttf", gTrue}, - {"Palatino-BoldItalic", nullptr, "palabi.ttf", gTrue}, - - {"ArialBlack", nullptr, "arialbd.ttf", gTrue}, - - {"ArialNarrow", nullptr, "arialn.ttf", gTrue}, - {"ArialNarrow,Bold", nullptr, "arialnb.ttf", gTrue}, - {"ArialNarrow,Italic", nullptr, "arialni.ttf", gTrue}, - {"ArialNarrow,BoldItalic", nullptr, "arialnbi.ttf", gTrue}, - {"ArialNarrow-Bold", nullptr, "arialnb.ttf", gTrue}, - {"ArialNarrow-Italic", nullptr, "arialni.ttf", gTrue}, - {"ArialNarrow-BoldItalic", nullptr, "arialnbi.ttf", gTrue}, - - {"HelveticaNarrow", nullptr, "arialn.ttf", gTrue}, - {"HelveticaNarrow,Bold", nullptr, "arialnb.ttf", gTrue}, - {"HelveticaNarrow,Italic", nullptr, "arialni.ttf", gTrue}, - {"HelveticaNarrow,BoldItalic", nullptr, "arialnbi.ttf", gTrue}, - {"HelveticaNarrow-Bold", nullptr, "arialnb.ttf", gTrue}, - {"HelveticaNarrow-Italic", nullptr, "arialni.ttf", gTrue}, - {"HelveticaNarrow-BoldItalic", nullptr, "arialnbi.ttf", gTrue}, - - {"BookAntiqua", nullptr, "bkant.ttf", gTrue}, - {"BookAntiqua,Bold", nullptr, "bkant.ttf", gTrue}, - {"BookAntiqua,Italic", nullptr, "bkant.ttf", gTrue}, - {"BookAntiqua,BoldItalic", nullptr, "bkant.ttf", gTrue}, - {"BookAntiqua-Bold", nullptr, "bkant.ttf", gTrue}, - {"BookAntiqua-Italic", nullptr, "bkant.ttf", gTrue}, - {"BookAntiqua-BoldItalic", nullptr, "bkant.ttf", gTrue}, - - {"Verdana", nullptr, "verdana.ttf", gTrue}, - {"Verdana,Bold", nullptr, "verdanab.ttf", gTrue}, - {"Verdana,Italic", nullptr, "verdanai.ttf", gTrue}, - {"Verdana,BoldItalic", nullptr, "verdanaz.ttf", gTrue}, - {"Verdana-Bold", nullptr, "verdanab.ttf", gTrue}, - {"Verdana-Italic", nullptr, "verdanai.ttf", gTrue}, - {"Verdana-BoldItalic", nullptr, "verdanaz.ttf", gTrue}, - - {"Tahoma", nullptr, "tahoma.ttf", gTrue}, - {"Tahoma,Bold", nullptr, "tahomabd.ttf", gTrue}, - {"Tahoma,Italic", nullptr, "tahoma.ttf", gTrue}, - {"Tahoma,BoldItalic", nullptr, "tahomabd.ttf", gTrue}, - {"Tahoma-Bold", nullptr, "tahomabd.ttf", gTrue}, - {"Tahoma-Italic", nullptr, "tahoma.ttf", gTrue}, - {"Tahoma-BoldItalic", nullptr, "tahomabd.ttf", gTrue}, - - {"CCRIKH+Verdana", nullptr, "verdana.ttf", gTrue}, - {"CCRIKH+Verdana,Bold", nullptr, "verdanab.ttf", gTrue}, - {"CCRIKH+Verdana,Italic", nullptr, "verdanai.ttf", gTrue}, - {"CCRIKH+Verdana,BoldItalic", nullptr, "verdanaz.ttf", gTrue}, - {"CCRIKH+Verdana-Bold", nullptr, "verdanab.ttf", gTrue}, - {"CCRIKH+Verdana-Italic", nullptr, "verdanai.ttf", gTrue}, - {"CCRIKH+Verdana-BoldItalic", nullptr, "verdanaz.ttf", gTrue}, - - {"Georgia", nullptr, "georgia.ttf", gTrue}, - {"Georgia,Bold", nullptr, "georgiab.ttf", gTrue}, - {"Georgia,Italic", nullptr, "georgiai.ttf", gTrue}, - {"Georgia,BoldItalic", nullptr, "georgiaz.ttf", gTrue}, - {"Georgia-Bold", nullptr, "georgiab.ttf", gTrue}, - {"Georgia-Italic", nullptr, "georgiai.ttf", gTrue}, - {"Georgia-BoldItalic", nullptr, "georgiaz.ttf", gTrue}, + {"Palatino", nullptr, "pala.ttf", true}, + {"Palatino-Roman", nullptr, "pala.ttf", true}, + {"Palatino-Bold", nullptr, "palab.ttf", true}, + {"Palatino-Italic", nullptr, "palai.ttf", true}, + {"Palatino,Italic", nullptr, "palai.ttf", true}, + {"Palatino-BoldItalic", nullptr, "palabi.ttf", true}, + + {"ArialBlack", nullptr, "arialbd.ttf", true}, + + {"ArialNarrow", nullptr, "arialn.ttf", true}, + {"ArialNarrow,Bold", nullptr, "arialnb.ttf", true}, + {"ArialNarrow,Italic", nullptr, "arialni.ttf", true}, + {"ArialNarrow,BoldItalic", nullptr, "arialnbi.ttf", true}, + {"ArialNarrow-Bold", nullptr, "arialnb.ttf", true}, + {"ArialNarrow-Italic", nullptr, "arialni.ttf", true}, + {"ArialNarrow-BoldItalic", nullptr, "arialnbi.ttf", true}, + + {"HelveticaNarrow", nullptr, "arialn.ttf", true}, + {"HelveticaNarrow,Bold", nullptr, "arialnb.ttf", true}, + {"HelveticaNarrow,Italic", nullptr, "arialni.ttf", true}, + {"HelveticaNarrow,BoldItalic", nullptr, "arialnbi.ttf", true}, + {"HelveticaNarrow-Bold", nullptr, "arialnb.ttf", true}, + {"HelveticaNarrow-Italic", nullptr, "arialni.ttf", true}, + {"HelveticaNarrow-BoldItalic", nullptr, "arialnbi.ttf", true}, + + {"BookAntiqua", nullptr, "bkant.ttf", true}, + {"BookAntiqua,Bold", nullptr, "bkant.ttf", true}, + {"BookAntiqua,Italic", nullptr, "bkant.ttf", true}, + {"BookAntiqua,BoldItalic", nullptr, "bkant.ttf", true}, + {"BookAntiqua-Bold", nullptr, "bkant.ttf", true}, + {"BookAntiqua-Italic", nullptr, "bkant.ttf", true}, + {"BookAntiqua-BoldItalic", nullptr, "bkant.ttf", true}, + + {"Verdana", nullptr, "verdana.ttf", true}, + {"Verdana,Bold", nullptr, "verdanab.ttf", true}, + {"Verdana,Italic", nullptr, "verdanai.ttf", true}, + {"Verdana,BoldItalic", nullptr, "verdanaz.ttf", true}, + {"Verdana-Bold", nullptr, "verdanab.ttf", true}, + {"Verdana-Italic", nullptr, "verdanai.ttf", true}, + {"Verdana-BoldItalic", nullptr, "verdanaz.ttf", true}, + + {"Tahoma", nullptr, "tahoma.ttf", true}, + {"Tahoma,Bold", nullptr, "tahomabd.ttf", true}, + {"Tahoma,Italic", nullptr, "tahoma.ttf", true}, + {"Tahoma,BoldItalic", nullptr, "tahomabd.ttf", true}, + {"Tahoma-Bold", nullptr, "tahomabd.ttf", true}, + {"Tahoma-Italic", nullptr, "tahoma.ttf", true}, + {"Tahoma-BoldItalic", nullptr, "tahomabd.ttf", true}, + + {"CCRIKH+Verdana", nullptr, "verdana.ttf", true}, + {"CCRIKH+Verdana,Bold", nullptr, "verdanab.ttf", true}, + {"CCRIKH+Verdana,Italic", nullptr, "verdanai.ttf", true}, + {"CCRIKH+Verdana,BoldItalic", nullptr, "verdanaz.ttf", true}, + {"CCRIKH+Verdana-Bold", nullptr, "verdanab.ttf", true}, + {"CCRIKH+Verdana-Italic", nullptr, "verdanai.ttf", true}, + {"CCRIKH+Verdana-BoldItalic", nullptr, "verdanaz.ttf", true}, + + {"Georgia", nullptr, "georgia.ttf", true}, + {"Georgia,Bold", nullptr, "georgiab.ttf", true}, + {"Georgia,Italic", nullptr, "georgiai.ttf", true}, + {"Georgia,BoldItalic", nullptr, "georgiaz.ttf", true}, + {"Georgia-Bold", nullptr, "georgiab.ttf", true}, + {"Georgia-Italic", nullptr, "georgiai.ttf", true}, + {"Georgia-BoldItalic", nullptr, "georgiaz.ttf", true}, // fallback for Adobe CID fonts: - {"MingLiU", nullptr, "mingliu.ttf", gFalse}, - {"SimSun", nullptr, "simsun.ttf", gFalse}, - {"MS-Mincho", nullptr, "msmincho.ttf", gFalse}, - {"Batang", nullptr, "batang.ttf", gFalse}, - {"ArialUnicode", nullptr, "arialuni.ttf", gTrue}, + {"MingLiU", nullptr, "mingliu.ttf", false}, + {"SimSun", nullptr, "simsun.ttf", false}, + {"MS-Mincho", nullptr, "msmincho.ttf", false}, + {"Batang", nullptr, "batang.ttf", false}, + {"ArialUnicode", nullptr, "arialuni.ttf", true}, { } }; @@ -294,7 +294,7 @@ void SysFontList::scanWindowsFonts(GooString *winFontDir) { SysFontInfo *SysFontList::makeWindowsFont(const char *name, int fontNum, const char *path) { int n; - GBool bold, italic, oblique, fixedWidth; + bool bold, italic, oblique, fixedWidth; GooString *s; char c; int i; @@ -302,7 +302,7 @@ SysFontInfo *SysFontList::makeWindowsFont(const char *name, int fontNum, GooString substituteName; n = strlen(name); - bold = italic = oblique = fixedWidth = gFalse; + bold = italic = oblique = fixedWidth = false; // remove trailing ' (TrueType)' if (n > 11 && !strncmp(name + n - 11, " (TrueType)", 11)) { @@ -317,19 +317,19 @@ SysFontInfo *SysFontList::makeWindowsFont(const char *name, int fontNum, // remove trailing ' Italic' if (n > 7 && !strncmp(name + n - 7, " Italic", 7)) { n -= 7; - italic = gTrue; + italic = true; } // remove trailing ' Oblique' if (n > 7 && !strncmp(name + n - 8, " Oblique", 8)) { n -= 8; - oblique = gTrue; + oblique = true; } // remove trailing ' Bold' if (n > 5 && !strncmp(name + n - 5, " Bold", 5)) { n -= 5; - bold = gTrue; + bold = true; } // remove trailing ' Regular' @@ -343,9 +343,9 @@ SysFontInfo *SysFontList::makeWindowsFont(const char *name, int fontNum, strstr(name, "Fixed") || (strstr(name, "Mono") && !strstr(name, "Monotype")) || strstr(name, "Typewriter") ) - fixedWidth = gTrue; + fixedWidth = true; else - fixedWidth = gFalse; + fixedWidth = false; //----- normalize the font name @@ -447,8 +447,8 @@ void GlobalParams::setupBaseFonts(char * dir) Parser *parser; parser = new Parser(nullptr, new Lexer(nullptr, - new FileStream(file, 0, gFalse, file->size(), Object(objNull))), - gTrue); + new FileStream(file, 0, false, file->size(), Object(objNull))), + true); Object obj1 = parser->getObj(); while (!obj1.isEOF()) { Object obj2 = parser->getObj(); @@ -543,7 +543,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, // In the system using FontConfig, findSystemFontFile() uses // base14Name only for the creation of query pattern. - if ((fi = sysFonts->find(fontName, gFalse, gFalse))) { + if ((fi = sysFonts->find(fontName, false, false))) { path = fi->path->copy(); *type = fi->type; *fontNum = fi->fontNum; diff --git a/poppler/Hints.cc b/poppler/Hints.cc index a231ba34..57daa235 100644 --- a/poppler/Hints.cc +++ b/poppler/Hints.cc @@ -32,7 +32,7 @@ public: StreamBitReader(Stream *strA) : str(strA) , inputBits(0) - , isAtEof(gFalse) + , isAtEof(false) { } @@ -41,7 +41,7 @@ public: inputBits = 0; } - GBool atEOF() const + bool atEOF() const { return isAtEof; } @@ -53,7 +53,7 @@ public: if (inputBits == 0) { if ((c = str->getChar()) == EOF) { - isAtEof = gTrue; + isAtEof = true; return (Guint) -1; } bitsBuffer = c; @@ -91,7 +91,7 @@ private: Stream *str; int inputBits; char bitsBuffer; - GBool isAtEof; + bool isAtEof; }; //------------------------------------------------------------------------ @@ -147,7 +147,7 @@ Hints::Hints(BaseStream *str, Linearization *linearization, XRef *xref, Security groupNumObjects = nullptr; groupXRefOffset = nullptr; - ok = gTrue; + ok = true; readTables(str, linearization, xref, secHdlr); } @@ -187,13 +187,13 @@ void Hints::readTables(BaseStream *str, Linearization *linearization, XRef *xref std::vector<char> buf(bufLength); char *p = &buf[0]; - Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, Object(objNull)); + Stream *s = str->makeSubStream(hintsOffset, false, hintsLength, Object(objNull)); s->reset(); for (Guint i=0; i < hintsLength; i++) { *p++ = s->getChar(); } delete s; if (hintsOffset2 && hintsLength2) { - s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, Object(objNull)); + s = str->makeSubStream(hintsOffset2, false, hintsLength2, Object(objNull)); s->reset(); for (Guint i=0; i < hintsLength2; i++) { *p++ = s->getChar(); } delete s; @@ -201,18 +201,18 @@ void Hints::readTables(BaseStream *str, Linearization *linearization, XRef *xref MemStream *memStream = new MemStream (&buf[0], 0, bufLength, Object(objNull)); - parser = new Parser(xref, new Lexer(xref, memStream), gTrue); + parser = new Parser(xref, new Lexer(xref, memStream), true); int num, gen; Object obj; if ((obj = parser->getObj(), obj.isInt()) && (num = obj.getInt(), obj = parser->getObj(), obj.isInt()) && (gen = obj.getInt(), obj = parser->getObj(), obj.isCmd("obj")) && - (obj = parser->getObj(gFalse, + (obj = parser->getObj(false, secHdlr ? secHdlr->getFileKey() : nullptr, secHdlr ? secHdlr->getEncAlgorithm() : cryptRC4, secHdlr ? secHdlr->getFileKeyLength() : 0, - num, gen, 0, gTrue), obj.isStream())) { + num, gen, 0, true), obj.isStream())) { Stream *hintsStream = obj.getStream(); Dict *hintsDict = obj.streamGetDict(); @@ -238,11 +238,11 @@ void Hints::readTables(BaseStream *str, Linearization *linearization, XRef *xref delete parser; } -GBool Hints::readPageOffsetTable(Stream *str) +bool Hints::readPageOffsetTable(Stream *str) { if (nPages < 1) { error(errSyntaxWarning, -1, "Invalid number of pages reading page offset hints table"); - return gFalse; + return false; } StreamBitReader sbr(str); @@ -251,7 +251,7 @@ GBool Hints::readPageOffsetTable(Stream *str) if (nObjectLeast < 1) { error(errSyntaxWarning, -1, "Invalid least number of objects reading page offset hints table"); nPages = 0; - return gFalse; + return false; } objectOffsetFirst = sbr.readBits(32); @@ -261,7 +261,7 @@ GBool Hints::readPageOffsetTable(Stream *str) if (nBitsDiffObjects > 32) { error(errSyntaxWarning, -1, "Invalid number of bits needed to represent the difference between the greatest and least number of objects in a page"); nPages = 0; - return gFalse; + return false; } pageLengthLeast = sbr.readBits(32); @@ -288,7 +288,7 @@ GBool Hints::readPageOffsetTable(Stream *str) nObjects[i] = nObjectLeast + sbr.readBits(nBitsDiffObjects); } if (sbr.atEOF()) - return gFalse; + return false; nObjects[0] = 0; xRefOffset[0] = mainXRefEntriesOffset + 20; @@ -307,7 +307,7 @@ GBool Hints::readPageOffsetTable(Stream *str) pageLength[i] = pageLengthLeast + sbr.readBits(nBitsDiffPageLength); } if (sbr.atEOF()) - return gFalse; + return false; sbr.resetInputBits(); // reset on byte boundary. Not in specs! numSharedObject[0] = sbr.readBits(nBitsNumShared); @@ -318,17 +318,17 @@ GBool Hints::readPageOffsetTable(Stream *str) if (numSharedObject[i] >= INT_MAX / (int)sizeof(Guint)) { error(errSyntaxWarning, -1, "Invalid number of shared objects"); numSharedObject[i] = 0; - return gFalse; + return false; } sharedObjectId[i] = (Guint *) gmallocn_checkoverflow(numSharedObject[i], sizeof(Guint)); if (numSharedObject[i] && !sharedObjectId[i]) { error(errSyntaxWarning, -1, "Failed to allocate memory for shared object IDs"); numSharedObject[i] = 0; - return gFalse; + return false; } } if (sbr.atEOF()) - return gFalse; + return false; sbr.resetInputBits(); // reset on byte boundary. Not in specs! for (int i=1; i<nPages; i++) { @@ -346,7 +346,7 @@ GBool Hints::readPageOffsetTable(Stream *str) return !sbr.atEOF(); } -GBool Hints::readSharedObjectsTable(Stream *str) +bool Hints::readSharedObjectsTable(Stream *str) { StreamBitReader sbr(str); @@ -366,15 +366,15 @@ GBool Hints::readSharedObjectsTable(Stream *str) if ((!nSharedGroups) || (nSharedGroups >= INT_MAX / (int)sizeof(Guint))) { error(errSyntaxWarning, -1, "Invalid number of shared object groups"); - return gFalse; + return false; } if ((!nSharedGroupsFirst) || (nSharedGroupsFirst > nSharedGroups)) { error(errSyntaxWarning, -1, "Invalid number of first page shared object groups"); - return gFalse; + return false; } if (nBitsNumObjects > 32 || nBitsDiffGroupLength > 32) { error(errSyntaxWarning, -1, "Invalid shared object groups bit length"); - return gFalse; + return false; } groupLength = (Guint *) gmallocn_checkoverflow(nSharedGroups, sizeof(Guint)); @@ -385,7 +385,7 @@ GBool Hints::readSharedObjectsTable(Stream *str) if (!groupLength || !groupOffset || !groupHasSignature || !groupNumObjects || !groupXRefOffset) { error(errSyntaxWarning, -1, "Failed to allocate memory for shared object groups"); - return gFalse; + return false; } sbr.resetInputBits(); // reset on byte boundary. Not in specs! @@ -393,7 +393,7 @@ GBool Hints::readSharedObjectsTable(Stream *str) groupLength[i] = groupLengthLeast + sbr.readBits(nBitsDiffGroupLength); } if (sbr.atEOF()) - return gFalse; + return false; groupOffset[0] = objectOffsetFirst; for (Guint i=1; i<nSharedGroupsFirst; i++) { @@ -411,7 +411,7 @@ GBool Hints::readSharedObjectsTable(Stream *str) groupHasSignature[i] = sbr.readBits(1); } if (sbr.atEOF()) - return gFalse; + return false; sbr.resetInputBits(); // reset on byte boundary. Not in specs! for (Guint i = 0; i < nSharedGroups && !sbr.atEOF(); i++) { @@ -420,7 +420,7 @@ GBool Hints::readSharedObjectsTable(Stream *str) } } if (sbr.atEOF()) - return gFalse; + return false; sbr.resetInputBits(); // reset on byte boundary. Not in specs! for (Guint i = 0; i < nSharedGroups && !sbr.atEOF(); i++) { @@ -443,7 +443,7 @@ GBool Hints::readSharedObjectsTable(Stream *str) return !sbr.atEOF(); } -GBool Hints::isOk() const +bool Hints::isOk() const { return ok; } diff --git a/poppler/Hints.h b/poppler/Hints.h index a9062265..b535abe2 100644 --- a/poppler/Hints.h +++ b/poppler/Hints.h @@ -36,7 +36,7 @@ public: Hints(const Hints &) = delete; Hints& operator=(const Hints &) = delete; - GBool isOk() const; + bool isOk() const; int getPageObjectNum(int page); Goffset getPageOffset(int page); @@ -45,8 +45,8 @@ public: private: void readTables(BaseStream *str, Linearization *linearization, XRef *xref, SecurityHandler *secHdlr); - GBool readPageOffsetTable(Stream *str); - GBool readSharedObjectsTable(Stream *str); + bool readPageOffsetTable(Stream *str); + bool readSharedObjectsTable(Stream *str); Guint hintsOffset; Guint hintsLength; @@ -87,7 +87,7 @@ private: Guint *groupHasSignature; Guint *groupNumObjects; Guint *groupXRefOffset; - GBool ok; + bool ok; }; #endif diff --git a/poppler/JArithmeticDecoder.cc b/poppler/JArithmeticDecoder.cc index 1f54b156..45922629 100644 --- a/poppler/JArithmeticDecoder.cc +++ b/poppler/JArithmeticDecoder.cc @@ -86,7 +86,7 @@ int JArithmeticDecoder::switchTab[47] = { JArithmeticDecoder::JArithmeticDecoder() { str = nullptr; dataLen = 0; - limitStream = gFalse; + limitStream = false; nBytesRead = 0; } @@ -119,7 +119,7 @@ void JArithmeticDecoder::start() { void JArithmeticDecoder::restart(int dataLenA) { Guint cAdd; - GBool prevFF; + bool prevFF; int k, nBits; if (dataLen >= 0) { @@ -131,7 +131,7 @@ void JArithmeticDecoder::restart(int dataLenA) { k = (-dataLen - 1) * 8 - ct; dataLen = dataLenA; cAdd = 0; - prevFF = gFalse; + prevFF = false; while (k > 0) { buf0 = readByte(); if (prevFF) { @@ -241,7 +241,7 @@ int JArithmeticDecoder::decodeByte(Guint context, return byte; } -GBool JArithmeticDecoder::decodeInt(int *x, JArithmeticDecoderStats *stats) { +bool JArithmeticDecoder::decodeInt(int *x, JArithmeticDecoderStats *stats) { int s; Guint v; int i; @@ -293,13 +293,13 @@ GBool JArithmeticDecoder::decodeInt(int *x, JArithmeticDecoderStats *stats) { if (s) { if (v == 0) { - return gFalse; + return false; } *x = -(int)v; } else { *x = (int)v; } - return gTrue; + return true; } int JArithmeticDecoder::decodeIntBit(JArithmeticDecoderStats *stats) { diff --git a/poppler/JArithmeticDecoder.h b/poppler/JArithmeticDecoder.h index 3f4f0737..9e651702 100644 --- a/poppler/JArithmeticDecoder.h +++ b/poppler/JArithmeticDecoder.h @@ -67,9 +67,9 @@ public: JArithmeticDecoder& operator=(const JArithmeticDecoder &) = delete; void setStream(Stream *strA) - { str = strA; dataLen = 0; limitStream = gFalse; } + { str = strA; dataLen = 0; limitStream = false; } void setStream(Stream *strA, int dataLenA) - { str = strA; dataLen = dataLenA; limitStream = gTrue; } + { str = strA; dataLen = dataLenA; limitStream = true; } // Start decoding on a new stream. This fills the byte buffers and // runs INITDEC. @@ -91,7 +91,7 @@ public: int decodeByte(Guint context, JArithmeticDecoderStats *stats); // Returns false for OOB, otherwise sets *<x> and returns true. - GBool decodeInt(int *x, JArithmeticDecoderStats *stats); + bool decodeInt(int *x, JArithmeticDecoderStats *stats); Guint decodeIAID(Guint codeLen, JArithmeticDecoderStats *stats); @@ -119,7 +119,7 @@ private: Stream *str; Guint nBytesRead; int dataLen; - GBool limitStream; + bool limitStream; }; #endif diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc index c3621a7a..f4c735e6 100644 --- a/poppler/JBIG2Stream.cc +++ b/poppler/JBIG2Stream.cc @@ -320,7 +320,7 @@ public: void reset(); // Returns false for OOB, otherwise sets *<x> and returns true. - GBool decodeInt(int *x, JBIG2HuffmanTable *table); + bool decodeInt(int *x, JBIG2HuffmanTable *table); Guint readBits(Guint n); Guint readBit(); @@ -349,7 +349,7 @@ void JBIG2HuffmanDecoder::reset() { } //~ optimize this -GBool JBIG2HuffmanDecoder::decodeInt(int *x, JBIG2HuffmanTable *table) { +bool JBIG2HuffmanDecoder::decodeInt(int *x, JBIG2HuffmanTable *table) { Guint i, len, prefix; i = 0; @@ -362,7 +362,7 @@ GBool JBIG2HuffmanDecoder::decodeInt(int *x, JBIG2HuffmanTable *table) { } if (prefix == table[i].prefix) { if (table[i].rangeLen == jbig2HuffmanOOB) { - return gFalse; + return false; } if (table[i].rangeLen == jbig2HuffmanLOW) { *x = table[i].val - readBits(32); @@ -371,11 +371,11 @@ GBool JBIG2HuffmanDecoder::decodeInt(int *x, JBIG2HuffmanTable *table) { } else { *x = table[i].val; } - return gTrue; + return true; } ++i; } - return gFalse; + return false; } Guint JBIG2HuffmanDecoder::readBits(Guint n) { @@ -696,7 +696,7 @@ public: void combine(JBIG2Bitmap *bitmap, int x, int y, Guint combOp); Guchar *getDataPtr() { return data; } int getDataSize() { return h * line; } - GBool isOk() { return data != nullptr; } + bool isOk() { return data != nullptr; } private: @@ -853,7 +853,7 @@ void JBIG2Bitmap::combine(JBIG2Bitmap *bitmap, int x, int y, int x0, x1, y0, y1, xx, yy; Guchar *srcPtr, *destPtr; Guint src0, src1, src, dest, s1, s2, m1, m2, m3; - GBool oneByte; + bool oneByte; // check for the pathological case where y = -2^31 if (y < -0x7fffffff) { @@ -1054,7 +1054,7 @@ public: Guint getSize() { return size; } void setBitmap(Guint idx, JBIG2Bitmap *bitmap) { bitmaps[idx] = bitmap; } JBIG2Bitmap *getBitmap(Guint idx) { return bitmaps[idx]; } - GBool isOk() { return bitmaps != nullptr; } + bool isOk() { return bitmaps != nullptr; } void setGenericRegionStats(JArithmeticDecoderStats *stats) { genericRegionStats = stats; } void setRefinementRegionStats(JArithmeticDecoderStats *stats) @@ -1324,8 +1324,8 @@ GooString *JBIG2Stream::getPSFilter(int psLevel, const char *indent) { return nullptr; } -GBool JBIG2Stream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool JBIG2Stream::isBinary(bool last) { + return str->isBinary(true); } void JBIG2Stream::readSegments() { @@ -1419,48 +1419,48 @@ void JBIG2Stream::readSegments() { } break; case 4: - readTextRegionSeg(segNum, gFalse, gFalse, segLength, refSegs, nRefSegs); + readTextRegionSeg(segNum, false, false, segLength, refSegs, nRefSegs); break; case 6: - readTextRegionSeg(segNum, gTrue, gFalse, segLength, refSegs, nRefSegs); + readTextRegionSeg(segNum, true, false, segLength, refSegs, nRefSegs); break; case 7: - readTextRegionSeg(segNum, gTrue, gTrue, segLength, refSegs, nRefSegs); + readTextRegionSeg(segNum, true, true, segLength, refSegs, nRefSegs); break; case 16: readPatternDictSeg(segNum, segLength); break; case 20: - readHalftoneRegionSeg(segNum, gFalse, gFalse, segLength, + readHalftoneRegionSeg(segNum, false, false, segLength, refSegs, nRefSegs); break; case 22: - readHalftoneRegionSeg(segNum, gTrue, gFalse, segLength, + readHalftoneRegionSeg(segNum, true, false, segLength, refSegs, nRefSegs); break; case 23: - readHalftoneRegionSeg(segNum, gTrue, gTrue, segLength, + readHalftoneRegionSeg(segNum, true, true, segLength, refSegs, nRefSegs); break; case 36: - readGenericRegionSeg(segNum, gFalse, gFalse, segLength); + readGenericRegionSeg(segNum, false, false, segLength); break; case 38: - readGenericRegionSeg(segNum, gTrue, gFalse, segLength); + readGenericRegionSeg(segNum, true, false, segLength); break; case 39: - readGenericRegionSeg(segNum, gTrue, gTrue, segLength); + readGenericRegionSeg(segNum, true, true, segLength); break; case 40: - readGenericRefinementRegionSeg(segNum, gFalse, gFalse, segLength, + readGenericRefinementRegionSeg(segNum, false, false, segLength, refSegs, nRefSegs); break; case 42: - readGenericRefinementRegionSeg(segNum, gTrue, gFalse, segLength, + readGenericRefinementRegionSeg(segNum, true, false, segLength, refSegs, nRefSegs); break; case 43: - readGenericRefinementRegionSeg(segNum, gTrue, gTrue, segLength, + readGenericRefinementRegionSeg(segNum, true, true, segLength, refSegs, nRefSegs); break; case 48: @@ -1542,7 +1542,7 @@ void JBIG2Stream::readSegments() { error(errSyntaxError, curStr->getPos(), "Unexpected EOF in JBIG2 stream"); } -GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, +bool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, Guint *refSegs, Guint nRefSegs) { JBIG2SymbolDict *symbolDict; JBIG2HuffmanTable *huffDHTable, *huffDWTable; @@ -1560,7 +1560,7 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, Guint *symWidths; Guint symHeight, symWidth, totalWidth, x, symID; int dh = 0, dw, refAggNum, refDX = 0, refDY = 0, bmSize; - GBool ex; + bool ex; int run, cnt, c; Guint i, j, k; Guchar *p; @@ -1622,7 +1622,7 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, codeTables = new GooList(); numInputSyms = 0; for (i = 0; i < nRefSegs; ++i) { - // This is need by bug 12014, returning gFalse makes it not crash + // This is need by bug 12014, returning false makes it not crash // but we end up with a empty page while acroread is able to render // part of it if ((seg = findSegment(refSegs[i]))) { @@ -1639,7 +1639,7 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, } } else { delete codeTables; - return gFalse; + return false; } } if (numInputSyms > UINT_MAX - numNewSyms) { @@ -1854,13 +1854,13 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, } bitmaps[numInputSyms + i] = readGenericRefinementRegion(symWidth, symHeight, - sdrTemplate, gFalse, + sdrTemplate, false, refBitmap, refDX, refDY, sdrATX, sdrATY); //~ do we need to use the bmSize value here (in Huffman mode)? } else { bitmaps[numInputSyms + i] = - readTextRegion(huff, gTrue, symWidth, symHeight, + readTextRegion(huff, true, symWidth, symHeight, refAggNum, 0, numInputSyms + i, nullptr, symCodeLen, bitmaps, 0, 0, 0, 1, 0, huffTableF, huffTableH, huffTableK, huffTableO, @@ -1871,8 +1871,8 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, // non-ref/agg coding } else { bitmaps[numInputSyms + i] = - readGenericBitmap(gFalse, symWidth, symHeight, - sdTemplate, gFalse, gFalse, nullptr, + readGenericBitmap(false, symWidth, symHeight, + sdTemplate, false, false, nullptr, sdATX, sdATY, 0); } @@ -1899,8 +1899,8 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, *p++ = (Guchar)c; } } else { - collBitmap = readGenericBitmap(gTrue, totalWidth, symHeight, - 0, gFalse, gFalse, nullptr, nullptr, nullptr, + collBitmap = readGenericBitmap(true, totalWidth, symHeight, + 0, false, false, nullptr, nullptr, nullptr, bmSize); } if (likely(collBitmap != nullptr)) { @@ -1927,7 +1927,7 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, // exported symbol list i = j = 0; - ex = gFalse; + ex = false; run = 0; // initialize it once in case the first decodeInt fails // we do not want to use uninitialized memory while (i < numInputSyms + numNewSyms) { @@ -1978,7 +1978,7 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, // store the new symbol dict segments->push_back(symbolDict); - return gTrue; + return true; codeTableError: error(errSyntaxError, curStr->getPos(), "Missing code table in JBIG2 symbol dictionary"); @@ -1994,15 +1994,15 @@ GBool JBIG2Stream::readSymbolDictSeg(Guint segNum, Guint length, if (symWidths) { gfree(symWidths); } - return gFalse; + return false; eofError: error(errSyntaxError, curStr->getPos(), "Unexpected EOF in JBIG2 stream"); - return gFalse; + return false; } -void JBIG2Stream::readTextRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length, +void JBIG2Stream::readTextRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length, Guint *refSegs, Guint nRefSegs) { JBIG2Bitmap *bitmap; JBIG2HuffmanTable runLengthTab[36]; @@ -2311,7 +2311,7 @@ void JBIG2Stream::readTextRegionSeg(Guint segNum, GBool imm, return; } -JBIG2Bitmap *JBIG2Stream::readTextRegion(GBool huff, GBool refine, +JBIG2Bitmap *JBIG2Stream::readTextRegion(bool huff, bool refine, int w, int h, Guint numInstances, Guint logStrips, @@ -2430,7 +2430,7 @@ JBIG2Bitmap *JBIG2Stream::readTextRegion(GBool huff, GBool refine, ri = 0; } if (ri) { - GBool decodeSuccess; + bool decodeSuccess; if (huff) { decodeSuccess = huffDecoder->decodeInt(&rdw, huffRDWTable); decodeSuccess = decodeSuccess && huffDecoder->decodeInt(&rdh, huffRDHTable); @@ -2454,7 +2454,7 @@ JBIG2Bitmap *JBIG2Stream::readTextRegion(GBool huff, GBool refine, symbolBitmap = readGenericRefinementRegion(rdw + syms[symID]->getWidth(), rdh + syms[symID]->getHeight(), - templ, gFalse, syms[symID], + templ, false, syms[symID], refDX, refDY, atx, aty); } //~ do we need to use the bmSize value here (in Huffman mode)? @@ -2608,7 +2608,7 @@ void JBIG2Stream::readPatternDictSeg(Guint segNum, Guint length) { atx[2] = 2; aty[2] = -2; atx[3] = -2; aty[3] = -2; bitmap = readGenericBitmap(mmr, (grayMax + 1) * patternW, patternH, - templ, gFalse, gFalse, nullptr, + templ, false, false, nullptr, atx, aty, length - 7); if (!bitmap) @@ -2636,8 +2636,8 @@ void JBIG2Stream::readPatternDictSeg(Guint segNum, Guint length) { error(errSyntaxError, curStr->getPos(), "Unexpected EOF in JBIG2 stream"); } -void JBIG2Stream::readHalftoneRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length, +void JBIG2Stream::readHalftoneRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length, Guint *refSegs, Guint nRefSegs) { JBIG2Bitmap *bitmap; JBIG2Segment *seg; @@ -2754,7 +2754,7 @@ void JBIG2Stream::readHalftoneRegionSeg(Guint segNum, GBool imm, atx[2] = 2; aty[2] = -2; atx[3] = -2; aty[3] = -2; for (j = bpp - 1; j >= 0; --j) { - grayBitmap = readGenericBitmap(mmr, gridW, gridH, templ, gFalse, + grayBitmap = readGenericBitmap(mmr, gridW, gridH, templ, false, enableSkip, skipBitmap, atx, aty, -1); i = 0; for (m = 0; m < gridH; ++m) { @@ -2814,8 +2814,8 @@ void JBIG2Stream::readHalftoneRegionSeg(Guint segNum, GBool imm, error(errSyntaxError, curStr->getPos(), "Unexpected EOF in JBIG2 stream"); } -void JBIG2Stream::readGenericRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length) { +void JBIG2Stream::readGenericRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length) { JBIG2Bitmap *bitmap; Guint w, h, x, y, segInfoFlags, extCombOp, rowCount; Guint flags, mmr, templ, tpgdOn; @@ -2865,7 +2865,7 @@ void JBIG2Stream::readGenericRegionSeg(Guint segNum, GBool imm, } // read the bitmap - bitmap = readGenericBitmap(mmr, w, h, templ, tpgdOn, gFalse, + bitmap = readGenericBitmap(mmr, w, h, templ, tpgdOn, false, nullptr, atx, aty, mmr ? length - 18 : 0); if (!bitmap) return; @@ -2933,13 +2933,13 @@ inline void JBIG2Stream::mmrAddPixelsNeg(int a1, int blackPixels, } } -JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h, - int templ, GBool tpgdOn, - GBool useSkip, JBIG2Bitmap *skip, +JBIG2Bitmap *JBIG2Stream::readGenericBitmap(bool mmr, int w, int h, + int templ, bool tpgdOn, + bool useSkip, JBIG2Bitmap *skip, int *atx, int *aty, int mmrDataLength) { JBIG2Bitmap *bitmap; - GBool ltp; + bool ltp; Guint ltpCX, cx, cx0, cx1, cx2; int *refLine, *codingLine; int code1, code2, code3; @@ -3721,8 +3721,8 @@ JBIG2Bitmap *JBIG2Stream::readGenericBitmap(GBool mmr, int w, int h, return bitmap; } -void JBIG2Stream::readGenericRefinementRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length, +void JBIG2Stream::readGenericRefinementRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length, Guint *refSegs, Guint nRefSegs) { JBIG2Bitmap *bitmap, *refBitmap; @@ -3814,12 +3814,12 @@ void JBIG2Stream::readGenericRefinementRegionSeg(Guint segNum, GBool imm, } JBIG2Bitmap *JBIG2Stream::readGenericRefinementRegion(int w, int h, - int templ, GBool tpgrOn, + int templ, bool tpgrOn, JBIG2Bitmap *refBitmap, int refDX, int refDY, int *atx, int *aty) { JBIG2Bitmap *bitmap; - GBool ltp; + bool ltp; Guint ltpCX, cx, cx0, cx2, cx3, cx4, tpgrCX0, tpgrCX1, tpgrCX2; JBIG2BitmapPtr cxPtr0 = {nullptr, 0, 0}; JBIG2BitmapPtr cxPtr1 = {nullptr, 0, 0}; @@ -4255,65 +4255,65 @@ void JBIG2Stream::resetIntStats(int symCodeLen) { } } -GBool JBIG2Stream::readUByte(Guint *x) { +bool JBIG2Stream::readUByte(Guint *x) { int c0; if ((c0 = curStr->getChar()) == EOF) { - return gFalse; + return false; } *x = (Guint)c0; - return gTrue; + return true; } -GBool JBIG2Stream::readByte(int *x) { +bool JBIG2Stream::readByte(int *x) { int c0; if ((c0 = curStr->getChar()) == EOF) { - return gFalse; + return false; } *x = c0; if (c0 & 0x80) { *x |= -1 - 0xff; } - return gTrue; + return true; } -GBool JBIG2Stream::readUWord(Guint *x) { +bool JBIG2Stream::readUWord(Guint *x) { int c0, c1; if ((c0 = curStr->getChar()) == EOF || (c1 = curStr->getChar()) == EOF) { - return gFalse; + return false; } *x = (Guint)((c0 << 8) | c1); - return gTrue; + return true; } -GBool JBIG2Stream::readULong(Guint *x) { +bool JBIG2Stream::readULong(Guint *x) { int c0, c1, c2, c3; if ((c0 = curStr->getChar()) == EOF || (c1 = curStr->getChar()) == EOF || (c2 = curStr->getChar()) == EOF || (c3 = curStr->getChar()) == EOF) { - return gFalse; + return false; } *x = (Guint)((c0 << 24) | (c1 << 16) | (c2 << 8) | c3); - return gTrue; + return true; } -GBool JBIG2Stream::readLong(int *x) { +bool JBIG2Stream::readLong(int *x) { int c0, c1, c2, c3; if ((c0 = curStr->getChar()) == EOF || (c1 = curStr->getChar()) == EOF || (c2 = curStr->getChar()) == EOF || (c3 = curStr->getChar()) == EOF) { - return gFalse; + return false; } *x = ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3); if (c0 & 0x80) { *x |= -1 - (int)0xffffffff; } - return gTrue; + return true; } diff --git a/poppler/JBIG2Stream.h b/poppler/JBIG2Stream.h index 9a45eb60..a4279553 100644 --- a/poppler/JBIG2Stream.h +++ b/poppler/JBIG2Stream.h @@ -52,21 +52,21 @@ public: int getChar() override; int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; virtual Object *getGlobalsStream() { return &globalsStream; } virtual Ref getGlobalsStreamRef() { return globalsStreamRef; } private: - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; void readSegments(); - GBool readSymbolDictSeg(Guint segNum, Guint length, + bool readSymbolDictSeg(Guint segNum, Guint length, Guint *refSegs, Guint nRefSegs); - void readTextRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length, + void readTextRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length, Guint *refSegs, Guint nRefSegs); - JBIG2Bitmap *readTextRegion(GBool huff, GBool refine, + JBIG2Bitmap *readTextRegion(bool huff, bool refine, int w, int h, Guint numInstances, Guint logStrips, @@ -88,26 +88,26 @@ private: Guint templ, int *atx, int *aty); void readPatternDictSeg(Guint segNum, Guint length); - void readHalftoneRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length, + void readHalftoneRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length, Guint *refSegs, Guint nRefSegs); - void readGenericRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length); + void readGenericRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length); void mmrAddPixels(int a1, int blackPixels, int *codingLine, int *a0i, int w); void mmrAddPixelsNeg(int a1, int blackPixels, int *codingLine, int *a0i, int w); - JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h, - int templ, GBool tpgdOn, - GBool useSkip, JBIG2Bitmap *skip, + JBIG2Bitmap *readGenericBitmap(bool mmr, int w, int h, + int templ, bool tpgdOn, + bool useSkip, JBIG2Bitmap *skip, int *atx, int *aty, int mmrDataLength); - void readGenericRefinementRegionSeg(Guint segNum, GBool imm, - GBool lossless, Guint length, + void readGenericRefinementRegionSeg(Guint segNum, bool imm, + bool lossless, Guint length, Guint *refSegs, Guint nRefSegs); JBIG2Bitmap *readGenericRefinementRegion(int w, int h, - int templ, GBool tpgrOn, + int templ, bool tpgrOn, JBIG2Bitmap *refBitmap, int refDX, int refDY, int *atx, int *aty); @@ -123,11 +123,11 @@ private: void resetRefinementStats(Guint templ, JArithmeticDecoderStats *prevStats); void resetIntStats(int symCodeLen); - GBool readUByte(Guint *x); - GBool readByte(int *x); - GBool readUWord(Guint *x); - GBool readULong(Guint *x); - GBool readLong(int *x); + bool readUByte(Guint *x); + bool readByte(int *x); + bool readUWord(Guint *x); + bool readULong(Guint *x); + bool readLong(int *x); Object globalsStream; Ref globalsStreamRef; diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc index cb88b26d..fa395652 100644 --- a/poppler/JPEG2000Stream.cc +++ b/poppler/JPEG2000Stream.cc @@ -39,12 +39,12 @@ struct JPXStreamPrivate { int ccounter; int npixels; int ncomps; - GBool inited; + bool inited; int smaskInData; - void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length, GBool indexed); + void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length, bool indexed); }; -static inline Guchar adjustComp(int r, int adjust, int depth, int sgndcorr, GBool indexed) { +static inline Guchar adjustComp(int r, int adjust, int depth, int sgndcorr, bool indexed) { if (!indexed) { r += sgndcorr; if (adjust) { @@ -76,7 +76,7 @@ static inline int doGetChar(JPXStreamPrivate* priv) { JPXStream::JPXStream(Stream *strA) : FilterStream(strA) { priv = new JPXStreamPrivate; - priv->inited = gFalse; + priv->inited = false; priv->image = nullptr; priv->npixels = 0; priv->ncomps = 0; @@ -106,7 +106,7 @@ Goffset JPXStream::getPos() { } int JPXStream::getChars(int nChars, Guchar *buffer) { - if (unlikely(priv->inited == gFalse)) { init(); } + if (unlikely(priv->inited == false)) { init(); } for (int i = 0; i < nChars; ++i) { const int c = doGetChar(priv); @@ -117,13 +117,13 @@ int JPXStream::getChars(int nChars, Guchar *buffer) { } int JPXStream::getChar() { - if (unlikely(priv->inited == gFalse)) { init(); } + if (unlikely(priv->inited == false)) { init(); } return doGetChar(priv); } int JPXStream::lookChar() { - if (unlikely(priv->inited == gFalse)) { init(); } + if (unlikely(priv->inited == false)) { init(); } return doLookChar(priv); } @@ -132,12 +132,12 @@ GooString *JPXStream::getPSFilter(int psLevel, const char *indent) { return nullptr; } -GBool JPXStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool JPXStream::isBinary(bool last) { + return str->isBinary(true); } void JPXStream::getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMode) { - if (unlikely(priv->inited == gFalse)) { init(); } + if (unlikely(priv->inited == false)) { init(); } *bitsPerComponent = 8; int numComps = (priv->image) ? priv->image->numcomps : 1; @@ -221,10 +221,10 @@ void JPXStream::init() int bufSize = BUFFER_INITIAL_SIZE; if (oLen.isInt()) bufSize = oLen.getInt(); - GBool indexed = gFalse; + bool indexed = false; if (cspace.isArray() && cspace.arrayGetLength() > 0) { const Object cstype = cspace.arrayGet(0); - if (cstype.isName("Indexed")) indexed = gTrue; + if (cstype.isName("Indexed")) indexed = true; } priv->smaskInData = 0; @@ -272,10 +272,10 @@ void JPXStream::init() priv->counter = 0; priv->ccounter = 0; - priv->inited = gTrue; + priv->inited = true; } -void JPXStreamPrivate::init2(OPJ_CODEC_FORMAT format, unsigned char *buf, int length, GBool indexed) +void JPXStreamPrivate::init2(OPJ_CODEC_FORMAT format, unsigned char *buf, int length, bool indexed) { JPXData jpxData; diff --git a/poppler/JPEG2000Stream.h b/poppler/JPEG2000Stream.h index 1fb63f1d..33a84a36 100644 --- a/poppler/JPEG2000Stream.h +++ b/poppler/JPEG2000Stream.h @@ -36,7 +36,7 @@ public: int getChar() override; int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; void getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMode) override; int readStream(int nChars, Guchar *buffer) { @@ -48,7 +48,7 @@ private: JPXStreamPrivate *priv; void init(); - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; }; diff --git a/poppler/JPXStream.cc b/poppler/JPXStream.cc index 02c43693..7ac47620 100644 --- a/poppler/JPXStream.cc +++ b/poppler/JPXStream.cc @@ -245,15 +245,15 @@ JPXStream::JPXStream(Stream *strA): nComps = 0; bpc = NULL; width = height = 0; - haveCS = gFalse; - havePalette = gFalse; - haveCompMap = gFalse; - haveChannelDefn = gFalse; + haveCS = false; + havePalette = false; + haveCompMap = false; + haveChannelDefn = false; img.tiles = NULL; bitBuf = 0; bitBufLen = 0; - bitBufSkip = gFalse; + bitBufSkip = false; byteCount = 0; curX = curY = 0; @@ -293,19 +293,19 @@ void JPXStream::close() { if (havePalette) { gfree(palette.bpc); gfree(palette.c); - havePalette = gFalse; + havePalette = false; } if (haveCompMap) { gfree(compMap.comp); gfree(compMap.type); gfree(compMap.pComp); - haveCompMap = gFalse; + haveCompMap = false; } if (haveChannelDefn) { gfree(channelDefn.idx); gfree(channelDefn.type); gfree(channelDefn.assoc); - haveChannelDefn = gFalse; + haveChannelDefn = false; } if (img.tiles) { @@ -468,8 +468,8 @@ GooString *JPXStream::getPSFilter(int psLevel, const char *indent) { return NULL; } -GBool JPXStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool JPXStream::isBinary(bool last) { + return str->isBinary(true); } void JPXStream::getImageParams(int *bitsPerComponent, @@ -478,10 +478,10 @@ void JPXStream::getImageParams(int *bitsPerComponent, Guint bpc1, dummy, i; int csMeth, csPrec, csPrec1, dummy2; StreamColorSpaceMode csMode1; - GBool haveBPC, haveCSMode; + bool haveBPC, haveCSMode; csPrec = 0; // make gcc happy - haveBPC = haveCSMode = gFalse; + haveBPC = haveCSMode = false; bufStr->reset(); if (bufStr->lookChar() == 0xff) { getImageParams2(bitsPerComponent, csMode); @@ -500,7 +500,7 @@ void JPXStream::getImageParams(int *bitsPerComponent, readUByte(&dummy) && readUByte(&dummy)) { *bitsPerComponent = bpc1 + 1; - haveBPC = gTrue; + haveBPC = true; } } else if (boxType == 0x636F6C72) { // color specification cover(2); @@ -524,7 +524,7 @@ void JPXStream::getImageParams(int *bitsPerComponent, (!haveCSMode || csPrec1 > csPrec)) { *csMode = csMode1; csPrec = csPrec1; - haveCSMode = gTrue; + haveCSMode = true; } if( dataLen >= 7 ) { for (i = 0; i < dataLen - 7; ++i) { @@ -604,12 +604,12 @@ void JPXStream::getImageParams2(int *bitsPerComponent, } } -GBool JPXStream::readBoxes() { +bool JPXStream::readBoxes() { Guint boxType, boxLen, dataLen; Guint bpc1, compression, unknownColorspace, ipr; Guint i, j; - haveImgHdr = gFalse; + haveImgHdr = false; // initialize in case there is a parse error img.xSize = img.ySize = 0; @@ -626,7 +626,7 @@ GBool JPXStream::readBoxes() { error(errSyntaxWarning, getPos(), "Naked JPEG 2000 codestream, missing JP2/JPX wrapper"); if (!readCodestream(0)) { - return gFalse; + return false; } nComps = img.nComps; bpc = (Guint *)gmallocn(nComps, sizeof(Guint)); @@ -635,7 +635,7 @@ GBool JPXStream::readBoxes() { } width = img.xSize - img.xOffset; height = img.ySize - img.yOffset; - return gTrue; + return true; } while (readBoxHdr(&boxType, &boxLen, &dataLen)) { @@ -658,42 +658,42 @@ GBool JPXStream::readBoxes() { !readUByte(&unknownColorspace) || !readUByte(&ipr)) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } if (compression != 7) { error(errSyntaxError, getPos(), "Unknown compression type in JPX stream"); - return gFalse; + return false; } bpc = (Guint *)gmallocn(nComps, sizeof(Guint)); for (i = 0; i < nComps; ++i) { bpc[i] = bpc1; } - haveImgHdr = gTrue; + haveImgHdr = true; break; case 0x62706363: // bits per component cover(10); if (!haveImgHdr) { error(errSyntaxError, getPos(), "Found bits per component box before image header box in JPX stream"); - return gFalse; + return false; } if (dataLen != nComps) { error(errSyntaxError, getPos(), "Invalid bits per component box in JPX stream"); - return gFalse; + return false; } for (i = 0; i < nComps; ++i) { if (!readUByte(&bpc[i])) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } } break; case 0x636F6C72: // color specification cover(11); if (!readColorSpecBox(dataLen)) { - return gFalse; + return false; } break; case 0x70636c72: // palette @@ -701,7 +701,7 @@ GBool JPXStream::readBoxes() { if (!readUWord(&palette.nEntries) || !readUByte(&palette.nComps)) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } palette.bpc = (Guint *)gmallocn(palette.nComps, sizeof(Guint)); palette.c = @@ -709,21 +709,21 @@ GBool JPXStream::readBoxes() { for (i = 0; i < palette.nComps; ++i) { if (!readUByte(&palette.bpc[i])) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } ++palette.bpc[i]; } for (i = 0; i < palette.nEntries; ++i) { for (j = 0; j < palette.nComps; ++j) { if (!readNBytes(((palette.bpc[j] & 0x7f) + 7) >> 3, - (palette.bpc[j] & 0x80) ? gTrue : gFalse, + (palette.bpc[j] & 0x80) ? true : false, &palette.c[i * palette.nComps + j])) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } } } - havePalette = gTrue; + havePalette = true; break; case 0x636d6170: // component mapping cover(13); @@ -736,16 +736,16 @@ GBool JPXStream::readBoxes() { !readUByte(&compMap.type[i]) || !readUByte(&compMap.pComp[i])) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } } - haveCompMap = gTrue; + haveCompMap = true; break; case 0x63646566: // channel definition cover(14); if (!readUWord(&channelDefn.nChannels)) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } channelDefn.idx = (Guint *)gmallocn(channelDefn.nChannels, sizeof(Guint)); @@ -758,10 +758,10 @@ GBool JPXStream::readBoxes() { !readUWord(&channelDefn.type[i]) || !readUWord(&channelDefn.assoc[i])) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } } - haveChannelDefn = gTrue; + haveChannelDefn = true; break; case 0x6A703263: // contiguous codestream cover(15); @@ -774,7 +774,7 @@ GBool JPXStream::readBoxes() { "JPX stream has no supported color spec"); } if (!readCodestream(dataLen)) { - return gFalse; + return false; } break; default: @@ -782,22 +782,22 @@ GBool JPXStream::readBoxes() { for (i = 0; i < dataLen; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Unexpected EOF in JPX stream"); - return gFalse; + return false; } } break; } } - return gTrue; + return true; } -GBool JPXStream::readColorSpecBox(Guint dataLen) { +bool JPXStream::readColorSpecBox(Guint dataLen) { JPXColorSpec newCS; Guint csApprox, csEnum; Guint i; - GBool ok; + bool ok; - ok = gFalse; + ok = false; if (!readUByte(&newCS.meth) || !readByte(&newCS.prec) || !readUByte(&csApprox)) { @@ -812,28 +812,28 @@ GBool JPXStream::readColorSpecBox(Guint dataLen) { newCS.enumerated.type = (JPXColorSpaceType)csEnum; switch (newCS.enumerated.type) { case jpxCSBiLevel: - ok = gTrue; + ok = true; break; case jpxCSYCbCr1: - ok = gTrue; + ok = true; break; case jpxCSYCbCr2: - ok = gTrue; + ok = true; break; case jpxCSYCBCr3: - ok = gTrue; + ok = true; break; case jpxCSPhotoYCC: - ok = gTrue; + ok = true; break; case jpxCSCMY: - ok = gTrue; + ok = true; break; case jpxCSCMYK: - ok = gTrue; + ok = true; break; case jpxCSYCCK: - ok = gTrue; + ok = true; break; case jpxCSCIELab: if (dataLen == 7 + 7*4) { @@ -859,34 +859,34 @@ GBool JPXStream::readColorSpecBox(Guint dataLen) { } else { goto err; } - ok = gTrue; + ok = true; break; case jpxCSsRGB: - ok = gTrue; + ok = true; break; case jpxCSGrayscale: - ok = gTrue; + ok = true; break; case jpxCSBiLevel2: - ok = gTrue; + ok = true; break; case jpxCSCIEJab: // not allowed in PDF goto err; case jpxCSCISesRGB: - ok = gTrue; + ok = true; break; case jpxCSROMMRGB: - ok = gTrue; + ok = true; break; case jpxCSsRGBYCbCr: - ok = gTrue; + ok = true; break; case jpxCSYPbPr1125: - ok = gTrue; + ok = true; break; case jpxCSYPbPr1250: - ok = gTrue; + ok = true; break; default: goto err; @@ -906,30 +906,30 @@ GBool JPXStream::readColorSpecBox(Guint dataLen) { if (ok && (!haveCS || newCS.prec > cs.prec)) { cs = newCS; - haveCS = gTrue; + haveCS = true; } - return gTrue; + return true; err: error(errSyntaxError, getPos(), "Error in JPX color spec"); - return gFalse; + return false; } -GBool JPXStream::readCodestream(Guint len) { +bool JPXStream::readCodestream(Guint len) { JPXTile *tile; JPXTileComp *tileComp; int segType; - GBool haveSIZ, haveCOD, haveQCD, haveSOT; + bool haveSIZ, haveCOD, haveQCD, haveSOT; Guint precinctSize, style, nDecompLevels; Guint segLen, capabilities, comp, i, j, r; //----- main header - haveSIZ = haveCOD = haveQCD = haveSOT = gFalse; + haveSIZ = haveCOD = haveQCD = haveSOT = false; do { if (!readMarkerHdr(&segType, &segLen)) { error(errSyntaxError, getPos(), "Error in JPX codestream"); - return gFalse; + return false; } switch (segType) { case 0x4f: // SOC - start of codestream @@ -941,7 +941,7 @@ GBool JPXStream::readCodestream(Guint len) { if (haveSIZ) { error(errSyntaxError, getPos(), "Duplicate SIZ marker segment in JPX stream"); - return gFalse; + return false; } if (!readUWord(&capabilities) || !readULong(&img.xSize) || @@ -954,12 +954,12 @@ GBool JPXStream::readCodestream(Guint len) { !readULong(&img.yTileOffset) || !readUWord(&img.nComps)) { error(errSyntaxError, getPos(), "Error in JPX SIZ marker segment"); - return gFalse; + return false; } if (haveImgHdr && img.nComps != nComps) { error(errSyntaxError, getPos(), "Different number of components in JPX SIZ marker segment"); - return gFalse; + return false; } if (img.xSize == 0 || img.ySize == 0 || img.xOffset >= img.xSize || img.yOffset >= img.ySize || @@ -969,7 +969,7 @@ GBool JPXStream::readCodestream(Guint len) { img.xTileSize + img.xTileOffset <= img.xOffset || img.yTileSize + img.yTileOffset <= img.yOffset) { error(errSyntaxError, getPos(), "Error in JPX SIZ marker segment"); - return gFalse; + return false; } img.nXTiles = (img.xSize - img.xTileOffset + img.xTileSize - 1) / img.xTileSize; @@ -980,12 +980,12 @@ GBool JPXStream::readCodestream(Guint len) { img.nXTiles >= 65535 / img.nYTiles) { error(errSyntaxError, getPos(), "Bad tile count in JPX SIZ marker segment"); - return gFalse; + return false; } img.tiles = (JPXTile *)gmallocn(img.nXTiles * img.nYTiles, sizeof(JPXTile)); for (i = 0; i < img.nXTiles * img.nYTiles; ++i) { - img.tiles[i].init = gFalse; + img.tiles[i].init = false; img.tiles[i].tileComps = (JPXTileComp *)gmallocn(img.nComps, sizeof(JPXTileComp)); for (comp = 0; comp < img.nComps; ++comp) { @@ -1000,33 +1000,33 @@ GBool JPXStream::readCodestream(Guint len) { !readUByte(&img.tiles[0].tileComps[comp].hSep) || !readUByte(&img.tiles[0].tileComps[comp].vSep)) { error(errSyntaxError, getPos(), "Error in JPX SIZ marker segment"); - return gFalse; + return false; } if (img.tiles[0].tileComps[comp].hSep == 0 || img.tiles[0].tileComps[comp].vSep == 0) { error(errSyntaxError, getPos(), "Error in JPX SIZ marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[comp].sgned = - (img.tiles[0].tileComps[comp].prec & 0x80) ? gTrue : gFalse; + (img.tiles[0].tileComps[comp].prec & 0x80) ? true : false; img.tiles[0].tileComps[comp].prec = (img.tiles[0].tileComps[comp].prec & 0x7f) + 1; for (i = 1; i < img.nXTiles * img.nYTiles; ++i) { img.tiles[i].tileComps[comp] = img.tiles[0].tileComps[comp]; } } - haveSIZ = gTrue; + haveSIZ = true; break; case 0x52: // COD - coding style default cover(21); if (!haveSIZ) { error(errSyntaxError, getPos(), "JPX COD marker segment before SIZ segment"); - return gFalse; + return false; } if (img.tiles == NULL || img.nXTiles * img.nYTiles == 0 || img.tiles[0].tileComps == NULL) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } if (!readUByte(&img.tiles[0].tileComps[0].style) || !readUByte(&img.tiles[0].progOrder) || @@ -1038,13 +1038,13 @@ GBool JPXStream::readCodestream(Guint len) { !readUByte(&img.tiles[0].tileComps[0].codeBlockStyle) || !readUByte(&img.tiles[0].tileComps[0].transform)) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } if (nDecompLevels > 32 || img.tiles[0].tileComps[0].codeBlockW > 8 || img.tiles[0].tileComps[0].codeBlockH > 8) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[0].nDecompLevels = nDecompLevels; img.tiles[0].tileComps[0].codeBlockW += 2; @@ -1076,7 +1076,7 @@ GBool JPXStream::readCodestream(Guint len) { sizeof(JPXResLevel)); if (img.tiles[i].tileComps[comp].resLevels == NULL) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } for (r = 0; r <= img.tiles[i].tileComps[comp].nDecompLevels; ++r) { img.tiles[i].tileComps[comp].resLevels[r].precincts = NULL; @@ -1088,7 +1088,7 @@ GBool JPXStream::readCodestream(Guint len) { cover(91); if (!readUByte(&precinctSize)) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[0].resLevels[r].precinctWidth = precinctSize & 0x0f; @@ -1111,14 +1111,14 @@ GBool JPXStream::readCodestream(Guint len) { } } } - haveCOD = gTrue; + haveCOD = true; break; case 0x53: // COC - coding style component cover(22); if (!haveCOD) { error(errSyntaxError, getPos(), "JPX COC marker segment before COD segment"); - return gFalse; + return false; } if ((img.nComps > 256 && !readUWord(&comp)) || (img.nComps <= 256 && !readUByte(&comp)) || @@ -1130,13 +1130,13 @@ GBool JPXStream::readCodestream(Guint len) { !readUByte(&img.tiles[0].tileComps[comp].codeBlockStyle) || !readUByte(&img.tiles[0].tileComps[comp].transform)) { error(errSyntaxError, getPos(), "Error in JPX COC marker segment"); - return gFalse; + return false; } if (nDecompLevels > 32 || img.tiles[0].tileComps[comp].codeBlockW > 8 || img.tiles[0].tileComps[comp].codeBlockH > 8) { error(errSyntaxError, getPos(), "Error in JPX COC marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[comp].nDecompLevels = nDecompLevels; img.tiles[0].tileComps[comp].style = @@ -1171,7 +1171,7 @@ GBool JPXStream::readCodestream(Guint len) { if (img.tiles[0].tileComps[comp].style & 0x01) { if (!readUByte(&precinctSize)) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[comp].resLevels[r].precinctWidth = precinctSize & 0x0f; @@ -1196,16 +1196,16 @@ GBool JPXStream::readCodestream(Guint len) { if (!haveSIZ) { error(errSyntaxError, getPos(), "JPX QCD marker segment before SIZ segment"); - return gFalse; + return false; } if (!readUByte(&img.tiles[0].tileComps[0].quantStyle)) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } if ((img.tiles[0].tileComps[0].quantStyle & 0x1f) == 0x00) { if (segLen <= 3) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[0].nQuantSteps = segLen - 3; img.tiles[0].tileComps[0].quantSteps = @@ -1215,7 +1215,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < img.tiles[0].tileComps[0].nQuantSteps; ++i) { if (!readUByte(&img.tiles[0].tileComps[0].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } } else if ((img.tiles[0].tileComps[0].quantStyle & 0x1f) == 0x01) { @@ -1226,12 +1226,12 @@ GBool JPXStream::readCodestream(Guint len) { sizeof(Guint)); if (!readUWord(&img.tiles[0].tileComps[0].quantSteps[0])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } else if ((img.tiles[0].tileComps[0].quantStyle & 0x1f) == 0x02) { if (segLen < 5) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[0].nQuantSteps = (segLen - 3) / 2; img.tiles[0].tileComps[0].quantSteps = @@ -1241,12 +1241,12 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < img.tiles[0].tileComps[0].nQuantSteps; ++i) { if (!readUWord(&img.tiles[0].tileComps[0].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } } else { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } for (i = 0; i < img.nXTiles * img.nYTiles; ++i) { for (comp = 0; comp < img.nComps; ++comp) { @@ -1266,26 +1266,26 @@ GBool JPXStream::readCodestream(Guint len) { } } } - haveQCD = gTrue; + haveQCD = true; break; case 0x5d: // QCC - quantization component cover(24); if (!haveQCD) { error(errSyntaxError, getPos(), "JPX QCC marker segment before QCD segment"); - return gFalse; + return false; } if ((img.nComps > 256 && !readUWord(&comp)) || (img.nComps <= 256 && !readUByte(&comp)) || comp >= img.nComps || !readUByte(&img.tiles[0].tileComps[comp].quantStyle)) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } if ((img.tiles[0].tileComps[comp].quantStyle & 0x1f) == 0x00) { if (segLen <= (img.nComps > 256 ? 5U : 4U)) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[comp].nQuantSteps = segLen - (img.nComps > 256 ? 5 : 4); @@ -1296,7 +1296,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < img.tiles[0].tileComps[comp].nQuantSteps; ++i) { if (!readUByte(&img.tiles[0].tileComps[comp].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } } } else if ((img.tiles[0].tileComps[comp].quantStyle & 0x1f) == 0x01) { @@ -1307,12 +1307,12 @@ GBool JPXStream::readCodestream(Guint len) { sizeof(Guint)); if (!readUWord(&img.tiles[0].tileComps[comp].quantSteps[0])) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } } else if ((img.tiles[0].tileComps[comp].quantStyle & 0x1f) == 0x02) { if (segLen < (img.nComps > 256 ? 5U : 4U) + 2) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } img.tiles[0].tileComps[comp].nQuantSteps = (segLen - (img.nComps > 256 ? 5 : 4)) / 2; @@ -1323,12 +1323,12 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < img.tiles[0].tileComps[comp].nQuantSteps; ++i) { if (!readUWord(&img.tiles[0].tileComps[comp].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } } else { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } for (i = 1; i < img.nXTiles * img.nYTiles; ++i) { img.tiles[i].tileComps[comp].quantStyle = @@ -1352,7 +1352,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX RGN marker segment"); - return gFalse; + return false; } } #else @@ -1362,7 +1362,7 @@ GBool JPXStream::readCodestream(Guint len) { !readUByte(&compInfo[comp].defROI.style) || !readUByte(&compInfo[comp].defROI.shift)) { error(errSyntaxError, getPos(), "Error in JPX RGN marker segment"); - return gFalse; + return false; } #endif break; @@ -1373,7 +1373,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX POC marker segment"); - return gFalse; + return false; } } #else @@ -1389,7 +1389,7 @@ GBool JPXStream::readCodestream(Guint len) { !(img.nComps <= 256 && readUByte(&progs[i].endComp)) || !readUByte(&progs[i].progOrder)) { error(errSyntaxError, getPos(), "Error in JPX POC marker segment"); - return gFalse; + return false; } } #endif @@ -1401,7 +1401,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX PPM marker segment"); - return gFalse; + return false; } } #endif @@ -1412,7 +1412,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX TLM marker segment"); - return gFalse; + return false; } } break; @@ -1422,7 +1422,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX PLM marker segment"); - return gFalse; + return false; } } break; @@ -1432,7 +1432,7 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX CRG marker segment"); - return gFalse; + return false; } } break; @@ -1442,13 +1442,13 @@ GBool JPXStream::readCodestream(Guint len) { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX COM marker segment"); - return gFalse; + return false; } } break; case 0x90: // SOT - start of tile cover(32); - haveSOT = gTrue; + haveSOT = true; break; default: cover(33); @@ -1466,27 +1466,27 @@ GBool JPXStream::readCodestream(Guint len) { if (!haveSIZ) { error(errSyntaxError, getPos(), "Missing SIZ marker segment in JPX stream"); - return gFalse; + return false; } if (!haveCOD) { error(errSyntaxError, getPos(), "Missing COD marker segment in JPX stream"); - return gFalse; + return false; } if (!haveQCD) { error(errSyntaxError, getPos(), "Missing QCD marker segment in JPX stream"); - return gFalse; + return false; } //----- read the tile-parts while (1) { if (!readTilePart()) { - return gFalse; + return false; } if (!readMarkerHdr(&segType, &segLen)) { error(errSyntaxError, getPos(), "Error in JPX codestream"); - return gFalse; + return false; } if (segType != 0x90) { // SOT - start of tile break; @@ -1495,7 +1495,7 @@ GBool JPXStream::readCodestream(Guint len) { if (segType != 0xd9) { // EOC - end of codestream error(errSyntaxError, getPos(), "Missing EOC marker in JPX codestream"); - return gFalse; + return false; } //----- finish decoding the image @@ -1503,23 +1503,23 @@ GBool JPXStream::readCodestream(Guint len) { tile = &img.tiles[i]; if (!tile->init) { error(errSyntaxError, getPos(), "Uninitialized tile in JPX codestream"); - return gFalse; + return false; } for (comp = 0; comp < img.nComps; ++comp) { tileComp = &tile->tileComps[comp]; inverseTransform(tileComp); } if (!inverseMultiCompAndDC(tile)) { - return gFalse; + return false; } } //~ can free memory below tileComps here, and also tileComp.buf - return gTrue; + return true; } -GBool JPXStream::readTilePart() { +bool JPXStream::readTilePart() { JPXTile *tile; JPXTileComp *tileComp; JPXResLevel *resLevel; @@ -1527,9 +1527,9 @@ GBool JPXStream::readTilePart() { JPXSubband *subband; JPXCodeBlock *cb; int *sbCoeffs; - GBool haveSOD; + bool haveSOD; Guint tileIdx, tilePartLen, tilePartIdx, nTileParts; - GBool tilePartToEOC; + bool tilePartToEOC; Guint precinctSize, style, nDecompLevels; Guint n, nSBs, nx, ny, sbx0, sby0, comp, segLen; Guint i, j, k, cbX, cbY, r, pre, sb, cbi, cbj; @@ -1541,23 +1541,23 @@ GBool JPXStream::readTilePart() { !readUByte(&tilePartIdx) || !readUByte(&nTileParts)) { error(errSyntaxError, getPos(), "Error in JPX SOT marker segment"); - return gFalse; + return false; } if (tileIdx >= img.nXTiles * img.nYTiles || (tilePartIdx > 0 && !img.tiles[tileIdx].init)) { error(errSyntaxError, getPos(), "Weird tile index in JPX stream"); - return gFalse; + return false; } tilePartToEOC = tilePartLen == 0; tilePartLen -= 12; // subtract size of SOT segment - haveSOD = gFalse; + haveSOD = false; do { if (!readMarkerHdr(&segType, &segLen)) { error(errSyntaxError, getPos(), "Error in JPX tile-part codestream"); - return gFalse; + return false; } tilePartLen -= 2 + segLen; switch (segType) { @@ -1573,13 +1573,13 @@ GBool JPXStream::readTilePart() { !readUByte(&img.tiles[tileIdx].tileComps[0].codeBlockStyle) || !readUByte(&img.tiles[tileIdx].tileComps[0].transform)) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } if (nDecompLevels > 32 || img.tiles[tileIdx].tileComps[0].codeBlockW > 8 || img.tiles[tileIdx].tileComps[0].codeBlockH > 8) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[0].nDecompLevels = nDecompLevels; img.tiles[tileIdx].tileComps[0].codeBlockW += 2; @@ -1614,7 +1614,7 @@ GBool JPXStream::readTilePart() { if (img.tiles[tileIdx].tileComps[0].style & 0x01) { if (!readUByte(&precinctSize)) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[0].resLevels[r].precinctWidth = precinctSize & 0x0f; @@ -1648,13 +1648,13 @@ GBool JPXStream::readTilePart() { !readUByte(&img.tiles[tileIdx].tileComps[comp].codeBlockStyle) || !readUByte(&img.tiles[tileIdx].tileComps[comp].transform)) { error(errSyntaxError, getPos(), "Error in JPX COC marker segment"); - return gFalse; + return false; } if (nDecompLevels > 32 || img.tiles[tileIdx].tileComps[comp].codeBlockW > 8 || img.tiles[tileIdx].tileComps[comp].codeBlockH > 8) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[comp].nDecompLevels = nDecompLevels; img.tiles[tileIdx].tileComps[comp].style = @@ -1673,7 +1673,7 @@ GBool JPXStream::readTilePart() { if (img.tiles[tileIdx].tileComps[comp].style & 0x01) { if (!readUByte(&precinctSize)) { error(errSyntaxError, getPos(), "Error in JPX COD marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[comp].resLevels[r].precinctWidth = precinctSize & 0x0f; @@ -1689,12 +1689,12 @@ GBool JPXStream::readTilePart() { cover(36); if (!readUByte(&img.tiles[tileIdx].tileComps[0].quantStyle)) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } if ((img.tiles[tileIdx].tileComps[0].quantStyle & 0x1f) == 0x00) { if (segLen <= 3) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[0].nQuantSteps = segLen - 3; img.tiles[tileIdx].tileComps[0].quantSteps = @@ -1704,7 +1704,7 @@ GBool JPXStream::readTilePart() { for (i = 0; i < img.tiles[tileIdx].tileComps[0].nQuantSteps; ++i) { if (!readUByte(&img.tiles[tileIdx].tileComps[0].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } } else if ((img.tiles[tileIdx].tileComps[0].quantStyle & 0x1f) == 0x01) { @@ -1715,12 +1715,12 @@ GBool JPXStream::readTilePart() { sizeof(Guint)); if (!readUWord(&img.tiles[tileIdx].tileComps[0].quantSteps[0])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } else if ((img.tiles[tileIdx].tileComps[0].quantStyle & 0x1f) == 0x02) { if (segLen < 5) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[0].nQuantSteps = (segLen - 3) / 2; img.tiles[tileIdx].tileComps[0].quantSteps = @@ -1730,12 +1730,12 @@ GBool JPXStream::readTilePart() { for (i = 0; i < img.tiles[tileIdx].tileComps[0].nQuantSteps; ++i) { if (!readUWord(&img.tiles[tileIdx].tileComps[0].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } } else { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } for (comp = 1; comp < img.nComps; ++comp) { img.tiles[tileIdx].tileComps[comp].quantStyle = @@ -1759,12 +1759,12 @@ GBool JPXStream::readTilePart() { comp >= img.nComps || !readUByte(&img.tiles[tileIdx].tileComps[comp].quantStyle)) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } if ((img.tiles[tileIdx].tileComps[comp].quantStyle & 0x1f) == 0x00) { if (segLen <= (img.nComps > 256 ? 5U : 4U)) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[comp].nQuantSteps = segLen - (img.nComps > 256 ? 5 : 4); @@ -1775,7 +1775,7 @@ GBool JPXStream::readTilePart() { for (i = 0; i < img.tiles[tileIdx].tileComps[comp].nQuantSteps; ++i) { if (!readUByte(&img.tiles[tileIdx].tileComps[comp].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } } } else if ((img.tiles[tileIdx].tileComps[comp].quantStyle & 0x1f) @@ -1787,13 +1787,13 @@ GBool JPXStream::readTilePart() { sizeof(Guint)); if (!readUWord(&img.tiles[tileIdx].tileComps[comp].quantSteps[0])) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } } else if ((img.tiles[tileIdx].tileComps[comp].quantStyle & 0x1f) == 0x02) { if (segLen < (img.nComps > 256 ? 5U : 4U) + 2) { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } img.tiles[tileIdx].tileComps[comp].nQuantSteps = (segLen - (img.nComps > 256 ? 5 : 4)) / 2; @@ -1804,12 +1804,12 @@ GBool JPXStream::readTilePart() { for (i = 0; i < img.tiles[tileIdx].tileComps[comp].nQuantSteps; ++i) { if (!readUWord(&img.tiles[tileIdx].tileComps[comp].quantSteps[i])) { error(errSyntaxError, getPos(), "Error in JPX QCD marker segment"); - return gFalse; + return false; } } } else { error(errSyntaxError, getPos(), "Error in JPX QCC marker segment"); - return gFalse; + return false; } break; case 0x5e: // RGN - region of interest @@ -1819,7 +1819,7 @@ GBool JPXStream::readTilePart() { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX RGN marker segment"); - return gFalse; + return false; } } #else @@ -1829,7 +1829,7 @@ GBool JPXStream::readTilePart() { !readUByte(&compInfo[comp].roi.style) || !readUByte(&compInfo[comp].roi.shift)) { error(errSyntaxError, getPos(), "Error in JPX RGN marker segment"); - return gFalse; + return false; } #endif break; @@ -1840,7 +1840,7 @@ GBool JPXStream::readTilePart() { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX POC marker segment"); - return gFalse; + return false; } } #else @@ -1856,7 +1856,7 @@ GBool JPXStream::readTilePart() { !(img.nComps <= 256 && readUByte(&tileProgs[i].endComp)) || !readUByte(&tileProgs[i].progOrder)) { error(errSyntaxError, getPos(), "Error in JPX POC marker segment"); - return gFalse; + return false; } } #endif @@ -1868,7 +1868,7 @@ GBool JPXStream::readTilePart() { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX PPT marker segment"); - return gFalse; + return false; } } #endif @@ -1878,7 +1878,7 @@ GBool JPXStream::readTilePart() { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX PLT marker segment"); - return gFalse; + return false; } } break; @@ -1888,13 +1888,13 @@ GBool JPXStream::readTilePart() { for (i = 0; i < segLen - 2; ++i) { if (bufStr->getChar() == EOF) { error(errSyntaxError, getPos(), "Error in JPX COM marker segment"); - return gFalse; + return false; } } break; case 0x93: // SOD - start of data cover(43); - haveSOD = gTrue; + haveSOD = true; break; default: cover(44); @@ -1913,7 +1913,7 @@ GBool JPXStream::readTilePart() { //----- initialize the tile, precincts, and code-blocks if (tilePartIdx == 0) { tile = &img.tiles[tileIdx]; - tile->init = gTrue; + tile->init = true; i = tileIdx / img.nXTiles; j = tileIdx % img.nXTiles; if ((tile->x0 = img.xTileOffset + j * img.xTileSize) < img.xOffset) { @@ -2021,9 +2021,9 @@ GBool JPXStream::readTilePart() { subband->zeroBitPlane = (JPXTagTreeNode *)gmallocn(n, sizeof(JPXTagTreeNode)); for (k = 0; k < n; ++k) { - subband->inclusion[k].finished = gFalse; + subband->inclusion[k].finished = false; subband->inclusion[k].val = 0; - subband->zeroBitPlane[k].finished = gFalse; + subband->zeroBitPlane[k].finished = false; subband->zeroBitPlane[k].val = 0; } subband->cbs = (JPXCodeBlock *)gmallocn(subband->nXCBs * @@ -2063,7 +2063,7 @@ GBool JPXStream::readTilePart() { if (subband->y1 < cb->y1) { cb->y1 = subband->y1; } - cb->seen = gFalse; + cb->seen = false; cb->lBlock = 3; cb->nextPass = jpxPassCleanup; cb->nZeroBitPlanes = 0; @@ -2096,8 +2096,8 @@ GBool JPXStream::readTilePart() { return readTilePartData(tileIdx, tilePartLen, tilePartToEOC); } -GBool JPXStream::readTilePartData(Guint tileIdx, - Guint tilePartLen, GBool tilePartToEOC) { +bool JPXStream::readTilePartData(Guint tileIdx, + Guint tilePartLen, bool tilePartToEOC) { JPXTile *tile; JPXTileComp *tileComp; JPXResLevel *resLevel; @@ -2143,7 +2143,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, for (cbY = 0; cbY < subband->nYCBs; ++cbY) { for (cbX = 0; cbX < subband->nXCBs; ++cbX) { cb = &subband->cbs[cbY * subband->nXCBs + cbX]; - cb->included = gFalse; + cb->included = false; } } } @@ -2158,7 +2158,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, // skip code-blocks with no coefficients if (cb->x0 >= cb->x1 || cb->y0 >= cb->y1) { cover(46); - cb->included = gFalse; + cb->included = false; continue; } @@ -2188,7 +2188,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, goto err; } if (bits == 1) { - subband->inclusion[j].finished = gTrue; + subband->inclusion[j].finished = true; } else { ++ttVal; } @@ -2225,7 +2225,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, goto err; } if (bits == 1) { - subband->zeroBitPlane[j].finished = gTrue; + subband->zeroBitPlane[j].finished = true; } else { ++ttVal; } @@ -2335,7 +2335,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, if (cb->included) { if (!readCodeBlockData(tileComp, resLevel, precinct, subband, tile->res, sb, cb)) { - return gFalse; + return false; } if (tileComp->codeBlockStyle & 0x04) { for (i = 0; i < cb->nCodingPasses; ++i) { @@ -2344,7 +2344,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, } else { tilePartLen -= cb->dataLen[0]; } - cb->seen = gTrue; + cb->seen = true; } } } @@ -2391,7 +2391,7 @@ GBool JPXStream::readTilePartData(Guint tileIdx, tileComp = &tile->tileComps[tile->comp]; if (tile->res >= tileComp->nDecompLevels + 1) { if (++tile->comp == img.nComps) { - return gTrue; + return true; } } } @@ -2425,14 +2425,14 @@ GBool JPXStream::readTilePartData(Guint tileIdx, } } - return gTrue; + return true; err: error(errSyntaxError, getPos(), "Error in JPX stream"); - return gFalse; + return false; } -GBool JPXStream::readCodeBlockData(JPXTileComp *tileComp, +bool JPXStream::readCodeBlockData(JPXTileComp *tileComp, JPXResLevel *resLevel, JPXPrecinct *precinct, JPXSubband *subband, @@ -2756,7 +2756,7 @@ GBool JPXStream::readCodeBlockData(JPXTileComp *tileComp, } cb->arithDecoder->cleanup(); - return gTrue; + return true; } // Inverse quantization, and wavelet transform (IDWT). This also does @@ -3175,7 +3175,7 @@ void JPXStream::inverseTransform1D(JPXTileComp *tileComp, int *data, // Inverse multi-component transform and DC level shift. This also // converts fixed point samples back to integers. -GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) { +bool JPXStream::inverseMultiCompAndDC(JPXTile *tile) { JPXTileComp *tileComp; int coeff, d0, d1, d2, t, minVal, maxVal, zeroVal; int *dataPtr; @@ -3190,7 +3190,7 @@ GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) { tile->tileComps[0].vSep != tile->tileComps[1].vSep || tile->tileComps[1].hSep != tile->tileComps[2].hSep || tile->tileComps[1].vSep != tile->tileComps[2].vSep) { - return gFalse; + return false; } // inverse irreversible multiple component transform @@ -3283,24 +3283,24 @@ GBool JPXStream::inverseMultiCompAndDC(JPXTile *tile) { } } - return gTrue; + return true; } -GBool JPXStream::readBoxHdr(Guint *boxType, Guint *boxLen, Guint *dataLen) { +bool JPXStream::readBoxHdr(Guint *boxType, Guint *boxLen, Guint *dataLen) { Guint len, lenH; if (!readULong(&len) || !readULong(boxType)) { - return gFalse; + return false; } if (len == 1) { if (!readULong(&lenH) || !readULong(&len)) { - return gFalse; + return false; } if (lenH) { error(errSyntaxError, getPos(), "JPX stream contains a box larger than 2^32 bytes"); - return gFalse; + return false; } *boxLen = len; *dataLen = len - 16; @@ -3311,7 +3311,7 @@ GBool JPXStream::readBoxHdr(Guint *boxType, Guint *boxLen, Guint *dataLen) { *boxLen = len; *dataLen = len - 8; } - return gTrue; + return true; } int JPXStream::readMarkerHdr(int *segType, Guint *segLen) { @@ -3320,12 +3320,12 @@ int JPXStream::readMarkerHdr(int *segType, Guint *segLen) { do { do { if ((c = bufStr->getChar()) == EOF) { - return gFalse; + return false; } } while (c != 0xff); do { if ((c = bufStr->getChar()) == EOF) { - return gFalse; + return false; } } while (c == 0xff); } while (c == 0x00); @@ -3333,65 +3333,65 @@ int JPXStream::readMarkerHdr(int *segType, Guint *segLen) { if ((c >= 0x30 && c <= 0x3f) || c == 0x4f || c == 0x92 || c == 0x93 || c == 0xd9) { *segLen = 0; - return gTrue; + return true; } return readUWord(segLen); } -GBool JPXStream::readUByte(Guint *x) { +bool JPXStream::readUByte(Guint *x) { int c0; if ((c0 = bufStr->getChar()) == EOF) { - return gFalse; + return false; } *x = (Guint)c0; - return gTrue; + return true; } -GBool JPXStream::readByte(int *x) { +bool JPXStream::readByte(int *x) { int c0; if ((c0 = bufStr->getChar()) == EOF) { - return gFalse; + return false; } *x = c0; if (c0 & 0x80) { *x |= -1 - 0xff; } - return gTrue; + return true; } -GBool JPXStream::readUWord(Guint *x) { +bool JPXStream::readUWord(Guint *x) { int c0, c1; if ((c0 = bufStr->getChar()) == EOF || (c1 = bufStr->getChar()) == EOF) { - return gFalse; + return false; } *x = (Guint)((c0 << 8) | c1); - return gTrue; + return true; } -GBool JPXStream::readULong(Guint *x) { +bool JPXStream::readULong(Guint *x) { int c0, c1, c2, c3; if ((c0 = bufStr->getChar()) == EOF || (c1 = bufStr->getChar()) == EOF || (c2 = bufStr->getChar()) == EOF || (c3 = bufStr->getChar()) == EOF) { - return gFalse; + return false; } *x = (Guint)((c0 << 24) | (c1 << 16) | (c2 << 8) | c3); - return gTrue; + return true; } -GBool JPXStream::readNBytes(int nBytes, GBool signd, int *x) { +bool JPXStream::readNBytes(int nBytes, bool signd, int *x) { int y, c, i; y = 0; for (i = 0; i < nBytes; ++i) { if ((c = bufStr->getChar()) == EOF) { - return gFalse; + return false; } y = (y << 8) + c; } @@ -3401,21 +3401,21 @@ GBool JPXStream::readNBytes(int nBytes, GBool signd, int *x) { } } *x = y; - return gTrue; + return true; } void JPXStream::startBitBuf(Guint byteCountA) { bitBufLen = 0; - bitBufSkip = gFalse; + bitBufSkip = false; byteCount = byteCountA; } -GBool JPXStream::readBits(int nBits, Guint *x) { +bool JPXStream::readBits(int nBits, Guint *x) { int c; while (bitBufLen < nBits) { if (byteCount == 0 || (c = bufStr->getChar()) == EOF) { - return gFalse; + return false; } --byteCount; if (bitBufSkip) { @@ -3429,7 +3429,7 @@ GBool JPXStream::readBits(int nBits, Guint *x) { } *x = (bitBuf >> (bitBufLen - nBits)) & ((1 << nBits) - 1); bitBufLen -= nBits; - return gTrue; + return true; } void JPXStream::skipSOP() { @@ -3445,7 +3445,7 @@ void JPXStream::skipSOP() { } byteCount -= 6; bitBufLen = 0; - bitBufSkip = gFalse; + bitBufSkip = false; } } @@ -3461,7 +3461,7 @@ void JPXStream::skipEPH() { } byteCount -= k + 2; bitBufLen = 0; - bitBufSkip = gFalse; + bitBufSkip = false; } } diff --git a/poppler/JPXStream.h b/poppler/JPXStream.h index 2f22e2e1..9f9ac190 100644 --- a/poppler/JPXStream.h +++ b/poppler/JPXStream.h @@ -89,7 +89,7 @@ struct JPXChannelDefn { //------------------------------------------------------------------------ struct JPXTagTreeNode { - GBool finished; // true if this node is finished + bool finished; // true if this node is finished Guint val; // current value }; @@ -100,7 +100,7 @@ struct JPXCodeBlock { Guint x0, y0, x1, y1; // bounds //----- persistent state - GBool seen; // true if this code-block has already + bool seen; // true if this code-block has already // been seen Guint lBlock; // base number of bits used for pkt data length Guint nextPass; // next coding pass @@ -173,7 +173,7 @@ struct JPXResLevel { struct JPXTileComp { //----- from the SIZ segment - GBool sgned; // 1 for signed, 0 for unsigned + bool sgned; // 1 for signed, 0 for unsigned Guint prec; // precision, in bits Guint hSep; // horizontal separation of samples Guint vSep; // vertical separation of samples @@ -210,7 +210,7 @@ struct JPXTileComp { //------------------------------------------------------------------------ struct JPXTile { - GBool init; + bool init; //----- from the COD segments (main and tile) Guint progOrder; // progression order @@ -264,7 +264,7 @@ public: virtual int getChar() override; virtual int lookChar() override; virtual GooString *getPSFilter(int psLevel, const char *indent) override; - virtual GBool isBinary(GBool last = gTrue) override; + virtual bool isBinary(bool last = true) override; virtual void getImageParams(int *bitsPerComponent, StreamColorSpaceMode *csMode) override; @@ -272,13 +272,13 @@ private: void fillReadBuf(); void getImageParams2(int *bitsPerComponent, StreamColorSpaceMode *csMode); - GBool readBoxes(); - GBool readColorSpecBox(Guint dataLen); - GBool readCodestream(Guint len); - GBool readTilePart(); - GBool readTilePartData(Guint tileIdx, - Guint tilePartLen, GBool tilePartToEOC); - GBool readCodeBlockData(JPXTileComp *tileComp, + bool readBoxes(); + bool readColorSpecBox(Guint dataLen); + bool readCodestream(Guint len); + bool readTilePart(); + bool readTilePartData(Guint tileIdx, + Guint tilePartLen, bool tilePartToEOC); + bool readCodeBlockData(JPXTileComp *tileComp, JPXResLevel *resLevel, JPXPrecinct *precinct, JPXSubband *subband, @@ -289,16 +289,16 @@ private: Guint r, JPXResLevel *resLevel); void inverseTransform1D(JPXTileComp *tileComp, int *data, Guint offset, Guint n); - GBool inverseMultiCompAndDC(JPXTile *tile); - GBool readBoxHdr(Guint *boxType, Guint *boxLen, Guint *dataLen); + bool inverseMultiCompAndDC(JPXTile *tile); + bool readBoxHdr(Guint *boxType, Guint *boxLen, Guint *dataLen); int readMarkerHdr(int *segType, Guint *segLen); - GBool readUByte(Guint *x); - GBool readByte(int *x); - GBool readUWord(Guint *x); - GBool readULong(Guint *x); - GBool readNBytes(int nBytes, GBool signd, int *x); + bool readUByte(Guint *x); + bool readByte(int *x); + bool readUWord(Guint *x); + bool readULong(Guint *x); + bool readNBytes(int nBytes, bool signd, int *x); void startBitBuf(Guint byteCountA); - GBool readBits(int nBits, Guint *x); + bool readBits(int nBits, Guint *x); void skipSOP(); void skipEPH(); Guint finishBitBuf(); @@ -308,21 +308,21 @@ private: Guint nComps; // number of components Guint *bpc; // bits per component, for each component Guint width, height; // image size - GBool haveImgHdr; // set if a JP2/JPX image header has been + bool haveImgHdr; // set if a JP2/JPX image header has been // found JPXColorSpec cs; // color specification - GBool haveCS; // set if a color spec has been found + bool haveCS; // set if a color spec has been found JPXPalette palette; // the palette - GBool havePalette; // set if a palette has been found + bool havePalette; // set if a palette has been found JPXCompMap compMap; // the component mapping - GBool haveCompMap; // set if a component mapping has been found + bool haveCompMap; // set if a component mapping has been found JPXChannelDefn channelDefn; // channel definition - GBool haveChannelDefn; // set if a channel defn has been found + bool haveChannelDefn; // set if a channel defn has been found JPXImage img; // JPEG2000 decoder data Guint bitBuf; // buffer for bit reads int bitBufLen; // number of bits in bitBuf - GBool bitBufSkip; // true if next bit should be skipped + bool bitBufSkip; // true if next bit should be skipped // (for bit stuffing) Guint byteCount; // number of available bytes left diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc index 3fe75763..a6433bb6 100644 --- a/poppler/Lexer.cc +++ b/poppler/Lexer.cc @@ -73,7 +73,7 @@ Lexer::Lexer(XRef *xrefA, Stream *str) { streams = new Array(xref); streams->add(curStr.copy()); strPtr = 0; - freeArray = gTrue; + freeArray = true; curStr.streamReset(); } @@ -83,11 +83,11 @@ Lexer::Lexer(XRef *xrefA, Object *obj) { if (obj->isStream()) { streams = new Array(xref); - freeArray = gTrue; + freeArray = true; streams->add(obj->copy()); } else { streams = obj->getArray(); - freeArray = gFalse; + freeArray = false; } strPtr = 0; if (streams->getLength() > 0) { @@ -107,7 +107,7 @@ Lexer::~Lexer() { } } -int Lexer::getChar(GBool comesFromLook) { +int Lexer::getChar(bool comesFromLook) { int c; if (LOOK_VALUE_NOT_CACHED != lookCharLastValueCached) { @@ -118,7 +118,7 @@ int Lexer::getChar(GBool comesFromLook) { c = EOF; while (curStr.isStream() && (c = curStr.streamGetChar()) == EOF) { - if (comesFromLook == gTrue) { + if (comesFromLook == true) { return EOF; } else { curStr.streamClose(); @@ -140,7 +140,7 @@ int Lexer::lookChar() { if (LOOK_VALUE_NOT_CACHED != lookCharLastValueCached) { return lookCharLastValueCached; } - lookCharLastValueCached = getChar(gTrue); + lookCharLastValueCached = getChar(true); if (lookCharLastValueCached == EOF) { lookCharLastValueCached = LOOK_VALUE_NOT_CACHED; return EOF; @@ -152,7 +152,7 @@ int Lexer::lookChar() { Object Lexer::getObj(int objNum) { char *p; int c, c2; - GBool comment, neg, done, overflownInteger, overflownLongLong; + bool comment, neg, done, overflownInteger, overflownLongLong; int numParen; int xi; long long xll = 0; @@ -161,16 +161,16 @@ Object Lexer::getObj(int objNum) { int n, m; // skip whitespace and comments - comment = gFalse; + comment = false; while (1) { if ((c = getChar()) == EOF) { return Object(objEOF); } if (comment) { if (c == '\r' || c == '\n') - comment = gFalse; + comment = false; } else if (c == '%') { - comment = gTrue; + comment = true; } else if (specialChars[c] != 1) { break; } @@ -183,12 +183,12 @@ Object Lexer::getObj(int objNum) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '+': case '-': case '.': - overflownInteger = gFalse; - overflownLongLong = gFalse; - neg = gFalse; + overflownInteger = false; + overflownLongLong = false; + neg = false; xi = 0; if (c == '-') { - neg = gTrue; + neg = true; } else if (c == '.') { goto doReal; } else if (c != '+') { @@ -203,7 +203,7 @@ Object Lexer::getObj(int objNum) { } else if (unlikely (overflownInteger)) { if (unlikely(xll > LongLongSafeLimit) && (xll > (LLONG_MAX - (c - '0')) / 10)) { - overflownLongLong = gTrue; + overflownLongLong = true; xf = xll * 10.0 + (c - '0'); } else { xll = xll * 10 + (c - '0'); @@ -211,7 +211,7 @@ Object Lexer::getObj(int objNum) { } else { if (unlikely(xi > IntegerSafeLimit) && (xi > (INT_MAX - (c - '0')) / 10.0)) { - overflownInteger = gTrue; + overflownInteger = true; xll = xi * 10LL + (c - '0'); } else { xi = xi * 10 + (c - '0'); @@ -277,7 +277,7 @@ Object Lexer::getObj(int objNum) { p = tokBuf; n = 0; numParen = 1; - done = gFalse; + done = false; s = nullptr; do { c2 = EOF; @@ -290,7 +290,7 @@ Object Lexer::getObj(int objNum) { case '\n': #endif error(errSyntaxError, getPos(), "Unterminated string"); - done = gTrue; + done = true; break; case '(': @@ -300,7 +300,7 @@ Object Lexer::getObj(int objNum) { case ')': if (--numParen == 0) { - done = gTrue; + done = true; } else { c2 = c; } @@ -352,7 +352,7 @@ Object Lexer::getObj(int objNum) { break; case EOF: error(errSyntaxError, getPos(), "Unterminated string"); - done = gTrue; + done = true; break; default: c2 = c; @@ -381,7 +381,7 @@ Object Lexer::getObj(int objNum) { if (newObjNum != objNum) { error(errSyntaxError, getPos(), "Unterminated string"); - done = gTrue; + done = true; delete s; n = -2; } @@ -563,9 +563,9 @@ Object Lexer::getObj(int objNum) { } *p = '\0'; if (tokBuf[0] == 't' && !strcmp(tokBuf, "true")) { - return Object(gTrue); + return Object(true); } else if (tokBuf[0] == 'f' && !strcmp(tokBuf, "false")) { - return Object(gFalse); + return Object(false); } else if (tokBuf[0] == 'n' && !strcmp(tokBuf, "null")) { return Object(objNull); } else { @@ -580,11 +580,11 @@ Object Lexer::getObj(int objNum) { Object Lexer::getObj(const char *cmdA, int objNum) { char *p; int c; - GBool comment; + bool comment; int n; // skip whitespace and comments - comment = gFalse; + comment = false; const char *cmd1 = tokBuf; *tokBuf = 0; while (strcmp(cmdA, cmd1) && (objNum < 0 || (xref && xref->getNumEntry(getPos()) == objNum))) { @@ -594,10 +594,10 @@ Object Lexer::getObj(const char *cmdA, int objNum) { } if (comment) { if (c == '\r' || c == '\n') { - comment = gFalse; + comment = false; } } else if (c == '%') { - comment = gTrue; + comment = true; } else if (specialChars[c] != 1) { break; } @@ -635,6 +635,6 @@ void Lexer::skipToNextLine() { } } -GBool Lexer::isSpace(int c) { +bool Lexer::isSpace(int c) { return c >= 0 && c <= 0xff && specialChars[c] == 1; } diff --git a/poppler/Lexer.h b/poppler/Lexer.h index 8487e534..bbc05a10 100644 --- a/poppler/Lexer.h +++ b/poppler/Lexer.h @@ -79,7 +79,7 @@ public: { if (curStr.isStream()) curStr.streamSetPos(pos, dir); } // Returns true if <c> is a whitespace character. - static GBool isSpace(int c); + static bool isSpace(int c); // often (e.g. ~30% on PDF Refernce 1.6 pdf file from Adobe site) getChar @@ -93,13 +93,13 @@ public: private: - int getChar(GBool comesFromLook = gFalse); + int getChar(bool comesFromLook = false); int lookChar(); Array *streams; // array of input streams int strPtr; // index of current stream Object curStr; // current stream - GBool freeArray; // should lexer free the streams array? + bool freeArray; // should lexer free the streams array? char tokBuf[tokBufSize]; // temporary token buffer XRef *xref; diff --git a/poppler/Linearization.cc b/poppler/Linearization.cc index 8886894f..c37f27de 100644 --- a/poppler/Linearization.cc +++ b/poppler/Linearization.cc @@ -24,8 +24,8 @@ Linearization::Linearization (BaseStream *str) str->reset(); parser = new Parser(nullptr, - new Lexer(nullptr, str->makeSubStream(str->getStart(), gFalse, 0, Object(objNull))), - gFalse); + new Lexer(nullptr, str->makeSubStream(str->getStart(), false, 0, Object(objNull))), + false); Object obj1 = parser->getObj(); Object obj2 = parser->getObj(); Object obj3 = parser->getObj(); diff --git a/poppler/Link.cc b/poppler/Link.cc index d262ea6a..07949fc2 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -222,8 +222,8 @@ void LinkAction::setNextActions(GooList *actions) { LinkDest::LinkDest(const Array *a) { // initialize fields left = bottom = right = top = zoom = 0; - changeLeft = changeTop = changeZoom = gFalse; - ok = gFalse; + changeLeft = changeTop = changeZoom = false; + ok = false; // get page if (a->getLength() < 2) { @@ -233,11 +233,11 @@ LinkDest::LinkDest(const Array *a) { Object obj1 = a->getNF(0); if (obj1.isInt()) { pageNum = obj1.getInt() + 1; - pageIsRef = gFalse; + pageIsRef = false; } else if (obj1.isRef()) { pageRef.num = obj1.getRefNum(); pageRef.gen = obj1.getRefGen(); - pageIsRef = gTrue; + pageIsRef = true; } else { error(errSyntaxWarning, -1, "Bad annotation destination"); return; @@ -250,13 +250,13 @@ LinkDest::LinkDest(const Array *a) { if (obj1.isName("XYZ")) { kind = destXYZ; if (a->getLength() < 3) { - changeLeft = gFalse; + changeLeft = false; } else { Object obj2 = a->get(2); if (obj2.isNull()) { - changeLeft = gFalse; + changeLeft = false; } else if (obj2.isNum()) { - changeLeft = gTrue; + changeLeft = true; left = obj2.getNum(); } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); @@ -264,13 +264,13 @@ LinkDest::LinkDest(const Array *a) { } } if (a->getLength() < 4) { - changeTop = gFalse; + changeTop = false; } else { Object obj2 = a->get(3); if (obj2.isNull()) { - changeTop = gFalse; + changeTop = false; } else if (obj2.isNum()) { - changeTop = gTrue; + changeTop = true; top = obj2.getNum(); } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); @@ -278,14 +278,14 @@ LinkDest::LinkDest(const Array *a) { } } if (a->getLength() < 5) { - changeZoom = gFalse; + changeZoom = false; } else { Object obj2 = a->get(4); if (obj2.isNull()) { - changeZoom = gFalse; + changeZoom = false; } else if (obj2.isNum()) { zoom = obj2.getNum(); - changeZoom = (zoom == 0) ? gFalse : gTrue; + changeZoom = (zoom == 0) ? false : true; } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); return; @@ -300,13 +300,13 @@ LinkDest::LinkDest(const Array *a) { } else if (obj1.isName("FitH")) { kind = destFitH; if (a->getLength() < 3) { - changeTop = gFalse; + changeTop = false; } else { Object obj2 = a->get(2); if (obj2.isNull()) { - changeTop = gFalse; + changeTop = false; } else if (obj2.isNum()) { - changeTop = gTrue; + changeTop = true; top = obj2.getNum(); } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); @@ -323,9 +323,9 @@ LinkDest::LinkDest(const Array *a) { kind = destFitV; Object obj2 = a->get(2); if (obj2.isNull()) { - changeLeft = gFalse; + changeLeft = false; } else if (obj2.isNum()) { - changeLeft = gTrue; + changeLeft = true; left = obj2.getNum(); } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); @@ -381,9 +381,9 @@ LinkDest::LinkDest(const Array *a) { kind = destFitBH; Object obj2 = a->get(2); if (obj2.isNull()) { - changeTop = gFalse; + changeTop = false; } else if (obj2.isNum()) { - changeTop = gTrue; + changeTop = true; top = obj2.getNum(); } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); @@ -399,9 +399,9 @@ LinkDest::LinkDest(const Array *a) { kind = destFitBV; Object obj2 = a->get(2); if (obj2.isNull()) { - changeLeft = gFalse; + changeLeft = false; } else if (obj2.isNum()) { - changeLeft = gTrue; + changeLeft = true; left = obj2.getNum(); } else { error(errSyntaxWarning, -1, "Bad annotation destination position"); @@ -413,7 +413,7 @@ LinkDest::LinkDest(const Array *a) { error(errSyntaxWarning, -1, "Unknown annotation destination type"); } - ok = gTrue; + ok = true; return; } @@ -432,7 +432,7 @@ LinkDest::LinkDest(const LinkDest *dest) { changeLeft = dest->changeLeft; changeTop = dest->changeTop; changeZoom = dest->changeZoom; - ok = gTrue; + ok = true; } //------------------------------------------------------------------------ @@ -683,9 +683,9 @@ LinkMovie::~LinkMovie() { LinkSound::LinkSound(const Object *soundObj) { volume = 1.0; - sync = gFalse; - repeat = gFalse; - mix = gFalse; + sync = false; + repeat = false; + mix = false; sound = nullptr; if (soundObj->isDict()) { @@ -822,7 +822,7 @@ LinkJavaScript::~LinkJavaScript() { //------------------------------------------------------------------------ LinkOCGState::LinkOCGState(const Object *obj) { stateList = new GooList(); - preserveRB = gTrue; + preserveRB = true; Object obj1 = obj->dictLookup("State"); if (obj1.isArray()) { @@ -973,12 +973,12 @@ LinkAction *Links::find(double x, double y) const { return nullptr; } -GBool Links::onLink(double x, double y) const { +bool Links::onLink(double x, double y) const { int i; for (i = 0; i < numLinks; ++i) { if (links[i]->inRect(x, y)) - return gTrue; + return true; } - return gFalse; + return false; } diff --git a/poppler/Link.h b/poppler/Link.h index a3ee1750..d0e3cc39 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -72,7 +72,7 @@ public: virtual ~LinkAction(); // Was the LinkAction created successfully? - virtual GBool isOk() const = 0; + virtual bool isOk() const = 0; // Check link action type. virtual LinkActionKind getKind() const = 0; @@ -121,11 +121,11 @@ public: LinkDest *copy() const { return new LinkDest(this); } // Was the LinkDest created successfully? - GBool isOk() const { return ok; } + bool isOk() const { return ok; } // Accessors. LinkDestKind getKind() const { return kind; } - GBool isPageRef() const { return pageIsRef; } + bool isPageRef() const { return pageIsRef; } int getPageNum() const { return pageNum; } Ref getPageRef() const { return pageRef; } double getLeft() const { return left; } @@ -133,14 +133,14 @@ public: double getRight() const { return right; } double getTop() const { return top; } double getZoom() const { return zoom; } - GBool getChangeLeft() const { return changeLeft; } - GBool getChangeTop() const { return changeTop; } - GBool getChangeZoom() const { return changeZoom; } + bool getChangeLeft() const { return changeLeft; } + bool getChangeTop() const { return changeTop; } + bool getChangeZoom() const { return changeZoom; } private: LinkDestKind kind; // destination type - GBool pageIsRef; // is the page a reference or number? + bool pageIsRef; // is the page a reference or number? union { Ref pageRef; // reference to page int pageNum; // one-relative page number @@ -148,11 +148,11 @@ private: double left, bottom; // position double right, top; double zoom; // zoom factor - GBool changeLeft, changeTop; // which position components to change: - GBool changeZoom; // destXYZ uses all three; + bool changeLeft, changeTop; // which position components to change: + bool changeZoom; // destXYZ uses all three; // destFitH/BH use changeTop; // destFitV/BV use changeLeft - GBool ok; // set if created successfully + bool ok; // set if created successfully LinkDest(const LinkDest *dest); }; @@ -171,7 +171,7 @@ public: ~LinkGoTo(); // Was the LinkGoTo created successfully? - GBool isOk() const override { return dest || namedDest; } + bool isOk() const override { return dest || namedDest; } // Accessors. LinkActionKind getKind() const override { return actionGoTo; } @@ -201,7 +201,7 @@ public: ~LinkGoToR(); // Was the LinkGoToR created successfully? - GBool isOk() const override { return fileName && (dest || namedDest); } + bool isOk() const override { return fileName && (dest || namedDest); } // Accessors. LinkActionKind getKind() const override { return actionGoToR; } @@ -232,7 +232,7 @@ public: ~LinkLaunch(); // Was the LinkLaunch created successfully? - GBool isOk() const override { return fileName != nullptr; } + bool isOk() const override { return fileName != nullptr; } // Accessors. LinkActionKind getKind() const override { return actionLaunch; } @@ -259,7 +259,7 @@ public: ~LinkURI(); // Was the LinkURI created successfully? - GBool isOk() const override { return uri != nullptr; } + bool isOk() const override { return uri != nullptr; } // Accessors. LinkActionKind getKind() const override { return actionURI; } @@ -282,7 +282,7 @@ public: ~LinkNamed(); - GBool isOk() const override { return name != nullptr; } + bool isOk() const override { return name != nullptr; } LinkActionKind getKind() const override { return actionNamed; } const GooString *getName() const { return name; } @@ -310,14 +310,14 @@ public: LinkMovie(const Object *obj); ~LinkMovie(); - GBool isOk() const override { return annotRef.num >= 0 || annotTitle != nullptr; } + bool isOk() const override { return annotRef.num >= 0 || annotTitle != nullptr; } LinkActionKind getKind() const override { return actionMovie; } // a movie action stores either an indirect reference to a movie annotation // or the movie annotation title - GBool hasAnnotRef() const { return annotRef.num >= 0; } - GBool hasAnnotTitle() const { return annotTitle != nullptr; } + bool hasAnnotRef() const { return annotRef.num >= 0; } + bool hasAnnotTitle() const { return annotTitle != nullptr; } const Ref *getAnnotRef() const { return &annotRef; } const GooString *getAnnotTitle() const { return annotTitle; } @@ -353,14 +353,14 @@ public: ~LinkRendition(); - GBool isOk() const override { return true; } + bool isOk() const override { return true; } LinkActionKind getKind() const override { return actionRendition; } - GBool hasRenditionObject() const { return renditionObj.isDict(); } + bool hasRenditionObject() const { return renditionObj.isDict(); } const Object* getRenditionObject() const { return &renditionObj; } - GBool hasScreenAnnot() const { return screenRef.isRef(); } + bool hasScreenAnnot() const { return screenRef.isRef(); } Ref getScreenAnnot() const { return screenRef.getRef(); } RenditionOperation getOperation() const { return operation; } @@ -391,22 +391,22 @@ public: ~LinkSound(); - GBool isOk() const override { return sound != nullptr; } + bool isOk() const override { return sound != nullptr; } LinkActionKind getKind() const override { return actionSound; } double getVolume() const { return volume; } - GBool getSynchronous() const { return sync; } - GBool getRepeat() const { return repeat; } - GBool getMix() const { return mix; } + bool getSynchronous() const { return sync; } + bool getRepeat() const { return repeat; } + bool getMix() const { return mix; } Sound *getSound() const { return sound; } private: double volume; - GBool sync; - GBool repeat; - GBool mix; + bool sync; + bool repeat; + bool mix; Sound *sound; }; @@ -422,7 +422,7 @@ public: ~LinkJavaScript(); - GBool isOk() const override { return js != nullptr; } + bool isOk() const override { return js != nullptr; } LinkActionKind getKind() const override { return actionJavaScript; } const GooString *getScript() const { return js; } @@ -441,7 +441,7 @@ public: ~LinkOCGState(); - GBool isOk() const override { return stateList != nullptr; } + bool isOk() const override { return stateList != nullptr; } LinkActionKind getKind() const override { return actionOCGState; } @@ -456,11 +456,11 @@ public: }; const GooList *getStateList() const { return stateList; } - GBool getPreserveRB() const { return preserveRB; } + bool getPreserveRB() const { return preserveRB; } private: GooList *stateList; - GBool preserveRB; + bool preserveRB; }; //------------------------------------------------------------------------ @@ -473,7 +473,7 @@ public: ~LinkHide(); - GBool isOk() const override { return targetName != nullptr; } + bool isOk() const override { return targetName != nullptr; } LinkActionKind getKind() const override { return actionHide; } // According to spec the target can be either: @@ -485,15 +485,15 @@ public: // While b / c appear to be very uncommon and can't easily be // created with Adobe Acrobat DC. So only support hide // actions with named targets (yet). - GBool hasTargetName() const { return targetName != nullptr; } + bool hasTargetName() const { return targetName != nullptr; } const GooString *getTargetName() const { return targetName; } // Should this action show or hide. - GBool isShowAction() const { return show; } + bool isShowAction() const { return show; } private: GooString *targetName; - GBool show; + bool show; }; //------------------------------------------------------------------------ @@ -510,7 +510,7 @@ public: ~LinkUnknown(); // Was the LinkUnknown create successfully? - GBool isOk() const override { return action != nullptr; } + bool isOk() const override { return action != nullptr; } // Accessors. LinkActionKind getKind() const override { return actionUnknown; } @@ -546,7 +546,7 @@ public: LinkAction *find(double x, double y) const; // Return true if <x>,<y> is in a link. - GBool onLink(double x, double y) const; + bool onLink(double x, double y) const; private: diff --git a/poppler/LocalPDFDocBuilder.cc b/poppler/LocalPDFDocBuilder.cc index 6f6f1fca..bdecc657 100644 --- a/poppler/LocalPDFDocBuilder.cc +++ b/poppler/LocalPDFDocBuilder.cc @@ -32,14 +32,14 @@ LocalPDFDocBuilder::buildPDFDoc( } } -GBool LocalPDFDocBuilder::supports(const GooString &uri) +bool LocalPDFDocBuilder::supports(const GooString &uri) { if (uri.cmpN("file://", 7) == 0) { - return gTrue; + return true; } else if (!strstr(uri.getCString(), "://")) { - return gTrue; + return true; } else { - return gFalse; + return false; } } diff --git a/poppler/LocalPDFDocBuilder.h b/poppler/LocalPDFDocBuilder.h index 32e41a5d..05765cce 100644 --- a/poppler/LocalPDFDocBuilder.h +++ b/poppler/LocalPDFDocBuilder.h @@ -25,7 +25,7 @@ class LocalPDFDocBuilder : public PDFDocBuilder { public: PDFDoc *buildPDFDoc(const GooString &uri, GooString *ownerPassword = nullptr, GooString *userPassword = nullptr, void *guiDataA = nullptr) override; - GBool supports(const GooString &uri) override; + bool supports(const GooString &uri) override; }; diff --git a/poppler/MarkedContentOutputDev.cc b/poppler/MarkedContentOutputDev.cc index cefc0787..98f1e4b1 100644 --- a/poppler/MarkedContentOutputDev.cc +++ b/poppler/MarkedContentOutputDev.cc @@ -100,20 +100,20 @@ void MarkedContentOutputDev::endMarkedContent(GfxState *state) bool MarkedContentOutputDev::needFontChange(const GfxFont* font) const { if (currentFont == font) - return gFalse; + return false; if (!currentFont) return font != nullptr && font->isOk(); if (font == nullptr) - return gTrue; + return true; // Two non-null valid fonts are the same if they point to the same Ref if (currentFont->getID()->num == font->getID()->num && currentFont->getID()->gen == font->getID()->gen) - return gFalse; + return false; - return gTrue; + return true; } @@ -131,7 +131,7 @@ void MarkedContentOutputDev::drawChar(GfxState *state, // Color changes are tracked here so the color can be chosen depending on // the render mode (for mode 1 stroke color is used), so there is no need // to implement both updateFillColor() and updateStrokeColor(). - GBool colorChange = gFalse; + bool colorChange = false; GfxRGB color; if ((state->getRender() & 3) == 1) state->getStrokeRGB(&color); @@ -143,7 +143,7 @@ void MarkedContentOutputDev::drawChar(GfxState *state, color.b != currentColor.b); // Check also for font changes. - GBool fontChange = needFontChange(state->getFont()); + bool fontChange = needFontChange(state->getFont()); // Save a span with the current changes. if (colorChange || fontChange) { diff --git a/poppler/MarkedContentOutputDev.h b/poppler/MarkedContentOutputDev.h index 103e859a..ed12b70f 100644 --- a/poppler/MarkedContentOutputDev.h +++ b/poppler/MarkedContentOutputDev.h @@ -92,12 +92,12 @@ public: MarkedContentOutputDev(int mcidA); virtual ~MarkedContentOutputDev(); - virtual GBool isOk() { return gTrue; } - GBool upsideDown() override { return gTrue; } - GBool useDrawChar() override { return gTrue; } - GBool interpretType3Chars() override { return gFalse; } - GBool needNonText() override { return gFalse; } - GBool needCharCount() override { return gFalse; } + virtual bool isOk() { return true; } + bool upsideDown() override { return true; } + bool useDrawChar() override { return true; } + bool interpretType3Chars() override { return false; } + bool needNonText() override { return false; } + bool needCharCount() override { return false; } void startPage(int pageNum, GfxState *state, XRef *xref) override; void endPage() override; diff --git a/poppler/Movie.cc b/poppler/Movie.cc index 82d7f3f5..f4dfdf91 100644 --- a/poppler/Movie.cc +++ b/poppler/Movie.cc @@ -29,13 +29,13 @@ MovieActivationParameters::MovieActivationParameters() { // default values - floatingWindow = gFalse; + floatingWindow = false; xPosition = 0.5; yPosition = 0.5; rate = 1.0; volume = 100; - showControls = gFalse; - synchronousPlay = gFalse; + showControls = false; + synchronousPlay = false; repeatMode = repeatModeOnce; start.units = 0; duration.units = 0; @@ -141,7 +141,7 @@ void MovieActivationParameters::parseMovieActivation(const Object* aDict) { if (obj1.isArray()) { // the presence of that entry implies that the movie is to be played // in a floating window - floatingWindow = gTrue; + floatingWindow = true; Array* scale = obj1.getArray(); if (scale->getLength() >= 2) { @@ -177,7 +177,7 @@ void Movie::parseMovie (const Object *movieDict) { rotationAngle = 0; width = -1; height = -1; - showPoster = gFalse; + showPoster = false; Object obj1 = movieDict->dictLookup("F"); Object obj2 = getFileSpecNameForPlatform(&obj1); @@ -185,7 +185,7 @@ void Movie::parseMovie (const Object *movieDict) { fileName = obj2.getString()->copy(); } else { error (errSyntaxError, -1, "Invalid Movie"); - ok = gFalse; + ok = false; return; } @@ -216,7 +216,7 @@ void Movie::parseMovie (const Object *movieDict) { poster = movieDict->dictLookupNF("Poster"); if (!poster.isNull()) { if (poster.isRef() || poster.isStream()) { - showPoster = gTrue; + showPoster = true; } else if (poster.isBool()) { showPoster = poster.getBool(); poster.setToNull(); @@ -231,23 +231,23 @@ Movie::~Movie() { } Movie::Movie(const Object *movieDict) { - ok = gTrue; + ok = true; if (movieDict->isDict()) parseMovie(movieDict); else - ok = gFalse; + ok = false; } Movie::Movie(const Object *movieDict, const Object *aDict) { - ok = gTrue; + ok = true; if (movieDict->isDict()) { parseMovie(movieDict); if (aDict->isDict()) MA.parseMovieActivation(aDict); } else { - ok = gFalse; + ok = false; } } diff --git a/poppler/Movie.h b/poppler/Movie.h index 5c7f7913..bffd0e3d 100644 --- a/poppler/Movie.h +++ b/poppler/Movie.h @@ -55,13 +55,13 @@ struct MovieActivationParameters { int volume; // 100 - GBool showControls; // false + bool showControls; // false - GBool synchronousPlay; // false + bool synchronousPlay; // false MovieRepeatMode repeatMode; // repeatModeOnce // floating window position - GBool floatingWindow; + bool floatingWindow; double xPosition; // 0.5 double yPosition; // 0.5 int znum; // 1 @@ -76,7 +76,7 @@ class Movie { ~Movie(); Movie& operator=(const Movie &) = delete; - GBool isOk() const { return ok; } + bool isOk() const { return ok; } const MovieActivationParameters* getActivationParameters() const { return &MA; } const GooString* getFileName() const { return fileName; } @@ -85,9 +85,9 @@ class Movie { void getAspect (int *widthA, int *heightA) const { *widthA = width; *heightA = height; } Object getPoster() const { return poster.copy(); } - GBool getShowPoster() const { return showPoster; } + bool getShowPoster() const { return showPoster; } - GBool getUseFloatingWindow() const { return MA.floatingWindow; } + bool getUseFloatingWindow() const { return MA.floatingWindow; } void getFloatingWindowSize(int *width, int *height); Movie* copy() const ; @@ -95,14 +95,14 @@ class Movie { private: void parseMovie (const Object *movieDict); - GBool ok; + bool ok; Gushort rotationAngle; // 0 int width; // Aspect int height; // Aspect Object poster; - GBool showPoster; + bool showPoster; GooString* fileName; diff --git a/poppler/Object.h b/poppler/Object.h index 73e4793a..506f3360 100644 --- a/poppler/Object.h +++ b/poppler/Object.h @@ -153,7 +153,7 @@ public: Object() : type(objNone) {} ~Object() { free(); } - explicit Object(GBool boolnA) + explicit Object(bool boolnA) { type = objBool; booln = boolnA; } explicit Object(int intgA) { type = objInt; intg = intgA; } @@ -209,34 +209,34 @@ public: // Type checking. ObjType getType() const { CHECK_NOT_DEAD; return type; } - GBool isBool() const { CHECK_NOT_DEAD; return type == objBool; } - GBool isInt() const { CHECK_NOT_DEAD; return type == objInt; } - GBool isReal() const { CHECK_NOT_DEAD; return type == objReal; } - GBool isNum() const { CHECK_NOT_DEAD; return type == objInt || type == objReal || type == objInt64; } - GBool isString() const { CHECK_NOT_DEAD; return type == objString; } - GBool isName() const { CHECK_NOT_DEAD; return type == objName; } - GBool isNull() const { CHECK_NOT_DEAD; return type == objNull; } - GBool isArray() const { CHECK_NOT_DEAD; return type == objArray; } - GBool isDict() const { CHECK_NOT_DEAD; return type == objDict; } - GBool isStream() const { CHECK_NOT_DEAD; return type == objStream; } - GBool isRef() const { CHECK_NOT_DEAD; return type == objRef; } - GBool isCmd() const { CHECK_NOT_DEAD; return type == objCmd; } - GBool isError() const { CHECK_NOT_DEAD; return type == objError; } - GBool isEOF() const { CHECK_NOT_DEAD; return type == objEOF; } - GBool isNone() const { CHECK_NOT_DEAD; return type == objNone; } - GBool isInt64() const { CHECK_NOT_DEAD; return type == objInt64; } - GBool isIntOrInt64() const { CHECK_NOT_DEAD; return type == objInt || type == objInt64; } + bool isBool() const { CHECK_NOT_DEAD; return type == objBool; } + bool isInt() const { CHECK_NOT_DEAD; return type == objInt; } + bool isReal() const { CHECK_NOT_DEAD; return type == objReal; } + bool isNum() const { CHECK_NOT_DEAD; return type == objInt || type == objReal || type == objInt64; } + bool isString() const { CHECK_NOT_DEAD; return type == objString; } + bool isName() const { CHECK_NOT_DEAD; return type == objName; } + bool isNull() const { CHECK_NOT_DEAD; return type == objNull; } + bool isArray() const { CHECK_NOT_DEAD; return type == objArray; } + bool isDict() const { CHECK_NOT_DEAD; return type == objDict; } + bool isStream() const { CHECK_NOT_DEAD; return type == objStream; } + bool isRef() const { CHECK_NOT_DEAD; return type == objRef; } + bool isCmd() const { CHECK_NOT_DEAD; return type == objCmd; } + bool isError() const { CHECK_NOT_DEAD; return type == objError; } + bool isEOF() const { CHECK_NOT_DEAD; return type == objEOF; } + bool isNone() const { CHECK_NOT_DEAD; return type == objNone; } + bool isInt64() const { CHECK_NOT_DEAD; return type == objInt64; } + bool isIntOrInt64() const { CHECK_NOT_DEAD; return type == objInt || type == objInt64; } // Special type checking. - GBool isName(const char *nameA) const + bool isName(const char *nameA) const { return type == objName && !strcmp(cString, nameA); } - GBool isDict(const char *dictType) const; - GBool isStream(const char *dictType) const; - GBool isCmd(const char *cmdA) const + bool isDict(const char *dictType) const; + bool isStream(const char *dictType) const; + bool isCmd(const char *cmdA) const { return type == objCmd && !strcmp(cString, cmdA); } // Accessors. - GBool getBool() const { OBJECT_TYPE_CHECK(objBool); return booln; } + bool getBool() const { OBJECT_TYPE_CHECK(objBool); return booln; } int getInt() const { OBJECT_TYPE_CHECK(objInt); return intg; } double getReal() const { OBJECT_TYPE_CHECK(objReal); return real; } @@ -279,7 +279,7 @@ public: void dictAdd(const char *key, Object &&val); void dictSet(const char *key, Object &&val); void dictRemove(const char *key); - GBool dictIs(const char *dictType) const; + bool dictIs(const char *dictType) const; Object dictLookup(const char *key, int recursion = 0) const; Object dictLookupNF(const char *key) const; const char *dictGetKey(int i) const; @@ -287,7 +287,7 @@ public: Object dictGetValNF(int i) const; // Stream accessors. - GBool streamIs(const char *dictType) const; + bool streamIs(const char *dictType) const; void streamReset(); void streamClose(); int streamGetChar() const; @@ -308,7 +308,7 @@ private: ObjType type; // object type union { // value for each type: - GBool booln; // boolean + bool booln; // boolean int intg; // integer long long int64g; // 64-bit integer double real; // real @@ -360,10 +360,10 @@ inline void Object::dictSet(const char *key, Object &&val) inline void Object::dictRemove(const char *key) { OBJECT_TYPE_CHECK(objDict); dict->remove(key); } -inline GBool Object::dictIs(const char *dictType) const +inline bool Object::dictIs(const char *dictType) const { OBJECT_TYPE_CHECK(objDict); return dict->is(dictType); } -inline GBool Object::isDict(const char *dictType) const +inline bool Object::isDict(const char *dictType) const { return type == objDict && dictIs(dictType); } inline Object Object::dictLookup(const char *key, int recursion) const @@ -387,10 +387,10 @@ inline Object Object::dictGetValNF(int i) const #include "Stream.h" -inline GBool Object::streamIs(const char *dictType) const +inline bool Object::streamIs(const char *dictType) const { OBJECT_TYPE_CHECK(objStream); return stream->getDict()->is(dictType); } -inline GBool Object::isStream(const char *dictType) const +inline bool Object::isStream(const char *dictType) const { return type == objStream && streamIs(dictType); } inline void Object::streamReset() diff --git a/poppler/OptionalContent.cc b/poppler/OptionalContent.cc index 9d924e93..9922e893 100644 --- a/poppler/OptionalContent.cc +++ b/poppler/OptionalContent.cc @@ -35,12 +35,12 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) : m_xref(xref) { // we need to parse the dictionary here, and build optionalContentGroups - ok = gTrue; + ok = true; Object ocgList = ocgObject->dictLookup("OCGs"); if (!ocgList.isArray()) { error(errSyntaxError, -1, "Expected the optional content group list, but wasn't able to find it, or it isn't an Array"); - ok = gFalse; + ok = false; return; } @@ -64,7 +64,7 @@ OCGs::OCGs(Object *ocgObject, XRef *xref) : Object defaultOcgConfig = ocgObject->dictLookup("D"); if (!defaultOcgConfig.isDict()) { error(errSyntaxError, -1, "Expected the default config, but wasn't able to find it, or it isn't a Dictionary"); - ok = gFalse; + ok = false; return; } @@ -194,14 +194,14 @@ bool OCGs::optContentIsVisible( Object *dictRef ) return result; } -GBool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) { +bool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) { OptionalContentGroup *ocg; - GBool ret; + bool ret; if (recursion > visibilityExprRecursionLimit) { error(errSyntaxError, -1, "Loop detected in optional content visibility expression"); - return gTrue; + return true; } if (expr->isRef()) { if ((ocg = findOcgByRef(expr->getRef()))) { @@ -212,7 +212,7 @@ GBool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) { if (!expr2.isArray() || expr2.arrayGetLength() < 1) { error(errSyntaxError, -1, "Invalid optional content visibility expression"); - return gTrue; + return true; } Object op = expr2.arrayGet(0); if (op.isName("Not")) { @@ -222,16 +222,16 @@ GBool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) { } else { error(errSyntaxError, -1, "Invalid optional content visibility expression"); - ret = gTrue; + ret = true; } } else if (op.isName("And")) { - ret = gTrue; + ret = true; for (int i = 1; i < expr2.arrayGetLength() && ret; ++i) { Object obj = expr2.arrayGetNF(i); ret = evalOCVisibilityExpr(&obj, recursion + 1); } } else if (op.isName("Or")) { - ret = gFalse; + ret = false; for (int i = 1; i < expr2.arrayGetLength() && !ret; ++i) { Object obj = expr2.arrayGetNF(i); ret = evalOCVisibilityExpr(&obj, recursion + 1); @@ -239,7 +239,7 @@ GBool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) { } else { error(errSyntaxError, -1, "Invalid optional content visibility expression"); - ret = gTrue; + ret = true; } return ret; } diff --git a/poppler/OptionalContent.h b/poppler/OptionalContent.h index aeace263..74d5b436 100644 --- a/poppler/OptionalContent.h +++ b/poppler/OptionalContent.h @@ -37,7 +37,7 @@ public: OCGs& operator=(const OCGs &) = delete; // Is OCGS valid? - GBool isOk() const { return ok; } + bool isOk() const { return ok; } bool hasOCGs() const; const std::unordered_map< Ref, std::unique_ptr< OptionalContentGroup > > &getOCGs() const { return optionalContentGroups; } @@ -56,9 +56,9 @@ public: bool optContentIsVisible( Object *dictRef ); private: - GBool ok; + bool ok; - GBool evalOCVisibilityExpr(Object *expr, int recursion); + bool evalOCVisibilityExpr(Object *expr, int recursion); bool allOn( Array *ocgArray ); bool allOff( Array *ocgArray ); bool anyOn( Array *ocgArray ); diff --git a/poppler/Outline.cc b/poppler/Outline.cc index ec45edbf..b17ffdf9 100644 --- a/poppler/Outline.cc +++ b/poppler/Outline.cc @@ -89,11 +89,11 @@ OutlineItem::OutlineItem(const Dict *dict, int refNumA, OutlineItem *parentA, XR lastRef = dict->lookupNF("Last"); nextRef = dict->lookupNF("Next"); - startsOpen = gFalse; + startsOpen = false; obj1 = dict->lookup("Count"); if (obj1.isInt()) { if (obj1.getInt() > 0) { - startsOpen = gTrue; + startsOpen = true; } } } diff --git a/poppler/Outline.h b/poppler/Outline.h index 4194e048..b7d34e1a 100644 --- a/poppler/Outline.h +++ b/poppler/Outline.h @@ -70,8 +70,8 @@ public: const Unicode *getTitle() const { return title; } int getTitleLength() const { return titleLen; } const LinkAction *getAction() const { return action; } - GBool isOpen() const { return startsOpen; } - GBool hasKids() const { return firstRef.isRef(); } + bool isOpen() const { return startsOpen; } + bool hasKids() const { return firstRef.isRef(); } const GooList *getKids() const { return kids; } private: @@ -85,7 +85,7 @@ private: Object firstRef; Object lastRef; Object nextRef; - GBool startsOpen; + bool startsOpen; GooList *kids; // NULL if this item is closed or has no kids, // otherwise a list of OutlineItem }; diff --git a/poppler/OutputDev.cc b/poppler/OutputDev.cc index b72f0a40..15ab4a1a 100644 --- a/poppler/OutputDev.cc +++ b/poppler/OutputDev.cc @@ -93,15 +93,15 @@ void OutputDev::updateAll(GfxState *state) { updateFont(state); } -GBool OutputDev::beginType3Char(GfxState *state, double x, double y, +bool OutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { - return gFalse; + return false; } void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { int i, j; if (inlineImg) { @@ -115,9 +115,9 @@ void OutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void OutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) { - drawImageMask(state, ref, str, width, height, invert, gFalse, inlineImg); + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) { + drawImageMask(state, ref, str, width, height, invert, false, inlineImg); } void OutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) { @@ -126,7 +126,7 @@ void OutputDev::unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) { + bool interpolate, int *maskColors, bool inlineImg) { int i, j; if (inlineImg) { @@ -142,23 +142,23 @@ void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void OutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, - GBool maskInterpolate) { - drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, gFalse); + bool maskInvert, + bool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, false); } void OutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) { - drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, gFalse); + bool maskInterpolate) { + drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, false); } void OutputDev::endMarkedContent(GfxState *state) { diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h index 158a1625..8195a257 100644 --- a/poppler/OutputDev.h +++ b/poppler/OutputDev.h @@ -87,41 +87,41 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - virtual GBool upsideDown() = 0; + virtual bool upsideDown() = 0; // Does this device use drawChar() or drawString()? - virtual GBool useDrawChar() = 0; + virtual bool useDrawChar() = 0; // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - virtual GBool useTilingPatternFill() { return gFalse; } + virtual bool useTilingPatternFill() { return false; } // Does this device support specific shading types? // see gouraudTriangleShadedFill() and patchMeshShadedFill() - virtual GBool useShadedFills(int type) { return gFalse; } + virtual bool useShadedFills(int type) { return false; } // Does this device use FillColorStop()? - virtual GBool useFillColorStop() { return gFalse; } + virtual bool useFillColorStop() { return false; } // Does this device use drawForm()? If this returns false, // form-type XObjects will be interpreted (i.e., unrolled). - virtual GBool useDrawForm() { return gFalse; } + virtual bool useDrawForm() { return false; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - virtual GBool interpretType3Chars() = 0; + virtual bool interpretType3Chars() = 0; // Does this device need non-text content? - virtual GBool needNonText() { return gTrue; } + virtual bool needNonText() { return true; } // Does this device require incCharCount to be called for text on // non-shown layers? - virtual GBool needCharCount() { return gFalse; } + virtual bool needCharCount() { return false; } // Does this device need to clip pages to the crop box even when the // box is the crop box? - virtual GBool needClipToCropBox() { return gFalse; } + virtual bool needClipToCropBox() { return false; } //----- initialization and control @@ -132,15 +132,15 @@ public: // returns false, the page display is aborted. Typically, an // OutputDev will use some alternate means to display the page // before returning false. - virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + virtual bool checkPageSlice(Page *page, double hDPI, double vDPI, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (* abortCheckCbk)(void *data) = nullptr, + bool printing, + bool (* abortCheckCbk)(void *data) = nullptr, void * abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr) - { return gTrue; } + { return true; } // Start a page. virtual void startPage(int pageNum, GfxState *state, XRef *xref) {} @@ -215,27 +215,27 @@ public: virtual void stroke(GfxState * /*state*/) {} virtual void fill(GfxState * /*state*/) {} virtual void eoFill(GfxState * /*state*/) {} - virtual GBool tilingPatternFill(GfxState * /*state*/, Gfx * /*gfx*/, Catalog * /*cat*/, Object * /*str*/, + virtual bool tilingPatternFill(GfxState * /*state*/, Gfx * /*gfx*/, Catalog * /*cat*/, Object * /*str*/, const double * /*pmat*/, int /*paintType*/, int /*tilingType*/, Dict * /*resDict*/, const double * /*mat*/, const double * /*bbox*/, int /*x0*/, int /*y0*/, int /*x1*/, int /*y1*/, double /*xStep*/, double /*yStep*/) - { return gFalse; } - virtual GBool functionShadedFill(GfxState * /*state*/, + { return false; } + virtual bool functionShadedFill(GfxState * /*state*/, GfxFunctionShading * /*shading*/) - { return gFalse; } - virtual GBool axialShadedFill(GfxState * /*state*/, GfxAxialShading * /*shading*/, double /*tMin*/, double /*tMax*/) - { return gFalse; } - virtual GBool axialShadedSupportExtend(GfxState * /*state*/, GfxAxialShading * /*shading*/) - { return gFalse; } - virtual GBool radialShadedFill(GfxState * /*state*/, GfxRadialShading * /*shading*/, double /*sMin*/, double /*sMax*/) - { return gFalse; } - virtual GBool radialShadedSupportExtend(GfxState * /*state*/, GfxRadialShading * /*shading*/) - { return gFalse; } - virtual GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) - { return gFalse; } - virtual GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) - { return gFalse; } + { return false; } + virtual bool axialShadedFill(GfxState * /*state*/, GfxAxialShading * /*shading*/, double /*tMin*/, double /*tMax*/) + { return false; } + virtual bool axialShadedSupportExtend(GfxState * /*state*/, GfxAxialShading * /*shading*/) + { return false; } + virtual bool radialShadedFill(GfxState * /*state*/, GfxRadialShading * /*shading*/, double /*sMin*/, double /*sMax*/) + { return false; } + virtual bool radialShadedSupportExtend(GfxState * /*state*/, GfxRadialShading * /*shading*/) + { return false; } + virtual bool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) + { return false; } + virtual bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) + { return false; } //----- path clipping @@ -274,7 +274,7 @@ public: double /*originX*/, double /*originY*/, CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/) {} virtual void drawString(GfxState * /*state*/, const GooString * /*s*/) {} - virtual GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, + virtual bool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, CharCode /*code*/, Unicode * /*u*/, int /*uLen*/); virtual void endType3Char(GfxState * /*state*/) {} @@ -291,29 +291,29 @@ public: // If 'invert' is false, a sample value of 0 marks the page with the current color, // and a 1 leaves the previous contents unchanged. If 'invert' is true, these meanings are reversed. virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, GBool interpolate, - GBool inlineImg); + int width, int height, bool invert, bool interpolate, + bool inlineImg); virtual void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix); + int width, int height, bool invert, + bool inlineImg, double *baseMatrix); virtual void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg); + bool interpolate, int *maskColors, bool inlineImg); virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, - GfxImageColorMap *colorMap, GBool interpolate, + GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate); + bool maskInvert, bool maskInterpolate); virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate); + bool maskInterpolate); //----- grouping operators @@ -347,14 +347,14 @@ public: std::unique_ptr<std::unordered_map<std::string, ProfileData>> endProfile(); //----- transparency groups and soft masks - virtual GBool checkTransparencyGroup(GfxState * /*state*/, GBool /*knockout*/) { return gTrue; } + virtual bool checkTransparencyGroup(GfxState * /*state*/, bool /*knockout*/) { return true; } virtual void beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) {} + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) {} virtual void endTransparencyGroup(GfxState * /*state*/) {} virtual void paintTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/) {} - virtual void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/, + virtual void setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) {} virtual void clearSoftMask(GfxState * /*state*/) {} @@ -362,8 +362,8 @@ public: virtual void processLink(AnnotLink * /*link*/) {} #if 1 //~tmp: turn off anti-aliasing temporarily - virtual GBool getVectorAntialias() { return gFalse; } - virtual void setVectorAntialias(GBool /*vaa*/) {} + virtual bool getVectorAntialias() { return false; } + virtual void setVectorAntialias(bool /*vaa*/) {} #endif #ifdef USE_CMS diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 80d3f808..0d164e25 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -107,7 +107,7 @@ void PDFDoc::init() { - ok = gFalse; + ok = false; errCode = errNone; fileName = nullptr; file = nullptr; @@ -165,7 +165,7 @@ PDFDoc::PDFDoc(const GooString *fileNameA, const GooString *ownerPassword, } // create stream - str = new FileStream(file, 0, gFalse, file->size(), Object(objNull)); + str = new FileStream(file, 0, false, file->size(), Object(objNull)); ok = setup(ownerPassword, userPassword); } @@ -206,7 +206,7 @@ PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword, } // create stream - str = new FileStream(file, 0, gFalse, file->size(), Object(objNull)); + str = new FileStream(file, 0, false, file->size(), Object(objNull)); ok = setup(ownerPassword, userPassword); } @@ -240,32 +240,32 @@ PDFDoc::PDFDoc(BaseStream *strA, const GooString *ownerPassword, ok = setup(ownerPassword, userPassword); } -GBool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPassword) { +bool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPassword) { pdfdocLocker(); if (str->getLength() <= 0) { error(errSyntaxError, -1, "Document stream is empty"); - return gFalse; + return false; } str->setPos(0, -1); if (str->getPos() < 0) { error(errSyntaxError, -1, "Document base stream is not seekable"); - return gFalse; + return false; } str->reset(); // check footer // Adobe does not seem to enforce %%EOF, so we do the same -// if (!checkFooter()) return gFalse; +// if (!checkFooter()) return false; // check header checkHeader(); - GBool wasReconstructed = false; + bool wasReconstructed = false; // read xref table xref = new XRef(str, getStartXRef(), getMainXRefEntriesOffset(), &wasReconstructed); @@ -273,19 +273,19 @@ GBool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPasswor if (wasReconstructed) { delete xref; startXRefPos = -1; - xref = new XRef(str, getStartXRef(gTrue), getMainXRefEntriesOffset(gTrue), &wasReconstructed); + xref = new XRef(str, getStartXRef(true), getMainXRefEntriesOffset(true), &wasReconstructed); } if (!xref->isOk()) { error(errSyntaxError, -1, "Couldn't read xref table"); errCode = xref->getErrorCode(); - return gFalse; + return false; } } // check for encryption if (!checkEncryption(ownerPassword, userPassword)) { errCode = errEncrypted; - return gFalse; + return false; } // read catalog @@ -303,7 +303,7 @@ GBool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPasswor if (catalog && !catalog->isOk()) { error(errSyntaxError, -1, "Couldn't read page catalog"); errCode = errBadCatalog; - return gFalse; + return false; } } @@ -311,7 +311,7 @@ GBool PDFDoc::setup(const GooString *ownerPassword, const GooString *userPasswor extractPDFSubtype(); // done - return gTrue; + return true; } PDFDoc::~PDFDoc() { @@ -357,7 +357,7 @@ PDFDoc::~PDFDoc() { // Check for a %%EOF at the end of this stream -GBool PDFDoc::checkFooter() { +bool PDFDoc::checkFooter() { // we look in the last 1024 chars because Adobe does the same char *eof = new char[1025]; Goffset pos = str->getPos(); @@ -384,11 +384,11 @@ GBool PDFDoc::checkFooter() { error(errSyntaxError, -1, "Document has not the mandatory ending %%EOF"); errCode = errDamaged; delete[] eof; - return gFalse; + return false; } delete[] eof; str->setPos(pos); - return gTrue; + return true; } // Check for a PDF header on this stream. Skip past some garbage @@ -434,16 +434,16 @@ void PDFDoc::checkHeader() { // We don't do the version check. Don't add it back in. } -GBool PDFDoc::checkEncryption(const GooString *ownerPassword, const GooString *userPassword) { - GBool encrypted; - GBool ret; +bool PDFDoc::checkEncryption(const GooString *ownerPassword, const GooString *userPassword) { + bool encrypted; + bool ret; Object encrypt = xref->getTrailerDict()->dictLookup("Encrypt"); if ((encrypted = encrypt.isDict())) { if ((secHdlr = SecurityHandler::make(this, &encrypt))) { if (secHdlr->isUnencrypted()) { // no encryption - ret = gTrue; + ret = true; } else if (secHdlr->checkEncryption(ownerPassword, userPassword)) { // authorization succeeded xref->setEncryption(secHdlr->getPermissionFlags(), @@ -453,18 +453,18 @@ GBool PDFDoc::checkEncryption(const GooString *ownerPassword, const GooString *u secHdlr->getEncVersion(), secHdlr->getEncRevision(), secHdlr->getEncAlgorithm()); - ret = gTrue; + ret = true; } else { // authorization failed - ret = gFalse; + ret = false; } } else { // couldn't find the matching security handler - ret = gFalse; + ret = false; } } else { // document is not encrypted - ret = gTrue; + ret = true; } return ret; } @@ -619,11 +619,11 @@ std::vector<FormWidgetSignature*> PDFDoc::getSignatureWidgets() void PDFDoc::displayPage(OutputDev *out, int page, double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool crop, GBool printing, - GBool (*abortCheckCbk)(void *data), + bool useMediaBox, bool crop, bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), - void *annotDisplayDecideCbkData, GBool copyXRef) { + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), + void *annotDisplayDecideCbkData, bool copyXRef) { if (globalParams->getPrintCommands()) { printf("***** page %d *****\n", page); } @@ -638,10 +638,10 @@ void PDFDoc::displayPage(OutputDev *out, int page, void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage, double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool crop, GBool printing, - GBool (*abortCheckCbk)(void *data), + bool useMediaBox, bool crop, bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), void *annotDisplayDecideCbkData) { int page; @@ -654,12 +654,12 @@ void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage, void PDFDoc::displayPageSlice(OutputDev *out, int page, double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool crop, GBool printing, + bool useMediaBox, bool crop, bool printing, int sliceX, int sliceY, int sliceW, int sliceH, - GBool (*abortCheckCbk)(void *data), + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), - void *annotDisplayDecideCbkData, GBool copyXRef) { + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), + void *annotDisplayDecideCbkData, bool copyXRef) { if (getPage(page)) getPage(page)->displaySlice(out, hDPI, vDPI, rotate, useMediaBox, crop, @@ -691,19 +691,19 @@ Linearization *PDFDoc::getLinearization() return linearization; } -GBool PDFDoc::checkLinearization() { +bool PDFDoc::checkLinearization() { if (linearization == nullptr) - return gFalse; + return false; if (linearizationState == 1) - return gTrue; + return true; if (linearizationState == 2) - return gFalse; + return false; if (!hints) { hints = new Hints(str, linearization, getXRef(), secHdlr); } if (!hints->isOk()) { linearizationState = 2; - return gFalse; + return false; } for (int page = 1; page <= linearization->getNumPages(); page++) { Ref pageRef; @@ -711,35 +711,35 @@ GBool PDFDoc::checkLinearization() { pageRef.num = hints->getPageObjectNum(page); if (!pageRef.num) { linearizationState = 2; - return gFalse; + return false; } // check for bogus ref - this can happen in corrupted PDF files if (pageRef.num < 0 || pageRef.num >= xref->getNumObjects()) { linearizationState = 2; - return gFalse; + return false; } pageRef.gen = xref->getEntry(pageRef.num)->gen; Object obj = xref->fetch(pageRef.num, pageRef.gen); if (!obj.isDict("Page")) { linearizationState = 2; - return gFalse; + return false; } } linearizationState = 1; - return gTrue; + return true; } -GBool PDFDoc::isLinearized(GBool tryingToReconstruct) { +bool PDFDoc::isLinearized(bool tryingToReconstruct) { if ((str->getLength()) && (getLinearization()->getLength() == str->getLength())) - return gTrue; + return true; else { if (tryingToReconstruct) return getLinearization()->getLength() > 0; else - return gFalse; + return false; } } @@ -751,7 +751,7 @@ void PDFDoc::setDocInfoModified(Object *infoObj) void PDFDoc::setDocInfoStringEntry(const char *key, GooString *value) { - GBool removeEntry = !value || value->getLength() == 0 || value->hasJustUnicodeMarker(); + bool removeEntry = !value || value->getLength() == 0 || value->hasJustUnicodeMarker(); if (removeEntry) { delete value; } @@ -797,14 +797,14 @@ GooString *PDFDoc::getDocInfoStringEntry(const char *key) { return result; } -static GBool +static bool get_id (const GooString *encodedidstring, GooString *id) { const char *encodedid = encodedidstring->getCString(); char pdfid[pdfIdLength + 1]; int n; if (encodedidstring->getLength() != pdfIdLength / 2) - return gFalse; + return false; n = sprintf(pdfid, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", encodedid[0] & 0xff, encodedid[1] & 0xff, encodedid[2] & 0xff, encodedid[3] & 0xff, @@ -812,13 +812,13 @@ get_id (const GooString *encodedidstring, GooString *id) { encodedid[8] & 0xff, encodedid[9] & 0xff, encodedid[10] & 0xff, encodedid[11] & 0xff, encodedid[12] & 0xff, encodedid[13] & 0xff, encodedid[14] & 0xff, encodedid[15] & 0xff); if (n != pdfIdLength) - return gFalse; + return false; id->Set(pdfid, pdfIdLength); - return gTrue; + return true; } -GBool PDFDoc::getID(GooString *permanent_id, GooString *update_id) const { +bool PDFDoc::getID(GooString *permanent_id, GooString *update_id) const { Object obj = xref->getTrailerDict()->dictLookup ("ID"); if (obj.isArray() && obj.arrayGetLength() == 2) { @@ -826,11 +826,11 @@ GBool PDFDoc::getID(GooString *permanent_id, GooString *update_id) const { Object obj2 = obj.arrayGet(0); if (obj2.isString()) { if (!get_id (obj2.getString(), permanent_id)) { - return gFalse; + return false; } } else { error(errSyntaxError, -1, "Invalid permanent ID"); - return gFalse; + return false; } } @@ -838,18 +838,18 @@ GBool PDFDoc::getID(GooString *permanent_id, GooString *update_id) const { Object obj2 = obj.arrayGet(1); if (obj2.isString()) { if (!get_id (obj2.getString(), update_id)) { - return gFalse; + return false; } } else { error(errSyntaxError, -1, "Invalid update ID"); - return gFalse; + return false; } } - return gTrue; + return true; } - return gFalse; + return false; } Hints *PDFDoc::getHints() @@ -914,7 +914,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) if (trailerObj->isDict()) { markPageObjects(trailerObj->getDict(), yRef, countRef, 0, refPage->num, rootNum + 2); } - yRef->add(0, 65535, 0, gFalse); + yRef->add(0, 65535, 0, false); writeHeader(outStr, getPDFMajorVersion(), getPDFMinorVersion()); // get and mark info dict @@ -926,7 +926,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) Dict *trailerDict = trailerObj->getDict(); Object ref = trailerDict->lookupNF("Info"); if (ref.isRef()) { - yRef->add(ref.getRef().num, ref.getRef().gen, 0, gTrue); + yRef->add(ref.getRef().num, ref.getRef().gen, 0, true); if (getXRef()->getEntry(ref.getRef().num)->type == xrefEntryCompressed) { yRef->getEntry(ref.getRef().num)->type = xrefEntryCompressed; } @@ -964,7 +964,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) yRef->markUnencrypted(); writePageObjects(outStr, yRef, 0); - yRef->add(rootNum,0,outStr->getPos(),gTrue); + yRef->add(rootNum,0,outStr->getPos(),true); outStr->printf("%d 0 obj\n", rootNum); outStr->printf("<< /Type /Catalog /Pages %d 0 R", rootNum + 1); for (int j = 0; j < catDict->getLength(); j++) { @@ -981,7 +981,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) } outStr->printf(">>\nendobj\n"); - yRef->add(rootNum + 1,0,outStr->getPos(),gTrue); + yRef->add(rootNum + 1,0,outStr->getPos(),true); outStr->printf("%d 0 obj\n", rootNum + 1); outStr->printf("<< /Type /Pages /Kids [ %d 0 R ] /Count 1 ", rootNum + 2); if (resourcesObj.isDict()) { @@ -991,7 +991,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) outStr->printf(">>\n"); outStr->printf("endobj\n"); - yRef->add(rootNum + 2,0,outStr->getPos(),gTrue); + yRef->add(rootNum + 2,0,outStr->getPos(),true); outStr->printf("%d 0 obj\n", rootNum + 2); outStr->printf("<< "); for (int n = 0; n < pageDict->getLength(); n++) { @@ -1011,9 +1011,9 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) Ref ref; ref.num = rootNum; ref.gen = 0; - Object trailerDict = createTrailerDict(rootNum + 3, gFalse, 0, &ref, getXRef(), + Object trailerDict = createTrailerDict(rootNum + 3, false, 0, &ref, getXRef(), name->getCString(), uxrefOffset); - writeXRefTableTrailer(std::move(trailerDict), yRef, gFalse /* do not write unnecessary entries */, + writeXRefTableTrailer(std::move(trailerDict), yRef, false /* do not write unnecessary entries */, uxrefOffset, outStr, getXRef()); outStr->close(); @@ -1112,7 +1112,7 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) xref->getEncryptionParameters(&fileKey, &encAlgorithm, &keyLength); uxref = new XRef(); - uxref->add(0, 65535, 0, gFalse); + uxref->add(0, 65535, 0, false); xref->lock(); for(int i=0; i<xref->getNumObjects(); i++) { if ((xref->getEntry(i)->type == xrefEntryFree) && @@ -1128,14 +1128,14 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) Goffset offset = writeObjectHeader(&ref, outStr); writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen); writeObjectFooter(outStr); - uxref->add(ref.num, ref.gen, offset, gTrue); + uxref->add(ref.num, ref.gen, offset, true); } else { - uxref->add(ref.num, ref.gen, 0, gFalse); + uxref->add(ref.num, ref.gen, 0, false); } } } xref->unlock(); - // because of "uxref->add(0, 65535, 0, gFalse);" uxref->getNumObjects() will + // because of "uxref->add(0, 65535, 0, false);" uxref->getNumObjects() will // always be >= 1; if it is 1, it means there is nothing to update if (uxref->getNumObjects() == 1) { delete uxref; @@ -1150,20 +1150,20 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) rootRef.gen = getXRef()->getRootGen(); // Output a xref stream if there is a xref stream already - GBool xRefStream = xref->isXRefStream(); + bool xRefStream = xref->isXRefStream(); if (xRefStream) { // Append an entry for the xref stream itself uxrefStreamRef.num = numobjects++; uxrefStreamRef.gen = 0; - uxref->add(uxrefStreamRef.num, uxrefStreamRef.gen, uxrefOffset, gTrue); + uxref->add(uxrefStreamRef.num, uxrefStreamRef.gen, uxrefOffset, true); } - Object trailerDict = createTrailerDict(numobjects, gTrue, getStartXRef(), &rootRef, getXRef(), fileNameA, uxrefOffset); + Object trailerDict = createTrailerDict(numobjects, true, getStartXRef(), &rootRef, getXRef(), fileNameA, uxrefOffset); if (xRefStream) { writeXRefStreamTrailer(std::move(trailerDict), uxref, &uxrefStreamRef, uxrefOffset, outStr, getXRef()); } else { - writeXRefTableTrailer(std::move(trailerDict), uxref, gFalse, uxrefOffset, outStr, getXRef()); + writeXRefTableTrailer(std::move(trailerDict), uxref, false, uxrefOffset, outStr, getXRef()); } delete uxref; @@ -1182,7 +1182,7 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr) writeHeader(outStr, getPDFMajorVersion(), getPDFMinorVersion()); XRef *uxref = new XRef(); - uxref->add(0, 65535, 0, gFalse); + uxref->add(0, 65535, 0, false); xref->lock(); for(int i=0; i<xref->getNumObjects(); i++) { Ref ref; @@ -1193,12 +1193,12 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr) /* the XRef class adds a lot of irrelevant free entries, we only want the significant one and we don't want the one with num=0 because it has already been added (gen = 65535)*/ if (ref.gen > 0 && ref.num > 0) - uxref->add(ref.num, ref.gen, 0, gFalse); + uxref->add(ref.num, ref.gen, 0, false); } else if (xref->getEntry(i)->getFlag(XRefEntry::DontRewrite)) { // This entry must not be written, put a free entry instead (with incremented gen) ref.num = i; ref.gen = xref->getEntry(i)->gen + 1; - uxref->add(ref.num, ref.gen, 0, gFalse); + uxref->add(ref.num, ref.gen, 0, false); } else if (type == xrefEntryUncompressed){ ref.num = i; ref.gen = xref->getEntry(i)->gen; @@ -1211,7 +1211,7 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr) writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen); } writeObjectFooter(outStr); - uxref->add(ref.num, ref.gen, offset, gTrue); + uxref->add(ref.num, ref.gen, offset, true); } else if (type == xrefEntryCompressed) { ref.num = i; ref.gen = 0; //compressed entries have gen == 0 @@ -1219,13 +1219,13 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr) Goffset offset = writeObjectHeader(&ref, outStr); writeObject(&obj1, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen); writeObjectFooter(outStr); - uxref->add(ref.num, ref.gen, offset, gTrue); + uxref->add(ref.num, ref.gen, offset, true); } } xref->unlock(); Goffset uxrefOffset = outStr->getPos(); - writeXRefTableTrailer(uxrefOffset, uxref, gTrue /* write all entries */, - uxref->getNumObjects(), outStr, gFalse /* complete rewrite */); + writeXRefTableTrailer(uxrefOffset, uxref, true /* write all entries */, + uxref->getNumObjects(), outStr, false /* complete rewrite */); delete uxref; } @@ -1249,7 +1249,7 @@ void PDFDoc::writeDictionnary (Dict* dict, OutStream* outStr, XRef *xRef, Guint outStr->printf("<<"); for (int i=0; i<dict->getLength(); i++) { GooString keyName(dict->getKey(i)); - GooString *keyNameToPrint = keyName.sanitizedName(gFalse /* non ps mode */); + GooString *keyNameToPrint = keyName.sanitizedName(false /* non ps mode */); outStr->printf("/%s ", keyNameToPrint->getCString()); delete keyNameToPrint; Object obj1 = dict->getValNF(i); @@ -1390,7 +1390,7 @@ void PDFDoc::writeObject (Object* obj, OutStream* outStr, XRef *xRef, Guint numO case objName: { GooString name(obj->getName()); - GooString *nameToPrint = name.sanitizedName(gFalse /* non ps mode */); + GooString *nameToPrint = name.sanitizedName(false /* non ps mode */); outStr->printf("/%s ", nameToPrint->getCString()); delete nameToPrint; break; @@ -1420,7 +1420,7 @@ void PDFDoc::writeObject (Object* obj, OutStream* outStr, XRef *xRef, Guint numO // Encrypt stream EncryptStream *encStream = nullptr; - GBool removeFilter = gTrue; + bool removeFilter = true; if (stream->getKind() == strWeird && fileKey) { Object filter = stream->getDict()->lookup("Filter"); if (!filter.isName("Crypt")) { @@ -1428,26 +1428,26 @@ void PDFDoc::writeObject (Object* obj, OutStream* outStr, XRef *xRef, Guint numO for (int i = 0; i < filter.arrayGetLength(); i++) { Object filterEle = filter.arrayGet(i); if (filterEle.isName("Crypt")) { - removeFilter = gFalse; + removeFilter = false; break; } } if (removeFilter) { encStream = new EncryptStream(stream, fileKey, encAlgorithm, keyLength, objNum, objGen); - encStream->setAutoDelete(gFalse); + encStream->setAutoDelete(false); stream = encStream; } } else { encStream = new EncryptStream(stream, fileKey, encAlgorithm, keyLength, objNum, objGen); - encStream->setAutoDelete(gFalse); + encStream->setAutoDelete(false); stream = encStream; } } else { - removeFilter = gFalse; + removeFilter = false; } } else if (fileKey != nullptr) { // Encrypt stream encStream = new EncryptStream(stream, fileKey, encAlgorithm, keyLength, objNum, objGen); - encStream->setAutoDelete(gFalse); + encStream->setAutoDelete(false); stream = encStream; } @@ -1512,7 +1512,7 @@ void PDFDoc::writeObjectFooter (OutStream* outStr) outStr->printf("\r\nendobj\r\n"); } -Object PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Goffset startxRef, +Object PDFDoc::createTrailerDict(int uxrefSize, bool incrUpdate, Goffset startxRef, Ref *root, XRef *xRef, const char *fileName, Goffset fileSize) { Dict *trailerDict = new Dict(xRef); @@ -1547,12 +1547,12 @@ Object PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Goffset startx } } - GBool hasEncrypt = gFalse; + bool hasEncrypt = false; if (!xRef->getTrailerDict()->isNone()) { Object obj2 = xRef->getTrailerDict()->dictLookupNF("Encrypt"); if (!obj2.isNull()) { trailerDict->set("Encrypt", std::move(obj2)); - hasEncrypt = gTrue; + hasEncrypt = true; } } @@ -1598,7 +1598,7 @@ Object PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Goffset startx return Object(trailerDict); } -void PDFDoc::writeXRefTableTrailer(Object &&trailerDict, XRef *uxref, GBool writeAllEntries, Goffset uxrefOffset, OutStream* outStr, XRef *xRef) +void PDFDoc::writeXRefTableTrailer(Object &&trailerDict, XRef *uxref, bool writeAllEntries, Goffset uxrefOffset, OutStream* outStr, XRef *xRef) { uxref->writeTableToFile( outStr, writeAllEntries ); outStr->printf( "trailer\r\n"); @@ -1627,8 +1627,8 @@ void PDFDoc::writeXRefStreamTrailer (Object &&trailerDict, XRef *uxref, Ref *uxr outStr->printf( "%%%%EOF\r\n"); } -void PDFDoc::writeXRefTableTrailer(Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries, - int uxrefSize, OutStream* outStr, GBool incrUpdate) +void PDFDoc::writeXRefTableTrailer(Goffset uxrefOffset, XRef *uxref, bool writeAllEntries, + int uxrefSize, OutStream* outStr, bool incrUpdate) { const char *fileNameA = fileName ? fileName->getCString() : nullptr; // file size (doesn't include the trailer) @@ -1714,7 +1714,7 @@ void PDFDoc::markObject (Object* obj, XRef *xRef, XRef *countRef, Guint numOffse if (getXRef()->getEntry(obj->getRef().num)->type == xrefEntryFree) { return; // already marked as free => should be replaced } - xRef->add(obj->getRef().num + numOffset, obj->getRef().gen, 0, gTrue); + xRef->add(obj->getRef().num + numOffset, obj->getRef().gen, 0, true); if (getXRef()->getEntry(obj->getRef().num)->type == xrefEntryCompressed) { xRef->getEntry(obj->getRef().num + numOffset)->type = xrefEntryCompressed; } @@ -1722,7 +1722,7 @@ void PDFDoc::markObject (Object* obj, XRef *xRef, XRef *countRef, Guint numOffse if (obj->getRef().num + (int) numOffset >= countRef->getNumObjects() || countRef->getEntry(obj->getRef().num + numOffset)->type == xrefEntryFree) { - countRef->add(obj->getRef().num + numOffset, 1, 0, gTrue); + countRef->add(obj->getRef().num + numOffset, 1, 0, true); } else { XRefEntry *entry = countRef->getEntry(obj->getRef().num + numOffset); entry->gen++; @@ -1795,8 +1795,8 @@ void PDFDoc::markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint n } } -GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts) { - GBool modified = gFalse; +bool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts) { + bool modified = false; Object annots = annotsObj->fetch(getXRef()); if (annots.isArray()) { Array *array = annots.getArray(); @@ -1826,7 +1826,7 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui } } array->remove(i); - modified = gTrue; + modified = true; continue; } } @@ -1839,7 +1839,7 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui if (getXRef()->getEntry(obj1.getRef().num)->type == xrefEntryFree) { continue; // already marked as free => should be replaced } - xRef->add(obj1.getRef().num + numOffset, obj1.getRef().gen, 0, gTrue); + xRef->add(obj1.getRef().num + numOffset, obj1.getRef().gen, 0, true); if (getXRef()->getEntry(obj1.getRef().num)->type == xrefEntryCompressed) { xRef->getEntry(obj1.getRef().num + numOffset)->type = xrefEntryCompressed; } @@ -1847,7 +1847,7 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui if (obj1.getRef().num + (int) numOffset >= countRef->getNumObjects() || countRef->getEntry(obj1.getRef().num + numOffset)->type == xrefEntryFree) { - countRef->add(obj1.getRef().num + numOffset, 1, 0, gTrue); + countRef->add(obj1.getRef().num + numOffset, 1, 0, true); } else { XRefEntry *entry = countRef->getEntry(obj1.getRef().num + numOffset); entry->gen++; @@ -1860,7 +1860,7 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui if (getXRef()->getEntry(annotsObj->getRef().num)->type == xrefEntryFree) { return modified; // already marked as free => should be replaced } - xRef->add(annotsObj->getRef().num + numOffset, annotsObj->getRef().gen, 0, gTrue); + xRef->add(annotsObj->getRef().num + numOffset, annotsObj->getRef().gen, 0, true); if (getXRef()->getEntry(annotsObj->getRef().num)->type == xrefEntryCompressed) { xRef->getEntry(annotsObj->getRef().num + numOffset)->type = xrefEntryCompressed; } @@ -1868,7 +1868,7 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui if (annotsObj->getRef().num + (int) numOffset >= countRef->getNumObjects() || countRef->getEntry(annotsObj->getRef().num + numOffset)->type == xrefEntryFree) { - countRef->add(annotsObj->getRef().num + numOffset, 1, 0, gTrue); + countRef->add(annotsObj->getRef().num + numOffset, 1, 0, true); } else { XRefEntry *entry = countRef->getEntry(annotsObj->getRef().num + numOffset); entry->gen++; @@ -1879,7 +1879,7 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui } void PDFDoc::markAcroForm(Object *afObj, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum) { - GBool modified = gFalse; + bool modified = false; Object acroform = afObj->fetch(getXRef()); if (acroform.isDict()) { Dict *dict = acroform.getDict(); @@ -1898,7 +1898,7 @@ void PDFDoc::markAcroForm(Object *afObj, XRef *xRef, XRef *countRef, Guint numOf if (getXRef()->getEntry(afObj->getRef().num)->type == xrefEntryFree) { return; // already marked as free => should be replaced } - xRef->add(afObj->getRef().num + numOffset, afObj->getRef().gen, 0, gTrue); + xRef->add(afObj->getRef().num + numOffset, afObj->getRef().gen, 0, true); if (getXRef()->getEntry(afObj->getRef().num)->type == xrefEntryCompressed) { xRef->getEntry(afObj->getRef().num + numOffset)->type = xrefEntryCompressed; } @@ -1906,7 +1906,7 @@ void PDFDoc::markAcroForm(Object *afObj, XRef *xRef, XRef *countRef, Guint numOf if (afObj->getRef().num + (int) numOffset >= countRef->getNumObjects() || countRef->getEntry(afObj->getRef().num + numOffset)->type == xrefEntryFree) { - countRef->add(afObj->getRef().num + numOffset, 1, 0, gTrue); + countRef->add(afObj->getRef().num + numOffset, 1, 0, true); } else { XRefEntry *entry = countRef->getEntry(afObj->getRef().num + numOffset); entry->gen++; @@ -1918,7 +1918,7 @@ void PDFDoc::markAcroForm(Object *afObj, XRef *xRef, XRef *countRef, Guint numOf return; } -Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, GBool combine) +Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, bool combine) { Guint objectsCount = 0; //count the number of objects in the XRef(s) Guchar *fileKey; @@ -1942,7 +1942,7 @@ Guint PDFDoc::writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, G writeObject(&obj, outStr, fileKey, encAlgorithm, keyLength, ref.num, ref.gen); } writeObjectFooter(outStr); - xRef->add(ref.num, ref.gen, offset, gTrue); + xRef->add(ref.num, ref.gen, offset, true); } } return objectsCount; @@ -1984,7 +1984,7 @@ long long PDFDoc::strToLongLong(const char *s) { } // Read the 'startxref' position. -Goffset PDFDoc::getStartXRef(GBool tryingToReconstruct) +Goffset PDFDoc::getStartXRef(bool tryingToReconstruct) { if (startXRefPos == -1) { @@ -2052,7 +2052,7 @@ Goffset PDFDoc::getStartXRef(GBool tryingToReconstruct) return startXRefPos; } -Goffset PDFDoc::getMainXRefEntriesOffset(GBool tryingToReconstruct) +Goffset PDFDoc::getMainXRefEntriesOffset(bool tryingToReconstruct) { Guint mainXRefEntriesOffset = 0; diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 71315600..d57c049f 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -132,7 +132,7 @@ public: static PDFDoc *ErrorPDFDoc(int errorCode, const GooString *fileNameA = nullptr); // Was PDF document successfully opened? - GBool isOk() const { return ok; } + bool isOk() const { return ok; } // Get the error code (if isOk() returns false). int getErrorCode() const { return errCode; } @@ -149,7 +149,7 @@ public: // Get the linearization table. Linearization *getLinearization(); - GBool checkLinearization(); + bool checkLinearization(); // Get the xref table. XRef *getXRef() const { return xref; } @@ -191,30 +191,30 @@ public: // Display a page. void displayPage(OutputDev *out, int page, double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool crop, GBool printing, - GBool (*abortCheckCbk)(void *data) = nullptr, + bool useMediaBox, bool crop, bool printing, + bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, - void *annotDisplayDecideCbkData = nullptr, GBool copyXRef = gFalse); + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + void *annotDisplayDecideCbkData = nullptr, bool copyXRef = false); // Display a range of pages. void displayPages(OutputDev *out, int firstPage, int lastPage, double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool crop, GBool printing, - GBool (*abortCheckCbk)(void *data) = nullptr, + bool useMediaBox, bool crop, bool printing, + bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr); // Display part of a page. void displayPageSlice(OutputDev *out, int page, double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool crop, GBool printing, + bool useMediaBox, bool crop, bool printing, int sliceX, int sliceY, int sliceW, int sliceH, - GBool (*abortCheckCbk)(void *data) = nullptr, + bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, - void *annotDisplayDecideCbkData = nullptr, GBool copyXRef = gFalse); + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + void *annotDisplayDecideCbkData = nullptr, bool copyXRef = false); // Find a page, given its object ID. Returns page number, or 0 if // not found. @@ -236,31 +236,31 @@ public: Outline *getOutline(); // Is the file encrypted? - GBool isEncrypted() { return xref->isEncrypted(); } + bool isEncrypted() { return xref->isEncrypted(); } std::vector<FormWidgetSignature*> getSignatureWidgets(); // Check various permissions. - GBool okToPrint(GBool ignoreOwnerPW = gFalse) + bool okToPrint(bool ignoreOwnerPW = false) { return xref->okToPrint(ignoreOwnerPW); } - GBool okToPrintHighRes(GBool ignoreOwnerPW = gFalse) + bool okToPrintHighRes(bool ignoreOwnerPW = false) { return xref->okToPrintHighRes(ignoreOwnerPW); } - GBool okToChange(GBool ignoreOwnerPW = gFalse) + bool okToChange(bool ignoreOwnerPW = false) { return xref->okToChange(ignoreOwnerPW); } - GBool okToCopy(GBool ignoreOwnerPW = gFalse) + bool okToCopy(bool ignoreOwnerPW = false) { return xref->okToCopy(ignoreOwnerPW); } - GBool okToAddNotes(GBool ignoreOwnerPW = gFalse) + bool okToAddNotes(bool ignoreOwnerPW = false) { return xref->okToAddNotes(ignoreOwnerPW); } - GBool okToFillForm(GBool ignoreOwnerPW = gFalse) + bool okToFillForm(bool ignoreOwnerPW = false) { return xref->okToFillForm(ignoreOwnerPW); } - GBool okToAccessibility(GBool ignoreOwnerPW = gFalse) + bool okToAccessibility(bool ignoreOwnerPW = false) { return xref->okToAccessibility(ignoreOwnerPW); } - GBool okToAssemble(GBool ignoreOwnerPW = gFalse) + bool okToAssemble(bool ignoreOwnerPW = false) { return xref->okToAssemble(ignoreOwnerPW); } // Is this document linearized? - GBool isLinearized(GBool tryingToReconstruct = gFalse); + bool isLinearized(bool tryingToReconstruct = false); // Return the document's Info dictionary (if any). Object getDocInfo() { return xref->getDocInfo(); } @@ -313,7 +313,7 @@ public: int getPDFMinorVersion() const { return pdfMinorVersion; } //Return the PDF ID in the trailer dictionary (if any). - GBool getID(GooString *permanent_id, GooString *update_id) const; + bool getID(GooString *permanent_id, GooString *update_id) const; // Save one page with another name. int savePageAs(GooString *name, int pageNo); @@ -332,17 +332,17 @@ public: // rewrite pageDict with MediaBox, CropBox and new page CTM void replacePageDict(int pageNo, int rotate, const PDFRectangle *mediaBox, const PDFRectangle *cropBox); void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr); - GBool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts = nullptr); + bool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts = nullptr); void markAcroForm(Object *acrpForm, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum); // write all objects used by pageDict to outStr - Guint writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, GBool combine = gFalse); + Guint writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, bool combine = false); static void writeObject (Object *obj, OutStream* outStr, XRef *xref, Guint numOffset, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, std::set<Dict*> *alreadyWrittenDicts = nullptr); static void writeHeader(OutStream *outStr, int major, int minor); - static Object createTrailerDict (int uxrefSize, GBool incrUpdate, Goffset startxRef, + static Object createTrailerDict (int uxrefSize, bool incrUpdate, Goffset startxRef, Ref *root, XRef *xRef, const char *fileName, Goffset fileSize); - static void writeXRefTableTrailer (Object &&trailerDict, XRef *uxref, GBool writeAllEntries, + static void writeXRefTableTrailer (Object &&trailerDict, XRef *uxref, bool writeAllEntries, Goffset uxrefOffset, OutStream* outStr, XRef *xRef); static void writeXRefStreamTrailer (Object &&trailerDict, XRef *uxref, Ref *uxrefStreamRef, Goffset uxrefOffset, OutStream* outStr, XRef *xRef); @@ -363,8 +363,8 @@ private: { writeObject(obj, outStr, getXRef(), 0, fileKey, encAlgorithm, keyLength, objNum, objGen, alreadyWrittenDicts); } static void writeStream (Stream* str, OutStream* outStr); static void writeRawStream (Stream* str, OutStream* outStr); - void writeXRefTableTrailer (Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries, - int uxrefSize, OutStream* outStr, GBool incrUpdate); + void writeXRefTableTrailer (Goffset uxrefOffset, XRef *uxref, bool writeAllEntries, + int uxrefSize, OutStream* outStr, bool incrUpdate); static void writeString (const GooString* s, OutStream* outStr, const Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen); void saveIncrementalUpdate (OutStream* outStr); @@ -377,17 +377,17 @@ private: PDFDoc(); void init(); - GBool setup(const GooString *ownerPassword, const GooString *userPassword); - GBool checkFooter(); + bool setup(const GooString *ownerPassword, const GooString *userPassword); + bool checkFooter(); void checkHeader(); - GBool checkEncryption(const GooString *ownerPassword, const GooString *userPassword); + bool checkEncryption(const GooString *ownerPassword, const GooString *userPassword); void extractPDFSubtype(); // Get the offset of the start xref table. - Goffset getStartXRef(GBool tryingToReconstruct = gFalse); + Goffset getStartXRef(bool tryingToReconstruct = false); // Get the offset of the entries in the main XRef table of a // linearized document (0 for non linearized documents). - Goffset getMainXRefEntriesOffset(GBool tryingToReconstruct = gFalse); + Goffset getMainXRefEntriesOffset(bool tryingToReconstruct = false); long long strToLongLong(const char *s); // Mark the document's Info dictionary as modified. @@ -417,7 +417,7 @@ private: Outline *outline; Page **pageCache; - GBool ok; + bool ok; int errCode; //If there is an error opening the PDF file with fopen() in the constructor, //then the POSIX errno will be here. diff --git a/poppler/PDFDocBuilder.h b/poppler/PDFDocBuilder.h index 6d94b0d3..843a5c49 100644 --- a/poppler/PDFDocBuilder.h +++ b/poppler/PDFDocBuilder.h @@ -38,8 +38,8 @@ public: virtual PDFDoc *buildPDFDoc(const GooString &uri, GooString *ownerPassword = nullptr, GooString *userPassword = nullptr, void *guiDataA = nullptr) = 0; - // Returns gTrue if the builder supports building a PDFDoc from the URI. - virtual GBool supports(const GooString &uri) = 0; + // Returns true if the builder supports building a PDFDoc from the URI. + virtual bool supports(const GooString &uri) = 0; }; diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 4b409410..3f3082f8 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -1001,12 +1001,12 @@ public: int lookChar() override { return (bufIdx >= bufSize && !fillBuf()) ? EOF : buf[bufIdx]; } GooString *getPSFilter(int psLevel, const char *indent) override { return nullptr; } - GBool isBinary(GBool last = gTrue) override { return gTrue; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool last = true) override { return true; } + bool isEncoder() override { return true; } private: - GBool fillBuf(); + bool fillBuf(); int width, height; GfxImageColorMap *colorMap; @@ -1048,14 +1048,14 @@ void DeviceNRecoder::reset() { imgStr->reset(); } -GBool DeviceNRecoder::fillBuf() { +bool DeviceNRecoder::fillBuf() { Guchar pixBuf[gfxColorMaxComps]; GfxColor color; double x[gfxColorMaxComps], y[gfxColorMaxComps]; int i; if (pixelIdx >= width * height) { - return gFalse; + return false; } imgStr->getPixel(pixBuf); colorMap->getColor(pixBuf, &color); @@ -1070,7 +1070,7 @@ GBool DeviceNRecoder::fillBuf() { } bufIdx = 0; ++pixelIdx; - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -1089,10 +1089,10 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, char *psTitleA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA, int paperHeightA, - GBool noCropA, GBool duplexA, + bool noCropA, bool duplexA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, - GBool forceRasterizeA, - GBool manualCtrlA, + bool forceRasterizeA, + bool manualCtrlA, PSOutCustomCodeCbk customCodeCbkA, void *customCodeCbkDataA) { FILE *f; @@ -1114,7 +1114,7 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, paperSizes = nullptr; embFontList = nullptr; customColors = nullptr; - haveTextClip = gFalse; + haveTextClip = false; t3String = nullptr; forceRasterize = forceRasterizeA; psTitle = nullptr; @@ -1131,19 +1131,19 @@ PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, #endif if (!(f = popen(fileName + 1, "w"))) { error(errIO, -1, "Couldn't run print command '{0:s}'", fileName); - ok = gFalse; + ok = false; return; } #else error(errIO, -1, "Print commands are not supported ('{0:s}')", fileName); - ok = gFalse; + ok = false; return; #endif } else { fileTypeA = psFile; if (!(f = fopen(fileName, "w"))) { error(errIO, -1, "Couldn't open PostScript file '{0:s}'", fileName); - ok = gFalse; + ok = false; return; } } @@ -1159,10 +1159,10 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, PDFDoc *doc, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA, int paperHeightA, - GBool noCropA, GBool duplexA, + bool noCropA, bool duplexA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, - GBool forceRasterizeA, - GBool manualCtrlA, + bool forceRasterizeA, + bool manualCtrlA, PSOutCustomCodeCbk customCodeCbkA, void *customCodeCbkDataA) { underlayCbk = nullptr; @@ -1181,7 +1181,7 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, paperSizes = nullptr; embFontList = nullptr; customColors = nullptr; - haveTextClip = gFalse; + haveTextClip = false; t3String = nullptr; forceRasterize = forceRasterizeA; psTitle = nullptr; @@ -1233,36 +1233,36 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, PSFileType fileTypeA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pagesA, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, - GBool manualCtrlA, int paperWidthA, int paperHeightA, - GBool noCropA, GBool duplexA) { + bool manualCtrlA, int paperWidthA, int paperHeightA, + bool noCropA, bool duplexA) { if (pagesA.empty()) { - ok = gFalse; + ok = false; return; } // initialize - postInitDone = gFalse; - embedType1 = gTrue; - embedTrueType = gTrue; - embedCIDPostScript = gTrue; - embedCIDTrueType = gTrue; - fontPassthrough = gFalse; - optimizeColorSpace = gFalse; - passLevel1CustomColor = gFalse; - preloadImagesForms = gFalse; - generateOPI = gFalse; - useASCIIHex = gFalse; - useBinary = gFalse; - enableLZW = gTrue; - enableFlate = gTrue; - rasterMono = gFalse; + postInitDone = false; + embedType1 = true; + embedTrueType = true; + embedCIDPostScript = true; + embedCIDTrueType = true; + fontPassthrough = false; + optimizeColorSpace = false; + passLevel1CustomColor = false; + preloadImagesForms = false; + generateOPI = false; + useASCIIHex = false; + useBinary = false; + enableLZW = true; + enableFlate = true; + rasterMono = false; rasterResolution = 300; - uncompressPreloadedImages = gFalse; - psCenter = gTrue; - rasterAntialias = gFalse; - displayText = gTrue; - ok = gTrue; + uncompressPreloadedImages = false; + psCenter = true; + rasterAntialias = false; + displayText = true; + ok = true; outputFunc = outputFuncA; outputStream = outputStreamA; fileType = fileTypeA; @@ -1284,9 +1284,9 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, xref = nullptr; processColors = 0; - inType3Char = gFalse; - inUncoloredPattern = gFalse; - t3FillColorOnly = gFalse; + inType3Char = false; + inUncoloredPattern = false; + t3FillColorOnly = false; #ifdef OPI_SUPPORT // initialize OPI nesting levels @@ -1318,15 +1318,15 @@ void PSOutputDev::postInit() return; } - postInitDone = gTrue; + postInitDone = true; xref = doc->getXRef(); catalog = doc->getCatalog(); if (paperWidth < 0 || paperHeight < 0) { - paperMatch = gTrue; + paperMatch = true; } else { - paperMatch = gFalse; + paperMatch = false; } Page *page; paperSizes = new GooList(); @@ -1334,7 +1334,7 @@ void PSOutputDev::postInit() const int pg = pages[pgi]; page = catalog->getPage(pg); if (page == nullptr) - paperMatch = gFalse; + paperMatch = false; if (!paperMatch) { w = paperWidth; h = paperHeight; @@ -1624,23 +1624,23 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages, } void PSOutputDev::writeXpdfProcset() { - GBool lev1, lev2, lev3, sep, nonSep; + bool lev1, lev2, lev3, sep, nonSep; const char **p; const char *q; writePSFmt("%%BeginResource: procset xpdf {0:s} 0\n", "3.00"); writePSFmt("%%Copyright: {0:s}\n", xpdfCopyright); - lev1 = lev2 = lev3 = sep = nonSep = gTrue; + lev1 = lev2 = lev3 = sep = nonSep = true; for (p = prolog; *p; ++p) { if ((*p)[0] == '~') { - lev1 = lev2 = lev3 = sep = nonSep = gFalse; + lev1 = lev2 = lev3 = sep = nonSep = false; for (q = *p + 1; *q; ++q) { switch (*q) { - case '1': lev1 = gTrue; break; - case '2': lev2 = gTrue; break; - case '3': lev3 = gTrue; break; - case 's': sep = gTrue; break; - case 'n': nonSep = gTrue; break; + case '1': lev1 = true; break; + case '2': lev2 = true; break; + case '3': lev3 = true; break; + case 's': sep = true; break; + case 'n': nonSep = true; break; } } } else if ((level == psLevel1 && lev1 && nonSep) || @@ -1664,7 +1664,7 @@ void PSOutputDev::writeXpdfProcset() { void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog, const std::vector<int> &pages, - GBool duplexA) { + bool duplexA) { Page *page; Dict *resDict; Annots *annots; @@ -1785,7 +1785,7 @@ void PSOutputDev::writeTrailer() { } void PSOutputDev::setupResources(Dict *resDict) { - GBool skip; + bool skip; setupFonts(resDict); setupImages(resDict); @@ -1797,12 +1797,12 @@ void PSOutputDev::setupResources(Dict *resDict) { for (int i = 0; i < xObjDict.dictGetLength(); ++i) { // avoid infinite recursion on XObjects - skip = gFalse; + skip = false; Object xObjRef = xObjDict.dictGetValNF(i); if (xObjRef.isRef()) { Ref ref0 = xObjRef.getRef(); if (resourceIDs.find(ref0.num) != resourceIDs.end()) { - skip = gTrue; + skip = true; } else { resourceIDs.insert(ref0.num); } @@ -1824,16 +1824,16 @@ void PSOutputDev::setupResources(Dict *resDict) { //----- recursively scan Patterns Object patDict = resDict->lookup("Pattern"); if (patDict.isDict()) { - inType3Char = gTrue; + inType3Char = true; for (int i = 0; i < patDict.dictGetLength(); ++i) { // avoid infinite recursion on Patterns - skip = gFalse; + skip = false; Object patRef = patDict.dictGetValNF(i); if (patRef.isRef()) { Ref ref0 = patRef.getRef(); if (resourceIDs.find(ref0.num) != resourceIDs.end()) { - skip = gTrue; + skip = true; } else { resourceIDs.insert(ref0.num); } @@ -1850,7 +1850,7 @@ void PSOutputDev::setupResources(Dict *resDict) { } } } - inType3Char = gFalse; + inType3Char = false; } } @@ -1885,7 +1885,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { GfxFontLoc *fontLoc; GooString *psName; char buf[16]; - GBool subst; + bool subst; UnicodeMap *uMap; const char *charName; double xs, ys; @@ -1910,7 +1910,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { psName = nullptr; xs = ys = 1; - subst = gFalse; + subst = false; if (font->getType() == fontType3) { psName = GooString::format("T3_{0:d}_{1:d}", @@ -1948,7 +1948,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { case fontCIDType2OT: psName = makePSFontName(font, font->getID()); //~ should check to see if font actually uses vertical mode - setupEmbeddedCIDTrueTypeFont(font, &fontLoc->embFontID, psName, gTrue); + setupEmbeddedCIDTrueTypeFont(font, &fontLoc->embFontID, psName, true); break; case fontCIDType0COT: psName = makePSFontName(font, &fontLoc->embFontID); @@ -1980,7 +1980,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { case fontCIDType2OT: psName = makePSFontName(font, font->getID()); //~ should check to see if font actually uses vertical mode - setupExternalCIDTrueTypeFont(font, fontLoc->path, psName, gTrue); + setupExternalCIDTrueTypeFont(font, fontLoc->path, psName, true); break; default: break; @@ -2023,7 +2023,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { // scale substituted 8-bit fonts if (fontLoc->locType == gfxFontLocResident && fontLoc->substIdx >= 0) { - subst = gTrue; + subst = true; for (code = 0; code < 256; ++code) { if ((charName = ((Gfx8BitFont *)font)->getCharName(code)) && charName[0] == 'm' && charName[1] == '\0') { @@ -2045,7 +2045,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { // handle encodings for substituted CID fonts if (fontLoc->locType == gfxFontLocResident && fontLoc->fontType >= fontCIDType0) { - subst = gTrue; + subst = true; if (font16EncLen >= font16EncSize) { font16EncSize += 16; font16Enc = (PSFont16Enc *)greallocn(font16Enc, @@ -2116,8 +2116,8 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { long length1, length2, length3; int c, i; int start[4]; - GBool binMode; - GBool writePadding = gTrue; + bool binMode; + bool writePadding = true; // check if font is already embedded if (!fontNames.emplace(psName->toStr()).second) { @@ -2172,7 +2172,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { } // figure out if encrypted portion is binary or ASCII - binMode = gFalse; + binMode = false; for (i = 0; i < 4; ++i) { start[i] = strObj.streamGetChar(); if (start[i] == EOF) { @@ -2183,7 +2183,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { if (!((start[i] >= '0' && start[i] <= '9') || (start[i] >= 'A' && start[i] <= 'F') || (start[i] >= 'a' && start[i] <= 'f'))) - binMode = gTrue; + binMode = true; } if (length2 == 0) @@ -2193,7 +2193,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { // the stream data error(errSyntaxWarning, -1, "Font has length2 as 0, trying to overcome the problem reading the stream until the end"); length2 = INT_MAX; - writePadding = gFalse; + writePadding = false; } @@ -2397,7 +2397,7 @@ void PSOutputDev::setupEmbeddedType1CFont(GfxFont *font, Ref *id, // convert it to a Type 1 font if ((fontBuf = font->readEmbFontFile(xref, &fontLen))) { if ((ffT1C = FoFiType1C::make(fontBuf, fontLen))) { - ffT1C->convertToType1(psName->getCString(), nullptr, gTrue, + ffT1C->convertToType1(psName->getCString(), nullptr, true, outputFunc, outputStream); delete ffT1C; } @@ -2443,7 +2443,7 @@ void PSOutputDev::setupEmbeddedOpenTypeT1CFont(GfxFont *font, Ref *id, if ((fontBuf = font->readEmbFontFile(xref, &fontLen))) { if ((ffTT = FoFiTrueType::make(fontBuf, fontLen))) { if (ffTT->isOpenTypeCFF()) { - ffTT->convertToType1(psName->getCString(), nullptr, gTrue, + ffTT->convertToType1(psName->getCString(), nullptr, true, outputFunc, outputStream); } delete ffTT; @@ -2546,7 +2546,7 @@ void PSOutputDev::updateFontMaxValidGlyph(GfxFont *font, int maxValidGlyph) { void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font, GooString *fileName, GooString *psName, - GBool needVerticalMetrics) { + bool needVerticalMetrics) { FoFiTrueType *ffTT; int *codeToGID; int codeToGIDLen; @@ -2663,7 +2663,7 @@ void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, GooString *psName, - GBool needVerticalMetrics) { + bool needVerticalMetrics) { char *fontBuf; int fontLen; FoFiTrueType *ffTT; @@ -2774,9 +2774,9 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName, // set up resources used by font if ((resDict = ((Gfx8BitFont *)font)->getResources())) { - inType3Char = gTrue; + inType3Char = true; setupResources(resDict); - inType3Char = gFalse; + inType3Char = false; } else { resDict = parentResDict; } @@ -2815,11 +2815,11 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName, box.x2 = m[2]; box.y2 = m[3]; gfx = new Gfx(doc, this, resDict, &box, nullptr); - inType3Char = gTrue; + inType3Char = true; for (i = 0; i < charProcs->getLength(); ++i) { - t3FillColorOnly = gFalse; - t3Cacheable = gFalse; - t3NeedsRestore = gFalse; + t3FillColorOnly = false; + t3Cacheable = false; + t3NeedsRestore = false; writePS("/"); writePSName(charProcs->getKey(i)); writePS(" {\n"); @@ -2844,7 +2844,7 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName, } writePS("} def\n"); } - inType3Char = gFalse; + inType3Char = false; delete gfx; writePS("end\n"); } @@ -2923,11 +2923,11 @@ void PSOutputDev::setupImages(Dict *resDict) { imgIDs = (Ref *)greallocn(imgIDs, imgIDSize, sizeof(Ref)); } imgIDs[imgIDLen++] = imgID; - setupImage(imgID, xObj.getStream(), gFalse); + setupImage(imgID, xObj.getStream(), false); if (level >= psLevel3) { Object maskObj = xObj.streamGetDict()->lookup("Mask"); if (maskObj.isStream()) { - setupImage(imgID, maskObj.getStream(), gTrue); + setupImage(imgID, maskObj.getStream(), true); } } } @@ -2941,8 +2941,8 @@ void PSOutputDev::setupImages(Dict *resDict) { } } -void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) { - GBool useFlate, useLZW, useRLE, useCompressed, doUseASCIIHex; +void PSOutputDev::setupImage(Ref id, Stream *str, bool mask) { + bool useFlate, useLZW, useRLE, useCompressed, doUseASCIIHex; GooString *s; int c; int size, line, col, i; @@ -2952,27 +2952,27 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) { //~ this does not correctly handle the DeviceN color space //~ -- need to use DeviceNRecoder - useFlate = useLZW = useRLE = gFalse; - useCompressed = gFalse; - doUseASCIIHex = gFalse; + useFlate = useLZW = useRLE = false; + useCompressed = false; + doUseASCIIHex = false; if (level < psLevel2) { - doUseASCIIHex = gTrue; + doUseASCIIHex = true; } else { if (uncompressPreloadedImages) { /* nothing to do */; } else { s = str->getPSFilter(level < psLevel3 ? 2 : 3, ""); if (s) { - useCompressed = gTrue; + useCompressed = true; delete s; } else { if (level >= psLevel3 && getEnableFlate()) { - useFlate = gTrue; + useFlate = true; } else if (getEnableLZW()) { - useLZW = gTrue; + useLZW = true; } else { - useRLE = gTrue; + useRLE = true; } } } @@ -3205,19 +3205,19 @@ void PSOutputDev::setupForm(Ref id, Object *strObj) { writePS("} def\n"); } -GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, - int rotateA, GBool useMediaBox, GBool crop, +bool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, + int rotateA, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (*abortCheckCbk)(void *data), + bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), void *annotDisplayDecideCbkData) { PreScanOutputDev *scan; - GBool rasterize; + bool rasterize; #ifdef HAVE_SPLASH - GBool useFlate, useLZW; + bool useFlate, useLZW; SplashOutputDev *splashOut; SplashColor paperColor; PDFRectangle box; @@ -3233,14 +3233,14 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, int numComps, initialNumComps; char hexBuf[32*2 + 2]; // 32 values X 2 chars/value + line ending + null Guchar digit; - GBool isGray; + bool isGray; #endif if (!postInitDone) { postInit(); } if (forceRasterize) { - rasterize = gTrue; + rasterize = true; } else { scan = new PreScanOutputDev(doc); page->displaySlice(scan, 72, 72, rotateA, useMediaBox, crop, @@ -3251,7 +3251,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, delete scan; } if (!rasterize) { - return gTrue; + return true; } #ifdef HAVE_SPLASH @@ -3259,7 +3259,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, useFlate = getEnableFlate() && level >= psLevel3; useLZW = getEnableLZW(); // start the PS page - page->makeBox(rasterResolution, rasterResolution, rotateA, useMediaBox, gFalse, + page->makeBox(rasterResolution, rasterResolution, rotateA, useMediaBox, false, sliceX, sliceY, sliceW, sliceH, &box, &crop); rotateA += page->getRotate(); if (rotateA >= 360) { @@ -3267,7 +3267,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, } else if (rotateA < 0) { rotateA += 360; } - state = new GfxState(rasterResolution, rasterResolution, &box, rotateA, gFalse); + state = new GfxState(rasterResolution, rasterResolution, &box, rotateA, false); startPage(page->getNum(), state, xref); delete state; @@ -3275,21 +3275,21 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, if (rasterMono || level == psLevel1) { numComps = 1; paperColor[0] = 0xff; - splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse, - paperColor, gFalse); + splashOut = new SplashOutputDev(splashModeMono8, 1, false, + paperColor, false); #ifdef SPLASH_CMYK } else if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || globalParams->getOverprintPreview()) { numComps = 4; paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0; - splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse, - paperColor, gFalse); + splashOut = new SplashOutputDev(splashModeCMYK8, 1, false, + paperColor, false); #endif } else { numComps = 3; paperColor[0] = paperColor[1] = paperColor[2] = 0xff; - splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, - paperColor, gFalse); + splashOut = new SplashOutputDev(splashModeRGB8, 1, false, + paperColor, false); } splashOut->setFontAntialias(rasterAntialias); splashOut->setVectorAntialias(rasterAntialias); @@ -3312,7 +3312,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, (double)rasterizationSliceSize); if (unlikely(nStripes == 0)) { delete splashOut; - return gFalse; + return false; } stripeH = (sliceH + nStripes - 1) / nStripes; @@ -3321,7 +3321,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, for (stripeY = sliceY; stripeY < sliceH; stripeY += stripeH) { // rasterize a stripe - page->makeBox(hDPI2, vDPI2, 0, useMediaBox, gFalse, + page->makeBox(hDPI2, vDPI2, 0, useMediaBox, false, sliceX, stripeY, sliceW, stripeH, &box, &crop); m0 = box.x2 - box.x1; m1 = 0; @@ -3386,11 +3386,11 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, p = bitmap->getDataPtr(); // Check for an all gray image if (getOptimizeColorSpace()) { - isGray = gTrue; + isGray = true; for (y = 0; y < h; ++y) { for (x = 0; x < w; ++x) { if (p[4*x] != p[4*x + 1] || p[4*x] != p[4*x + 2]) { - isGray = gFalse; + isGray = false; y = h; break; } @@ -3398,7 +3398,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, p += bitmap->getRowSize(); } } else { - isGray = gFalse; + isGray = false; } writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1{5:s}{6:s}\n", w, h, w, -h, h, @@ -3545,30 +3545,30 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, str0 = new MemStream((char *)p, 0, w * h * numComps, Object(objNull)); // Check for a color image that uses only gray if (!getOptimizeColorSpace()) { - isGray = gFalse; + isGray = false; } else if (numComps == 4) { int compCyan; - isGray = gTrue; + isGray = true; while ((compCyan = str0->getChar()) != EOF) { if (str0->getChar() != compCyan || str0->getChar() != compCyan) { - isGray = gFalse; + isGray = false; break; } str0->getChar(); } } else if (numComps == 3) { int compRed; - isGray = gTrue; + isGray = true; while ((compRed = str0->getChar()) != EOF) { if (str0->getChar() != compRed || str0->getChar() != compRed) { - isGray = gFalse; + isGray = false; break; } } } else { - isGray = gFalse; + isGray = false; } str0->reset(); #ifdef ENABLE_ZLIB @@ -3679,14 +3679,14 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, // finish the PS page endPage(); - return gFalse; + return false; #else // HAVE_SPLASH error(errSyntaxWarning, -1, "PDF page uses transparency and PSOutputDev was built without" " the Splash rasterizer - output may not be correct"); - return gTrue; + return true; #endif // HAVE_SPLASH } @@ -3694,7 +3694,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { Page *page; int x1, y1, x2, y2, width, height, t; int imgWidth, imgHeight, imgWidth2, imgHeight2; - GBool landscape; + bool landscape; GooString *s; PSOutPaperSize *paperSize; @@ -3704,10 +3704,10 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { xref = xrefA; if (mode == psModePS) { GooString pageLabel; - const GBool gotLabel = doc->getCatalog()->indexToLabel(pageNum -1, &pageLabel); + const bool gotLabel = doc->getCatalog()->indexToLabel(pageNum -1, &pageLabel); if (gotLabel) { // See bug13338 for why we try to avoid parentheses... - GBool needParens; + bool needParens; GooString *filteredString = filterPSLabel(&pageLabel, &needParens); if (needParens) { writePSFmt("%%Page: ({0:t}) {1:d}\n", filteredString, seqPage); @@ -3761,27 +3761,27 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { // rotation and portrait/landscape mode if (paperMatch) { rotate = (360 - state->getRotate()) % 360; - landscape = gFalse; + landscape = false; } else if (rotate0 >= 0) { rotate = (360 - rotate0) % 360; - landscape = gFalse; + landscape = false; } else { rotate = (360 - state->getRotate()) % 360; if (rotate == 0 || rotate == 180) { if ((width < height && imgWidth > imgHeight && height > imgHeight) || (width > height && imgWidth < imgHeight && width > imgWidth)) { rotate += 90; - landscape = gTrue; + landscape = true; } else { - landscape = gFalse; + landscape = false; } } else { // rotate == 90 || rotate == 270 if ((height < width && imgWidth > imgHeight && width > imgHeight) || (height > width && imgWidth < imgHeight && height > imgWidth)) { rotate = 270 - rotate; - landscape = gTrue; + landscape = true; } else { - landscape = gFalse; + landscape = false; } } } @@ -4036,7 +4036,7 @@ void PSOutputDev::updateFillColorSpace(GfxState *state) { case psLevel2: case psLevel3: if (state->getFillColorSpace()->getMode() != csPattern) { - dumpColorSpaceL2(state->getFillColorSpace(), gTrue, gFalse, gFalse); + dumpColorSpaceL2(state->getFillColorSpace(), true, false, false); writePS(" cs\n"); } break; @@ -4057,7 +4057,7 @@ void PSOutputDev::updateStrokeColorSpace(GfxState *state) { case psLevel2: case psLevel3: if (state->getStrokeColorSpace()->getMode() != csPattern) { - dumpColorSpaceL2(state->getStrokeColorSpace(), gTrue, gFalse, gFalse); + dumpColorSpaceL2(state->getStrokeColorSpace(), true, false, false); writePS(" CS\n"); } break; @@ -4121,7 +4121,7 @@ void PSOutputDev::updateFillColor(GfxState *state) { } break; } - t3Cacheable = gFalse; + t3Cacheable = false; } void PSOutputDev::updateStrokeColor(GfxState *state) { @@ -4178,7 +4178,7 @@ void PSOutputDev::updateStrokeColor(GfxState *state) { } break; } - t3Cacheable = gFalse; + t3Cacheable = false; } void PSOutputDev::addProcessColor(double c, double m, double y, double k) { @@ -4307,7 +4307,7 @@ void PSOutputDev::updateRender(GfxState *state) { writePSFmt("{0:d} Tr\n", rm); rm &= 3; if (rm != 0 && rm != 3) { - t3Cacheable = gFalse; + t3Cacheable = false; } } @@ -4370,7 +4370,7 @@ void PSOutputDev::eoFill(GfxState *state) { writePS("f*\n"); } -GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str, +bool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -4407,7 +4407,7 @@ GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *st if (paintType == 2) { writePSFmt("{0:.6g} 0 {1:.6g} {2:.6g} {3:.6g} {4:.6g} setcachedevice\n", xStep, bbox[0], bbox[1], bbox[2], bbox[3]); - t3FillColorOnly = gTrue; + t3FillColorOnly = true; } else { if (x1 - 1 <= x0) { @@ -4415,11 +4415,11 @@ GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *st } else { writePSFmt("{0:.6g} 0 setcharwidth\n", xStep); } - t3FillColorOnly = gFalse; + t3FillColorOnly = false; } - inType3Char = gTrue; + inType3Char = true; if (paintType == 2) { - inUncoloredPattern = gTrue; + inUncoloredPattern = true; // ensure any PS procedures that contain sCol or fCol do not change the color writePS("/pdfLastFill true def\n"); writePS("/pdfLastStroke true def\n"); @@ -4428,12 +4428,12 @@ GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *st gfx->display(str); --numTilingPatterns; if (paintType == 2) { - inUncoloredPattern = gFalse; + inUncoloredPattern = false; // ensure the next PS procedures that uses sCol or fCol will update the color writePS("/pdfLastFill false def\n"); writePS("/pdfLastStroke false def\n"); } - inType3Char = gFalse; + inType3Char = false; writePS("} def\n"); delete gfx; writePS("end\n"); @@ -4449,10 +4449,10 @@ GBool PSOutputDev::tilingPatternFillL1(GfxState *state, Catalog *cat, Object *st y0, y1 - 1, x0 * xStep, yStep, x0, x1 - 1); writePS("grestore\n"); - return gTrue; + return true; } -GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str, +bool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -4476,21 +4476,21 @@ GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *st box.x2 = bbox[2]; box.y2 = bbox[3]; gfx = new Gfx(doc, this, resDict, &box, nullptr); - inType3Char = gTrue; + inType3Char = true; if (paintType == 2) { - inUncoloredPattern = gTrue; + inUncoloredPattern = true; // ensure any PS procedures that contain sCol or fCol do not change the color writePS("/pdfLastFill true def\n"); writePS("/pdfLastStroke true def\n"); } gfx->display(str); if (paintType == 2) { - inUncoloredPattern = gFalse; + inUncoloredPattern = false; // ensure the next PS procedures that uses sCol or fCol will update the color writePS("/pdfLastFill false def\n"); writePS("/pdfLastStroke false def\n"); } - inType3Char = gFalse; + inType3Char = false; delete gfx; writePS(" }\n"); writePS(">>\n"); @@ -4498,10 +4498,10 @@ GBool PSOutputDev::tilingPatternFillL2(GfxState *state, Catalog *cat, Object *st writePS("makepattern setpattern\n"); writePS("clippath fill\n"); // Gfx sets up a clip before calling out->tilingPatternFill() - return gTrue; + return true; } -GBool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, +bool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -4522,11 +4522,11 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, O box.y2 = bbox[3]; gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA); writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] cm\n", mat[0], mat[1], mat[2], mat[3], tx, ty); - inType3Char = gTrue; + inType3Char = true; gfx->display(str); - inType3Char = gFalse; + inType3Char = false; delete gfx; - return gTrue; + return true; } if (level == psLevel1 || level == psLevel1Sep) { @@ -4538,14 +4538,14 @@ GBool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, O } } -GBool PSOutputDev::functionShadedFill(GfxState *state, +bool PSOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { double x0, y0, x1, y1; int i; if (level == psLevel2Sep || level == psLevel3Sep) { if (shading->getColorSpace()->getMode() != csDeviceCMYK) { - return gFalse; + return false; } processColors |= psProcessCMYK; } @@ -4575,10 +4575,10 @@ GBool PSOutputDev::functionShadedFill(GfxState *state, } writePSFmt("{0:.6g} {1:.6g} {2:.6g} {3:.6g} 0 funcSH\n", x0, y0, x1, y1); - return gTrue; + return true; } -GBool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) { +bool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) { double xMin, yMin, xMax, yMax; double x0, y0, x1, y1, dx, dy, mul; double tMin, tMax, t, t0, t1; @@ -4586,7 +4586,7 @@ GBool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, do if (level == psLevel2Sep || level == psLevel3Sep) { if (shading->getColorSpace()->getMode() != csDeviceCMYK) { - return gFalse; + return false; } processColors |= psProcessCMYK; } @@ -4600,7 +4600,7 @@ GBool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, do dx = x1 - x0; dy = y1 - y0; if (fabs(dx) < 0.01 && fabs(dy) < 0.01) { - return gTrue; + return true; } else { mul = 1 / (dx * dx + dy * dy); tMin = tMax = ((xMin - x0) * dx + (yMin - y0) * dy) * mul; @@ -4669,24 +4669,24 @@ GBool PSOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, do } writePSFmt("{0:.6g} {1:.6g} 0 axialSH\n", tMin, tMax); - return gTrue; + return true; } -GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) { +bool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) { double xMin, yMin, xMax, yMax; double x0, y0, r0, x1, y1, r1, t0, t1; double xa, ya, ra; double sMin, sMax, h, ta; double sLeft, sRight, sTop, sBottom, sZero, sDiag; - GBool haveSLeft, haveSRight, haveSTop, haveSBottom, haveSZero; - GBool haveSMin, haveSMax; + bool haveSLeft, haveSRight, haveSTop, haveSBottom, haveSZero; + bool haveSMin, haveSMax; double theta, alpha, a1, a2; - GBool enclosed; + bool enclosed; int i; if (level == psLevel2Sep || level == psLevel3Sep) { if (shading->getColorSpace()->getMode() != csDeviceCMYK) { - return gFalse; + return false; } processColors |= psProcessCMYK; } @@ -4702,16 +4702,16 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, // circles case; and compute the angles for the tangent lines. h = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)); if (h == 0) { - enclosed = gTrue; + enclosed = true; theta = 0; // make gcc happy } else if (r1 - r0 == 0) { - enclosed = gFalse; + enclosed = false; theta = 0; } else if (fabs(r1 - r0) >= h) { - enclosed = gTrue; + enclosed = true; theta = 0; // make gcc happy } else { - enclosed = gFalse; + enclosed = false; theta = asin((r1 - r0) / h); } if (enclosed) { @@ -4772,23 +4772,23 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, // compute sMin if (shading->getExtend0()) { sMin = 0; - haveSMin = gFalse; + haveSMin = false; if (x0 < x1 && haveSLeft && sLeft < 0) { sMin = sLeft; - haveSMin = gTrue; + haveSMin = true; } else if (x0 > x1 && haveSRight && sRight < 0) { sMin = sRight; - haveSMin = gTrue; + haveSMin = true; } if (y0 < y1 && haveSBottom && sBottom < 0) { if (!haveSMin || sBottom > sMin) { sMin = sBottom; - haveSMin = gTrue; + haveSMin = true; } } else if (y0 > y1 && haveSTop && sTop < 0) { if (!haveSMin || sTop > sMin) { sMin = sTop; - haveSMin = gTrue; + haveSMin = true; } } if (haveSZero && sZero < 0) { @@ -4802,23 +4802,23 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, // compute sMax if (shading->getExtend1()) { sMax = 1; - haveSMax = gFalse; + haveSMax = false; if (x1 < x0 && haveSLeft && sLeft > 1) { sMax = sLeft; - haveSMax = gTrue; + haveSMax = true; } else if (x1 > x0 && haveSRight && sRight > 1) { sMax = sRight; - haveSMax = gTrue; + haveSMax = true; } if (y1 < y0 && haveSBottom && sBottom > 1) { if (!haveSMax || sBottom < sMax) { sMax = sBottom; - haveSMax = gTrue; + haveSMax = true; } } else if (y1 > y0 && haveSTop && sTop > 1) { if (!haveSMax || sTop < sMax) { sMax = sTop; - haveSMax = gTrue; + haveSMax = true; } } if (haveSZero && sDiag > 1) { @@ -4917,14 +4917,14 @@ GBool PSOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, } } - return gTrue; + return true; } -GBool PSOutputDev::patchMeshShadedFill(GfxState *state, +bool PSOutputDev::patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) { // TODO: support parametrized shading if (level < psLevel3 || shading->isParameterized()) { - return gFalse; + return false; } writePS("%% Begin patchMeshShadedFill\n"); @@ -4935,7 +4935,7 @@ GBool PSOutputDev::patchMeshShadedFill(GfxState *state, writePS("<<\n"); writePS(" /ShadingType 7\n"); writePS(" /ColorSpace "); - dumpColorSpaceL2(shading->getColorSpace(), gFalse, gFalse, gFalse); + dumpColorSpaceL2(shading->getColorSpace(), false, false, false); writePS("\n"); writePS(" /DataSource [\n"); @@ -4971,7 +4971,7 @@ GBool PSOutputDev::patchMeshShadedFill(GfxState *state, writePS(">> shfill\n"); writePS("%% End patchMeshShadedFill\n"); - return gTrue; + return true; } void PSOutputDev::clip(GfxState *state) { @@ -5063,7 +5063,7 @@ void PSOutputDev::drawString(GfxState *state, const GooString *s) { CharCode maxGlyph; // for pdftohtml, output PS without text - if( displayText == gFalse ) + if( displayText == false ) return; // check for invisible text -- this is used by Acrobat Capture @@ -5206,7 +5206,7 @@ void PSOutputDev::drawString(GfxState *state, const GooString *s) { delete s2; if (state->getRender() & 4) { - haveTextClip = gTrue; + haveTextClip = true; } } @@ -5216,13 +5216,13 @@ void PSOutputDev::beginTextObject(GfxState *state) { void PSOutputDev::endTextObject(GfxState *state) { if (haveTextClip) { writePS("Tclip\n"); - haveTextClip = gFalse; + haveTextClip = false; } } void PSOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { int len; len = height * ((width + 7) / 8); @@ -5230,24 +5230,24 @@ void PSOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, case psLevel1: case psLevel1Sep: doImageL1(ref, nullptr, invert, inlineImg, str, width, height, len, - nullptr, nullptr, 0, 0, gFalse); + nullptr, nullptr, 0, 0, false); break; case psLevel2: case psLevel2Sep: doImageL2(ref, nullptr, invert, inlineImg, str, width, height, len, - nullptr, nullptr, 0, 0, gFalse); + nullptr, nullptr, 0, 0, false); break; case psLevel3: case psLevel3Sep: doImageL3(ref, nullptr, invert, inlineImg, str, width, height, len, - nullptr, nullptr, 0, 0, gFalse); + nullptr, nullptr, 0, 0, false); break; } } void PSOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) { + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) { if (level != psLevel1 && level != psLevel1Sep) { maskToClippingPath(str, width, height, invert); } @@ -5261,75 +5261,75 @@ void PSOutputDev::unsetSoftMaskFromImageMask(GfxState * state, double *baseMatri void PSOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) { + bool interpolate, int *maskColors, bool inlineImg) { int len; len = height * ((width * colorMap->getNumPixelComps() * colorMap->getBits() + 7) / 8); switch (level) { case psLevel1: - doImageL1(ref, colorMap, gFalse, inlineImg, str, - width, height, len, maskColors, nullptr, 0, 0, gFalse); + doImageL1(ref, colorMap, false, inlineImg, str, + width, height, len, maskColors, nullptr, 0, 0, false); break; case psLevel1Sep: //~ handle indexed, separation, ... color spaces - doImageL1Sep(ref, colorMap, gFalse, inlineImg, str, - width, height, len, maskColors, nullptr, 0, 0, gFalse); + doImageL1Sep(ref, colorMap, false, inlineImg, str, + width, height, len, maskColors, nullptr, 0, 0, false); break; case psLevel2: case psLevel2Sep: - doImageL2(ref, colorMap, gFalse, inlineImg, str, - width, height, len, maskColors, nullptr, 0, 0, gFalse); + doImageL2(ref, colorMap, false, inlineImg, str, + width, height, len, maskColors, nullptr, 0, 0, false); break; case psLevel3: case psLevel3Sep: - doImageL3(ref, colorMap, gFalse, inlineImg, str, - width, height, len, maskColors, nullptr, 0, 0, gFalse); + doImageL3(ref, colorMap, false, inlineImg, str, + width, height, len, maskColors, nullptr, 0, 0, false); break; } - t3Cacheable = gFalse; + t3Cacheable = false; } void PSOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) { + bool maskInvert, bool maskInterpolate) { int len; len = height * ((width * colorMap->getNumPixelComps() * colorMap->getBits() + 7) / 8); switch (level) { case psLevel1: - doImageL1(ref, colorMap, gFalse, gFalse, str, width, height, len, + doImageL1(ref, colorMap, false, false, str, width, height, len, nullptr, maskStr, maskWidth, maskHeight, maskInvert); break; case psLevel1Sep: //~ handle indexed, separation, ... color spaces - doImageL1Sep(ref, colorMap, gFalse, gFalse, str, width, height, len, + doImageL1Sep(ref, colorMap, false, false, str, width, height, len, nullptr, maskStr, maskWidth, maskHeight, maskInvert); break; case psLevel2: case psLevel2Sep: - doImageL2(ref, colorMap, gFalse, gFalse, str, width, height, len, + doImageL2(ref, colorMap, false, false, str, width, height, len, nullptr, maskStr, maskWidth, maskHeight, maskInvert); break; case psLevel3: case psLevel3Sep: - doImageL3(ref, colorMap, gFalse, gFalse, str, width, height, len, + doImageL3(ref, colorMap, false, false, str, width, height, len, nullptr, maskStr, maskWidth, maskHeight, maskInvert); break; } - t3Cacheable = gFalse; + t3Cacheable = false; } void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert) { + int maskWidth, int maskHeight, bool maskInvert) { ImageStream *imgStr; Guchar pixBuf[gfxColorMaxComps]; GfxGray gray; @@ -5374,7 +5374,7 @@ void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap, delete str; } else { // make sure the image is setup, it sometimes is not like on bug #17645 - setupImage(ref->getRef(), str, gFalse); + setupImage(ref->getRef(), str, false); // set up to use the array already created by setupImages() writePSFmt("ImData_{0:d}_{1:d} 0 0\n", ref->getRefNum(), ref->getRefGen()); } @@ -5482,16 +5482,16 @@ void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap, } void PSOutputDev::doImageL1Sep(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert) { + int maskWidth, int maskHeight, bool maskInvert) { ImageStream *imgStr; Guchar *lineBuf; Guchar pixBuf[gfxColorMaxComps]; GfxCMYK cmyk; int x, y, i, comp; - GBool checkProcessColor; + bool checkProcessColor; char hexBuf[32*2 + 2]; // 32 values X 2 chars/value + line ending + null Guchar digit; @@ -5515,7 +5515,7 @@ void PSOutputDev::doImageL1Sep(Object *ref, GfxImageColorMap *colorMap, imgStr->reset(); // process the data stream - checkProcessColor = gTrue; + checkProcessColor = true; i = 0; for (y = 0; y < height; ++y) { @@ -5589,12 +5589,12 @@ void PSOutputDev::doImageL1Sep(Object *ref, GfxImageColorMap *colorMap, } } -void PSOutputDev::maskToClippingPath(Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert) { +void PSOutputDev::maskToClippingPath(Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert) { ImageStream *imgStr; Guchar *line; PSOutImgClipRect *rects0, *rects1, *rectsTmp, *rectsOut; int rects0Len, rects1Len, rectsSize, rectsOutLen, rectsOutSize; - GBool emitRect, addRect, extendRect; + bool emitRect, addRect, extendRect; int i, x0, x1, y, maskXor; imgStr = new ImageStream(maskStr, maskWidth, 1, 1); @@ -5614,19 +5614,19 @@ void PSOutputDev::maskToClippingPath(Stream *maskStr, int maskWidth, int maskHei for (x0 = 0; x0 < maskWidth && (line[x0] ^ maskXor); ++x0) ; for (x1 = x0; x1 < maskWidth && !(line[x1] ^ maskXor); ++x1) ; while (x0 < maskWidth || i < rects0Len) { - emitRect = addRect = extendRect = gFalse; + emitRect = addRect = extendRect = false; if (x0 >= maskWidth) { - emitRect = gTrue; + emitRect = true; } else if (i >= rects0Len) { - addRect = gTrue; + addRect = true; } else if (rects0[i].x0 < x0) { - emitRect = gTrue; + emitRect = true; } else if (x0 < rects0[i].x0) { - addRect = gTrue; + addRect = true; } else if (rects0[i].x1 == x1) { - extendRect = gTrue; + extendRect = true; } else { - emitRect = addRect = gTrue; + emitRect = addRect = true; } if (emitRect) { if (rectsOutLen == rectsOutSize) { @@ -5708,19 +5708,19 @@ void PSOutputDev::maskToClippingPath(Stream *maskStr, int maskWidth, int maskHei } void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert) { + int maskWidth, int maskHeight, bool maskInvert) { Stream *str2; ImageStream *imgStr; Guchar *line; PSOutImgClipRect *rects0, *rects1, *rectsTmp, *rectsOut; int rects0Len, rects1Len, rectsSize, rectsOutLen, rectsOutSize; - GBool emitRect, addRect, extendRect; + bool emitRect, addRect, extendRect; GooString *s; int n, numComps; - GBool useLZW, useRLE, useASCII, useCompressed; + bool useLZW, useRLE, useASCII, useCompressed; GfxSeparationColorSpace *sepCS; GfxColor color; GfxCMYK cmyk; @@ -5772,19 +5772,19 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, } } while (x0 < width || i < rects0Len) { - emitRect = addRect = extendRect = gFalse; + emitRect = addRect = extendRect = false; if (x0 >= width) { - emitRect = gTrue; + emitRect = true; } else if (i >= rects0Len) { - addRect = gTrue; + addRect = true; } else if (rects0[i].x0 < x0) { - emitRect = gTrue; + emitRect = true; } else if (x0 < rects0[i].x0) { - addRect = gTrue; + addRect = true; } else if (rects0[i].x1 == x1) { - extendRect = gTrue; + extendRect = true; } else { - emitRect = addRect = gTrue; + emitRect = addRect = true; } if (emitRect) { if (rectsOutLen == rectsOutSize) { @@ -5896,10 +5896,10 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, // color space if (colorMap) { // Do not update the process color list for custom colors - GBool isCustomColor = + bool isCustomColor = (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) && colorMap->getColorSpace()->getMode() == csDeviceN; - dumpColorSpaceL2(colorMap->getColorSpace(), gFalse, !isCustomColor, gFalse); + dumpColorSpaceL2(colorMap->getColorSpace(), false, !isCustomColor, false); writePS(" setcolorspace\n"); } @@ -5963,7 +5963,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, delete str2; } else { // make sure the image is setup, it sometimes is not like on bug #17645 - setupImage(ref->getRef(), str, gFalse); + setupImage(ref->getRef(), str, false); // set up to use the array already created by setupImages() writePSFmt("ImData_{0:d}_{1:d} 0 0\n",ref->getRefNum(), ref->getRefGen()); } @@ -6033,28 +6033,28 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, if ((mode == psModeForm || inType3Char || preloadImagesForms) && uncompressPreloadedImages) { s = nullptr; - useLZW = useRLE = gFalse; - useCompressed = gFalse; - useASCII = gFalse; + useLZW = useRLE = false; + useCompressed = false; + useASCII = false; } else { s = str->getPSFilter(level < psLevel2 ? 1 : level < psLevel3 ? 2 : 3, " "); if ((colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) || inlineImg || !s) { if (getEnableLZW()) { - useLZW = gTrue; - useRLE = gFalse; + useLZW = true; + useRLE = false; } else { - useRLE = gTrue; - useLZW = gFalse; + useRLE = true; + useLZW = false; } useASCII = !(mode == psModeForm || inType3Char || preloadImagesForms); - useCompressed = gFalse; + useCompressed = false; } else { - useLZW = useRLE = gFalse; + useLZW = useRLE = false; useASCII = str->isBinary() && !(mode == psModeForm || inType3Char || preloadImagesForms); - useCompressed = gTrue; + useCompressed = true; } } if (useASCII) { @@ -6188,15 +6188,15 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, //~ this doesn't currently support OPI void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert) { + int maskWidth, int maskHeight, bool maskInvert) { Stream *str2; GooString *s; int n, numComps; - GBool useFlate, useLZW, useRLE, useASCII, useCompressed; - GBool maskUseFlate, maskUseLZW, maskUseRLE, maskUseASCII, maskUseCompressed; + bool useFlate, useLZW, useRLE, useASCII, useCompressed; + bool maskUseFlate, maskUseLZW, maskUseRLE, maskUseASCII, maskUseCompressed; GooString *maskFilters; GfxSeparationColorSpace *sepCS; GfxColor color; @@ -6204,8 +6204,8 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, int c; int col, i; - useFlate = useLZW = useRLE = useASCII = useCompressed = gFalse; - maskUseFlate = maskUseLZW = maskUseRLE = maskUseASCII = maskUseCompressed = gFalse; + useFlate = useLZW = useRLE = useASCII = useCompressed = false; + maskUseFlate = maskUseLZW = maskUseRLE = maskUseASCII = maskUseCompressed = false; maskFilters = nullptr; // make gcc happy // explicit masking @@ -6219,17 +6219,17 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, s = maskStr->getPSFilter(3, " "); if (!s) { if (getEnableFlate()) { - maskUseFlate = gTrue; + maskUseFlate = true; } else if (getEnableLZW()) { - maskUseLZW = gTrue; + maskUseLZW = true; } else { - maskUseRLE = gTrue; + maskUseRLE = true; } maskUseASCII = !(mode == psModeForm || inType3Char || preloadImagesForms); } else { maskUseASCII = maskStr->isBinary() && !(mode == psModeForm || inType3Char || preloadImagesForms); - maskUseCompressed = gTrue; + maskUseCompressed = true; } } maskFilters = new GooString(); @@ -6299,10 +6299,10 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, // color space if (colorMap) { // Do not update the process color list for custom colors - GBool isCustomColor = + bool isCustomColor = (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) && colorMap->getColorSpace()->getMode() == csDeviceN; - dumpColorSpaceL2(colorMap->getColorSpace(), gFalse, !isCustomColor, gFalse); + dumpColorSpaceL2(colorMap->getColorSpace(), false, !isCustomColor, false); writePS(" setcolorspace\n"); } @@ -6371,7 +6371,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, delete str2; } else { // make sure the image is setup, it sometimes is not like on bug #17645 - setupImage(ref->getRef(), str, gFalse); + setupImage(ref->getRef(), str, false); // set up to use the array already created by setupImages() writePSFmt("ImData_{0:d}_{1:d} 0 0\n", ref->getRefNum(), ref->getRefGen()); } @@ -6447,9 +6447,9 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, // filters - useFlate = useLZW = useRLE = gFalse; - useCompressed = gFalse; - useASCII = gFalse; + useFlate = useLZW = useRLE = false; + useCompressed = false; + useASCII = false; if ((mode == psModeForm || inType3Char || preloadImagesForms) && uncompressPreloadedImages) { @@ -6460,17 +6460,17 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, if ((colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) || inlineImg || !s) { if (getEnableFlate()) { - useFlate = gTrue; + useFlate = true; } else if (getEnableLZW()) { - useLZW = gTrue; + useLZW = true; } else { - useRLE = gTrue; + useRLE = true; } useASCII = !(mode == psModeForm || inType3Char || preloadImagesForms); } else { useASCII = str->isBinary() && !(mode == psModeForm || inType3Char || preloadImagesForms); - useCompressed = gTrue; + useCompressed = true; } } if (useASCII) { @@ -6602,8 +6602,8 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, } void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace, - GBool genXform, GBool updateColors, - GBool map01) { + bool genXform, bool updateColors, + bool map01) { GfxCalGrayColorSpace *calGrayCS; GfxCalRGBColorSpace *calRGBCS; GfxLabColorSpace *labCS; @@ -6746,14 +6746,14 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace, // there is no transform function to the alternate color space, so // we can use it directly dumpColorSpaceL2(((GfxICCBasedColorSpace *)colorSpace)->getAlt(), - genXform, updateColors, gFalse); + genXform, updateColors, false); break; case csIndexed: indexedCS = (GfxIndexedColorSpace *)colorSpace; baseCS = indexedCS->getBase(); writePS("[/Indexed "); - dumpColorSpaceL2(baseCS, gFalse, gFalse, gTrue); + dumpColorSpaceL2(baseCS, false, false, true); n = indexedCS->getIndexHigh(); numComps = baseCS->getNComps(); lookup = indexedCS->getLookup(); @@ -6828,7 +6828,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace, writePS("[/Separation "); writePSString(separationCS->getName()); writePS(" "); - dumpColorSpaceL2(separationCS->getAlt(), gFalse, gFalse, gFalse); + dumpColorSpaceL2(separationCS->getAlt(), false, false, false); writePS("\n"); cvtFunction(separationCS->getFunc()); writePS("]"); @@ -6850,7 +6850,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace, writePS(" "); } writePS("]\n"); - dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, gFalse); + dumpColorSpaceL2(deviceNCS->getAlt(), false, updateColors, false); writePS("\n"); cvtFunction(deviceNCS->getTintTransformFunc(), map01 && deviceNCS->getAlt()->getMode() == csLab); writePS("]\n"); @@ -6859,7 +6859,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace, } } else { // DeviceN color spaces are a Level 3 PostScript feature. - dumpColorSpaceL2(deviceNCS->getAlt(), gFalse, updateColors, map01); + dumpColorSpaceL2(deviceNCS->getAlt(), false, updateColors, map01); if (genXform) { writePS(" "); cvtFunction(deviceNCS->getTintTransformFunc()); @@ -7199,7 +7199,7 @@ void PSOutputDev::opiEnd(GfxState *state, Dict *opiDict) { void PSOutputDev::type3D0(GfxState *state, double wx, double wy) { writePSFmt("{0:.6g} {1:.6g} setcharwidth\n", wx, wy); writePS("q\n"); - t3NeedsRestore = gTrue; + t3NeedsRestore = true; } void PSOutputDev::type3D1(GfxState *state, double wx, double wy, @@ -7212,9 +7212,9 @@ void PSOutputDev::type3D1(GfxState *state, double wx, double wy, t3URY = ury; t3String = new GooString(); writePS("q\n"); - t3FillColorOnly = gTrue; - t3Cacheable = gTrue; - t3NeedsRestore = gTrue; + t3FillColorOnly = true; + t3Cacheable = true; + t3NeedsRestore = true; } void PSOutputDev::drawForm(Ref id) { @@ -7239,7 +7239,7 @@ void PSOutputDev::psXObject(Stream *psStream, Stream *level1Stream) { //~ can nextFunc be reset to 0 -- maybe at the start of each page? //~ or maybe at the start of each color space / pattern? -void PSOutputDev::cvtFunction(const Function *func, GBool invertPSFunction) { +void PSOutputDev::cvtFunction(const Function *func, bool invertPSFunction) { const SampledFunction *func0; const ExponentialFunction *func2; const StitchingFunction *func3; @@ -7552,9 +7552,9 @@ GooString *PSOutputDev::filterPSName(const GooString *name) { // Convert GooString to GooString, with appropriate escaping // of things that can't appear in a label // This is heavily based on the writePSTextLine() method -GooString* PSOutputDev::filterPSLabel(GooString *label, GBool *needParens) { +GooString* PSOutputDev::filterPSLabel(GooString *label, bool *needParens) { int i, step; - GBool isNumeric; + bool isNumeric; // - DSC comments must be printable ASCII; control chars and // backslashes have to be escaped (we do cheap UCS2-to-ASCII diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index 8a452b62..0e8b911a 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -100,12 +100,12 @@ public: char *psTitleA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, - GBool noCrop = gFalse, - GBool duplexA = gTrue, + bool noCrop = false, + bool duplexA = true, int imgLLXA = 0, int imgLLYA = 0, int imgURXA = 0, int imgURYA = 0, - GBool forceRasterizeA = gFalse, - GBool manualCtrlA = gFalse, + bool forceRasterizeA = false, + bool manualCtrlA = false, PSOutCustomCodeCbk customCodeCbkA = nullptr, void *customCodeCbkDataA = nullptr); @@ -116,12 +116,12 @@ public: PDFDoc *docA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, - GBool noCrop = gFalse, - GBool duplexA = gTrue, + bool noCrop = false, + bool duplexA = true, int imgLLXA = 0, int imgLLYA = 0, int imgURXA = 0, int imgURYA = 0, - GBool forceRasterizeA = gFalse, - GBool manualCtrlA = gFalse, + bool forceRasterizeA = false, + bool manualCtrlA = false, PSOutCustomCodeCbk customCodeCbkA = nullptr, void *customCodeCbkDataA = nullptr); @@ -129,37 +129,37 @@ public: virtual ~PSOutputDev(); // Check if file was successfully created. - virtual GBool isOk() { return ok; } + virtual bool isOk() { return ok; } //---- get info about output device // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gFalse; } + bool upsideDown() override { return false; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gFalse; } + bool useDrawChar() override { return false; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. - GBool useShadedFills(int type) override + bool useShadedFills(int type) override { return (type < 4 && level >= psLevel2) || (type == 7 && level >= psLevel3); } // Does this device use drawForm()? If this returns false, // form-type XObjects will be interpreted (i.e., unrolled). - GBool useDrawForm() override { return preloadImagesForms; } + bool useDrawForm() override { return preloadImagesForms; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } - GBool needClipToCropBox() override { return mode == psModeEPS; } + bool needClipToCropBox() override { return mode == psModeEPS; } //----- header/trailer (used only if manualCtrl is true) @@ -183,13 +183,13 @@ public: // returns false, the page display is aborted. Typically, an // OutputDev will use some alternate means to display the page // before returning false. - GBool checkPageSlice(Page *page, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + bool checkPageSlice(Page *page, double hDPI, double vDPI, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (*abortCheckCbk)(void *data) = nullptr, + bool printing, + bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr) override; // Start a page. @@ -237,16 +237,16 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) override; - GBool functionShadedFill(GfxState *state, + bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; - GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) override; - GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) override; - GBool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) override; + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) override; + bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override; //----- path clipping void clip(GfxState *state) override; @@ -260,22 +260,22 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) override; + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) override; void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; #ifdef OPI_SUPPORT //----- OPI functions @@ -309,41 +309,41 @@ public: void setOverlayCbk(void (*cbk)(PSOutputDev *psOut, void *data), void *data) { overlayCbk = cbk; overlayCbkData = data; } - void setDisplayText(GBool display) { displayText = display; } + void setDisplayText(bool display) { displayText = display; } - void setPSCenter(GBool center) { psCenter = center; } - void setRasterAntialias(GBool a) { rasterAntialias = a; } + void setPSCenter(bool center) { psCenter = center; } + void setRasterAntialias(bool a) { rasterAntialias = a; } void setRasterResolution(double r) { rasterResolution = r; } - void setRasterMono(GBool b) { rasterMono = b; } - void setUncompressPreloadedImages(GBool b) { uncompressPreloadedImages = b; } - - GBool getEmbedType1() const { return embedType1; } - GBool getEmbedTrueType() const { return embedTrueType; } - GBool getEmbedCIDPostScript() const { return embedCIDPostScript; } - GBool getEmbedCIDTrueType() const { return embedCIDTrueType; } - GBool getFontPassthrough() const { return fontPassthrough; } - GBool getOptimizeColorSpace() const { return optimizeColorSpace; } - GBool getPassLevel1CustomColor() const { return passLevel1CustomColor; } - GBool getEnableLZW() const { return enableLZW; }; - GBool getEnableFlate() const + void setRasterMono(bool b) { rasterMono = b; } + void setUncompressPreloadedImages(bool b) { uncompressPreloadedImages = b; } + + bool getEmbedType1() const { return embedType1; } + bool getEmbedTrueType() const { return embedTrueType; } + bool getEmbedCIDPostScript() const { return embedCIDPostScript; } + bool getEmbedCIDTrueType() const { return embedCIDTrueType; } + bool getFontPassthrough() const { return fontPassthrough; } + bool getOptimizeColorSpace() const { return optimizeColorSpace; } + bool getPassLevel1CustomColor() const { return passLevel1CustomColor; } + bool getEnableLZW() const { return enableLZW; }; + bool getEnableFlate() const #ifdef ENABLE_ZLIB { return enableFlate; } #else - { return gFalse; } + { return false; } #endif - void setEmbedType1(GBool b) { embedType1 = b; } - void setEmbedTrueType(GBool b) { embedTrueType = b; } - void setEmbedCIDPostScript(GBool b) { embedCIDPostScript = b; } - void setEmbedCIDTrueType(GBool b) { embedCIDTrueType = b; } - void setFontPassthrough(GBool b) { fontPassthrough = b; } - void setOptimizeColorSpace(GBool b) { optimizeColorSpace = b; } - void setPassLevel1CustomColor(GBool b) { passLevel1CustomColor = b; } - void setPreloadImagesForms(GBool b) { preloadImagesForms = b; } - void setGenerateOPI(GBool b) { generateOPI = b; } - void setUseASCIIHex(GBool b) { useASCIIHex = b; } - void setUseBinary(GBool b) { useBinary = b; } - void setEnableLZW(GBool b) { enableLZW = b; } - void setEnableFlate(GBool b) { enableFlate = b; } + void setEmbedType1(bool b) { embedType1 = b; } + void setEmbedTrueType(bool b) { embedTrueType = b; } + void setEmbedCIDPostScript(bool b) { embedCIDPostScript = b; } + void setEmbedCIDTrueType(bool b) { embedCIDTrueType = b; } + void setFontPassthrough(bool b) { fontPassthrough = b; } + void setOptimizeColorSpace(bool b) { optimizeColorSpace = b; } + void setPassLevel1CustomColor(bool b) { passLevel1CustomColor = b; } + void setPreloadImagesForms(bool b) { preloadImagesForms = b; } + void setGenerateOPI(bool b) { generateOPI = b; } + void setUseASCIIHex(bool b) { useASCIIHex = b; } + void setUseBinary(bool b) { useBinary = b; } + void setEnableLZW(bool b) { enableLZW = b; } + void setEnableFlate(bool b) { enableFlate = b; } private: @@ -351,8 +351,8 @@ private: PSFileType fileTypeA, char *psTitleA, PDFDoc *doc, const std::vector<int> &pages, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, - GBool manualCtrlA, int paperWidthA, int paperHeightA, - GBool noCropA, GBool duplexA); + bool manualCtrlA, int paperWidthA, int paperHeightA, + bool noCropA, bool duplexA); void postInit(); void setupResources(Dict *resDict); void setupFonts(Dict *resDict); @@ -367,51 +367,51 @@ private: GooString *psName); void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, GooString *psName); void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, GooString *psName, - GBool needVerticalMetrics); + bool needVerticalMetrics); void setupExternalCIDTrueTypeFont(GfxFont *font, GooString *fileName, GooString *psName, - GBool needVerticalMetrics); + bool needVerticalMetrics); void setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id, GooString *psName); void setupType3Font(GfxFont *font, GooString *psName, Dict *parentResDict); GooString *makePSFontName(GfxFont *font, const Ref *id); void setupImages(Dict *resDict); - void setupImage(Ref id, Stream *str, GBool mask); + void setupImage(Ref id, Stream *str, bool mask); void setupForms(Dict *resDict); void setupForm(Ref id, Object *strObj); void addProcessColor(double c, double m, double y, double k); void addCustomColor(GfxSeparationColorSpace *sepCS); void doPath(GfxPath *path); - void maskToClippingPath(Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert); + void maskToClippingPath(Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert); void doImageL1(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert); + int maskWidth, int maskHeight, bool maskInvert); void doImageL1Sep(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert); + int maskWidth, int maskHeight, bool maskInvert); void doImageL2(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert); + int maskWidth, int maskHeight, bool maskInvert); void doImageL3(Object *ref, GfxImageColorMap *colorMap, - GBool invert, GBool inlineImg, + bool invert, bool inlineImg, Stream *str, int width, int height, int len, int *maskColors, Stream *maskStr, - int maskWidth, int maskHeight, GBool maskInvert); + int maskWidth, int maskHeight, bool maskInvert); void dumpColorSpaceL2(GfxColorSpace *colorSpace, - GBool genXform, GBool updateColors, - GBool map01); - GBool tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str, + bool genXform, bool updateColors, + bool map01); + bool tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep); - GBool tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str, + bool tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -423,11 +423,11 @@ private: void opiTransform(GfxState *state, double x0, double y0, double *x1, double *y1); #endif - void cvtFunction(const Function *func, GBool invertPSFunction = gFalse); + void cvtFunction(const Function *func, bool invertPSFunction = false); GooString *filterPSName(const GooString *name); // Write the document-level setup. - void writeDocSetup(PDFDoc *doc, Catalog *catalog, const std::vector<int> &pages, GBool duplexA); + void writeDocSetup(PDFDoc *doc, Catalog *catalog, const std::vector<int> &pages, bool duplexA); void writePSChar(char c); void writePS(const char *s); @@ -435,30 +435,30 @@ private: void writePSFmt(const char *fmt, ...); void writePSString(const GooString *s); void writePSName(const char *s); - GooString *filterPSLabel(GooString *label, GBool *needParens=nullptr); + GooString *filterPSLabel(GooString *label, bool *needParens=nullptr); void writePSTextLine(const GooString *s); PSLevel level; // PostScript level (1, 2, separation) PSOutMode mode; // PostScript mode (PS, EPS, form) int paperWidth; // width of paper, in pts int paperHeight; // height of paper, in pts - GBool paperMatch; // true if paper size is set to match each page + bool paperMatch; // true if paper size is set to match each page int prevWidth; // width of previous page // (only psModePSOrigPageSizes output mode) int prevHeight; // height of previous page // (only psModePSOrigPageSizes output mode) int imgLLX, imgLLY, // imageable area, in pts imgURX, imgURY; - GBool noCrop; - GBool duplex; + bool noCrop; + bool duplex; std::vector<int> pages; char *psTitle; - GBool postInitDone; // true if postInit() was called + bool postInitDone; // true if postInit() was called PSOutputFunc outputFunc; void *outputStream; PSFileType fileType; // file / pipe / stdout - GBool manualCtrl; + bool manualCtrl; int seqPage; // current sequential page number void (*underlayCbk)(PSOutputDev *psOut, void *data); void *underlayCbkData; @@ -517,50 +517,50 @@ private: PSOutCustomColor // used custom colors *customColors; - GBool haveTextClip; // set if text has been drawn with a + bool haveTextClip; // set if text has been drawn with a // clipping render mode - GBool inType3Char; // inside a Type 3 CharProc - GBool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) + bool inType3Char; // inside a Type 3 CharProc + bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2) GooString *t3String; // Type 3 content string double t3WX, t3WY, // Type 3 character parameters t3LLX, t3LLY, t3URX, t3URY; - GBool t3FillColorOnly; // operators should only use the fill color - GBool t3Cacheable; // cleared if char is not cacheable - GBool t3NeedsRestore; // set if a 'q' operator was issued - GBool forceRasterize; // forces the page to be rasterized into a image before printing - GBool displayText; // displayText - GBool psCenter; // center pages on the paper - GBool rasterAntialias; // antialias on rasterize - GBool uncompressPreloadedImages; + bool t3FillColorOnly; // operators should only use the fill color + bool t3Cacheable; // cleared if char is not cacheable + bool t3NeedsRestore; // set if a 'q' operator was issued + bool forceRasterize; // forces the page to be rasterized into a image before printing + bool displayText; // displayText + bool psCenter; // center pages on the paper + bool rasterAntialias; // antialias on rasterize + bool uncompressPreloadedImages; double rasterResolution; // PostScript rasterization resolution (dpi) - GBool rasterMono; // true to do PostScript rasterization + bool rasterMono; // true to do PostScript rasterization // in monochrome (gray); false to do it // in color (RGB/CMYK) - GBool embedType1; // embed Type 1 fonts? - GBool embedTrueType; // embed TrueType fonts? - GBool embedCIDPostScript; // embed CID PostScript fonts? - GBool embedCIDTrueType; // embed CID TrueType fonts? - GBool fontPassthrough; // pass all fonts through as-is? - GBool optimizeColorSpace; // false to keep gray RGB images in their original color space + bool embedType1; // embed Type 1 fonts? + bool embedTrueType; // embed TrueType fonts? + bool embedCIDPostScript; // embed CID PostScript fonts? + bool embedCIDTrueType; // embed CID TrueType fonts? + bool fontPassthrough; // pass all fonts through as-is? + bool optimizeColorSpace; // false to keep gray RGB images in their original color space // true to optimize gray images to DeviceGray color space - GBool passLevel1CustomColor; // false to convert all custom colors to CMYK + bool passLevel1CustomColor; // false to convert all custom colors to CMYK // true to pass custom colors // has effect only when doing a level1sep - GBool preloadImagesForms; // preload PostScript images and forms into + bool preloadImagesForms; // preload PostScript images and forms into // memory - GBool generateOPI; // generate PostScript OPI comments? - GBool useASCIIHex; // use ASCIIHex instead of ASCII85? - GBool useBinary; // use binary instead of hex - GBool enableLZW; // enable LZW compression - GBool enableFlate; // enable Flate compression + bool generateOPI; // generate PostScript OPI comments? + bool useASCIIHex; // use ASCIIHex instead of ASCII85? + bool useBinary; // use binary instead of hex + bool enableLZW; // enable LZW compression + bool enableFlate; // enable Flate compression #ifdef OPI_SUPPORT int opi13Nest; // nesting level of OPI 1.3 objects int opi20Nest; // nesting level of OPI 2.0 objects #endif - GBool ok; // set up ok? + bool ok; // set up ok? friend class WinPDFPrinter; }; diff --git a/poppler/PSTokenizer.cc b/poppler/PSTokenizer.cc index bdc7bc41..a5eb7c86 100644 --- a/poppler/PSTokenizer.cc +++ b/poppler/PSTokenizer.cc @@ -62,25 +62,25 @@ PSTokenizer::PSTokenizer(int (*getCharFuncA)(void *), void *dataA) { PSTokenizer::~PSTokenizer() { } -GBool PSTokenizer::getToken(char *buf, int size, int *length) { - GBool comment, backslash; +bool PSTokenizer::getToken(char *buf, int size, int *length) { + bool comment, backslash; int c; int i; // skip leading whitespace and comments - comment = gFalse; + comment = false; while (1) { if ((c = getChar()) == EOF) { buf[0] = '\0'; *length = 0; - return gFalse; + return false; } if (comment) { if (c == '\x0a' || c == '\x0d') { - comment = gFalse; + comment = false; } } else if (c == '%') { - comment = gTrue; + comment = true; } else if (specialChars[static_cast<unsigned char>(c)] != 1) { break; } @@ -93,18 +93,18 @@ GBool PSTokenizer::getToken(char *buf, int size, int *length) { i = 0; buf[i++] = c; if (c == '(') { - backslash = gFalse; + backslash = false; while ((c = lookChar()) != EOF) { consumeChar(); if (i < size) { buf[i++] = c; } if (c == '\\') { - backslash = gTrue; + backslash = true; } else if (!backslash && c == ')') { break; } else { - backslash = gFalse; + backslash = false; } } } else if (c == '<') { @@ -130,7 +130,7 @@ GBool PSTokenizer::getToken(char *buf, int size, int *length) { // Return length of token *length = i; - return gTrue; + return true; } int PSTokenizer::lookChar() { diff --git a/poppler/PSTokenizer.h b/poppler/PSTokenizer.h index 6bfb2727..0cd8e231 100644 --- a/poppler/PSTokenizer.h +++ b/poppler/PSTokenizer.h @@ -34,7 +34,7 @@ public: ~PSTokenizer(); // Get the next PostScript token. Returns false at end-of-stream. - GBool getToken(char *buf, int size, int *length); + bool getToken(char *buf, int size, int *length); private: diff --git a/poppler/Page.cc b/poppler/Page.cc index 7891d2d4..fddb831c 100644 --- a/poppler/Page.cc +++ b/poppler/Page.cc @@ -92,7 +92,7 @@ void PDFRectangle::clipTo(PDFRectangle *rect) { PageAttrs::PageAttrs(PageAttrs *attrs, Dict *dict) { Object obj1; PDFRectangle mBox; - const GBool isPage = dict->is("Page"); + const bool isPage = dict->is("Page"); // get old/default values if (attrs) { @@ -109,7 +109,7 @@ PageAttrs::PageAttrs(PageAttrs *attrs, Dict *dict) { mediaBox.x2 = 612; mediaBox.y2 = 792; cropBox.x1 = cropBox.y1 = cropBox.x2 = cropBox.y2 = 0; - haveCropBox = gFalse; + haveCropBox = false; rotate = 0; resources.setToNull(); } @@ -121,7 +121,7 @@ PageAttrs::PageAttrs(PageAttrs *attrs, Dict *dict) { // crop box if (readBox(dict, "CropBox", &cropBox)) { - haveCropBox = gTrue; + haveCropBox = true; } if (!haveCropBox) { cropBox = mediaBox; @@ -186,41 +186,41 @@ void PageAttrs::clipBoxes() { artBox.clipTo(&mediaBox); } -GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) { +bool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) { PDFRectangle tmp; double t; Object obj1, obj2; - GBool ok; + bool ok; obj1 = dict->lookup(key); if (obj1.isArray() && obj1.arrayGetLength() == 4) { - ok = gTrue; + ok = true; obj2 = obj1.arrayGet(0); if (obj2.isNum()) { tmp.x1 = obj2.getNum(); } else { - ok = gFalse; + ok = false; } obj2 = obj1.arrayGet(1); if (obj2.isNum()) { tmp.y1 = obj2.getNum(); } else { - ok = gFalse; + ok = false; } obj2 = obj1.arrayGet(2); if (obj2.isNum()) { tmp.x2 = obj2.getNum(); } else { - ok = gFalse; + ok = false; } obj2 = obj1.arrayGet(3); if (obj2.isNum()) { tmp.y2 = obj2.getNum(); } else { - ok = gFalse; + ok = false; } if (tmp.x1 == 0 && tmp.x2 == 0 && tmp.y1 == 0 && tmp.y2 == 0) - ok = gFalse; + ok = false; if (ok) { if (tmp.x1 > tmp.x2) { t = tmp.x1; tmp.x1 = tmp.x2; tmp.x2 = t; @@ -231,7 +231,7 @@ GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) { *box = tmp; } } else { - ok = gFalse; + ok = false; } return ok; } @@ -243,7 +243,7 @@ GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) { #define pageLocker() std::unique_lock<std::recursive_mutex> locker(mutex) Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *attrsA, Form *form) { - ok = gTrue; + ok = true; doc = docA; xref = doc->getXRef(); num = numA; @@ -313,7 +313,7 @@ Page::Page(PDFDoc *docA, int numA, Object *pageDict, Ref pageRefA, PageAttrs *at annotsObj.setToNull(); err1: contents.setToNull(); - ok = gFalse; + ok = false; } Page::~Page() { @@ -404,7 +404,7 @@ void Page::addAnnot(Annot *annot) { static_cast<AnnotPopup*>(annot)->getParentNF()->isNull()) { annots->appendAnnot(annot); } - annot->setPage(num, gTrue); + annot->setPage(num, true); AnnotMarkup *annotMarkup = dynamic_cast<AnnotMarkup*>(annot); if (annotMarkup) { @@ -447,7 +447,7 @@ void Page::removeAnnot(Annot *annot) { } } annot->removeReferencedObjects(); // Note: Might recurse in removeAnnot again - annot->setPage(0, gFalse); + annot->setPage(0, false); } Links *Page::getLinks() { @@ -459,23 +459,23 @@ FormPageWidgets *Page::getFormWidgets() { } void Page::display(OutputDev *out, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, - GBool printing, - GBool (*abortCheckCbk)(void *data), + int rotate, bool useMediaBox, bool crop, + bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), void *annotDisplayDecideCbkData, - GBool copyXRef) { + bool copyXRef) { displaySlice(out, hDPI, vDPI, rotate, useMediaBox, crop, -1, -1, -1, -1, printing, abortCheckCbk, abortCheckCbkData, annotDisplayDecideCbk, annotDisplayDecideCbkData, copyXRef); } Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (*abortCheckCbk)(void *data), + bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, XRef *xrefA) { const PDFRectangle *mediaBox, *cropBox; PDFRectangle box; @@ -512,14 +512,14 @@ Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI, } void Page::displaySlice(OutputDev *out, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (*abortCheckCbk)(void *data), + bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), void *annotDisplayDecideCbkData, - GBool copyXRef) { + bool copyXRef) { Gfx *gfx; Annots *annotList; int i; @@ -587,7 +587,7 @@ void Page::display(Gfx *gfx) { } } -GBool Page::loadThumb(unsigned char **data_out, +bool Page::loadThumb(unsigned char **data_out, int *width_out, int *height_out, int *rowstride_out) { @@ -596,7 +596,7 @@ GBool Page::loadThumb(unsigned char **data_out, Object obj1; Dict *dict; GfxColorSpace *colorSpace; - GBool success = gFalse; + bool success = false; Stream *str; GfxImageColorMap *colorMap; @@ -604,7 +604,7 @@ GBool Page::loadThumb(unsigned char **data_out, pageLocker(); Object fetched_thumb = thumb.fetch(xref); if (!fetched_thumb.isStream()) { - return gFalse; + return false; } dict = fetched_thumb.streamGetDict(); @@ -671,7 +671,7 @@ GBool Page::loadThumb(unsigned char **data_out, delete imgstr; } - success = gTrue; + success = true; if (width_out) *width_out = width; @@ -686,9 +686,9 @@ GBool Page::loadThumb(unsigned char **data_out, } void Page::makeBox(double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool upsideDown, + bool useMediaBox, bool upsideDown, double sliceX, double sliceY, double sliceW, double sliceH, - PDFRectangle *box, GBool *crop) { + PDFRectangle *box, bool *crop) { const PDFRectangle *mediaBox, *cropBox, *baseBox; double kx, ky; @@ -743,7 +743,7 @@ void Page::makeBox(double hDPI, double vDPI, int rotate, *box = *mediaBox; } else { *box = *cropBox; - *crop = gFalse; + *crop = false; } } @@ -759,7 +759,7 @@ void Page::processLinks(OutputDev *out) { } void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool upsideDown) { + int rotate, bool useMediaBox, bool upsideDown) { GfxState *state; int i; rotate += getRotate(); diff --git a/poppler/Page.h b/poppler/Page.h index 7a8a531b..37b59455 100644 --- a/poppler/Page.h +++ b/poppler/Page.h @@ -59,8 +59,8 @@ public: PDFRectangle() { x1 = y1 = x2 = y2 = 0; } PDFRectangle(double x1A, double y1A, double x2A, double y2A) { x1 = x1A; y1 = y1A; x2 = x2A; y2 = y2A; } - GBool isValid() { return x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0; } - GBool contains(double x, double y) { return x1 <= x && x <= x2 && y1 <= y && y <= y2; } + bool isValid() { return x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0; } + bool contains(double x, double y) { return x1 <= x && x <= x2 && y1 <= y && y <= y2; } void clipTo(PDFRectangle *rect); bool operator==(const PDFRectangle &rect) const { return x1 == rect.x1 && y1 == rect.y1 && x2 == rect.x2 && y2 == rect.y2; } @@ -84,7 +84,7 @@ public: // Accessors. const PDFRectangle *getMediaBox() const { return &mediaBox; } const PDFRectangle *getCropBox() const { return &cropBox; } - GBool isCropped() const { return haveCropBox; } + bool isCropped() const { return haveCropBox; } const PDFRectangle *getBleedBox() const { return &bleedBox; } const PDFRectangle *getTrimBox() const { return &trimBox; } const PDFRectangle *getArtBox() const { return &artBox; } @@ -115,11 +115,11 @@ public: private: - GBool readBox(Dict *dict, const char *key, PDFRectangle *box); + bool readBox(Dict *dict, const char *key, PDFRectangle *box); PDFRectangle mediaBox; PDFRectangle cropBox; - GBool haveCropBox; + bool haveCropBox; PDFRectangle bleedBox; PDFRectangle trimBox; PDFRectangle artBox; @@ -150,13 +150,13 @@ public: Page& operator=(const Page &) = delete; // Is page valid? - GBool isOk() const { return ok; } + bool isOk() const { return ok; } // Get page parameters. int getNum() const { return num; } const PDFRectangle *getMediaBox() const { return attrs->getMediaBox(); } const PDFRectangle *getCropBox() const { return attrs->getCropBox(); } - GBool isCropped() const { return attrs->isCropped(); } + bool isCropped() const { return attrs->isCropped(); } double getMediaWidth() const { return attrs->getMediaBox()->x2 - attrs->getMediaBox()->x1; } double getMediaHeight() const @@ -201,7 +201,7 @@ public: // Get thumb. Object getThumb() { return thumb.fetch(xref); } - GBool loadThumb(unsigned char **data, int *width, int *height, int *rowstride); + bool loadThumb(unsigned char **data, int *width, int *height, int *rowstride); // Get transition. Object getTrans() { return trans.fetch(xref); } @@ -225,45 +225,45 @@ public: LinkAction *getAdditionalAction(PageAdditionalActionsType type); Gfx *createGfx(OutputDev *out, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (*abortCheckCbk)(void *data), + bool printing, + bool (*abortCheckCbk)(void *data), void *abortCheckCbkData, XRef *xrefA = nullptr); // Display a page. void display(OutputDev *out, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, - GBool printing, - GBool (*abortCheckCbk)(void *data) = nullptr, + int rotate, bool useMediaBox, bool crop, + bool printing, + bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr, - GBool copyXRef = gFalse); + bool copyXRef = false); // Display part of a page. void displaySlice(OutputDev *out, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (*abortCheckCbk)(void *data) = nullptr, + bool printing, + bool (*abortCheckCbk)(void *data) = nullptr, void *abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr, - GBool copyXRef = gFalse); + bool copyXRef = false); void display(Gfx *gfx); void makeBox(double hDPI, double vDPI, int rotate, - GBool useMediaBox, GBool upsideDown, + bool useMediaBox, bool upsideDown, double sliceX, double sliceY, double sliceW, double sliceH, - PDFRectangle *box, GBool *crop); + PDFRectangle *box, bool *crop); void processLinks(OutputDev *out); // Get the page's default CTM. void getDefaultCTM(double *ctm, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool upsideDown); + int rotate, bool useMediaBox, bool upsideDown); private: // replace xref @@ -282,7 +282,7 @@ private: Object trans; // page transition Object actions; // page additional actions double duration; // page duration - GBool ok; // true if page is valid + bool ok; // true if page is valid mutable std::recursive_mutex mutex; }; diff --git a/poppler/PageLabelInfo.cc b/poppler/PageLabelInfo.cc index 3053aa05..389c1b0f 100644 --- a/poppler/PageLabelInfo.cc +++ b/poppler/PageLabelInfo.cc @@ -98,7 +98,7 @@ void PageLabelInfo::parse(Object *tree) { } } -GBool PageLabelInfo::labelToIndex(GooString *label, int *index) const +bool PageLabelInfo::labelToIndex(GooString *label, int *index) const { const char *const str = label->getCString(); const std::size_t strLen = label->getLength(); @@ -116,7 +116,7 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index) const std::tie(number, ok) = fromDecimal(str + prefixLen, str + strLen, strUnicode); if (ok && number - interval.first < interval.length) { *index = interval.base + number - interval.first; - return gTrue; + return true; } break; case Interval::LowercaseRoman: @@ -124,7 +124,7 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index) const number = fromRoman(str + prefixLen); if (number >= 0 && number - interval.first < interval.length) { *index = interval.base + number - interval.first; - return gTrue; + return true; } break; case Interval::UppercaseLatin: @@ -132,7 +132,7 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index) const number = fromLatin(str + prefixLen); if (number >= 0 && number - interval.first < interval.length) { *index = interval.base + number - interval.first; - return gTrue; + return true; } break; case Interval::None: @@ -140,10 +140,10 @@ GBool PageLabelInfo::labelToIndex(GooString *label, int *index) const } } - return gFalse; + return false; } -GBool PageLabelInfo::indexToLabel(int index, GooString *label) const +bool PageLabelInfo::indexToLabel(int index, GooString *label) const { char buffer[32]; int base, number; @@ -161,7 +161,7 @@ GBool PageLabelInfo::indexToLabel(int index, GooString *label) const } if (!matching_interval) - return gFalse; + return false; number = index - base + matching_interval->first; switch (matching_interval->style) { @@ -170,16 +170,16 @@ GBool PageLabelInfo::indexToLabel(int index, GooString *label) const number_string.append(buffer); break; case Interval::LowercaseRoman: - toRoman(number, &number_string, gFalse); + toRoman(number, &number_string, false); break; case Interval::UppercaseRoman: - toRoman(number, &number_string, gTrue); + toRoman(number, &number_string, true); break; case Interval::LowercaseLatin: - toLatin(number, &number_string, gFalse); + toLatin(number, &number_string, false); break; case Interval::UppercaseLatin: - toLatin(number, &number_string, gTrue); + toLatin(number, &number_string, true); break; case Interval::None: break; @@ -202,5 +202,5 @@ GBool PageLabelInfo::indexToLabel(int index, GooString *label) const label->append(&number_string); } - return gTrue; + return true; } diff --git a/poppler/PageLabelInfo.h b/poppler/PageLabelInfo.h index 8f13a2af..8c36ae87 100644 --- a/poppler/PageLabelInfo.h +++ b/poppler/PageLabelInfo.h @@ -29,8 +29,8 @@ public: PageLabelInfo(const PageLabelInfo &) = delete; PageLabelInfo& operator=(const PageLabelInfo &) = delete; - GBool labelToIndex(GooString *label, int *index) const; - GBool indexToLabel(int index, GooString *label) const; + bool labelToIndex(GooString *label, int *index) const; + bool indexToLabel(int index, GooString *label) const; private: void parse(Object *tree); diff --git a/poppler/PageLabelInfo_p.h b/poppler/PageLabelInfo_p.h index 52b25042..5647ad71 100644 --- a/poppler/PageLabelInfo_p.h +++ b/poppler/PageLabelInfo_p.h @@ -102,7 +102,7 @@ static int fromRoman(const char *buffer) { return value; } -static void toRoman(int number, GooString *str, GBool uppercase) { +static void toRoman(int number, GooString *str, bool uppercase) { static const char uppercaseNumerals[] = "IVXLCDM"; static const char lowercaseNumerals[] = "ivxlcdm"; int divisor; @@ -171,7 +171,7 @@ static int fromLatin(const char *buffer) return -1; } -static void toLatin(int number, GooString *str, GBool uppercase) { +static void toLatin(int number, GooString *str, bool uppercase) { char base, letter; int i, count; diff --git a/poppler/PageTransition.cc b/poppler/PageTransition.cc index c532b91c..97226868 100644 --- a/poppler/PageTransition.cc +++ b/poppler/PageTransition.cc @@ -35,11 +35,11 @@ PageTransition::PageTransition (Object *trans) { direction = transitionInward; angle = 0; scale = 1.0; - rectangular = gFalse; - ok = gTrue; + rectangular = false; + ok = true; if (!trans || !trans->isDict ()) { - ok = gFalse; + ok = false; return; } diff --git a/poppler/PageTransition.h b/poppler/PageTransition.h index 9f78f3cc..6eb52d8a 100644 --- a/poppler/PageTransition.h +++ b/poppler/PageTransition.h @@ -63,7 +63,7 @@ public: ~PageTransition (); // Was the Page Transition created successfully? - GBool isOk() { return ok; } + bool isOk() { return ok; } // Get type PageTransitionType getType() { return type; } @@ -84,7 +84,7 @@ public: double getScale() { return scale; } // Is rectangular? - GBool isRectangular() { return rectangular; } + bool isRectangular() { return rectangular; } private: @@ -94,8 +94,8 @@ private: PageTransitionDirection direction; // direction of motion int angle; // direction in degrees double scale; // scale - GBool rectangular; // is the area to be flown in rectangular? - GBool ok; // set if created successfully + bool rectangular; // is the area to be flown in rectangular? + bool ok; // set if created successfully }; #endif /* PAGE_TRANSITION_H */ diff --git a/poppler/Parser.cc b/poppler/Parser.cc index 2315e317..bd4845ab 100644 --- a/poppler/Parser.cc +++ b/poppler/Parser.cc @@ -43,7 +43,7 @@ // lots of nested arrays that made us consume all the stack #define recursionLimit 500 -Parser::Parser(XRef *xrefA, Lexer *lexerA, GBool allowStreamsA) { +Parser::Parser(XRef *xrefA, Lexer *lexerA, bool allowStreamsA) { xref = xrefA; lexer = lexerA; inlineImg = 0; @@ -58,14 +58,14 @@ Parser::~Parser() { Object Parser::getObj(int recursion) { - return getObj(gFalse, nullptr, cryptRC4, 0, 0, 0, recursion); + return getObj(false, nullptr, cryptRC4, 0, 0, 0, recursion); } -Object Parser::getObj(GBool simpleOnly, +Object Parser::getObj(bool simpleOnly, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, int recursion, - GBool strict) { + bool strict) { Object obj; Stream *str; DecryptStream *decrypt; @@ -89,7 +89,7 @@ Object Parser::getObj(GBool simpleOnly, shift(); obj = Object(new Array(xref)); while (!buf1.isCmd("]") && !buf1.isEOF() && recursion + 1 < recursionLimit) { - Object obj2 = getObj(gFalse, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1); + Object obj2 = getObj(false, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1); obj.arrayAdd(std::move(obj2)); } if (recursion + 1 >= recursionLimit && strict) goto err; @@ -116,7 +116,7 @@ Object Parser::getObj(GBool simpleOnly, if (strict && buf1.isError()) goto err; break; } - Object obj2 = getObj(gFalse, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1); + Object obj2 = getObj(false, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1); if (unlikely(obj2.isError() && recursion + 1 >= recursionLimit)) { break; } @@ -192,7 +192,7 @@ err: Stream *Parser::makeStream(Object &&dict, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, int recursion, - GBool strict) { + bool strict) { BaseStream *baseStr; Stream *str; Goffset length; @@ -267,7 +267,7 @@ Stream *Parser::makeStream(Object &&dict, Guchar *fileKey, } // make base stream - str = baseStr->makeSubStream(pos, gTrue, length, std::move(dict)); + str = baseStr->makeSubStream(pos, true, length, std::move(dict)); // handle decryption if (fileKey) { diff --git a/poppler/Parser.h b/poppler/Parser.h index 1faaa463..418e2f28 100644 --- a/poppler/Parser.h +++ b/poppler/Parser.h @@ -36,7 +36,7 @@ class Parser { public: // Constructor. - Parser(XRef *xrefA, Lexer *lexerA, GBool allowStreamsA); + Parser(XRef *xrefA, Lexer *lexerA, bool allowStreamsA); // Destructor. ~Parser(); @@ -47,11 +47,11 @@ public: // Get the next object from the input stream. If <simpleOnly> is // true, do not parse compound objects (arrays, dictionaries, or // streams). - Object getObj(GBool simpleOnly = gFalse, + Object getObj(bool simpleOnly = false, Guchar *fileKey = nullptr, CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0, int objNum = 0, int objGen = 0, int recursion = 0, - GBool strict = gFalse); + bool strict = false); Object getObj(int recursion); template<typename T> Object getObj(T) = delete; @@ -66,14 +66,14 @@ private: XRef *xref; // the xref table for this PDF file Lexer *lexer; // input stream - GBool allowStreams; // parse stream objects? + bool allowStreams; // parse stream objects? Object buf1, buf2; // next two tokens int inlineImg; // set when inline image data is encountered Stream *makeStream(Object &&dict, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, int recursion, - GBool strict); + bool strict); void shift(int objNum = -1); void shift(const char *cmdA, int objNum); }; diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc index bc85eced..9c460490 100644 --- a/poppler/PreScanOutputDev.cc +++ b/poppler/PreScanOutputDev.cc @@ -63,7 +63,7 @@ void PreScanOutputDev::stroke(GfxState *state) { state->getStrokeOpacity(), state->getBlendMode()); state->getLineDash(&dash, &dashLen, &dashStart); if (dashLen != 0) { - gdi = gFalse; + gdi = false; } } @@ -77,13 +77,13 @@ void PreScanOutputDev::eoFill(GfxState *state) { state->getFillOpacity(), state->getBlendMode()); } -GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str, +bool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str, const double *pmat, int paintType, int /*tilingType*/, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { if (paintType == 1) { - GBool tilingNeeded = (x1 - x0 != 1 || y1 - y0 != 1); + bool tilingNeeded = (x1 - x0 != 1 || y1 - y0 != 1); if (tilingNeeded) { inTilingPatternFill++; } @@ -95,47 +95,47 @@ GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *ca check(state->getFillColorSpace(), state->getFillColor(), state->getFillOpacity(), state->getBlendMode()); } - return gTrue; + return true; } -GBool PreScanOutputDev::functionShadedFill(GfxState *state, +bool PreScanOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { if (shading->getColorSpace()->getMode() != csDeviceGray && shading->getColorSpace()->getMode() != csCalGray) { - gray = gFalse; + gray = false; } - mono = gFalse; + mono = false; if (state->getFillOpacity() != 1 || state->getBlendMode() != gfxBlendNormal) { - transparency = gTrue; + transparency = true; } - return gTrue; + return true; } -GBool PreScanOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) { +bool PreScanOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) { if (shading->getColorSpace()->getMode() != csDeviceGray && shading->getColorSpace()->getMode() != csCalGray) { - gray = gFalse; + gray = false; } - mono = gFalse; + mono = false; if (state->getFillOpacity() != 1 || state->getBlendMode() != gfxBlendNormal) { - transparency = gTrue; + transparency = true; } - return gTrue; + return true; } -GBool PreScanOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) { +bool PreScanOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) { if (shading->getColorSpace()->getMode() != csDeviceGray && shading->getColorSpace()->getMode() != csCalGray) { - gray = gFalse; + gray = false; } - mono = gFalse; + mono = false; if (state->getFillOpacity() != 1 || state->getBlendMode() != gfxBlendNormal) { - transparency = gTrue; + transparency = true; } - return gTrue; + return true; } void PreScanOutputDev::clip(GfxState * /*state*/) { @@ -150,7 +150,7 @@ void PreScanOutputDev::eoClip(GfxState * /*state*/) { void PreScanOutputDev::beginStringOp(GfxState *state) { int render; double m11, m12, m21, m22; - GBool simpleTTF; + bool simpleTTF; render = state->getRender(); if (!(render & 1)) { @@ -176,34 +176,34 @@ void PreScanOutputDev::beginStringOp(GfxState *state) { //~ need to create a FoFiTrueType object, and check for a Unicode cmap } if (state->getRender() != 0 || !simpleTTF) { - gdi = gFalse; + gdi = false; } } void PreScanOutputDev::endStringOp(GfxState * /*state*/) { } -GBool PreScanOutputDev::beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, +bool PreScanOutputDev::beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/, double /*dx*/, double /*dy*/, CharCode /*code*/, Unicode * /*u*/, int /*uLen*/) { // return false so all Type 3 chars get rendered (no caching) - return gFalse; + return false; } void PreScanOutputDev::endType3Char(GfxState * /*state*/) { } void PreScanOutputDev::drawImageMask(GfxState *state, Object * /*ref*/, Stream *str, - int width, int height, GBool /*invert*/, - GBool /*interpolate*/, GBool inlineImg) { + int width, int height, bool /*invert*/, + bool /*interpolate*/, bool inlineImg) { int i, j; check(state->getFillColorSpace(), state->getFillColor(), state->getFillOpacity(), state->getBlendMode()); - gdi = gFalse; + gdi = false; if ((level == psLevel1 || level == psLevel1Sep) && (state->getFillColorSpace()->getMode() == csPattern || inTilingPatternFill > 0)) { - patternImgMask = gTrue; + patternImgMask = true; } if (inlineImg) { @@ -218,7 +218,7 @@ void PreScanOutputDev::drawImageMask(GfxState *state, Object * /*ref*/, Stream * void PreScanOutputDev::drawImage(GfxState *state, Object * /*ref*/, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool /*interpolate*/, int * /*maskColors*/, GBool inlineImg) { + bool /*interpolate*/, int * /*maskColors*/, bool inlineImg) { GfxColorSpace *colorSpace; int i, j; @@ -229,20 +229,20 @@ void PreScanOutputDev::drawImage(GfxState *state, Object * /*ref*/, Stream *str, if (colorSpace->getMode() == csDeviceGray || colorSpace->getMode() == csCalGray) { if (colorMap->getBits() > 1) { - mono = gFalse; + mono = false; } } else { - gray = gFalse; - mono = gFalse; + gray = false; + mono = false; } if (state->getFillOpacity() != 1 || state->getBlendMode() != gfxBlendNormal) { - transparency = gTrue; + transparency = true; } - gdi = gFalse; + gdi = false; if ((level == psLevel1 || level == psLevel1Sep) && inTilingPatternFill > 0) { - patternImgMask = gTrue; + patternImgMask = true; } if (inlineImg) { @@ -259,10 +259,10 @@ void PreScanOutputDev::drawMaskedImage(GfxState *state, Object * /*ref*/, Stream * /*str*/, int /*width*/, int /*height*/, GfxImageColorMap *colorMap, - GBool /*interpolate*/, + bool /*interpolate*/, Stream * /*maskStr*/, int /*maskWidth*/, int /*maskHeight*/, - GBool /*maskInvert*/, GBool /*maskInterpolate*/) { + bool /*maskInvert*/, bool /*maskInterpolate*/) { GfxColorSpace *colorSpace; colorSpace = colorMap->getColorSpace(); @@ -272,28 +272,28 @@ void PreScanOutputDev::drawMaskedImage(GfxState *state, Object * /*ref*/, if (colorSpace->getMode() == csDeviceGray || colorSpace->getMode() == csCalGray) { if (colorMap->getBits() > 1) { - mono = gFalse; + mono = false; } } else { - gray = gFalse; - mono = gFalse; + gray = false; + mono = false; } if (state->getFillOpacity() != 1 || state->getBlendMode() != gfxBlendNormal) { - transparency = gTrue; + transparency = true; } - gdi = gFalse; + gdi = false; } void PreScanOutputDev::drawSoftMaskedImage(GfxState * /*state*/, Object * /*ref*/, Stream * /*str*/, int /*width*/, int /*height*/, GfxImageColorMap *colorMap, - GBool /*interpolate*/, + bool /*interpolate*/, Stream * /*maskStr*/, int /*maskWidth*/, int /*maskHeight*/, GfxImageColorMap * /*maskColorMap*/, - GBool /*maskInterpolate*/) { + bool /*maskInterpolate*/) { GfxColorSpace *colorSpace; colorSpace = colorMap->getColorSpace(); @@ -302,19 +302,19 @@ void PreScanOutputDev::drawSoftMaskedImage(GfxState * /*state*/, Object * /*ref* } if (colorSpace->getMode() != csDeviceGray && colorSpace->getMode() != csCalGray) { - gray = gFalse; + gray = false; } - mono = gFalse; - transparency = gTrue; - gdi = gFalse; + mono = false; + transparency = true; + gdi = false; } void PreScanOutputDev::beginTransparencyGroup( GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) { - gdi = gFalse; + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) { + gdi = false; } void PreScanOutputDev::paintTransparencyGroup(GfxState *state, const double * /*bbox*/) @@ -323,10 +323,10 @@ void PreScanOutputDev::paintTransparencyGroup(GfxState *state, const double * /* state->getFillOpacity(), state->getBlendMode()); } -void PreScanOutputDev::setSoftMask(GfxState * /*state*/, const double * /*bbox*/, GBool /*alpha*/, +void PreScanOutputDev::setSoftMask(GfxState * /*state*/, const double * /*bbox*/, bool /*alpha*/, Function * /*transferFunc*/, GfxColor * /*backdropColor*/) { - transparency = gTrue; + transparency = true; } void PreScanOutputDev::check(GfxColorSpace *colorSpace, const GfxColor *color, @@ -334,31 +334,31 @@ void PreScanOutputDev::check(GfxColorSpace *colorSpace, const GfxColor *color, GfxRGB rgb; if (colorSpace->getMode() == csPattern) { - mono = gFalse; - gray = gFalse; - gdi = gFalse; + mono = false; + gray = false; + gdi = false; } else { colorSpace->getRGB(color, &rgb); if (rgb.r != rgb.g || rgb.g != rgb.b || rgb.b != rgb.r) { - mono = gFalse; - gray = gFalse; + mono = false; + gray = false; } else if (!((rgb.r == 0 && rgb.g == 0 && rgb.b == 0) || (rgb.r == gfxColorComp1 && rgb.g == gfxColorComp1 && rgb.b == gfxColorComp1))) { - mono = gFalse; + mono = false; } } if (opacity != 1 || blendMode != gfxBlendNormal) { - transparency = gTrue; + transparency = true; } } void PreScanOutputDev::clearStats() { - mono = gTrue; - gray = gTrue; - transparency = gFalse; - gdi = gTrue; - patternImgMask = gFalse; + mono = true; + gray = true; + transparency = false; + gdi = true; + patternImgMask = false; inTilingPatternFill = 0; } diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h index 8393fc88..a53aa13c 100644 --- a/poppler/PreScanOutputDev.h +++ b/poppler/PreScanOutputDev.h @@ -50,24 +50,24 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. - GBool useShadedFills(int type) override { return gTrue; } + bool useShadedFills(int type) override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gTrue; } + bool interpretType3Chars() override { return true; } //----- initialization and control @@ -81,15 +81,15 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) override; - GBool functionShadedFill(GfxState *state, + bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; - GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; - GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override; + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override; //----- path clipping void clip(GfxState *state) override; @@ -98,64 +98,64 @@ public: //----- text drawing void beginStringOp(GfxState *state) override; void endStringOp(GfxState *state) override; - GBool beginType3Char(GfxState *state, double x, double y, + bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override; void endType3Char(GfxState *state) override; //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; //----- transparency groups and soft masks void beginTransparencyGroup(GfxState *state, const double *bbox, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, - GBool forSoftMask) override; + bool isolated, bool knockout, + bool forSoftMask) override; void paintTransparencyGroup(GfxState *state, const double *bbox) override; - void setSoftMask(GfxState *state, const double *bbox, GBool alpha, + void setSoftMask(GfxState *state, const double *bbox, bool alpha, Function *transferFunc, GfxColor *backdropColor) override; //----- special access // Returns true if the operations performed since the last call to // clearStats() are all monochrome (black or white). - GBool isMonochrome() { return mono; } + bool isMonochrome() { return mono; } // Returns true if the operations performed since the last call to // clearStats() are all gray. - GBool isGray() { return gray; } + bool isGray() { return gray; } // Returns true if the operations performed since the last call to // clearStats() included any transparency. - GBool usesTransparency() { return transparency; } + bool usesTransparency() { return transparency; } // Returns true if the operations performed since the last call to // clearStats() are all rasterizable by GDI calls in GDIOutputDev. - GBool isAllGDI() { return gdi; } + bool isAllGDI() { return gdi; } // Returns true if the operations performed since the last call to // clearStats() included any image mask fills with a pattern color // space. (only level1!) - GBool usesPatternImageMask() { return patternImgMask; } + bool usesPatternImageMask() { return patternImgMask; } // Clear the stats used by the above functions. void clearStats(); @@ -166,12 +166,12 @@ private: double opacity, GfxBlendMode blendMode); PDFDoc *doc; - GBool mono; - GBool gray; - GBool transparency; - GBool gdi; + bool mono; + bool gray; + bool transparency; + bool gdi; PSLevel level; // PostScript level (1, 2, separation) - GBool patternImgMask; + bool patternImgMask; int inTilingPatternFill; }; diff --git a/poppler/Rendition.cc b/poppler/Rendition.cc index b74aca49..26a15fd9 100644 --- a/poppler/Rendition.cc +++ b/poppler/Rendition.cc @@ -36,9 +36,9 @@ MediaWindowParameters::MediaWindowParameters() { relativeTo = windowRelativeToDocument; XPosition = 0.5; YPosition = 0.5; - hasTitleBar = gTrue; - hasCloseButton = gTrue; - isResizeable = gTrue; + hasTitleBar = true; + hasCloseButton = true; + isResizeable = true; } MediaWindowParameters::~MediaWindowParameters() { @@ -136,10 +136,10 @@ MediaParameters::MediaParameters() { volume = 100; fittingPolicy = fittingUndefined; - autoPlay = gTrue; + autoPlay = true; repeatCount = 1.0; opacity = 1.0; - showControls = gFalse; + showControls = false; duration = 0; } @@ -251,19 +251,19 @@ MediaRendition::~MediaRendition() { } MediaRendition::MediaRendition(Object* obj) { - GBool hasClip = gFalse; + bool hasClip = false; - ok = gTrue; + ok = true; fileName = nullptr; contentType = nullptr; - isEmbedded = gFalse; + isEmbedded = false; // // Parse media clip data // Object tmp2 = obj->dictLookup("C"); if (tmp2.isDict()) { // media clip - hasClip = gTrue; + hasClip = true; Object tmp = tmp2.dictLookup("S"); if (tmp.isName()) { if (!strcmp(tmp.getName(), "MCD")) { // media clip data @@ -277,7 +277,7 @@ MediaRendition::MediaRendition(Object* obj) { if (obj2.isDict()) { Object embedded = obj2.dictLookup("F"); if (embedded.isStream()) { - isEmbedded = gTrue; + isEmbedded = true; embeddedStreamObject = embedded.copy(); } } @@ -285,7 +285,7 @@ MediaRendition::MediaRendition(Object* obj) { // TODO: D might be a form XObject too } else { error (errSyntaxError, -1, "Invalid Media Clip Data"); - ok = gFalse; + ok = false; } // FIXME: ignore CT if D is a form XObject @@ -298,7 +298,7 @@ MediaRendition::MediaRendition(Object* obj) { } } else { error (errSyntaxError, -1, "Invalid Media Clip"); - ok = gFalse; + ok = false; } } @@ -319,7 +319,7 @@ MediaRendition::MediaRendition(Object* obj) { } } else if (!hasClip) { error (errSyntaxError, -1, "Invalid Media Rendition"); - ok = gFalse; + ok = false; } // diff --git a/poppler/Rendition.h b/poppler/Rendition.h index cfe57170..60d1cba4 100644 --- a/poppler/Rendition.h +++ b/poppler/Rendition.h @@ -62,9 +62,9 @@ struct MediaWindowParameters { double XPosition; // 0.5 double YPosition; // 0.5 - GBool hasTitleBar; // true - GBool hasCloseButton; // true - GBool isResizeable; // true + bool hasTitleBar; // true + bool hasCloseButton; // true + bool isResizeable; // true }; @@ -99,7 +99,7 @@ struct MediaParameters { // correspond to 'fit' SMIL's attribute MediaFittingPolicy fittingPolicy; // fittingUndefined - GBool autoPlay; // true + bool autoPlay; // true // repeat count, can be real values, 0 means forever double repeatCount; // 1.0 @@ -111,7 +111,7 @@ struct MediaParameters { double opacity; // 1.0 - GBool showControls; // false + bool showControls; // false MediaWindowParameters windowParams; }; @@ -123,7 +123,7 @@ class MediaRendition { ~MediaRendition(); MediaRendition& operator=(const MediaRendition &) = delete; - GBool isOk () const { return ok; } + bool isOk () const { return ok; } const MediaParameters* getMHParameters() const { return &MH; } const MediaParameters* getBEParameters() const { return &BE; } @@ -131,7 +131,7 @@ class MediaRendition { const GooString* getContentType() const { return contentType; } const GooString* getFileName() const { return fileName; } - GBool getIsEmbedded() const { return isEmbedded; } + bool getIsEmbedded() const { return isEmbedded; } Stream* getEmbbededStream() const { return isEmbedded ? embeddedStreamObject.getStream() : nullptr; } const Object* getEmbbededStreamObject() const { return isEmbedded ? &embeddedStreamObject : nullptr; } // write embedded stream to file @@ -140,14 +140,14 @@ class MediaRendition { MediaRendition* copy() const; private: - GBool ok; + bool ok; // "Must Honor" parameters MediaParameters MH; // "Best Effort" parameters MediaParameters BE; - GBool isEmbedded; + bool isEmbedded; GooString* contentType; diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc index 4114a331..adb8fdcf 100644 --- a/poppler/SecurityHandler.cc +++ b/poppler/SecurityHandler.cc @@ -62,10 +62,10 @@ SecurityHandler::SecurityHandler(PDFDoc *docA) { SecurityHandler::~SecurityHandler() { } -GBool SecurityHandler::checkEncryption(const GooString *ownerPassword, +bool SecurityHandler::checkEncryption(const GooString *ownerPassword, const GooString *userPassword) { void *authData; - GBool ok; + bool ok; int i; if (ownerPassword || userPassword) { @@ -129,7 +129,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, Object *encryptDictA): SecurityHandler(docA) { - ok = gFalse; + ok = false; fileID = nullptr; ownerKey = nullptr; userKey = nullptr; @@ -177,7 +177,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, } else { fileKeyLength = lengthObj.getInt() / 8; } - encryptMetadata = gTrue; + encryptMetadata = true; //~ this currently only handles a subset of crypt filter functionality //~ (in particular, it ignores the EFF entry in encryptDictA, and //~ doesn't handle the case where StmF, StrF, and EFF are not all the @@ -251,7 +251,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, if (fileKeyLength > 16 || fileKeyLength < 0) { fileKeyLength = 16; } - ok = gTrue; + ok = true; } else if (encVersion == 5 && (encRevision == 5 || encRevision == 6)) { fileID = new GooString(); // unused for V=R=5 if (ownerEncObj.isString() && userEncObj.isString()) { @@ -260,7 +260,7 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, if (fileKeyLength > 32 || fileKeyLength < 0) { fileKeyLength = 32; } - ok = gTrue; + ok = true; } else { error(errSyntaxError, -1, "Weird encryption owner/user info"); } @@ -295,9 +295,9 @@ StandardSecurityHandler::~StandardSecurityHandler() { } } -GBool StandardSecurityHandler::isUnencrypted() { +bool StandardSecurityHandler::isUnencrypted() { if (!ok) { - return gTrue; + return true; } return encVersion == -1 && encRevision == -1; } @@ -318,11 +318,11 @@ void StandardSecurityHandler::freeAuthData(void *authData) { delete (StandardAuthData *)authData; } -GBool StandardSecurityHandler::authorize(void *authData) { +bool StandardSecurityHandler::authorize(void *authData) { GooString *ownerPassword, *userPassword; if (!ok) { - return gFalse; + return false; } if (authData) { ownerPassword = ((StandardAuthData *)authData)->ownerPassword; @@ -336,8 +336,8 @@ GBool StandardSecurityHandler::authorize(void *authData) { permFlags, fileID, ownerPassword, userPassword, fileKey, encryptMetadata, &ownerPasswordOk)) { - return gFalse; + return false; } - return gTrue; + return true; } diff --git a/poppler/SecurityHandler.h b/poppler/SecurityHandler.h index 08773a78..017a328b 100644 --- a/poppler/SecurityHandler.h +++ b/poppler/SecurityHandler.h @@ -48,7 +48,7 @@ public: SecurityHandler& operator=(const SecurityHandler &) = delete; // Returns true if the file is actually unencrypted. - virtual GBool isUnencrypted() { return gFalse; } + virtual bool isUnencrypted() { return false; } // Check the document's encryption. If the document is encrypted, // this will first try <ownerPassword> and <userPassword> (in @@ -59,7 +59,7 @@ public: // document can be opened (if it's unencrypted, or if a correct // password is obtained); false otherwise (encrypted and no correct // password). - GBool checkEncryption(const GooString *ownerPassword, + bool checkEncryption(const GooString *ownerPassword, const GooString *userPassword); // Create authorization data for the specified owner and user @@ -81,12 +81,12 @@ public: // authorization data (which may be NULL). Returns true if // successful (i.e., if at least the right to open the document was // granted). - virtual GBool authorize(void *authData) = 0; + virtual bool authorize(void *authData) = 0; // Return the various authorization parameters. These are only // valid after authorize has returned true. virtual int getPermissionFlags() = 0; - virtual GBool getOwnerPasswordOk() = 0; + virtual bool getOwnerPasswordOk() = 0; virtual Guchar *getFileKey() = 0; virtual int getFileKeyLength() = 0; virtual int getEncVersion() = 0; @@ -108,14 +108,14 @@ public: StandardSecurityHandler(PDFDoc *docA, Object *encryptDictA); ~StandardSecurityHandler(); - GBool isUnencrypted() override; + bool isUnencrypted() override; void *makeAuthData(const GooString *ownerPassword, const GooString *userPassword) override; void *getAuthData() override; void freeAuthData(void *authData) override; - GBool authorize(void *authData) override; + bool authorize(void *authData) override; int getPermissionFlags() override { return permFlags; } - GBool getOwnerPasswordOk() override { return ownerPasswordOk; } + bool getOwnerPasswordOk() override { return ownerPasswordOk; } Guchar *getFileKey() override { return fileKey; } int getFileKeyLength() override { return fileKeyLength; } int getEncVersion() override { return encVersion; } @@ -125,18 +125,18 @@ public: private: int permFlags; - GBool ownerPasswordOk; + bool ownerPasswordOk; Guchar fileKey[32]; int fileKeyLength; int encVersion; int encRevision; - GBool encryptMetadata; + bool encryptMetadata; CryptAlgorithm encAlgorithm; GooString *ownerKey, *userKey; GooString *ownerEnc, *userEnc; GooString *fileID; - GBool ok; + bool ok; }; #endif diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 60644ecf..90e51205 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -195,7 +195,7 @@ static inline void convertGfxShortColor(SplashColorPtr dest, //------------------------------------------------------------------------ // SplashGouraudPattern //------------------------------------------------------------------------ -SplashGouraudPattern::SplashGouraudPattern(GBool bDirectColorTranslationA, +SplashGouraudPattern::SplashGouraudPattern(bool bDirectColorTranslationA, GfxState *stateA, GfxGouraudTriangleShading *shadingA) { state = stateA; shading = shadingA; @@ -266,15 +266,15 @@ SplashFunctionPattern::SplashFunctionPattern(SplashColorMode colorModeA, GfxStat SplashFunctionPattern::~SplashFunctionPattern() { } -GBool SplashFunctionPattern::getColor(int x, int y, SplashColorPtr c) { +bool SplashFunctionPattern::getColor(int x, int y, SplashColorPtr c) { GfxColor gfxColor; double xc, yc; ictm.transform(x, y, &xc, &yc); - if (xc < xMin || xc > xMax || yc < yMin || yc > yMax) return gFalse; + if (xc < xMin || xc > xMax || yc < yMin || yc > yMax) return false; shading->getColor(xc, yc, &gfxColor); convertGfxColor(c, colorMode, shading->getColorSpace(), &gfxColor); - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -305,13 +305,13 @@ SplashUnivariatePattern::SplashUnivariatePattern(SplashColorMode colorModeA, Gfx SplashUnivariatePattern::~SplashUnivariatePattern() { } -GBool SplashUnivariatePattern::getColor(int x, int y, SplashColorPtr c) { +bool SplashUnivariatePattern::getColor(int x, int y, SplashColorPtr c) { GfxColor gfxColor; double xc, yc, t; ictm.transform(x, y, &xc, &yc); if (! getParameter (xc, yc, &t)) - return gFalse; + return false; const int filled = shading->getColor(t, &gfxColor); if (unlikely(filled < shading->getColorSpace()->getNComps())) { @@ -319,15 +319,15 @@ GBool SplashUnivariatePattern::getColor(int x, int y, SplashColorPtr c) { gfxColor.c[i] = 0; } convertGfxColor(c, colorMode, shading->getColorSpace(), &gfxColor); - return gTrue; + return true; } -GBool SplashUnivariatePattern::testPosition(int x, int y) { +bool SplashUnivariatePattern::testPosition(int x, int y) { double xc, yc, t; ictm.transform(x, y, &xc, &yc); if (! getParameter (xc, yc, &t)) - return gFalse; + return false; return (t0 < t1) ? (t > t0 && t < t1) : (t > t1 && t < t0); } @@ -357,7 +357,7 @@ SplashRadialPattern::SplashRadialPattern(SplashColorMode colorModeA, GfxState *s SplashRadialPattern::~SplashRadialPattern() { } -GBool SplashRadialPattern::getParameter(double xs, double ys, double *t) { +bool SplashRadialPattern::getParameter(double xs, double ys, double *t) { double b, c, s0, s1; // We want to solve this system of equations: @@ -389,7 +389,7 @@ GBool SplashRadialPattern::getParameter(double xs, double ys, double *t) { // If B is 0, we can either have no solution or an indeterminate // equation, thus we behave as if we had an invalid solution if (fabs(b) <= RADIAL_EPSILON) - return gFalse; + return false; s0 = s1 = 0.5 * c / b; } else { @@ -397,7 +397,7 @@ GBool SplashRadialPattern::getParameter(double xs, double ys, double *t) { d = b*b - a*c; if (d < 0) - return gFalse; + return false; d = sqrt (d); s0 = b + d; @@ -414,30 +414,30 @@ GBool SplashRadialPattern::getParameter(double xs, double ys, double *t) { if (r0 + s0 * dr >= 0) { if (0 <= s0 && s0 <= 1) { *t = t0 + dt * s0; - return gTrue; + return true; } else if (s0 < 0 && shading->getExtend0()) { *t = t0; - return gTrue; + return true; } else if (s0 > 1 && shading->getExtend1()) { *t = t1; - return gTrue; + return true; } } if (r0 + s1 * dr >= 0) { if (0 <= s1 && s1 <= 1) { *t = t0 + dt * s1; - return gTrue; + return true; } else if (s1 < 0 && shading->getExtend0()) { *t = t0; - return gTrue; + return true; } else if (s1 > 1 && shading->getExtend1()) { *t = t1; - return gTrue; + return true; } } - return gFalse; + return false; } #undef RADIAL_EPSILON @@ -468,7 +468,7 @@ SplashAxialPattern::SplashAxialPattern(SplashColorMode colorModeA, GfxState *sta SplashAxialPattern::~SplashAxialPattern() { } -GBool SplashAxialPattern::getParameter(double xc, double yc, double *t) { +bool SplashAxialPattern::getParameter(double xc, double yc, double *t) { double s; xc -= x0; @@ -482,10 +482,10 @@ GBool SplashAxialPattern::getParameter(double xc, double yc, double *t) { } else if (s > 1 && shading->getExtend1()) { *t = t1; } else { - return gFalse; + return false; } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -1208,7 +1208,7 @@ public: ~SplashOutFontFileID() {} - GBool matches(SplashFontFileID *id) override { + bool matches(SplashFontFileID *id) override { return ((SplashOutFontFileID *)id)->r.num == r.num && ((SplashOutFontFileID *)id)->r.gen == r.gen; } @@ -1233,11 +1233,11 @@ public: T3FontCache(const Ref *fontID, double m11A, double m12A, double m21A, double m22A, int glyphXA, int glyphYA, int glyphWA, int glyphHA, - GBool aa, GBool validBBoxA); + bool aa, bool validBBoxA); ~T3FontCache(); T3FontCache(const T3FontCache &) = delete; T3FontCache& operator=(const T3FontCache &) = delete; - GBool matches(const Ref *idA, double m11A, double m12A, + bool matches(const Ref *idA, double m11A, double m12A, double m21A, double m22A) { return fontID.num == idA->num && fontID.gen == idA->gen && m11 == m11A && m12 == m12A && m21 == m21A && m22 == m22A; } @@ -1246,7 +1246,7 @@ public: double m11, m12, m21, m22; // transform matrix int glyphX, glyphY; // pixel offset of glyph bitmaps int glyphW, glyphH; // size of glyph bitmaps, in pixels - GBool validBBox; // false if the bbox was [0 0 0 0] + bool validBBox; // false if the bbox was [0 0 0 0] int glyphSize; // size of glyph bitmaps, in bytes int cacheSets; // number of sets in cache int cacheAssoc; // cache associativity (glyphs per set) @@ -1257,7 +1257,7 @@ public: T3FontCache::T3FontCache(const Ref *fontIDA, double m11A, double m12A, double m21A, double m22A, int glyphXA, int glyphYA, int glyphWA, int glyphHA, - GBool validBBoxA, GBool aa) { + bool validBBoxA, bool aa) { fontID = *fontIDA; m11 = m11A; @@ -1273,7 +1273,7 @@ T3FontCache::T3FontCache(const Ref *fontIDA, double m11A, double m12A, // indicate an incorrect BBox) if (glyphW > INT_MAX / glyphH || glyphW <= 0 || glyphH <= 0 || glyphW * glyphH > 100000) { glyphW = glyphH = 100; - validBBox = gFalse; + validBBox = false; } if (aa) { glyphSize = glyphW * glyphH; @@ -1316,8 +1316,8 @@ T3FontCache::~T3FontCache() { struct T3GlyphStack { Gushort code; // character code - GBool haveDx; // set after seeing a d0/d1 operator - GBool doNotCache; // set if we see a gsave/grestore before + bool haveDx; // set after seeing a d0/d1 operator + bool doNotCache; // set if we see a gsave/grestore before // the d0/d1 //----- cache info @@ -1342,13 +1342,13 @@ struct SplashTransparencyGroup { SplashBitmap *tBitmap; // bitmap for transparency group SplashBitmap *softmask; // bitmap for softmasks GfxColorSpace *blendingColorSpace; - GBool isolated; + bool isolated; //----- for knockout SplashBitmap *shape; - GBool knockout; + bool knockout; SplashCoord knockoutOpacity; - GBool fontAA; + bool fontAA; //----- saved state SplashBitmap *origBitmap; @@ -1363,20 +1363,20 @@ struct SplashTransparencyGroup { SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, - GBool reverseVideoA, + bool reverseVideoA, SplashColorPtr paperColorA, - GBool bitmapTopDownA, + bool bitmapTopDownA, SplashThinLineMode thinLineMode, - GBool overprintPreviewA) { + bool overprintPreviewA) { colorMode = colorModeA; bitmapRowPad = bitmapRowPadA; bitmapTopDown = bitmapTopDownA; - bitmapUpsideDown = gFalse; - fontAntialias = gTrue; - vectorAntialias = gTrue; + bitmapUpsideDown = false; + fontAntialias = true; + vectorAntialias = true; overprintPreview = overprintPreviewA; - enableFreeTypeHinting = gFalse; - enableSlightHinting = gFalse; + enableFreeTypeHinting = false; + enableSlightHinting = false; setupScreenParams(72.0, 72.0); reverseVideo = reverseVideoA; if (paperColorA != nullptr) { @@ -1384,8 +1384,8 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, } else { splashClearColor(paperColor); } - skipHorizText = gFalse; - skipRotatedText = gFalse; + skipHorizText = false; + skipRotatedText = false; keepAlphaChannel = paperColorA == nullptr; doc = nullptr; @@ -1403,7 +1403,7 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, t3GlyphStack = nullptr; font = nullptr; - needFontUpdate = gFalse; + needFontUpdate = false; textClipPath = nullptr; transpGroupStack = nullptr; nestCount = 0; @@ -1555,7 +1555,7 @@ void SplashOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { splash->setFlatness(1); // the SA parameter supposedly defaults to false, but Acrobat // apparently hardwires it to true - splash->setStrokeAdjust(gTrue); + splash->setStrokeAdjust(true); splash->clear(paperColor, 0); } @@ -1568,7 +1568,7 @@ void SplashOutputDev::endPage() { void SplashOutputDev::saveState(GfxState *state) { splash->saveState(); if (t3GlyphStack && !t3GlyphStack->haveDx) { - t3GlyphStack->doNotCache = gTrue; + t3GlyphStack->doNotCache = true; error(errSyntaxWarning, -1, "Save (q) operator before d0/d1 in Type 3 glyph"); } @@ -1576,9 +1576,9 @@ void SplashOutputDev::saveState(GfxState *state) { void SplashOutputDev::restoreState(GfxState *state) { splash->restoreState(); - needFontUpdate = gTrue; + needFontUpdate = true; if (t3GlyphStack && !t3GlyphStack->haveDx) { - t3GlyphStack->doNotCache = gTrue; + t3GlyphStack->doNotCache = true; error(errSyntaxWarning, -1, "Restore (Q) operator before d0/d1 in Type 3 glyph"); } @@ -1596,7 +1596,7 @@ void SplashOutputDev::updateAll(GfxState *state) { updateFillColor(state); updateStrokeColorSpace(state); updateStrokeColor(state); - needFontUpdate = gTrue; + needFontUpdate = true; } void SplashOutputDev::updateCTM(GfxState *state, double m11, double m12, @@ -1840,14 +1840,14 @@ void SplashOutputDev::getMatteColor(SplashColorMode colorMode, GfxImageColorMap } void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace, - GBool overprintFlag, + bool overprintFlag, int overprintMode, const GfxColor *singleColor, - GBool grayIndexed) { + bool grayIndexed) { #ifdef SPLASH_CMYK Guint mask; GfxCMYK cmyk; - GBool additive = gFalse; + bool additive = false; int i; if (colorSpace->getMode() == csIndexed) { @@ -1886,13 +1886,13 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace, additive = mask == 0x0f && !deviceNCS->isNonMarking(); for (i = 0; i < deviceNCS->getNComps() && additive; i++) { if (deviceNCS->getColorantName(i)->cmp("Cyan") == 0) { - additive = gFalse; + additive = false; } else if (deviceNCS->getColorantName(i)->cmp("Magenta") == 0) { - additive = gFalse; + additive = false; } else if (deviceNCS->getColorantName(i)->cmp("Yellow") == 0) { - additive = gFalse; + additive = false; } else if (deviceNCS->getColorantName(i)->cmp("Black") == 0) { - additive = gFalse; + additive = false; } } } @@ -1987,7 +1987,7 @@ void SplashOutputDev::updateTransfer(GfxState *state) { } void SplashOutputDev::updateFont(GfxState * /*state*/) { - needFontUpdate = gTrue; + needFontUpdate = true; } void SplashOutputDev::doUpdateFont(GfxState *state) { @@ -2007,10 +2007,10 @@ void SplashOutputDev::doUpdateFont(GfxState *state) { int faceIndex = 0; SplashCoord mat[4]; int n, i; - GBool recreateFont = gFalse; - GBool doAdjustFontMatrix = gFalse; + bool recreateFont = false; + bool doAdjustFontMatrix = false; - needFontUpdate = gFalse; + needFontUpdate = false; font = nullptr; fileName = nullptr; tmpBuf = nullptr; @@ -2065,14 +2065,14 @@ reload: } else { // gfxFontLocExternal fileName = fontLoc->path; fontType = fontLoc->fontType; - doAdjustFontMatrix = gTrue; + doAdjustFontMatrix = true; } fontsrc = new SplashFontSrc; if (fileName) - fontsrc->setFile(fileName, gFalse); + fontsrc->setFile(fileName, false); else - fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue); + fontsrc->setBuf(tmpBuf, tmpBufLen, true); // load the font file switch (fontType) { @@ -2261,7 +2261,7 @@ reload: w1 /= w2; m11 *= w1; m21 *= w1; - recreateFont = gTrue; + recreateFont = true; } } } @@ -2294,7 +2294,7 @@ void SplashOutputDev::stroke(GfxState *state) { } setOverprintMask(state->getStrokeColorSpace(), state->getStrokeOverprint(), state->getOverprintMode(), state->getStrokeColor()); - SplashPath path = convertPath(state, state->getPath(), gFalse); + SplashPath path = convertPath(state, state->getPath(), false); splash->stroke(&path); } @@ -2304,8 +2304,8 @@ void SplashOutputDev::fill(GfxState *state) { } setOverprintMask(state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), state->getFillColor()); - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->fill(&path, gFalse); + SplashPath path = convertPath(state, state->getPath(), true); + splash->fill(&path, false); } void SplashOutputDev::eoFill(GfxState *state) { @@ -2314,31 +2314,31 @@ void SplashOutputDev::eoFill(GfxState *state) { } setOverprintMask(state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), state->getFillColor()); - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->fill(&path, gTrue); + SplashPath path = convertPath(state, state->getPath(), true); + splash->fill(&path, true); } void SplashOutputDev::clip(GfxState *state) { - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->clipToPath(&path, gFalse); + SplashPath path = convertPath(state, state->getPath(), true); + splash->clipToPath(&path, false); } void SplashOutputDev::eoClip(GfxState *state) { - SplashPath path = convertPath(state, state->getPath(), gTrue); - splash->clipToPath(&path, gTrue); + SplashPath path = convertPath(state, state->getPath(), true); + splash->clipToPath(&path, true); } void SplashOutputDev::clipToStrokePath(GfxState *state) { SplashPath *path2; - SplashPath path = convertPath(state, state->getPath(), gFalse); + SplashPath path = convertPath(state, state->getPath(), false); path2 = splash->makeStrokePath(&path, state->getLineWidth()); - splash->clipToPath(path2, gFalse); + splash->clipToPath(path2, false); delete path2; } SplashPath SplashOutputDev::convertPath(GfxState *state, GfxPath *path, - GBool dropEmptySubpaths) { + bool dropEmptySubpaths) { SplashPath sPath; GfxSubpath *subpath; int n, i, j; @@ -2381,9 +2381,9 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, Unicode *u, int uLen) { SplashPath *path; int render; - GBool doFill, doStroke, doClip, strokeAdjust; + bool doFill, doStroke, doClip, strokeAdjust; double m[4]; - GBool horiz; + bool horiz; if (skipHorizText || skipRotatedText) { state->getFontTransMat(&m[0], &m[1], &m[2], &m[3]); @@ -2428,10 +2428,10 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, // don't use stroke adjustment when stroking text -- the results // tend to be ugly (because characters with horizontal upper or // lower edges get misaligned relative to the other characters) - strokeAdjust = gFalse; // make gcc happy + strokeAdjust = false; // make gcc happy if (doStroke) { strokeAdjust = splash->getStrokeAdjust(); - splash->setStrokeAdjust(gFalse); + splash->setStrokeAdjust(false); } // fill and stroke @@ -2439,7 +2439,7 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, if (path) { setOverprintMask(state->getFillColorSpace(), state->getFillOverprint(), state->getOverprintMode(), state->getFillColor()); - splash->fill(path, gFalse); + splash->fill(path, false); setOverprintMask(state->getStrokeColorSpace(), state->getStrokeOverprint(), state->getOverprintMode(), @@ -2486,7 +2486,7 @@ void SplashOutputDev::drawChar(GfxState *state, double x, double y, } } -GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, +bool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) { GfxFont *gfxFont; @@ -2494,9 +2494,9 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, const double *ctm, *bbox; T3FontCache *t3Font; T3GlyphStack *t3gs; - GBool validBBox; + bool validBBox; double m[4]; - GBool horiz; + bool horiz; double x1, y1, xMin, yMin, xMax, yMax, xt, yt; int i, j; @@ -2504,7 +2504,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, if (state->getRender() == 3) { // this is a bit of cheating, we say yes, font is already on cache // so we actually skip the rendering of it - return gTrue; + return true; } if (skipHorizText || skipRotatedText) { @@ -2512,12 +2512,12 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, horiz = m[0] > 0 && fabs(m[1]) < 0.001 && fabs(m[2]) < 0.001 && m[3] < 0; if ((skipHorizText && horiz) || (skipRotatedText && !horiz)) { - return gTrue; + return true; } } if (!(gfxFont = state->getFont())) { - return gFalse; + return false; } fontID = gfxFont->getID(); ctm = state->getCTM(); @@ -2546,7 +2546,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, while (t3gs != nullptr) { if (t3gs->cache == t3FontCache[nT3Fonts - 1]) { error(errSyntaxWarning, -1, "t3FontCache reaches limit but font still on stack in SplashOutputDev::beginType3Char"); - return gTrue; + return true; } t3gs = t3gs->next; } @@ -2564,7 +2564,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, xMax = xMin + 30; yMax = yt + 15; yMin = yMax - 45; - validBBox = gFalse; + validBBox = false; } else { state->transform(bbox[0], bbox[1], &x1, &y1); xMin = xMax = x1; @@ -2602,7 +2602,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, } else if (y1 > yMax) { yMax = y1; } - validBBox = gTrue; + validBBox = true; } t3FontCache[0] = new T3FontCache(fontID, ctm[0], ctm[1], ctm[2], ctm[3], (int)floor(xMin - xt) - 2, @@ -2623,7 +2623,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, t3Font->cacheTags[i+j].code == code) { drawType3Glyph(state, t3Font, &t3Font->cacheTags[i+j], t3Font->cacheData + (i+j) * t3Font->glyphSize); - return gTrue; + return true; } } } @@ -2636,10 +2636,10 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y, t3GlyphStack->cache = t3Font; t3GlyphStack->cacheTag = nullptr; t3GlyphStack->cacheData = nullptr; - t3GlyphStack->haveDx = gFalse; - t3GlyphStack->doNotCache = gFalse; + t3GlyphStack->haveDx = false; + t3GlyphStack->doNotCache = false; - return gFalse; + return false; } void SplashOutputDev::endType3Char(GfxState *state) { @@ -2667,7 +2667,7 @@ void SplashOutputDev::endType3Char(GfxState *state) { void SplashOutputDev::type3D0(GfxState *state, double wx, double wy) { if (likely(t3GlyphStack != nullptr)) { - t3GlyphStack->haveDx = gTrue; + t3GlyphStack->haveDx = true; } else { error(errSyntaxWarning, -1, "t3GlyphStack was null in SplashOutputDev::type3D0"); } @@ -2684,7 +2684,7 @@ void SplashOutputDev::type3D1(GfxState *state, double wx, double wy, if (!t3GlyphStack || t3GlyphStack->haveDx) { return; } - t3GlyphStack->haveDx = gTrue; + t3GlyphStack->haveDx = true; // don't cache if we got a gsave/grestore before the d1 if (t3GlyphStack->doNotCache) { return; @@ -2781,15 +2781,15 @@ void SplashOutputDev::type3D1(GfxState *state, double wx, double wy, // create the temporary bitmap if (colorMode == splashModeMono1) { bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1, - splashModeMono1, gFalse); - splash = new Splash(bitmap, gFalse, + splashModeMono1, false); + splash = new Splash(bitmap, false, t3GlyphStack->origSplash->getScreen()); color[0] = 0; splash->clear(color); color[0] = 0xff; } else { bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1, - splashModeMono8, gFalse); + splashModeMono8, false); splash = new Splash(bitmap, vectorAntialias, t3GlyphStack->origSplash->getScreen()); color[0] = 0x00; @@ -2819,7 +2819,7 @@ void SplashOutputDev::drawType3Glyph(GfxState *state, T3FontCache *t3Font, glyph.h = t3Font->glyphH; glyph.aa = colorMode != splashModeMono1; glyph.data = data; - glyph.freeData = gFalse; + glyph.freeData = false; splash->fillGlyph(0, 0, &glyph); } @@ -2828,7 +2828,7 @@ void SplashOutputDev::beginTextObject(GfxState *state) { void SplashOutputDev::endTextObject(GfxState *state) { if (textClipPath) { - splash->clipToPath(textClipPath, gFalse); + splash->clipToPath(textClipPath, false); delete textClipPath; textClipPath = nullptr; } @@ -2836,32 +2836,32 @@ void SplashOutputDev::endTextObject(GfxState *state) { struct SplashOutImageMaskData { ImageStream *imgStr; - GBool invert; + bool invert; int width, height, y; }; -GBool SplashOutputDev::imageMaskSrc(void *data, SplashColorPtr line) { +bool SplashOutputDev::imageMaskSrc(void *data, SplashColorPtr line) { SplashOutImageMaskData *imgMaskData = (SplashOutImageMaskData *)data; Guchar *p; SplashColorPtr q; int x; if (imgMaskData->y == imgMaskData->height) { - return gFalse; + return false; } if (!(p = imgMaskData->imgStr->getLine())) { - return gFalse; + return false; } for (x = 0, q = line; x < imgMaskData->width; ++x) { *q++ = *p++ ^ imgMaskData->invert; } ++imgMaskData->y; - return gTrue; + return true; } void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; @@ -2904,8 +2904,8 @@ void SplashOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, - GBool invert, - GBool inlineImg, double *baseMatrix) { + bool invert, + bool inlineImg, double *baseMatrix) { const double *ctm; SplashCoord mat[6]; SplashOutImageMaskData imgMaskData; @@ -2922,7 +2922,7 @@ void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state, if (!std::isfinite(ctm[i])) return; } - beginTransparencyGroup(state, bbox, nullptr, gFalse, gFalse, gFalse); + beginTransparencyGroup(state, bbox, nullptr, false, false, false); baseMatrix[4] -= transpGroupStack->tx; baseMatrix[5] -= transpGroupStack->ty; @@ -2940,7 +2940,7 @@ void SplashOutputDev::setSoftMaskFromImageMask(GfxState *state, imgMaskData.height = height; imgMaskData.y = 0; - transpGroupStack->softmask = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), 1, splashModeMono8, gFalse); + transpGroupStack->softmask = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), 1, splashModeMono8, false); maskSplash = new Splash(transpGroupStack->softmask, vectorAntialias); maskColor[0] = 0; maskSplash->clear(maskColor); @@ -2986,7 +2986,7 @@ struct SplashOutImageData { }; #ifdef USE_CMS -GBool SplashOutputDev::useIccImageSrc(void *data) { +bool SplashOutputDev::useIccImageSrc(void *data) { SplashOutImageData *imgData = (SplashOutImageData *)data; if (!imgData->lookup && imgData->colorMap->getColorSpace()->getMode() == csICCBased) { @@ -2995,24 +2995,24 @@ GBool SplashOutputDev::useIccImageSrc(void *data) { case splashModeMono1: case splashModeMono8: if (colorSpace->getAlt() != nullptr && colorSpace->getAlt()->getMode() == csDeviceGray) - return gTrue; + return true; break; case splashModeXBGR8: case splashModeRGB8: case splashModeBGR8: if (colorSpace->getAlt() != nullptr && colorSpace->getAlt()->getMode() == csDeviceRGB) - return gTrue; + return true; break; #ifdef SPLASH_CMYK case splashModeCMYK8: if (colorSpace->getAlt() != NULL && colorSpace->getAlt()->getMode() == csDeviceCMYK) - return gTrue; + return true; break; #endif } } - return gFalse; + return false; } #endif @@ -3021,7 +3021,7 @@ static inline Guchar clip255(int x) { return x < 0 ? 0 : x > 255 ? 255 : x; } -GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, +bool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, Guchar * /*alphaLine*/) { SplashOutImageData *imgData = (SplashOutImageData *)data; Guchar *p; @@ -3035,7 +3035,7 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, int nComps, x; if (imgData->y == imgData->height) { - return gFalse; + return false; } if (!(p = imgData->imgStr->getLine())) { int destComps = 1; @@ -3050,7 +3050,7 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, destComps = SPOT_NCOMPS + 4; #endif memset(colorLine, 0, imgData->width * destComps); - return gFalse; + return false; } nComps = imgData->colorMap->getNumPixelComps(); @@ -3175,18 +3175,18 @@ GBool SplashOutputDev::imageSrc(void *data, SplashColorPtr colorLine, } } ++imgData->y; - return gTrue; + return true; } #ifdef USE_CMS -GBool SplashOutputDev::iccImageSrc(void *data, SplashColorPtr colorLine, +bool SplashOutputDev::iccImageSrc(void *data, SplashColorPtr colorLine, Guchar * /*alphaLine*/) { SplashOutImageData *imgData = (SplashOutImageData *)data; Guchar *p; int nComps; if (imgData->y == imgData->height) { - return gFalse; + return false; } if (!(p = imgData->imgStr->getLine())) { int destComps = 1; @@ -3201,7 +3201,7 @@ GBool SplashOutputDev::iccImageSrc(void *data, SplashColorPtr colorLine, destComps = SPOT_NCOMPS + 4; #endif memset(colorLine, 0, imgData->width * destComps); - return gFalse; + return false; } if (imgData->colorMode == splashModeXBGR8) { @@ -3219,7 +3219,7 @@ GBool SplashOutputDev::iccImageSrc(void *data, SplashColorPtr colorLine, } ++imgData->y; - return gTrue; + return true; } void SplashOutputDev::iccTransform(void *data, SplashBitmap *bitmap) { @@ -3272,7 +3272,7 @@ void SplashOutputDev::iccTransform(void *data, SplashBitmap *bitmap) { } #endif -GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, +bool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine) { SplashOutImageData *imgData = (SplashOutImageData *)data; Guchar *p, *aq; @@ -3287,10 +3287,10 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, int nComps, x, i; if (imgData->y == imgData->height) { - return gFalse; + return false; } if (!(p = imgData->imgStr->getLine())) { - return gFalse; + return false; } nComps = imgData->colorMap->getNumPixelComps(); @@ -3378,7 +3378,7 @@ GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine, } ++imgData->y; - return gTrue; + return true; } struct TilingSplashOutBitmap { @@ -3391,14 +3391,14 @@ struct TilingSplashOutBitmap { int y; }; -GBool SplashOutputDev::tilingBitmapSrc(void *data, SplashColorPtr colorLine, +bool SplashOutputDev::tilingBitmapSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine) { TilingSplashOutBitmap *imgData = (TilingSplashOutBitmap *)data; if (imgData->y == imgData->bitmap->getHeight()) { imgData->repeatY--; if (imgData->repeatY == 0) - return gFalse; + return false; imgData->y = 0; } @@ -3470,14 +3470,14 @@ GBool SplashOutputDev::tilingBitmapSrc(void *data, SplashColorPtr colorLine, } } ++imgData->y; - return gTrue; + return true; } void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, - int *maskColors, GBool inlineImg) { + bool interpolate, + int *maskColors, bool inlineImg) { SplashCoord mat[6]; SplashOutImageData imgData; SplashColorMode srcMode; @@ -3487,7 +3487,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, GfxRGB rgb; #ifdef SPLASH_CMYK GfxCMYK cmyk; - GBool grayIndexed = gFalse; + bool grayIndexed = false; GfxColor deviceN; #endif Guchar pix; @@ -3564,7 +3564,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, pix = (Guchar)i; colorMap->getCMYK(&pix, &cmyk); if (cmyk.c != 0 || cmyk.m != 0 || cmyk.y != 0) { - grayIndexed = gFalse; + grayIndexed = false; } imgData.lookup[4*i] = colToByte(cmyk.c); imgData.lookup[4*i+1] = colToByte(cmyk.m); @@ -3580,7 +3580,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, pix = (Guchar)i; colorMap->getCMYK(&pix, &cmyk); if (cmyk.c != 0 || cmyk.m != 0 || cmyk.y != 0) { - grayIndexed = gFalse; + grayIndexed = false; } colorMap->getDeviceN(&pix, &deviceN); for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) @@ -3611,7 +3611,7 @@ void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, src = maskColors ? &alphaImageSrc : &imageSrc; tf = NULL; #endif - splash->drawImage(src, tf, &imgData, srcMode, maskColors ? gTrue : gFalse, + splash->drawImage(src, tf, &imgData, srcMode, maskColors ? true : false, width, height, mat, interpolate); if (inlineImg) { while (imgData.y < height) { @@ -3634,7 +3634,7 @@ struct SplashOutMaskedImageData { int width, height, y; }; -GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, +bool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine) { SplashOutMaskedImageData *imgData = (SplashOutMaskedImageData *)data; Guchar *p, *aq; @@ -3651,10 +3651,10 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, int nComps, x; if (imgData->y == imgData->height) { - return gFalse; + return false; } if (!(p = imgData->imgStr->getLine())) { - return gFalse; + return false; } nComps = imgData->colorMap->getNumPixelComps(); @@ -3742,16 +3742,16 @@ GBool SplashOutputDev::maskedImageSrc(void *data, SplashColorPtr colorLine, } ++imgData->y; - return gTrue; + return true; } void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, - int maskHeight, GBool maskInvert, - GBool maskInterpolate) { + int maskHeight, bool maskInvert, + bool maskInterpolate) { GfxImageColorMap *maskColorMap; SplashCoord mat[6]; SplashOutMaskedImageData imgData; @@ -3802,19 +3802,19 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, imgMaskData.width = maskWidth; imgMaskData.height = maskHeight; imgMaskData.y = 0; - maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, gFalse); + maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, false); if (!maskBitmap->getDataPtr()) { delete maskBitmap; width = height = 1; - maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, gFalse); + maskBitmap = new SplashBitmap(width, height, 1, splashModeMono1, false); } - maskSplash = new Splash(maskBitmap, gFalse); + maskSplash = new Splash(maskBitmap, false); maskColor[0] = 0; maskSplash->clear(maskColor); maskColor[0] = 0xff; maskSplash->setFillPattern(new SplashSolidColor(maskColor)); maskSplash->fillImageMask(&imageMaskSrc, &imgMaskData, - maskWidth, maskHeight, mat, gFalse); + maskWidth, maskHeight, mat, false); delete imgMaskData.imgStr; maskStr->close(); delete maskSplash; @@ -3913,7 +3913,7 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, } else { srcMode = colorMode; } - splash->drawImage(&maskedImageSrc, nullptr, &imgData, srcMode, gTrue, + splash->drawImage(&maskedImageSrc, nullptr, &imgData, srcMode, true, width, height, mat, interpolate); delete maskBitmap; gfree(imgData.lookup); @@ -3925,11 +3925,11 @@ void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref, void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) { + bool maskInterpolate) { SplashCoord mat[6]; SplashOutImageData imgData; SplashOutImageData imgMaskData; @@ -3998,11 +3998,11 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */, imgMaskData.lookup[i] = colToByte(gray); } maskBitmap = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), - 1, splashModeMono8, gFalse); + 1, splashModeMono8, false); maskSplash = new Splash(maskBitmap, vectorAntialias); maskColor[0] = 0; maskSplash->clear(maskColor); - maskSplash->drawImage(&imageSrc, nullptr, &imgMaskData, splashModeMono8, gFalse, + maskSplash->drawImage(&imageSrc, nullptr, &imgMaskData, splashModeMono8, false, maskWidth, maskHeight, mat, maskInterpolate); delete imgMaskData.imgStr; if (maskColorMap->getMatteColor() == nullptr) { @@ -4110,7 +4110,7 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */, } else { srcMode = colorMode; } - splash->drawImage(&imageSrc, nullptr, &imgData, srcMode, gFalse, width, height, mat, interpolate); + splash->drawImage(&imageSrc, nullptr, &imgData, srcMode, false, width, height, mat, interpolate); splash->setSoftMask(nullptr); gfree(imgData.lookup); delete imgData.maskStr; @@ -4122,21 +4122,21 @@ void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object * /* ref */, str->close(); } -GBool SplashOutputDev::checkTransparencyGroup(GfxState *state, GBool knockout) { +bool SplashOutputDev::checkTransparencyGroup(GfxState *state, bool knockout) { if (state->getFillOpacity() != 1 || state->getStrokeOpacity() != 1 || state->getAlphaIsShape() || state->getBlendMode() != gfxBlendNormal || splash->getSoftMask() != nullptr || knockout) - return gTrue; + return true; return transpGroupStack != nullptr && transpGroupStack->shape != nullptr; } void SplashOutputDev::beginTransparencyGroup(GfxState *state, const double *bbox, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, - GBool forSoftMask) { + bool isolated, bool knockout, + bool forSoftMask) { SplashTransparencyGroup *transpGroup; SplashColor color; double xMin, yMin, xMax, yMax, x, y; @@ -4250,17 +4250,17 @@ void SplashOutputDev::beginTransparencyGroup(GfxState *state, const double *bbox } // create the temporary bitmap - bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode, gTrue, + bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode, true, bitmapTopDown, bitmap->getSeparationList()); if (!bitmap->getDataPtr()) { delete bitmap; w = h = 1; - bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode, gTrue, bitmapTopDown); + bitmap = new SplashBitmap(w, h, bitmapRowPad, colorMode, true, bitmapTopDown); } splash = new Splash(bitmap, vectorAntialias, transpGroup->origSplash->getScreen()); if (transpGroup->next != nullptr && transpGroup->next->knockout) { - fontEngine->setAA(gFalse); + fontEngine->setAA(false); } splash->setThinLineMode(transpGroup->origSplash->getThinLineMode()); splash->setMinLineWidth(s_minLineWidth); @@ -4307,7 +4307,7 @@ void SplashOutputDev::endTransparencyGroup(GfxState *state) { void SplashOutputDev::paintTransparencyGroup(GfxState *state, const double *bbox) { SplashBitmap *tBitmap; SplashTransparencyGroup *transpGroup; - GBool isolated; + bool isolated; int tx, ty; tx = transpGroupStack->tx; @@ -4320,13 +4320,13 @@ void SplashOutputDev::paintTransparencyGroup(GfxState *state, const double *bbox if (tx < bitmap->getWidth() && ty < bitmap->getHeight()) { SplashCoord knockoutOpacity = (transpGroupStack->next != nullptr) ? transpGroupStack->next->knockoutOpacity : transpGroupStack->knockoutOpacity; - splash->setOverprintMask(0xffffffff, gFalse); + splash->setOverprintMask(0xffffffff, false); splash->composite(tBitmap, 0, 0, tx, ty, tBitmap->getWidth(), tBitmap->getHeight(), - gFalse, !isolated, transpGroupStack->next != nullptr && transpGroupStack->next->knockout, knockoutOpacity); + false, !isolated, transpGroupStack->next != nullptr && transpGroupStack->next->knockout, knockoutOpacity); fontEngine->setAA(transpGroupStack->fontAA); if (transpGroupStack->next != nullptr && transpGroupStack->next->shape != nullptr) { - transpGroupStack->next->knockout = gTrue; + transpGroupStack->next->knockout = true; } } @@ -4343,7 +4343,7 @@ void SplashOutputDev::paintTransparencyGroup(GfxState *state, const double *bbox } void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox, - GBool alpha, Function *transferFunc, + bool alpha, Function *transferFunc, GfxColor *backdropColor) { SplashBitmap *softMask, *tBitmap; Splash *tSplash; @@ -4412,7 +4412,7 @@ void SplashOutputDev::setSoftMask(GfxState *state, const double *bbox, } softMask = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), - 1, splashModeMono8, gFalse); + 1, splashModeMono8, false); unsigned char fill = 0; if (transpGroupStack->blendingColorSpace) { transpGroupStack->blendingColorSpace->getGray(backdropColor, &gray); @@ -4517,24 +4517,24 @@ void SplashOutputDev::clearModRegion() { } #if 1 //~tmp: turn off anti-aliasing temporarily -GBool SplashOutputDev::getVectorAntialias() { +bool SplashOutputDev::getVectorAntialias() { return splash->getVectorAntialias(); } -void SplashOutputDev::setVectorAntialias(GBool vaa) { +void SplashOutputDev::setVectorAntialias(bool vaa) { vaa = vaa && colorMode != splashModeMono1; vectorAntialias = vaa; splash->setVectorAntialias(vaa); } #endif -void SplashOutputDev::setFreeTypeHinting(GBool enable, GBool enableSlightHintingA) +void SplashOutputDev::setFreeTypeHinting(bool enable, bool enableSlightHintingA) { enableFreeTypeHinting = enable; enableSlightHinting = enableSlightHintingA; } -GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, Object *str, +bool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *catalog, Object *str, const double *ptm, int paintType, int /*tilingType*/, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -4552,13 +4552,13 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca const double *ctm; double savedCTM[6]; double kx, ky, sx, sy; - GBool retValue = gFalse; + bool retValue = false; width = bbox[2] - bbox[0]; height = bbox[3] - bbox[1]; if (xStep != width || yStep != height) - return gFalse; + return false; // calculate offsets ctm = state->getCTM(); @@ -4571,7 +4571,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca for (i = 0; i < 6; ++i) { if (!std::isfinite(ctm[i])) { state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); - return gFalse; + return false; } } matc[4] = x0 * xStep * ctm[0] + y0 * yStep * ctm[2] + ctm[4]; @@ -4616,7 +4616,7 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca } else { if ((unsigned long) surface_width * surface_height > 0x800000L) { state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); - return gFalse; + return false; } while(fabs(kx) > 16384 || fabs(ky) > 16384) { // limit pattern bitmap size @@ -4650,22 +4650,22 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca if (surface_width == 0 || surface_height == 0 || repeatX * repeatY <= 4) { state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); - return gFalse; + return false; } m1.transform(bbox[0], bbox[1], &kx, &ky); m1.m[4] = -kx; m1.m[5] = -ky; bitmap = new SplashBitmap(surface_width, surface_height, 1, - (paintType == 1) ? colorMode : splashModeMono8, gTrue); + (paintType == 1) ? colorMode : splashModeMono8, true); if (bitmap->getDataPtr() == nullptr) { SplashBitmap *tBitmap = bitmap; bitmap = formerBitmap; delete tBitmap; state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); - return gFalse; + return false; } - splash = new Splash(bitmap, gTrue); + splash = new Splash(bitmap, true); if (paintType == 2) { SplashColor clearColor; #ifdef SPLASH_CMYK @@ -4717,29 +4717,29 @@ GBool SplashOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *ca matc[1] = ctm[1]; matc[2] = ctm[2]; matc[3] = ctm[3]; - GBool minorAxisZero = matc[1] == 0 && matc[2] == 0; + bool minorAxisZero = matc[1] == 0 && matc[2] == 0; if (matc[0] > 0 && minorAxisZero && matc[3] > 0) { // draw the tiles for (int y = 0; y < imgData.repeatY; ++y) { for (int x = 0; x < imgData.repeatX; ++x) { x0 = splashFloor(matc[4]) + x * tBitmap->getWidth(); y0 = splashFloor(matc[5]) + y * tBitmap->getHeight(); - splash->blitImage(tBitmap, gTrue, x0, y0); + splash->blitImage(tBitmap, true, x0, y0); } } - retValue = gTrue; + retValue = true; } else { - retValue = splash->drawImage(&tilingBitmapSrc, nullptr, &imgData, colorMode, gTrue, result_width, result_height, matc, gFalse, gTrue) == splashOk; + retValue = splash->drawImage(&tilingBitmapSrc, nullptr, &imgData, colorMode, true, result_width, result_height, matc, false, true) == splashOk; } delete tBitmap; delete gfx; return retValue; } -GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) +bool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) { GfxColorSpaceMode shadingMode = shading->getColorSpace()->getMode(); - GBool bDirectColorTranslation = gFalse; // triggers an optimization. + bool bDirectColorTranslation = false; // triggers an optimization. switch (colorMode) { case splashModeRGB8: bDirectColorTranslation = (shadingMode == csDeviceRGB); @@ -4756,24 +4756,24 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria // restore vector antialias because we support it here if (shading->isParameterized()) { SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading); - GBool vaa = getVectorAntialias(); - GBool retVal = gFalse; - setVectorAntialias(gTrue); + bool vaa = getVectorAntialias(); + bool retVal = false; + setVectorAntialias(true); retVal = splash->gouraudTriangleShadedFill(splashShading); setVectorAntialias(vaa); delete splashShading; return retVal; } - return gFalse; + return false; } -GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePattern *pattern, double tMin, double tMax) { +bool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePattern *pattern, double tMin, double tMax) { double xMin, yMin, xMax, yMax; - GBool vaa = getVectorAntialias(); + bool vaa = getVectorAntialias(); // restore vector antialias because we support it here - setVectorAntialias(gTrue); + setVectorAntialias(true); - GBool retVal = gFalse; + bool retVal = false; // get the clip region bbox if (pattern->getShading()->getHasBBox()) { pattern->getShading()->getBBox(&xMin, &yMin, &xMax, &yMax); @@ -4815,7 +4815,7 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat state->lineTo(xMax, yMax); state->lineTo(xMin, yMax); state->closePath(); - SplashPath path = convertPath(state, state->getPath(), gTrue); + SplashPath path = convertPath(state, state->getPath(), true); #ifdef SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); @@ -4829,14 +4829,14 @@ GBool SplashOutputDev::univariateShadedFill(GfxState *state, SplashUnivariatePat return retVal; } -GBool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { +bool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *shading) { SplashFunctionPattern *pattern = new SplashFunctionPattern(colorMode, state, shading); double xMin, yMin, xMax, yMax; - GBool vaa = getVectorAntialias(); + bool vaa = getVectorAntialias(); // restore vector antialias because we support it here - setVectorAntialias(gTrue); + setVectorAntialias(true); - GBool retVal = gFalse; + bool retVal = false; // get the clip region bbox if (pattern->getShading()->getHasBBox()) { pattern->getShading()->getBBox(&xMin, &yMin, &xMax, &yMax); @@ -4878,7 +4878,7 @@ GBool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *s state->lineTo(xMax, yMax); state->lineTo(xMin, yMax); state->closePath(); - SplashPath path = convertPath(state, state->getPath(), gTrue); + SplashPath path = convertPath(state, state->getPath(), true); #ifdef SPLASH_CMYK pattern->getShading()->getColorSpace()->createMapping(bitmap->getSeparationList(), SPOT_NCOMPS); @@ -4894,18 +4894,18 @@ GBool SplashOutputDev::functionShadedFill(GfxState *state, GfxFunctionShading *s return retVal; } -GBool SplashOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { +bool SplashOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { SplashAxialPattern *pattern = new SplashAxialPattern(colorMode, state, shading); - GBool retVal = univariateShadedFill(state, pattern, tMin, tMax); + bool retVal = univariateShadedFill(state, pattern, tMin, tMax); delete pattern; return retVal; } -GBool SplashOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) { +bool SplashOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) { SplashRadialPattern *pattern = new SplashRadialPattern(colorMode, state, shading); - GBool retVal = univariateShadedFill(state, pattern, tMin, tMax); + bool retVal = univariateShadedFill(state, pattern, tMin, tMax); delete pattern; diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index 0e5bef08..59604053 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -65,15 +65,15 @@ public: ~SplashFunctionPattern(); - GBool testPosition(int x, int y) override { return gTrue; } + bool testPosition(int x, int y) override { return true; } - GBool isStatic() override { return gFalse; } + bool isStatic() override { return false; } - GBool getColor(int x, int y, SplashColorPtr c) override; + bool getColor(int x, int y, SplashColorPtr c) override; virtual GfxFunctionShading *getShading() { return shading; } - GBool isCMYK() override { return gfxMode == csDeviceCMYK; } + bool isCMYK() override { return gfxMode == csDeviceCMYK; } protected: Matrix ictm; @@ -91,17 +91,17 @@ public: ~SplashUnivariatePattern(); - GBool getColor(int x, int y, SplashColorPtr c) override; + bool getColor(int x, int y, SplashColorPtr c) override; - GBool testPosition(int x, int y) override; + bool testPosition(int x, int y) override; - GBool isStatic() override { return gFalse; } + bool isStatic() override { return false; } - virtual GBool getParameter(double xs, double ys, double *t) = 0; + virtual bool getParameter(double xs, double ys, double *t) = 0; virtual GfxUnivariateShading *getShading() { return shading; } - GBool isCMYK() override { return gfxMode == csDeviceCMYK; } + bool isCMYK() override { return gfxMode == csDeviceCMYK; } protected: Matrix ictm; @@ -121,7 +121,7 @@ public: ~SplashAxialPattern(); - GBool getParameter(double xs, double ys, double *t) override; + bool getParameter(double xs, double ys, double *t) override; private: double x0, y0, x1, y1; @@ -132,21 +132,21 @@ private: class SplashGouraudPattern: public SplashGouraudColor { public: - SplashGouraudPattern(GBool bDirectColorTranslation, GfxState *state, GfxGouraudTriangleShading *shading); + SplashGouraudPattern(bool bDirectColorTranslation, GfxState *state, GfxGouraudTriangleShading *shading); SplashPattern *copy() override { return new SplashGouraudPattern(bDirectColorTranslation, state, shading); } ~SplashGouraudPattern(); - GBool getColor(int x, int y, SplashColorPtr c) override { return gFalse; } + bool getColor(int x, int y, SplashColorPtr c) override { return false; } - GBool testPosition(int x, int y) override { return gFalse; } + bool testPosition(int x, int y) override { return false; } - GBool isStatic() override { return gFalse; } + bool isStatic() override { return false; } - GBool isCMYK() override { return gfxMode == csDeviceCMYK; } + bool isCMYK() override { return gfxMode == csDeviceCMYK; } - GBool isParameterized() override { return shading->isParameterized(); } + bool isParameterized() override { return shading->isParameterized(); } int getNTriangles() override { return shading->getNTriangles(); } void getTriangle(int i, double *x0, double *y0, double *color0, double *x1, double *y1, double *color1, @@ -158,7 +158,7 @@ public: private: GfxGouraudTriangleShading *shading; GfxState *state; - GBool bDirectColorTranslation; + bool bDirectColorTranslation; GfxColorSpaceMode gfxMode; }; @@ -172,7 +172,7 @@ public: ~SplashRadialPattern(); - GBool getParameter(double xs, double ys, double *t) override; + bool getParameter(double xs, double ys, double *t) override; private: double x0, y0, r0, dx, dy, dr; @@ -193,10 +193,10 @@ public: // Constructor. SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, - GBool reverseVideoA, SplashColorPtr paperColorA, - GBool bitmapTopDownA = gTrue, + bool reverseVideoA, SplashColorPtr paperColorA, + bool bitmapTopDownA = true, SplashThinLineMode thinLineMode = splashThinLineDefault, - GBool overprintPreviewA = globalParams->getOverprintPreview()); + bool overprintPreviewA = globalParams->getOverprintPreview()); // Destructor. ~SplashOutputDev(); @@ -206,24 +206,24 @@ public: // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use functionShadedFill(), axialShadedFill(), and // radialShadedFill()? If this returns false, these shaded fills // will be reduced to a series of other drawing operations. - GBool useShadedFills(int type) override - { return (type >= 1 && type <= 5) ? gTrue : gFalse; } + bool useShadedFills(int type) override + { return (type >= 1 && type <= 5) ? true : false; } // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return bitmapTopDown ^ bitmapUpsideDown; } + bool upsideDown() override { return bitmapTopDown ^ bitmapUpsideDown; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gTrue; } + bool interpretType3Chars() override { return true; } //----- initialization and control @@ -269,15 +269,15 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *catalog, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) override; - GBool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; - GBool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; - GBool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override; - GBool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; + bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override; + bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) override; + bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double tMin, double tMax) override; + bool gouraudTriangleShadedFill(GfxState *state, GfxGouraudTriangleShading *shading) override; //----- path clipping void clip(GfxState *state) override; @@ -289,7 +289,7 @@ public: double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen) override; - GBool beginType3Char(GfxState *state, double x, double y, + bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override; void endType3Char(GfxState *state) override; @@ -298,30 +298,30 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool inlineImg, double *baseMatrix) override; + int width, int height, bool invert, + bool inlineImg, double *baseMatrix) override; void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; //----- Type 3 font operators void type3D0(GfxState *state, double wx, double wy) override; @@ -329,14 +329,14 @@ public: double llx, double lly, double urx, double ury) override; //----- transparency groups and soft masks - GBool checkTransparencyGroup(GfxState *state, GBool knockout) override; + bool checkTransparencyGroup(GfxState *state, bool knockout) override; void beginTransparencyGroup(GfxState *state, const double *bbox, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, - GBool forSoftMask) override; + bool isolated, bool knockout, + bool forSoftMask) override; void endTransparencyGroup(GfxState *state) override; void paintTransparencyGroup(GfxState *state, const double *bbox) override; - void setSoftMask(GfxState *state, const double *bbox, GBool alpha, + void setSoftMask(GfxState *state, const double *bbox, bool alpha, Function *transferFunc, GfxColor *backdropColor) override; void clearSoftMask(GfxState *state) override; @@ -347,8 +347,8 @@ public: void setPaperColor(SplashColorPtr paperColorA); - GBool isReverseVideo() { return reverseVideo; } - void setReverseVideo(GBool reverseVideoA) { reverseVideo = reverseVideoA; } + bool isReverseVideo() { return reverseVideo; } + void setReverseVideo(bool reverseVideoA) { reverseVideo = reverseVideoA; } // Get the bitmap and its size. SplashBitmap *getBitmap() { return bitmap; } @@ -361,7 +361,7 @@ public: // Set this flag to true to generate an upside-down bitmap (useful // for Windows BMP files). - void setBitmapUpsideDown(GBool f) { bitmapUpsideDown = f; } + void setBitmapUpsideDown(bool f) { bitmapUpsideDown = f; } // Get the Splash object. Splash *getSplash() { return splash; } @@ -376,26 +376,26 @@ public: // If <skipTextA> is true, don't draw horizontal text. // If <skipRotatedTextA> is true, don't draw rotated (non-horizontal) text. - void setSkipText(GBool skipHorizTextA, GBool skipRotatedTextA) + void setSkipText(bool skipHorizTextA, bool skipRotatedTextA) { skipHorizText = skipHorizTextA; skipRotatedText = skipRotatedTextA; } int getNestCount() { return nestCount; } #if 1 //~tmp: turn off anti-aliasing temporarily - GBool getVectorAntialias() override; - void setVectorAntialias(GBool vaa) override; + bool getVectorAntialias() override; + void setVectorAntialias(bool vaa) override; #endif - GBool getFontAntialias() { return fontAntialias; } - void setFontAntialias(GBool anti) { fontAntialias = anti; } + bool getFontAntialias() { return fontAntialias; } + void setFontAntialias(bool anti) { fontAntialias = anti; } - void setFreeTypeHinting(GBool enable, GBool enableSlightHinting); + void setFreeTypeHinting(bool enable, bool enableSlightHinting); protected: void doUpdateFont(GfxState *state); private: - GBool univariateShadedFill(GfxState *state, SplashUnivariatePattern *pattern, double tMin, double tMax); + bool univariateShadedFill(GfxState *state, SplashUnivariatePattern *pattern, double tMin, double tMax); void setupScreenParams(double hDPI, double vDPI); SplashPattern *getColor(GfxGray gray); @@ -405,44 +405,44 @@ private: SplashPattern *getColor(GfxColor *deviceN); #endif static void getMatteColor( SplashColorMode colorMode, GfxImageColorMap *colorMap, const GfxColor * matteColor, SplashColor splashMatteColor); - void setOverprintMask(GfxColorSpace *colorSpace, GBool overprintFlag, - int overprintMode, const GfxColor *singleColor, GBool grayIndexed = gFalse); + void setOverprintMask(GfxColorSpace *colorSpace, bool overprintFlag, + int overprintMode, const GfxColor *singleColor, bool grayIndexed = false); SplashPath convertPath(GfxState *state, GfxPath *path, - GBool dropEmptySubpaths); + bool dropEmptySubpaths); void drawType3Glyph(GfxState *state, T3FontCache *t3Font, T3FontCacheTag *tag, Guchar *data); #ifdef USE_CMS - GBool useIccImageSrc(void *data); + bool useIccImageSrc(void *data); static void iccTransform(void *data, SplashBitmap *bitmap); - static GBool iccImageSrc(void *data, SplashColorPtr colorLine, + static bool iccImageSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine); #endif - static GBool imageMaskSrc(void *data, SplashColorPtr line); - static GBool imageSrc(void *data, SplashColorPtr colorLine, + static bool imageMaskSrc(void *data, SplashColorPtr line); + static bool imageSrc(void *data, SplashColorPtr colorLine, Guchar *alphaLine); - static GBool alphaImageSrc(void *data, SplashColorPtr line, + static bool alphaImageSrc(void *data, SplashColorPtr line, Guchar *alphaLine); - static GBool maskedImageSrc(void *data, SplashColorPtr line, + static bool maskedImageSrc(void *data, SplashColorPtr line, Guchar *alphaLine); - static GBool tilingBitmapSrc(void *data, SplashColorPtr line, + static bool tilingBitmapSrc(void *data, SplashColorPtr line, Guchar *alphaLine); - GBool keepAlphaChannel; // don't fill with paper color, keep alpha channel + bool keepAlphaChannel; // don't fill with paper color, keep alpha channel SplashColorMode colorMode; int bitmapRowPad; - GBool bitmapTopDown; - GBool bitmapUpsideDown; - GBool fontAntialias; - GBool vectorAntialias; - GBool overprintPreview; - GBool enableFreeTypeHinting; - GBool enableSlightHinting; - GBool reverseVideo; // reverse video mode + bool bitmapTopDown; + bool bitmapUpsideDown; + bool fontAntialias; + bool vectorAntialias; + bool overprintPreview; + bool enableFreeTypeHinting; + bool enableSlightHinting; + bool reverseVideo; // reverse video mode SplashColor paperColor; // paper color SplashScreenParams screenParams; - GBool skipHorizText; - GBool skipRotatedText; + bool skipHorizText; + bool skipRotatedText; PDFDoc *doc; // the current document XRef *xref; // the xref of the current document @@ -457,7 +457,7 @@ private: T3GlyphStack *t3GlyphStack; // Type 3 glyph context stack SplashFont *font; // current font - GBool needFontUpdate; // set when the font needs to be updated + bool needFontUpdate; // set when the font needs to be updated SplashPath *textClipPath; // clipping path built with text object SplashTransparencyGroup * // transparency group stack diff --git a/poppler/StdinPDFDocBuilder.cc b/poppler/StdinPDFDocBuilder.cc index c7b08b72..e6db77cf 100644 --- a/poppler/StdinPDFDocBuilder.cc +++ b/poppler/StdinPDFDocBuilder.cc @@ -24,17 +24,17 @@ StdinPDFDocBuilder::buildPDFDoc(const GooString &uri, GooString *ownerPassword, GooString *userPassword, void *guiDataA) { CachedFile *cachedFile = new CachedFile(new StdinCacheLoader(), nullptr); - return new PDFDoc(new CachedFileStream(cachedFile, 0, gFalse, + return new PDFDoc(new CachedFileStream(cachedFile, 0, false, cachedFile->getLength(), Object(objNull)), ownerPassword, userPassword); } -GBool StdinPDFDocBuilder::supports(const GooString &uri) +bool StdinPDFDocBuilder::supports(const GooString &uri) { if (uri.cmpN("fd://0", 6) == 0) { - return gTrue; + return true; } else { - return gFalse; + return false; } } diff --git a/poppler/StdinPDFDocBuilder.h b/poppler/StdinPDFDocBuilder.h index 51818e9e..35d14d24 100644 --- a/poppler/StdinPDFDocBuilder.h +++ b/poppler/StdinPDFDocBuilder.h @@ -25,7 +25,7 @@ class StdinPDFDocBuilder : public PDFDocBuilder { public: PDFDoc *buildPDFDoc(const GooString &uri, GooString *ownerPassword = nullptr, GooString *userPassword = nullptr, void *guiDataA = nullptr) override; - GBool supports(const GooString &uri) override; + bool supports(const GooString &uri) override; }; diff --git a/poppler/Stream.cc b/poppler/Stream.cc index 8d423ca7..4c5380e0 100644 --- a/poppler/Stream.cc +++ b/poppler/Stream.cc @@ -79,7 +79,7 @@ #endif #ifdef __DJGPP__ -static GBool setDJSYSFLAGS = gFalse; +static bool setDJSYSFLAGS = false; #endif #ifdef VMS @@ -186,7 +186,7 @@ Stream *Stream::makeFilter(const char *name, Stream *str, Object *params, int re int bits; int early; int encoding; - GBool endOfLine, byteAlign, endOfBlock, black, damagedRowsBeforeError; + bool endOfLine, byteAlign, endOfBlock, black, damagedRowsBeforeError; int columns, rows; Object globals, obj; @@ -222,12 +222,12 @@ Stream *Stream::makeFilter(const char *name, Stream *str, Object *params, int re str = new RunLengthStream(str); } else if (!strcmp(name, "CCITTFaxDecode") || !strcmp(name, "CCF")) { encoding = 0; - endOfLine = gFalse; - byteAlign = gFalse; + endOfLine = false; + byteAlign = false; columns = 1728; rows = 0; - endOfBlock = gTrue; - black = gFalse; + endOfBlock = true; + black = false; damagedRowsBeforeError = 0; if (params->isDict()) { obj = params->dictLookup("K", recursion); @@ -455,19 +455,19 @@ void ImageStream::close() { str->close(); } -GBool ImageStream::getPixel(Guchar *pix) { +bool ImageStream::getPixel(Guchar *pix) { int i; if (imgIdx >= nVals) { if (!getLine()) { - return gFalse; + return false; } imgIdx = 0; } for (i = 0; i < nComps; ++i) { pix[i] = imgLine[imgIdx++]; } - return gTrue; + return true; } Guchar *ImageStream::getLine() { @@ -535,7 +535,7 @@ StreamPredictor::StreamPredictor(Stream *strA, int predictorA, nComps = nCompsA; nBits = nBitsA; predLine = nullptr; - ok = gFalse; + ok = false; nVals = width * nComps; if (width <= 0 || nComps <= 0 || nBits <= 0 || @@ -551,7 +551,7 @@ StreamPredictor::StreamPredictor(Stream *strA, int predictorA, memset(predLine, 0, rowBytes); predIdx = rowBytes; - ok = gTrue; + ok = true; } StreamPredictor::~StreamPredictor() { @@ -597,7 +597,7 @@ int StreamPredictor::getChars(int nChars, Guchar *buffer) { return n; } -GBool StreamPredictor::getNextLine() { +bool StreamPredictor::getNextLine() { int curPred; Guchar upLeftBuf[gfxColorMaxComps * 2 + 1]; int left, up, upLeft, p, pa, pb, pc; @@ -609,7 +609,7 @@ GBool StreamPredictor::getNextLine() { // get PNG optimum predictor number if (predictor >= 10) { if ((curPred = str->getRawChar()) == EOF) { - return gFalse; + return false; } curPred += 10; } else { @@ -633,7 +633,7 @@ GBool StreamPredictor::getNextLine() { break; } delete[] rawCharLine; - return gFalse; + return false; } switch (curPred) { case 11: // PNG sub @@ -718,14 +718,14 @@ GBool StreamPredictor::getNextLine() { // reset to start of line predIdx = pixBytes; - return gTrue; + return true; } //------------------------------------------------------------------------ // FileStream //------------------------------------------------------------------------ -FileStream::FileStream(GooFile* fileA, Goffset startA, GBool limitedA, +FileStream::FileStream(GooFile* fileA, Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA): BaseStream(std::move(dictA), lengthA) { file = fileA; @@ -735,7 +735,7 @@ FileStream::FileStream(GooFile* fileA, Goffset startA, GBool limitedA, bufPtr = bufEnd = buf; bufPos = start; savePos = 0; - saved = gFalse; + saved = false; } FileStream::~FileStream() { @@ -746,7 +746,7 @@ BaseStream *FileStream::copy() { return new FileStream(file, start, limited, length, dict.copy()); } -Stream *FileStream::makeSubStream(Goffset startA, GBool limitedA, +Stream *FileStream::makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) { return new FileStream(file, startA, limitedA, lengthA, std::move(dictA)); } @@ -754,7 +754,7 @@ Stream *FileStream::makeSubStream(Goffset startA, GBool limitedA, void FileStream::reset() { savePos = offset; offset = start; - saved = gTrue; + saved = true; bufPtr = bufEnd = buf; bufPos = start; } @@ -762,17 +762,17 @@ void FileStream::reset() { void FileStream::close() { if (saved) { offset = savePos; - saved = gFalse; + saved = false; } } -GBool FileStream::fillBuf() { +bool FileStream::fillBuf() { int n; bufPos += bufEnd - buf; bufPtr = bufEnd = buf; if (limited && bufPos >= start + length) { - return gFalse; + return false; } if (limited && bufPos + fileStreamBufSize > start + length) { n = start + length - bufPos; @@ -781,14 +781,14 @@ GBool FileStream::fillBuf() { } n = file->read(buf, n, offset); if (n == -1) { - return gFalse; + return false; } offset += n; bufEnd = buf + n; if (bufPtr >= bufEnd) { - return gFalse; + return false; } - return gTrue; + return true; } void FileStream::setPos(Goffset pos, int dir) { @@ -817,7 +817,7 @@ void FileStream::moveStart(Goffset delta) { //------------------------------------------------------------------------ CachedFileStream::CachedFileStream(CachedFile *ccA, Goffset startA, - GBool limitedA, Goffset lengthA, Object &&dictA) + bool limitedA, Goffset lengthA, Object &&dictA) : BaseStream(std::move(dictA), lengthA) { cc = ccA; @@ -827,7 +827,7 @@ CachedFileStream::CachedFileStream(CachedFile *ccA, Goffset startA, bufPtr = bufEnd = buf; bufPos = start; savePos = 0; - saved = gFalse; + saved = false; } CachedFileStream::~CachedFileStream() @@ -841,7 +841,7 @@ BaseStream *CachedFileStream::copy() { return new CachedFileStream(cc, start, limited, length, dict.copy()); } -Stream *CachedFileStream::makeSubStream(Goffset startA, GBool limitedA, +Stream *CachedFileStream::makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) { cc->incRefCnt(); @@ -853,7 +853,7 @@ void CachedFileStream::reset() savePos = (Guint)cc->tell(); cc->seek(start, SEEK_SET); - saved = gTrue; + saved = true; bufPtr = bufEnd = buf; bufPos = start; } @@ -862,18 +862,18 @@ void CachedFileStream::close() { if (saved) { cc->seek(savePos, SEEK_SET); - saved = gFalse; + saved = false; } } -GBool CachedFileStream::fillBuf() +bool CachedFileStream::fillBuf() { int n; bufPos += bufEnd - buf; bufPtr = bufEnd = buf; if (limited && bufPos >= start + length) { - return gFalse; + return false; } if (limited && bufPos + cachedStreamBufSize > start + length) { n = start + length - bufPos; @@ -883,9 +883,9 @@ GBool CachedFileStream::fillBuf() n = cc->read(buf, 1, n); bufEnd = buf + n; if (bufPtr >= bufEnd) { - return gFalse; + return false; } - return gTrue; + return true; } void CachedFileStream::setPos(Goffset pos, int dir) @@ -921,19 +921,19 @@ void CachedFileStream::moveStart(Goffset delta) //------------------------------------------------------------------------ EmbedStream::EmbedStream(Stream *strA, Object &&dictA, - GBool limitedA, Goffset lengthA, GBool reusableA): + bool limitedA, Goffset lengthA, bool reusableA): BaseStream(std::move(dictA), lengthA) { str = strA; limited = limitedA; length = lengthA; reusable = reusableA; - record = gFalse; - replay = gFalse; + record = false; + replay = false; if (reusable) { bufData = (unsigned char*)gmalloc(16384); bufMax = 16384; bufLen = 0; - record = gTrue; + record = true; } } @@ -947,20 +947,20 @@ BaseStream *EmbedStream::copy() { return nullptr; } -Stream *EmbedStream::makeSubStream(Goffset start, GBool limitedA, +Stream *EmbedStream::makeSubStream(Goffset start, bool limitedA, Goffset lengthA, Object &&dictA) { error(errInternal, -1, "Called makeSubStream() on EmbedStream"); return nullptr; } void EmbedStream::rewind() { - record = gFalse; - replay = gTrue; + record = false; + replay = true; bufPos = 0; } void EmbedStream::restore() { - replay = gFalse; + replay = false; } Goffset EmbedStream::getPos() { @@ -1061,7 +1061,7 @@ void EmbedStream::moveStart(Goffset delta) { ASCIIHexStream::ASCIIHexStream(Stream *strA): FilterStream(strA) { buf = EOF; - eof = gFalse; + eof = false; } ASCIIHexStream::~ASCIIHexStream() { @@ -1071,7 +1071,7 @@ ASCIIHexStream::~ASCIIHexStream() { void ASCIIHexStream::reset() { str->reset(); buf = EOF; - eof = gFalse; + eof = false; } int ASCIIHexStream::lookChar() { @@ -1087,7 +1087,7 @@ int ASCIIHexStream::lookChar() { c1 = str->getChar(); } while (isspace(c1)); if (c1 == '>') { - eof = gTrue; + eof = true; buf = EOF; return buf; } @@ -1095,7 +1095,7 @@ int ASCIIHexStream::lookChar() { c2 = str->getChar(); } while (isspace(c2)); if (c2 == '>') { - eof = gTrue; + eof = true; c2 = '0'; } if (c1 >= '0' && c1 <= '9') { @@ -1105,7 +1105,7 @@ int ASCIIHexStream::lookChar() { } else if (c1 >= 'a' && c1 <= 'f') { x = (c1 - 'a' + 10) << 4; } else if (c1 == EOF) { - eof = gTrue; + eof = true; x = 0; } else { error(errSyntaxError, getPos(), @@ -1119,7 +1119,7 @@ int ASCIIHexStream::lookChar() { } else if (c2 >= 'a' && c2 <= 'f') { x += c2 - 'a' + 10; } else if (c2 == EOF) { - eof = gTrue; + eof = true; x = 0; } else { error(errSyntaxError, getPos(), @@ -1142,8 +1142,8 @@ GooString *ASCIIHexStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool ASCIIHexStream::isBinary(GBool last) { - return str->isBinary(gFalse); +bool ASCIIHexStream::isBinary(bool last) { + return str->isBinary(false); } //------------------------------------------------------------------------ @@ -1153,7 +1153,7 @@ GBool ASCIIHexStream::isBinary(GBool last) { ASCII85Stream::ASCII85Stream(Stream *strA): FilterStream(strA) { index = n = 0; - eof = gFalse; + eof = false; } ASCII85Stream::~ASCII85Stream() { @@ -1163,7 +1163,7 @@ ASCII85Stream::~ASCII85Stream() { void ASCII85Stream::reset() { str->reset(); index = n = 0; - eof = gFalse; + eof = false; } int ASCII85Stream::lookChar() { @@ -1178,7 +1178,7 @@ int ASCII85Stream::lookChar() { c[0] = str->getChar(); } while (Lexer::isSpace(c[0])); if (c[0] == '~' || c[0] == EOF) { - eof = gTrue; + eof = true; n = 0; return EOF; } else if (c[0] == 'z') { @@ -1196,7 +1196,7 @@ int ASCII85Stream::lookChar() { if (k < 5 && (c[k] == '~' || c[k] == EOF)) { for (++k; k < 5; ++k) c[k] = 0x21 + 84; - eof = gTrue; + eof = true; } t = 0; for (k = 0; k < 5; ++k) @@ -1223,8 +1223,8 @@ GooString *ASCII85Stream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool ASCII85Stream::isBinary(GBool last) { - return str->isBinary(gFalse); +bool ASCII85Stream::isBinary(bool last) { + return str->isBinary(false); } //------------------------------------------------------------------------ @@ -1244,7 +1244,7 @@ LZWStream::LZWStream(Stream *strA, int predictor, int columns, int colors, pred = nullptr; } early = earlyA; - eof = gFalse; + eof = false; inputBits = 0; clearTable(); } @@ -1324,27 +1324,27 @@ int LZWStream::getChars(int nChars, Guchar *buffer) { void LZWStream::reset() { str->reset(); - eof = gFalse; + eof = false; inputBits = 0; clearTable(); } -GBool LZWStream::processNextCode() { +bool LZWStream::processNextCode() { int code; int nextLength; int i, j; // check for EOF if (eof) { - return gFalse; + return false; } // check for eod and clear-table codes start: code = getCode(); if (code == EOF || code == 257) { - eof = gTrue; - return gFalse; + eof = true; + return false; } if (code == 256) { clearTable(); @@ -1368,12 +1368,12 @@ GBool LZWStream::processNextCode() { ++seqLength; } else { error(errSyntaxError, getPos(), "Bad LZW stream - unexpected code"); - eof = gTrue; - return gFalse; + eof = true; + return false; } newChar = seqBuf[0]; if (first) { - first = gFalse; + first = false; } else { if (nextCode < 4097) { table[nextCode].length = nextLength; @@ -1393,14 +1393,14 @@ GBool LZWStream::processNextCode() { // reset buffer seqIndex = 0; - return gTrue; + return true; } void LZWStream::clearTable() { nextCode = 258; nextBits = 9; seqIndex = seqLength = 0; - first = gTrue; + first = true; newChar = 0; } @@ -1436,8 +1436,8 @@ GooString *LZWStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool LZWStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool LZWStream::isBinary(bool last) { + return str->isBinary(true); } //------------------------------------------------------------------------ @@ -1447,7 +1447,7 @@ GBool LZWStream::isBinary(GBool last) { RunLengthStream::RunLengthStream(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; - eof = gFalse; + eof = false; } RunLengthStream::~RunLengthStream() { @@ -1457,7 +1457,7 @@ RunLengthStream::~RunLengthStream() { void RunLengthStream::reset() { str->reset(); bufPtr = bufEnd = buf; - eof = gFalse; + eof = false; } int RunLengthStream::getChars(int nChars, Guchar *buffer) { @@ -1494,20 +1494,20 @@ GooString *RunLengthStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool RunLengthStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool RunLengthStream::isBinary(bool last) { + return str->isBinary(true); } -GBool RunLengthStream::fillBuf() { +bool RunLengthStream::fillBuf() { int c; int n, i; if (eof) - return gFalse; + return false; c = str->getChar(); if (c == 0x80 || c == EOF) { - eof = gTrue; - return gFalse; + eof = true; + return false; } if (c < 0x80) { n = c + 1; @@ -1521,16 +1521,16 @@ GBool RunLengthStream::fillBuf() { } bufPtr = buf; bufEnd = buf + n; - return gTrue; + return true; } //------------------------------------------------------------------------ // CCITTFaxStream //------------------------------------------------------------------------ -CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA, - GBool byteAlignA, int columnsA, int rowsA, - GBool endOfBlockA, GBool blackA, int damagedRowsBeforeErrorA): +CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, bool endOfLineA, + bool byteAlignA, int columnsA, int rowsA, + bool endOfBlockA, bool blackA, int damagedRowsBeforeErrorA): FilterStream(strA) { encoding = encodingA; endOfLine = endOfLineA; @@ -1553,10 +1553,10 @@ CCITTFaxStream::CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA, refLine = (int *)gmallocn_checkoverflow(columns + 2, sizeof(int)); if (codingLine != nullptr && refLine != nullptr) { - eof = gFalse; + eof = false; codingLine[0] = columns; } else { - eof = gTrue; + eof = true; } row = 0; nextLine2D = encoding < 0; @@ -1573,7 +1573,7 @@ CCITTFaxStream::~CCITTFaxStream() { gfree(codingLine); } -void CCITTFaxStream::ccittReset(GBool unfiltered) { +void CCITTFaxStream::ccittReset(bool unfiltered) { if (unfiltered) str->unfilteredReset(); else @@ -1588,19 +1588,19 @@ void CCITTFaxStream::ccittReset(GBool unfiltered) { } void CCITTFaxStream::unfilteredReset() { - ccittReset(gTrue); + ccittReset(true); } void CCITTFaxStream::reset() { int code1; - ccittReset(gFalse); + ccittReset(false); if (codingLine != nullptr && refLine != nullptr) { - eof = gFalse; + eof = false; codingLine[0] = columns; } else { - eof = gTrue; + eof = true; } // skip any initial zero bits and end-of-line marker, and get the 2D @@ -1610,7 +1610,7 @@ void CCITTFaxStream::reset() { } if (code1 == 0x001) { eatBits(12); - endOfLine = gTrue; + endOfLine = true; } if (encoding > 0) { nextLine2D = !lookBits(1); @@ -1623,7 +1623,7 @@ inline void CCITTFaxStream::addPixels(int a1, int blackPixels) { if (a1 > columns) { error(errSyntaxError, getPos(), "CCITTFax row is wrong length ({0:d})", a1); - err = gTrue; + err = true; a1 = columns; } if ((a0i & 1) ^ blackPixels) { @@ -1638,7 +1638,7 @@ inline void CCITTFaxStream::addPixelsNeg(int a1, int blackPixels) { if (a1 > columns) { error(errSyntaxError, getPos(), "CCITTFax row is wrong length ({0:d})", a1); - err = gTrue; + err = true; a1 = columns; } if ((a0i & 1) ^ blackPixels) { @@ -1648,7 +1648,7 @@ inline void CCITTFaxStream::addPixelsNeg(int a1, int blackPixels) { } else if (a1 < codingLine[a0i]) { if (a1 < 0) { error(errSyntaxError, getPos(), "Invalid CCITTFax code"); - err = gTrue; + err = true; a1 = 0; } while (a0i > 0 && a1 <= codingLine[a0i - 1]) { @@ -1661,7 +1661,7 @@ inline void CCITTFaxStream::addPixelsNeg(int a1, int blackPixels) { int CCITTFaxStream::lookChar() { int code1, code2, code3; int b1i, blackPixels, i, bits; - GBool gotEOL; + bool gotEOL; if (buf != EOF) { return buf; @@ -1675,7 +1675,7 @@ int CCITTFaxStream::lookChar() { return EOF; } - err = gFalse; + err = false; // 2-D encoding if (nextLine2D) { @@ -1733,7 +1733,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1742,7 +1742,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixels(refLine[b1i] + 3, blackPixels); @@ -1754,7 +1754,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1764,7 +1764,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixels(refLine[b1i] + 2, blackPixels); @@ -1776,7 +1776,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1786,7 +1786,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixels(refLine[b1i] + 1, blackPixels); @@ -1798,7 +1798,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1808,7 +1808,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixels(refLine[b1i], blackPixels); @@ -1820,7 +1820,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1830,7 +1830,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixelsNeg(refLine[b1i] - 3, blackPixels); @@ -1846,7 +1846,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1856,7 +1856,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixelsNeg(refLine[b1i] - 2, blackPixels); @@ -1872,7 +1872,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1882,7 +1882,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } addPixelsNeg(refLine[b1i] - 1, blackPixels); @@ -1898,7 +1898,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(b1i > columns + 1)) { error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); - err = gTrue; + err = true; break; } } @@ -1906,13 +1906,13 @@ int CCITTFaxStream::lookChar() { break; case EOF: addPixels(columns, 0); - eof = gTrue; + eof = true; break; default: error(errSyntaxError, getPos(), "Bad 2D code {0:04x} in CCITTFax stream", code1); addPixels(columns, 0); - err = gTrue; + err = true; break; } } @@ -1944,9 +1944,9 @@ int CCITTFaxStream::lookChar() { // row i are set to zero, and the first 11-n bits in row i+1 // happen to be zero -- so we don't look for EOL markers in this // case) - gotEOL = gFalse; + gotEOL = false; if (!endOfBlock && row == rows - 1) { - eof = gTrue; + eof = true; } else if (endOfLine || !byteAlign) { code1 = lookBits(12); if (endOfLine) { @@ -1962,7 +1962,7 @@ int CCITTFaxStream::lookChar() { } if (code1 == 0x001) { eatBits(12); - gotEOL = gTrue; + gotEOL = true; } } @@ -1980,7 +1980,7 @@ int CCITTFaxStream::lookChar() { // check for end of stream if (lookBits(1) == EOF) { - eof = gTrue; + eof = true; } // get 2D encoding tag @@ -1996,7 +1996,7 @@ int CCITTFaxStream::lookChar() { code1 = lookBits(24); if (code1 == 0x001001) { eatBits(12); - gotEOL = gTrue; + gotEOL = true; } } if (endOfBlock && gotEOL) { @@ -2021,7 +2021,7 @@ int CCITTFaxStream::lookChar() { } } } - eof = gTrue; + eof = true; } // look for an end-of-line marker after an error -- we only do @@ -2031,7 +2031,7 @@ int CCITTFaxStream::lookChar() { while (1) { code1 = lookBits(13); if (code1 == EOF) { - eof = gTrue; + eof = true; return EOF; } if ((code1 >> 1) == 0x001) { @@ -2087,7 +2087,7 @@ int CCITTFaxStream::lookChar() { if (unlikely(a0i > columns)) { error(errSyntaxError, getPos(), "Bad bits {0:04x} in CCITTFax stream", bits); - err = gTrue; + err = true; break; } outputBits = codingLine[a0i] - codingLine[a0i - 1]; @@ -2329,8 +2329,8 @@ GooString *CCITTFaxStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool CCITTFaxStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool CCITTFaxStream::isBinary(bool last) { + return str->isBinary(true); } #ifndef ENABLE_LIBJPEG @@ -2385,7 +2385,7 @@ DCTStream::DCTStream(Stream *strA, int colorXformA, Dict *dict, int recursion): int i, j; colorXform = colorXformA; - progressive = interleaved = gFalse; + progressive = interleaved = false; width = height = 0; mcuWidth = mcuHeight = 0; numComps = 0; @@ -2414,31 +2414,31 @@ DCTStream::~DCTStream() { delete str; } -void DCTStream::dctReset(GBool unfiltered) { +void DCTStream::dctReset(bool unfiltered) { if (unfiltered) str->unfilteredReset(); else str->reset(); - progressive = interleaved = gFalse; + progressive = interleaved = false; width = height = 0; numComps = 0; numQuantTables = 0; numDCHuffTables = 0; numACHuffTables = 0; - gotJFIFMarker = gFalse; - gotAdobeMarker = gFalse; + gotJFIFMarker = false; + gotAdobeMarker = false; restartInterval = 0; } void DCTStream::unfilteredReset() { - dctReset(gTrue); + dctReset(true); } void DCTStream::reset() { int i, j; - dctReset(gFalse); + dctReset(false); if (!readHeader()) { y = height; @@ -2617,7 +2617,7 @@ void DCTStream::restart() { } // Read one row of MCUs from a sequential JPEG stream. -GBool DCTStream::readMCURow() { +bool DCTStream::readMCURow() { int data1[64]; Guchar data2[64]; Guchar *p1, *p2; @@ -2634,7 +2634,7 @@ GBool DCTStream::readMCURow() { if (c != restartMarker) { error(errSyntaxError, getPos(), "Bad DCT data: incorrect restart marker"); - return gFalse; + return false; } if (++restartMarker == 0xd8) restartMarker = 0xd0; @@ -2652,13 +2652,13 @@ GBool DCTStream::readMCURow() { for (y2 = 0; y2 < mcuHeight; y2 += vert) { for (x2 = 0; x2 < mcuWidth; x2 += horiz) { if (unlikely(scanInfo.dcHuffTable[cc] >= 4) || unlikely(scanInfo.acHuffTable[cc] >= 4)) { - return gFalse; + return false; } if (!readDataUnit(&dcHuffTables[scanInfo.dcHuffTable[cc]], &acHuffTables[scanInfo.acHuffTable[cc]], &compInfo[cc].prevDC, data1)) { - return gFalse; + return false; } transformDataUnit(quantTables[compInfo[cc].quantTable], data1, data2); @@ -2738,7 +2738,7 @@ GBool DCTStream::readMCURow() { } } } - return gTrue; + return true; } // Read one scan from a progressive or non-interleaved JPEG stream. @@ -2847,7 +2847,7 @@ void DCTStream::readScan() { } // Read one data unit from a sequential JPEG stream. -GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, +bool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]) { int run, size, amp; @@ -2855,11 +2855,11 @@ GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, int i, j; if ((size = readHuffSym(dcHuffTable)) == 9999) { - return gFalse; + return false; } if (size > 0) { if ((amp = readAmp(size)) == 9999) { - return gFalse; + return false; } } else { amp = 0; @@ -2875,7 +2875,7 @@ GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, run += 0x10; } if (c == 9999) { - return gFalse; + return false; } if (c == 0x00) { break; @@ -2884,7 +2884,7 @@ GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, size = c & 0x0f; amp = readAmp(size); if (amp == 9999) { - return gFalse; + return false; } i += run; if (i < 64) { @@ -2893,11 +2893,11 @@ GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, } } } - return gTrue; + return true; } // Read one data unit from a sequential JPEG stream. -GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, +bool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]) { int run, size, amp, bit, c; @@ -2908,11 +2908,11 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, if (i == 0) { if (scanInfo.ah == 0) { if ((size = readHuffSym(dcHuffTable)) == 9999) { - return gFalse; + return false; } if (size > 0) { if ((amp = readAmp(size)) == 9999) { - return gFalse; + return false; } } else { amp = 0; @@ -2920,14 +2920,14 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, data[0] += (*prevDC += amp) << scanInfo.al; } else { if ((bit = readBit()) == 9999) { - return gFalse; + return false; } data[0] += bit << scanInfo.al; } ++i; } if (scanInfo.lastCoeff == 0) { - return gTrue; + return true; } // check for an EOB run @@ -2936,7 +2936,7 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, j = dctZigZag[i++]; if (data[j] != 0) { if ((bit = readBit()) == EOF) { - return gFalse; + return false; } if (bit) { data[j] += 1 << scanInfo.al; @@ -2944,13 +2944,13 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, } } --eobRun; - return gTrue; + return true; } // read the AC coefficients while (i <= scanInfo.lastCoeff) { if ((c = readHuffSym(acHuffTable)) == 9999) { - return gFalse; + return false; } // ZRL @@ -2962,7 +2962,7 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, ++k; } else { if ((bit = readBit()) == EOF) { - return gFalse; + return false; } if (bit) { data[j] += 1 << scanInfo.al; @@ -2976,7 +2976,7 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, eobRun = 0; for (k = 0; k < j; ++k) { if ((bit = readBit()) == EOF) { - return gFalse; + return false; } eobRun = (eobRun << 1) | bit; } @@ -2985,7 +2985,7 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, j = dctZigZag[i++]; if (data[j] != 0) { if ((bit = readBit()) == EOF) { - return gFalse; + return false; } if (bit) { data[j] += 1 << scanInfo.al; @@ -3000,14 +3000,14 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, run = (c >> 4) & 0x0f; size = c & 0x0f; if ((amp = readAmp(size)) == 9999) { - return gFalse; + return false; } j = 0; // make gcc happy for (k = 0; k <= run && i <= scanInfo.lastCoeff; ++k) { j = dctZigZag[i++]; while (data[j] != 0 && i <= scanInfo.lastCoeff) { if ((bit = readBit()) == EOF) { - return gFalse; + return false; } if (bit) { data[j] += 1 << scanInfo.al; @@ -3019,7 +3019,7 @@ GBool DCTStream::readProgressiveDataUnit(DCTHuffTable *dcHuffTable, } } - return gTrue; + return true; } // Decode a progressive JPEG image. @@ -3391,66 +3391,66 @@ int DCTStream::readBit() { return bit; } -GBool DCTStream::readHeader() { - GBool doScan; +bool DCTStream::readHeader() { + bool doScan; int n; int c = 0; int i; // read headers - doScan = gFalse; + doScan = false; while (!doScan) { c = readMarker(); switch (c) { case 0xc0: // SOF0 (sequential) case 0xc1: // SOF1 (extended sequential) if (!readBaselineSOF()) { - return gFalse; + return false; } break; case 0xc2: // SOF2 (progressive) if (!readProgressiveSOF()) { - return gFalse; + return false; } break; case 0xc4: // DHT if (!readHuffmanTables()) { - return gFalse; + return false; } break; case 0xd8: // SOI break; case 0xd9: // EOI - return gFalse; + return false; case 0xda: // SOS if (!readScanInfo()) { - return gFalse; + return false; } - doScan = gTrue; + doScan = true; break; case 0xdb: // DQT if (!readQuantTables()) { - return gFalse; + return false; } break; case 0xdd: // DRI if (!readRestartInterval()) { - return gFalse; + return false; } break; case 0xe0: // APP0 if (!readJFIFMarker()) { - return gFalse; + return false; } break; case 0xee: // APP14 if (!readAdobeMarker()) { - return gFalse; + return false; } break; case EOF: error(errSyntaxError, getPos(), "Bad DCT header"); - return gFalse; + return false; default: // skip APPn / COM / etc. if (c >= 0xe0) { @@ -3460,16 +3460,16 @@ GBool DCTStream::readHeader() { } } else { error(errSyntaxError, getPos(), "Unknown DCT marker <{0:02x}>", c); - return gFalse; + return false; } break; } } - return gTrue; + return true; } -GBool DCTStream::readBaselineSOF() { +bool DCTStream::readBaselineSOF() { int length; int prec; int i; @@ -3483,11 +3483,11 @@ GBool DCTStream::readBaselineSOF() { if (numComps <= 0 || numComps > 4) { error(errSyntaxError, getPos(), "Bad number of components in DCT stream"); numComps = 0; - return gFalse; + return false; } if (prec != 8) { error(errSyntaxError, getPos(), "Bad DCT precision {0:d}", prec); - return gFalse; + return false; } for (i = 0; i < numComps; ++i) { compInfo[i].id = str->getChar(); @@ -3498,18 +3498,18 @@ GBool DCTStream::readBaselineSOF() { if (compInfo[i].hSample < 1 || compInfo[i].hSample > 4 || compInfo[i].vSample < 1 || compInfo[i].vSample > 4) { error(errSyntaxError, getPos(), "Bad DCT sampling factor"); - return gFalse; + return false; } if (compInfo[i].quantTable < 0 || compInfo[i].quantTable > 3) { error(errSyntaxError, getPos(), "Bad DCT quant table selector"); - return gFalse; + return false; } } - progressive = gFalse; - return gTrue; + progressive = false; + return true; } -GBool DCTStream::readProgressiveSOF() { +bool DCTStream::readProgressiveSOF() { int length; int prec; int i; @@ -3524,11 +3524,11 @@ GBool DCTStream::readProgressiveSOF() { if (numComps <= 0 || numComps > 4) { error(errSyntaxError, getPos(), "Bad number of components in DCT stream"); numComps = 0; - return gFalse; + return false; } if (prec != 8) { error(errSyntaxError, getPos(), "Bad DCT precision {0:d}", prec); - return gFalse; + return false; } for (i = 0; i < numComps; ++i) { compInfo[i].id = str->getChar(); @@ -3539,18 +3539,18 @@ GBool DCTStream::readProgressiveSOF() { if (compInfo[i].hSample < 1 || compInfo[i].hSample > 4 || compInfo[i].vSample < 1 || compInfo[i].vSample > 4) { error(errSyntaxError, getPos(), "Bad DCT sampling factor"); - return gFalse; + return false; } if (compInfo[i].quantTable < 0 || compInfo[i].quantTable > 3) { error(errSyntaxError, getPos(), "Bad DCT quant table selector"); - return gFalse; + return false; } } - progressive = gTrue; - return gTrue; + progressive = true; + return true; } -GBool DCTStream::readScanInfo() { +bool DCTStream::readScanInfo() { int length; int id, c; int i, j; @@ -3560,16 +3560,16 @@ GBool DCTStream::readScanInfo() { if (scanInfo.numComps <= 0 || scanInfo.numComps > 4) { error(errSyntaxError, getPos(), "Bad number of components in DCT stream"); scanInfo.numComps = 0; - return gFalse; + return false; } --length; if (length != 2 * scanInfo.numComps + 3) { error(errSyntaxError, getPos(), "Bad DCT scan info block"); - return gFalse; + return false; } interleaved = scanInfo.numComps == numComps; for (j = 0; j < numComps; ++j) { - scanInfo.comp[j] = gFalse; + scanInfo.comp[j] = false; scanInfo.dcHuffTable[j] = 0; scanInfo.acHuffTable[j] = 0; } @@ -3589,10 +3589,10 @@ GBool DCTStream::readScanInfo() { if (j == numComps) { error(errSyntaxError, getPos(), "Bad DCT component ID in scan info block"); - return gFalse; + return false; } } - scanInfo.comp[j] = gTrue; + scanInfo.comp[j] = true; c = str->getChar(); scanInfo.dcHuffTable[j] = (c >> 4) & 0x0f; scanInfo.acHuffTable[j] = c & 0x0f; @@ -3603,15 +3603,15 @@ GBool DCTStream::readScanInfo() { scanInfo.firstCoeff > scanInfo.lastCoeff) { error(errSyntaxError, getPos(), "Bad DCT coefficient numbers in scan info block"); - return gFalse; + return false; } c = str->getChar(); scanInfo.ah = (c >> 4) & 0x0f; scanInfo.al = c & 0x0f; - return gTrue; + return true; } -GBool DCTStream::readQuantTables() { +bool DCTStream::readQuantTables() { int length, prec, i, index; length = read16() - 2; @@ -3621,7 +3621,7 @@ GBool DCTStream::readQuantTables() { index &= 0x0f; if (prec > 1 || index >= 4) { error(errSyntaxError, getPos(), "Bad DCT quantization table"); - return gFalse; + return false; } if (index == numQuantTables) { numQuantTables = index + 1; @@ -3639,10 +3639,10 @@ GBool DCTStream::readQuantTables() { length -= 65; } } - return gTrue; + return true; } -GBool DCTStream::readHuffmanTables() { +bool DCTStream::readHuffmanTables() { DCTHuffTable *tbl; int length; int index; @@ -3657,7 +3657,7 @@ GBool DCTStream::readHuffmanTables() { --length; if ((index & 0x0f) >= 4) { error(errSyntaxError, getPos(), "Bad DCT Huffman table"); - return gFalse; + return false; } if (index & 0x10) { index &= 0x0f; @@ -3685,22 +3685,22 @@ GBool DCTStream::readHuffmanTables() { tbl->sym[i] = str->getChar(); length -= sym; } - return gTrue; + return true; } -GBool DCTStream::readRestartInterval() { +bool DCTStream::readRestartInterval() { int length; length = read16(); if (length != 4) { error(errSyntaxError, getPos(), "Bad DCT restart interval"); - return gFalse; + return false; } restartInterval = read16(); - return gTrue; + return true; } -GBool DCTStream::readJFIFMarker() { +bool DCTStream::readJFIFMarker() { int length, i; char buf[5]; int c; @@ -3711,26 +3711,26 @@ GBool DCTStream::readJFIFMarker() { for (i = 0; i < 5; ++i) { if ((c = str->getChar()) == EOF) { error(errSyntaxError, getPos(), "Bad DCT APP0 marker"); - return gFalse; + return false; } buf[i] = c; } length -= 5; if (!memcmp(buf, "JFIF\0", 5)) { - gotJFIFMarker = gTrue; + gotJFIFMarker = true; } } while (length > 0) { if (str->getChar() == EOF) { error(errSyntaxError, getPos(), "Bad DCT APP0 marker"); - return gFalse; + return false; } --length; } - return gTrue; + return true; } -GBool DCTStream::readAdobeMarker() { +bool DCTStream::readAdobeMarker() { int length, i; char buf[12]; int c; @@ -3749,28 +3749,28 @@ GBool DCTStream::readAdobeMarker() { goto err; } colorXform = buf[11]; - gotAdobeMarker = gTrue; + gotAdobeMarker = true; for (i = 14; i < length; ++i) { if (str->getChar() == EOF) { goto err; } } - return gTrue; + return true; err: error(errSyntaxError, getPos(), "Bad DCT Adobe APP14 marker"); - return gFalse; + return false; } -GBool DCTStream::readTrailer() { +bool DCTStream::readTrailer() { int c; c = readMarker(); if (c != 0xd9) { // EOI error(errSyntaxError, getPos(), "Bad DCT trailer"); - return gFalse; + return false; } - return gTrue; + return true; } int DCTStream::readMarker() { @@ -3810,8 +3810,8 @@ GooString *DCTStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool DCTStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool DCTStream::isBinary(bool last) { + return str->isBinary(true); } #endif @@ -4480,7 +4480,7 @@ FlateStream::~FlateStream() { delete str; } -void FlateStream::flateReset(GBool unfiltered) { +void FlateStream::flateReset(bool unfiltered) { if (unfiltered) str->unfilteredReset(); else @@ -4490,23 +4490,23 @@ void FlateStream::flateReset(GBool unfiltered) { remain = 0; codeBuf = 0; codeSize = 0; - compressedBlock = gFalse; - endOfBlock = gTrue; - eof = gTrue; + compressedBlock = false; + endOfBlock = true; + eof = true; } void FlateStream::unfilteredReset() { - flateReset(gTrue); + flateReset(true); } void FlateStream::reset() { int cmf, flg; - flateReset(gFalse); + flateReset(false); // read header //~ need to look at window size? - endOfBlock = eof = gTrue; + endOfBlock = eof = true; cmf = str->getChar(); flg = str->getChar(); if (cmf == EOF || flg == EOF) @@ -4524,7 +4524,7 @@ void FlateStream::reset() { return; } - eof = gFalse; + eof = false; } int FlateStream::getChar() { @@ -4584,8 +4584,8 @@ GooString *FlateStream::getPSFilter(int psLevel, const char *indent) { return s; } -GBool FlateStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool FlateStream::isBinary(bool last) { + return str->isBinary(true); } void FlateStream::readSome() { @@ -4606,7 +4606,7 @@ void FlateStream::readSome() { buf[index] = code1; remain = 1; } else if (code1 == 256) { - endOfBlock = gTrue; + endOfBlock = true; remain = 0; } else { code1 -= 257; @@ -4634,7 +4634,7 @@ void FlateStream::readSome() { len = (blockLen < flateWindow) ? blockLen : flateWindow; for (i = 0, j = index; i < len; ++i, j = (j + 1) & flateMask) { if ((c = str->getChar()) == EOF) { - endOfBlock = eof = gTrue; + endOfBlock = eof = true; break; } buf[j] = c & 0xff; @@ -4642,18 +4642,18 @@ void FlateStream::readSome() { remain = i; blockLen -= len; if (blockLen == 0) - endOfBlock = gTrue; + endOfBlock = true; } return; err: error(errSyntaxError, getPos(), "Unexpected end of file in flate stream"); - endOfBlock = eof = gTrue; + endOfBlock = eof = true; remain = 0; } -GBool FlateStream::startBlock() { +bool FlateStream::startBlock() { int blockHdr; int c; int check; @@ -4671,12 +4671,12 @@ GBool FlateStream::startBlock() { // read block header blockHdr = getCodeWord(3); if (blockHdr & 1) - eof = gTrue; + eof = true; blockHdr >>= 1; // uncompressed block if (blockHdr == 0) { - compressedBlock = gFalse; + compressedBlock = false; if ((c = str->getChar()) == EOF) goto err; blockLen = c & 0xff; @@ -4696,12 +4696,12 @@ GBool FlateStream::startBlock() { // compressed block with fixed codes } else if (blockHdr == 1) { - compressedBlock = gTrue; + compressedBlock = true; loadFixedCodes(); // compressed block with dynamic codes } else if (blockHdr == 2) { - compressedBlock = gTrue; + compressedBlock = true; if (!readDynamicCodes()) { goto err; } @@ -4711,13 +4711,13 @@ GBool FlateStream::startBlock() { goto err; } - endOfBlock = gFalse; - return gTrue; + endOfBlock = false; + return true; err: error(errSyntaxError, getPos(), "Bad block header in flate stream"); - endOfBlock = eof = gTrue; - return gFalse; + endOfBlock = eof = true; + return false; } void FlateStream::loadFixedCodes() { @@ -4727,7 +4727,7 @@ void FlateStream::loadFixedCodes() { distCodeTab.maxLen = fixedDistCodeTab.maxLen; } -GBool FlateStream::readDynamicCodes() { +bool FlateStream::readDynamicCodes() { int numCodeLenCodes; int numLitCodes; int numDistCodes; @@ -4819,12 +4819,12 @@ GBool FlateStream::readDynamicCodes() { compHuffmanCodes(codeLengths + numLitCodes, numDistCodes, &distCodeTab); gfree(codeLenCodeTab.codes); - return gTrue; + return true; err: error(errSyntaxError, getPos(), "Bad dynamic code table in flate stream"); gfree(codeLenCodeTab.codes); - return gFalse; + return false; } // Convert an array <lengths> of <n> lengths, in value order, into a @@ -4967,8 +4967,8 @@ int BufStream::lookChar(int idx) { return buf[idx]; } -GBool BufStream::isBinary(GBool last) { - return str->isBinary(gTrue); +bool BufStream::isBinary(bool last) { + return str->isBinary(true); } //------------------------------------------------------------------------ @@ -5004,8 +5004,8 @@ int FixedLengthEncoder::lookChar() { return str->getChar(); } -GBool FixedLengthEncoder::isBinary(GBool last) { - return str->isBinary(gTrue); +bool FixedLengthEncoder::isBinary(bool last) { + return str->isBinary(true); } //------------------------------------------------------------------------ @@ -5016,7 +5016,7 @@ ASCIIHexEncoder::ASCIIHexEncoder(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; lineLen = 0; - eof = gFalse; + eof = false; } ASCIIHexEncoder::~ASCIIHexEncoder() { @@ -5029,20 +5029,20 @@ void ASCIIHexEncoder::reset() { str->reset(); bufPtr = bufEnd = buf; lineLen = 0; - eof = gFalse; + eof = false; } -GBool ASCIIHexEncoder::fillBuf() { +bool ASCIIHexEncoder::fillBuf() { static const char *hex = "0123456789abcdef"; int c; if (eof) { - return gFalse; + return false; } bufPtr = bufEnd = buf; if ((c = str->getChar()) == EOF) { *bufEnd++ = '>'; - eof = gTrue; + eof = true; } else { if (lineLen >= 64) { *bufEnd++ = '\n'; @@ -5052,7 +5052,7 @@ GBool ASCIIHexEncoder::fillBuf() { *bufEnd++ = hex[c & 0x0f]; lineLen += 2; } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -5063,7 +5063,7 @@ ASCII85Encoder::ASCII85Encoder(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; lineLen = 0; - eof = gFalse; + eof = false; } ASCII85Encoder::~ASCII85Encoder() { @@ -5075,17 +5075,17 @@ void ASCII85Encoder::reset() { str->reset(); bufPtr = bufEnd = buf; lineLen = 0; - eof = gFalse; + eof = false; } -GBool ASCII85Encoder::fillBuf() { +bool ASCII85Encoder::fillBuf() { Guint t; char buf1[5]; int c0, c1, c2, c3; int n, i; if (eof) { - return gFalse; + return false; } c0 = str->getChar(); c1 = str->getChar(); @@ -5121,7 +5121,7 @@ GBool ASCII85Encoder::fillBuf() { } *bufEnd++ = '~'; *bufEnd++ = '>'; - eof = gTrue; + eof = true; } else { t = (c0 << 24) | (c1 << 16) | (c2 << 8) | c3; if (t == 0) { @@ -5144,7 +5144,7 @@ GBool ASCII85Encoder::fillBuf() { } } } - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -5154,7 +5154,7 @@ GBool ASCII85Encoder::fillBuf() { RunLengthEncoder::RunLengthEncoder(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = nextEnd = buf; - eof = gFalse; + eof = false; } RunLengthEncoder::~RunLengthEncoder() { @@ -5165,7 +5165,7 @@ RunLengthEncoder::~RunLengthEncoder() { void RunLengthEncoder::reset() { str->reset(); bufPtr = bufEnd = nextEnd = buf; - eof = gFalse; + eof = false; } // @@ -5176,31 +5176,31 @@ void RunLengthEncoder::reset() { // ^ ^ ^ // bufPtr bufEnd nextEnd // -GBool RunLengthEncoder::fillBuf() { +bool RunLengthEncoder::fillBuf() { int c, c1, c2; int n; // already hit EOF? if (eof) - return gFalse; + return false; // grab two bytes if (nextEnd < bufEnd + 1) { if ((c1 = str->getChar()) == EOF) { - eof = gTrue; - return gFalse; + eof = true; + return false; } } else { c1 = bufEnd[0] & 0xff; } if (nextEnd < bufEnd + 2) { if ((c2 = str->getChar()) == EOF) { - eof = gTrue; + eof = true; buf[0] = 0; buf[1] = c1; bufPtr = buf; bufEnd = &buf[2]; - return gTrue; + return true; } } else { c2 = bufEnd[1] & 0xff; @@ -5216,7 +5216,7 @@ GBool RunLengthEncoder::fillBuf() { buf[1] = c1; bufEnd = &buf[2]; if (c == EOF) { - eof = gTrue; + eof = true; } else if (n < 128) { buf[2] = c; nextEnd = &buf[3]; @@ -5231,7 +5231,7 @@ GBool RunLengthEncoder::fillBuf() { n = 2; while (n < 128) { if ((c = str->getChar()) == EOF) { - eof = gTrue; + eof = true; break; } ++n; @@ -5249,7 +5249,7 @@ GBool RunLengthEncoder::fillBuf() { } } bufPtr = buf; - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -5289,7 +5289,7 @@ void LZWEncoder::reset() { // initialize output buffer with a clear-table code outBuf = 256; outBufLen = 9; - needEOD = gFalse; + needEOD = false; } int LZWEncoder::getChar() { @@ -5335,7 +5335,7 @@ void LZWEncoder::fillBuf() { if (needEOD) { outBuf = (outBuf << codeLen) | 257; outBufLen += codeLen; - needEOD = gFalse; + needEOD = false; return; } @@ -5393,7 +5393,7 @@ void LZWEncoder::fillBuf() { // generate EOD next time if (inBufLen == 0) { - needEOD = gTrue; + needEOD = true; } } @@ -5404,7 +5404,7 @@ void LZWEncoder::fillBuf() { CMYKGrayEncoder::CMYKGrayEncoder(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; - eof = gFalse; + eof = false; } CMYKGrayEncoder::~CMYKGrayEncoder() { @@ -5415,29 +5415,29 @@ CMYKGrayEncoder::~CMYKGrayEncoder() { void CMYKGrayEncoder::reset() { str->reset(); bufPtr = bufEnd = buf; - eof = gFalse; + eof = false; } -GBool CMYKGrayEncoder::fillBuf() { +bool CMYKGrayEncoder::fillBuf() { int c0, c1, c2, c3; int i; if (eof) { - return gFalse; + return false; } c0 = str->getChar(); c1 = str->getChar(); c2 = str->getChar(); c3 = str->getChar(); if (c3 == EOF) { - eof = gTrue; - return gFalse; + eof = true; + return false; } i = (3 * c0 + 6 * c1 + c2) / 10 + c3; if (i > 255) i = 255; bufPtr = bufEnd = buf; *bufEnd++ = (char) i; - return gTrue; + return true; } //------------------------------------------------------------------------ @@ -5447,7 +5447,7 @@ GBool CMYKGrayEncoder::fillBuf() { RGBGrayEncoder::RGBGrayEncoder(Stream *strA): FilterStream(strA) { bufPtr = bufEnd = buf; - eof = gFalse; + eof = false; } RGBGrayEncoder::~RGBGrayEncoder() { @@ -5458,27 +5458,27 @@ RGBGrayEncoder::~RGBGrayEncoder() { void RGBGrayEncoder::reset() { str->reset(); bufPtr = bufEnd = buf; - eof = gFalse; + eof = false; } -GBool RGBGrayEncoder::fillBuf() { +bool RGBGrayEncoder::fillBuf() { int c0, c1, c2; int i; if (eof) { - return gFalse; + return false; } c0 = str->getChar(); c1 = str->getChar(); c2 = str->getChar(); if (c2 == EOF) { - eof = gTrue; - return gFalse; + eof = true; + return false; } i = 255 - (3 * c0 + 6 * c1 + c2) / 10; if (i < 0) i = 0; bufPtr = bufEnd = buf; *bufEnd++ = (char) i; - return gTrue; + return true; } diff --git a/poppler/Stream.h b/poppler/Stream.h index 93827a4f..6a9a6e87 100644 --- a/poppler/Stream.h +++ b/poppler/Stream.h @@ -198,7 +198,7 @@ public: virtual GooString *getPSFilter(int psLevel, const char *indent); // Does this stream type potentially contain non-printable chars? - virtual GBool isBinary(GBool last = gTrue) = 0; + virtual bool isBinary(bool last = true) = 0; // Get the BaseStream of this stream. virtual BaseStream *getBaseStream() = 0; @@ -212,7 +212,7 @@ public: virtual Object *getDictObject() = 0; // Is this an encoding filter? - virtual GBool isEncoder() { return gFalse; } + virtual bool isEncoder() { return false; } // Get image parameters which are defined by the stream contents. virtual void getImageParams(int * /*bitsPerComponent*/, @@ -232,7 +232,7 @@ private: int incRef() { return ++ref; } int decRef() { return --ref; } - virtual GBool hasGetChars() { return false; } + virtual bool hasGetChars() { return false; } virtual int getChars(int nChars, Guchar *buffer); Stream *makeFilter(const char *name, Stream *str, Object *params, int recursion = 0, Dict *dict = nullptr); @@ -305,10 +305,10 @@ public: BaseStream(Object &&dictA, Goffset lengthA); ~BaseStream(); virtual BaseStream *copy() = 0; - virtual Stream *makeSubStream(Goffset start, GBool limited, + virtual Stream *makeSubStream(Goffset start, bool limited, Goffset length, Object &&dict) = 0; void setPos(Goffset pos, int dir = 0) override = 0; - GBool isBinary(GBool last = gTrue) override { return last; } + bool isBinary(bool last = true) override { return last; } BaseStream *getBaseStream() override { return this; } Stream *getUndecodedStream() override { return this; } Dict *getDict() override { return dict.getDict(); } @@ -379,7 +379,7 @@ public: // Gets the next pixel from the stream. <pix> should be able to hold // at least nComps elements. Returns false at end of file. - GBool getPixel(Guchar *pix); + bool getPixel(Guchar *pix); // Returns a pointer to the next line of pixels. Returns NULL at // end of file. @@ -418,7 +418,7 @@ public: StreamPredictor(const StreamPredictor &) = delete; StreamPredictor& operator=(const StreamPredictor &) = delete; - GBool isOk() { return ok; } + bool isOk() { return ok; } int lookChar(); int getChar(); @@ -426,7 +426,7 @@ public: private: - GBool getNextLine(); + bool getNextLine(); Stream *str; // base stream int predictor; // predictor @@ -438,7 +438,7 @@ private: int rowBytes; // bytes per line Guchar *predLine; // line buffer int predIdx; // current index in predLine - GBool ok; + bool ok; }; //------------------------------------------------------------------------ @@ -450,11 +450,11 @@ private: class FileStream: public BaseStream { public: - FileStream(GooFile* fileA, Goffset startA, GBool limitedA, + FileStream(GooFile* fileA, Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA); ~FileStream(); BaseStream *copy() override; - Stream *makeSubStream(Goffset startA, GBool limitedA, + Stream *makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) override; StreamKind getKind() override { return strFile; } void reset() override; @@ -473,9 +473,9 @@ public: private: - GBool fillBuf(); + bool fillBuf(); - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override { int n, m; @@ -502,13 +502,13 @@ private: GooFile* file; Goffset offset; Goffset start; - GBool limited; + bool limited; char buf[fileStreamBufSize]; char *bufPtr; char *bufEnd; Goffset bufPos; Goffset savePos; - GBool saved; + bool saved; }; //------------------------------------------------------------------------ @@ -520,11 +520,11 @@ private: class CachedFileStream: public BaseStream { public: - CachedFileStream(CachedFile *ccA, Goffset startA, GBool limitedA, + CachedFileStream(CachedFile *ccA, Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA); ~CachedFileStream(); BaseStream *copy() override; - Stream *makeSubStream(Goffset startA, GBool limitedA, + Stream *makeSubStream(Goffset startA, bool limitedA, Goffset lengthA, Object &&dictA) override; StreamKind getKind() override { return strCachedFile; } void reset() override; @@ -543,17 +543,17 @@ public: private: - GBool fillBuf(); + bool fillBuf(); CachedFile *cc; Goffset start; - GBool limited; + bool limited; char buf[cachedStreamBufSize]; char *bufPtr; char *bufEnd; Guint bufPos; int savePos; - GBool saved; + bool saved; }; @@ -577,7 +577,7 @@ public: return new BaseMemStream(buf, start, length, dict.copy()); } - Stream *makeSubStream(Goffset startA, GBool limited, Goffset lengthA, Object &&dictA) override { + Stream *makeSubStream(Goffset startA, bool limited, Goffset lengthA, Object &&dictA) override { Goffset newLength; if (!limited || startA + lengthA > start + length) { @@ -637,7 +637,7 @@ protected: private: - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override { int n; @@ -693,10 +693,10 @@ public: class EmbedStream: public BaseStream { public: - EmbedStream(Stream *strA, Object &&dictA, GBool limitedA, Goffset lengthA, GBool reusableA = gFalse); + EmbedStream(Stream *strA, Object &&dictA, bool limitedA, Goffset lengthA, bool reusableA = false); ~EmbedStream(); BaseStream *copy() override; - Stream *makeSubStream(Goffset start, GBool limitedA, + Stream *makeSubStream(Goffset start, bool limitedA, Goffset lengthA, Object &&dictA) override; StreamKind getKind() override { return str->getKind(); } void reset() override {} @@ -715,14 +715,14 @@ public: private: - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; Stream *str; - GBool limited; - GBool reusable; - GBool record; - GBool replay; + bool limited; + bool reusable; + bool record; + bool replay; unsigned char *bufData; long bufMax; long bufLen; @@ -745,12 +745,12 @@ public: { int c = lookChar(); buf = EOF; return c; } int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; private: int buf; - GBool eof; + bool eof; }; //------------------------------------------------------------------------ @@ -768,14 +768,14 @@ public: { int ch = lookChar(); ++index; return ch; } int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; private: int c[5]; int b[4]; int index, n; - GBool eof; + bool eof; }; //------------------------------------------------------------------------ @@ -795,11 +795,11 @@ public: int getRawChar() override; void getRawChars(int nChars, int *buffer) override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; private: - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; inline int doGetRawChar() { @@ -816,7 +816,7 @@ private: StreamPredictor *pred; // predictor int early; // early parameter - GBool eof; // true if at eof + bool eof; // true if at eof unsigned int inputBuf; // input buffer int inputBits; // number of bits in input buffer struct { // decoding table @@ -831,9 +831,9 @@ private: Guchar seqBuf[4097]; // buffer for current sequence int seqLength; // length of current sequence int seqIndex; // index into current sequence - GBool first; // first code after a table clear + bool first; // first code after a table clear - GBool processNextCode(); + bool processNextCode(); void clearTable(); int getCode(); }; @@ -854,19 +854,19 @@ public: int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; private: - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; char buf[128]; // buffer char *bufPtr; // next char to read char *bufEnd; // end of buffer - GBool eof; + bool eof; - GBool fillBuf(); + bool fillBuf(); }; //------------------------------------------------------------------------ @@ -878,9 +878,9 @@ struct CCITTCodeTable; class CCITTFaxStream: public FilterStream { public: - CCITTFaxStream(Stream *strA, int encodingA, GBool endOfLineA, - GBool byteAlignA, int columnsA, int rowsA, - GBool endOfBlockA, GBool blackA, int damagedRowsBeforeErrorA); + CCITTFaxStream(Stream *strA, int encodingA, bool endOfLineA, + bool byteAlignA, int columnsA, int rowsA, + bool endOfBlockA, bool blackA, int damagedRowsBeforeErrorA); ~CCITTFaxStream(); StreamKind getKind() override { return strCCITTFax; } void reset() override; @@ -888,38 +888,38 @@ public: { int c = lookChar(); buf = EOF; return c; } int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; void unfilteredReset () override; int getEncoding() { return encoding; } - GBool getEndOfLine() { return endOfLine; } - GBool getEncodedByteAlign() { return byteAlign; } - GBool getEndOfBlock() { return endOfBlock; } + bool getEndOfLine() { return endOfLine; } + bool getEncodedByteAlign() { return byteAlign; } + bool getEndOfBlock() { return endOfBlock; } int getColumns() { return columns; } - GBool getBlackIs1() { return black; } + bool getBlackIs1() { return black; } int getDamagedRowsBeforeError() { return damagedRowsBeforeError; } private: - void ccittReset(GBool unfiltered); + void ccittReset(bool unfiltered); int encoding; // 'K' parameter - GBool endOfLine; // 'EndOfLine' parameter - GBool byteAlign; // 'EncodedByteAlign' parameter + bool endOfLine; // 'EndOfLine' parameter + bool byteAlign; // 'EncodedByteAlign' parameter int columns; // 'Columns' parameter int rows; // 'Rows' parameter - GBool endOfBlock; // 'EndOfBlock' parameter - GBool black; // 'BlackIs1' parameter + bool endOfBlock; // 'EndOfBlock' parameter + bool black; // 'BlackIs1' parameter int damagedRowsBeforeError; // 'DamagedRowsBeforeError' parameter - GBool eof; // true if at eof - GBool nextLine2D; // true if next line uses 2D encoding + bool eof; // true if at eof + bool nextLine2D; // true if next line uses 2D encoding int row; // current row Guint inputBuf; // input buffer int inputBits; // number of bits in input buffer int *codingLine; // coding line changing elements int *refLine; // reference line changing elements int a0i; // index into codingLine - GBool err; // error on current line + bool err; // error on current line int outputBits; // remaining ouput bits int buf; // character buffer @@ -946,7 +946,7 @@ struct DCTCompInfo { }; struct DCTScanInfo { - GBool comp[4]; // comp[i] is set if component i is + bool comp[4]; // comp[i] is set if component i is // included in this scan int numComps; // number of components in the scan int dcHuffTable[4]; // DC Huffman table numbers @@ -974,15 +974,15 @@ public: int getChar() override; int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; void unfilteredReset() override; private: - void dctReset(GBool unfiltered); - GBool progressive; // set if in progressive mode - GBool interleaved; // set if in interleaved mode + void dctReset(bool unfiltered); + bool progressive; // set if in progressive mode + bool interleaved; // set if in interleaved mode int width, height; // image size int mcuWidth, mcuHeight; // size of min coding unit, in data units int bufWidth, bufHeight; // frameBuf size @@ -992,8 +992,8 @@ private: int colorXform; // color transform: -1 = unspecified // 0 = none // 1 = YUV/YUVK -> RGB/CMYK - GBool gotJFIFMarker; // set if APP0 JFIF marker was present - GBool gotAdobeMarker; // set if APP14 Adobe marker was present + bool gotJFIFMarker; // set if APP0 JFIF marker was present + bool gotAdobeMarker; // set if APP14 Adobe marker was present int restartInterval; // restart interval, in MCUs Gushort quantTables[4][64]; // quantization tables int numQuantTables; // number of quantization tables @@ -1011,12 +1011,12 @@ private: int inputBits; // number of valid bits in input buffer void restart(); - GBool readMCURow(); + bool readMCURow(); void readScan(); - GBool readDataUnit(DCTHuffTable *dcHuffTable, + bool readDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]); - GBool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, + bool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, int *prevDC, int data[64]); void decodeImage(); @@ -1025,16 +1025,16 @@ private: int readHuffSym(DCTHuffTable *table); int readAmp(int size); int readBit(); - GBool readHeader(); - GBool readBaselineSOF(); - GBool readProgressiveSOF(); - GBool readScanInfo(); - GBool readQuantTables(); - GBool readHuffmanTables(); - GBool readRestartInterval(); - GBool readJFIFMarker(); - GBool readAdobeMarker(); - GBool readTrailer(); + bool readHeader(); + bool readBaselineSOF(); + bool readProgressiveSOF(); + bool readScanInfo(); + bool readQuantTables(); + bool readHuffmanTables(); + bool readRestartInterval(); + bool readJFIFMarker(); + bool readAdobeMarker(); + bool readTrailer(); int readMarker(); int read16(); }; @@ -1083,11 +1083,11 @@ public: int getRawChar() override; void getRawChars(int nChars, int *buffer) override; GooString *getPSFilter(int psLevel, const char *indent) override; - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; void unfilteredReset () override; private: - void flateReset(GBool unfiltered); + void flateReset(bool unfiltered); inline int doGetRawChar() { int c; @@ -1102,7 +1102,7 @@ private: return c; } - GBool hasGetChars() override { return true; } + bool hasGetChars() override { return true; } int getChars(int nChars, Guchar *buffer) override; StreamPredictor *pred; // predictor @@ -1115,10 +1115,10 @@ private: codeLengths[flateMaxLitCodes + flateMaxDistCodes]; FlateHuffmanTab litCodeTab; // literal code table FlateHuffmanTab distCodeTab; // distance code table - GBool compressedBlock; // set if reading a compressed block + bool compressedBlock; // set if reading a compressed block int blockLen; // remaining length of uncompressed block - GBool endOfBlock; // set when end of block is reached - GBool eof; // set when end of stream is reached + bool endOfBlock; // set when end of block is reached + bool eof; // set when end of stream is reached static int // code length code reordering codeLenCodeMap[flateMaxCodeLenCodes]; @@ -1132,9 +1132,9 @@ private: fixedDistCodeTab; void readSome(); - GBool startBlock(); + bool startBlock(); void loadFixedCodes(); - GBool readDynamicCodes(); + bool readDynamicCodes(); void compHuffmanCodes(int *lengths, int n, FlateHuffmanTab *tab); int getHuffmanCodeWord(FlateHuffmanTab *tab); int getCodeWord(int bits); @@ -1155,7 +1155,7 @@ public: int getChar() override { return EOF; } int lookChar() override { return EOF; } GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override { return gFalse; } + bool isBinary(bool /*last = true*/) override { return false; } }; //------------------------------------------------------------------------ @@ -1173,7 +1173,7 @@ public: int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override { return nullptr; } - GBool isBinary(GBool last = gTrue) override; + bool isBinary(bool last = true) override; int lookChar(int idx); @@ -1197,8 +1197,8 @@ public: int getChar() override; int lookChar() override; GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override; - GBool isEncoder() override { return gTrue; } + bool isBinary(bool /*last = true*/) override; + bool isEncoder() override { return true; } private: @@ -1222,8 +1222,8 @@ public: int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override { return gFalse; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool /*last = true*/) override { return false; } + bool isEncoder() override { return true; } private: @@ -1231,9 +1231,9 @@ private: char *bufPtr; char *bufEnd; int lineLen; - GBool eof; + bool eof; - GBool fillBuf(); + bool fillBuf(); }; //------------------------------------------------------------------------ @@ -1252,8 +1252,8 @@ public: int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override { return gFalse; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool /*last = true*/) override { return false; } + bool isEncoder() override { return true; } private: @@ -1261,9 +1261,9 @@ private: char *bufPtr; char *bufEnd; int lineLen; - GBool eof; + bool eof; - GBool fillBuf(); + bool fillBuf(); }; //------------------------------------------------------------------------ @@ -1282,8 +1282,8 @@ public: int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override { return gTrue; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool /*last = true*/) override { return true; } + bool isEncoder() override { return true; } private: @@ -1291,9 +1291,9 @@ private: char *bufPtr; char *bufEnd; char *nextEnd; - GBool eof; + bool eof; - GBool fillBuf(); + bool fillBuf(); }; //------------------------------------------------------------------------ @@ -1317,8 +1317,8 @@ public: int lookChar() override; GooString *getPSFilter(int psLevel, const char *indent) override { return nullptr; } - GBool isBinary(GBool last = gTrue) override { return gTrue; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool last = true) override { return true; } + bool isEncoder() override { return true; } private: @@ -1329,7 +1329,7 @@ private: int inBufLen; int outBuf; int outBufLen; - GBool needEOD; + bool needEOD; void fillBuf(); }; @@ -1350,17 +1350,17 @@ public: int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override { return gFalse; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool /*last = true*/) override { return false; } + bool isEncoder() override { return true; } private: char buf[2]; char *bufPtr; char *bufEnd; - GBool eof; + bool eof; - GBool fillBuf(); + bool fillBuf(); }; //------------------------------------------------------------------------ @@ -1379,17 +1379,17 @@ public: int lookChar() override { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } GooString *getPSFilter(int /*psLevel*/, const char * /*indent*/) override { return nullptr; } - GBool isBinary(GBool /*last = gTrue*/) override { return gFalse; } - GBool isEncoder() override { return gTrue; } + bool isBinary(bool /*last = true*/) override { return false; } + bool isEncoder() override { return true; } private: char buf[2]; char *bufPtr; char *bufEnd; - GBool eof; + bool eof; - GBool fillBuf(); + bool fillBuf(); }; #endif diff --git a/poppler/StructElement.cc b/poppler/StructElement.cc index d7e38f6d..9557b006 100644 --- a/poppler/StructElement.cc +++ b/poppler/StructElement.cc @@ -25,7 +25,7 @@ class GfxState; -static GBool isPlacementName(Object *value) +static bool isPlacementName(Object *value) { return value->isName("Block") || value->isName("Inline") @@ -34,14 +34,14 @@ static GBool isPlacementName(Object *value) || value->isName("End"); } -static GBool isWritingModeName(Object *value) +static bool isWritingModeName(Object *value) { return value->isName("LrTb") || value->isName("RlTb") || value->isName("TbRl"); } -static GBool isBorderStyleName(Object *value) +static bool isBorderStyleName(Object *value) { return value->isName("None") || value->isName("Hidden") @@ -55,7 +55,7 @@ static GBool isBorderStyleName(Object *value) || value->isName("Outset"); } -static GBool isTextAlignName(Object *value) +static bool isTextAlignName(Object *value) { return value->isName("Start") || value->isName("End") @@ -63,7 +63,7 @@ static GBool isTextAlignName(Object *value) || value->isName("Justify"); } -static GBool isBlockAlignName(Object *value) +static bool isBlockAlignName(Object *value) { return value->isName("Before") || value->isName("Middle") @@ -71,26 +71,26 @@ static GBool isBlockAlignName(Object *value) || value->isName("Justify"); } -static GBool isInlineAlignName(Object *value) +static bool isInlineAlignName(Object *value) { return value->isName("Start") || value->isName("End") || value->isName("Center"); } -static GBool isNumber(Object *value) +static bool isNumber(Object *value) { return value->isNum(); } -static GBool isLineHeight(Object *value) +static bool isLineHeight(Object *value) { return value->isName("Normal") || value->isName("Auto") || isNumber(value); } -static GBool isTextDecorationName(Object *value) +static bool isTextDecorationName(Object *value) { return value->isName("None") || value->isName("Underline") @@ -98,7 +98,7 @@ static GBool isTextDecorationName(Object *value) || value->isName("LineThrough"); } -static GBool isRubyAlignName(Object *value) +static bool isRubyAlignName(Object *value) { return value->isName("Start") || value->isName("End") @@ -107,7 +107,7 @@ static GBool isRubyAlignName(Object *value) || value->isName("Distribute"); } -static GBool isRubyPositionName(Object *value) +static bool isRubyPositionName(Object *value) { return value->isName("Before") || value->isName("After") @@ -115,7 +115,7 @@ static GBool isRubyPositionName(Object *value) || value->isName("Inline"); } -static GBool isGlyphOrientationName(Object *value) +static bool isGlyphOrientationName(Object *value) { return value->isName("Auto") || value->isName("90") @@ -126,7 +126,7 @@ static GBool isGlyphOrientationName(Object *value) || value->isName("-180"); } -static GBool isListNumberingName(Object *value) +static bool isListNumberingName(Object *value) { return value->isName("None") || value->isName("Disc") @@ -139,7 +139,7 @@ static GBool isListNumberingName(Object *value) || value->isName("LowerAlpha"); } -static GBool isFieldRoleName(Object *value) +static bool isFieldRoleName(Object *value) { return value->isName("rb") || value->isName("cb") @@ -147,34 +147,34 @@ static GBool isFieldRoleName(Object *value) || value->isName("tv"); } -static GBool isFieldCheckedName(Object *value) +static bool isFieldCheckedName(Object *value) { return value->isName("on") || value->isName("off") || value->isName("neutral"); } -static GBool isTableScopeName(Object *value) +static bool isTableScopeName(Object *value) { return value->isName("Row") || value->isName("Column") || value->isName("Both"); } -static GBool isRGBColor(Object *value) +static bool isRGBColor(Object *value) { if (!(value->isArray() && value->arrayGetLength() == 3)) - return gFalse; + return false; - GBool okay = gTrue; + bool okay = true; for (int i = 0; i < 3; i++) { Object obj = value->arrayGet(i); if (!obj.isNum()) { - okay = gFalse; + okay = false; break; } if (obj.getNum() < 0.0 || obj.getNum() > 1.0) { - okay = gFalse; + okay = false; break; } } @@ -182,23 +182,23 @@ static GBool isRGBColor(Object *value) return okay; } -static GBool isNatural(Object *value) +static bool isNatural(Object *value) { return (value->isInt() && value->getInt() > 0) || (value->isInt64() && value->getInt64() > 0); } -static GBool isPositive(Object *value) +static bool isPositive(Object *value) { return value->isNum() && value->getNum() >= 0.0; } -static GBool isNumberOrAuto(Object *value) +static bool isNumberOrAuto(Object *value) { return isNumber(value) || value->isName("Auto"); } -static GBool isTextString(Object *value) +static bool isTextString(Object *value) { // XXX: Shall isName() also be checked? return value->isString(); @@ -206,42 +206,42 @@ static GBool isTextString(Object *value) #define ARRAY_CHECKER(name, checkItem, length, allowSingle, allowNulls) \ - static GBool name(Object *value) { \ + static bool name(Object *value) { \ if (!value->isArray()) \ - return allowSingle ? checkItem(value) : gFalse; \ + return allowSingle ? checkItem(value) : false; \ \ if (length && value->arrayGetLength() != length) \ - return gFalse; \ + return false; \ \ - GBool okay = gTrue; \ + bool okay = true; \ for (int i = 0; i < value->arrayGetLength(); i++) { \ Object obj = value->arrayGet(i); \ if ((!allowNulls && obj.isNull()) || !checkItem(&obj)) { \ - okay = gFalse; \ + okay = false; \ break; \ } \ } \ return okay; \ } -ARRAY_CHECKER(isRGBColorOrOptionalArray4, isRGBColor, 4, gTrue, gTrue ) -ARRAY_CHECKER(isPositiveOrOptionalArray4, isPositive, 4, gTrue, gTrue ) -ARRAY_CHECKER(isPositiveOrArray4, isPositive, 4, gTrue, gFalse) -ARRAY_CHECKER(isBorderStyle, isBorderStyleName, 4, gTrue, gTrue ) -ARRAY_CHECKER(isNumberArray4, isNumber, 4, gFalse, gFalse) -ARRAY_CHECKER(isNumberOrArrayN, isNumber, 0, gTrue, gFalse) -ARRAY_CHECKER(isTableHeaders, isTextString, 0, gFalse, gFalse) +ARRAY_CHECKER(isRGBColorOrOptionalArray4, isRGBColor, 4, true, true ) +ARRAY_CHECKER(isPositiveOrOptionalArray4, isPositive, 4, true, true ) +ARRAY_CHECKER(isPositiveOrArray4, isPositive, 4, true, false) +ARRAY_CHECKER(isBorderStyle, isBorderStyleName, 4, true, true ) +ARRAY_CHECKER(isNumberArray4, isNumber, 4, false, false) +ARRAY_CHECKER(isNumberOrArrayN, isNumber, 0, true, false) +ARRAY_CHECKER(isTableHeaders, isTextString, 0, false, false) // Type of functions used to do type-checking on attribute values -typedef GBool (*AttributeCheckFunc)(Object*); +typedef bool (*AttributeCheckFunc)(Object*); // Maps attributes to their names and whether the attribute can be inherited. struct AttributeMapEntry { Attribute::Type type; const char *name; const Object *defval; - GBool inherit; + bool inherit; AttributeCheckFunc check; }; @@ -265,7 +265,7 @@ static const AttributeDefaults attributeDefaults; #define ATTR_LIST_END \ - { Attribute::Unknown, nullptr, nullptr, gFalse, nullptr } + { Attribute::Unknown, nullptr, nullptr, false, nullptr } #define ATTR_WITH_DEFAULT(name, inherit, check, defval) \ { Attribute::name, \ @@ -283,86 +283,86 @@ static const AttributeDefaults attributeDefaults; static const AttributeMapEntry attributeMapCommonShared[] = { - ATTR_WITH_DEFAULT(Placement, gFalse, isPlacementName, Inline), - ATTR_WITH_DEFAULT(WritingMode, gTrue, isWritingModeName, LrTb), - ATTR (BackgroundColor, gFalse, isRGBColor), - ATTR (BorderColor, gTrue, isRGBColorOrOptionalArray4), - ATTR_WITH_DEFAULT(BorderStyle, gFalse, isBorderStyle, None), - ATTR (BorderThickness, gTrue, isPositiveOrOptionalArray4), - ATTR_WITH_DEFAULT(Padding, gFalse, isPositiveOrArray4, Zero), - ATTR (Color, gTrue, isRGBColor), + ATTR_WITH_DEFAULT(Placement, false, isPlacementName, Inline), + ATTR_WITH_DEFAULT(WritingMode, true, isWritingModeName, LrTb), + ATTR (BackgroundColor, false, isRGBColor), + ATTR (BorderColor, true, isRGBColorOrOptionalArray4), + ATTR_WITH_DEFAULT(BorderStyle, false, isBorderStyle, None), + ATTR (BorderThickness, true, isPositiveOrOptionalArray4), + ATTR_WITH_DEFAULT(Padding, false, isPositiveOrArray4, Zero), + ATTR (Color, true, isRGBColor), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonBlock[] = { - ATTR_WITH_DEFAULT(SpaceBefore, gFalse, isPositive, Zero), - ATTR_WITH_DEFAULT(SpaceAfter, gFalse, isPositive, Zero), - ATTR_WITH_DEFAULT(StartIndent, gTrue, isNumber, Zero), - ATTR_WITH_DEFAULT(EndIndent, gTrue, isNumber, Zero), - ATTR_WITH_DEFAULT(TextIndent, gTrue, isNumber, Zero), - ATTR_WITH_DEFAULT(TextAlign, gTrue, isTextAlignName, Start), - ATTR (BBox, gFalse, isNumberArray4), - ATTR_WITH_DEFAULT(Width, gFalse, isNumberOrAuto, Auto), - ATTR_WITH_DEFAULT(Height, gFalse, isNumberOrAuto, Auto), - ATTR_WITH_DEFAULT(BlockAlign, gTrue, isBlockAlignName, Before), - ATTR_WITH_DEFAULT(InlineAlign, gTrue, isInlineAlignName, Start), + ATTR_WITH_DEFAULT(SpaceBefore, false, isPositive, Zero), + ATTR_WITH_DEFAULT(SpaceAfter, false, isPositive, Zero), + ATTR_WITH_DEFAULT(StartIndent, true, isNumber, Zero), + ATTR_WITH_DEFAULT(EndIndent, true, isNumber, Zero), + ATTR_WITH_DEFAULT(TextIndent, true, isNumber, Zero), + ATTR_WITH_DEFAULT(TextAlign, true, isTextAlignName, Start), + ATTR (BBox, false, isNumberArray4), + ATTR_WITH_DEFAULT(Width, false, isNumberOrAuto, Auto), + ATTR_WITH_DEFAULT(Height, false, isNumberOrAuto, Auto), + ATTR_WITH_DEFAULT(BlockAlign, true, isBlockAlignName, Before), + ATTR_WITH_DEFAULT(InlineAlign, true, isInlineAlignName, Start), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonInline[] = { - ATTR_WITH_DEFAULT(BaselineShift, gFalse, isNumber, Zero), - ATTR_WITH_DEFAULT(LineHeight, gTrue, isLineHeight, Normal), - ATTR (TextDecorationColor, gTrue, isRGBColor), - ATTR (TextDecorationThickness, gTrue, isPositive), - ATTR_WITH_DEFAULT(TextDecorationType, gFalse, isTextDecorationName, None), - ATTR_WITH_DEFAULT(GlyphOrientationVertical, gTrue, isGlyphOrientationName, Auto), + ATTR_WITH_DEFAULT(BaselineShift, false, isNumber, Zero), + ATTR_WITH_DEFAULT(LineHeight, true, isLineHeight, Normal), + ATTR (TextDecorationColor, true, isRGBColor), + ATTR (TextDecorationThickness, true, isPositive), + ATTR_WITH_DEFAULT(TextDecorationType, false, isTextDecorationName, None), + ATTR_WITH_DEFAULT(GlyphOrientationVertical, true, isGlyphOrientationName, Auto), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonRubyText[] = { - ATTR_WITH_DEFAULT(RubyPosition, gTrue, isRubyPositionName, Before), - ATTR_WITH_DEFAULT(RubyAlign, gTrue, isRubyAlignName, Distribute), + ATTR_WITH_DEFAULT(RubyPosition, true, isRubyPositionName, Before), + ATTR_WITH_DEFAULT(RubyAlign, true, isRubyAlignName, Distribute), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonColumns[] = { - ATTR_WITH_DEFAULT(ColumnCount, gFalse, isNatural, Nat1), - ATTR (ColumnGap, gFalse, isNumberOrArrayN), - ATTR (ColumnWidths, gFalse, isNumberOrArrayN), + ATTR_WITH_DEFAULT(ColumnCount, false, isNatural, Nat1), + ATTR (ColumnGap, false, isNumberOrArrayN), + ATTR (ColumnWidths, false, isNumberOrArrayN), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonList[] = { - ATTR_WITH_DEFAULT(ListNumbering, gTrue, isListNumberingName, None), + ATTR_WITH_DEFAULT(ListNumbering, true, isListNumberingName, None), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonPrintField[] = { - ATTR (Role, gFalse, isFieldRoleName), - ATTR_WITH_DEFAULT(checked, gFalse, isFieldCheckedName, off), - ATTR (Desc, gFalse, isTextString), + ATTR (Role, false, isFieldRoleName), + ATTR_WITH_DEFAULT(checked, false, isFieldCheckedName, off), + ATTR (Desc, false, isTextString), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonTable[] = { - ATTR(Headers, gFalse, isTableHeaders), - ATTR(Scope, gFalse, isTableScopeName), - ATTR(Summary, gFalse, isTextString), + ATTR(Headers, false, isTableHeaders), + ATTR(Scope, false, isTableScopeName), + ATTR(Summary, false, isTextString), ATTR_LIST_END }; static const AttributeMapEntry attributeMapCommonTableCell[] = { - ATTR_WITH_DEFAULT(RowSpan, gFalse, isNatural, Nat1), - ATTR_WITH_DEFAULT(ColSpan, gFalse, isNatural, Nat1), - ATTR_WITH_DEFAULT(TBorderStyle, gTrue, isBorderStyle, None), - ATTR_WITH_DEFAULT(TPadding, gTrue, isPositiveOrArray4, Zero), + ATTR_WITH_DEFAULT(RowSpan, false, isNatural, Nat1), + ATTR_WITH_DEFAULT(ColSpan, false, isNatural, Nat1), + ATTR_WITH_DEFAULT(TBorderStyle, true, isBorderStyle, None), + ATTR_WITH_DEFAULT(TPadding, true, isPositiveOrArray4, Zero), ATTR_LIST_END }; @@ -468,7 +468,7 @@ static const struct OwnerMapEntry { }; -static GBool ownerHasMorePriority(Attribute::Owner a, Attribute::Owner b) +static bool ownerHasMorePriority(Attribute::Owner a, Attribute::Owner b) { unsigned aIndex, bIndex; @@ -665,7 +665,7 @@ Attribute::Attribute(const char *nameA, int nameLenA, Object *valueA): revision(0), name(nameA, nameLenA), value(), - hidden(gFalse), + hidden(false), formatted(nullptr) { assert(valueA); @@ -678,7 +678,7 @@ Attribute::Attribute(Type typeA, Object *valueA): revision(0), name(), value(), - hidden(gFalse), + hidden(false), formatted(nullptr) { assert(valueA); @@ -730,26 +730,26 @@ void Attribute::setFormattedValue(const char *formattedA) } } -GBool Attribute::checkType(StructElement *element) +bool Attribute::checkType(StructElement *element) { // If an element is passed, tighther type-checking can be done. if (!element) - return gTrue; + return true; const TypeMapEntry *elementTypeEntry = getTypeMapEntry(element->getType()); if (elementTypeEntry && elementTypeEntry->attributes) { const AttributeMapEntry *entry = getAttributeMapEntry(elementTypeEntry->attributes, type); if (entry) { if (entry->check && !((*entry->check)(&value))) { - return gFalse; + return false; } } else { // No entry: the attribute is not valid for the containing element. - return gFalse; + return false; } } - return gTrue; + return true; } Attribute::Type Attribute::getTypeForName(const char *name, StructElement *element) @@ -880,25 +880,25 @@ StructElement::~StructElement() delete s; } -GBool StructElement::isBlock() const +bool StructElement::isBlock() const { const TypeMapEntry *entry = getTypeMapEntry(type); - return entry ? (entry->elementType == elementTypeBlock) : gFalse; + return entry ? (entry->elementType == elementTypeBlock) : false; } -GBool StructElement::isInline() const +bool StructElement::isInline() const { const TypeMapEntry *entry = getTypeMapEntry(type); - return entry ? (entry->elementType == elementTypeInline) : gFalse; + return entry ? (entry->elementType == elementTypeInline) : false; } -GBool StructElement::isGrouping() const +bool StructElement::isGrouping() const { const TypeMapEntry *entry = getTypeMapEntry(type); - return entry ? (entry->elementType == elementTypeGrouping) : gFalse; + return entry ? (entry->elementType == elementTypeGrouping) : false; } -GBool StructElement::hasPageRef() const +bool StructElement::hasPageRef() const { return pageRef.isRef() || (parent && parent->hasPageRef()); } @@ -907,13 +907,13 @@ bool StructElement::getPageRef(Ref& ref) const { if (pageRef.isRef()) { ref = pageRef.getRef(); - return gTrue; + return true; } if (parent) return parent->getPageRef(ref); - return gFalse; + return false; } const char *StructElement::getTypeName() const @@ -921,7 +921,7 @@ const char *StructElement::getTypeName() const return typeToName(type); } -const Attribute *StructElement::findAttribute(Attribute::Type attributeType, GBool inherit, +const Attribute *StructElement::findAttribute(Attribute::Type attributeType, bool inherit, Attribute::Owner attributeOwner) const { if (isContent()) @@ -968,7 +968,7 @@ const Attribute *StructElement::findAttribute(Attribute::Type attributeType, GBo return nullptr; } -GooString* StructElement::appendSubTreeText(GooString *string, GBool recursive) const +GooString* StructElement::appendSubTreeText(GooString *string, bool recursive) const { if (isContent() && !isObjectRef()) { MarkedContentOutputDev mcdev(getMCID()); @@ -1012,7 +1012,7 @@ const TextSpanArray& StructElement::getTextSpansInternal(MarkedContentOutputDev& endPage = treeRoot->getDoc()->getNumPages(); } - treeRoot->getDoc()->displayPages(&mcdev, startPage, endPage, 72.0, 72.0, 0, gTrue, gFalse, gFalse); + treeRoot->getDoc()->displayPages(&mcdev, startPage, endPage, 72.0, 72.0, 0, true, false, false); return mcdev.getTextSpans(); } @@ -1155,14 +1155,14 @@ void StructElement::parse(Dict *element) if (classes.isName()) { Object attr = treeRoot->getClassMap()->lookup(classes.getName()); if (attr.isDict()) { - parseAttributes(attr.getDict(), gTrue); + parseAttributes(attr.getDict(), true); } else if (attr.isArray()) { for (int i = 0; i < attr.arrayGetLength(); i++) { unsigned attrIndex = getNumAttributes(); Object iobj = attr.arrayGet(i); if (iobj.isDict()) { attrIndex = getNumAttributes(); - parseAttributes(iobj.getDict(), gTrue); + parseAttributes(iobj.getDict(), true); } else if (iobj.isInt()) { // Set revision numbers for the elements previously created. const int revision = iobj.getInt(); @@ -1266,7 +1266,7 @@ void StructElement::parseChildren(Dict *element, std::set<int> &seen) } } -void StructElement::parseAttributes(Dict *attributes, GBool keepExisting) +void StructElement::parseAttributes(Dict *attributes, bool keepExisting) { Object owner = attributes->lookup("O"); if (owner.isName("UserProperties")) { @@ -1302,10 +1302,10 @@ void StructElement::parseAttributes(Dict *attributes, GBool keepExisting) // Check if the attribute is already defined. if (keepExisting) { - GBool exists = gFalse; + bool exists = false; for (unsigned j = 0; j < getNumAttributes(); j++) { if (getAttribute(j)->getType() == type) { - exists = gTrue; + exists = true; break; } } @@ -1315,7 +1315,7 @@ void StructElement::parseAttributes(Dict *attributes, GBool keepExisting) if (type != Attribute::Unknown) { Object value = attributes->getVal(i); - GBool typeCheckOk = gTrue; + bool typeCheckOk = true; Attribute *attribute = new Attribute(type, &value); if (attribute->isOk() && (typeCheckOk = attribute->checkType(this))) { diff --git a/poppler/StructElement.h b/poppler/StructElement.h index 78ae36d3..878e5bc6 100644 --- a/poppler/StructElement.h +++ b/poppler/StructElement.h @@ -74,7 +74,7 @@ public: // Creates an UserProperty attribute, with an arbitrary name and value. Attribute(const char *name, int nameLen, Object *value); - GBool isOk() const { return type != Unknown; } + bool isOk() const { return type != Unknown; } // Name, type and value can be set only on construction. Type getType() const { return type; } @@ -92,8 +92,8 @@ public: void setRevision(Guint revisionA) { revision = revisionA; } // Hidden elements should not be displayed by the user agent - GBool isHidden() const { return hidden; } - void setHidden(GBool hiddenA) { hidden = hiddenA; } + bool isHidden() const { return hidden; } + void setHidden(bool hiddenA) { hidden = hiddenA; } // The formatted value may be in the PDF, or be left undefined (nullptr). // In the later case the user agent should provide a default representation. @@ -108,10 +108,10 @@ private: Guint revision; mutable GooString name; mutable Object value; - GBool hidden; + bool hidden; GooString *formatted; - GBool checkType(StructElement *element = nullptr); + bool checkType(StructElement *element = nullptr); static Type getTypeForName(const char *name, StructElement *element = nullptr); static Attribute *parseUserProperty(Dict *property); @@ -149,19 +149,19 @@ public: const char *getTypeName() const; Type getType() const { return type; } - GBool isOk() const { return type != Unknown; } - GBool isBlock() const; - GBool isInline() const; - GBool isGrouping() const; + bool isOk() const { return type != Unknown; } + bool isBlock() const; + bool isInline() const; + bool isGrouping() const; - inline GBool isContent() const { return (type == MCID) || isObjectRef(); } - inline GBool isObjectRef() const { return (type == OBJR && c->ref.num != -1 && c->ref.gen != -1); } + inline bool isContent() const { return (type == MCID) || isObjectRef(); } + inline bool isObjectRef() const { return (type == OBJR && c->ref.num != -1 && c->ref.gen != -1); } int getMCID() const { return c->mcid; } Ref getObjectRef() const { return c->ref; } Ref getParentRef() { return isContent() ? parent->getParentRef() : s->parentRef.getRef(); } - GBool hasPageRef() const; - GBool getPageRef(Ref& ref) const; + bool hasPageRef() const; + bool getPageRef(Ref& ref) const; StructTreeRoot *getStructTreeRoot() { return treeRoot; } // Optional element identifier. @@ -210,7 +210,7 @@ public: } } - const Attribute* findAttribute(Attribute::Type attributeType, GBool inherit = gFalse, + const Attribute* findAttribute(Attribute::Type attributeType, bool inherit = false, Attribute::Owner owner = Attribute::UnknownOwner) const; const GooString *getAltText() const { return isContent() ? nullptr : s->altText; } @@ -232,7 +232,7 @@ public: // // A new string is returned, and the ownership passed to the caller. // - GooString *getText(GBool recursive = gTrue) const { + GooString *getText(bool recursive = true) const { return appendSubTreeText(nullptr, recursive); } @@ -246,7 +246,7 @@ public: ~StructElement(); private: - GooString* appendSubTreeText(GooString *string, GBool recursive) const; + GooString* appendSubTreeText(GooString *string, bool recursive) const; const TextSpanArray& getTextSpansInternal(MarkedContentOutputDev& mcdev) const; typedef std::vector<Attribute*> AttrPtrArray; @@ -300,7 +300,7 @@ private: void parse(Dict* elementDict); StructElement* parseChild(Object *ref, Object* childObj, std::set<int> &seen); void parseChildren(Dict* element, std::set<int> &seen); - void parseAttributes(Dict *element, GBool keepExisting = gFalse); + void parseAttributes(Dict *element, bool keepExisting = false); friend class StructTreeRoot; }; diff --git a/poppler/StructTreeRoot.cc b/poppler/StructTreeRoot.cc index 86404bfe..20772764 100644 --- a/poppler/StructTreeRoot.cc +++ b/poppler/StructTreeRoot.cc @@ -58,7 +58,7 @@ void StructTreeRoot::parse(Dict *root) std::set<int> seenElements; // Parse the children StructElements - const GBool marked = doc->getCatalog()->getMarkInfo() & Catalog::markInfoMarked; + const bool marked = doc->getCatalog()->getMarkInfo() & Catalog::markInfoMarked; Object kids = root->lookup("K"); if (kids.isArray()) { if (marked && kids.arrayGetLength() > 1) { diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index 4355169b..14b6028e 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -179,7 +179,7 @@ #define combMaxMidDelta 0.3 #define combMaxBaseDelta 0.4 -static int reorderText(Unicode *text, int len, UnicodeMap *uMap, GBool primaryLR, GooString *s, Unicode* u) { +static int reorderText(Unicode *text, int len, UnicodeMap *uMap, bool primaryLR, GooString *s, Unicode* u) { char lre[8], rle[8], popdf[8], buf[8]; int lreLen = 0, rleLen = 0, popdfLen = 0, n; int nCols, i, j, k; @@ -279,7 +279,7 @@ public: ~TextUnderline() {} double x0, y0, x1, y1; - GBool horiz; + bool horiz; }; //------------------------------------------------------------------------ @@ -322,11 +322,11 @@ TextFontInfo::~TextFontInfo() { #endif } -GBool TextFontInfo::matches(GfxState *state) const { +bool TextFontInfo::matches(GfxState *state) const { return state->getFont() == gfxFont; } -GBool TextFontInfo::matches(const TextFontInfo *fontInfo) const { +bool TextFontInfo::matches(const TextFontInfo *fontInfo) const { return gfxFont == fontInfo->gfxFont; } @@ -356,7 +356,7 @@ TextWord::TextWord(const GfxState *state, int rotA, double fontSizeA) { font = nullptr; textMat = nullptr; len = size = 0; - spaceAfter = gFalse; + spaceAfter = false; next = nullptr; #ifdef TEXTOUT_WORD_LIST @@ -372,7 +372,7 @@ TextWord::TextWord(const GfxState *state, int rotA, double fontSizeA) { colorB = colToDbl(rgb.b); #endif - underlined = gFalse; + underlined = false; link = nullptr; } @@ -573,11 +573,11 @@ static Unicode getCombiningChar(Unicode u) { return 0; } -GBool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y, +bool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y, double dx, double dy, int charPosA, int charLen, CharCode c, Unicode u, const Matrix &textMatA) { if (len == 0 || wMode != 0 || fontA->getWMode() != 0) - return gFalse; + return false; Unicode cCurrent = getCombiningChar(u); Unicode cPrev = getCombiningChar(text[len-1]); @@ -602,7 +602,7 @@ GBool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSi if (fabs(charMid - edgeMid) >= maxScaledMidDelta || fabs(charBase - base) >= maxScaledBaseDelta) - return gFalse; + return false; // Add character, but don't adjust edge / bounding box because // combining character's positioning could be odd. @@ -616,7 +616,7 @@ GBool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSi edge[len+1] = edge[len]; edge[len] = (edge[len+1] + edge[len-1]) / 2; ++len; - return gTrue; + return true; } if (cPrev != 0 && unicodeTypeAlphaNum(u)) { @@ -637,7 +637,7 @@ GBool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSi if (fabs(charMid - edgeMid) >= maxScaledMidDelta || fabs(charBase - base) >= maxScaledBaseDelta) - return gFalse; + return false; // move combining character to after base character ensureCapacity(len+1); @@ -701,9 +701,9 @@ GBool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSi edge[len] = (edge[len+1] + edge[len-1]) / 2; ++len; - return gTrue; + return true; } - return gFalse; + return false; } void TextWord::merge(TextWord *word) { @@ -958,7 +958,7 @@ TextLine::TextLine(TextBlock *blkA, int rotA, double baseA) { col = nullptr; len = 0; convertedLen = 0; - hyphenated = gFalse; + hyphenated = false; next = nullptr; xMin = yMin = 0; xMax = yMax = -1; @@ -1085,7 +1085,7 @@ int TextLine::cmpXY(const void *p1, const void *p2) { void TextLine::coalesce(UnicodeMap *uMap) { TextWord *word0, *word1; double space, delta, minSpace; - GBool isUnicode; + bool isUnicode; char buf[8]; int i, j; @@ -1122,7 +1122,7 @@ void TextLine::coalesce(UnicodeMap *uMap) { word1 = words->next; while (word1) { if (word0->primaryDelta(word1) >= space) { - word0->spaceAfter = gTrue; + word0->spaceAfter = true; word0 = word1; word1 = word1->next; } else if (word0->font[word0->len - 1] == word1->font[0] && @@ -1142,7 +1142,7 @@ void TextLine::coalesce(UnicodeMap *uMap) { } // build the line text - isUnicode = uMap ? uMap->isUnicode() : gFalse; + isUnicode = uMap ? uMap->isUnicode() : false; len = 0; for (word1 = words; word1; word1 = word1->next) { len += word1->len; @@ -1200,7 +1200,7 @@ public: int col; // first column void init(TextLine *lineA, int startA, int lenA); - void computeCoords(GBool oneRot); + void computeCoords(bool oneRot); static int cmpYXPrimaryRot(const void *p1, const void *p2); static int cmpYXLineRot(const void *p1, const void *p2); @@ -1216,7 +1216,7 @@ void TextLineFrag::init(TextLine *lineA, int startA, int lenA) { col = line->col[start]; } -void TextLineFrag::computeCoords(GBool oneRot) { +void TextLineFrag::computeCoords(bool oneRot) { TextBlock *blk; double d0, d1, d2, d3, d4; @@ -1503,7 +1503,7 @@ TextBlock::TextBlock(TextPage *pageA, int rotA) { next = nullptr; stackNext = nullptr; tableId = -1; - tableEnd = gFalse; + tableEnd = false; } TextBlock::~TextBlock() { @@ -1548,7 +1548,7 @@ void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) { double minBase, maxBase; double fontSize, wordSpacing, delta, priDelta, secDelta; TextLine **lineArray; - GBool found, overlap; + bool found, overlap; int col1, col2; int i, j, k; @@ -1559,7 +1559,7 @@ void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) { priDelta = dupMaxPriDelta * word0->fontSize; secDelta = dupMaxSecDelta * word0->fontSize; maxBaseIdx = pool->getBaseIdx(word0->base + secDelta); - found = gFalse; + found = false; word1 = word2 = nullptr; // make gcc happy for (idx1 = idx0; idx1 <= maxBaseIdx; ++idx1) { if (idx1 == idx0) { @@ -1664,7 +1664,7 @@ void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) { // this line bestWordBaseIdx = 0; bestWord0 = bestWord1 = nullptr; - overlap = gFalse; + overlap = false; for (baseIdx = minBaseIdx; !overlap && baseIdx <= maxBaseIdx; ++baseIdx) { @@ -1675,7 +1675,7 @@ void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) { word1->base <= maxBase) { delta = lastWord->primaryDelta(word1); if (delta < minCharSpacing * fontSize) { - overlap = gTrue; + overlap = true; break; } else { if (delta < wordSpacing && @@ -1816,9 +1816,9 @@ void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) { void TextBlock::updatePriMinMax(TextBlock *blk) { double newPriMin, newPriMax; - GBool gotPriMin, gotPriMax; + bool gotPriMin, gotPriMax; - gotPriMin = gotPriMax = gFalse; + gotPriMin = gotPriMax = false; newPriMin = newPriMax = 0; // make gcc happy switch (page->primaryRot) { case 0: @@ -1826,11 +1826,11 @@ void TextBlock::updatePriMinMax(TextBlock *blk) { if (blk->yMin < yMax && blk->yMax > yMin) { if (blk->xMin < xMin) { newPriMin = blk->xMax; - gotPriMin = gTrue; + gotPriMin = true; } if (blk->xMax > xMax) { newPriMax = blk->xMin; - gotPriMax = gTrue; + gotPriMax = true; } } break; @@ -1839,11 +1839,11 @@ void TextBlock::updatePriMinMax(TextBlock *blk) { if (blk->xMin < xMax && blk->xMax > xMin) { if (blk->yMin < yMin) { newPriMin = blk->yMax; - gotPriMin = gTrue; + gotPriMin = true; } if (blk->yMax > yMax) { newPriMax = blk->yMin; - gotPriMax = gTrue; + gotPriMax = true; } } break; @@ -1970,10 +1970,10 @@ double TextBlock::secondaryDelta(TextBlock *blk) { return delta; } -GBool TextBlock::isBelow(TextBlock *blk) { - GBool below; +bool TextBlock::isBelow(TextBlock *blk) { + bool below; - below = gFalse; // make gcc happy + below = false; // make gcc happy switch (page->primaryRot) { case 0: below = xMin >= blk->priMin && xMax <= blk->priMax && @@ -1996,9 +1996,9 @@ GBool TextBlock::isBelow(TextBlock *blk) { return below; } -GBool TextBlock::isBeforeByRule1(TextBlock *blk1) { - GBool before = gFalse; - GBool overlap = gFalse; +bool TextBlock::isBeforeByRule1(TextBlock *blk1) { + bool before = false; + bool overlap = false; switch (this->page->primaryRot) { case 0: @@ -2033,7 +2033,7 @@ GBool TextBlock::isBeforeByRule1(TextBlock *blk1) { return before; } -GBool TextBlock::isBeforeByRule2(TextBlock *blk1) { +bool TextBlock::isBeforeByRule2(TextBlock *blk1) { double cmp = 0; int rotLR = rot; @@ -2065,11 +2065,11 @@ GBool TextBlock::isBeforeByRule2(TextBlock *blk1) { // http://en.wikipedia.org/wiki/Topological_sorting int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, TextBlock **sorted, int sortPos, - GBool* visited, + bool* visited, TextBlock **cache, int cacheSize) { int pos2; TextBlock *blk1, *blk2, *blk3; - GBool before; + bool before; if (visited[pos1]) { return sortPos; @@ -2081,7 +2081,7 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, printf("visited: %d %.2f..%.2f %.2f..%.2f\n", sortPos, blk1->ExMin, blk1->ExMax, blk1->EyMin, blk1->EyMax); #endif - visited[pos1] = gTrue; + visited[pos1] = true; pos2 = -1; for (blk2 = blkList; blk2; blk2 = blk2->next) { pos2++; @@ -2089,7 +2089,7 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, // skip visited nodes continue; } - before = gFalse; + before = false; // is blk2 before blk1? (for table entries) if (blk1->tableId >= 0 && blk1->tableId == blk2->tableId) { @@ -2097,20 +2097,20 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, if (blk2->xMax <= blk1->xMin && blk2->yMin <= blk1->yMax && blk2->yMax >= blk1->yMin) - before = gTrue; + before = true; } else { if (blk2->xMin >= blk1->xMax && blk2->yMin <= blk1->yMax && blk2->yMax >= blk1->yMin) - before = gTrue; + before = true; } if (blk2->yMax <= blk1->yMin) - before = gTrue; + before = true; } else { if (blk2->isBeforeByRule1(blk1)) { // Rule (1) blk1 and blk2 overlap, and blk2 is above blk1. - before = gTrue; + before = true; #if 0 // for debugging printf("rule1: %.2f..%.2f %.2f..%.2f %.2f..%.2f %.2f..%.2f\n", blk2->ExMin, blk2->ExMax, blk2->EyMin, blk2->EyMax, @@ -2120,11 +2120,11 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, // Rule (2) blk2 left of blk1, and no intervening blk3 // such that blk1 is before blk3 by rule 1, // and blk3 is before blk2 by rule 1. - before = gTrue; + before = true; for (int i = 0; i < cacheSize && cache[i]; ++i) { if (blk1->isBeforeByRule1(cache[i]) && cache[i]->isBeforeByRule1(blk2)) { - before = gFalse; + before = false; std::rotate(cache, cache + i, cache + i + 1); break; } @@ -2137,7 +2137,7 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, } if (blk1->isBeforeByRule1(blk3) && blk3->isBeforeByRule1(blk2)) { - before = gFalse; + before = false; std::copy_backward(cache, cache + cacheSize - 1, cache + cacheSize); cache[0] = blk3; @@ -2170,7 +2170,7 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1, TextBlock **sorted, int sortPos, - GBool* visited) { + bool* visited) { const int blockCacheSize = 4; TextBlock *blockCache[blockCacheSize]; std::fill(blockCache, blockCache + blockCacheSize, nullptr); @@ -2225,15 +2225,15 @@ void TextFlow::addBlock(TextBlock *blk) { } } -GBool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) { - GBool fits; +bool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) { + bool fits; // lower blocks must use smaller fonts if (blk->lines->words->fontSize > lastBlk->lines->words->fontSize) { - return gFalse; + return false; } - fits = gFalse; // make gcc happy + fits = false; // make gcc happy switch (page->primaryRot) { case 0: fits = blk->xMin >= priMin && blk->xMax <= priMax; @@ -2257,7 +2257,7 @@ GBool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) { // TextWordList //------------------------------------------------------------------------ -TextWordList::TextWordList(TextPage *text, GBool physLayout) { +TextWordList::TextWordList(TextPage *text, bool physLayout) { TextFlow *flow; TextBlock *blk; TextLine *line; @@ -2336,7 +2336,7 @@ TextWord *TextWordList::get(int idx) { // TextPage //------------------------------------------------------------------------ -TextPage::TextPage(GBool rawOrderA) { +TextPage::TextPage(bool rawOrderA) { int rot; refCnt = 1; @@ -2347,7 +2347,7 @@ TextPage::TextPage(GBool rawOrderA) { curFontSize = 0; nest = 0; nTinyChars = 0; - lastCharOverlap = gFalse; + lastCharOverlap = false; if (!rawOrder) { for (rot = 0; rot < 4; ++rot) { pools[rot] = new TextPool(); @@ -2359,10 +2359,10 @@ TextPage::TextPage(GBool rawOrderA) { rawLastWord = nullptr; fonts = new GooList(); lastFindXMin = lastFindYMin = 0; - haveLastFind = gFalse; + haveLastFind = false; underlines = new GooList(); links = new GooList(); - mergeCombining = gTrue; + mergeCombining = true; } TextPage::~TextPage() { @@ -2490,7 +2490,7 @@ void TextPage::updateFont(GfxState *state) { for (code = 0; code < 256; ++code) { name = ((Gfx8BitFont *)gfxFont)->getCharName(code); int nameLen = name ? strlen(name) : 0; - GBool nameOneChar = nameLen == 1 || (nameLen > 1 && name[1] == '\0'); + bool nameOneChar = nameLen == 1 || (nameLen > 1 && name[1] == '\0'); if (nameOneChar && name[0] == 'm') { mCode = code; } @@ -2571,7 +2571,7 @@ void TextPage::addChar(GfxState *state, double x, double y, double dx, double dy, CharCode c, int nBytes, Unicode *u, int uLen) { double x1, y1, w1, h1, dx2, dy2, base, sp, delta; - GBool overlap; + bool overlap; int i; int wMode; Matrix mat; @@ -2676,7 +2676,7 @@ void TextPage::addChar(GfxState *state, double x, double y, } lastCharOverlap = overlap; } else { - lastCharOverlap = gFalse; + lastCharOverlap = false; } if (uLen != 0) { @@ -2757,7 +2757,7 @@ void TextPage::addLink(int xMin, int yMin, int xMax, int yMax, AnnotLink *link) links->push_back(new TextLink(xMin, yMin, xMax, yMax, link)); } -void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { +void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) { UnicodeMap *uMap; TextPool *pool; TextWord *word0, *word1, *word2; @@ -2769,7 +2769,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { int rot, poolMinBaseIdx, baseIdx, startBaseIdx, endBaseIdx; double minBase, maxBase, newMinBase, newMaxBase; double fontSize, colSpace1, colSpace2, lineSpace, intraLineSpace, blkSpace; - GBool found; + bool found; int count[4]; int lrCount; int col1, col2; @@ -2777,7 +2777,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { if (rawOrder) { primaryRot = 0; - primaryLR = gTrue; + primaryLR = true; return; } @@ -2830,7 +2830,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { //~ need to check the y value against the word baseline if (underline->x0 < word0->xMin + underlineSlack && word0->xMax - underlineSlack < underline->x1) { - word0->underlined = gTrue; + word0->underlined = true; } } } @@ -2844,7 +2844,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { for (word0 = pools[2]->getPool(j); word0; word0 = word0->next) { if (underline->x0 < word0->xMin + underlineSlack && word0->xMax - underlineSlack < underline->x1) { - word0->underlined = gTrue; + word0->underlined = true; } } } @@ -2858,7 +2858,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { for (word0 = pools[1]->getPool(j); word0; word0 = word0->next) { if (underline->y0 < word0->yMin + underlineSlack && word0->yMax - underlineSlack < underline->y1) { - word0->underlined = gTrue; + word0->underlined = true; } } } @@ -2872,7 +2872,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { for (word0 = pools[3]->getPool(j); word0; word0 = word0->next) { if (underline->y0 < word0->yMin + underlineSlack && word0->yMax - underlineSlack < underline->y1) { - word0->underlined = gTrue; + word0->underlined = true; } } } @@ -3003,7 +3003,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { // add words to the block do { - found = gFalse; + found = false; // look for words on the line above the current top edge of // the block @@ -3030,7 +3030,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { word1 = word1->next; word2->next = nullptr; blk->addWord(word2); - found = gTrue; + found = true; newMinBase = word2->base; } else { word0 = word1; @@ -3065,7 +3065,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { word1 = word1->next; word2->next = nullptr; blk->addWord(word2); - found = gTrue; + found = true; newMaxBase = word2->base; } else { word0 = word1; @@ -3101,7 +3101,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { word1 = word1->next; word2->next = nullptr; blk->addWord(word2); - found = gTrue; + found = true; } else { word0 = word1; word1 = word1->next; @@ -3169,7 +3169,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { } else if (word2->base > maxBase) { maxBase = word2->base; } - found = gTrue; + found = true; break; } else { word0 = word1; @@ -3233,7 +3233,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { } else if (word2->base > maxBase) { maxBase = word2->base; } - found = gTrue; + found = true; break; } else { word0 = word1; @@ -3470,9 +3470,9 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { #endif int sortPos = 0; - GBool *visited = (GBool *)gmallocn(nBlocks, sizeof(GBool)); + bool *visited = (bool *)gmallocn(nBlocks, sizeof(bool)); for (i = 0; i < nBlocks; i++) { - visited[i] = gFalse; + visited[i] = false; } double bxMin0, byMin0, bxMin1, byMin1; @@ -3679,7 +3679,7 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { if (blk1->tableId >= 0 && blk1->xMin <= ending_blocks[blk1->tableId]->xMax && blk1->xMax >= ending_blocks[blk1->tableId]->xMin) { - blk1->tableEnd = gTrue; + blk1->tableEnd = true; } } @@ -3833,11 +3833,11 @@ void TextPage::coalesce(GBool physLayout, double fixedPitch, GBool doHTML) { } } -GBool TextPage::findText(Unicode *s, int len, - GBool startAtTop, GBool stopAtBottom, - GBool startAtLast, GBool stopAtLast, - GBool caseSensitive, GBool backward, - GBool wholeWord, +bool TextPage::findText(Unicode *s, int len, + bool startAtTop, bool stopAtBottom, + bool startAtLast, bool stopAtLast, + bool caseSensitive, bool backward, + bool wholeWord, double *xMin, double *yMin, double *xMax, double *yMax) { TextBlock *blk; @@ -3848,11 +3848,11 @@ GBool TextPage::findText(Unicode *s, int len, double xStart, yStart, xStop, yStop; double xMin0, yMin0, xMax0, yMax0; double xMin1, yMin1, xMax1, yMax1; - GBool found; + bool found; if (rawOrder) { - return gFalse; + return false; } // handle right-to-left text @@ -3888,7 +3888,7 @@ GBool TextPage::findText(Unicode *s, int len, yStop = *yMax; } - found = gFalse; + found = false; xMin0 = xMax0 = yMin0 = yMax0 = 0; // make gcc happy xMin1 = xMax1 = yMin1 = yMax1 = 0; // make gcc happy @@ -4009,7 +4009,7 @@ GBool TextPage::findText(Unicode *s, int len, xMax0 = xMax1; yMin0 = yMin1; yMax0 = yMax1; - found = gTrue; + found = true; } } } else { @@ -4023,7 +4023,7 @@ GBool TextPage::findText(Unicode *s, int len, xMax0 = xMax1; yMin0 = yMin1; yMax0 = yMax1; - found = gTrue; + found = true; } } } @@ -4053,11 +4053,11 @@ GBool TextPage::findText(Unicode *s, int len, *yMax = yMax0; lastFindXMin = xMin0; lastFindYMin = yMin0; - haveLastFind = gTrue; - return gTrue; + haveLastFind = true; + return true; } - return gFalse; + return false; } GooString *TextPage::getText(double xMin, double yMin, @@ -4074,7 +4074,7 @@ GooString *TextPage::getText(double xMin, double yMin, int lastRot; double x, y, delta; int col, idx0, idx1, i, j; - GBool multiLine, oneRot; + bool multiLine, oneRot; s = new GooString(); @@ -4124,7 +4124,7 @@ GooString *TextPage::getText(double xMin, double yMin, frags = (TextLineFrag *)gmallocn(fragsSize, sizeof(TextLineFrag)); nFrags = 0; lastRot = -1; - oneRot = gTrue; + oneRot = true; for (i = 0; i < nBlocks; ++i) { blk = blocks[i]; if (xMin < blk->xMax && blk->xMin < xMax && @@ -4228,7 +4228,7 @@ GooString *TextPage::getText(double xMin, double yMin, frags[nFrags].init(line, idx0, idx1 - idx0 + 1); ++nFrags; if (lastRot >= 0 && line->rot != lastRot) { - oneRot = gFalse; + oneRot = false; } lastRot = line->rot; } @@ -4267,7 +4267,7 @@ GooString *TextPage::getText(double xMin, double yMin, } col = 0; - multiLine = gFalse; + multiLine = false; for (i = 0; i < nFrags; ++i) { frag = &frags[i]; @@ -4277,7 +4277,7 @@ GooString *TextPage::getText(double xMin, double yMin, maxIntraLineDelta * frags[i-1].line->words->fontSize)) { s->append(eol, eolLen); col = 0; - multiLine = gTrue; + multiLine = true; } // column alignment @@ -4599,7 +4599,7 @@ TextSelectionPainter::TextSelectionPainter(TextPage *page, PDFRectangle box(0, 0, page->pageWidth, page->pageHeight); selectionList = new GooList(); - state = new GfxState(72 * scale, 72 * scale, &box, rotation, gFalse); + state = new GfxState(72 * scale, 72 * scale, &box, rotation, false); state->getCTM(&ctm); ctm.invertTo(&ictm); @@ -4815,7 +4815,7 @@ void TextBlock::visitSelection(TextSelectionVisitor *visitor, double x[2], y[2], d, best_d[2]; TextLine *p, *best_line[2]; int i, count = 0, best_count[2], start, stop; - GBool all[2]; + bool all[2]; x[0] = selection->x1; y[0] = selection->y1; @@ -5091,7 +5091,7 @@ GooList **TextPage::getSelectionWords(PDFRectangle *selection, return dumper.takeWordList(nLines); } -GBool TextPage::findCharRange(int pos, int length, +bool TextPage::findCharRange(int pos, int length, double *xMin, double *yMin, double *xMax, double *yMax) { TextBlock *blk; @@ -5099,17 +5099,17 @@ GBool TextPage::findCharRange(int pos, int length, TextWord *word; double xMin0, xMax0, yMin0, yMax0; double xMin1, xMax1, yMin1, yMax1; - GBool first; + bool first; int i, j0, j1; if (rawOrder) { - return gFalse; + return false; } //~ this doesn't correctly handle ranges split across multiple lines //~ (the highlighted region is the bounding box of all the parts of //~ the range) - first = gTrue; + first = true; xMin0 = xMax0 = yMin0 = yMax0 = 0; // make gcc happy xMin1 = xMax1 = yMin1 = yMax1 = 0; // make gcc happy for (i = 0; i < nBlocks; ++i) { @@ -5162,7 +5162,7 @@ GBool TextPage::findCharRange(int pos, int length, if (first || yMax1 > yMax0) { yMax0 = yMax1; } - first = gFalse; + first = false; } } } @@ -5172,13 +5172,13 @@ GBool TextPage::findCharRange(int pos, int length, *xMax = xMax0; *yMin = yMin0; *yMax = yMax0; - return gTrue; + return true; } - return gFalse; + return false; } void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, - GBool physLayout) { + bool physLayout) { UnicodeMap *uMap; TextFlow *flow; TextBlock *blk; @@ -5189,7 +5189,7 @@ void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, TextLineFrag *frag; char space[8], eol[16], eop[8]; int spaceLen, eolLen, eopLen; - GBool pageBreaks; + bool pageBreaks; GooString *s; double delta; int col, i, j, d, n; @@ -5254,7 +5254,7 @@ void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, fragsSize, sizeof(TextLineFrag)); } frags[nFrags].init(line, 0, line->len); - frags[nFrags].computeCoords(gTrue); + frags[nFrags].computeCoords(true); ++nFrags; } } @@ -5356,11 +5356,11 @@ void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, uMap->decRefCnt(); } -void TextPage::setMergeCombining(GBool merge) { +void TextPage::setMergeCombining(bool merge) { mergeCombining = merge; } -void TextPage::assignColumns(TextLineFrag *frags, int nFrags, GBool oneRot) { +void TextPage::assignColumns(TextLineFrag *frags, int nFrags, bool oneRot) { TextLineFrag *frag0, *frag1; int rot, col1, col2, i, j, k; @@ -5477,7 +5477,7 @@ int TextPage::dumpFragment(Unicode *text, int len, UnicodeMap *uMap, } #ifdef TEXTOUT_WORD_LIST -TextWordList *TextPage::makeWordList(GBool physLayout) { +TextWordList *TextPage::makeWordList(bool physLayout) { return new TextWordList(this, physLayout); } #endif @@ -5554,18 +5554,18 @@ static void TextOutputDev_outputToFile(void *stream, const char *text, int len) fwrite(text, 1, len, (FILE *)stream); } -TextOutputDev::TextOutputDev(const char *fileName, GBool physLayoutA, - double fixedPitchA, GBool rawOrderA, - GBool append) { +TextOutputDev::TextOutputDev(const char *fileName, bool physLayoutA, + double fixedPitchA, bool rawOrderA, + bool append) { text = nullptr; physLayout = physLayoutA; fixedPitch = physLayout ? fixedPitchA : 0; rawOrder = rawOrderA; - doHTML = gFalse; - ok = gTrue; + doHTML = false; + ok = true; // open file - needClose = gFalse; + needClose = false; if (fileName) { if (!strcmp(fileName, "-")) { outputStream = stdout; @@ -5574,10 +5574,10 @@ TextOutputDev::TextOutputDev(const char *fileName, GBool physLayoutA, setmode(fileno(stdout), O_BINARY); #endif } else if ((outputStream = fopen(fileName, append ? "ab" : "wb"))) { - needClose = gTrue; + needClose = true; } else { error(errIO, -1, "Couldn't open text file '{0:s}'", fileName); - ok = gFalse; + ok = false; actualText = nullptr; return; } @@ -5592,18 +5592,18 @@ TextOutputDev::TextOutputDev(const char *fileName, GBool physLayoutA, } TextOutputDev::TextOutputDev(TextOutputFunc func, void *stream, - GBool physLayoutA, double fixedPitchA, - GBool rawOrderA) { + bool physLayoutA, double fixedPitchA, + bool rawOrderA) { outputFunc = func; outputStream = stream; - needClose = gFalse; + needClose = false; physLayout = physLayoutA; fixedPitch = physLayout ? fixedPitchA : 0; rawOrder = rawOrderA; - doHTML = gFalse; + doHTML = false; text = new TextPage(rawOrderA); actualText = new ActualText(text); - ok = gTrue; + ok = true; } TextOutputDev::~TextOutputDev() { @@ -5813,11 +5813,11 @@ void TextOutputDev::processLink(AnnotLink *link) { text->addLink(xMin, yMin, xMax, yMax, link); } -GBool TextOutputDev::findText(Unicode *s, int len, - GBool startAtTop, GBool stopAtBottom, - GBool startAtLast, GBool stopAtLast, - GBool caseSensitive, GBool backward, - GBool wholeWord, +bool TextOutputDev::findText(Unicode *s, int len, + bool startAtTop, bool stopAtBottom, + bool startAtLast, bool stopAtLast, + bool caseSensitive, bool backward, + bool wholeWord, double *xMin, double *yMin, double *xMax, double *yMax) { return text->findText(s, len, startAtTop, stopAtBottom, @@ -5852,13 +5852,13 @@ GooString *TextOutputDev::getSelectionText(PDFRectangle *selection, return text->getSelectionText(selection, style); } -GBool TextOutputDev::findCharRange(int pos, int length, +bool TextOutputDev::findCharRange(int pos, int length, double *xMin, double *yMin, double *xMax, double *yMax) { return text->findCharRange(pos, length, xMin, yMin, xMax, yMax); } -void TextOutputDev::setMergeCombining(GBool merge) { +void TextOutputDev::setMergeCombining(bool merge) { text->setMergeCombining(merge); } diff --git a/poppler/TextOutputDev.h b/poppler/TextOutputDev.h index eea079ef..1daf9641 100644 --- a/poppler/TextOutputDev.h +++ b/poppler/TextOutputDev.h @@ -80,8 +80,8 @@ public: TextFontInfo(const TextFontInfo &) = delete; TextFontInfo& operator=(const TextFontInfo &) = delete; - GBool matches(GfxState *state) const; - GBool matches(const TextFontInfo *fontInfo) const; + bool matches(GfxState *state) const; + bool matches(const TextFontInfo *fontInfo) const; // Get the font ascent, or a default value if the font is not set double getAscent() const; @@ -97,11 +97,11 @@ public: const GooString *getFontName() const { return fontName; } // Get font descriptor flags. - GBool isFixedWidth() const { return flags & fontFixedWidth; } - GBool isSerif() const { return flags & fontSerif; } - GBool isSymbolic() const { return flags & fontSymbolic; } - GBool isItalic() const { return flags & fontItalic; } - GBool isBold() const { return flags & fontBold; } + bool isFixedWidth() const { return flags & fontFixedWidth; } + bool isSerif() const { return flags & fontSerif; } + bool isSymbolic() const { return flags & fontSymbolic; } + bool isItalic() const { return flags & fontItalic; } + bool isBold() const { return flags & fontBold; } #endif private: @@ -142,7 +142,7 @@ public: // Either character u or the last character in the word must be an // acute, dieresis, or other combining character. Returns true if // the character was added. - GBool addCombining(GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y, + bool addCombining(GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y, double dx, double dy, int charPosA, int charLen, CharCode c, Unicode u, const Matrix &textMatA); @@ -184,13 +184,13 @@ public: int getRotation() { return rot; } int getCharPos() { return charPos[0]; } int getCharLen() { return charPos[len] - charPos[0]; } - GBool getSpaceAfter() { return spaceAfter; } + bool getSpaceAfter() { return spaceAfter; } #endif - GBool isUnderlined() { return underlined; } + bool isUnderlined() { return underlined; } AnnotLink *getLink() { return link; } double getEdge(int i) { return edge[i]; } double getBaseline () { return base; } - GBool hasSpaceAfter () { return spaceAfter; } + bool hasSpaceAfter () { return spaceAfter; } TextWord* nextWord () { return next; }; private: void ensureCapacity(int capacity); @@ -214,9 +214,9 @@ private: TextFontInfo **font; // font information for each char Matrix *textMat; // transformation matrix for each char double fontSize; // font size - GBool spaceAfter; // set if there is a space between this + bool spaceAfter; // set if there is a space between this // word and the next word on the line - GBool underlined; + bool underlined; TextWord *next; // next word in line #ifdef TEXTOUT_WORD_LIST @@ -318,7 +318,7 @@ public: TextLine *getNext() { return next; } // Returns true if the last char of the line is a hyphen. - GBool isHyphenated() { return hyphenated; } + bool isHyphenated() { return hyphenated; } private: @@ -336,7 +336,7 @@ private: int *col; // starting column number of each Unicode char int len; // number of Unicode chars int convertedLen; // total number of converted characters - GBool hyphenated; // set if last char is a hyphen + bool hyphenated; // set if last char is a hyphen TextLine *next; // next line in block Unicode *normalized; // normalized form of Unicode text int normalized_len; // number of normalized Unicode chars @@ -383,7 +383,7 @@ public: // Returns true if <this> is below <blk>, relative to the page's // primary rotation. - GBool isBelow(TextBlock *blk); + bool isBelow(TextBlock *blk); void visitSelection(TextSelectionVisitor *visitor, PDFRectangle *selection, @@ -402,16 +402,16 @@ public: private: - GBool isBeforeByRule1(TextBlock *blk1); - GBool isBeforeByRepeatedRule1(TextBlock *blkList, TextBlock *blk1); - GBool isBeforeByRule2(TextBlock *blk1); + bool isBeforeByRule1(TextBlock *blk1); + bool isBeforeByRepeatedRule1(TextBlock *blkList, TextBlock *blk1); + bool isBeforeByRule2(TextBlock *blk1); int visitDepthFirst(TextBlock *blkList, int pos1, TextBlock **sorted, int sortPos, - GBool* visited); + bool* visited); int visitDepthFirst(TextBlock *blkList, int pos1, TextBlock **sorted, int sortPos, - GBool* visited, + bool* visited, TextBlock **cache, int cacheSize); TextPage *page; // the parent page @@ -422,7 +422,7 @@ private: double ExMin, ExMax; // extended bounding box x coordinates double EyMin, EyMax; // extended bounding box y coordinates int tableId; // id of table to which this block belongs - GBool tableEnd; // is this block at end of line of actual table + bool tableEnd; // is this block at end of line of actual table TextPool *pool; // pool of words (used only until lines // are built) @@ -465,7 +465,7 @@ public: // it uses a font no larger than the last block added to the flow, // and (2) it fits within the flow's [priMin, priMax] along the // primary axis. - GBool blockFits(TextBlock *blk, TextBlock *prevBlk); + bool blockFits(TextBlock *blk, TextBlock *prevBlk); // Get the head of the linked list of TextBlocks. TextBlock *getBlocks() { return blocks; } @@ -500,7 +500,7 @@ public: // text->rawOrder is true), physical layout order (if <physLayout> // is true and text->rawOrder is false), or reading order (if both // flags are false). - TextWordList(TextPage *text, GBool physLayout); + TextWordList(TextPage *text, bool physLayout); ~TextWordList(); @@ -548,7 +548,7 @@ class TextPage { public: // Constructor. - TextPage(GBool rawOrderA); + TextPage(bool rawOrderA); TextPage(const TextPage &) = delete; TextPage& operator=(const TextPage &) = delete; @@ -589,7 +589,7 @@ public: void addLink(int xMin, int yMin, int xMax, int yMax, AnnotLink *link); // Coalesce strings that look like parts of the same line. - void coalesce(GBool physLayout, double fixedPitch, GBool doHTML); + void coalesce(bool physLayout, double fixedPitch, bool doHTML); // Find a string. If <startAtTop> is true, starts looking at the // top of the page; else if <startAtLast> is true, starts looking @@ -598,11 +598,11 @@ public: // bottom of the page; else if <stopAtLast> is true, stops looking // just before the last find result; else stops looking at // <xMax>,<yMax>. - GBool findText(Unicode *s, int len, - GBool startAtTop, GBool stopAtBottom, - GBool startAtLast, GBool stopAtLast, - GBool caseSensitive, GBool backward, - GBool wholeWord, + bool findText(Unicode *s, int len, + bool startAtTop, bool stopAtBottom, + bool startAtLast, bool stopAtLast, + bool caseSensitive, bool backward, + bool wholeWord, double *xMin, double *yMin, double *xMax, double *yMax); @@ -635,27 +635,27 @@ public: // Find a string by character position and length. If found, sets // the text bounding rectangle and returns true; otherwise returns // false. - GBool findCharRange(int pos, int length, + bool findCharRange(int pos, int length, double *xMin, double *yMin, double *xMax, double *yMax); // Dump contents of page to a file. void dump(void *outputStream, TextOutputFunc outputFunc, - GBool physLayout); + bool physLayout); // Get the head of the linked list of TextFlows. TextFlow *getFlows() { return flows; } // If true, will combine characters when a base and combining // character are drawn on eachother. - void setMergeCombining(GBool merge); + void setMergeCombining(bool merge); #ifdef TEXTOUT_WORD_LIST // Build a flat word list, in content stream order (if // this->rawOrder is true), physical layout order (if <physLayout> // is true and this->rawOrder is false), or reading order (if both // flags are false). - TextWordList *makeWordList(GBool physLayout); + TextWordList *makeWordList(bool physLayout); #endif private: @@ -664,11 +664,11 @@ private: ~TextPage(); void clear(); - void assignColumns(TextLineFrag *frags, int nFrags, GBool rot); + void assignColumns(TextLineFrag *frags, int nFrags, bool rot); int dumpFragment(Unicode *text, int len, UnicodeMap *uMap, GooString *s); - GBool rawOrder; // keep text in content stream order - GBool mergeCombining; // merge when combining and base characters + bool rawOrder; // keep text in content stream order + bool mergeCombining; // merge when combining and base characters // are drawn on top of each other double pageWidth, pageHeight; // width and height of current page @@ -679,7 +679,7 @@ private: double curFontSize; // current font size int nest; // current nesting level (for Type 3 fonts) int nTinyChars; // number of "tiny" chars seen so far - GBool lastCharOverlap; // set if the last added char overlapped the + bool lastCharOverlap; // set if the last added char overlapped the // previous char TextPool *pools[4]; // a "pool" of TextWords for each rotation @@ -687,7 +687,7 @@ private: TextBlock **blocks; // array of blocks, in yx order int nBlocks; // number of blocks int primaryRot; // primary rotation - GBool primaryLR; // primary direction (true means L-to-R, + bool primaryLR; // primary direction (true means L-to-R, // false means R-to-L) TextWord *rawWords; // list of words, in raw order (only if // rawOrder is set) @@ -698,7 +698,7 @@ private: double lastFindXMin, // coordinates of the last "find" result lastFindYMin; - GBool haveLastFind; + bool haveLastFind; GooList *underlines; // [TextUnderline] GooList *links; // [TextLink] @@ -757,43 +757,43 @@ public: // <physLayoutA> is true, the original physical layout of the text // is maintained. If <rawOrder> is true, the text is kept in // content stream order. - TextOutputDev(const char *fileName, GBool physLayoutA, - double fixedPitchA, GBool rawOrderA, - GBool append); + TextOutputDev(const char *fileName, bool physLayoutA, + double fixedPitchA, bool rawOrderA, + bool append); // Create a TextOutputDev which will write to a generic stream. If // <physLayoutA> is true, the original physical layout of the text // is maintained. If <rawOrder> is true, the text is kept in // content stream order. TextOutputDev(TextOutputFunc func, void *stream, - GBool physLayoutA, double fixedPitchA, - GBool rawOrderA); + bool physLayoutA, double fixedPitchA, + bool rawOrderA); // Destructor. ~TextOutputDev(); // Check if file was successfully created. - virtual GBool isOk() { return ok; } + virtual bool isOk() { return ok; } //---- get info about output device // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need non-text content? - GBool needNonText() override { return gFalse; } + bool needNonText() override { return false; } // Does this device require incCharCount to be called for text on // non-shown layers? - GBool needCharCount() override { return gTrue; } + bool needCharCount() override { return true; } //----- initialization and control @@ -837,11 +837,11 @@ public: // bottom of the page; else if <stopAtLast> is true, stops looking // just before the last find result; else stops looking at // <xMax>,<yMax>. - GBool findText(Unicode *s, int len, - GBool startAtTop, GBool stopAtBottom, - GBool startAtLast, GBool stopAtLast, - GBool caseSensitive, GBool backward, - GBool wholeWord, + bool findText(Unicode *s, int len, + bool startAtTop, bool stopAtBottom, + bool startAtLast, bool stopAtLast, + bool caseSensitive, bool backward, + bool wholeWord, double *xMin, double *yMin, double *xMax, double *yMax); @@ -852,7 +852,7 @@ public: // Find a string by character position and length. If found, sets // the text bounding rectangle and returns true; otherwise returns // false. - GBool findCharRange(int pos, int length, + bool findCharRange(int pos, int length, double *xMin, double *yMin, double *xMax, double *yMax); @@ -870,7 +870,7 @@ public: // If true, will combine characters when a base and combining // character are drawn on eachother. - void setMergeCombining(GBool merge); + void setMergeCombining(bool merge); #ifdef TEXTOUT_WORD_LIST // Build a flat word list, in content stream order (if @@ -885,7 +885,7 @@ public: TextPage *takeText(); // Turn extra processing for HTML conversion on or off. - void enableHTMLExtras(GBool doHTMLA) { doHTML = doHTMLA; } + void enableHTMLExtras(bool doHTMLA) { doHTML = doHTMLA; } // Get the head of the linked list of TextFlows for the // last rasterized page. @@ -895,17 +895,17 @@ private: TextOutputFunc outputFunc; // output function void *outputStream; // output stream - GBool needClose; // need to close the output file? + bool needClose; // need to close the output file? // (only if outputStream is a FILE*) TextPage *text; // text for the current page - GBool physLayout; // maintain original physical layout when + bool physLayout; // maintain original physical layout when // dumping text double fixedPitch; // if physLayout is true and this is non-zero, // assume fixed-pitch characters with this // width - GBool rawOrder; // keep text in content stream order - GBool doHTML; // extra processing for HTML conversion - GBool ok; // set up ok? + bool rawOrder; // keep text in content stream order + bool doHTML; // extra processing for HTML conversion + bool ok; // set up ok? ActualText *actualText; }; diff --git a/poppler/UnicodeMap.cc b/poppler/UnicodeMap.cc index b66f36f5..b71328ac 100644 --- a/poppler/UnicodeMap.cc +++ b/poppler/UnicodeMap.cc @@ -129,7 +129,7 @@ UnicodeMap *UnicodeMap::parse(GooString *encodingNameA) { UnicodeMap::UnicodeMap(GooString *encodingNameA) { encodingName = encodingNameA; - unicodeOut = gFalse; + unicodeOut = false; kind = unicodeMapUser; ranges = nullptr; len = 0; @@ -138,7 +138,7 @@ UnicodeMap::UnicodeMap(GooString *encodingNameA) { refCnt = 1; } -UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA, +UnicodeMap::UnicodeMap(const char *encodingNameA, bool unicodeOutA, UnicodeMapRange *rangesA, int lenA) { encodingName = new GooString(encodingNameA); unicodeOut = unicodeOutA; @@ -150,7 +150,7 @@ UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA, refCnt = 1; } -UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA, +UnicodeMap::UnicodeMap(const char *encodingNameA, bool unicodeOutA, UnicodeMapFunc funcA) { encodingName = new GooString(encodingNameA); unicodeOut = unicodeOutA; @@ -255,7 +255,7 @@ void UnicodeMap::decRefCnt() { } } -GBool UnicodeMap::match(const GooString *encodingNameA) const { +bool UnicodeMap::match(const GooString *encodingNameA) const { return !encodingName->cmp(encodingNameA); } diff --git a/poppler/UnicodeMap.h b/poppler/UnicodeMap.h index 48fcec16..070faebc 100644 --- a/poppler/UnicodeMap.h +++ b/poppler/UnicodeMap.h @@ -61,12 +61,12 @@ public: static UnicodeMap *parse(GooString *encodingNameA); // Create a resident UnicodeMap. - UnicodeMap(const char *encodingNameA, GBool unicodeOutA, + UnicodeMap(const char *encodingNameA, bool unicodeOutA, UnicodeMapRange *rangesA, int lenA); // Create a resident UnicodeMap that uses a function instead of a // list of ranges. - UnicodeMap(const char *encodingNameA, GBool unicodeOutA, + UnicodeMap(const char *encodingNameA, bool unicodeOutA, UnicodeMapFunc funcA); UnicodeMap(UnicodeMap &&other) noexcept; @@ -84,11 +84,11 @@ public: const GooString *getEncodingName() const { return encodingName; } - GBool isUnicode() const { return unicodeOut; } + bool isUnicode() const { return unicodeOut; } // Return true if this UnicodeMap matches the specified // <encodingNameA>. - GBool match(const GooString *encodingNameA) const; + bool match(const GooString *encodingNameA) const; // Map Unicode to the target encoding. Fills in <buf> with the // output and returns the number of bytes used. Output will be @@ -102,7 +102,7 @@ private: GooString *encodingName; UnicodeMapKind kind; - GBool unicodeOut; + bool unicodeOut; union { UnicodeMapRange *ranges; // (user, resident) UnicodeMapFunc func; // (func) diff --git a/poppler/UnicodeTypeTable.cc b/poppler/UnicodeTypeTable.cc index 2d1bd768..ccf3d4ef 100644 --- a/poppler/UnicodeTypeTable.cc +++ b/poppler/UnicodeTypeTable.cc @@ -945,19 +945,19 @@ static inline char getType(Unicode c) { return type; } -GBool unicodeTypeL(Unicode c) { +bool unicodeTypeL(Unicode c) { return getType(c) == 'L'; } -GBool unicodeTypeR(Unicode c) { +bool unicodeTypeR(Unicode c) { return getType(c) == 'R'; } -GBool unicodeTypeNum(Unicode c) { +bool unicodeTypeNum(Unicode c) { return getType(c) == '#'; } -GBool unicodeTypeAlphaNum(Unicode c) { +bool unicodeTypeAlphaNum(Unicode c) { char t; t = getType(c); @@ -967,7 +967,7 @@ GBool unicodeTypeAlphaNum(Unicode c) { #define UNICODE_ALPHABETIC_PRESENTATION_BLOCK_BEGIN 0xFB00 #define UNICODE_ALPHABETIC_PRESENTATION_BLOCK_END 0xFB4F -GBool unicodeIsAlphabeticPresentationForm(Unicode c) { +bool unicodeIsAlphabeticPresentationForm(Unicode c) { return c >= UNICODE_ALPHABETIC_PRESENTATION_BLOCK_BEGIN && c <= UNICODE_ALPHABETIC_PRESENTATION_BLOCK_END; } @@ -1018,13 +1018,13 @@ Unicode unicodeToUpper(Unicode c) { // decomposition, write @u into @buf and return 1. // If reverseRTL is true, then decompositions of RTL characters will be output // in reverse order. -static int decomp_compat(Unicode u, Unicode *buf, GBool reverseRTL = false) { +static int decomp_compat(Unicode u, Unicode *buf, bool reverseRTL = false) { // decomposition tables stored as lists {character, decomp_length, offset} // so we do a binary search int start = 0, end = DECOMP_TABLE_LENGTH; if (u >= decomp_table[start].character && u <= decomp_table[end - 1].character) - while (gTrue) { + while (true) { int midpoint = (start + end) / 2; if (u == decomp_table[midpoint].character) { int offset = decomp_table[midpoint].offset; @@ -1064,8 +1064,8 @@ static int decomp_compat(Unicode u, Unicode *buf, GBool reverseRTL = false) { ((((u) / 256) > (COMPOSE_TABLE_LAST)) ? 0 : CI((u) / 256, (u) % 256)) // If @add combines with @base, write the combination to @out and return -// gTrue. Otherwise return gFalse. -static GBool combine(Unicode base, Unicode add, Unicode *out) { +// true. Otherwise return false. +static bool combine(Unicode base, Unicode add, Unicode *out) { unsigned short idx_base, idx_add; idx_base = COMPOSE_INDEX(base); @@ -1074,9 +1074,9 @@ static GBool combine(Unicode base, Unicode add, Unicode *out) { if (compose_first_single[idx_base - COMPOSE_FIRST_SINGLE_START][0] == add) { *out = compose_first_single[idx_base - COMPOSE_FIRST_SINGLE_START][1]; - return gTrue; + return true; } else - return gFalse; + return false; } idx_add = COMPOSE_INDEX(add); @@ -1084,9 +1084,9 @@ static GBool combine(Unicode base, Unicode add, Unicode *out) { if (compose_second_single[idx_add - COMPOSE_SECOND_SINGLE_START][0] == base) { *out = compose_second_single[idx_add - COMPOSE_SECOND_SINGLE_START][1]; - return gTrue; + return true; } else - return gFalse; + return false; } if (idx_base >= COMPOSE_FIRST_START && idx_base < COMPOSE_FIRST_SINGLE_START @@ -1096,11 +1096,11 @@ static GBool combine(Unicode base, Unicode add, Unicode *out) { [idx_add - COMPOSE_SECOND_START]; if (o) { *out = o; - return gTrue; + return true; } } - return gFalse; + return false; } #define HANGUL_S_BASE 0xAC00 @@ -1141,7 +1141,7 @@ Unicode *unicodeNormalizeNFKC(Unicode *in, int len, Unicode *unicodeNormalizeNFKC(Unicode *in, int len, int *out_len, int **indices, - GBool reverseRTL) { + bool reverseRTL) { Unicode *out; int i, o, *classes, *idx = nullptr; diff --git a/poppler/UnicodeTypeTable.h b/poppler/UnicodeTypeTable.h index 978d889f..ca843387 100644 --- a/poppler/UnicodeTypeTable.h +++ b/poppler/UnicodeTypeTable.h @@ -27,15 +27,15 @@ #include "goo/gtypes.h" -extern GBool unicodeTypeL(Unicode c); +extern bool unicodeTypeL(Unicode c); -extern GBool unicodeTypeR(Unicode c); +extern bool unicodeTypeR(Unicode c); -extern GBool unicodeTypeNum(Unicode c); +extern bool unicodeTypeNum(Unicode c); -extern GBool unicodeTypeAlphaNum(Unicode c); +extern bool unicodeTypeAlphaNum(Unicode c); -extern GBool unicodeIsAlphabeticPresentationForm(Unicode c); +extern bool unicodeIsAlphabeticPresentationForm(Unicode c); extern Unicode unicodeToUpper(Unicode c); @@ -44,6 +44,6 @@ extern Unicode *unicodeNormalizeNFKC(Unicode *in, int len, extern Unicode *unicodeNormalizeNFKC(Unicode *in, int len, int *out_len, int **offsets, - GBool reverseRTL); + bool reverseRTL); #endif diff --git a/poppler/ViewerPreferences.cc b/poppler/ViewerPreferences.cc index e45134f2..35a2f7d1 100644 --- a/poppler/ViewerPreferences.cc +++ b/poppler/ViewerPreferences.cc @@ -103,12 +103,12 @@ ViewerPreferences::~ViewerPreferences() void ViewerPreferences::init() { - hideToolbar = gFalse; - hideMenubar = gFalse; - hideWindowUI = gFalse; - fitWindow = gFalse; - centerWindow = gFalse; - displayDocTitle = gFalse; + hideToolbar = false; + hideMenubar = false; + hideWindowUI = false; + fitWindow = false; + centerWindow = false; + displayDocTitle = false; nonFullScreenPageMode = nfpmUseNone; direction = directionL2R; printScaling = printScalingAppDefault; diff --git a/poppler/ViewerPreferences.h b/poppler/ViewerPreferences.h index 8cdc4d40..b9b813a6 100644 --- a/poppler/ViewerPreferences.h +++ b/poppler/ViewerPreferences.h @@ -46,12 +46,12 @@ public: ViewerPreferences(Dict *prefDict); ~ViewerPreferences(); - GBool getHideToolbar() const { return hideToolbar; } - GBool getHideMenubar() const { return hideMenubar; } - GBool getHideWindowUI() const { return hideWindowUI; } - GBool getFitWindow() const { return fitWindow; } - GBool getCenterWindow() const { return centerWindow; } - GBool getDisplayDocTitle() const { return displayDocTitle; } + bool getHideToolbar() const { return hideToolbar; } + bool getHideMenubar() const { return hideMenubar; } + bool getHideWindowUI() const { return hideWindowUI; } + bool getFitWindow() const { return fitWindow; } + bool getCenterWindow() const { return centerWindow; } + bool getDisplayDocTitle() const { return displayDocTitle; } NonFullScreenPageMode getNonFullScreenPageMode() const { return nonFullScreenPageMode; } Direction getDirection() const { return direction; } PrintScaling getPrintScaling() const { return printScaling; } @@ -61,12 +61,12 @@ private: void init(); - GBool hideToolbar; - GBool hideMenubar; - GBool hideWindowUI; - GBool fitWindow; - GBool centerWindow; - GBool displayDocTitle; + bool hideToolbar; + bool hideMenubar; + bool hideWindowUI; + bool fitWindow; + bool centerWindow; + bool displayDocTitle; NonFullScreenPageMode nonFullScreenPageMode; Direction direction; PrintScaling printScaling; diff --git a/poppler/XRef.cc b/poppler/XRef.cc index e9734b2f..faa37a9b 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -80,7 +80,7 @@ public: // generation 0. ObjectStream(XRef *xref, int objStrNumA, int recursion = 0); - GBool isOk() { return ok; } + bool isOk() { return ok; } ~ObjectStream(); @@ -100,7 +100,7 @@ private: int nObjects; // number of objects in the stream Object *objs; // the objects (length = nObjects) int *objNums; // the object numbers (length = nObjects) - GBool ok; + bool ok; }; ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { @@ -115,7 +115,7 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { nObjects = 0; objs = nullptr; objNums = nullptr; - ok = gFalse; + ok = false; objStr = xref->fetch(objStrNum, 0, recursion); if (!objStr.isStream()) { @@ -156,8 +156,8 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { // parse the header: object numbers and offsets objStr.streamReset(); - str = new EmbedStream(objStr.getStream(), Object(objNull), gTrue, first); - parser = new Parser(xref, new Lexer(xref, str), gFalse); + str = new EmbedStream(objStr.getStream(), Object(objNull), true, first); + parser = new Parser(xref, new Lexer(xref, str), false); for (i = 0; i < nObjects; ++i) { obj1 = parser->getObj(); Object obj2 = parser->getObj(); @@ -191,19 +191,19 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA, int recursion) { // parse the objects for (i = 0; i < nObjects; ++i) { if (i == nObjects - 1) { - str = new EmbedStream(objStr.getStream(), Object(objNull), gFalse, 0); + str = new EmbedStream(objStr.getStream(), Object(objNull), false, 0); } else { - str = new EmbedStream(objStr.getStream(), Object(objNull), gTrue, + str = new EmbedStream(objStr.getStream(), Object(objNull), true, offsets[i+1] - offsets[i]); } - parser = new Parser(xref, new Lexer(xref, str), gFalse); + parser = new Parser(xref, new Lexer(xref, str), false); objs[i] = parser->getObj(); while (str->getChar() != EOF) ; delete parser; } gfree(offsets); - ok = gTrue; + ok = true; } ObjectStream::~ObjectStream() { @@ -225,23 +225,23 @@ Object ObjectStream::getObject(int objIdx, int objNum) { #define xrefLocker() std::unique_lock<std::recursive_mutex> locker(mutex) XRef::XRef() : objStrs{5} { - ok = gTrue; + ok = true; errCode = errNone; entries = nullptr; capacity = 0; size = 0; - modified = gFalse; + modified = false; streamEnds = nullptr; streamEndsLen = 0; mainXRefEntriesOffset = 0; - xRefStream = gFalse; - scannedSpecialFlags = gFalse; - encrypted = gFalse; + xRefStream = false; + scannedSpecialFlags = false; + encrypted = false; permFlags = defPermFlags; - ownerPasswordOk = gFalse; + ownerPasswordOk = false; rootNum = -1; - strOwner = gFalse; - xrefReconstructed = gFalse; + strOwner = false; + xrefReconstructed = false; encAlgorithm = cryptNone; } @@ -250,7 +250,7 @@ XRef::XRef(const Object *trailerDictA) : XRef{} { trailerDict = trailerDictA->copy(); } -XRef::XRef(BaseStream *strA, Goffset pos, Goffset mainXRefEntriesOffsetA, GBool *wasReconstructed, GBool reconstruct) : XRef{} { +XRef::XRef(BaseStream *strA, Goffset pos, Goffset mainXRefEntriesOffsetA, bool *wasReconstructed, bool reconstruct) : XRef{} { Object obj; mainXRefEntriesOffset = mainXRefEntriesOffsetA; @@ -339,7 +339,7 @@ XRef::~XRef() { XRef *XRef::copy() const { XRef *xref = new XRef(); xref->str = str->copy(); - xref->strOwner = gTrue; + xref->strOwner = true; xref->encrypted = encrypted; xref->permFlags = permFlags; xref->ownerPasswordOk = ownerPasswordOk; @@ -445,24 +445,24 @@ int XRef::resize(int newSize) * xrefStreamObjsNum If not NULL, every time a XRef stream is encountered, * its object number is appended * Return value: - * gTrue if a prev pointer is found, otherwise gFalse + * true if a prev pointer is found, otherwise false */ -GBool XRef::readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum) { +bool XRef::readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum) { Parser *parser; Object obj; - GBool more; + bool more; if (unlikely(start > (LLONG_MAX - *pos))) { - ok = gFalse; - return gFalse; + ok = false; + return false; } // start up a parser, parse one token parser = new Parser(nullptr, new Lexer(nullptr, - str->makeSubStream(start + *pos, gFalse, 0, Object(objNull))), - gTrue); - obj = parser->getObj(gTrue); + str->makeSubStream(start + *pos, false, 0, Object(objNull))), + true); + obj = parser->getObj(true); // parse an old-style xref table if (obj.isCmd("xref")) { @@ -471,17 +471,17 @@ GBool XRef::readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::v // parse an xref stream } else if (obj.isInt()) { const int objNum = obj.getInt(); - if (obj = parser->getObj(gTrue), !obj.isInt()) { + if (obj = parser->getObj(true), !obj.isInt()) { goto err1; } - if (obj = parser->getObj(gTrue), !obj.isCmd("obj")) { + if (obj = parser->getObj(true), !obj.isCmd("obj")) { goto err1; } if (obj = parser->getObj(), !obj.isStream()) { goto err1; } if (trailerDict.isNone()) { - xRefStream = gTrue; + xRefStream = true; } if (xrefStreamObjsNum) { xrefStreamObjsNum->push_back(objNum); @@ -497,19 +497,19 @@ GBool XRef::readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::v err1: delete parser; - ok = gFalse; - return gFalse; + ok = false; + return false; } -GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum) { +bool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum) { XRefEntry entry; - GBool more; + bool more; Object obj, obj2; Goffset pos2; int first, n; while (1) { - obj = parser->getObj(gTrue); + obj = parser->getObj(true); if (obj.isCmd("trailer")) { break; } @@ -517,7 +517,7 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo goto err0; } first = obj.getInt(); - obj = parser->getObj(gTrue); + obj = parser->getObj(true); if (!obj.isInt()) { goto err0; } @@ -532,7 +532,7 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo } } for (int i = first; i < first + n; ++i) { - obj = parser->getObj(gTrue); + obj = parser->getObj(true); if (obj.isInt()) { entry.offset = obj.getInt(); } else if (obj.isInt64()) { @@ -540,13 +540,13 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo } else { goto err0; } - obj = parser->getObj(gTrue); + obj = parser->getObj(true); if (!obj.isInt()) { goto err0; } entry.gen = obj.getInt(); entry.flags = 0; - obj = parser->getObj(gTrue); + obj = parser->getObj(true); if (obj.isCmd("n")) { entry.type = xrefEntryUncompressed; } else if (obj.isCmd("f")) { @@ -596,10 +596,10 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo pos2 = obj2.getInt64(); if (pos2 != *pos) { *pos = pos2; - more = gTrue; + more = true; } else { error(errSyntaxWarning, -1, "Infinite loop in xref table"); - more = gFalse; + more = false; } } else if (obj2.isRef()) { // certain buggy PDF generators generate "/Prev NNN 0 R" instead @@ -607,13 +607,13 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo pos2 = (Guint)obj2.getRefNum(); if (pos2 != *pos) { *pos = pos2; - more = gTrue; + more = true; } else { error(errSyntaxWarning, -1, "Infinite loop in xref table"); - more = gFalse; + more = false; } } else { - more = gFalse; + more = false; } // save the first trailer dictionary @@ -628,9 +628,9 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo pos2 = obj2.getInt(); else pos2 = obj2.getInt64(); - for (size_t i = 0; ok == gTrue && i < followedXRefStm->size(); ++i) { + for (size_t i = 0; ok == true && i < followedXRefStm->size(); ++i) { if (followedXRefStm->at(i) == pos2) { - ok = gFalse; + ok = false; } } if (ok) { @@ -645,49 +645,49 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo return more; err0: - ok = gFalse; - return gFalse; + ok = false; + return false; } -GBool XRef::readXRefStream(Stream *xrefStr, Goffset *pos) { +bool XRef::readXRefStream(Stream *xrefStr, Goffset *pos) { int w[3]; - GBool more; + bool more; Object obj; - ok = gFalse; + ok = false; Dict *dict = xrefStr->getDict(); obj = dict->lookupNF("Size"); if (!obj.isInt()) { - return gFalse; + return false; } int newSize = obj.getInt(); if (newSize < 0) { - return gFalse; + return false; } if (newSize > size) { if (resize(newSize) != newSize) { error(errSyntaxError, -1, "Invalid 'size' parameter"); - return gFalse; + return false; } } obj = dict->lookupNF("W"); if (!obj.isArray() || obj.arrayGetLength() < 3) { - return gFalse; + return false; } for (int i = 0; i < 3; ++i) { Object obj2 = obj.arrayGet(i); if (!obj2.isInt()) { - return gFalse; + return false; } w[i] = obj2.getInt(); if (w[i] < 0) { - return gFalse; + return false; } } if (w[0] > (int)sizeof(int) || w[1] > (int)sizeof(long long) || w[2] > (int)sizeof(long long)) { - return gFalse; + return false; } xrefStr->reset(); @@ -696,61 +696,61 @@ GBool XRef::readXRefStream(Stream *xrefStr, Goffset *pos) { for (int i = 0; i+1 < idx.arrayGetLength(); i += 2) { obj = idx.arrayGet(i); if (!obj.isInt()) { - return gFalse; + return false; } int first = obj.getInt(); obj = idx.arrayGet(i+1); if (!obj.isInt()) { - return gFalse; + return false; } int n = obj.getInt(); if (first < 0 || n < 0 || !readXRefStreamSection(xrefStr, w, first, n)) { - return gFalse; + return false; } } } else { if (!readXRefStreamSection(xrefStr, w, 0, newSize)) { - return gFalse; + return false; } } obj = dict->lookupNF("Prev"); if (obj.isInt() && obj.getInt() >= 0) { *pos = obj.getInt(); - more = gTrue; + more = true; } else if (obj.isInt64() && obj.getInt64() >= 0) { *pos = obj.getInt64(); - more = gTrue; + more = true; } else { - more = gFalse; + more = false; } if (trailerDict.isNone()) { trailerDict = xrefStr->getDictObject()->copy(); } - ok = gTrue; + ok = true; return more; } -GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) { +bool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) { unsigned long long offset, gen; int type, c, i, j; if (first > INT_MAX - n) { - return gFalse; + return false; } if (first + n < 0) { - return gFalse; + return false; } if (first + n > size) { if (resize(first + n) != size) { error(errSyntaxError, -1, "Invalid 'size' inside xref table"); - return gFalse; + return false; } if (first + n > size) { error(errSyntaxError, -1, "Invalid 'first' or 'n' inside xref table"); - return gFalse; + return false; } } for (i = first; i < first + n; ++i) { @@ -759,30 +759,30 @@ GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) { } else { for (type = 0, j = 0; j < w[0]; ++j) { if ((c = xrefStr->getChar()) == EOF) { - return gFalse; + return false; } type = (type << 8) + c; } } for (offset = 0, j = 0; j < w[1]; ++j) { if ((c = xrefStr->getChar()) == EOF) { - return gFalse; + return false; } offset = (offset << 8) + c; } if (offset > (unsigned long long)GoffsetMax()) { error(errSyntaxError, -1, "Offset inside xref table too large for fseek"); - return gFalse; + return false; } for (gen = 0, j = 0; j < w[2]; ++j) { if ((c = xrefStr->getChar()) == EOF) { - return gFalse; + return false; } gen = (gen << 8) + c; } if (gen > INT_MAX) { error(errSyntaxError, -1, "Gen inside xref table too large (bigger than INT_MAX)"); - return gFalse; + return false; } if (entries[i].offset == -1) { switch (type) { @@ -802,19 +802,19 @@ GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) { entries[i].type = xrefEntryCompressed; break; default: - return gFalse; + return false; } } } - return gTrue; + return true; } // Attempt to construct an xref table for a damaged file. // Warning: Reconstruction of files where last XRef section is a stream // or where some objects are defined inside an object stream is not yet supported. // Existing data in XRef::entries may get corrupted if applied anyway. -GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { +bool XRef::constructXRef(bool *wasReconstructed, bool needCatalogDict) { Parser *parser; Object obj; char buf[256]; @@ -822,7 +822,7 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { int num, gen; int streamEndsSize; char *p; - GBool gotRoot; + bool gotRoot; char* token = nullptr; bool oneCycle = true; int offset = 0; @@ -833,7 +833,7 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { size = 0; entries = nullptr; - gotRoot = gFalse; + gotRoot = false; streamEndsLen = streamEndsSize = 0; if (wasReconstructed) @@ -868,8 +868,8 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { if (!strncmp(p, "trailer", 7)) { parser = new Parser(nullptr, new Lexer(nullptr, - str->makeSubStream(pos + 7, gFalse, 0, Object(objNull))), - gFalse); + str->makeSubStream(pos + 7, false, 0, Object(objNull))), + false); Object newTrailerDict = parser->getObj(); if (newTrailerDict.isDict()) { obj = newTrailerDict.dictLookupNF("Root"); @@ -877,7 +877,7 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { rootNum = obj.getRefNum(); rootGen = obj.getRefGen(); trailerDict = newTrailerDict.copy(); - gotRoot = gTrue; + gotRoot = true; } } delete parser; @@ -916,16 +916,16 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { if (num >= size) { if (unlikely(num >= INT_MAX - 1 - 255)) { error(errSyntaxError, -1, "Bad object number"); - return gFalse; + return false; } const int newSize = (num + 1 + 255) & ~255; if (newSize < 0) { error(errSyntaxError, -1, "Bad object number"); - return gFalse; + return false; } if (resize(newSize) != newSize) { error(errSyntaxError, -1, "Invalid 'obj' parameters"); - return gFalse; + return false; } } if (entries[num].type == xrefEntryFree || @@ -951,7 +951,7 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { streamEndsSize += 64; if (streamEndsSize >= INT_MAX / (int)sizeof(int)) { error(errSyntaxError, -1, "Invalid 'endstream' parameter."); - return gFalse; + return false; } streamEnds = (Goffset *)greallocn(streamEnds, streamEndsSize, sizeof(Goffset)); @@ -972,19 +972,19 @@ GBool XRef::constructXRef(GBool *wasReconstructed, GBool needCatalogDict) { } if (gotRoot) - return gTrue; + return true; error(errSyntaxError, -1, "Couldn't find trailer dictionary"); - return gFalse; + return false; } -void XRef::setEncryption(int permFlagsA, GBool ownerPasswordOkA, +void XRef::setEncryption(int permFlagsA, bool ownerPasswordOkA, const Guchar *fileKeyA, int keyLengthA, int encVersionA, int encRevisionA, CryptAlgorithm encAlgorithmA) { int i; - encrypted = gTrue; + encrypted = true; permFlags = permFlagsA; ownerPasswordOk = ownerPasswordOkA; if (keyLengthA <= 32) { @@ -1014,14 +1014,14 @@ void XRef::getEncryptionParameters(Guchar **fileKeyA, CryptAlgorithm *encAlgorit } } -GBool XRef::okToPrint(GBool ignoreOwnerPW) const { +bool XRef::okToPrint(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permPrint); } // we can print at high res if we are only doing security handler revision // 2 (and we are allowed to print at all), or with security handler rev // 3 and we are allowed to print, and bit 12 is set. -GBool XRef::okToPrintHighRes(GBool ignoreOwnerPW) const { +bool XRef::okToPrintHighRes(bool ignoreOwnerPW) const { if (encrypted) { if (2 == encRevision) { return (okToPrint(ignoreOwnerPW)); @@ -1029,34 +1029,34 @@ GBool XRef::okToPrintHighRes(GBool ignoreOwnerPW) const { return (okToPrint(ignoreOwnerPW) && (permFlags & permHighResPrint)); } else { // something weird - unknown security handler version - return gFalse; + return false; } } else { - return gTrue; + return true; } } -GBool XRef::okToChange(GBool ignoreOwnerPW) const { +bool XRef::okToChange(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permChange); } -GBool XRef::okToCopy(GBool ignoreOwnerPW) const { +bool XRef::okToCopy(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permCopy); } -GBool XRef::okToAddNotes(GBool ignoreOwnerPW) const { +bool XRef::okToAddNotes(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permNotes); } -GBool XRef::okToFillForm(GBool ignoreOwnerPW) const { +bool XRef::okToFillForm(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permFillForm); } -GBool XRef::okToAccessibility(GBool ignoreOwnerPW) const { +bool XRef::okToAccessibility(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permAccessibility); } -GBool XRef::okToAssemble(GBool ignoreOwnerPW) const { +bool XRef::okToAssemble(bool ignoreOwnerPW) const { return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permAssemble); } @@ -1065,8 +1065,8 @@ Object XRef::getCatalog() { if (catalog.isDict()) { return catalog; } - GBool wasReconstructed = false; - if (constructXRef(&wasReconstructed, gTrue)) { + bool wasReconstructed = false; + if (constructXRef(&wasReconstructed, true)) { catalog = fetch(rootNum, rootGen); } return catalog; @@ -1097,8 +1097,8 @@ Object XRef::fetch(int num, int gen, int recursion) { } parser = new Parser(this, new Lexer(this, - str->makeSubStream(start + e->offset, gFalse, 0, Object(objNull))), - gTrue); + str->makeSubStream(start + e->offset, false, 0, Object(objNull))), + true); obj1 = parser->getObj(recursion); obj2 = parser->getObj(recursion); obj3 = parser->getObj(recursion); @@ -1128,7 +1128,7 @@ Object XRef::fetch(int num, int gen, int recursion) { delete parser; goto err; } - Object obj = parser->getObj(gFalse, (encrypted && !e->getFlag(XRefEntry::Unencrypted)) ? fileKey : nullptr, + Object obj = parser->getObj(false, (encrypted && !e->getFlag(XRefEntry::Unencrypted)) ? fileKey : nullptr, encAlgorithm, keyLength, num, gen, recursion); delete parser; return obj; @@ -1222,12 +1222,12 @@ void XRef::removeDocInfo() { removeIndirectObject(infoObjRef.getRef()); } -GBool XRef::getStreamEnd(Goffset streamStart, Goffset *streamEnd) { +bool XRef::getStreamEnd(Goffset streamStart, Goffset *streamEnd) { int a, b, m; if (streamEndsLen == 0 || streamStart > streamEnds[streamEndsLen - 1]) { - return gFalse; + return false; } a = -1; @@ -1242,7 +1242,7 @@ GBool XRef::getStreamEnd(Goffset streamStart, Goffset *streamEnd) { } } *streamEnd = streamEnds[b]; - return gTrue; + return true; } int XRef::getNumEntry(Goffset offset) @@ -1254,7 +1254,7 @@ int XRef::getNumEntry(Goffset offset) XRefEntry *e; for (int i = 1; i < size; ++i) { - e = getEntry(i, gFalse); + e = getEntry(i, false); if (e->type != xrefEntryFree && e->offset < offset && e->offset >= resOffset) { res = i; @@ -1266,7 +1266,7 @@ int XRef::getNumEntry(Goffset offset) else return -1; } -void XRef::add(int num, int gen, Goffset offs, GBool used) { +void XRef::add(int num, int gen, Goffset offs, bool used) { xrefLocker(); if (num >= size) { if (num >= capacity) { @@ -1303,7 +1303,7 @@ void XRef::setModifiedObject (const Object* o, Ref r) { } XRefEntry *e = getEntry(r.num); e->obj = o->copy(); - e->setFlag(XRefEntry::Updated, gTrue); + e->setFlag(XRefEntry::Updated, true); setModified(); } @@ -1319,7 +1319,7 @@ Ref XRef::addIndirectObject (const Object *o) { XRefEntry *e; if (entryIndexToUse == -1) { entryIndexToUse = size; - add(entryIndexToUse, 0, 0, gFalse); + add(entryIndexToUse, 0, 0, false); e = getEntry(entryIndexToUse); } else { //reuse a free entry @@ -1329,7 +1329,7 @@ Ref XRef::addIndirectObject (const Object *o) { } e->type = xrefEntryUncompressed; e->obj = o->copy(); - e->setFlag(XRefEntry::Updated, gTrue); + e->setFlag(XRefEntry::Updated, true); setModified(); Ref r; @@ -1351,11 +1351,11 @@ void XRef::removeIndirectObject(Ref r) { e->obj.~Object(); e->type = xrefEntryFree; e->gen++; - e->setFlag(XRefEntry::Updated, gTrue); + e->setFlag(XRefEntry::Updated, true); setModified(); } -void XRef::writeXRef(XRef::XRefWriter *writer, GBool writeAllEntries) { +void XRef::writeXRef(XRef::XRefWriter *writer, bool writeAllEntries) { //create free entries linked-list if (getEntry(0)->gen != 65535) { error(errInternal, -1, "XRef::writeXRef, entry 0 of the XRef is invalid (gen != 65535)\n"); @@ -1411,7 +1411,7 @@ void XRef::XRefTableWriter::writeEntry(Goffset offset, int gen, XRefEntryType ty outStr->printf("%010lli %05i %c\r\n", (long long)offset, gen, (type==xrefEntryFree)?'f':'n'); } -void XRef::writeTableToFile(OutStream* outStr, GBool writeAllEntries) { +void XRef::writeTableToFile(OutStream* outStr, bool writeAllEntries) { XRefTableWriter writer(outStr); outStr->printf("xref\r\n"); writeXRef(&writer, writeAllEntries); @@ -1442,7 +1442,7 @@ void XRef::XRefStreamWriter::writeEntry(Goffset offset, int gen, XRefEntryType t } XRef::XRefPreScanWriter::XRefPreScanWriter() { - hasOffsetsBeyond4GB = gFalse; + hasOffsetsBeyond4GB = false; } void XRef::XRefPreScanWriter::startSection(int first, int count) { @@ -1450,7 +1450,7 @@ void XRef::XRefPreScanWriter::startSection(int first, int count) { void XRef::XRefPreScanWriter::writeEntry(Goffset offset, int gen, XRefEntryType type) { if (offset >= 0x100000000ll) - hasOffsetsBeyond4GB = gTrue; + hasOffsetsBeyond4GB = true; } void XRef::writeStreamToBuffer(GooString *stmBuf, Dict *xrefDict, XRef *xref) { @@ -1459,12 +1459,12 @@ void XRef::writeStreamToBuffer(GooString *stmBuf, Dict *xrefDict, XRef *xref) { // First pass: determine whether all offsets fit in 4 bytes or not XRefPreScanWriter prescan; - writeXRef(&prescan, gFalse); + writeXRef(&prescan, false); const int offsetSize = prescan.hasOffsetsBeyond4GB ? sizeof(Goffset) : 4; // Second pass: actually write the xref stream XRefStreamWriter writer(index, stmBuf, offsetSize); - writeXRef(&writer, gFalse); + writeXRef(&writer, false); xrefDict->set("Type", Object(objName, "XRef")); xrefDict->set("Index", Object(index)); @@ -1475,15 +1475,15 @@ void XRef::writeStreamToBuffer(GooString *stmBuf, Dict *xrefDict, XRef *xref) { xrefDict->set("W", Object(wArray)); } -GBool XRef::parseEntry(Goffset offset, XRefEntry *entry) +bool XRef::parseEntry(Goffset offset, XRefEntry *entry) { - GBool r; + bool r; if (unlikely(entry == nullptr)) - return gFalse; + return false; Parser parser(nullptr, new Lexer(nullptr, - str->makeSubStream(offset, gFalse, 20, Object(objNull))), gTrue); + str->makeSubStream(offset, false, 20, Object(objNull))), true); Object obj1, obj2, obj3; if (((obj1 = parser.getObj(), obj1.isInt()) || obj1.isInt64()) && @@ -1497,9 +1497,9 @@ GBool XRef::parseEntry(Goffset offset, XRefEntry *entry) entry->type = obj3.isCmd("n") ? xrefEntryUncompressed : xrefEntryFree; entry->obj.setToNull(); entry->flags = 0; - r = gTrue; + r = true; } else { - r = gFalse; + r = false; } return r; @@ -1548,7 +1548,7 @@ void XRef::readXRefUntil(int untilEntryNum, std::vector<int> *xrefStreamObjsNum) } } -XRefEntry *XRef::getEntry(int i, GBool complainIfMissing) +XRefEntry *XRef::getEntry(int i, bool complainIfMissing) { if (i >= size || entries[i].type == xrefEntryNone) { @@ -1619,7 +1619,7 @@ void XRef::markUnencrypted(Object *obj) { XRefEntry *e = getEntry(ref.num); if (e->getFlag(XRefEntry::Unencrypted)) return; // We've already been here: prevent infinite recursion - e->setFlag(XRefEntry::Unencrypted, gTrue); + e->setFlag(XRefEntry::Unencrypted, true); obj1 = fetch(ref.num, ref.gen); markUnencrypted(&obj1); break; @@ -1633,7 +1633,7 @@ void XRef::scanSpecialFlags() { if (scannedSpecialFlags) { return; } - scannedSpecialFlags = gTrue; + scannedSpecialFlags = true; // "Rewind" the XRef linked list, so that readXRefUntil re-reads all XRef // tables/streams, even those that had already been parsed @@ -1652,7 +1652,7 @@ void XRef::scanSpecialFlags() { if (unlikely(objStmNum < 0 || objStmNum >= size)) { error(errSyntaxError, -1, "Compressed object offset out of xref bounds"); } else { - getEntry(objStmNum)->setFlag(XRefEntry::DontRewrite, gTrue); + getEntry(objStmNum)->setFlag(XRefEntry::DontRewrite, true); } } } @@ -1660,8 +1660,8 @@ void XRef::scanSpecialFlags() { // Mark XRef streams objects as Unencrypted and DontRewrite for (size_t i = 0; i < xrefStreamObjNums.size(); ++i) { const int objNum = xrefStreamObjNums.at(i); - getEntry(objNum)->setFlag(XRefEntry::Unencrypted, gTrue); - getEntry(objNum)->setFlag(XRefEntry::DontRewrite, gTrue); + getEntry(objNum)->setFlag(XRefEntry::Unencrypted, true); + getEntry(objNum)->setFlag(XRefEntry::DontRewrite, true); } // Mark objects referred from the Encrypt dict as Unencrypted @@ -1673,7 +1673,7 @@ void XRef::markUnencrypted() { Object obj = trailerDict.dictLookupNF("Encrypt"); if (obj.isRef()) { XRefEntry *e = getEntry(obj.getRefNum()); - e->setFlag(XRefEntry::Unencrypted, gTrue); + e->setFlag(XRefEntry::Unencrypted, true); } } diff --git a/poppler/XRef.h b/poppler/XRef.h index 191fe80f..11ee5e03 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -71,12 +71,12 @@ struct XRefEntry { DontRewrite // Entry must not be written back in case of full rewrite }; - inline GBool getFlag(Flag flag) const { + inline bool getFlag(Flag flag) const { const int mask = (1 << (int)flag); return (flags & mask) != 0; } - inline void setFlag(Flag flag, GBool value) { + inline void setFlag(Flag flag, bool value) { const int mask = (1 << (int)flag); if (value) { flags |= mask; @@ -94,7 +94,7 @@ public: // Constructor, create an empty XRef but with info dict, used for PDF writing XRef(const Object *trailerDictA); // Constructor. Read xref table from stream. - XRef(BaseStream *strA, Goffset pos, Goffset mainXRefEntriesOffsetA = 0, GBool *wasReconstructed = nullptr, GBool reconstruct = false); + XRef(BaseStream *strA, Goffset pos, Goffset mainXRefEntriesOffsetA = 0, bool *wasReconstructed = nullptr, bool reconstruct = false); // Destructor. ~XRef(); @@ -106,16 +106,16 @@ public: XRef *copy() const; // Is xref table valid? - GBool isOk() const { return ok; } + bool isOk() const { return ok; } // Is the last XRef section a stream or a table? - GBool isXRefStream() const { return xRefStream; } + bool isXRefStream() const { return xRefStream; } // Get the error code (if isOk() returns false). int getErrorCode() const { return errCode; } // Set the encryption parameters. - void setEncryption(int permFlagsA, GBool ownerPasswordOkA, + void setEncryption(int permFlagsA, bool ownerPasswordOkA, const Guchar *fileKeyA, int keyLengthA, int encVersionA, int encRevisionA, CryptAlgorithm encAlgorithmA); @@ -125,17 +125,17 @@ public: void getEncryptionParameters(Guchar **fileKeyA, CryptAlgorithm *encAlgorithmA, int *keyLengthA); // Is the file encrypted? - GBool isEncrypted() const { return encrypted; } + bool isEncrypted() const { return encrypted; } // Check various permissions. - GBool okToPrint(GBool ignoreOwnerPW = gFalse) const; - GBool okToPrintHighRes(GBool ignoreOwnerPW = gFalse) const; - GBool okToChange(GBool ignoreOwnerPW = gFalse) const; - GBool okToCopy(GBool ignoreOwnerPW = gFalse) const; - GBool okToAddNotes(GBool ignoreOwnerPW = gFalse) const; - GBool okToFillForm(GBool ignoreOwnerPW = gFalse) const; - GBool okToAccessibility(GBool ignoreOwnerPW = gFalse) const; - GBool okToAssemble(GBool ignoreOwnerPW = gFalse) const; + bool okToPrint(bool ignoreOwnerPW = false) const; + bool okToPrintHighRes(bool ignoreOwnerPW = false) const; + bool okToChange(bool ignoreOwnerPW = false) const; + bool okToCopy(bool ignoreOwnerPW = false) const; + bool okToAddNotes(bool ignoreOwnerPW = false) const; + bool okToFillForm(bool ignoreOwnerPW = false) const; + bool okToAccessibility(bool ignoreOwnerPW = false) const; + bool okToAssemble(bool ignoreOwnerPW = false) const; int getPermFlags() const { return permFlags; } // Get catalog object. @@ -164,7 +164,7 @@ public: // Get end position for a stream in a damaged file. // Returns false if unknown or file is not damaged. - GBool getStreamEnd(Goffset streamStart, Goffset *streamEnd); + bool getStreamEnd(Goffset streamStart, Goffset *streamEnd); // Retuns the entry that belongs to the offset int getNumEntry(Goffset offset); @@ -178,22 +178,22 @@ public: void scanSpecialFlags(); // Direct access. - XRefEntry *getEntry(int i, GBool complainIfMissing = gTrue); + XRefEntry *getEntry(int i, bool complainIfMissing = true); Object *getTrailerDict() { return &trailerDict; } // Was the XRef modified? - GBool isModified() const { return modified; } + bool isModified() const { return modified; } // Set the modification flag for XRef to true. - void setModified() { modified = gTrue; } + void setModified() { modified = true; } // Write access void setModifiedObject(const Object* o, Ref r); Ref addIndirectObject (const Object* o); void removeIndirectObject(Ref r); - void add(int num, int gen, Goffset offs, GBool used); + void add(int num, int gen, Goffset offs, bool used); // Output XRef table to stream - void writeTableToFile(OutStream* outStr, GBool writeAllEntries); + void writeTableToFile(OutStream* outStr, bool writeAllEntries); // Output XRef stream contents to GooString and fill trailerDict fields accordingly void writeStreamToBuffer(GooString *stmBuf, Dict *xrefDict, XRef *xref); @@ -210,39 +210,39 @@ private: int capacity; // size of <entries> array int size; // number of entries int rootNum, rootGen; // catalog dict - GBool ok; // true if xref table is valid + bool ok; // true if xref table is valid int errCode; // error code (if <ok> is false) - GBool xrefReconstructed; // marker, true if xref was already reconstructed + bool xrefReconstructed; // marker, true if xref was already reconstructed Object trailerDict; // trailer dictionary - GBool modified; + bool modified; Goffset *streamEnds; // 'endstream' positions - only used in // damaged files int streamEndsLen; // number of valid entries in streamEnds PopplerCache<Goffset, ObjectStream> objStrs; // cached object streams - GBool encrypted; // true if file is encrypted + bool encrypted; // true if file is encrypted int encRevision; int encVersion; // encryption algorithm CryptAlgorithm encAlgorithm; // encryption algorithm int keyLength; // length of key, in bytes int permFlags; // permission bits Guchar fileKey[32]; // file decryption key - GBool ownerPasswordOk; // true if owner password is correct + bool ownerPasswordOk; // true if owner password is correct Goffset prevXRefOffset; // position of prev XRef section (= next to read) Goffset mainXRefEntriesOffset; // offset of entries in main XRef table - GBool xRefStream; // true if last XRef section is a stream + bool xRefStream; // true if last XRef section is a stream Goffset mainXRefOffset; // position of the main XRef table/stream - GBool scannedSpecialFlags; // true if scanSpecialFlags has been called - GBool strOwner; // true if str is owned by the instance + bool scannedSpecialFlags; // true if scanSpecialFlags has been called + bool strOwner; // true if str is owned by the instance mutable std::recursive_mutex mutex; int reserve(int newSize); int resize(int newSize); - GBool readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum); - GBool readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum); - GBool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n); - GBool readXRefStream(Stream *xrefStr, Goffset *pos); - GBool constructXRef(GBool *wasReconstructed, GBool needCatalogDict = gFalse); - GBool parseEntry(Goffset offset, XRefEntry *entry); + bool readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum); + bool readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum); + bool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n); + bool readXRefStream(Stream *xrefStr, Goffset *pos); + bool constructXRef(bool *wasReconstructed, bool needCatalogDict = false); + bool parseEntry(Goffset offset, XRefEntry *entry); void readXRefUntil(int untilEntryNum, std::vector<int> *xrefStreamObjsNum = nullptr); void markUnencrypted(Object *obj); @@ -286,10 +286,10 @@ private: void startSection(int first, int count) override; void writeEntry(Goffset offset, int gen, XRefEntryType type) override; - GBool hasOffsetsBeyond4GB; + bool hasOffsetsBeyond4GB; }; - void writeXRef(XRefWriter *writer, GBool writeAllEntries); + void writeXRef(XRefWriter *writer, bool writeAllEntries); }; #endif diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc index 38473c37..3cda4b9f 100644 --- a/qt5/src/ArthurOutputDev.cc +++ b/qt5/src/ArthurOutputDev.cc @@ -77,7 +77,7 @@ public: ~SplashOutFontFileID() {} - GBool matches(SplashFontFileID *id) override { + bool matches(SplashFontFileID *id) override { return ((SplashOutFontFileID *)id)->r.num == r.num && ((SplashOutFontFileID *)id)->r.gen == r.gen; } @@ -244,7 +244,7 @@ void ArthurOutputDev::restoreState(GfxState *state) void ArthurOutputDev::updateAll(GfxState *state) { OutputDev::updateAll(state); - m_needFontUpdate = gTrue; + m_needFontUpdate = true; } // Set CTM (Current Transformation Matrix) to a fixed matrix @@ -591,9 +591,9 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc = new SplashFontSrc; if (fileName) - fontsrc->setFile(fileName, gFalse); + fontsrc->setFile(fileName, false); else - fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue); + fontsrc->setBuf(tmpBuf, tmpBufLen, true); // load the font file switch (fontType) { @@ -787,7 +787,7 @@ void ArthurOutputDev::eoFill(GfxState *state) m_painter.top()->fillPath( convertPath( state, state->getPath(), Qt::OddEvenFill ), m_currentBrush ); } -GBool ArthurOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) +bool ArthurOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double tMin, double tMax) { double x0, y0, x1, y1; shading->getCoords(&x0, &y0, &x1, &y1); @@ -910,7 +910,7 @@ GBool ArthurOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading state->clearPath(); // True means: The shaded region has been painted - return gTrue; + return true; } void ArthurOutputDev::clip(GfxState *state) @@ -1055,8 +1055,8 @@ void ArthurOutputDev::endTextObject(GfxState *state) void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) + int width, int height, bool invert, + bool interpolate, bool inlineImg) { auto imgStr = std::make_unique<ImageStream>( str, width, @@ -1098,7 +1098,7 @@ void ArthurOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) + bool interpolate, int *maskColors, bool inlineImg) { unsigned int *data; unsigned int *line; @@ -1152,18 +1152,18 @@ void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void ArthurOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) + bool maskInterpolate) { // Bail out if the image size doesn't match the mask size. I don't know // what to do in this case. if (width!=maskWidth || height!=maskHeight) { qDebug() << "Soft mask size does not match image size!"; - drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, gFalse); + drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, false); return; } @@ -1172,7 +1172,7 @@ void ArthurOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream * if (maskColorMap->getColorSpace()->getNComps() != 1) { qDebug() << "Soft mask is not a single 8-bit channel!"; - drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, gFalse); + drawImage(state, ref, str, width, height, colorMap, interpolate, nullptr, false); return; } @@ -1223,8 +1223,8 @@ void ArthurOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream * void ArthurOutputDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, GfxColorSpace * /*blendingColorSpace*/, - GBool /*isolated*/, GBool /*knockout*/, - GBool /*forSoftMask*/) + bool /*isolated*/, bool /*knockout*/, + bool /*forSoftMask*/) { // The entire transparency group will be painted into a // freshly created QPicture object. Since an existing painter diff --git a/qt5/src/ArthurOutputDev.h b/qt5/src/ArthurOutputDev.h index 12d3883f..47972b63 100644 --- a/qt5/src/ArthurOutputDev.h +++ b/qt5/src/ArthurOutputDev.h @@ -77,20 +77,20 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device implement shaded fills (aka gradients) natively? // If this returns false, these shaded fills // will be reduced to a series of other drawing operations. // type==2 is 'axial shading' - GBool useShadedFills(int type) override { return type == 2; } + bool useShadedFills(int type) override { return type == 2; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } //----- initialization and control @@ -130,7 +130,7 @@ public: void stroke(GfxState *state) override; void fill(GfxState *state) override; void eoFill(GfxState *state) override; - GBool axialShadedFill(GfxState * state, GfxAxialShading *shading, double tMin, double tMax) override; + bool axialShadedFill(GfxState * state, GfxAxialShading *shading, double tMin, double tMax) override; //----- path clipping void clip(GfxState *state) override; @@ -146,20 +146,20 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; //----- Type 3 font operators void type3D0(GfxState *state, double wx, double wy) override; @@ -169,8 +169,8 @@ public: //----- transparency groups and soft masks virtual void beginTransparencyGroup(GfxState *state, const double *bbox, GfxColorSpace *blendingColorSpace, - GBool isolated, GBool knockout, - GBool forSoftMask) override; + bool isolated, bool knockout, + bool forSoftMask) override; virtual void endTransparencyGroup(GfxState *state) override; virtual void paintTransparencyGroup(GfxState *state, const double *bbox) override; @@ -179,7 +179,7 @@ public: // Called to indicate that a new PDF document has been loaded. void startDoc(PDFDoc* doc); - GBool isReverseVideo() { return gFalse; } + bool isReverseVideo() { return false; } private: @@ -204,7 +204,7 @@ private: QBrush m_currentBrush; std::stack<QBrush> m_currentBrushStack; - GBool m_needFontUpdate; // set when the font needs to be updated + bool m_needFontUpdate; // set when the font needs to be updated SplashFontEngine *m_fontEngine; PDFDoc* m_doc; XRef *xref; // xref table for current document diff --git a/qt5/src/poppler-annotation-helper.h b/qt5/src/poppler-annotation-helper.h index 93e29c31..0edcdd0b 100644 --- a/qt5/src/poppler-annotation-helper.h +++ b/qt5/src/poppler-annotation-helper.h @@ -81,7 +81,7 @@ void XPDFReader::lookupBool( Dict * dict, char * type, bool & dest ) if ( boolObj.isNull() ) return; if ( boolObj.isBool() ) - dest = boolObj.getBool() == gTrue; + dest = boolObj.getBool() == true; else qDebug() << type << " is not Bool." << endl; } diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc index 01817f09..a30088d6 100644 --- a/qt5/src/poppler-annotation.cc +++ b/qt5/src/poppler-annotation.cc @@ -212,7 +212,7 @@ void AnnotationPrivate::fillNormalizationMTX(double MTX[6], int pageRotation) co Q_ASSERT ( pdfPage ); // build a normalized transform matrix for this page at 100% scale - GfxState * gfxState = new GfxState( 72.0, 72.0, pdfPage->getCropBox(), pageRotation, gTrue ); + GfxState * gfxState = new GfxState( 72.0, 72.0, pdfPage->getCropBox(), pageRotation, true ); const double * gfxCTM = gfxState->getCTM(); double w = pdfPage->getCropWidth(); diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc index 81bf509c..ef5eef93 100644 --- a/qt5/src/poppler-form.cc +++ b/qt5/src/poppler-form.cc @@ -76,7 +76,7 @@ FormField::FormField(FormFieldData &dd) double left, top, right, bottom; m_formData->fm->getRect(&left, &bottom, &right, &top); // build a normalized transform matrix for this page at 100% scale - GfxState gfxState( 72.0, 72.0, m_formData->page->getCropBox(), rotation, gTrue ); + GfxState gfxState( 72.0, 72.0, m_formData->page->getCropBox(), rotation, true ); const double * gfxCTM = gfxState.getCTM(); double MTX[6]; double pageWidth = m_formData->page->getCropWidth(); @@ -291,7 +291,7 @@ bool FormFieldButton::state() const void FormFieldButton::setState( bool state ) { FormWidgetButton* fwb = static_cast<FormWidgetButton*>(m_formData->fm); - fwb->setState((GBool)state); + fwb->setState((bool)state); } QList<int> FormFieldButton::siblings() const diff --git a/qt5/src/poppler-link-extractor-private.h b/qt5/src/poppler-link-extractor-private.h index f91430c1..f6995867 100644 --- a/qt5/src/poppler-link-extractor-private.h +++ b/qt5/src/poppler-link-extractor-private.h @@ -37,9 +37,9 @@ class LinkExtractorOutputDev : public OutputDev ~LinkExtractorOutputDev(); // inherited from OutputDev - GBool upsideDown() override { return gFalse; } - GBool useDrawChar() override { return gFalse; } - GBool interpretType3Chars() override { return gFalse; } + bool upsideDown() override { return false; } + bool useDrawChar() override { return false; } + bool interpretType3Chars() override { return false; } void processLink(::AnnotLink *link) override; // our stuff diff --git a/qt5/src/poppler-link-extractor.cc b/qt5/src/poppler-link-extractor.cc index 3781dcec..d67de6aa 100644 --- a/qt5/src/poppler-link-extractor.cc +++ b/qt5/src/poppler-link-extractor.cc @@ -40,7 +40,7 @@ LinkExtractorOutputDev::LinkExtractorOutputDev(PageData *data) m_pageCropHeight = popplerPage->getCropHeight(); if (popplerPage->getRotate() == 90 || popplerPage->getRotate() == 270) qSwap(m_pageCropWidth, m_pageCropHeight); - GfxState gfxState(72.0, 72.0, popplerPage->getCropBox(), popplerPage->getRotate(), gTrue); + GfxState gfxState(72.0, 72.0, popplerPage->getCropBox(), popplerPage->getRotate(), true); setDefaultCTM(gfxState.getCTM()); } diff --git a/qt5/src/poppler-movie.cc b/qt5/src/poppler-movie.cc index e37a5d6b..dddb12d1 100644 --- a/qt5/src/poppler-movie.cc +++ b/qt5/src/poppler-movie.cc @@ -102,7 +102,7 @@ MovieObject::PlayMode MovieObject::playMode() const bool MovieObject::showPosterImage() const { - return (m_movieData->m_movieObj->getShowPoster() == gTrue); + return (m_movieData->m_movieObj->getShowPoster() == true); } QImage MovieObject::posterImage() const diff --git a/qt5/src/poppler-page-private.h b/qt5/src/poppler-page-private.h index 1cb63e9f..ceb67b39 100644 --- a/qt5/src/poppler-page-private.h +++ b/qt5/src/poppler-page-private.h @@ -48,8 +48,8 @@ public: static Link* convertLinkActionToLink(::LinkAction * a, DocumentData *parentDoc, const QRectF &linkArea); TextPage *prepareTextSearch(const QString &text, Page::Rotation rotate, QVector<Unicode> *u); - GBool performSingleTextSearch(TextPage* textPage, QVector<Unicode> &u, double &sLeft, double &sTop, double &sRight, double &sBottom, Page::SearchDirection direction, GBool sCase, GBool sWords); - QList<QRectF> performMultipleTextSearch(TextPage* textPage, QVector<Unicode> &u, GBool sCase, GBool sWords); + bool performSingleTextSearch(TextPage* textPage, QVector<Unicode> &u, double &sLeft, double &sTop, double &sRight, double &sBottom, Page::SearchDirection direction, bool sCase, bool sWords); + QList<QRectF> performMultipleTextSearch(TextPage* textPage, QVector<Unicode> &u, bool sCase, bool sWords); }; } diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc index 9bcb4945..34f58053 100644 --- a/qt5/src/poppler-page.cc +++ b/qt5/src/poppler-page.cc @@ -106,9 +106,9 @@ class Qt5SplashOutputDev : public SplashOutputDev, public OutputDevCallbackHelpe { public: Qt5SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, - GBool reverseVideoA, bool ignorePaperColorA, SplashColorPtr paperColorA, - GBool bitmapTopDownA, SplashThinLineMode thinLineMode, - GBool overprintPreviewA) + bool reverseVideoA, bool ignorePaperColorA, SplashColorPtr paperColorA, + bool bitmapTopDownA, SplashThinLineMode thinLineMode, + bool overprintPreviewA) : SplashOutputDev(colorModeA, bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA, thinLineMode, overprintPreviewA) , ignorePaperColor(ignorePaperColorA) { @@ -386,36 +386,36 @@ inline TextPage *PageData::prepareTextSearch(const QString &text, Page::Rotation const int rotation = (int)rotate * 90; // fetch ourselves a textpage - TextOutputDev td(nullptr, gTrue, 0, gFalse, gFalse); + TextOutputDev td(nullptr, true, 0, false, false); parentDoc->doc->displayPage( &td, index + 1, 72, 72, rotation, false, true, false, - nullptr, nullptr, nullptr, nullptr, gTrue); + nullptr, nullptr, nullptr, nullptr, true); TextPage *textPage=td.takeText(); return textPage; } -inline GBool PageData::performSingleTextSearch(TextPage* textPage, QVector<Unicode> &u, double &sLeft, double &sTop, double &sRight, double &sBottom, Page::SearchDirection direction, GBool sCase, GBool sWords) +inline bool PageData::performSingleTextSearch(TextPage* textPage, QVector<Unicode> &u, double &sLeft, double &sTop, double &sRight, double &sBottom, Page::SearchDirection direction, bool sCase, bool sWords) { if (direction == Page::FromTop) return textPage->findText( u.data(), u.size(), - gTrue, gTrue, gFalse, gFalse, sCase, gFalse, sWords, &sLeft, &sTop, &sRight, &sBottom ); + true, true, false, false, sCase, false, sWords, &sLeft, &sTop, &sRight, &sBottom ); else if ( direction == Page::NextResult ) return textPage->findText( u.data(), u.size(), - gFalse, gTrue, gTrue, gFalse, sCase, gFalse, sWords, &sLeft, &sTop, &sRight, &sBottom ); + false, true, true, false, sCase, false, sWords, &sLeft, &sTop, &sRight, &sBottom ); else if ( direction == Page::PreviousResult ) return textPage->findText( u.data(), u.size(), - gFalse, gTrue, gTrue, gFalse, sCase, gTrue, sWords, &sLeft, &sTop, &sRight, &sBottom ); + false, true, true, false, sCase, true, sWords, &sLeft, &sTop, &sRight, &sBottom ); - return gFalse; + return false; } -inline QList<QRectF> PageData::performMultipleTextSearch(TextPage* textPage, QVector<Unicode> &u, GBool sCase, GBool sWords) +inline QList<QRectF> PageData::performMultipleTextSearch(TextPage* textPage, QVector<Unicode> &u, bool sCase, bool sWords) { QList<QRectF> results; double sLeft = 0.0, sTop = 0.0, sRight = 0.0, sBottom = 0.0; while(textPage->findText( u.data(), u.size(), - gFalse, gTrue, gTrue, gFalse, sCase, gFalse, sWords, &sLeft, &sTop, &sRight, &sBottom )) + false, true, true, false, sCase, false, sWords, &sLeft, &sTop, &sRight, &sBottom )) { QRectF result; @@ -453,7 +453,7 @@ static auto annotDisplayDecideCbk = [](Annot *annot, void *user_data) // A nullptr, but with the type of a function pointer // Needed to make the ternary operator happy. -static GBool (*nullAnnotCallBack)(Annot *annot, void *user_data) = nullptr; +static bool (*nullAnnotCallBack)(Annot *annot, void *user_data) = nullptr; static auto shouldAbortRenderInternalCallback = [](void *user_data) { @@ -469,7 +469,7 @@ static auto shouldAbortExtractionInternalCallback = [](void *user_data) // A nullptr, but with the type of a function pointer // Needed to make the ternary operator happy. -static GBool (*nullAbortCallBack)(void *user_data) = nullptr; +static bool (*nullAbortCallBack)(void *user_data) = nullptr; static bool renderToArthur(QImageDumpingArthurOutputDev *arthur_output, QPainter *painter, PageData *page, double xres, double yres, int x, int y, int w, int h, Page::Rotation rotate, Page::PainterFlags flags) { @@ -484,7 +484,7 @@ static bool renderToArthur(QImageDumpingArthurOutputDev *arthur_output, QPainter arthur_output->startDoc(page->parentDoc->doc); - const GBool hideAnnotations = page->parentDoc->m_hints & Document::HideAnnotations; + const bool hideAnnotations = page->parentDoc->m_hints & Document::HideAnnotations; OutputDevCallbackHelper *abortHelper = arthur_output; page->parentDoc->doc->displayPageSlice(arthur_output, @@ -502,7 +502,7 @@ static bool renderToArthur(QImageDumpingArthurOutputDev *arthur_output, QPainter abortHelper->shouldAbortRenderCallback ? shouldAbortRenderInternalCallback : nullAbortCallBack, abortHelper, (hideAnnotations) ? annotDisplayDecideCbk : nullAnnotCallBack, - nullptr, gTrue); + nullptr, true); if (savePainter) painter->restore(); return true; @@ -528,9 +528,9 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, { #if defined(HAVE_SPLASH) SplashColor bgColor; - GBool overprintPreview = gFalse; + bool overprintPreview = false; #ifdef SPLASH_CMYK - overprintPreview = m_page->parentDoc->m_hints & Document::OverprintPreview ? gTrue : gFalse; + overprintPreview = m_page->parentDoc->m_hints & Document::OverprintPreview ? true : false; if (overprintPreview) { Guchar c, m, y, k; @@ -574,30 +574,30 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, Qt5SplashOutputDev splash_output( colorMode, 4, - gFalse, + false, ignorePaperColor, ignorePaperColor ? nullptr : bgColor, - gTrue, + true, thinLineMode, overprintPreview); splash_output.setCallbacks(partialUpdateCallback, shouldDoPartialUpdateCallback, shouldAbortRenderCallback, payload); - splash_output.setFontAntialias(m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse); - splash_output.setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? gTrue : gFalse); - splash_output.setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? gTrue : gFalse, - m_page->parentDoc->m_hints & Document::TextSlightHinting ? gTrue : gFalse); + splash_output.setFontAntialias(m_page->parentDoc->m_hints & Document::TextAntialiasing ? true : false); + splash_output.setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? true : false); + splash_output.setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? true : false, + m_page->parentDoc->m_hints & Document::TextSlightHinting ? true : false); splash_output.startDoc(m_page->parentDoc->doc); - const GBool hideAnnotations = m_page->parentDoc->m_hints & Document::HideAnnotations; + const bool hideAnnotations = m_page->parentDoc->m_hints & Document::HideAnnotations; OutputDevCallbackHelper *abortHelper = &splash_output; m_page->parentDoc->doc->displayPageSlice(&splash_output, m_page->index + 1, xres, yres, rotation, false, true, false, x, y, w, h, shouldAbortRenderCallback ? shouldAbortRenderInternalCallback : nullAbortCallBack, abortHelper, (hideAnnotations) ? annotDisplayDecideCbk : nullAnnotCallBack, - nullptr, gTrue); + nullptr, true); img = splash_output.getXBGRImage( true /* takeImageData */); #endif @@ -655,7 +655,7 @@ QImage Page::thumbnail() const int w = 0; int h = 0; int rowstride = 0; - GBool r = m_page->page->loadThumb(&data, &w, &h, &rowstride); + bool r = m_page->page->loadThumb(&data, &w, &h, &rowstride); QImage ret; if (r) { @@ -673,11 +673,11 @@ QString Page::text(const QRectF &r, TextLayout textLayout) const GooString *s; QString result; - const GBool rawOrder = textLayout == RawOrderLayout; - output_dev = new TextOutputDev(nullptr, gFalse, 0, rawOrder, gFalse); + const bool rawOrder = textLayout == RawOrderLayout; + output_dev = new TextOutputDev(nullptr, false, 0, rawOrder, false); m_page->parentDoc->doc->displayPageSlice(output_dev, m_page->index + 1, 72, 72, 0, false, true, false, -1, -1, -1, -1, - nullptr, nullptr, nullptr, nullptr, gTrue); + nullptr, nullptr, nullptr, nullptr, true); if (r.isNull()) { const PDFRectangle *rect = m_page->page->getCropBox(); @@ -702,12 +702,12 @@ QString Page::text(const QRectF &r) const bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate) const { - const GBool sCase = caseSensitive == Page::CaseSensitive ? gTrue : gFalse; + const bool sCase = caseSensitive == Page::CaseSensitive ? true : false; QVector<Unicode> u; TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u); - const bool found = m_page->performSingleTextSearch(textPage, u, sLeft, sTop, sRight, sBottom, direction, sCase, gFalse); + const bool found = m_page->performSingleTextSearch(textPage, u, sLeft, sTop, sRight, sBottom, direction, sCase, false); textPage->decRefCnt(); @@ -716,8 +716,8 @@ bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRig bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRight, double &sBottom, SearchDirection direction, SearchFlags flags, Rotation rotate) const { - const GBool sCase = flags.testFlag(IgnoreCase) ? gFalse : gTrue; - const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse; + const bool sCase = flags.testFlag(IgnoreCase) ? false : true; + const bool sWords = flags.testFlag(WholeWords) ? true : false; QVector<Unicode> u; TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u); @@ -731,12 +731,12 @@ bool Page::search(const QString &text, double &sLeft, double &sTop, double &sRig QList<QRectF> Page::search(const QString &text, SearchMode caseSensitive, Rotation rotate) const { - const GBool sCase = caseSensitive == Page::CaseSensitive ? gTrue : gFalse; + const bool sCase = caseSensitive == Page::CaseSensitive ? true : false; QVector<Unicode> u; TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u); - const QList<QRectF> results = m_page->performMultipleTextSearch(textPage, u, sCase, gFalse); + const QList<QRectF> results = m_page->performMultipleTextSearch(textPage, u, sCase, false); textPage->decRefCnt(); @@ -745,8 +745,8 @@ QList<QRectF> Page::search(const QString &text, SearchMode caseSensitive, Rotati QList<QRectF> Page::search(const QString &text, SearchFlags flags, Rotation rotate) const { - const GBool sCase = flags.testFlag(IgnoreCase) ? gFalse : gTrue; - const GBool sWords = flags.testFlag(WholeWords) ? gTrue : gFalse; + const bool sCase = flags.testFlag(IgnoreCase) ? false : true; + const bool sWords = flags.testFlag(WholeWords) ? true : false; QVector<Unicode> u; TextPage *textPage = m_page->prepareTextSearch(text, rotate, &u); @@ -769,7 +769,7 @@ QList<TextBox*> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbort QList<TextBox*> output_list; - output_dev = new TextOutputDev(nullptr, gFalse, 0, gFalse, gFalse); + output_dev = new TextOutputDev(nullptr, false, 0, false, false); int rotation = (int)rotate * 90; @@ -777,7 +777,7 @@ QList<TextBox*> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbort m_page->parentDoc->doc->displayPageSlice(output_dev, m_page->index + 1, 72, 72, rotation, false, false, false, -1, -1, -1, -1, shouldAbortExtractionCallback ? shouldAbortExtractionInternalCallback : nullAbortCallBack, &abortHelper, - nullptr, nullptr, gTrue); + nullptr, nullptr, true); TextWordList *word_list = output_dev->makeWordList(); @@ -798,7 +798,7 @@ QList<TextBox*> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbort word->getBBox(&xMin, &yMin, &xMax, &yMax); TextBox* text_box = new TextBox(string, QRectF(xMin, yMin, xMax-xMin, yMax-yMin)); - text_box->m_data->hasSpaceAfter = word->hasSpaceAfter() == gTrue; + text_box->m_data->hasSpaceAfter = word->hasSpaceAfter() == true; text_box->m_data->charBBoxes.reserve(word->getLength()); for (int j = 0; j < word->getLength(); ++j) { @@ -893,7 +893,7 @@ Page::Orientation Page::orientation() const void Page::defaultCTM(double *CTM, double dpiX, double dpiY, int rotate, bool upsideDown) { - m_page->page->getDefaultCTM(CTM, dpiX, dpiY, rotate, gFalse, upsideDown); + m_page->page->getDefaultCTM(CTM, dpiX, dpiY, rotate, false, upsideDown); } QList<Link*> Page::links() const diff --git a/qt5/src/poppler-ps-converter.cc b/qt5/src/poppler-ps-converter.cc index b7d091bf..c4dec24c 100644 --- a/qt5/src/poppler-ps-converter.cc +++ b/qt5/src/poppler-ps-converter.cc @@ -181,12 +181,12 @@ void PSConverter::setPageConvertedCallback(void (* callback)(int page, void *pay d->pageConvertedPayload = payload; } -static GBool annotDisplayDecideCbk(Annot *annot, void *user_data) +static bool annotDisplayDecideCbk(Annot *annot, void *user_data) { if (annot->getType() == Annot::typeWidget) - return gTrue; // Never hide forms + return true; // Never hide forms else - return *(GBool*)user_data; + return *(bool*)user_data; } bool PSConverter::convert() @@ -229,8 +229,8 @@ bool PSConverter::convert() (d->opts & PrintToEPS) ? psModeEPS : psModePS, d->paperWidth, d->paperHeight, - gFalse, - gFalse, + false, + false, d->marginLeft, d->marginBottom, d->paperWidth - d->marginRight, @@ -246,8 +246,8 @@ bool PSConverter::convert() if (psOut->isOk()) { - GBool isPrinting = (d->opts & Printing) ? gTrue : gFalse; - GBool showAnnotations = (d->opts & HideAnnotations) ? gFalse : gTrue; + bool isPrinting = (d->opts & Printing) ? true : false; + bool showAnnotations = (d->opts & HideAnnotations) ? false : true; foreach(int page, d->pageList) { d->document->doc->displayPage(psOut, @@ -255,13 +255,13 @@ bool PSConverter::convert() d->hDPI, d->vDPI, d->rotate, - gFalse, - gTrue, + false, + true, isPrinting, nullptr, nullptr, annotDisplayDecideCbk, - &showAnnotations, gTrue); + &showAnnotations, true); if (d->pageConvertedCallback) (*d->pageConvertedCallback)(page, d->pageConvertedPayload); } diff --git a/qt5/tests/check_pagelabelinfo.cpp b/qt5/tests/check_pagelabelinfo.cpp index 6a3d89d0..ec262cd8 100644 --- a/qt5/tests/check_pagelabelinfo.cpp +++ b/qt5/tests/check_pagelabelinfo.cpp @@ -43,7 +43,7 @@ void TestPageLabelInfo::testFromDecimalUnicode() void TestPageLabelInfo::testToRoman() { GooString str; - toRoman(177, &str, gFalse); + toRoman(177, &str, false); QCOMPARE (str.getCString(), "clxxvii"); } @@ -56,7 +56,7 @@ void TestPageLabelInfo::testFromRoman() void TestPageLabelInfo::testToLatin() { GooString str; - toLatin(54, &str, gFalse); + toLatin(54, &str, false); QCOMPARE(str.getCString(), "bbb"); } diff --git a/splash/Splash.cc b/splash/Splash.cc index 00740dbd..7964da39 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -95,10 +95,10 @@ static inline int imgCoordMungeLower(SplashCoord x) { static inline int imgCoordMungeUpper(SplashCoord x) { return splashFloor(x) + 1; } -static inline int imgCoordMungeLowerC(SplashCoord x, GBool glyphMode) { +static inline int imgCoordMungeLowerC(SplashCoord x, bool glyphMode) { return glyphMode ? (splashCeil(x + 0.5) - 1) : splashFloor(x); } -static inline int imgCoordMungeUpperC(SplashCoord x, GBool glyphMode) { +static inline int imgCoordMungeUpperC(SplashCoord x, bool glyphMode) { return glyphMode ? (splashCeil(x + 0.5) - 1) : (splashFloor(x) + 1); } #endif @@ -130,7 +130,7 @@ struct SplashPipe { // source alpha and color Guchar aInput; - GBool usesShape; + bool usesShape; SplashColorPtr cSrc; SplashColor cSrcVal = {}; @@ -138,7 +138,7 @@ struct SplashPipe { Guchar *alpha0Ptr; // knockout groups - GBool knockout; + bool knockout; Guchar knockoutOpacity; // soft mask @@ -153,11 +153,11 @@ struct SplashPipe { Guchar shape; // result alpha and color - GBool noTransparency; + bool noTransparency; SplashPipeResultColorCtrl resultColorCtrl; // non-isolated group correction - GBool nonIsolatedGroup; + bool nonIsolatedGroup; // the "run" function void (Splash::*run)(SplashPipe *pipe); @@ -248,9 +248,9 @@ inline void Splash::updateModY(int y) { inline void Splash::pipeInit(SplashPipe *pipe, int x, int y, SplashPattern *pattern, SplashColorPtr cSrc, - Guchar aInput, GBool usesShape, - GBool nonIsolatedGroup, - GBool knockout, Guchar knockoutOpacity) { + Guchar aInput, bool usesShape, + bool nonIsolatedGroup, + bool knockout, Guchar knockoutOpacity) { pipeSetXY(pipe, x, y); pipe->pattern = nullptr; @@ -278,9 +278,9 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y, // result alpha if (aInput == 255 && !state->softMask && !usesShape && !state->inNonIsolatedGroup && !nonIsolatedGroup) { - pipe->noTransparency = gTrue; + pipe->noTransparency = true; } else { - pipe->noTransparency = gFalse; + pipe->noTransparency = false; } // result color @@ -1435,7 +1435,7 @@ inline void Splash::pipeIncX(SplashPipe *pipe) { } } -inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) { +inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, bool noClip) { if (unlikely(y < 0)) return; @@ -1510,7 +1510,7 @@ inline void Splash::drawAAPixel(SplashPipe *pipe, int x, int y) { } inline void Splash::drawSpan(SplashPipe *pipe, int x0, int x1, int y, - GBool noClip) { + bool noClip) { int x; if (noClip) { @@ -1541,7 +1541,7 @@ inline void Splash::drawSpan(SplashPipe *pipe, int x0, int x1, int y, } } -inline void Splash::drawAALine(SplashPipe *pipe, int x0, int x1, int y, GBool adjustLine, Guchar lineOpacity) { +inline void Splash::drawAALine(SplashPipe *pipe, int x0, int x1, int y, bool adjustLine, Guchar lineOpacity) { #if splashAASize == 4 static int bitCount4[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; @@ -1611,18 +1611,18 @@ inline void Splash::transform(SplashCoord *matrix, // Splash //------------------------------------------------------------------------ -Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, +Splash::Splash(SplashBitmap *bitmapA, bool vectorAntialiasA, SplashScreenParams *screenParams) { int i; bitmap = bitmapA; vectorAntialias = vectorAntialiasA; - inShading = gFalse; + inShading = false; state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, screenParams); if (vectorAntialias) { aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, - 1, splashModeMono1, gFalse); + 1, splashModeMono1, false); for (i = 0; i <= splashAASize * splashAASize; ++i) { aaGamma[i] = (Guchar)splashRound( splashPow((SplashCoord)i / @@ -1635,22 +1635,22 @@ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, minLineWidth = 0; thinLineMode = splashThinLineDefault; clearModRegion(); - debugMode = gFalse; + debugMode = false; alpha0Bitmap = nullptr; } -Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, +Splash::Splash(SplashBitmap *bitmapA, bool vectorAntialiasA, SplashScreen *screenA) { int i; bitmap = bitmapA; - inShading = gFalse; + inShading = false; vectorAntialias = vectorAntialiasA; state = new SplashState(bitmap->width, bitmap->height, vectorAntialias, screenA); if (vectorAntialias) { aaBuf = new SplashBitmap(splashAASize * bitmap->width, splashAASize, - 1, splashModeMono1, gFalse); + 1, splashModeMono1, false); for (i = 0; i <= splashAASize * splashAASize; ++i) { aaGamma[i] = (Guchar)splashRound( splashPow((SplashCoord)i / @@ -1663,7 +1663,7 @@ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, minLineWidth = 0; thinLineMode = splashThinLineDefault; clearModRegion(); - debugMode = gFalse; + debugMode = false; alpha0Bitmap = nullptr; } @@ -1739,7 +1739,7 @@ SplashCoord Splash::getLineDashPhase() { return state->lineDashPhase; } -GBool Splash::getStrokeAdjust() { +bool Splash::getStrokeAdjust() { return state->strokeAdjust; } @@ -1751,7 +1751,7 @@ SplashBitmap *Splash::getSoftMask() { return state->softMask; } -GBool Splash::getInNonIsolatedGroup() { +bool Splash::getInNonIsolatedGroup() { return state->inNonIsolatedGroup; } @@ -1790,20 +1790,20 @@ void Splash::setFillAlpha(SplashCoord alpha) { void Splash::setPatternAlpha(SplashCoord strokeAlpha, SplashCoord fillAlpha) { state->patternStrokeAlpha = strokeAlpha; state->patternFillAlpha = fillAlpha; - state->multiplyPatternAlpha = gTrue; + state->multiplyPatternAlpha = true; } void Splash::clearPatternAlpha() { state->patternStrokeAlpha = 1; state->patternFillAlpha = 1; - state->multiplyPatternAlpha = gFalse; + state->multiplyPatternAlpha = false; } -void Splash::setFillOverprint(GBool fop) { +void Splash::setFillOverprint(bool fop) { state->fillOverprint = fop; } -void Splash::setStrokeOverprint(GBool gop) { +void Splash::setStrokeOverprint(bool gop) { state->strokeOverprint = gop; } @@ -1840,7 +1840,7 @@ void Splash::setLineDash(SplashCoord *lineDash, int lineDashLength, state->setLineDash(lineDash, lineDashLength, lineDashPhase); } -void Splash::setStrokeAdjust(GBool strokeAdjust) { +void Splash::setStrokeAdjust(bool strokeAdjust) { state->strokeAdjust = strokeAdjust; } @@ -1854,7 +1854,7 @@ SplashError Splash::clipToRect(SplashCoord x0, SplashCoord y0, return state->clip->clipToRect(x0, y0, x1, y1); } -SplashError Splash::clipToPath(SplashPath *path, GBool eo) { +SplashError Splash::clipToPath(SplashPath *path, bool eo) { return state->clip->clipToPath(path, state->matrix, state->flatness, eo); } @@ -1867,7 +1867,7 @@ void Splash::setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, alpha0Bitmap = alpha0BitmapA; alpha0X = alpha0XA; alpha0Y = alpha0YA; - state->inNonIsolatedGroup = gTrue; + state->inNonIsolatedGroup = true; } void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue, @@ -1875,7 +1875,7 @@ void Splash::setTransfer(Guchar *red, Guchar *green, Guchar *blue, state->setTransfer(red, green, blue, gray); } -void Splash::setOverprintMask(Guint overprintMask, GBool additive) { +void Splash::setOverprintMask(Guint overprintMask, bool additive) { state->overprintMask = overprintMask; state->overprintAdditive = additive; } @@ -2113,11 +2113,11 @@ void Splash::strokeNarrow(SplashPath *path) { nClipRes[0] = nClipRes[1] = nClipRes[2] = 0; - SplashXPath xPath(path, state->matrix, state->flatness, gFalse); + SplashXPath xPath(path, state->matrix, state->flatness, false); pipeInit(&pipe, 0, 0, state->strokePattern, nullptr, (Guchar)splashRound(state->strokeAlpha * 255), - gFalse, gFalse); + false, false); for (i = 0, seg = xPath.segs; i < xPath.length; ++i, ++seg) { if (seg->y0 <= seg->y1) { @@ -2200,8 +2200,8 @@ void Splash::strokeNarrow(SplashPath *path) { void Splash::strokeWide(SplashPath *path, SplashCoord w) { SplashPath *path2; - path2 = makeStrokePath(path, w, gFalse); - fillWithPattern(path2, gFalse, state->strokePattern, state->strokeAlpha); + path2 = makeStrokePath(path, w, false); + fillWithPattern(path2, false, state->strokePattern, state->strokeAlpha); delete path2; } @@ -2336,7 +2336,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { SplashCoord lineDashTotal; SplashCoord lineDashStartPhase, lineDashDist, segLen; SplashCoord x0, y0, x1, y1, xa, ya; - GBool lineDashStartOn, lineDashOn, newPath; + bool lineDashStartOn, lineDashOn, newPath; int lineDashStartIdx, lineDashIdx; int i, j, k; @@ -2351,7 +2351,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { lineDashStartPhase = state->lineDashPhase; i = splashFloor(lineDashStartPhase / lineDashTotal); lineDashStartPhase -= (SplashCoord)i * lineDashTotal; - lineDashStartOn = gTrue; + lineDashStartOn = true; lineDashStartIdx = 0; if (lineDashStartPhase > 0) { while (lineDashStartIdx < state->lineDashLength && lineDashStartPhase >= state->lineDash[lineDashStartIdx]) { @@ -2381,7 +2381,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { lineDashDist = state->lineDash[lineDashIdx] - lineDashStartPhase; // process each segment of the subpath - newPath = gTrue; + newPath = true; for (k = i; k < j; ++k) { // grab the segment @@ -2398,7 +2398,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { if (lineDashOn) { if (newPath) { dPath->moveTo(x0, y0); - newPath = gFalse; + newPath = false; } dPath->lineTo(x1, y1); } @@ -2411,7 +2411,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { if (lineDashOn) { if (newPath) { dPath->moveTo(x0, y0); - newPath = gFalse; + newPath = false; } dPath->lineTo(xa, ya); } @@ -2428,7 +2428,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { lineDashIdx = 0; } lineDashDist = state->lineDash[lineDashIdx]; - newPath = gTrue; + newPath = true; } } } @@ -2436,7 +2436,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { } if (dPath->length == 0) { - GBool allSame = gTrue; + bool allSame = true; for (int i = 0; allSame && i < path->length - 1; ++i) { allSame = path->pts[i].x == path->pts[i + 1].x && path->pts[i].y == path->pts[i + 1].y; } @@ -2451,7 +2451,7 @@ SplashPath *Splash::makeDashedPath(SplashPath *path) { return dPath; } -SplashError Splash::fill(SplashPath *path, GBool eo) { +SplashError Splash::fill(SplashPath *path, bool eo) { if (debugMode) { printf("fill [eo:%d]:\n", eo); dumpPath(path); @@ -2484,14 +2484,14 @@ inline void Splash::getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMaxA = yMaxFP; } -SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, +SplashError Splash::fillWithPattern(SplashPath *path, bool eo, SplashPattern *pattern, SplashCoord alpha) { SplashPipe pipe = {}; SplashXPathScanner *scanner; int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; SplashClipResult clipRes, clipRes2; - GBool adjustLine = gFalse; + bool adjustLine = false; int linePosI = 0; if (path->length == 0) { @@ -2512,7 +2512,7 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, !(path->flags[0] & splashPathClosed) && !(path->flags[1] & splashPathLast) && !(path->flags[2] & splashPathLast)) { - path->close(gTrue); + path->close(true); path->addStrokeAdjustHint(0, 2, 0, 4); path->addStrokeAdjustHint(1, 3, 0, 4); } else if (n == 5 && @@ -2528,20 +2528,20 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, if (thinLineMode != splashThinLineDefault) { if (state->clip->getXMinI() == state->clip->getXMaxI()) { linePosI = state->clip->getXMinI(); - adjustLine = gTrue; + adjustLine = true; } else if (state->clip->getXMinI() == state->clip->getXMaxI() - 1) { - adjustLine = gTrue; + adjustLine = true; linePosI = splashFloor(state->clip->getXMin() + state->lineWidth); } else if (state->clip->getYMinI() == state->clip->getYMaxI()) { linePosI = state->clip->getYMinI(); - adjustLine = gTrue; + adjustLine = true; } else if (state->clip->getYMinI() == state->clip->getYMaxI() - 1) { - adjustLine = gTrue; + adjustLine = true; linePosI = splashFloor(state->clip->getYMin() + state->lineWidth); } } - SplashXPath xPath(path, state->matrix, state->flatness, gTrue, + SplashXPath xPath(path, state->matrix, state->flatness, true, adjustLine, linePosI); if (vectorAntialias && !inShading) { xPath.aaScale(); @@ -2581,7 +2581,7 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, } pipeInit(&pipe, 0, yMinI, pattern, nullptr, (Guchar)splashRound(alpha * 255), - vectorAntialias && !inShading, gFalse); + vectorAntialias && !inShading, false); // draw the spans if (vectorAntialias && !inShading) { @@ -2591,13 +2591,13 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, state->clip->clipAALine(aaBuf, &x0, &x1, y, thinLineMode != splashThinLineDefault && xMinI == xMaxI); } Guchar lineShape = 255; - GBool adjustLine = gFalse; + bool adjustLine = false; if (thinLineMode == splashThinLineShape && (xMinI == xMaxI || yMinI == yMaxI)) { // compute line shape for thin lines: SplashCoord mx, my, delta; transform(state->matrix, 0, 0, &mx, &my); transform(state->matrix, state->lineWidth, 0, &delta, &my); - adjustLine = gTrue; + adjustLine = true; lineShape = clip255((delta - mx) * 255); } drawAALine(&pipe, x0, x1, y, adjustLine, lineShape); @@ -2607,7 +2607,7 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, SplashXPathScanIterator iterator(*scanner, y); while (iterator.getNextSpan(&x0, &x1)) { if (clipRes == splashClipAllInside) { - drawSpan(&pipe, x0, x1, y, gTrue); + drawSpan(&pipe, x0, x1, y, true); } else { // limit the x range if (x0 < state->clip->getXMinI()) { @@ -2629,7 +2629,7 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo, return splashOk; } -GBool Splash::pathAllOutside(SplashPath *path) { +bool Splash::pathAllOutside(SplashPath *path) { SplashCoord xMin1, yMin1, xMax1, yMax1; SplashCoord xMin2, yMin2, xMax2, yMax2; SplashCoord x, y; @@ -2696,7 +2696,7 @@ GBool Splash::pathAllOutside(SplashPath *path) { splashClipAllOutside; } -SplashError Splash::xorFill(SplashPath *path, GBool eo) { +SplashError Splash::xorFill(SplashPath *path, bool eo) { SplashPipe pipe; SplashXPathScanner *scanner; int xMinI, yMinI, xMaxI, yMaxI, x0, x1, y; @@ -2706,7 +2706,7 @@ SplashError Splash::xorFill(SplashPath *path, GBool eo) { if (path->length == 0) { return splashErrEmptyPath; } - SplashXPath xPath(path, state->matrix, state->flatness, gTrue); + SplashXPath xPath(path, state->matrix, state->flatness, true); xPath.sort(); scanner = new SplashXPathScanner(&xPath, eo, state->clip->getYMinI(), state->clip->getYMaxI()); @@ -2723,14 +2723,14 @@ SplashError Splash::xorFill(SplashPath *path, GBool eo) { origBlendFunc = state->blendFunc; state->blendFunc = &blendXor; - pipeInit(&pipe, 0, yMinI, state->fillPattern, nullptr, 255, gFalse, gFalse); + pipeInit(&pipe, 0, yMinI, state->fillPattern, nullptr, 255, false, false); // draw the spans for (y = yMinI; y <= yMaxI; ++y) { SplashXPathScanIterator iterator(*scanner, y); while (iterator.getNextSpan(&x0, &x1)) { if (clipRes == splashClipAllInside) { - drawSpan(&pipe, x0, x1, y, gTrue); + drawSpan(&pipe, x0, x1, y, true); } else { // limit the x range if (x0 < state->clip->getXMinI()) { @@ -2799,7 +2799,7 @@ void Splash::fillGlyph(SplashCoord x, SplashCoord y, opClipRes = clipRes; } -void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) { +void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, bool noClip) { SplashPipe pipe; int alpha0; Guchar alpha; @@ -2838,7 +2838,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) if (noClip) { if (glyph->aa) { pipeInit(&pipe, xStart, yStart, - state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), true, false); for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { pipeSetXY(&pipe, xStart, y1); for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) { @@ -2858,7 +2858,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) const int widthEight = splashCeil(glyph->w / 8.0); pipeInit(&pipe, xStart, yStart, - state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse); + state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), false, false); for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { pipeSetXY(&pipe, xStart, y1); for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { @@ -2880,7 +2880,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) } else { if (glyph->aa) { pipeInit(&pipe, xStart, yStart, - state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), true, false); for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { pipeSetXY(&pipe, xStart, y1); for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) { @@ -2904,7 +2904,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) const int widthEight = splashCeil(glyph->w / 8.0); pipeInit(&pipe, xStart, yStart, - state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), gFalse, gFalse); + state->fillPattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), false, false); for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) { pipeSetXY(&pipe, xStart, y1); for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) { @@ -2932,10 +2932,10 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip) SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat, - GBool glyphMode) { + bool glyphMode) { SplashBitmap *scaledMask; SplashClipResult clipRes; - GBool minorAxisZero; + bool minorAxisZero; int x0, y0, x1, y1, scaledWidth, scaledHeight; int yp; @@ -3019,7 +3019,7 @@ SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, - SplashCoord *mat, GBool glyphMode) { + SplashCoord *mat, bool glyphMode) { SplashBitmap *scaledMask; SplashClipResult clipRes, clipRes2; SplashPipe pipe; @@ -3213,7 +3213,7 @@ void Splash::arbitraryTransformMask(SplashImageMaskSource src, void *srcData, // initialize the pixel pipe pipeInit(&pipe, 0, 0, state->fillPattern, nullptr, - (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + (Guchar)splashRound(state->fillAlpha * 255), true, false); if (vectorAntialias) { drawAAPixelInit(); } @@ -3295,7 +3295,7 @@ SplashBitmap *Splash::scaleMask(SplashImageMaskSource src, void *srcData, SplashBitmap *dest; dest = new SplashBitmap(scaledWidth, scaledHeight, 1, splashModeMono8, - gFalse); + false); if (scaledHeight < srcHeight) { if (scaledWidth < srcWidth) { scaleMaskYdXd(src, srcData, srcWidth, srcHeight, @@ -3658,7 +3658,7 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest, } if (vectorAntialias && clipRes != splashClipAllInside) { pipeInit(&pipe, xDest, yDest, state->fillPattern, nullptr, - (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + (Guchar)splashRound(state->fillAlpha * 255), true, false); drawAAPixelInit(); for (y = 0; y < h; ++y) { for (x = 0; x < w; ++x) { @@ -3668,7 +3668,7 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest, } } else { pipeInit(&pipe, xDest, yDest, state->fillPattern, nullptr, - (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + (Guchar)splashRound(state->fillAlpha * 255), true, false); if (clipRes == splashClipAllInside) { for (y = 0; y < h; ++y) { pipeSetXY(&pipe, xDest, yDest + y); @@ -3706,13 +3706,13 @@ void Splash::blitMask(SplashBitmap *src, int xDest, int yDest, } SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void *srcData, - SplashColorMode srcMode, GBool srcAlpha, - int w, int h, SplashCoord *mat, GBool interpolate, - GBool tilingPattern) { - GBool ok; + SplashColorMode srcMode, bool srcAlpha, + int w, int h, SplashCoord *mat, bool interpolate, + bool tilingPattern) { + bool ok; SplashBitmap *scaledImg; SplashClipResult clipRes; - GBool minorAxisZero; + bool minorAxisZero; int x0, y0, x1, y1, scaledWidth, scaledHeight; int nComps; int yp; @@ -3724,7 +3724,7 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void } // check color modes - ok = gFalse; // make gcc happy + ok = false; // make gcc happy nComps = 0; // make gcc happy switch (bitmap->mode) { case splashModeMono1: @@ -3755,7 +3755,7 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void break; #endif default: - ok = gFalse; + ok = false; break; } if (!ok) { @@ -3856,10 +3856,10 @@ SplashError Splash::drawImage(SplashImageSource src, SplashICCTransform tf, void SplashError Splash::arbitraryTransformImage(SplashImageSource src, SplashICCTransform tf, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, + bool srcAlpha, int srcWidth, int srcHeight, - SplashCoord *mat, GBool interpolate, - GBool tilingPattern) { + SplashCoord *mat, bool interpolate, + bool tilingPattern) { SplashBitmap *scaledImg; SplashClipResult clipRes, clipRes2; SplashPipe pipe; @@ -4088,7 +4088,7 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, SplashICCTran pipeInit(&pipe, 0, 0, nullptr, pixel, (Guchar)splashRound(state->fillAlpha * 255), srcAlpha || (vectorAntialias && clipRes != splashClipAllInside), - gFalse); + false); if (vectorAntialias) { drawAAPixelInit(); } @@ -4165,27 +4165,27 @@ SplashError Splash::arbitraryTransformImage(SplashImageSource src, SplashICCTran // determine if a scaled image requires interpolation based on the scale and // the interpolate flag from the image dictionary -static GBool isImageInterpolationRequired(int srcWidth, int srcHeight, +static bool isImageInterpolationRequired(int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, - GBool interpolate) { + bool interpolate) { if (interpolate || srcWidth == 0 || srcHeight == 0) - return gTrue; + return true; /* When scale factor is >= 400% we don't interpolate. See bugs #25268, #9860 */ if (scaledWidth / srcWidth >= 4 || scaledHeight / srcHeight >= 4) - return gFalse; + return false; - return gTrue; + return true; } // Scale an image into a SplashBitmap. SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, - int scaledWidth, int scaledHeight, GBool interpolate, GBool tilingPattern) { + bool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, bool interpolate, bool tilingPattern) { SplashBitmap *dest; - dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, gTrue, bitmap->getSeparationList()); + dest = new SplashBitmap(scaledWidth, scaledHeight, 1, srcMode, srcAlpha, true, bitmap->getSeparationList()); if (dest->getDataPtr() != nullptr && srcHeight > 0 && srcWidth > 0) { if (scaledHeight < srcHeight) { if (scaledWidth < srcWidth) { @@ -4218,7 +4218,7 @@ SplashBitmap *Splash::scaleImage(SplashImageSource src, void *srcData, void Splash::scaleImageYdXd(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest) { Guchar *lineBuf, *alphaLineBuf; @@ -4461,7 +4461,7 @@ void Splash::scaleImageYdXd(SplashImageSource src, void *srcData, void Splash::scaleImageYdXu(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest) { Guchar *lineBuf, *alphaLineBuf; @@ -4611,7 +4611,7 @@ void Splash::scaleImageYdXu(SplashImageSource src, void *srcData, void Splash::scaleImageYuXd(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest) { Guchar *lineBuf, *alphaLineBuf; @@ -4773,7 +4773,7 @@ void Splash::scaleImageYuXd(SplashImageSource src, void *srcData, void Splash::scaleImageYuXu(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest) { Guchar *lineBuf, *alphaLineBuf; @@ -4954,7 +4954,7 @@ static void expandRow(Guchar *srcBuf, Guchar *dstBuf, int srcWidth, int scaledWi // Scale up image using bilinear interpolation void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest) { Guchar *srcBuf, *lineBuf1, *lineBuf2, *alphaSrcBuf, *alphaLineBuf1, *alphaLineBuf2; @@ -5104,14 +5104,14 @@ void Splash::vertFlipImage(SplashBitmap *img, int width, int height, gfree(lineBuf); } -void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest) { +void Splash::blitImage(SplashBitmap *src, bool srcAlpha, int xDest, int yDest) { SplashClipResult clipRes = state->clip->testRect(xDest, yDest, xDest + src->getWidth() - 1, yDest + src->getHeight() - 1); if (clipRes != splashClipAllOutside) { blitImage(src, srcAlpha, xDest, yDest, clipRes); } } -void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest, +void Splash::blitImage(SplashBitmap *src, bool srcAlpha, int xDest, int yDest, SplashClipResult clipRes) { SplashPipe pipe; SplashColor pixel = {}; @@ -5155,7 +5155,7 @@ void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest, // draw the unclipped region if (x0 < w && y0 < h && x0 < x1 && y0 < y1) { pipeInit(&pipe, xDest + x0, yDest + y0, nullptr, pixel, - (Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse); + (Guchar)splashRound(state->fillAlpha * 255), srcAlpha, false); if (srcAlpha) { for (y = y0; y < y1; ++y) { pipeSetXY(&pipe, xDest + x0, yDest + y); @@ -5197,7 +5197,7 @@ void Splash::blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest, } } -void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha, +void Splash::blitImageClipped(SplashBitmap *src, bool srcAlpha, int xSrc, int ySrc, int xDest, int yDest, int w, int h) { SplashPipe pipe; @@ -5207,7 +5207,7 @@ void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha, if (vectorAntialias) { pipeInit(&pipe, xDest, yDest, nullptr, pixel, - (Guchar)splashRound(state->fillAlpha * 255), gTrue, gFalse); + (Guchar)splashRound(state->fillAlpha * 255), true, false); drawAAPixelInit(); if (srcAlpha) { for (y = 0; y < h; ++y) { @@ -5229,7 +5229,7 @@ void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha, } } else { pipeInit(&pipe, xDest, yDest, nullptr, pixel, - (Guchar)splashRound(state->fillAlpha * 255), srcAlpha, gFalse); + (Guchar)splashRound(state->fillAlpha * 255), srcAlpha, false); if (srcAlpha) { for (y = 0; y < h; ++y) { ap = src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc; @@ -5267,8 +5267,8 @@ void Splash::blitImageClipped(SplashBitmap *src, GBool srcAlpha, SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h, - GBool noClip, GBool nonIsolated, - GBool knockout, SplashCoord knockoutOpacity) { + bool noClip, bool nonIsolated, + bool knockout, SplashCoord knockoutOpacity) { SplashPipe pipe; SplashColor pixel; Guchar alpha; @@ -5289,7 +5289,7 @@ SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc, } if (src->alpha) { pipeInit(&pipe, xDest, yDest, nullptr, pixel, - (Guchar)splashRound(state->fillAlpha * 255), gTrue, nonIsolated, + (Guchar)splashRound(state->fillAlpha * 255), true, nonIsolated, knockout, (Guchar)splashRound(knockoutOpacity * 255)); if (noClip) { for (y = 0; y < h; ++y) { @@ -5330,7 +5330,7 @@ SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc, } } else { pipeInit(&pipe, xDest, yDest, nullptr, pixel, - (Guchar)splashRound(state->fillAlpha * 255), gFalse, nonIsolated); + (Guchar)splashRound(state->fillAlpha * 255), false, nonIsolated); if (noClip) { for (y = 0; y < h; ++y) { pipeSetXY(&pipe, xDest, yDest + y); @@ -5527,7 +5527,7 @@ void Splash::compositeBackground(SplashColorPtr color) { memset(bitmap->alpha, 255, bitmap->width * bitmap->height); } -GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) +bool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) { double xdbl[3] = {0., 0., 0.}; double ydbl[3] = {0., 0., 0.}; @@ -5545,7 +5545,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) double scanColorMap[2] = {0., 0.}; int scanEdgeL[2] = { 0, 0 }; int scanEdgeR[2] = { 0, 0 }; - GBool hasFurtherSegment = gFalse; + bool hasFurtherSegment = false; int scanLineOff = 0; int bitmapOff = 0; @@ -5560,7 +5560,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) SplashColorPtr cur = nullptr; SplashCoord* userToCanvasMatrix = getMatrix(); SplashColorMode bitmapMode = bitmap->getMode(); - GBool hasAlpha = (bitmapAlpha != nullptr); + bool hasAlpha = (bitmapAlpha != nullptr); int rowSize = bitmap->getRowSize(); int colorComps = 0; switch (bitmapMode) { @@ -5591,11 +5591,11 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) SplashPipe pipe; SplashColor cSrcVal; - pipeInit(&pipe, 0, 0, nullptr, cSrcVal, (Guchar)splashRound(state->strokeAlpha * 255), gFalse, gFalse); + pipeInit(&pipe, 0, 0, nullptr, cSrcVal, (Guchar)splashRound(state->strokeAlpha * 255), false, false); if (vectorAntialias) { if (aaBuf == nullptr) - return gFalse; // fall back to old behaviour + return false; // fall back to old behaviour drawAAPixelInit(); } @@ -5612,13 +5612,13 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) // - the final step, is performed using a SplashPipe: // - assign the actual color into cSrcVal: pipe uses cSrcVal by reference // - invoke drawPixel(&pipe,X,Y,bNoClip); - GBool bDirectBlit = vectorAntialias ? gFalse : pipe.noTransparency && !state->blendFunc; + bool bDirectBlit = vectorAntialias ? false : pipe.noTransparency && !state->blendFunc; if (!bDirectBlit) { blitTarget = new SplashBitmap(bitmap->getWidth(), bitmap->getHeight(), bitmap->getRowPad(), bitmap->getMode(), - gTrue, + true, bitmap->getRowSize() >= 0); bitmapData = blitTarget->getDataPtr(); bitmapAlpha = blitTarget->getAlphaPtr(); @@ -5627,7 +5627,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) int S = bitmap->getWidth() * bitmap->getHeight(); for (int i = 0; i < S; ++i) bitmapAlpha[i] = 0; - hasAlpha = gTrue; + hasAlpha = true; } if (shading->isParameterized()) { @@ -5761,7 +5761,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) } assert( y[scanEdgeL[0]] < y[scanEdgeL[1]] ); assert( y[scanEdgeR[0]] < y[scanEdgeR[1]] ); - hasFurtherSegment = gFalse; + hasFurtherSegment = false; } yt = Y; @@ -5814,7 +5814,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) if (!bDirectBlit) { delete blitTarget; } - return gFalse; + return false; } if (!bDirectBlit) { @@ -5835,7 +5835,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) if (vectorAntialias) { drawAAPixel(&pipe, X, Y); } else { - drawPixel(&pipe, X, Y, gTrue); // no clipping - has already been done. + drawPixel(&pipe, X, Y, true); // no clipping - has already been done. } } } @@ -5844,7 +5844,7 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) blitTarget = nullptr; } - return gTrue; + return true; } SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc, @@ -5956,11 +5956,11 @@ SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc, } SplashPath *Splash::makeStrokePath(SplashPath *path, SplashCoord w, - GBool flatten) { + bool flatten) { SplashPath *pathIn, *dashPath, *pathOut; SplashCoord d, dx, dy, wdx, wdy, dxNext, dyNext, wdxNext, wdyNext; SplashCoord crossprod, dotprod, miter, m; - GBool first, last, closed, hasangle; + bool first, last, closed, hasangle; int subpathStart0, subpathStart1, seg, i0, i1, j0, j1, k0, k1; int left0, left1, left2, right0, right1, right2, join0, join1, join2; int leftFirst, rightFirst, firstPt; @@ -5988,7 +5988,7 @@ SplashPath *pathIn, *dashPath, *pathOut; subpathStart0 = subpathStart1 = 0; // make gcc happy seg = 0; // make gcc happy - closed = gFalse; // make gcc happy + closed = false; // make gcc happy left0 = left1 = right0 = right1 = join0 = join1 = 0; // make gcc happy leftFirst = rightFirst = firstPt = 0; // make gcc happy @@ -6387,7 +6387,7 @@ void Splash::dumpXPath(SplashXPath *path) { } } -SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox, +SplashError Splash::shadedFill(SplashPath *path, bool hasBBox, SplashPattern *pattern) { SplashPipe pipe; SplashXPathScanner *scanner; @@ -6400,7 +6400,7 @@ SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox, if (path->length == 0) { return splashErrEmptyPath; } - SplashXPath xPath(path, state->matrix, state->flatness, gTrue); + SplashXPath xPath(path, state->matrix, state->flatness, true); if (vectorAntialias) { xPath.aaScale(); } @@ -6411,7 +6411,7 @@ SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox, yMinI = yMinI * splashAASize; yMaxI = (yMaxI + 1) * splashAASize - 1; } - scanner = new SplashXPathScanner(&xPath, gFalse, yMinI, yMaxI); + scanner = new SplashXPathScanner(&xPath, false, yMinI, yMaxI); // get the min and max x and y values if (vectorAntialias) { @@ -6430,7 +6430,7 @@ SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox, yMaxI = state->clip->getYMaxI(); } - pipeInit(&pipe, 0, yMinI, pattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, gFalse); + pipeInit(&pipe, 0, yMinI, pattern, nullptr, (Guchar)splashRound(state->fillAlpha * 255), vectorAntialias && !hasBBox, false); // draw the spans if (vectorAntialias) { @@ -6496,7 +6496,7 @@ SplashError Splash::shadedFill(SplashPath *path, GBool hasBBox, SplashXPathScanIterator iterator(*scanner, y); while (iterator.getNextSpan(&x0, &x1)) { if (clipRes == splashClipAllInside) { - drawSpan(&pipe, x0, x1, y, gTrue); + drawSpan(&pipe, x0, x1, y, true); } else { // limit the x range if (x0 < state->clip->getXMinI()) { diff --git a/splash/Splash.h b/splash/Splash.h index 2ce73e9f..97ed32ec 100644 --- a/splash/Splash.h +++ b/splash/Splash.h @@ -44,12 +44,12 @@ struct SplashPipe; // Retrieves the next line of pixels in an image mask. Normally, // fills in *<line> and returns true. If the image stream is // exhausted, returns false. -typedef GBool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel); +typedef bool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel); // Retrieves the next line of pixels in an image. Normally, fills in // *<line> and returns true. If the image stream is exhausted, // returns false. -typedef GBool (*SplashImageSource)(void *data, SplashColorPtr colorLine, +typedef bool (*SplashImageSource)(void *data, SplashColorPtr colorLine, Guchar *alphaLine); // Use ICCColorSpace to transform a bitmap @@ -87,9 +87,9 @@ class Splash { public: // Create a new rasterizer object. - Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, + Splash(SplashBitmap *bitmapA, bool vectorAntialiasA, SplashScreenParams *screenParams = nullptr); - Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA, + Splash(SplashBitmap *bitmapA, bool vectorAntialiasA, SplashScreen *screenA); ~Splash(); @@ -114,10 +114,10 @@ public: SplashCoord *getLineDash(); int getLineDashLength(); SplashCoord getLineDashPhase(); - GBool getStrokeAdjust(); + bool getStrokeAdjust(); SplashClip *getClip(); SplashBitmap *getSoftMask(); - GBool getInNonIsolatedGroup(); + bool getInNonIsolatedGroup(); //----- state write @@ -130,8 +130,8 @@ public: void setFillAlpha(SplashCoord alpha); void setPatternAlpha(SplashCoord strokeAlpha, SplashCoord fillAlpha); void clearPatternAlpha(); - void setFillOverprint(GBool fop); - void setStrokeOverprint(GBool sop); + void setFillOverprint(bool fop); + void setStrokeOverprint(bool sop); void setOverprintMode(int opm); void setLineWidth(SplashCoord lineWidth); void setLineCap(int lineCap); @@ -141,7 +141,7 @@ public: // the <lineDash> array will be copied void setLineDash(SplashCoord *lineDash, int lineDashLength, SplashCoord lineDashPhase); - void setStrokeAdjust(GBool strokeAdjust); + void setStrokeAdjust(bool strokeAdjust); // NB: uses transformed coordinates. void clipResetToRect(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1); @@ -149,12 +149,12 @@ public: SplashError clipToRect(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1); // NB: uses untransformed coordinates. - SplashError clipToPath(SplashPath *path, GBool eo); + SplashError clipToPath(SplashPath *path, bool eo); void setSoftMask(SplashBitmap *softMask); void setInNonIsolatedGroup(SplashBitmap *alpha0BitmapA, int alpha0XA, int alpha0YA); void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray); - void setOverprintMask(Guint overprintMask, GBool additive); + void setOverprintMask(Guint overprintMask, bool additive); //----- state save/restore @@ -170,10 +170,10 @@ public: SplashError stroke(SplashPath *path); // Fill a path using the current fill pattern. - SplashError fill(SplashPath *path, GBool eo); + SplashError fill(SplashPath *path, bool eo); // Fill a path, XORing with the current fill pattern. - SplashError xorFill(SplashPath *path, GBool eo); + SplashError xorFill(SplashPath *path, bool eo); // Draw a character, using the current fill pattern. SplashError fillChar(SplashCoord x, SplashCoord y, int c, SplashFont *font); @@ -198,7 +198,7 @@ public: // top line. SplashError fillImageMask(SplashImageMaskSource src, void *srcData, int w, int h, SplashCoord *mat, - GBool glyphMode); + bool glyphMode); // Draw an image. This will read <h> lines of <w> pixels from // <src>, starting with the top line. These pixels are assumed to @@ -216,16 +216,16 @@ public: // CMYK8 CMYK8 // The matrix behaves as for fillImageMask. SplashError drawImage(SplashImageSource src, SplashICCTransform tf, void *srcData, - SplashColorMode srcMode, GBool srcAlpha, - int w, int h, SplashCoord *mat, GBool interpolate, - GBool tilingPattern = gFalse); + SplashColorMode srcMode, bool srcAlpha, + int w, int h, SplashCoord *mat, bool interpolate, + bool tilingPattern = false); // Composite a rectangular region from <src> onto this Splash // object. SplashError composite(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h, - GBool noClip, GBool nonIsolated, - GBool knockout = gFalse, SplashCoord knockoutOpacity = 1.0); + bool noClip, bool nonIsolated, + bool knockout = false, SplashCoord knockoutOpacity = 1.0); // Composite this Splash object onto a background color. The // background alpha is assumed to be 1. @@ -236,7 +236,7 @@ public: // zero. SplashError blitTransparent(SplashBitmap *src, int xSrc, int ySrc, int xDest, int yDest, int w, int h); - void blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest); + void blitImage(SplashBitmap *src, bool srcAlpha, int xDest, int yDest); //----- misc @@ -245,7 +245,7 @@ public: // the current state. If <flatten> is true, this function will // first flatten the path and handle the linedash. SplashPath *makeStrokePath(SplashPath *path, SplashCoord w, - GBool flatten = gTrue); + bool flatten = true); // Return the associated bitmap. SplashBitmap *getBitmap() { return bitmap; } @@ -270,27 +270,27 @@ public: SplashClipResult getClipRes() { return opClipRes; } // Toggle debug mode on or off. - void setDebugMode(GBool debugModeA) { debugMode = debugModeA; } + void setDebugMode(bool debugModeA) { debugMode = debugModeA; } #if 1 //~tmp: turn off anti-aliasing temporarily - void setInShading(GBool sh) { inShading = sh; } - GBool getVectorAntialias() { return vectorAntialias; } - void setVectorAntialias(GBool vaa) { vectorAntialias = vaa; } + void setInShading(bool sh) { inShading = sh; } + bool getVectorAntialias() { return vectorAntialias; } + void setVectorAntialias(bool vaa) { vectorAntialias = vaa; } #endif // Do shaded fills with dynamic patterns - SplashError shadedFill(SplashPath *path, GBool hasBBox, + SplashError shadedFill(SplashPath *path, bool hasBBox, SplashPattern *pattern); // Draw a gouraud triangle shading. - GBool gouraudTriangleShadedFill(SplashGouraudColor *shading); + bool gouraudTriangleShadedFill(SplashGouraudColor *shading); private: void pipeInit(SplashPipe *pipe, int x, int y, SplashPattern *pattern, SplashColorPtr cSrc, - Guchar aInput, GBool usesShape, - GBool nonIsolatedGroup, - GBool knockout = gFalse, Guchar knockoutOpacity = 255); + Guchar aInput, bool usesShape, + bool nonIsolatedGroup, + bool knockout = false, Guchar knockoutOpacity = 255); void pipeRun(SplashPipe *pipe); void pipeRunSimpleMono1(SplashPipe *pipe); void pipeRunSimpleMono8(SplashPipe *pipe); @@ -312,11 +312,11 @@ private: #endif void pipeSetXY(SplashPipe *pipe, int x, int y); void pipeIncX(SplashPipe *pipe); - void drawPixel(SplashPipe *pipe, int x, int y, GBool noClip); + void drawPixel(SplashPipe *pipe, int x, int y, bool noClip); void drawAAPixelInit(); void drawAAPixel(SplashPipe *pipe, int x, int y); - void drawSpan(SplashPipe *pipe, int x0, int x1, int y, GBool noClip); - void drawAALine(SplashPipe *pipe, int x0, int x1, int y, GBool adjustLine = gFalse, Guchar lineOpacity = 0); + void drawSpan(SplashPipe *pipe, int x0, int x1, int y, bool noClip); + void drawAALine(SplashPipe *pipe, int x0, int x1, int y, bool adjustLine = false, Guchar lineOpacity = 0); void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi, SplashCoord *xo, SplashCoord *yo); void updateModX(int x); @@ -333,13 +333,13 @@ private: SplashPath *fPath); SplashPath *makeDashedPath(SplashPath *xPath); void getBBoxFP(SplashPath *path, SplashCoord *xMinA, SplashCoord *yMinA, SplashCoord *xMaxA, SplashCoord *yMaxA); - SplashError fillWithPattern(SplashPath *path, GBool eo, + SplashError fillWithPattern(SplashPath *path, bool eo, SplashPattern *pattern, SplashCoord alpha); - GBool pathAllOutside(SplashPath *path); - void fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noclip); + bool pathAllOutside(SplashPath *path); + void fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, bool noclip); void arbitraryTransformMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, - SplashCoord *mat, GBool glyphMode); + SplashCoord *mat, bool glyphMode); SplashBitmap *scaleMask(SplashImageMaskSource src, void *srcData, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight); @@ -363,43 +363,43 @@ private: SplashClipResult clipRes); SplashError arbitraryTransformImage(SplashImageSource src, SplashICCTransform tf, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, + bool srcAlpha, int srcWidth, int srcHeight, - SplashCoord *mat, GBool interpolate, GBool tilingPattern = gFalse); + SplashCoord *mat, bool interpolate, bool tilingPattern = false); SplashBitmap *scaleImage(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, - int scaledWidth, int scaledHeight, GBool interpolate, GBool tilingPattern = gFalse); + bool srcAlpha, int srcWidth, int srcHeight, + int scaledWidth, int scaledHeight, bool interpolate, bool tilingPattern = false); void scaleImageYdXd(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); void scaleImageYdXu(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); void scaleImageYuXd(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); void scaleImageYuXu(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); void scaleImageYuXuBilinear(SplashImageSource src, void *srcData, SplashColorMode srcMode, int nComps, - GBool srcAlpha, int srcWidth, int srcHeight, + bool srcAlpha, int srcWidth, int srcHeight, int scaledWidth, int scaledHeight, SplashBitmap *dest); void vertFlipImage(SplashBitmap *img, int width, int height, int nComps); - void blitImage(SplashBitmap *src, GBool srcAlpha, int xDest, int yDest, + void blitImage(SplashBitmap *src, bool srcAlpha, int xDest, int yDest, SplashClipResult clipRes); - void blitImageClipped(SplashBitmap *src, GBool srcAlpha, + void blitImageClipped(SplashBitmap *src, bool srcAlpha, int xSrc, int ySrc, int xDest, int yDest, int w, int h); void dumpPath(SplashPath *path); @@ -422,9 +422,9 @@ private: SplashThinLineMode thinLineMode; int modXMin, modYMin, modXMax, modYMax; SplashClipResult opClipRes; - GBool vectorAntialias; - GBool inShading; - GBool debugMode; + bool vectorAntialias; + bool inShading; + bool debugMode; }; #endif diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc index bedc6f42..837d412b 100644 --- a/splash/SplashBitmap.cc +++ b/splash/SplashBitmap.cc @@ -51,8 +51,8 @@ //------------------------------------------------------------------------ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPadA, - SplashColorMode modeA, GBool alphaA, - GBool topDown, GooList *separationListA) { + SplashColorMode modeA, bool alphaA, + bool topDown, GooList *separationListA) { width = widthA; height = heightA; mode = modeA; @@ -542,7 +542,7 @@ static inline Guchar div255(int x) { return (Guchar)((x + (x >> 8) + 0x80) >> 8); } -GBool SplashBitmap::convertToXBGR(ConversionMode conversionMode) { +bool SplashBitmap::convertToXBGR(ConversionMode conversionMode) { if (mode == splashModeXBGR8) { if (conversionMode != conversionOpaque) { // Copy the alpha channel into the fourth component so that XBGR becomes ABGR. @@ -569,7 +569,7 @@ GBool SplashBitmap::convertToXBGR(ConversionMode conversionMode) { } } - return gTrue; + return true; } int newrowSize = width * 4; diff --git a/splash/SplashBitmap.h b/splash/SplashBitmap.h index ee41ae67..6dad56f9 100644 --- a/splash/SplashBitmap.h +++ b/splash/SplashBitmap.h @@ -50,8 +50,8 @@ public: // <rowPad> bytes. If <topDown> is false, the bitmap will be stored // upside-down, i.e., with the last row first in memory. SplashBitmap(int widthA, int heightA, int rowPad, - SplashColorMode modeA, GBool alphaA, - GBool topDown = gTrue, GooList *separationList = nullptr); + SplashColorMode modeA, bool alphaA, + bool topDown = true, GooList *separationList = nullptr); static SplashBitmap *copy(SplashBitmap *src); ~SplashBitmap(); @@ -76,9 +76,9 @@ public: struct WriteImgParams { int jpegQuality = -1; - GBool jpegProgressive = gFalse; + bool jpegProgressive = false; GooString tiffCompression; - GBool jpegOptimize = gFalse; + bool jpegOptimize = false; }; SplashError writeImgFile(SplashImageFileFormat format, const char *fileName, int hDPI, int vDPI, WriteImgParams* params = nullptr); @@ -92,7 +92,7 @@ public: conversionAlphaPremultiplied }; - GBool convertToXBGR(ConversionMode conversionMode = conversionOpaque); + bool convertToXBGR(ConversionMode conversionMode = conversionOpaque); void getPixel(int x, int y, SplashColorPtr pixel); void getRGBLine(int y, SplashColorPtr line); diff --git a/splash/SplashClip.cc b/splash/SplashClip.cc index d04dcb5e..59cb4669 100644 --- a/splash/SplashClip.cc +++ b/splash/SplashClip.cc @@ -43,7 +43,7 @@ SplashClip::SplashClip(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1, - GBool antialiasA) { + bool antialiasA) { antialias = antialiasA; if (x0 < x1) { xMin = x0; @@ -210,11 +210,11 @@ SplashError SplashClip::clipToRect(SplashCoord x0, SplashCoord y0, } SplashError SplashClip::clipToPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool eo) { + SplashCoord flatness, bool eo) { SplashXPath *xPath; int yMinAA, yMaxAA; - xPath = new SplashXPath(path, matrix, flatness, gTrue); + xPath = new SplashXPath(path, matrix, flatness, true); // check for an empty path if (xPath->length == 0) { @@ -331,7 +331,7 @@ SplashClipResult SplashClip::testSpan(int spanXMin, int spanXMax, int spanY) { return splashClipAllInside; } -void SplashClip::clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, GBool adjustVertLine) { +void SplashClip::clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, bool adjustVertLine) { int xx0, xx1, xx, yy, i; SplashColorPtr p; diff --git a/splash/SplashClip.h b/splash/SplashClip.h index 457502b5..7b587d27 100644 --- a/splash/SplashClip.h +++ b/splash/SplashClip.h @@ -48,7 +48,7 @@ public: // Create a clip, for the given rectangle. SplashClip(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1, - GBool antialiasA); + bool antialiasA); // Copy a clip. SplashClip *copy() { return new SplashClip(this); } @@ -68,34 +68,34 @@ public: // Interesect the clip with <path>. SplashError clipToPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool eo); + SplashCoord flatness, bool eo); // Returns true if (<x>,<y>) is inside the clip. - GBool test(int x, int y) + bool test(int x, int y) { int i; // check the rectangle if (x < xMinI || x > xMaxI || y < yMinI || y > yMaxI) { - return gFalse; + return false; } // check the paths if (antialias) { for (i = 0; i < length; ++i) { if (!scanners[i]->test(x * splashAASize, y * splashAASize)) { - return gFalse; + return false; } } } else { for (i = 0; i < length; ++i) { if (!scanners[i]->test(x, y)) { - return gFalse; + return false; } } } - return gTrue; + return true; } // Tests a rectangle against the clipping region. Returns one of: @@ -117,7 +117,7 @@ public: // all non-zero pixels are between <x0> and <x1>. This function // will update <x0> and <x1>. void clipAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, - GBool adjustVertLine = gFalse); + bool adjustVertLine = false); // Get the rectangle part of the clip region. SplashCoord getXMin() { return xMin; } @@ -139,7 +139,7 @@ protected: SplashClip(SplashClip *clip); void grow(int nPaths); - GBool antialias; + bool antialias; SplashCoord xMin, yMin, xMax, yMax; int xMinI, yMinI, xMaxI, yMaxI; SplashXPath **paths; diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc index d347af30..bd60f82f 100644 --- a/splash/SplashFTFont.cc +++ b/splash/SplashFTFont.cc @@ -234,12 +234,12 @@ SplashFTFont::SplashFTFont(SplashFTFontFile *fontFileA, SplashCoord *matA, SplashFTFont::~SplashFTFont() { } -GBool SplashFTFont::getGlyph(int c, int xFrac, int yFrac, +bool SplashFTFont::getGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { return SplashFont::getGlyph(c, xFrac, 0, bitmap, x0, y0, clip, clipRes); } -static FT_Int32 getFTLoadFlags(GBool type1, GBool trueType, GBool aa, GBool enableFreeTypeHinting, GBool enableSlightHinting) +static FT_Int32 getFTLoadFlags(bool type1, bool trueType, bool aa, bool enableFreeTypeHinting, bool enableSlightHinting) { int ret = FT_LOAD_DEFAULT; if (aa) @@ -268,7 +268,7 @@ static FT_Int32 getFTLoadFlags(GBool type1, GBool trueType, GBool aa, GBool enab return ret; } -GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, +bool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { SplashFTFontFile *ff; FT_Vector offset; @@ -279,7 +279,7 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, int i; if (unlikely(!isOk)) { - return gFalse; + return false; } ff = (SplashFTFontFile *)fontFile; @@ -297,7 +297,7 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, } if (FT_Load_Glyph(ff->face, gid, getFTLoadFlags(ff->type1, ff->trueType, aa, enableFreeTypeHinting, enableSlightHinting))) { - return gFalse; + return false; } // prelimirary values based on FT_Outline_Get_CBox @@ -314,19 +314,19 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, x0 - bitmap->x + bitmap->w, y0 - bitmap->y + bitmap->h); if (*clipRes == splashClipAllOutside) { - bitmap->freeData = gFalse; - return gTrue; + bitmap->freeData = false; + return true; } if (FT_Render_Glyph(slot, aa ? ft_render_mode_normal : ft_render_mode_mono)) { - return gFalse; + return false; } if (slot->bitmap.width == 0 || slot->bitmap.rows == 0) { // this can happen if (a) the glyph is really tiny or (b) the // metrics in the TrueType file are broken - return gFalse; + return false; } bitmap->x = -slot->bitmap_left; @@ -341,16 +341,16 @@ GBool SplashFTFont::makeGlyph(int c, int xFrac, int yFrac, } bitmap->data = (Guchar *)gmallocn_checkoverflow(rowSize, bitmap->h); if (!bitmap->data) { - return gFalse; + return false; } - bitmap->freeData = gTrue; + bitmap->freeData = true; for (i = 0, p = bitmap->data, q = slot->bitmap.buffer; i < bitmap->h; ++i, p += rowSize, q += slot->bitmap.pitch) { memcpy(p, q, rowSize); } - return gTrue; + return true; } double SplashFTFont::getGlyphAdvance(int c) @@ -392,7 +392,7 @@ double SplashFTFont::getGlyphAdvance(int c) struct SplashFTFontPath { SplashPath *path; SplashCoord textScale; - GBool needClose; + bool needClose; }; SplashPath *SplashFTFont::getGlyphPath(int c) { @@ -440,7 +440,7 @@ SplashPath *SplashFTFont::getGlyphPath(int c) { } path.path = new SplashPath(); path.textScale = textScale; - path.needClose = gFalse; + path.needClose = false; FT_Outline_Decompose(&((FT_OutlineGlyph)glyph)->outline, &outlineFuncs, &path); if (path.needClose) { @@ -455,7 +455,7 @@ static int glyphPathMoveTo(const FT_Vector *pt, void *path) { if (p->needClose) { p->path->close(); - p->needClose = gFalse; + p->needClose = false; } p->path->moveTo((SplashCoord)pt->x * p->textScale / 64.0, (SplashCoord)pt->y * p->textScale / 64.0); @@ -467,7 +467,7 @@ static int glyphPathLineTo(const FT_Vector *pt, void *path) { p->path->lineTo((SplashCoord)pt->x * p->textScale / 64.0, (SplashCoord)pt->y * p->textScale / 64.0); - p->needClose = gTrue; + p->needClose = true; return 0; } @@ -506,7 +506,7 @@ static int glyphPathConicTo(const FT_Vector *ctrl, const FT_Vector *pt, y2 = (SplashCoord)(1.0 / 3.0) * ((SplashCoord)2 * yc + y3); p->path->curveTo(x1, y1, x2, y2, x3, y3); - p->needClose = gTrue; + p->needClose = true; return 0; } @@ -520,6 +520,6 @@ static int glyphPathCubicTo(const FT_Vector *ctrl1, const FT_Vector *ctrl2, (SplashCoord)ctrl2->y * p->textScale / 64.0, (SplashCoord)pt->x * p->textScale / 64.0, (SplashCoord)pt->y * p->textScale / 64.0); - p->needClose = gTrue; + p->needClose = true; return 0; } diff --git a/splash/SplashFTFont.h b/splash/SplashFTFont.h index 25376e9a..b2c90c42 100644 --- a/splash/SplashFTFont.h +++ b/splash/SplashFTFont.h @@ -46,12 +46,12 @@ public: virtual ~SplashFTFont(); // Munge xFrac and yFrac before calling SplashFont::getGlyph. - GBool getGlyph(int c, int xFrac, int yFrac, + bool getGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) override; // Rasterize a glyph. The <xFrac> and <yFrac> values are the same // as described for getGlyph. - GBool makeGlyph(int c, int xFrac, int yFrac, + bool makeGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) override; // Return the path for a glyph. @@ -67,9 +67,9 @@ private: FT_Matrix textMatrix; SplashCoord textScale; int size; - GBool enableFreeTypeHinting; - GBool enableSlightHinting; - GBool isOk; + bool enableFreeTypeHinting; + bool enableSlightHinting; + bool isOk; }; #endif diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc index b116663d..c8f7e559 100644 --- a/splash/SplashFTFontEngine.cc +++ b/splash/SplashFTFontEngine.cc @@ -46,8 +46,8 @@ extern "C" int unlink(char *filename); // SplashFTFontEngine //------------------------------------------------------------------------ -SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, - GBool enableSlightHintingA, FT_Library libA) { +SplashFTFontEngine::SplashFTFontEngine(bool aaA, bool enableFreeTypeHintingA, + bool enableSlightHintingA, FT_Library libA) { FT_Int major, minor, patch; aa = aaA; @@ -61,8 +61,8 @@ SplashFTFontEngine::SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, (major == 2 && (minor > 1 || (minor == 1 && patch > 7))); } -SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA, GBool enableFreeTypeHintingA, - GBool enableSlightHintingA) { +SplashFTFontEngine *SplashFTFontEngine::init(bool aaA, bool enableFreeTypeHintingA, + bool enableSlightHintingA) { FT_Library libA; if (FT_Init_FreeType(&libA)) { diff --git a/splash/SplashFTFontEngine.h b/splash/SplashFTFontEngine.h index e53b7f3d..ec1ad4df 100644 --- a/splash/SplashFTFontEngine.h +++ b/splash/SplashFTFontEngine.h @@ -41,7 +41,7 @@ class SplashFontSrc; class SplashFTFontEngine { public: - static SplashFTFontEngine *init(GBool aaA, GBool enableFreeTypeHintingA, GBool enableSlightHinting); + static SplashFTFontEngine *init(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHinting); ~SplashFTFontEngine(); @@ -57,18 +57,18 @@ public: int *codeToGID, int codeToGIDLen); SplashFontFile *loadTrueTypeFont(SplashFontFileID *idA, SplashFontSrc *src, int *codeToGID, int codeToGIDLen, int faceIndex = 0); - GBool getAA() { return aa; } - void setAA(GBool aaA) { aa = aaA; } + bool getAA() { return aa; } + void setAA(bool aaA) { aa = aaA; } private: - SplashFTFontEngine(GBool aaA, GBool enableFreeTypeHintingA, GBool enableSlightHintingA, FT_Library libA); + SplashFTFontEngine(bool aaA, bool enableFreeTypeHintingA, bool enableSlightHintingA, FT_Library libA); - GBool aa; - GBool enableFreeTypeHinting; - GBool enableSlightHinting; + bool aa; + bool enableFreeTypeHinting; + bool enableSlightHinting; FT_Library lib; - GBool useCIDs; + bool useCIDs; friend class SplashFTFontFile; friend class SplashFTFont; diff --git a/splash/SplashFTFontFile.cc b/splash/SplashFTFontFile.cc index b2bf4a5c..b1f9ddb5 100644 --- a/splash/SplashFTFontFile.cc +++ b/splash/SplashFTFontFile.cc @@ -65,7 +65,7 @@ SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA, } return new SplashFTFontFile(engineA, idA, src, - faceA, codeToGIDA, 256, gFalse, gTrue); + faceA, codeToGIDA, 256, false, true); } SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, @@ -84,7 +84,7 @@ SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, } return new SplashFTFontFile(engineA, idA, src, - faceA, codeToGIDA, codeToGIDLenA, gFalse, gFalse); + faceA, codeToGIDA, codeToGIDLenA, false, false); } SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, @@ -104,7 +104,7 @@ SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, } return new SplashFTFontFile(engineA, idA, src, - faceA, codeToGIDA, codeToGIDLenA, gTrue, gFalse); + faceA, codeToGIDA, codeToGIDLenA, true, false); } SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, @@ -112,7 +112,7 @@ SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, SplashFontSrc *srcA, FT_Face faceA, int *codeToGIDA, int codeToGIDLenA, - GBool trueTypeA, GBool type1A): + bool trueTypeA, bool type1A): SplashFontFile(idA, srcA) { engine = engineA; diff --git a/splash/SplashFTFontFile.h b/splash/SplashFTFontFile.h index f312a662..a73c671a 100644 --- a/splash/SplashFTFontFile.h +++ b/splash/SplashFTFontFile.h @@ -68,14 +68,14 @@ private: SplashFontSrc *src, FT_Face faceA, int *codeToGIDA, int codeToGIDLenA, - GBool trueTypeA, GBool type1A); + bool trueTypeA, bool type1A); SplashFTFontEngine *engine; FT_Face face; int *codeToGID; int codeToGIDLen; - GBool trueType; - GBool type1; + bool trueType; + bool type1; friend class SplashFTFont; }; diff --git a/splash/SplashFont.cc b/splash/SplashFont.cc index ecedd621..567e38e0 100644 --- a/splash/SplashFont.cc +++ b/splash/SplashFont.cc @@ -43,7 +43,7 @@ struct SplashFontCacheTag { //------------------------------------------------------------------------ SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, - const SplashCoord *textMatA, GBool aaA) { + const SplashCoord *textMatA, bool aaA) { fontFile = fontFileA; fontFile->incRefCnt(); mat[0] = matA[0]; @@ -116,7 +116,7 @@ SplashFont::~SplashFont() { } } -GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, +bool SplashFont::getGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) { SplashGlyphBitmap bitmap2; int size; @@ -150,34 +150,34 @@ GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, cacheTags[i+j].mru = 0x80000000; bitmap->aa = aa; bitmap->data = cache + (i+j) * glyphSize; - bitmap->freeData = gFalse; + bitmap->freeData = false; *clipRes = clip->testRect(x0 - bitmap->x, y0 - bitmap->y, x0 - bitmap->x + bitmap->w - 1, y0 - bitmap->y + bitmap->h - 1); - return gTrue; + return true; } } // generate the glyph bitmap if (!makeGlyph(c, xFrac, yFrac, &bitmap2, x0, y0, clip, clipRes)) { - return gFalse; + return false; } if (*clipRes == splashClipAllOutside) { - bitmap->freeData = gFalse; + bitmap->freeData = false; if (bitmap2.freeData) gfree(bitmap2.data); - return gTrue; + return true; } // if the glyph doesn't fit in the bounding box, return a temporary // uncached bitmap if (bitmap2.w > glyphW || bitmap2.h > glyphH) { *bitmap = bitmap2; - return gTrue; + return true; } // insert glyph pixmap in cache @@ -212,10 +212,10 @@ GBool SplashFont::getGlyph(int c, int xFrac, int yFrac, } *bitmap = bitmap2; bitmap->data = p; - bitmap->freeData = gFalse; + bitmap->freeData = false; if (bitmap2.freeData) { gfree(bitmap2.data); } } - return gTrue; + return true; } diff --git a/splash/SplashFont.h b/splash/SplashFont.h index 4b7fe363..8a5109df 100644 --- a/splash/SplashFont.h +++ b/splash/SplashFont.h @@ -48,7 +48,7 @@ class SplashFont { public: SplashFont(SplashFontFile *fontFileA, SplashCoord *matA, - const SplashCoord *textMatA, GBool aaA); + const SplashCoord *textMatA, bool aaA); // This must be called after the constructor, so that the subclass // constructor has a chance to compute the bbox. @@ -62,7 +62,7 @@ public: SplashFontFile *getFontFile() { return fontFile; } // Return true if <this> matches the specified font file and matrix. - GBool matches(SplashFontFile *fontFileA, SplashCoord *matA, + bool matches(SplashFontFile *fontFileA, SplashCoord *matA, const SplashCoord *textMatA) const { return fontFileA == fontFile && matA[0] == mat[0] && matA[1] == mat[1] && @@ -78,12 +78,12 @@ public: // splashFontFraction = 1 << splashFontFractionBits. Subclasses // should override this to zero out xFrac and/or yFrac if they don't // support fractional coordinates. - virtual GBool getGlyph(int c, int xFrac, int yFrac, + virtual bool getGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes); // Rasterize a glyph. The <xFrac> and <yFrac> values are the same // as described for getGlyph. - virtual GBool makeGlyph(int c, int xFrac, int yFrac, + virtual bool makeGlyph(int c, int xFrac, int yFrac, SplashGlyphBitmap *bitmap, int x0, int y0, SplashClip *clip, SplashClipResult *clipRes) = 0; // Return the path for a glyph. @@ -107,7 +107,7 @@ protected: // (text space -> device space) SplashCoord textMat[4]; // text transform matrix // (text space -> user space) - GBool aa; // anti-aliasing + bool aa; // anti-aliasing int xMin, yMin, xMax, yMax; // glyph bounding box Guchar *cache; // glyph bitmap cache SplashFontCacheTag * // cache tags diff --git a/splash/SplashFontEngine.cc b/splash/SplashFontEngine.cc index 330ec642..627f3b0f 100644 --- a/splash/SplashFontEngine.cc +++ b/splash/SplashFontEngine.cc @@ -61,10 +61,10 @@ extern "C" int unlink(char *filename); //------------------------------------------------------------------------ SplashFontEngine::SplashFontEngine( - GBool enableFreeType, - GBool enableFreeTypeHinting, - GBool enableSlightHinting, - GBool aa) { + bool enableFreeType, + bool enableFreeTypeHinting, + bool enableSlightHinting, + bool aa) { std::fill(fontCache.begin(), fontCache.end(), nullptr); if (enableFreeType) { @@ -217,11 +217,11 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA, return fontFile; } -GBool SplashFontEngine::getAA() { - return (ftEngine == nullptr) ? gFalse : ftEngine->getAA(); +bool SplashFontEngine::getAA() { + return (ftEngine == nullptr) ? false : ftEngine->getAA(); } -void SplashFontEngine::setAA(GBool aa) { +void SplashFontEngine::setAA(bool aa) { if (ftEngine != nullptr) { ftEngine->setAA(aa); } diff --git a/splash/SplashFontEngine.h b/splash/SplashFontEngine.h index ea887f05..84334f55 100644 --- a/splash/SplashFontEngine.h +++ b/splash/SplashFontEngine.h @@ -50,10 +50,10 @@ public: // Create a font engine. SplashFontEngine( - GBool enableFreeType, - GBool enableFreeTypeHinting, - GBool enableSlightHinting, - GBool aa); + bool enableFreeType, + bool enableFreeTypeHinting, + bool enableSlightHinting, + bool aa); ~SplashFontEngine(); @@ -84,8 +84,8 @@ public: // Note that the Splash y axis points downward. SplashFont *getFont(SplashFontFile *fontFile, const SplashCoord *textMat, const SplashCoord *ctm); - GBool getAA(); - void setAA(GBool aa); + bool getAA(); + void setAA(bool aa); private: diff --git a/splash/SplashFontFile.cc b/splash/SplashFontFile.cc index 20209fb9..b5a1d25f 100644 --- a/splash/SplashFontFile.cc +++ b/splash/SplashFontFile.cc @@ -45,7 +45,7 @@ SplashFontFile::SplashFontFile(SplashFontFileID *idA, SplashFontSrc *srcA) { src = srcA; src->ref(); refCnt = 0; - doAdjustMatrix = gFalse; + doAdjustMatrix = false; } SplashFontFile::~SplashFontFile() { @@ -66,8 +66,8 @@ void SplashFontFile::decRefCnt() { // SplashFontSrc::SplashFontSrc() { - isFile = gFalse; - deleteSrc = gFalse; + isFile = false; + deleteSrc = false; fileName = nullptr; buf = nullptr; refcnt = 1; @@ -97,23 +97,23 @@ void SplashFontSrc::unref() { delete this; } -void SplashFontSrc::setFile(GooString *file, GBool del) +void SplashFontSrc::setFile(GooString *file, bool del) { - isFile = gTrue; + isFile = true; fileName = file->copy(); deleteSrc = del; } -void SplashFontSrc::setFile(const char *file, GBool del) +void SplashFontSrc::setFile(const char *file, bool del) { - isFile = gTrue; + isFile = true; fileName = new GooString(file); deleteSrc = del; } -void SplashFontSrc::setBuf(char *bufA, int bufLenA, GBool del) +void SplashFontSrc::setBuf(char *bufA, int bufLenA, bool del) { - isFile = gFalse; + isFile = false; buf = bufA; bufLen = bufLenA; deleteSrc = del; diff --git a/splash/SplashFontFile.h b/splash/SplashFontFile.h index 6969803a..aa1c2677 100644 --- a/splash/SplashFontFile.h +++ b/splash/SplashFontFile.h @@ -41,14 +41,14 @@ public: SplashFontSrc(const SplashFontSrc &) = delete; SplashFontSrc& operator=(const SplashFontSrc&) = delete; - void setFile(GooString *file, GBool del); - void setFile(const char *file, GBool del); - void setBuf(char *bufA, int buflenA, GBool del); + void setFile(GooString *file, bool del); + void setFile(const char *file, bool del); + void setBuf(char *bufA, int buflenA, bool del); void ref(); void unref(); - GBool isFile; + bool isFile; GooString *fileName; char *buf; int bufLen; @@ -56,7 +56,7 @@ public: private: ~SplashFontSrc(); int refcnt; - GBool deleteSrc; + bool deleteSrc; }; class SplashFontFile { @@ -81,7 +81,7 @@ public: // the SplashFontFile object. void decRefCnt(); - GBool doAdjustMatrix; + bool doAdjustMatrix; protected: diff --git a/splash/SplashFontFileID.h b/splash/SplashFontFileID.h index 1b0594dd..e3fc5992 100644 --- a/splash/SplashFontFileID.h +++ b/splash/SplashFontFileID.h @@ -34,7 +34,7 @@ public: virtual ~SplashFontFileID(); SplashFontFileID(const SplashFontFileID &) = delete; SplashFontFileID& operator=(const SplashFontFileID &) = delete; - virtual GBool matches(SplashFontFileID *id) = 0; + virtual bool matches(SplashFontFileID *id) = 0; }; #endif diff --git a/splash/SplashGlyphBitmap.h b/splash/SplashGlyphBitmap.h index c062c106..61332900 100644 --- a/splash/SplashGlyphBitmap.h +++ b/splash/SplashGlyphBitmap.h @@ -15,10 +15,10 @@ struct SplashGlyphBitmap { int x, y, w, h; // offset and size of glyph - GBool aa; // anti-aliased: true means 8-bit alpha + bool aa; // anti-aliased: true means 8-bit alpha // bitmap; false means 1-bit Guchar *data; // bitmap data - GBool freeData; // true if data memory should be freed + bool freeData; // true if data memory should be freed }; #endif diff --git a/splash/SplashMath.h b/splash/SplashMath.h index 36793ea3..7e7696a1 100644 --- a/splash/SplashMath.h +++ b/splash/SplashMath.h @@ -233,7 +233,7 @@ static inline SplashCoord splashDist(SplashCoord x0, SplashCoord y0, #endif } -static inline GBool splashCheckDet(SplashCoord m11, SplashCoord m12, +static inline bool splashCheckDet(SplashCoord m11, SplashCoord m12, SplashCoord m21, SplashCoord m22, SplashCoord epsilon) { #ifdef USE_FIXEDPOINT diff --git a/splash/SplashPath.cc b/splash/SplashPath.cc index b48decce..bf797ee3 100644 --- a/splash/SplashPath.cc +++ b/splash/SplashPath.cc @@ -182,7 +182,7 @@ SplashError SplashPath::curveTo(SplashCoord x1, SplashCoord y1, return splashOk; } -SplashError SplashPath::close(GBool force) { +SplashError SplashPath::close(bool force) { if (noCurrentPoint()) { return splashErrNoCurPt; } @@ -221,11 +221,11 @@ void SplashPath::offset(SplashCoord dx, SplashCoord dy) { } } -GBool SplashPath::getCurPt(SplashCoord *x, SplashCoord *y) { +bool SplashPath::getCurPt(SplashCoord *x, SplashCoord *y) { if (noCurrentPoint()) { - return gFalse; + return false; } *x = pts[length - 1].x; *y = pts[length - 1].y; - return gTrue; + return true; } diff --git a/splash/SplashPath.h b/splash/SplashPath.h index be3840ae..a44732d9 100644 --- a/splash/SplashPath.h +++ b/splash/SplashPath.h @@ -95,7 +95,7 @@ public: // Close the last subpath, adding a line segment if necessary. If // <force> is true, this adds a line segment even if the current // point is equal to the first point in the subpath. - SplashError close(GBool force = gFalse); + SplashError close(bool force = false); // Add a stroke adjustment hint. The controlling segments are // <ctrl0> and <ctrl1> (where segments are identified by their first @@ -111,7 +111,7 @@ public: { *x = pts[i].x; *y = pts[i].y; *f = flags[i]; } // Get the current point. - GBool getCurPt(SplashCoord *x, SplashCoord *y); + bool getCurPt(SplashCoord *x, SplashCoord *y); // Reserve space for at least n points void reserve(int n); @@ -120,9 +120,9 @@ protected: SplashPath(SplashPath *path); void grow(int nPts); - GBool noCurrentPoint() { return curSubpath == length; } - GBool onePointSubpath() { return curSubpath == length - 1; } - GBool openSubpath() { return curSubpath < length - 1; } + bool noCurrentPoint() { return curSubpath == length; } + bool onePointSubpath() { return curSubpath == length - 1; } + bool openSubpath() { return curSubpath < length - 1; } SplashPathPoint *pts; // array of points Guchar *flags; // array of flags diff --git a/splash/SplashPattern.cc b/splash/SplashPattern.cc index c090a06e..39db35e0 100644 --- a/splash/SplashPattern.cc +++ b/splash/SplashPattern.cc @@ -45,7 +45,7 @@ SplashSolidColor::SplashSolidColor(SplashColorPtr colorA) { SplashSolidColor::~SplashSolidColor() { } -GBool SplashSolidColor::getColor(int x, int y, SplashColorPtr c) { +bool SplashSolidColor::getColor(int x, int y, SplashColorPtr c) { splashColorCopy(c, color); - return gTrue; + return true; } diff --git a/splash/SplashPattern.h b/splash/SplashPattern.h index 36674ac7..3304ae70 100644 --- a/splash/SplashPattern.h +++ b/splash/SplashPattern.h @@ -43,17 +43,17 @@ public: SplashPattern& operator=(const SplashPattern &) = delete; // Return the color value for a specific pixel. - virtual GBool getColor(int x, int y, SplashColorPtr c) = 0; + virtual bool getColor(int x, int y, SplashColorPtr c) = 0; // Test if x,y-position is inside pattern. - virtual GBool testPosition(int x, int y) = 0; + virtual bool testPosition(int x, int y) = 0; // Returns true if this pattern object will return the same color // value for all pixels. - virtual GBool isStatic() = 0; + virtual bool isStatic() = 0; // Returns true if this pattern colorspace is CMYK. - virtual GBool isCMYK() = 0; + virtual bool isCMYK() = 0; private: }; @@ -70,13 +70,13 @@ public: ~SplashSolidColor(); - GBool getColor(int x, int y, SplashColorPtr c) override; + bool getColor(int x, int y, SplashColorPtr c) override; - GBool testPosition(int x, int y) override { return gFalse; } + bool testPosition(int x, int y) override { return false; } - GBool isStatic() override { return gTrue; } + bool isStatic() override { return true; } - GBool isCMYK() override { return gFalse; } + bool isCMYK() override { return false; } private: @@ -90,7 +90,7 @@ private: class SplashGouraudColor: public SplashPattern { public: - virtual GBool isParameterized() = 0; + virtual bool isParameterized() = 0; virtual int getNTriangles() = 0; diff --git a/splash/SplashScreen.h b/splash/SplashScreen.h index c3bfe2ef..9d4c880a 100644 --- a/splash/SplashScreen.h +++ b/splash/SplashScreen.h @@ -54,7 +54,7 @@ public: // Returns true if value is above the white threshold or below the // black threshold, i.e., if the corresponding halftone will be // solid white or black. - GBool isStatic(Guchar value) { if (mat == nullptr) createMatrix(); return value < minVal || value >= maxVal; } + bool isStatic(Guchar value) { if (mat == nullptr) createMatrix(); return value < minVal || value >= maxVal; } private: void createMatrix(); diff --git a/splash/SplashState.cc b/splash/SplashState.cc index 85b7a6f6..5ddd5740 100644 --- a/splash/SplashState.cc +++ b/splash/SplashState.cc @@ -41,7 +41,7 @@ int splashColorModeNComps[] = { #endif }; -SplashState::SplashState(int width, int height, GBool vectorAntialias, +SplashState::SplashState(int width, int height, bool vectorAntialias, SplashScreenParams *screenParams) { SplashColor color; int i; @@ -56,7 +56,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, blendFunc = nullptr; strokeAlpha = 1; fillAlpha = 1; - multiplyPatternAlpha = gFalse; + multiplyPatternAlpha = false; patternStrokeAlpha = 1; patternFillAlpha = 1; lineWidth = 0; @@ -67,13 +67,13 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, lineDash = nullptr; lineDashLength = 0; lineDashPhase = 0; - strokeAdjust = gFalse; + strokeAdjust = false; clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias); softMask = nullptr; - deleteSoftMask = gFalse; - inNonIsolatedGroup = gFalse; - fillOverprint = gFalse; - strokeOverprint = gFalse; + deleteSoftMask = false; + inNonIsolatedGroup = false; + fillOverprint = false; + strokeOverprint = false; overprintMode = 0; for (i = 0; i < 256; ++i) { rgbTransferR[i] = (Guchar)i; @@ -90,11 +90,11 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, #endif } overprintMask = 0xffffffff; - overprintAdditive = gFalse; + overprintAdditive = false; next = nullptr; } -SplashState::SplashState(int width, int height, GBool vectorAntialias, +SplashState::SplashState(int width, int height, bool vectorAntialias, SplashScreen *screenA) { SplashColor color; int i; @@ -109,7 +109,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, blendFunc = nullptr; strokeAlpha = 1; fillAlpha = 1; - multiplyPatternAlpha = gFalse; + multiplyPatternAlpha = false; patternStrokeAlpha = 1; patternFillAlpha = 1; lineWidth = 0; @@ -120,13 +120,13 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, lineDash = nullptr; lineDashLength = 0; lineDashPhase = 0; - strokeAdjust = gFalse; + strokeAdjust = false; clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias); softMask = nullptr; - deleteSoftMask = gFalse; - inNonIsolatedGroup = gFalse; - fillOverprint = gFalse; - strokeOverprint = gFalse; + deleteSoftMask = false; + inNonIsolatedGroup = false; + fillOverprint = false; + strokeOverprint = false; overprintMode = 0; for (i = 0; i < 256; ++i) { rgbTransferR[i] = (Guchar)i; @@ -143,7 +143,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, #endif } overprintMask = 0xffffffff; - overprintAdditive = gFalse; + overprintAdditive = false; next = nullptr; } @@ -175,7 +175,7 @@ SplashState::SplashState(SplashState *state) { strokeAdjust = state->strokeAdjust; clip = state->clip->copy(); softMask = state->softMask; - deleteSoftMask = gFalse; + deleteSoftMask = false; inNonIsolatedGroup = state->inNonIsolatedGroup; fillOverprint = state->fillOverprint; strokeOverprint = state->strokeOverprint; @@ -241,7 +241,7 @@ void SplashState::setSoftMask(SplashBitmap *softMaskA) { delete softMask; } softMask = softMaskA; - deleteSoftMask = gTrue; + deleteSoftMask = true; } void SplashState::setTransfer(Guchar *red, Guchar *green, Guchar *blue, diff --git a/splash/SplashState.h b/splash/SplashState.h index 408aea5b..ec0bc5de 100644 --- a/splash/SplashState.h +++ b/splash/SplashState.h @@ -54,9 +54,9 @@ class SplashState { public: // Create a new state object, initialized with default settings. - SplashState(int width, int height, GBool vectorAntialias, + SplashState(int width, int height, bool vectorAntialias, SplashScreenParams *screenParams); - SplashState(int width, int height, GBool vectorAntialias, + SplashState(int width, int height, bool vectorAntialias, SplashScreen *screenA); // Copy a state object. @@ -84,8 +84,8 @@ public: void setSoftMask(SplashBitmap *softMaskA); // Set the overprint parametes. - void setFillOverprint(GBool fillOverprintA) { fillOverprint = fillOverprintA; } - void setStrokeOverprint(GBool strokeOverprintA) { strokeOverprint = strokeOverprintA; } + void setFillOverprint(bool fillOverprintA) { fillOverprint = fillOverprintA; } + void setStrokeOverprint(bool strokeOverprintA) { strokeOverprint = strokeOverprintA; } void setOverprintMode(int overprintModeA) { overprintMode = overprintModeA; } // Set the transfer function. @@ -102,7 +102,7 @@ private: SplashBlendFunc blendFunc; SplashCoord strokeAlpha; SplashCoord fillAlpha; - GBool multiplyPatternAlpha; + bool multiplyPatternAlpha; SplashCoord patternStrokeAlpha; SplashCoord patternFillAlpha; SplashCoord lineWidth; @@ -113,13 +113,13 @@ private: SplashCoord *lineDash; int lineDashLength; SplashCoord lineDashPhase; - GBool strokeAdjust; + bool strokeAdjust; SplashClip *clip; SplashBitmap *softMask; - GBool deleteSoftMask; - GBool inNonIsolatedGroup; - GBool fillOverprint; - GBool strokeOverprint; + bool deleteSoftMask; + bool inNonIsolatedGroup; + bool fillOverprint; + bool strokeOverprint; int overprintMode; Guchar rgbTransferR[256], rgbTransferG[256], @@ -133,7 +133,7 @@ private: Guchar deviceNTransfer[SPOT_NCOMPS+4][256]; #endif Guint overprintMask; - GBool overprintAdditive; + bool overprintAdditive; SplashState *next; // used by Splash class diff --git a/splash/SplashXPath.cc b/splash/SplashXPath.cc index 44c09f51..3ec90d94 100644 --- a/splash/SplashXPath.cc +++ b/splash/SplashXPath.cc @@ -40,7 +40,7 @@ struct SplashXPathPoint { struct SplashXPathAdjust { int firstPt, lastPt; // range of points - GBool vert; // vertical or horizontal hint + bool vert; // vertical or horizontal hint SplashCoord x0a, x0b, // hint boundaries xma, xmb, x1a, x1b; @@ -65,8 +65,8 @@ inline void SplashXPath::transform(SplashCoord *matrix, //------------------------------------------------------------------------ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool closeSubpaths, - GBool adjustLines, int linePosI) { + SplashCoord flatness, bool closeSubpaths, + bool adjustLines, int linePosI) { SplashPathHint *hint; SplashXPathPoint *pts; SplashXPathAdjust *adjusts, *adjust; @@ -96,11 +96,11 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix, x2 = pts[hint->ctrl1 ].x; y2 = pts[hint->ctrl1 ].y; x3 = pts[hint->ctrl1 + 1].x; y3 = pts[hint->ctrl1 + 1].y; if (x0 == x1 && x2 == x3) { - adjusts[i].vert = gTrue; + adjusts[i].vert = true; adj0 = x0; adj1 = x2; } else if (y0 == y1 && y2 == y3) { - adjusts[i].vert = gFalse; + adjusts[i].vert = false; adj0 = y0; adj1 = y2; } else { @@ -282,7 +282,7 @@ void SplashXPath::addCurve(SplashCoord x0, SplashCoord y0, SplashCoord x2, SplashCoord y2, SplashCoord x3, SplashCoord y3, SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1) { + bool first, bool last, bool end0, bool end1) { SplashCoord *cx = new SplashCoord[(splashMaxCurveSplits + 1) * 3]; SplashCoord *cy = new SplashCoord[(splashMaxCurveSplits + 1) * 3]; int *cNext = new int[splashMaxCurveSplits + 1]; diff --git a/splash/SplashXPath.h b/splash/SplashXPath.h index 55423d4c..14d5f723 100644 --- a/splash/SplashXPath.h +++ b/splash/SplashXPath.h @@ -61,8 +61,8 @@ public: // space, via <matrix>. If <closeSubpaths> is true, closes all open // subpaths. SplashXPath(SplashPath *path, SplashCoord *matrix, - SplashCoord flatness, GBool closeSubpaths, - GBool adjustLines = gFalse, int linePosI = 0); + SplashCoord flatness, bool closeSubpaths, + bool adjustLines = false, int linePosI = 0); // Copy an expanded path. SplashXPath *copy() { return new SplashXPath(this); } @@ -92,7 +92,7 @@ protected: SplashCoord x2, SplashCoord y2, SplashCoord x3, SplashCoord y3, SplashCoord flatness, - GBool first, GBool last, GBool end0, GBool end1); + bool first, bool last, bool end0, bool end1); void addSegment(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1); diff --git a/splash/SplashXPathScanner.cc b/splash/SplashXPathScanner.cc index 036370ae..c0905afa 100644 --- a/splash/SplashXPathScanner.cc +++ b/splash/SplashXPathScanner.cc @@ -39,7 +39,7 @@ // SplashXPathScanner //------------------------------------------------------------------------ -SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA, +SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, bool eoA, int clipYMin, int clipYMax) { SplashXPathSeg *seg; SplashCoord xMinFP, yMinFP, xMaxFP, yMaxFP; @@ -47,7 +47,7 @@ SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA, xPath = xPathA; eo = eoA; - partialClip = gFalse; + partialClip = false; // compute the bbox if (xPath->length == 0) { @@ -97,11 +97,11 @@ SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA, yMax = splashFloor(yMaxFP); if (clipYMin > yMin) { yMin = clipYMin; - partialClip = gTrue; + partialClip = true; } if (clipYMax < yMax) { yMax = clipYMax; - partialClip = gTrue; + partialClip = true; } } @@ -141,26 +141,26 @@ void SplashXPathScanner::getSpanBounds(int y, int *spanXMin, int *spanXMax) { } } -GBool SplashXPathScanner::test(int x, int y) { +bool SplashXPathScanner::test(int x, int y) { if (y < yMin || y > yMax) { - return gFalse; + return false; } const auto& line = allIntersections[y - yMin]; int count = 0; for (unsigned int i = 0; i < line.size() && line[i].x0 <= x; ++i) { if (x <= line[i].x1) { - return gTrue; + return true; } count += line[i].count; } return eo ? (count & 1) : (count != 0); } -GBool SplashXPathScanner::testSpan(int x0, int x1, int y) { +bool SplashXPathScanner::testSpan(int x0, int x1, int y) { unsigned int i; if (y < yMin || y > yMax) { - return gFalse; + return false; } const auto& line = allIntersections[y - yMin]; int count = 0; @@ -172,11 +172,11 @@ GBool SplashXPathScanner::testSpan(int x0, int x1, int y) { int xx1 = x0 - 1; while (xx1 < x1) { if (i >= line.size()) { - return gFalse; + return false; } if (line[i].x0 > xx1 + 1 && !(eo ? (count & 1) : (count != 0))) { - return gFalse; + return false; } if (line[i].x1 > xx1) { xx1 = line[i].x1; @@ -185,14 +185,14 @@ GBool SplashXPathScanner::testSpan(int x0, int x1, int y) { ++i; } - return gTrue; + return true; } -GBool SplashXPathScanIterator::getNextSpan(int *x0, int *x1) { +bool SplashXPathScanIterator::getNextSpan(int *x0, int *x1) { int xx0, xx1; if (interIdx >= line.size()) { - return gFalse; + return false; } xx0 = line[interIdx].x0; xx1 = line[interIdx].x1; @@ -209,7 +209,7 @@ GBool SplashXPathScanIterator::getNextSpan(int *x0, int *x1) { } *x0 = xx0; *x1 = xx1; - return gTrue; + return true; } SplashXPathScanIterator::SplashXPathScanIterator(const SplashXPathScanner &scanner, int y) : @@ -326,7 +326,7 @@ void SplashXPathScanner::computeIntersections() { } inline -GBool SplashXPathScanner::addIntersection(double segYMin, double segYMax, +bool SplashXPathScanner::addIntersection(double segYMin, double segYMax, int y, int x0, int x1, int count) { SplashIntersect intersect; intersect.y = y; @@ -349,11 +349,11 @@ GBool SplashXPathScanner::addIntersection(double segYMin, double segYMax, } line.push_back(intersect); - return gTrue; + return true; } void SplashXPathScanner::renderAALine(SplashBitmap *aaBuf, - int *x0, int *x1, int y, GBool adjustVertLine) { + int *x0, int *x1, int y, bool adjustVertLine) { int xx0, xx1, xx, xxMin, xxMax, yy, yyMax, interCount; size_t interIdx; Guchar mask; diff --git a/splash/SplashXPathScanner.h b/splash/SplashXPathScanner.h index 5e4bd727..1ac8ce84 100644 --- a/splash/SplashXPathScanner.h +++ b/splash/SplashXPathScanner.h @@ -44,7 +44,7 @@ class SplashXPathScanner { public: // Create a new SplashXPathScanner object. <xPathA> must be sorted. - SplashXPathScanner(SplashXPath *xPathA, GBool eoA, + SplashXPathScanner(SplashXPath *xPathA, bool eoA, int clipYMin, int clipYMax); ~SplashXPathScanner(); @@ -61,22 +61,22 @@ public: // Returns true if at least part of the path was outside the // clipYMin/clipYMax bounds passed to the constructor. - GBool hasPartialClip() { return partialClip; } + bool hasPartialClip() { return partialClip; } // Return the min/max x values for the span at <y>. void getSpanBounds(int y, int *spanXMin, int *spanXMax); // Returns true if (<x>,<y>) is inside the path. - GBool test(int x, int y); + bool test(int x, int y); // Returns true if the entire span ([<x0>,<x1>], <y>) is inside the // path. - GBool testSpan(int x0, int x1, int y); + bool testSpan(int x0, int x1, int y); // Renders one anti-aliased line into <aaBuf>. Returns the min and // max x coordinates with non-zero pixels in <x0> and <x1>. void renderAALine(SplashBitmap *aaBuf, int *x0, int *x1, int y, - GBool adjustVertLine = gFalse); + bool adjustVertLine = false); // Clips an anti-aliased line by setting pixels to zero. On entry, // all non-zero pixels are between <x0> and <x1>. This function @@ -86,13 +86,13 @@ public: private: void computeIntersections(); - GBool addIntersection(double segYMin, double segYMax, + bool addIntersection(double segYMin, double segYMax, int y, int x0, int x1, int count); SplashXPath *xPath; - GBool eo; + bool eo; int xMin, yMin, xMax, yMax; - GBool partialClip; + bool partialClip; typedef std::vector<SplashIntersect> IntersectionLine; std::vector<IntersectionLine> allIntersections; @@ -106,7 +106,7 @@ public: // Returns the next span inside the path at the current y position // Returns false if there are no more spans. - GBool getNextSpan(int *x0, int *x1); + bool getNextSpan(int *x0, int *x1); private: typedef std::vector<SplashIntersect> IntersectionLine; @@ -114,7 +114,7 @@ private: size_t interIdx; // current index into <line> int interCount; // current EO/NZWN counter - const GBool eo; + const bool eo; }; #endif diff --git a/test/gtk-test.cc b/test/gtk-test.cc index 44136456..5d2e285f 100644 --- a/test/gtk-test.cc +++ b/test/gtk-test.cc @@ -100,7 +100,7 @@ typedef struct GDKSplashOutputDev::GDKSplashOutputDev(GdkScreen *screen, void (*redrawCbkA)(void *data), void *redrawCbkDataA, SplashColor sc): - SplashOutputDev(splashModeRGB8, 4, gFalse, sc), + SplashOutputDev(splashModeRGB8, 4, false, sc), incrementalUpdate (1) { redrawCbk = redrawCbkA; @@ -218,7 +218,7 @@ view_set_page (View *view, int page) cairo_destroy (cr); g_object_unref (poppler_page); } else { - view->doc->doc->displayPage (view->out, page + 1, 72, 72, 0, gFalse, gTrue, gTrue); + view->doc->doc->displayPage (view->out, page + 1, 72, 72, 0, false, true, true); w = view->out->getBitmapWidth(); h = view->out->getBitmapHeight(); } diff --git a/test/pdf-fullrewrite.cc b/test/pdf-fullrewrite.cc index 420a690d..94f39b3c 100644 --- a/test/pdf-fullrewrite.cc +++ b/test/pdf-fullrewrite.cc @@ -15,14 +15,14 @@ #include "goo/GooString.h" #include "utils/parseargs.h" -static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc); -static GBool compareObjects(Object *objA, Object *objB); +static bool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc); +static bool compareObjects(Object *objA, Object *objB); static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool forceIncremental = gFalse; -static GBool checkOutput = gFalse; -static GBool printHelp = gFalse; +static bool forceIncremental = false; +static bool checkOutput = false; +static bool printHelp = false; static const ArgDesc argDesc[] = { {"-opw", argString, ownerPassword, sizeof(ownerPassword), @@ -55,7 +55,7 @@ int main (int argc, char *argv[]) int res = 0; // parse args - GBool ok = parseArgs(argDesc, &argc, argv); + bool ok = parseArgs(argDesc, &argc, argv); if (!ok || (argc < 3) || printHelp) { printUsage(argv[0], "INPUT-FILE OUTPUT-FILE", argDesc); if (!printHelp) { @@ -113,11 +113,11 @@ done: return res; } -static GBool compareDictionaries(Dict *dictA, Dict *dictB) +static bool compareDictionaries(Dict *dictA, Dict *dictB) { const int length = dictA->getLength(); if (dictB->getLength() != length) - return gFalse; + return false; /* Check that every key in dictA is contained in dictB. * Since keys are unique and we've already checked that dictA and dictB @@ -128,19 +128,19 @@ static GBool compareDictionaries(Dict *dictA, Dict *dictB) Object valA = dictA->getValNF(i); Object valB = dictB->lookupNF(key); if (!compareObjects(&valA, &valB)) - return gFalse; + return false; } - return gTrue; + return true; } -static GBool compareObjects(Object *objA, Object *objB) +static bool compareObjects(Object *objA, Object *objB) { switch (objA->getType()) { case objBool: { if (objB->getType() != objBool) { - return gFalse; + return false; } else { return (objA->getBool() == objB->getBool()); } @@ -150,7 +150,7 @@ static GBool compareObjects(Object *objA, Object *objB) case objReal: { if (!objB->isNum()) { - return gFalse; + return false; } else { // Fuzzy comparison const double diff = objA->getNum() - objB->getNum(); @@ -160,7 +160,7 @@ static GBool compareObjects(Object *objA, Object *objB) case objString: { if (objB->getType() != objString) { - return gFalse; + return false; } else { const GooString *strA = objA->getString(); const GooString *strB = objB->getString(); @@ -170,7 +170,7 @@ static GBool compareObjects(Object *objA, Object *objB) case objName: { if (objB->getType() != objName) { - return gFalse; + return false; } else { GooString nameA(objA->getName()); GooString nameB(objB->getName()); @@ -180,37 +180,37 @@ static GBool compareObjects(Object *objA, Object *objB) case objNull: { if (objB->getType() != objNull) { - return gFalse; + return false; } else { - return gTrue; + return true; } } case objArray: { if (objB->getType() != objArray) { - return gFalse; + return false; } else { Array *arrayA = objA->getArray(); Array *arrayB = objB->getArray(); const int length = arrayA->getLength(); if (arrayB->getLength() != length) { - return gFalse; + return false; } else { for (int i = 0; i < length; ++i) { Object elemA = arrayA->getNF(i); Object elemB = arrayB->getNF(i); if (!compareObjects(&elemA, &elemB)) { - return gFalse; + return false; } } - return gTrue; + return true; } } } case objDict: { if (objB->getType() != objDict) { - return gFalse; + return false; } else { Dict *dictA = objA->getDict(); Dict *dictB = objB->getDict(); @@ -220,12 +220,12 @@ static GBool compareObjects(Object *objA, Object *objB) case objStream: { if (objB->getType() != objStream) { - return gFalse; + return false; } else { Stream *streamA = objA->getStream(); Stream *streamB = objB->getStream(); if (!compareDictionaries(streamA->getDict(), streamB->getDict())) { - return gFalse; + return false; } else { int c; streamA->reset(); @@ -234,18 +234,18 @@ static GBool compareObjects(Object *objA, Object *objB) { c = streamA->getChar(); if (c != streamB->getChar()) { - return gFalse; + return false; } } while (c != EOF); - return gTrue; + return true; } } - return gTrue; + return true; } case objRef: { if (objB->getType() != objRef) { - return gFalse; + return false; } else { Ref refA = objA->getRef(); Ref refB = objB->getRef(); @@ -255,14 +255,14 @@ static GBool compareObjects(Object *objA, Object *objB) default: { fprintf(stderr, "compareObjects failed: unexpected object type %u\n", objA->getType()); - return gFalse; + return false; } } } -static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) +static bool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) { - GBool result = gTrue; + bool result = true; XRef *origXRef = origDoc->getXRef(); XRef *newXRef = newDoc->getXRef(); @@ -277,13 +277,13 @@ static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) // In case of incremental update, expect a new entry to be appended to store the new XRef stream if (origNumObjects+1 != newNumObjects) { fprintf(stderr, "XRef table: Unexpected number of entries (%d+1 != %d)\n", origNumObjects, newNumObjects); - result = gFalse; + result = false; } } else { // In all other cases the number of entries must be the same if (origNumObjects != newNumObjects) { fprintf(stderr, "XRef table: Different number of entries (%d != %d)\n", origNumObjects, newNumObjects); - result = gFalse; + result = false; } } @@ -299,7 +299,7 @@ static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) if (!forceIncremental && origXRef->getEntry(i)->getFlag(XRefEntry::DontRewrite)) { if (newType != xrefEntryFree || origGenNum+1 != newGenNum) { fprintf(stderr, "XRef entry %u: DontRewrite entry was not freed correctly\n", i); - result = gFalse; + result = false; } continue; // There's nothing left to check for this entry } @@ -310,13 +310,13 @@ static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) if (i != 0) { if (origGenNum != newGenNum) { fprintf(stderr, "XRef entry %u: generation numbers differ (%d != %d)\n", i, origGenNum, newGenNum); - result = gFalse; + result = false; continue; } } else { if (newGenNum != 65535) { fprintf(stderr, "XRef entry %u: generation number was expected to be 65535 (%d != 65535)\n", i, newGenNum); - result = gFalse; + result = false; continue; } } @@ -324,7 +324,7 @@ static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) // Compare object flags. A failure shows that there's some error in XRef::scanSpecialFlags() if (origXRef->getEntry(i)->flags != newXRef->getEntry(i)->flags) { fprintf(stderr, "XRef entry %u: flags detected by scanSpecialFlags differ (%d != %d)\n", i, origXRef->getEntry(i)->flags, newXRef->getEntry(i)->flags); - result = gFalse; + result = false; } // Check that either both are free or both are in use @@ -332,7 +332,7 @@ static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) const char *origStatus = (origType == xrefEntryFree) ? "free" : "in use"; const char *newStatus = (newType == xrefEntryFree) ? "free" : "in use"; fprintf(stderr, "XRef entry %u: usage status differs (%s != %s)\n", i, origStatus, newStatus); - result = gFalse; + result = false; continue; } @@ -346,7 +346,7 @@ static GBool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc) Object newObj = newXRef->fetch(i, newGenNum); if (!compareObjects(&origObj, &newObj)) { fprintf(stderr, "XRef entry %u: contents differ\n", i); - result = gFalse; + result = false; } } diff --git a/test/pdf-inspector.cc b/test/pdf-inspector.cc index 1314858e..1af646ec 100644 --- a/test/pdf-inspector.cc +++ b/test/pdf-inspector.cc @@ -127,7 +127,7 @@ PdfInspector::PdfInspector(void) } doc = nullptr; output = new CairoOutputDev(); - output->setPrinting (gFalse); + output->setPrinting (false); // set up initial widgets load (nullptr); @@ -228,7 +228,7 @@ PdfInspector::analyze_page (int page) cairo_surface_destroy (surface); output->setCairo (cr); cairo_destroy (cr); - doc->displayPage (output, page + 1, 72, 72, 0, gFalse, gTrue, gFalse); + doc->displayPage (output, page + 1, 72, 72, 0, false, true, false); output->setCairo (nullptr); // Total time; diff --git a/test/perf-test.cc b/test/perf-test.cc index 2db7ceeb..7372a79b 100644 --- a/test/perf-test.cc +++ b/test/perf-test.cc @@ -435,8 +435,8 @@ bool PdfEnginePoppler::load(const char *fileName) SplashOutputDev * PdfEnginePoppler::outputDevice() { if (!_outputDev) { - GBool bitmapTopDown = gTrue; - _outputDev = new SplashOutputDev(gSplashColorMode, 4, gFalse, gBgColor, bitmapTopDown); + bool bitmapTopDown = true; + _outputDev = new SplashOutputDev(gSplashColorMode, 4, false, gBgColor, bitmapTopDown); if (_outputDev) _outputDev->startDoc(_pdfDoc); } @@ -450,9 +450,9 @@ SplashBitmap *PdfEnginePoppler::renderBitmap(int pageNo, double zoomReal, int ro double hDPI = (double)PDF_FILE_DPI * zoomReal * 0.01; double vDPI = (double)PDF_FILE_DPI * zoomReal * 0.01; - GBool useMediaBox = gFalse; - GBool crop = gTrue; - GBool doLinks = gTrue; + bool useMediaBox = false; + bool crop = true; + bool doLinks = true; _pdfDoc->displayPage(_outputDev, pageNo, hDPI, vDPI, rotation, useMediaBox, crop, doLinks, nullptr, nullptr); @@ -839,7 +839,7 @@ static void RenderPdfAsText(const char *fileName) LogInfo("started: %s\n", fileName); - TextOutputDev * textOut = new TextOutputDev(nullptr, gTrue, 0, gFalse, gFalse); + TextOutputDev * textOut = new TextOutputDev(nullptr, true, 0, false, false); if (!textOut->isOk()) { delete textOut; return; @@ -870,9 +870,9 @@ static void RenderPdfAsText(const char *fileName) msTimer.start(); int rotate = 0; - GBool useMediaBox = gFalse; - GBool crop = gTrue; - GBool doLinks = gFalse; + bool useMediaBox = false; + bool crop = true; + bool doLinks = false; pdfDoc->displayPage(textOut, curPage, 72, 72, rotate, useMediaBox, crop, doLinks); txt = textOut->getText(0.0, 0.0, 10000.0, 10000.0); msTimer.stop(); @@ -1240,7 +1240,7 @@ int main(int argc, char **argv) globalParams = new GlobalParams(); if (!globalParams) return 1; - globalParams->setErrQuiet(gFalse); + globalParams->setErrQuiet(false); FILE * outFile = nullptr; if (gOutFileName) { diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc index 9ba91e9c..a294be19 100644 --- a/utils/HtmlFonts.cc +++ b/utils/HtmlFonts.cc @@ -71,8 +71,8 @@ void removeStyleSuffix(std::string& familyName) { } #define xoutRound(x) ((int)(x + 0.5)) -extern GBool xml; -extern GBool fontFullName; +extern bool xml; +extern bool fontFullName; HtmlFontColor::HtmlFontColor(GfxRGB rgb){ r=static_cast<int>(rgb.r/65535.0*255.0); @@ -117,12 +117,12 @@ HtmlFont::HtmlFont(GfxFont *font, int _size, GfxRGB rgb){ lineSize = -1; size=(_size-1); - italic = gFalse; - bold = gFalse; - rotOrSkewed = gFalse; + italic = false; + bold = false; + rotOrSkewed = false; - if (font->isBold() || font->getWeight() >= GfxFont::W700) bold=gTrue; - if (font->isItalic()) italic=gTrue; + if (font->isBold() || font->getWeight() >= GfxFont::W700) bold=true; + if (font->isItalic()) italic=true; if (const GooString *fontname = font->getName()){ FontName = new GooString(fontname); @@ -131,13 +131,13 @@ HtmlFont::HtmlFont(GfxFont *font, int _size, GfxRGB rgb){ fontnameLower.lowerCase(); if (!bold && strstr(fontnameLower.getCString(),"bold")) { - bold=gTrue; + bold=true; } if (!italic && (strstr(fontnameLower.getCString(),"italic")|| strstr(fontnameLower.getCString(),"oblique"))) { - italic=gTrue; + italic=true; } familyName = fontname->getCString(); @@ -184,7 +184,7 @@ HtmlFont& HtmlFont::operator=(const HtmlFont& x){ This function is used to compare font uniquely for insertion into the list of all encountered fonts */ -GBool HtmlFont::isEqual(const HtmlFont& x) const{ +bool HtmlFont::isEqual(const HtmlFont& x) const{ return (size==x.size) && (lineSize==x.lineSize) && (FontName->cmp(x.FontName) == 0) && (bold==x.bold) && (italic==x.italic) && @@ -196,7 +196,7 @@ GBool HtmlFont::isEqual(const HtmlFont& x) const{ This one is used to decide whether two pieces of text can be joined together and therefore we don't care about bold/italics properties */ -GBool HtmlFont::isEqualIgnoreBold(const HtmlFont& x) const{ +bool HtmlFont::isEqualIgnoreBold(const HtmlFont& x) const{ return ((size==x.size) && (familyName == x.familyName) && (color.isEqual(x.getColor()))); diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h index 7d0a7fb3..7f7e15d2 100644 --- a/utils/HtmlFonts.h +++ b/utils/HtmlFonts.h @@ -41,7 +41,7 @@ class HtmlFontColor{ unsigned int r; unsigned int g; unsigned int b; - GBool Ok(unsigned int xcol){ return xcol<=255;} + bool Ok(unsigned int xcol){ return xcol<=255;} GooString *convtoX(unsigned int xcol) const; public: HtmlFontColor():r(0),g(0),b(0){} @@ -53,7 +53,7 @@ class HtmlFontColor{ } ~HtmlFontColor(){}; GooString* toString() const; - GBool isEqual(const HtmlFontColor& col) const{ + bool isEqual(const HtmlFontColor& col) const{ return ((r==col.r)&&(g==col.g)&&(b==col.b)); } } ; @@ -63,9 +63,9 @@ class HtmlFont{ private: unsigned int size; int lineSize; - GBool italic; - GBool bold; - GBool rotOrSkewed; + bool italic; + bool bold; + bool rotOrSkewed; std::string familyName; GooString *FontName; HtmlFontColor color; @@ -78,19 +78,19 @@ public: HtmlFontColor getColor() const {return color;} ~HtmlFont(); GooString* getFullName(); - GBool isItalic() const {return italic;} - GBool isBold() const {return bold;} - GBool isRotOrSkewed() const { return rotOrSkewed; } + bool isItalic() const {return italic;} + bool isBold() const {return bold;} + bool isRotOrSkewed() const { return rotOrSkewed; } unsigned int getSize() const {return size;} int getLineSize() const {return lineSize;} void setLineSize(int _lineSize) { lineSize = _lineSize; } void setRotMat(const double * const mat) - { rotOrSkewed = gTrue; memcpy(rotSkewMat, mat, sizeof(rotSkewMat)); } + { rotOrSkewed = true; memcpy(rotSkewMat, mat, sizeof(rotSkewMat)); } const double *getRotMat() const { return rotSkewMat; } GooString* getFontName(); static GooString* HtmlFilter(const Unicode* u, int uLen); //char* s); - GBool isEqual(const HtmlFont& x) const; - GBool isEqualIgnoreBold(const HtmlFont& x) const; + bool isEqual(const HtmlFont& x) const; + bool isEqualIgnoreBold(const HtmlFont& x) const; void print() const {printf("font: %s (%s) %d %s%s\n", FontName->getCString(), familyName.c_str(), size, bold ? "bold " : "", italic ? "italic " : "");}; }; diff --git a/utils/HtmlLinks.cc b/utils/HtmlLinks.cc index 01ea234a..49533628 100644 --- a/utils/HtmlLinks.cc +++ b/utils/HtmlLinks.cc @@ -28,7 +28,7 @@ #include "HtmlLinks.h" -extern GBool xml; +extern bool xml; HtmlLink::HtmlLink(const HtmlLink& x){ Xmin=x.Xmin; @@ -61,13 +61,13 @@ HtmlLink::~HtmlLink(){ delete dest; } -GBool HtmlLink::isEqualDest(const HtmlLink& x) const{ +bool HtmlLink::isEqualDest(const HtmlLink& x) const{ return (!strcmp(dest->getCString(), x.dest->getCString())); } -GBool HtmlLink::inLink(double xmin,double ymin,double xmax,double ymax) const { +bool HtmlLink::inLink(double xmin,double ymin,double xmax,double ymax) const { double y=(ymin+ymax)/2; - if (y>Ymax) return gFalse; + if (y>Ymax) return false; return (y>Ymin)&&(xmin<Xmax)&&(xmax>Xmin); } @@ -127,7 +127,7 @@ HtmlLinks::~HtmlLinks(){ accu=nullptr; } -GBool HtmlLinks::inLink(double xmin,double ymin,double xmax,double ymax,int& p)const { +bool HtmlLinks::inLink(double xmin,double ymin,double xmax,double ymax,int& p)const { for(std::vector<HtmlLink>::iterator i=accu->begin();i!=accu->end();++i){ if (i->inLink(xmin,ymin,xmax,ymax)) { diff --git a/utils/HtmlLinks.h b/utils/HtmlLinks.h index 1eaa4990..e1358d4c 100644 --- a/utils/HtmlLinks.h +++ b/utils/HtmlLinks.h @@ -46,13 +46,13 @@ public: HtmlLink(double xmin,double ymin,double xmax,double ymax,GooString *_dest); ~HtmlLink(); HtmlLink& operator=(const HtmlLink &) = delete; - GBool isEqualDest(const HtmlLink& x) const; + bool isEqualDest(const HtmlLink& x) const; GooString *getDest(){return new GooString(dest);} double getX1() const {return Xmin;} double getX2() const {return Xmax;} double getY1() const {return Ymin;} double getY2() const {return Ymax;} - GBool inLink(double xmin,double ymin,double xmax,double ymax) const ; + bool inLink(double xmin,double ymin,double xmax,double ymax) const ; //GooString *Link(GooString *content); GooString* getLinkStart(); @@ -67,7 +67,7 @@ public: HtmlLinks(const HtmlLinks &) = delete; HtmlLinks& operator=(const HtmlLinks &) = delete; void AddLink(const HtmlLink& x) {accu->push_back(x);} - GBool inLink(double xmin,double ymin,double xmax,double ymax,int& p) const; + bool inLink(double xmin,double ymin,double xmax,double ymax,int& p) const; HtmlLink* getLink(int i) const; }; diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index 8980f63c..ce5e7735 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -99,21 +99,21 @@ public: // returns true if x is closer to y than x is to z static inline bool IS_CLOSER(float x, float y, float z) { return fabs((x)-(y)) < fabs((x)-(z)); } -extern GBool complexMode; -extern GBool singleHtml; -extern GBool ignore; -extern GBool printCommands; -extern GBool printHtml; -extern GBool noframes; -extern GBool stout; -extern GBool xml; -extern GBool noRoundedCoordinates; -extern GBool showHidden; -extern GBool noMerge; +extern bool complexMode; +extern bool singleHtml; +extern bool ignore; +extern bool printCommands; +extern bool printHtml; +extern bool noframes; +extern bool stout; +extern bool xml; +extern bool noRoundedCoordinates; +extern bool showHidden; +extern bool noMerge; extern double wordBreakThreshold; -static GBool debug = gFalse; +static bool debug = false; static GooString *gstr_buff0 = nullptr; // a workspace in which I format strings static GooString* basename(GooString* str){ @@ -276,7 +276,7 @@ void HtmlString::endString() // HtmlPage //------------------------------------------------------------------------ -HtmlPage::HtmlPage(GBool rawOrder, const char *imgExtVal) { +HtmlPage::HtmlPage(bool rawOrder, const char *imgExtVal) { this->rawOrder = rawOrder; curStr = nullptr; yxStrings = nullptr; @@ -467,7 +467,7 @@ static const char *strrstr( const char *s, const char *ss ) return p; } -static void CloseTags( GooString *htext, GBool &finish_a, GBool &finish_italic, GBool &finish_bold ) +static void CloseTags( GooString *htext, bool &finish_a, bool &finish_italic, bool &finish_bold ) { const char *last_italic = finish_italic && ( finish_bold || finish_a ) ? strrstr( htext->getCString(), "<i>" ) : nullptr; const char *last_bold = finish_bold && ( finish_italic || finish_a ) ? strrstr( htext->getCString(), "<b>" ) : nullptr; @@ -495,7 +495,7 @@ void HtmlPage::coalesce() { HtmlString *str1, *str2; HtmlFont *hfont1, *hfont2; double space, horSpace, vertSpace, vertOverlap; - GBool addSpace, addLineBreak; + bool addSpace, addLineBreak; int n, i; double curX, curY; @@ -519,12 +519,12 @@ void HtmlPage::coalesce() { if( !complexMode ) { /* if not in complex mode get rid of duplicate strings */ HtmlString *str3; - GBool found; + bool found; while (str1) { double size = str1->yMax - str1->yMin; double xLimit = str1->xMin + size * 0.2; - found = gFalse; + found = false; for (str2 = str1, str3 = str1->yxNext; str3 && str3->xMin < xLimit; str2 = str3, str3 = str2->yxNext) @@ -535,7 +535,7 @@ void HtmlPage::coalesce() { fabs(str3->yMax - str1->yMax) < size * 0.2 && fabs(str3->xMax - str1->xMax) < size * 0.2) { - found = gTrue; + found = true; //printf("found duplicate!\n"); break; } @@ -666,9 +666,9 @@ void HtmlPage::coalesce() { HtmlLink *hlink1 = str1->getLink(); HtmlLink *hlink2 = str2->getLink(); bool switch_links = !hlink1 || !hlink2 || !hlink1->isEqualDest(*hlink2); - GBool finish_a = switch_links && hlink1 != nullptr; - GBool finish_italic = hfont1->isItalic() && ( !hfont2->isItalic() || finish_a ); - GBool finish_bold = hfont1->isBold() && ( !hfont2->isBold() || finish_a || finish_italic ); + bool finish_a = switch_links && hlink1 != nullptr; + bool finish_italic = hfont1->isItalic() && ( !hfont2->isItalic() || finish_a ); + bool finish_bold = hfont1->isBold() && ( !hfont2->isBold() || finish_a || finish_italic ); CloseTags( str1->htext, finish_a, finish_italic, finish_bold ); if( switch_links && hlink2 != nullptr ) { GooString *ls = hlink2->getLinkStart(); @@ -695,9 +695,9 @@ void HtmlPage::coalesce() { delete str2; } else { // keep strings separate // printf("no\n"); - GBool finish_a = str1->getLink() != nullptr; - GBool finish_bold = hfont1->isBold(); - GBool finish_italic = hfont1->isItalic(); + bool finish_a = str1->getLink() != nullptr; + bool finish_bold = hfont1->isBold(); + bool finish_italic = hfont1->isItalic(); CloseTags( str1->htext, finish_a, finish_italic, finish_bold ); str1->xMin = curX; str1->yMin = curY; @@ -717,9 +717,9 @@ void HtmlPage::coalesce() { } str1->xMin = curX; str1->yMin = curY; - GBool finish_bold = hfont1->isBold(); - GBool finish_italic = hfont1->isItalic(); - GBool finish_a = str1->getLink() != nullptr; + bool finish_bold = hfont1->isBold(); + bool finish_italic = hfont1->isItalic(); + bool finish_a = str1->getLink() != nullptr; CloseTags( str1->htext, finish_a, finish_italic, finish_bold ); #if 0 //~ for debugging @@ -1097,21 +1097,21 @@ void HtmlOutputDev::doFrame(int firstPage){ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char *title, const char *author, const char *keywords, const char *subject, const char *date, const char *extension, - GBool rawOrder, int firstPage, GBool outline) + bool rawOrder, int firstPage, bool outline) { catalog = catalogA; fContentsFrame = nullptr; docTitle = new GooString(title); pages = nullptr; - dumpJPEG=gTrue; - //write = gTrue; + dumpJPEG=true; + //write = true; this->rawOrder = rawOrder; this->doOutline = outline; - ok = gFalse; + ok = false; //this->firstPage = firstPage; //pageNum=firstPage; // open file - needClose = gFalse; + needClose = false; pages = new HtmlPage(rawOrder, extension); glMetaVars = new GooList(); @@ -1207,7 +1207,7 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char } delete htmlEncoding; } - ok = gTrue; + ok = true; } HtmlOutputDev::~HtmlOutputDev() { @@ -1239,7 +1239,7 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) { #if 0 if (mode&&!xml){ if (write){ - write=gFalse; + write=false; GooString* fname=Dirname(Docname); fname->append("image.log"); if((tin=fopen(getFileNameFromPath(fname->getCString(),fname->getLength()),"w"))==NULL){ @@ -1351,7 +1351,7 @@ void HtmlOutputDev::drawJpegImage(GfxState *state, Stream *str) } void HtmlOutputDev::drawPngImage(GfxState *state, Stream *str, int width, int height, - GfxImageColorMap *colorMap, GBool isMask) + GfxImageColorMap *colorMap, bool isMask) { #ifdef ENABLE_LIBPNG FILE *f1; @@ -1489,8 +1489,8 @@ GooString *HtmlOutputDev::createImageFileName(const char *ext) } void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { if (ignore||(complexMode && !xml)) { OutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); @@ -1503,7 +1503,7 @@ void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, } else { #ifdef ENABLE_LIBPNG - drawPngImage(state, str, width, height, nullptr, gTrue); + drawPngImage(state, str, width, height, nullptr, true); #else OutputDev::drawImageMask(state, ref, str, width, height, invert, interpolate, inlineImg); #endif @@ -1512,7 +1512,7 @@ void HtmlOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) { + bool interpolate, int *maskColors, bool inlineImg) { if (ignore||(complexMode && !xml)) { OutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate, @@ -1687,21 +1687,21 @@ void HtmlOutputDev::dumpMetaVars(FILE *file) } } -GBool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) +bool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) { FILE * output = nullptr; - GBool bClose = gFalse; + bool bClose = false; if (!ok) - return gFalse; + return false; Outline *outline = doc->getOutline(); if (!outline) - return gFalse; + return false; const GooList *outlines = outline->getItems(); if (!outlines) - return gFalse; + return false; if (!complexMode || xml) { @@ -1721,8 +1721,8 @@ GBool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) output = fopen(str->getCString(), "w"); delete str; if (output == nullptr) - return gFalse; - bClose = gTrue; + return false; + bClose = true; GooString *htmlEncoding = HtmlOutputDev::mapEncodingToHtml(globalParams->getTextEncodingName()); @@ -1740,7 +1740,7 @@ GBool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) if (!xml) { - GBool done = newHtmlOutlineLevel(output, outlines); + bool done = newHtmlOutlineLevel(output, outlines); if (done && !complexMode) fputs("<hr/>\n", output); @@ -1753,12 +1753,12 @@ GBool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) else newXmlOutlineLevel(output, outlines); - return gTrue; + return true; } -GBool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const GooList *outlines, int level) +bool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const GooList *outlines, int level) { - GBool atLeastOne = gFalse; + bool atLeastOne = false; if (level == 1) { @@ -1808,7 +1808,7 @@ GBool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const GooList *outlines, delete linkName; } delete titleStr; - atLeastOne = gTrue; + atLeastOne = true; item->open(); if (item->hasKids() && item->getKids()) diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h index 04d7d9fe..0a39baba 100644 --- a/utils/HtmlOutputDev.h +++ b/utils/HtmlOutputDev.h @@ -124,7 +124,7 @@ class HtmlPage { public: // Constructor. - HtmlPage(GBool rawOrder, const char *imgExtVal); + HtmlPage(bool rawOrder, const char *imgExtVal); // Destructor. ~HtmlPage(); @@ -177,7 +177,7 @@ private: HtmlFont* getFont(HtmlString *hStr) { return fonts->Get(hStr->fontpos); } double fontSize; // current font size - GBool rawOrder; // keep strings in content stream order + bool rawOrder; // keep strings in content stream order HtmlString *curStr; // currently active string @@ -243,45 +243,45 @@ public: const char *subject, const char *date, const char *extension, - GBool rawOrder, + bool rawOrder, int firstPage = 1, - GBool outline = 0); + bool outline = 0); // Destructor. virtual ~HtmlOutputDev(); // Check if file was successfully created. - virtual GBool isOk() { return ok; } + virtual bool isOk() { return ok; } //---- get info about output device // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gTrue; } + bool useDrawChar() override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need non-text content? - GBool needNonText() override { return gTrue; } + bool needNonText() override { return true; } //----- initialization and control - GBool checkPageSlice(Page *page, double hDPI, double vDPI, - int rotate, GBool useMediaBox, GBool crop, + bool checkPageSlice(Page *page, double hDPI, double vDPI, + int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, - GBool printing, - GBool (* abortCheckCbk)(void *data) = nullptr, + bool printing, + bool (* abortCheckCbk)(void *data) = nullptr, void * abortCheckCbkData = nullptr, - GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, + bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr) override { docPage = page; - return gTrue; + return true; } @@ -304,11 +304,11 @@ public: void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; //new feature virtual int DevType() {return 1234;} @@ -316,7 +316,7 @@ public: int getPageWidth() { return maxPageWidth; } int getPageHeight() { return maxPageHeight; } - GBool dumpDocOutline(PDFDoc* doc); + bool dumpDocOutline(PDFDoc* doc); private: // convert encoding into a HTML standard, or encoding->getCString if not @@ -327,24 +327,24 @@ private: GooString* getLinkDest(AnnotLink *link); void dumpMetaVars(FILE *); void doFrame(int firstPage); - GBool newHtmlOutlineLevel(FILE *output, const GooList *outlines, int level = 1); + bool newHtmlOutlineLevel(FILE *output, const GooList *outlines, int level = 1); void newXmlOutlineLevel(FILE *output, const GooList *outlines); int getOutlinePageNum(OutlineItem *item); void drawJpegImage(GfxState *state, Stream *str); void drawPngImage(GfxState *state, Stream *str, int width, int height, - GfxImageColorMap *colorMap, GBool isMask = gFalse); + GfxImageColorMap *colorMap, bool isMask = false); GooString *createImageFileName(const char *ext); FILE *fContentsFrame; FILE *page; // html file //FILE *tin; // image log file - //GBool write; - GBool needClose; // need to close the file? + //bool write; + bool needClose; // need to close the file? HtmlPage *pages; // text for the current page - GBool rawOrder; // keep text in content stream order - GBool doOutline; // output document outline - GBool ok; // set up ok? - GBool dumpJPEG; + bool rawOrder; // keep text in content stream order + bool doOutline; // output document outline + bool ok; // set up ok? + bool dumpJPEG; int pageNum; int maxPageWidth; int maxPageHeight; diff --git a/utils/HtmlUtils.h b/utils/HtmlUtils.h index bdb89b9a..2c0c4240 100644 --- a/utils/HtmlUtils.h +++ b/utils/HtmlUtils.h @@ -19,15 +19,15 @@ #define HTMLUTILS_H_ #include <math.h> // fabs -#include "goo/gtypes.h" // GBool +#include "goo/gtypes.h" // bool // Returns true iff the difference between a and b is less than the threshold // We always use fuzzy math when comparing decimal numbers due to imprecision -inline GBool is_within(double a, double thresh, double b) { +inline bool is_within(double a, double thresh, double b) { return fabs(a-b) < thresh; } -inline GBool rot_matrices_equal(const double * const mat0, const double * const mat1) { +inline bool rot_matrices_equal(const double * const mat0, const double * const mat1) { return is_within(mat0[0], .1, mat1[0]) && is_within(mat0[1], .1, mat1[1]) && is_within(mat0[2], .1, mat1[2]) && is_within(mat0[3], .1, mat1[3]); } @@ -35,7 +35,7 @@ inline GBool rot_matrices_equal(const double * const mat0, const double * const // rotation is (cos q, sin q, -sin q, cos q, 0, 0) // sin q is zero iff there is no rotation, or 180 deg. rotation; // for 180 rotation, cos q will be negative -inline GBool isMatRotOrSkew(const double * const mat) { +inline bool isMatRotOrSkew(const double * const mat) { return mat[0] < 0 || !is_within(mat[1], .1, 0); } diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 2e99cb5e..0c059a1c 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -50,22 +50,22 @@ #include "JBIG2Stream.h" #include "ImageOutputDev.h" -ImageOutputDev::ImageOutputDev(char *fileRootA, GBool pageNamesA, GBool listImagesA) { +ImageOutputDev::ImageOutputDev(char *fileRootA, bool pageNamesA, bool listImagesA) { listImages = listImagesA; if (!listImages) { fileRoot = copyString(fileRootA); fileName = (char *)gmalloc(strlen(fileRoot) + 45); } - outputPNG = gFalse; - outputTiff = gFalse; - dumpJPEG = gFalse; - dumpJP2 = gFalse; - dumpJBIG2 = gFalse; - dumpCCITT = gFalse; + outputPNG = false; + outputTiff = false; + dumpJPEG = false; + dumpJP2 = false; + dumpJBIG2 = false; + dumpCCITT = false; pageNames = pageNamesA; imgNum = 0; pageNum = 0; - ok = gTrue; + ok = true; if (listImages) { printf("page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio\n"); printf("--------------------------------------------------------------------------------------------\n"); @@ -119,7 +119,7 @@ static void printNumber(double d) void ImageOutputDev::listImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, GBool inlineImg, + bool interpolate, bool inlineImg, ImageType imageType) { const char *type; const char *colorspace; @@ -509,7 +509,7 @@ void ImageOutputDev::writeImageFile(ImgWriter *writer, ImageFormat format, const void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str, int width, int height, - GfxImageColorMap *colorMap, GBool inlineImg) { + GfxImageColorMap *colorMap, bool inlineImg) { ImageFormat format; EmbedStream *embedStr; @@ -674,18 +674,18 @@ void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str, embedStr->restore(); } -GBool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, +bool ImageOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep) { - return gTrue; + return true; // do nothing -- this avoids the potentially slow loop in Gfx.cc } void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) { + int width, int height, bool invert, + bool interpolate, bool inlineImg) { if (listImages) listImage(state, ref, str, width, height, nullptr, interpolate, inlineImg, imgStencil); else @@ -695,7 +695,7 @@ void ImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str, void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) { + bool interpolate, int *maskColors, bool inlineImg) { if (listImages) listImage(state, ref, str, width, height, colorMap, interpolate, inlineImg, imgImage); else @@ -704,27 +704,27 @@ void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, void ImageOutputDev::drawMaskedImage( GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, GBool interpolate, - Stream *maskStr, int maskWidth, int maskHeight, GBool maskInvert, GBool maskInterpolate) { + int width, int height, GfxImageColorMap *colorMap, bool interpolate, + Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert, bool maskInterpolate) { if (listImages) { - listImage(state, ref, str, width, height, colorMap, interpolate, gFalse, imgImage); - listImage(state, ref, str, maskWidth, maskHeight, nullptr, maskInterpolate, gFalse, imgMask); + listImage(state, ref, str, width, height, colorMap, interpolate, false, imgImage); + listImage(state, ref, str, maskWidth, maskHeight, nullptr, maskInterpolate, false, imgMask); } else { - writeImage(state, ref, str, width, height, colorMap, gFalse); - writeImage(state, ref, maskStr, maskWidth, maskHeight, nullptr, gFalse); + writeImage(state, ref, str, width, height, colorMap, false); + writeImage(state, ref, maskStr, maskWidth, maskHeight, nullptr, false); } } void ImageOutputDev::drawSoftMaskedImage( GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, GBool interpolate, + int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GfxImageColorMap *maskColorMap, GBool maskInterpolate) { + GfxImageColorMap *maskColorMap, bool maskInterpolate) { if (listImages) { - listImage(state, ref, str, width, height, colorMap, interpolate, gFalse, imgImage); - listImage(state, ref, maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate, gFalse, imgSmask); + listImage(state, ref, str, width, height, colorMap, interpolate, false, imgImage); + listImage(state, ref, maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate, false, imgSmask); } else { - writeImage(state, ref, str, width, height, colorMap, gFalse); - writeImage(state, ref, maskStr, maskWidth, maskHeight, maskColorMap, gFalse); + writeImage(state, ref, str, width, height, colorMap, false); + writeImage(state, ref, maskStr, maskWidth, maskHeight, maskColorMap, false); } } diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h index 61001c4c..6f07b041 100644 --- a/utils/ImageOutputDev.h +++ b/utils/ImageOutputDev.h @@ -64,43 +64,43 @@ public: // (.pbm) or PPM (.ppm) files unless PNG or Tiff output is enabled // (PNG is used if both are enabled). If Jpeg is enabled, JPEG images // are written as JPEG (.jpg) files. - ImageOutputDev(char *fileRootA, GBool pageNamesA, GBool listImagesA); + ImageOutputDev(char *fileRootA, bool pageNamesA, bool listImagesA); // Destructor. virtual ~ImageOutputDev(); // Use PNG format for output - void enablePNG(GBool png) { outputPNG = png; } + void enablePNG(bool png) { outputPNG = png; } // Use TIFF format for output - void enableTiff(GBool tiff) { outputTiff = tiff; } + void enableTiff(bool tiff) { outputTiff = tiff; } // Use Jpeg format for Jpeg files - void enableJpeg(GBool jpeg) { dumpJPEG = jpeg; } + void enableJpeg(bool jpeg) { dumpJPEG = jpeg; } // Use Jpeg2000 format for Jpeg2000 files - void enableJpeg2000(GBool jp2) { dumpJP2 = jp2; } + void enableJpeg2000(bool jp2) { dumpJP2 = jp2; } // Use JBIG2 format for JBIG2 files - void enableJBig2(GBool jbig2) { dumpJBIG2 = jbig2; } + void enableJBig2(bool jbig2) { dumpJBIG2 = jbig2; } // Use CCITT format for CCITT files - void enableCCITT(GBool ccitt) { dumpCCITT = ccitt; } + void enableCCITT(bool ccitt) { dumpCCITT = ccitt; } // Check if file was successfully created. - virtual GBool isOk() { return ok; } + virtual bool isOk() { return ok; } // Does this device use tilingPatternFill()? If this returns false, // tiling pattern fills will be reduced to a series of other drawing // operations. - GBool useTilingPatternFill() override { return gTrue; } + bool useTilingPatternFill() override { return true; } // Does this device use beginType3Char/endType3Char? Otherwise, // text in Type 3 fonts will be drawn with drawChar/drawString. - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } // Does this device need non-text content? - GBool needNonText() override { return gTrue; } + bool needNonText() override { return true; } // Start a page void startPage(int pageNumA, GfxState *state, XRef *xref) override @@ -110,13 +110,13 @@ public: // Does this device use upside-down coordinates? // (Upside-down means (0,0) is the top left corner of the page.) - GBool upsideDown() override { return gTrue; } + bool upsideDown() override { return true; } // Does this device use drawChar() or drawString()? - GBool useDrawChar() override { return gFalse; } + bool useDrawChar() override { return false; } //----- path painting - GBool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, + bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, @@ -124,25 +124,25 @@ public: //----- image drawing void drawImageMask(GfxState *state, Object *ref, Stream *str, - int width, int height, GBool invert, - GBool interpolate, GBool inlineImg) override; + int width, int height, bool invert, + bool interpolate, bool inlineImg) override; void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, int *maskColors, GBool inlineImg) override; + bool interpolate, int *maskColors, bool inlineImg) override; void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, - GBool maskInvert, GBool maskInterpolate) override; + bool maskInvert, bool maskInterpolate) override; void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, + bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, GfxImageColorMap *maskColorMap, - GBool maskInterpolate) override; + bool maskInterpolate) override; private: // Sets the output filename with a given file extension @@ -150,10 +150,10 @@ private: void listImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool interpolate, GBool inlineImg, + bool interpolate, bool inlineImg, ImageType imageType); void writeImage(GfxState *state, Object *ref, Stream *str, - int width, int height, GfxImageColorMap *colorMap, GBool inlineImg); + int width, int height, GfxImageColorMap *colorMap, bool inlineImg); void writeRawImage(Stream *str, const char *ext); void writeImageFile(ImgWriter *writer, ImageFormat format, const char *ext, Stream *str, int width, int height, GfxImageColorMap *colorMap); @@ -161,17 +161,17 @@ private: char *fileRoot; // root of output file names char *fileName; // buffer for output file names - GBool listImages; // list images instead of dumping - GBool dumpJPEG; // set to dump native JPEG files - GBool dumpJP2; // set to dump native JPEG2000 files - GBool dumpJBIG2; // set to dump native JBIG2 files - GBool dumpCCITT; // set to dump native CCITT files - GBool outputPNG; // set to output in PNG format - GBool outputTiff; // set to output in TIFF format - GBool pageNames; // set to include page number in file names + bool listImages; // list images instead of dumping + bool dumpJPEG; // set to dump native JPEG files + bool dumpJP2; // set to dump native JPEG2000 files + bool dumpJBIG2; // set to dump native JBIG2 files + bool dumpCCITT; // set to dump native CCITT files + bool outputPNG; // set to output in PNG format + bool outputTiff; // set to output in TIFF format + bool pageNames; // set to include page number in file names int pageNum; // current page number int imgNum; // current image number - GBool ok; // set up ok? + bool ok; // set up ok? }; #endif diff --git a/utils/JSInfo.cc b/utils/JSInfo.cc index e90c1407..4488de46 100644 --- a/utils/JSInfo.cc +++ b/utils/JSInfo.cc @@ -56,7 +56,7 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin return; if (link->getKind() == actionJavaScript) { - hasJS = gTrue; + hasJS = true; if (print) { LinkJavaScript *linkjs = static_cast<LinkJavaScript *>(link); const GooString *s = linkjs->getScript(); @@ -71,7 +71,7 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin if (link->getKind() == actionRendition) { LinkRendition *linkr = static_cast<LinkRendition *>(link); if (linkr->getScript()) { - hasJS = gTrue; + hasJS = true; if (print) { const GooString *s = linkr->getScript(); if (s && s->getCString()) { @@ -87,13 +87,13 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin } void JSInfo::scanJS(int nPages) { - print = gFalse; + print = false; file = nullptr; scan(nPages); } void JSInfo::scanJS(int nPages, FILE *fout, UnicodeMap *uMap) { - print = gTrue; + print = true; file = fout; uniMap = uMap; scan(nPages); @@ -104,12 +104,12 @@ void JSInfo::scan(int nPages) { Annots *annots; int lastPage; - hasJS = gFalse; + hasJS = false; // Names int numNames = doc->getCatalog()->numJS(); if (numNames > 0) { - hasJS = gTrue; + hasJS = true; if (print) { for (int i = 0; i < numNames; i++) { fprintf(file, "Name Dictionary \"%s\":\n", doc->getCatalog()->getJSName(i)->getCString()); @@ -235,6 +235,6 @@ void JSInfo::scan(int nPages) { currentPage = lastPage; } -GBool JSInfo::containsJS() { +bool JSInfo::containsJS() { return hasJS; } diff --git a/utils/JSInfo.h b/utils/JSInfo.h index 6dee717d..c685c6df 100644 --- a/utils/JSInfo.h +++ b/utils/JSInfo.h @@ -42,14 +42,14 @@ public: void scanJS(int nPages, FILE *fout, UnicodeMap *uMap); // return true if PDF contains JavaScript - GBool containsJS(); + bool containsJS(); private: PDFDoc *doc; int currentPage; - GBool hasJS; - GBool print; + bool hasJS; + bool print; FILE *file; UnicodeMap *uniMap; diff --git a/utils/parseargs.cc b/utils/parseargs.cc index af9dbba9..c9bcf906 100644 --- a/utils/parseargs.cc +++ b/utils/parseargs.cc @@ -34,14 +34,14 @@ #include "goo/GooString.h" static const ArgDesc *findArg(const ArgDesc *args, char *arg); -static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]); +static bool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]); -GBool parseArgs(const ArgDesc *args, int *argc, char *argv[]) { +bool parseArgs(const ArgDesc *args, int *argc, char *argv[]) { const ArgDesc *arg; int i, j; - GBool ok; + bool ok; - ok = gTrue; + ok = true; i = 1; while (i < *argc) { if (!strcmp(argv[i], "--")) { @@ -51,7 +51,7 @@ GBool parseArgs(const ArgDesc *args, int *argc, char *argv[]) { break; } else if ((arg = findArg(args, argv[i]))) { if (!grabArg(arg, i, argc, argv)) - ok = gFalse; + ok = false; } else { ++i; } @@ -115,16 +115,16 @@ static const ArgDesc *findArg(const ArgDesc *args, char *arg) { return nullptr; } -static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { +static bool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { int n; int j; - GBool ok; + bool ok; - ok = gTrue; + ok = true; n = 0; switch (arg->kind) { case argFlag: - *(GBool *)arg->val = gTrue; + *(bool *)arg->val = true; n = 1; break; case argInt: @@ -132,7 +132,7 @@ static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { *(int *)arg->val = atoi(argv[i+1]); n = 2; } else { - ok = gFalse; + ok = false; n = 1; } break; @@ -141,7 +141,7 @@ static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { *(double *)arg->val = gatof(argv[i+1]); n = 2; } else { - ok = gFalse; + ok = false; n = 1; } break; @@ -151,7 +151,7 @@ static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { ((char *)arg->val)[arg->size - 1] = '\0'; n = 2; } else { - ok = gFalse; + ok = false; n = 1; } break; @@ -160,7 +160,7 @@ static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { ((GooString*)arg->val)->Set(argv[i+1]); n = 2; } else { - ok = gFalse; + ok = false; n = 1; } break; @@ -177,17 +177,17 @@ static GBool grabArg(const ArgDesc *arg, int i, int *argc, char *argv[]) { return ok; } -GBool isInt(const char *s) { +bool isInt(const char *s) { if (*s == '-' || *s == '+') ++s; while (isdigit(*s)) ++s; if (*s) - return gFalse; - return gTrue; + return false; + return true; } -GBool isFP(const char *s) { +bool isFP(const char *s) { int n; if (*s == '-' || *s == '+') @@ -209,12 +209,12 @@ GBool isFP(const char *s) { ++s; n = 0; if (!isdigit(*s)) - return gFalse; + return false; do { ++s; } while (isdigit(*s)); } if (*s) - return gFalse; - return gTrue; + return false; + return true; } diff --git a/utils/parseargs.h b/utils/parseargs.h index 71cd0f8d..2b83222c 100644 --- a/utils/parseargs.h +++ b/utils/parseargs.h @@ -35,7 +35,7 @@ extern "C" { */ typedef enum { argFlag, /* flag (present / not-present) */ - /* [val: GBool *] */ + /* [val: bool *] */ argInt, /* integer arg */ /* [val: int *] */ argFP, /* floating point arg */ @@ -66,9 +66,9 @@ typedef struct { /* * Parse command line. Removes all args which are found in the arg * descriptor list <args>. Stops parsing if "--" is found (and removes - * it). Returns gFalse if there was an error. + * it). Returns false if there was an error. */ -extern GBool parseArgs(const ArgDesc *args, int *argc, char *argv[]); +extern bool parseArgs(const ArgDesc *args, int *argc, char *argv[]); /* * Print usage message, based on arg descriptor list. @@ -78,8 +78,8 @@ extern void printUsage(const char *program, const char *otherArgs, const ArgDesc /* * Check if a string is a valid integer or floating point number. */ -extern GBool isInt(const char *s); -extern GBool isFP(const char *s); +extern bool isInt(const char *s); +extern bool isFP(const char *s); #ifdef __cplusplus } diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc index f65b435f..846584a4 100644 --- a/utils/pdfdetach.cc +++ b/utils/pdfdetach.cc @@ -44,15 +44,15 @@ #include "Error.h" #include "Win32Console.h" -static GBool doList = gFalse; +static bool doList = false; static int saveNum = 0; -static GBool saveAll = gFalse; +static bool saveAll = false; static char savePath[1024] = ""; static char textEncName[128] = ""; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool printVersion = false; +static bool printHelp = false; static ArgDesc argDesc[] = { {"-list", argFlag, &doList, 0, @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { char uBuf[8]; char path[1024]; char *p; - GBool ok; + bool ok; int exitCode; GooList *embeddedFiles = nullptr; int nFiles, nPages, n, i, j; @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { Annot *annot; const GooString *s1; Unicode u; - GBool isUnicode; + bool isUnicode; Win32Console win32Console(&argc, &argv); exitCode = 99; @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) { if ((doList ? 1 : 0) + ((saveNum != 0) ? 1 : 0) + (saveAll ? 1 : 0) != 1) { - ok = gFalse; + ok = false; } if (!ok || argc != 2 || printVersion || printHelp) { fprintf(stderr, "pdfdetach version %s\n", PACKAGE_VERSION); @@ -192,10 +192,10 @@ int main(int argc, char *argv[]) { printf("%d: ", i+1); s1 = fileSpec->getFileName(); if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { - isUnicode = gTrue; + isUnicode = true; j = 2; } else { - isUnicode = gFalse; + isUnicode = false; j = 0; } while (j < fileSpec->getFileName()->getLength()) { @@ -229,10 +229,10 @@ int main(int argc, char *argv[]) { } s1 = fileSpec->getFileName(); if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { - isUnicode = gTrue; + isUnicode = true; j = 2; } else { - isUnicode = gFalse; + isUnicode = false; j = 0; } while (j < fileSpec->getFileName()->getLength()) { @@ -272,10 +272,10 @@ int main(int argc, char *argv[]) { p = path; s1 = fileSpec->getFileName(); if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { - isUnicode = gTrue; + isUnicode = true; j = 2; } else { - isUnicode = gFalse; + isUnicode = false; j = 0; } while (j < fileSpec->getFileName()->getLength()) { diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc index 6ed874b4..6c949aa3 100644 --- a/utils/pdffonts.cc +++ b/utils/pdffonts.cc @@ -59,11 +59,11 @@ static const char *fontTypeNames[] = { static int firstPage = 1; static int lastPage = 0; -static GBool showSubst = gFalse; +static bool showSubst = false; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool printVersion = false; +static bool printHelp = false; static const ArgDesc argDesc[] = { {"-f", argInt, &firstPage, 0, @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { PDFDoc *doc; GooString *fileName; GooString *ownerPW, *userPW; - GBool ok; + bool ok; int exitCode; Win32Console win32Console(&argc, &argv); diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc index 30beb080..1dfe3027 100644 --- a/utils/pdfimages.cc +++ b/utils/pdfimages.cc @@ -52,20 +52,20 @@ static int firstPage = 1; static int lastPage = 0; -static GBool listImages = gFalse; -static GBool enablePNG = gFalse; -static GBool enableTiff = gFalse; -static GBool dumpJPEG = gFalse; -static GBool dumpJP2 = gFalse; -static GBool dumpJBIG2 = gFalse; -static GBool dumpCCITT = gFalse; -static GBool allFormats = gFalse; -static GBool pageNames = gFalse; +static bool listImages = false; +static bool enablePNG = false; +static bool enableTiff = false; +static bool dumpJPEG = false; +static bool dumpJP2 = false; +static bool dumpJBIG2 = false; +static bool dumpCCITT = false; +static bool allFormats = false; +static bool pageNames = false; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool quiet = gFalse; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool quiet = false; +static bool printVersion = false; +static bool printHelp = false; static const ArgDesc argDesc[] = { {"-f", argInt, &firstPage, 0, @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) { char *imgRoot = nullptr; GooString *ownerPW, *userPW; ImageOutputDev *imgOut; - GBool ok; + bool ok; int exitCode; Win32Console win32Console(&argc, &argv); @@ -203,12 +203,12 @@ int main(int argc, char *argv[]) { imgOut = new ImageOutputDev(imgRoot, pageNames, listImages); if (imgOut->isOk()) { if (allFormats) { - imgOut->enablePNG(gTrue); - imgOut->enableTiff(gTrue); - imgOut->enableJpeg(gTrue); - imgOut->enableJpeg2000(gTrue); - imgOut->enableJBig2(gTrue); - imgOut->enableCCITT(gTrue); + imgOut->enablePNG(true); + imgOut->enableTiff(true); + imgOut->enableJpeg(true); + imgOut->enableJpeg2000(true); + imgOut->enableJBig2(true); + imgOut->enableCCITT(true); } else { imgOut->enablePNG(enablePNG); imgOut->enableTiff(enableTiff); @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) { imgOut->enableCCITT(dumpCCITT); } doc->displayPages(imgOut, firstPage, lastPage, 72, 72, 0, - gTrue, gFalse, gFalse); + true, false, false); } delete imgOut; diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index 7e1701fa..fd7b9f34 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -69,20 +69,20 @@ static int firstPage = 1; static int lastPage = 0; -static GBool printBoxes = gFalse; -static GBool printMetadata = gFalse; -static GBool printJS = gFalse; -static GBool isoDates = gFalse; -static GBool rawDates = gFalse; +static bool printBoxes = false; +static bool printMetadata = false; +static bool printJS = false; +static bool isoDates = false; +static bool rawDates = false; static char textEncName[128] = ""; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; -static GBool printEnc = gFalse; -static GBool printStructure = gFalse; -static GBool printStructureText = gFalse; -static GBool printDests = gFalse; +static bool printVersion = false; +static bool printHelp = false; +static bool printEnc = false; +static bool printStructure = false; +static bool printStructureText = false; +static bool printDests = false; static const ArgDesc argDesc[] = { {"-f", argInt, &firstPage, 0, @@ -254,7 +254,7 @@ static void printStruct(const StructElement *element, unsigned indent) { } if (printStructureText && element->isContent()) { - GooString *text = element->getText(gFalse); + GooString *text = element->getText(false); printIndent(indent); if (text) { printf("\"%s\"\n", text->getCString()); @@ -660,7 +660,7 @@ static void printPdfSubtype(PDFDoc *doc, UnicodeMap *uMap) { } } -static void printInfo(PDFDoc *doc, UnicodeMap *uMap, long long filesize, GBool multiPage) { +static void printInfo(PDFDoc *doc, UnicodeMap *uMap, long long filesize, bool multiPage) { Page *page; char buf[256]; double w, h, wISO, hISO; @@ -747,10 +747,10 @@ static void printInfo(PDFDoc *doc, UnicodeMap *uMap, long long filesize, GBool m } printf("yes (print:%s copy:%s change:%s addNotes:%s algorithm:%s)\n", - doc->okToPrint(gTrue) ? "yes" : "no", - doc->okToCopy(gTrue) ? "yes" : "no", - doc->okToChange(gTrue) ? "yes" : "no", - doc->okToAddNotes(gTrue) ? "yes" : "no", + doc->okToPrint(true) ? "yes" : "no", + doc->okToCopy(true) ? "yes" : "no", + doc->okToChange(true) ? "yes" : "no", + doc->okToAddNotes(true) ? "yes" : "no", encAlgorithmName); } else { printf("no\n"); @@ -842,9 +842,9 @@ int main(int argc, char *argv[]) { GooString *ownerPW, *userPW; UnicodeMap *uMap; FILE *f; - GBool ok; + bool ok; int exitCode; - GBool multiPage; + bool multiPage; exitCode = 99; @@ -864,7 +864,7 @@ int main(int argc, char *argv[]) { } if (printStructureText) - printStructure = gTrue; + printStructure = true; // read config file globalParams = new GlobalParams(); @@ -924,9 +924,9 @@ int main(int argc, char *argv[]) { firstPage = 1; } if (lastPage == 0) { - multiPage = gFalse; + multiPage = false; } else { - multiPage = gTrue; + multiPage = true; } if (lastPage < 1 || lastPage > doc->getNumPages()) { lastPage = doc->getNumPages(); @@ -975,7 +975,7 @@ int main(int argc, char *argv[]) { fclose(f); } - if (multiPage == gFalse) + if (multiPage == false) lastPage = 1; printInfo(doc, uMap, filesize, multiPage); diff --git a/utils/pdfseparate.cc b/utils/pdfseparate.cc index 4751158a..935b04a0 100644 --- a/utils/pdfseparate.cc +++ b/utils/pdfseparate.cc @@ -30,8 +30,8 @@ static int firstPage = 0; static int lastPage = 0; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool printVersion = false; +static bool printHelp = false; static const ArgDesc argDesc[] = { {"-f", argInt, &firstPage, 0, @@ -146,7 +146,7 @@ static bool extractPages (const char *srcFileName, const char *destFileName) { int main (int argc, char *argv[]) { - GBool ok; + bool ok; int exitCode; exitCode = 99; diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc index 592270ad..b0e40e78 100644 --- a/utils/pdfsig.cc +++ b/utils/pdfsig.cc @@ -116,10 +116,10 @@ static void dumpSignature(int sig_num, int sigCount, FormWidgetSignature *sig_wi delete path; } -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; -static GBool dontVerifyCert = gFalse; -static GBool dumpSignatures = gFalse; +static bool printVersion = false; +static bool printHelp = false; +static bool dontVerifyCert = false; +static bool dumpSignatures = false; static const ArgDesc argDesc[] = { {"-nocert", argFlag, &dontVerifyCert, 0, @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) Win32Console win32Console(&argc, &argv); int exitCode = 99; - GBool ok; + bool ok; ok = parseArgs(argDesc, &argc, argv); diff --git a/utils/pdftocairo-win32.cc b/utils/pdftocairo-win32.cc index 35783a71..b5e1e4f7 100644 --- a/utils/pdftocairo-win32.cc +++ b/utils/pdftocairo-win32.cc @@ -92,7 +92,7 @@ static void parseDuplex(GooString *mode) fprintf(stderr, "Warning: Unknown duplex mode \"%s\"\n", mode->getCString()); } -static void fillCommonPrinterOptions(GBool duplex) +static void fillCommonPrinterOptions(bool duplex) { if (duplex) { devmode->dmDuplex = DMDUP_HORIZONTAL; @@ -118,7 +118,7 @@ static void fillPagePrinterOptions(double w, double h) } -static void fillPrinterOptions(GBool duplex, GooString *printOpt) +static void fillPrinterOptions(bool duplex, GooString *printOpt) { //printOpt format is: <opt1>=<val1>,<opt2>=<val2>,... const char *nextOpt = printOpt->getCString(); @@ -235,8 +235,8 @@ enum PageScale { NONE = 0, SHRINK = 1, FIT = 2 }; // used to set/get option values in printDialogHookProc static PageScale pageScale; -static GBool centerPage; -static GBool useOrigPageSize; +static bool centerPage; +static bool useOrigPageSize; // PrintDlg callback to customize the print dialog with additional controls. static UINT_PTR CALLBACK printDialogHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) @@ -364,7 +364,7 @@ static UINT_PTR CALLBACK printDialogHookProc(HWND hdlg, UINT uiMsg, WPARAM wPara } void win32SetupPrinter(GooString *printer, GooString *printOpt, - GBool duplex, GBool setupdlg) + bool duplex, bool setupdlg) { if (printer->getCString()[0] == 0) { DWORD size = 0; @@ -417,8 +417,8 @@ void win32SetupPrinter(GooString *printer, GooString *printOpt, } } -void win32ShowPrintDialog(GBool *expand, GBool *noShrink, GBool *noCenter, - GBool *usePDFPageSize, GBool *allPages, +void win32ShowPrintDialog(bool *expand, bool *noShrink, bool *noCenter, + bool *usePDFPageSize, bool *allPages, int *firstPage, int *lastPage, int maxPages) { PRINTDLG pd; @@ -455,21 +455,21 @@ void win32ShowPrintDialog(GBool *expand, GBool *noShrink, GBool *noCenter, devmode = (DEVMODEA*)GlobalLock(hDevmode); hdc = pd.hDC; if (pd.Flags & PD_PAGENUMS) { - *allPages = gFalse; + *allPages = false; *firstPage = pd.nFromPage; *lastPage = pd.nToPage; } else { - *allPages = gTrue; + *allPages = true; } if (pageScale == NONE) { - *expand = gFalse; - *noShrink = gTrue; + *expand = false; + *noShrink = true; } else if (pageScale == SHRINK) { - *expand = gFalse; - *noShrink = gFalse; + *expand = false; + *noShrink = false; } else { - *expand = gTrue; - *noShrink = gFalse; + *expand = true; + *noShrink = false; } *noCenter = !centerPage; *usePDFPageSize = useOrigPageSize; @@ -498,7 +498,7 @@ cairo_surface_t *win32BeginDocument(GooString *inputFileName, GooString *outputF return cairo_win32_printing_surface_create(hdc); } -void win32BeginPage(double *w, double *h, GBool changePageSize, GBool useFullPage) +void win32BeginPage(double *w, double *h, bool changePageSize, bool useFullPage) { if (changePageSize) fillPagePrinterOptions(*w, *h); diff --git a/utils/pdftocairo-win32.h b/utils/pdftocairo-win32.h index 1361267f..412c95ae 100644 --- a/utils/pdftocairo-win32.h +++ b/utils/pdftocairo-win32.h @@ -21,12 +21,12 @@ #include <cairo-win32.h> void win32SetupPrinter(GooString *printer, GooString *printOpt, - GBool duplex, GBool setupdlg); -void win32ShowPrintDialog(GBool *expand, GBool *noShrink, GBool *noCenter, - GBool *usePDFPageSize, GBool *allPages, + bool duplex, bool setupdlg); +void win32ShowPrintDialog(bool *expand, bool *noShrink, bool *noCenter, + bool *usePDFPageSize, bool *allPages, int *firstPage, int *lastPage, int maxPages); cairo_surface_t *win32BeginDocument(GooString *inputFileName, GooString *outputFileName); -void win32BeginPage(double *w, double *h, GBool changePageSize, GBool useFullPage); +void win32BeginPage(double *w, double *h, bool changePageSize, bool useFullPage); void win32EndPage(GooString *imageFileName); void win32EndDocument(); diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index 26c8e681..be9ff54a 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -76,21 +76,21 @@ #include "pdftocairo-win32.h" -static GBool png = gFalse; -static GBool jpeg = gFalse; -static GBool ps = gFalse; -static GBool eps = gFalse; -static GBool pdf = gFalse; -static GBool printToWin32 = gFalse; -static GBool printdlg = gFalse; -static GBool svg = gFalse; -static GBool tiff = gFalse; +static bool png = false; +static bool jpeg = false; +static bool ps = false; +static bool eps = false; +static bool pdf = false; +static bool printToWin32 = false; +static bool printdlg = false; +static bool svg = false; +static bool tiff = false; static int firstPage = 1; static int lastPage = 0; -static GBool printOnlyOdd = gFalse; -static GBool printOnlyEven = gFalse; -static GBool singleFile = gFalse; +static bool printOnlyOdd = false; +static bool printOnlyEven = false; +static bool singleFile = false; static double resolution = 0.0; static double x_resolution = 150.0; static double y_resolution = 150.0; @@ -102,31 +102,31 @@ static int crop_y = 0; static int crop_w = 0; static int crop_h = 0; static int sz = 0; -static GBool useCropBox = gFalse; -static GBool mono = gFalse; -static GBool gray = gFalse; -static GBool transp = gFalse; +static bool useCropBox = false; +static bool mono = false; +static bool gray = false; +static bool transp = false; static GooString antialias; static GooString icc; -static GBool level2 = gFalse; -static GBool level3 = gFalse; -static GBool origPageSizes = gFalse; +static bool level2 = false; +static bool level3 = false; +static bool origPageSizes = false; static char paperSize[15] = ""; static int paperWidth = -1; static int paperHeight = -1; -static GBool noCrop = gFalse; -static GBool expand = gFalse; -static GBool noShrink = gFalse; -static GBool noCenter = gFalse; -static GBool duplex = gFalse; +static bool noCrop = false; +static bool expand = false; +static bool noShrink = false; +static bool noCenter = false; +static bool duplex = false; static char tiffCompressionStr[16] = ""; static char ownerPassword[33] = ""; static char userPassword[33] = ""; -static GBool quiet = gFalse; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool quiet = false; +static bool printVersion = false; +static bool printHelp = false; static GooString jpegOpt; static int jpegQuality = -1; @@ -136,7 +136,7 @@ static bool jpegOptimize = false; static GooString printer; static GooString printOpt; #ifdef CAIRO_HAS_WIN32_SURFACE -static GBool setupdlg = gFalse; +static bool setupdlg = false; #endif static const ArgDesc argDesc[] = { @@ -278,9 +278,9 @@ static const ArgDesc argDesc[] = { static cairo_surface_t *surface; -static GBool printing; +static bool printing; static FILE *output_file; -static GBool usePDFPageSize; +static bool usePDFPageSize; static cairo_antialias_t antialiasEnum = CAIRO_ANTIALIAS_DEFAULT; #ifdef USE_CMS @@ -307,13 +307,13 @@ static const AntiliasOption antialiasOptions[] = { nullptr, CAIRO_ANTIALIAS_DEFAULT }, }; -static GBool parseAntialiasOption() +static bool parseAntialiasOption() { const AntiliasOption *option = antialiasOptions; while (option->name) { if (antialias.cmp(option->name) == 0) { antialiasEnum = option->value; - return gTrue; + return true; } option++; } @@ -325,10 +325,10 @@ static GBool parseAntialiasOption() fprintf(stderr, " %s\n", option->name); option++; } - return gFalse; + return false; } -static GBool parseJpegOptions() +static bool parseJpegOptions() { //jpegOpt format is: <opt1>=<val1>,<opt2>=<val2>,... const char *nextOpt = jpegOpt.getCString(); @@ -347,7 +347,7 @@ static GBool parseJpegOptions() const char *equal = strchr(opt.getCString(), '='); if (!equal) { fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); - return gFalse; + return false; } int iequal = equal - opt.getCString(); GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1); @@ -357,35 +357,35 @@ static GBool parseJpegOptions() if (opt.cmp("quality") == 0) { if (!isInt(value.getCString())) { fprintf(stderr, "Invalid jpeg quality\n"); - return gFalse; + return false; } jpegQuality = atoi(value.getCString()); if (jpegQuality < 0 || jpegQuality > 100) { fprintf(stderr, "jpeg quality must be between 0 and 100\n"); - return gFalse; + return false; } } else if (opt.cmp("progressive") == 0) { - jpegProgressive = gFalse; + jpegProgressive = false; if (value.cmp("y") == 0) { - jpegProgressive = gTrue; + jpegProgressive = true; } else if (value.cmp("n") != 0) { fprintf(stderr, "jpeg progressive option must be \"y\" or \"n\"\n"); - return gFalse; + return false; } } else if (opt.cmp("optimize") == 0 || opt.cmp("optimise") == 0) { - jpegOptimize = gFalse; + jpegOptimize = false; if (value.cmp("y") == 0) { - jpegOptimize = gTrue; + jpegOptimize = true; } else if (value.cmp("n") != 0) { fprintf(stderr, "jpeg optimize option must be \"y\" or \"n\"\n"); - return gFalse; + return false; } } else { fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); - return gFalse; + return false; } } - return gTrue; + return true; } static void writePageImage(GooString *filename) @@ -682,9 +682,9 @@ static void beginPage(double *w, double *h) #ifdef CAIRO_HAS_WIN32_SURFACE if (printToWin32) { - GBool changePageSize = gTrue; + bool changePageSize = true; if (setupdlg && !origPageSizes) - changePageSize = gFalse; + changePageSize = false; win32BeginPage(w, h, changePageSize, noShrink); // w,h will be changed to actual size used } #endif @@ -733,7 +733,7 @@ static void renderPage(PDFDoc *doc, CairoOutputDev *cairoOut, int pg, 72.0, 72.0, 0, /* rotate */ !useCropBox, /* useMediaBox */ - gFalse, /* Crop */ + false, /* Crop */ printing, -1, -1, -1, -1); cairo_restore(cr); @@ -796,7 +796,7 @@ static void endDocument() } } -static GBool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { +static bool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { if (!strcmp(size, "match")) { psPaperWidth = psPaperHeight = -1; } else if (!strcmp(size, "letter")) { @@ -812,9 +812,9 @@ static GBool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { psPaperWidth = 842; psPaperHeight = 1190; } else { - return gFalse; + return false; } - return gTrue; + return true; } static GooString *getImageFileName(GooString *outputFileName, int numDigits, int page) @@ -903,7 +903,7 @@ static GooString *getOutputFileName(GooString *fileName, GooString *outputName) return name; } -static void checkInvalidPrintOption(GBool option, const char *option_name) +static void checkInvalidPrintOption(bool option, const char *option_name) { if (option) { fprintf(stderr, "Error: %s may only be used with the -png, -jpeg, or -tiff output options.\n", option_name); @@ -911,7 +911,7 @@ static void checkInvalidPrintOption(GBool option, const char *option_name) } } -static void checkInvalidImageOption(GBool option, const char *option_name) +static void checkInvalidImageOption(bool option, const char *option_name) { if (option) { fprintf(stderr, "Error: %s may only be used with the -ps, -eps, -pdf, or -svg output options.\n", option_name); @@ -975,9 +975,9 @@ int main(int argc, char *argv[]) { exit(99); } if (png || jpeg || tiff) - printing = gFalse; + printing = false; else - printing = gTrue; + printing = true; if (printing) { checkInvalidPrintOption(mono, "-mono"); @@ -1050,7 +1050,7 @@ int main(int argc, char *argv[]) { exit(99); } if (!level2 && !level3) - level3 = gTrue; + level3 = true; if (eps && (origPageSizes || paperSize[0] || paperWidth > 0 || paperHeight > 0)) { fprintf(stderr, "Error: page size options may not be used with eps output.\n"); @@ -1073,12 +1073,12 @@ int main(int argc, char *argv[]) { } } if (origPageSizes || paperWidth < 0 || paperHeight < 0) - usePDFPageSize = gTrue; + usePDFPageSize = true; else - usePDFPageSize = gFalse; + usePDFPageSize = false; if (printdlg) - printToWin32 = gTrue; + printToWin32 = true; globalParams = new GlobalParams(); if (quiet) { @@ -1181,9 +1181,9 @@ int main(int argc, char *argv[]) { #ifdef CAIRO_HAS_WIN32_SURFACE if (printdlg) { - GBool allPages = gFalse; + bool allPages = false; if (firstPage == 1 && lastPage == doc->getNumPages()) - allPages = gTrue; + allPages = true; win32ShowPrintDialog(&expand, &noShrink, &noCenter, &usePDFPageSize, &allPages, &firstPage, &lastPage, doc->getNumPages()); diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc index 6871f4e9..ba30b7d1 100644 --- a/utils/pdftohtml.cc +++ b/utils/pdftohtml.cc @@ -71,29 +71,29 @@ static int firstPage = 1; static int lastPage = 0; -static GBool rawOrder = gTrue; -GBool printCommands = gTrue; -static GBool printHelp = gFalse; -GBool printHtml = gFalse; -GBool complexMode=gFalse; -GBool singleHtml=gFalse; // singleHtml -GBool ignore=gFalse; +static bool rawOrder = true; +bool printCommands = true; +static bool printHelp = false; +bool printHtml = false; +bool complexMode=false; +bool singleHtml=false; // singleHtml +bool ignore=false; static char extension[5]="png"; static double scale=1.5; -GBool noframes=gFalse; -GBool stout=gFalse; -GBool xml=gFalse; -GBool noRoundedCoordinates = gFalse; -static GBool errQuiet=gFalse; -static GBool noDrm=gFalse; +bool noframes=false; +bool stout=false; +bool xml=false; +bool noRoundedCoordinates = false; +static bool errQuiet=false; +static bool noDrm=false; double wordBreakThreshold=10; // 10%, below converted into a coefficient - 0.1 -GBool showHidden = gFalse; -GBool noMerge = gFalse; -GBool fontFullName = gFalse; +bool showHidden = false; +bool noMerge = false; +bool fontFullName = false; static char ownerPassword[33] = ""; static char userPassword[33] = ""; -static GBool printVersion = gFalse; +static bool printVersion = false; static GooString* getInfoString(Dict *infoDict, const char *key); static GooString* getInfoDate(Dict *infoDict, const char *key); @@ -162,8 +162,8 @@ static const ArgDesc argDesc[] = { class SplashOutputDevNoText : public SplashOutputDev { public: SplashOutputDevNoText(SplashColorMode colorModeA, int bitmapRowPadA, - GBool reverseVideoA, SplashColorPtr paperColorA, - GBool bitmapTopDownA = gTrue) : SplashOutputDev(colorModeA, + bool reverseVideoA, SplashColorPtr paperColorA, + bool bitmapTopDownA = true) : SplashOutputDev(colorModeA, bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA) { } virtual ~SplashOutputDevNoText() { } @@ -171,13 +171,13 @@ public: double dx, double dy, double originX, double originY, CharCode code, int nBytes, Unicode *u, int uLen) override { } - GBool beginType3Char(GfxState *state, double x, double y, + bool beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, Unicode *u, int uLen) override { return false; } void endType3Char(GfxState *state) override { } void beginTextObject(GfxState *state) override { } void endTextObject(GfxState *state) override { } - GBool interpretType3Chars() override { return gFalse; } + bool interpretType3Chars() override { return false; } }; #endif @@ -191,8 +191,8 @@ int main(int argc, char *argv[]) { #ifdef HAVE_SPLASH SplashOutputDev *splashOut = nullptr; #endif - GBool doOutline; - GBool ok; + bool doOutline; + bool ok; GooString *ownerPW, *userPW; Object info; int exit_status = EXIT_FAILURE; @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) { if (errQuiet) { globalParams->setErrQuiet(errQuiet); - printCommands = gFalse; // I'm not 100% what is the differecne between them + printCommands = false; // I'm not 100% what is the differecne between them } if (textEncName[0]) { @@ -311,22 +311,22 @@ int main(int argc, char *argv[]) { if (scale<0.5) scale=0.5; if (complexMode || singleHtml) { - //noframes=gFalse; - stout=gFalse; + //noframes=false; + stout=false; } if (stout) { - noframes=gTrue; - complexMode=gFalse; - singleHtml=gFalse; + noframes=true; + complexMode=false; + singleHtml=false; } if (xml) { - complexMode = gTrue; - singleHtml = gFalse; - noframes = gTrue; - noMerge = gTrue; + complexMode = true; + singleHtml = false; + noframes = true; + noMerge = true; } // get page range @@ -391,7 +391,7 @@ int main(int argc, char *argv[]) { if (htmlOut->isOk()) { doc->displayPages(htmlOut, firstPage, lastPage, 72 * scale, 72 * scale, 0, - gTrue, gFalse, gFalse); + true, false, false); htmlOut->dumpDocOutline(doc); } @@ -405,13 +405,13 @@ int main(int argc, char *argv[]) { SplashImageFileFormat format = strcmp(extension, "jpg") ? splashFormatPng : splashFormatJpeg; - splashOut = new SplashOutputDevNoText(splashModeRGB8, 4, gFalse, color); + splashOut = new SplashOutputDevNoText(splashModeRGB8, 4, false, color); splashOut->startDoc(doc); for (int pg = firstPage; pg <= lastPage; ++pg) { doc->displayPage(splashOut, pg, 72 * scale, 72 * scale, - 0, gTrue, gFalse, gFalse); + 0, true, false, false); SplashBitmap *bitmap = splashOut->getBitmap(); imgFileName = GooString::format("{0:s}{1:03d}.{2:s}", @@ -460,7 +460,7 @@ static GooString* getInfoString(Dict *infoDict, const char *key) { // Value HTML escaped and converted to desired encoding GooString *encodedString = nullptr; // Is rawString UCS2 (as opposed to pdfDocEncoding) - GBool isUnicode; + bool isUnicode; obj = infoDict->lookup(key); if (obj.isString()) { @@ -468,10 +468,10 @@ static GooString* getInfoString(Dict *infoDict, const char *key) { // Convert rawString to unicode if (rawString->hasUnicodeMarker()) { - isUnicode = gTrue; + isUnicode = true; unicodeLength = (obj.getString()->getLength() - 2) / 2; } else { - isUnicode = gFalse; + isUnicode = false; unicodeLength = obj.getString()->getLength(); } unicodeString = new Unicode[unicodeLength]; diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc index 42b3c501..7c85a241 100644 --- a/utils/pdftoppm.cc +++ b/utils/pdftoppm.cc @@ -69,9 +69,9 @@ static int firstPage = 1; static int lastPage = 0; -static GBool printOnlyOdd = gFalse; -static GBool printOnlyEven = gFalse; -static GBool singleFile = gFalse; +static bool printOnlyOdd = false; +static bool printOnlyEven = false; +static bool singleFile = false; static double resolution = 0.0; static double x_resolution = 150.0; static double y_resolution = 150.0; @@ -83,25 +83,25 @@ static int param_y = 0; static int param_w = 0; static int param_h = 0; static int sz = 0; -static GBool useCropBox = gFalse; -static GBool mono = gFalse; -static GBool gray = gFalse; -static GBool png = gFalse; -static GBool jpeg = gFalse; -static GBool jpegcmyk = gFalse; -static GBool tiff = gFalse; +static bool useCropBox = false; +static bool mono = false; +static bool gray = false; +static bool png = false; +static bool jpeg = false; +static bool jpegcmyk = false; +static bool tiff = false; static GooString jpegOpt; static int jpegQuality = -1; static bool jpegProgressive = false; static bool jpegOptimize = false; #ifdef SPLASH_CMYK -static GBool overprint = gFalse; +static bool overprint = false; #endif static char enableFreeTypeStr[16] = ""; static char antialiasStr[16] = ""; static char vectorAntialiasStr[16] = ""; -static GBool fontAntialias = gTrue; -static GBool vectorAntialias = gTrue; +static bool fontAntialias = true; +static bool vectorAntialias = true; static char ownerPassword[33] = ""; static char userPassword[33] = ""; static char TiffCompressionStr[16] = ""; @@ -110,9 +110,9 @@ static SplashThinLineMode thinLineMode = splashThinLineDefault; #ifdef UTILS_USE_PTHREADS static int numberOfJobs = 1; #endif // UTILS_USE_PTHREADS -static GBool quiet = gFalse; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool quiet = false; +static bool printVersion = false; +static bool printHelp = false; static const ArgDesc argDesc[] = { {"-f", argInt, &firstPage, 0, @@ -215,7 +215,7 @@ static const ArgDesc argDesc[] = { {} }; -static GBool parseJpegOptions() +static bool parseJpegOptions() { //jpegOpt format is: <opt1>=<val1>,<opt2>=<val2>,... const char *nextOpt = jpegOpt.getCString(); @@ -234,7 +234,7 @@ static GBool parseJpegOptions() const char *equal = strchr(opt.getCString(), '='); if (!equal) { fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); - return gFalse; + return false; } int iequal = equal - opt.getCString(); GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1); @@ -244,35 +244,35 @@ static GBool parseJpegOptions() if (opt.cmp("quality") == 0) { if (!isInt(value.getCString())) { fprintf(stderr, "Invalid jpeg quality\n"); - return gFalse; + return false; } jpegQuality = atoi(value.getCString()); if (jpegQuality < 0 || jpegQuality > 100) { fprintf(stderr, "jpeg quality must be between 0 and 100\n"); - return gFalse; + return false; } } else if (opt.cmp("progressive") == 0) { - jpegProgressive = gFalse; + jpegProgressive = false; if (value.cmp("y") == 0) { - jpegProgressive = gTrue; + jpegProgressive = true; } else if (value.cmp("n") != 0) { fprintf(stderr, "jpeg progressive option must be \"y\" or \"n\"\n"); - return gFalse; + return false; } } else if (opt.cmp("optimize") == 0 || opt.cmp("optimise") == 0) { - jpegOptimize = gFalse; + jpegOptimize = false; if (value.cmp("y") == 0) { - jpegOptimize = gTrue; + jpegOptimize = true; } else if (value.cmp("n") != 0) { fprintf(stderr, "jpeg optimize option must be \"y\" or \"n\"\n"); - return gFalse; + return false; } } else { fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); - return gFalse; + return false; } } - return gTrue; + return true; } static void savePageSlice(PDFDoc *doc, @@ -287,7 +287,7 @@ static void savePageSlice(PDFDoc *doc, doc->displayPageSlice(splashOut, pg, x_resolution, y_resolution, 0, - !useCropBox, gFalse, gFalse, + !useCropBox, false, false, x, y, w, h ); @@ -364,7 +364,7 @@ static void processPageJobs() { #ifdef SPLASH_CMYK (jpegcmyk || overprint) ? splashModeDeviceN8 : #endif - splashModeRGB8, 4, gFalse, *pageJob.paperColor, gTrue, thinLineMode); + splashModeRGB8, 4, false, *pageJob.paperColor, true, thinLineMode); splashOut->setFontAntialias(fontAntialias); splashOut->setVectorAntialias(vectorAntialias); splashOut->startDoc(pageJob.doc); @@ -390,7 +390,7 @@ int main(int argc, char *argv[]) { #else pthread_t* jobs; #endif // UTILS_USE_PTHREADS - GBool ok; + bool ok; int exitCode; int pg, pg_num_len; double pg_w, pg_h, tmp; @@ -401,7 +401,7 @@ int main(int argc, char *argv[]) { // parse args ok = parseArgs(argDesc, &argc, argv); if (mono && gray) { - ok = gFalse; + ok = false; } if ( resolution != 0.0 && (x_resolution == 150.0 || @@ -519,7 +519,7 @@ int main(int argc, char *argv[]) { // write PPM files #ifdef SPLASH_CMYK if (jpegcmyk || overprint) { - globalParams->setOverprintPreview(gTrue); + globalParams->setOverprintPreview(true); for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) paperColor[cp] = 0; } else @@ -538,7 +538,7 @@ int main(int argc, char *argv[]) { (jpegcmyk || overprint) ? splashModeDeviceN8 : #endif splashModeRGB8, 4, - gFalse, paperColor, gTrue, thinLineMode); + false, paperColor, true, thinLineMode); diff --git a/utils/pdftops.cc b/utils/pdftops.cc index 3e12c384..e377b8a6 100644 --- a/utils/pdftops.cc +++ b/utils/pdftops.cc @@ -54,7 +54,7 @@ #include "Error.h" #include "Win32Console.h" -static GBool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { +static bool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { if (!strcmp(size, "match")) { psPaperWidth = psPaperHeight = -1; } else if (!strcmp(size, "letter")) { @@ -70,52 +70,52 @@ static GBool setPSPaperSize(char *size, int &psPaperWidth, int &psPaperHeight) { psPaperWidth = 842; psPaperHeight = 1190; } else { - return gFalse; + return false; } - return gTrue; + return true; } static int firstPage = 1; static int lastPage = 0; -static GBool level1 = gFalse; -static GBool level1Sep = gFalse; -static GBool level2 = gFalse; -static GBool level2Sep = gFalse; -static GBool level3 = gFalse; -static GBool level3Sep = gFalse; -static GBool origPageSizes = gFalse; -static GBool doEPS = gFalse; -static GBool doForm = gFalse; +static bool level1 = false; +static bool level1Sep = false; +static bool level2 = false; +static bool level2Sep = false; +static bool level3 = false; +static bool level3Sep = false; +static bool origPageSizes = false; +static bool doEPS = false; +static bool doForm = false; #ifdef OPI_SUPPORT -static GBool doOPI = gFalse; +static bool doOPI = false; #endif static int splashResolution = 0; -static GBool psBinary = gFalse; -static GBool noEmbedT1Fonts = gFalse; -static GBool noEmbedTTFonts = gFalse; -static GBool noEmbedCIDPSFonts = gFalse; -static GBool noEmbedCIDTTFonts = gFalse; -static GBool fontPassthrough = gFalse; -static GBool optimizeColorSpace = gFalse; -static GBool passLevel1CustomColor = gFalse; +static bool psBinary = false; +static bool noEmbedT1Fonts = false; +static bool noEmbedTTFonts = false; +static bool noEmbedCIDPSFonts = false; +static bool noEmbedCIDTTFonts = false; +static bool fontPassthrough = false; +static bool optimizeColorSpace = false; +static bool passLevel1CustomColor = false; static char rasterAntialiasStr[16] = ""; -static GBool preload = gFalse; +static bool preload = false; static char paperSize[15] = ""; static int paperWidth = -1; static int paperHeight = -1; -static GBool noCrop = gFalse; -static GBool expand = gFalse; -static GBool noShrink = gFalse; -static GBool noCenter = gFalse; -static GBool duplex = gFalse; +static bool noCrop = false; +static bool expand = false; +static bool noShrink = false; +static bool noCenter = false; +static bool duplex = false; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool quiet = gFalse; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool quiet = false; +static bool printVersion = false; +static bool printHelp = false; #ifdef SPLASH_CMYK -static GBool overprint = gFalse; +static bool overprint = false; #endif static const ArgDesc argDesc[] = { @@ -214,9 +214,9 @@ int main(int argc, char *argv[]) { PSOutMode mode; GooString *ownerPW, *userPW; PSOutputDev *psOut; - GBool ok; + bool ok; int exitCode; - GBool rasterAntialias = gFalse; + bool rasterAntialias = false; std::vector<int> pages; Win32Console win32Console(&argc, &argv); @@ -290,14 +290,14 @@ int main(int argc, char *argv[]) { } #ifdef SPLASH_CMYK if (overprint) { - globalParams->setOverprintPreview(gTrue); + globalParams->setOverprintPreview(true); } #endif if (expand) { - globalParams->setPSExpandSmaller(gTrue); + globalParams->setPSExpandSmaller(true); } if (noShrink) { - globalParams->setPSShrinkLarger(gFalse); + globalParams->setPSShrinkLarger(false); } if (level1 || level1Sep || level2 || level2Sep || level3 || level3Sep) { globalParams->setPSLevel(level); @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) { noCrop, duplex); if (noCenter) { - psOut->setPSCenter(gFalse); + psOut->setPSCenter(false); } if (rasterAntialiasStr[0]) { @@ -422,7 +422,7 @@ int main(int argc, char *argv[]) { if (psOut->isOk()) { for (int i = firstPage; i <= lastPage; ++i) { doc->displayPage(psOut, i, 72, 72, - 0, noCrop, !noCrop, gTrue); + 0, noCrop, !noCrop, true); } } else { delete psOut; diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc index 10153acb..6b4d3066 100644 --- a/utils/pdftotext.cc +++ b/utils/pdftotext.cc @@ -78,21 +78,21 @@ static int x = 0; static int y = 0; static int w = 0; static int h = 0; -static GBool bbox = gFalse; -static GBool bboxLayout = gFalse; -static GBool physLayout = gFalse; +static bool bbox = false; +static bool bboxLayout = false; +static bool physLayout = false; static double fixedPitch = 0; -static GBool rawOrder = gFalse; -static GBool htmlMeta = gFalse; +static bool rawOrder = false; +static bool htmlMeta = false; static char textEncName[128] = ""; static char textEOL[16] = ""; -static GBool noPageBreaks = gFalse; +static bool noPageBreaks = false; static char ownerPassword[33] = "\001"; static char userPassword[33] = "\001"; -static GBool quiet = gFalse; -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; -static GBool printEnc = gFalse; +static bool quiet = false; +static bool printVersion = false; +static bool printHelp = false; +static bool printEnc = false; static const ArgDesc argDesc[] = { {"-f", argInt, &firstPage, 0, @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) { FILE *f; UnicodeMap *uMap; Object info; - GBool ok; + bool ok; int exitCode; Win32Console win32Console(&argc, &argv); @@ -190,10 +190,10 @@ int main(int argc, char *argv[]) { // parse args ok = parseArgs(argDesc, &argc, argv); if (bboxLayout) { - bbox = gTrue; + bbox = true; } if (bbox) { - htmlMeta = gTrue; + htmlMeta = true; } if (!ok || (argc < 2 && !printEnc) || argc > 3 || printVersion || printHelp) { fprintf(stderr, "pdftotext version %s\n", PACKAGE_VERSION); @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) { fileName = new GooString(argv[1]); if (fixedPitch) { - physLayout = gTrue; + physLayout = true; } if (textEncName[0]) { @@ -231,7 +231,7 @@ int main(int argc, char *argv[]) { } } if (noPageBreaks) { - globalParams->setTextPageBreaks(gFalse); + globalParams->setTextPageBreaks(false); } if (quiet) { globalParams->setErrQuiet(quiet); @@ -382,12 +382,12 @@ int main(int argc, char *argv[]) { if (textOut->isOk()) { if ((w==0) && (h==0) && (x==0) && (y==0)) { doc->displayPages(textOut, firstPage, lastPage, resolution, resolution, 0, - gTrue, gFalse, gFalse); + true, false, false); } else { for (int page = firstPage; page <= lastPage; ++page) { doc->displayPageSlice(textOut, page, resolution, resolution, 0, - gTrue, gFalse, gFalse, + true, false, false, x, y, w, h); } } @@ -438,7 +438,7 @@ int main(int argc, char *argv[]) { static void printInfoString(FILE *f, Dict *infoDict, const char *key, const char *text1, const char *text2, UnicodeMap *uMap) { const GooString *s1; - GBool isUnicode; + bool isUnicode; Unicode u; char buf[9]; int i, n; @@ -449,10 +449,10 @@ static void printInfoString(FILE *f, Dict *infoDict, const char *key, s1 = obj.getString(); if ((s1->getChar(0) & 0xff) == 0xfe && (s1->getChar(1) & 0xff) == 0xff) { - isUnicode = gTrue; + isUnicode = true; i = 2; } else { - isUnicode = gFalse; + isUnicode = false; i = 0; } while (i < obj.getString()->getLength()) { @@ -520,7 +520,7 @@ void printDocBBox(FILE *f, PDFDoc *doc, TextOutputDev *textOut, int first, int l fprintf(f, "<doc>\n"); for (int page = first; page <= last; ++page) { fprintf(f, " <page width=\"%f\" height=\"%f\">\n",doc->getPageMediaWidth(page), doc->getPageMediaHeight(page)); - doc->displayPage(textOut, page, resolution, resolution, 0, gTrue, gFalse, gFalse); + doc->displayPage(textOut, page, resolution, resolution, 0, true, false, false); for (flow = textOut->getFlows(); flow; flow = flow->getNext()) { fprintf(f, " <flow>\n"); for (blk = flow->getBlocks(); blk; blk = blk->getNext()) { @@ -542,7 +542,7 @@ void printWordBBox(FILE *f, PDFDoc *doc, TextOutputDev *textOut, int first, int fprintf(f, "<doc>\n"); for (int page = first; page <= last; ++page) { fprintf(f, " <page width=\"%f\" height=\"%f\">\n",doc->getPageMediaWidth(page), doc->getPageMediaHeight(page)); - doc->displayPage(textOut, page, resolution, resolution, 0, gTrue, gFalse, gFalse); + doc->displayPage(textOut, page, resolution, resolution, 0, true, false, false); TextWordList *wordlist = textOut->makeWordList(); const int word_length = wordlist != nullptr ? wordlist->getLength() : 0; TextWord *word; diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc index 1125aa62..47fae977 100644 --- a/utils/pdfunite.cc +++ b/utils/pdfunite.cc @@ -23,8 +23,8 @@ #include <poppler-config.h> #include <vector> -static GBool printVersion = gFalse; -static GBool printHelp = gFalse; +static bool printVersion = false; +static bool printHelp = false; static const ArgDesc argDesc[] = { {"-v", argFlag, &printVersion, 0, @@ -146,7 +146,7 @@ int main (int argc, char *argv[]) int exitCode; exitCode = 99; - const GBool ok = parseArgs (argDesc, &argc, argv); + const bool ok = parseArgs (argDesc, &argc, argv); if (!ok || argc < 3 || printVersion || printHelp) { fprintf(stderr, "pdfunite version %s\n", PACKAGE_VERSION); fprintf(stderr, "%s\n", popplerCopyright); @@ -192,7 +192,7 @@ int main (int argc, char *argv[]) yRef = new XRef(); countRef = new XRef(); - yRef->add(0, 65535, 0, gFalse); + yRef->add(0, 65535, 0, false); PDFDoc::writeHeader(outStr, majorVersion, minorVersion); // handle OutputIntents, AcroForm, OCProperties & Names @@ -229,7 +229,7 @@ int main (int argc, char *argv[]) Object idf = intent.dictLookup("OutputConditionIdentifier"); if (idf.isString()) { const GooString *gidf = idf.getString(); - GBool removeIntent = gTrue; + bool removeIntent = true; for (int k = 0; k < pageintents.arrayGetLength(); k++) { Object pgintent = pageintents.arrayGet(k, 0); if (pgintent.isDict()) { @@ -237,7 +237,7 @@ int main (int argc, char *argv[]) if (pgidf.isString()) { const GooString *gpgidf = pgidf.getString(); if (gpgidf->cmp(gidf) == 0) { - removeIntent = gFalse; + removeIntent = false; break; } } @@ -318,12 +318,12 @@ int main (int argc, char *argv[]) doMergeFormDict(afObj.getDict(), pageForm.getDict(), numOffset); } } - objectsCount += docs[i]->writePageObjects(outStr, yRef, numOffset, gTrue); + objectsCount += docs[i]->writePageObjects(outStr, yRef, numOffset, true); numOffset = yRef->getNumObjects() + 1; } rootNum = yRef->getNumObjects() + 1; - yRef->add(rootNum, 0, outStr->getPos(), gTrue); + yRef->add(rootNum, 0, outStr->getPos(), true); outStr->printf("%d 0 obj\n", rootNum); outStr->printf("<< /Type /Catalog /Pages %d 0 R", rootNum + 1); // insert OutputIntents @@ -355,7 +355,7 @@ int main (int argc, char *argv[]) outStr->printf(">>\nendobj\n"); objectsCount++; - yRef->add(rootNum + 1, 0, outStr->getPos(), gTrue); + yRef->add(rootNum + 1, 0, outStr->getPos(), true); outStr->printf("%d 0 obj\n", rootNum + 1); outStr->printf("<< /Type /Pages /Kids ["); for (j = 0; j < (int) pages.size(); j++) @@ -364,7 +364,7 @@ int main (int argc, char *argv[]) objectsCount++; for (i = 0; i < (int) pages.size(); i++) { - yRef->add(rootNum + i + 2, 0, outStr->getPos(), gTrue); + yRef->add(rootNum + i + 2, 0, outStr->getPos(), true); outStr->printf("%d 0 obj\n", rootNum + i + 2); outStr->printf("<< "); Dict *pageDict = pages[i].getDict(); @@ -387,9 +387,9 @@ int main (int argc, char *argv[]) Ref ref; ref.num = rootNum; ref.gen = 0; - Object trailerDict = PDFDoc::createTrailerDict(objectsCount, gFalse, 0, &ref, yRef, + Object trailerDict = PDFDoc::createTrailerDict(objectsCount, false, 0, &ref, yRef, fileName, outStr->getPos()); - PDFDoc::writeXRefTableTrailer(std::move(trailerDict), yRef, gTrue, // write all entries according to ISO 32000-1, 7.5.4 Cross-Reference Table: "For a file that has never been incrementally updated, the cross-reference section shall contain only one subsection, whose object numbering begins at 0." + PDFDoc::writeXRefTableTrailer(std::move(trailerDict), yRef, true, // write all entries according to ISO 32000-1, 7.5.4 Cross-Reference Table: "For a file that has never been incrementally updated, the cross-reference section shall contain only one subsection, whose object numbering begins at 0." uxrefOffset, outStr, yRef); outStr->close(); |