summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOliver Sander <oliver.sander@tu-dresden.de>2018-10-21 08:28:56 +0200
committerAlbert Astals Cid <aacid@kde.org>2018-10-23 14:19:10 +0200
commit163420b48bdddf9084208b3cadf04dafad52d40a (patch)
treee047526fa1d56b914453a6a489f2c91d10e958a3 /test
parent22dd47a64222bf967d57b986539ae1be46bc06a7 (diff)
Replace GBool, gTrue, and gFalse by bool, true, false, resp.
These are just non-standard names for bool, true, false, respectively. Getting rid of these names saves on layer of mental redirection, and enables proper syntax highlighting in editors.
Diffstat (limited to 'test')
-rw-r--r--test/gtk-test.cc4
-rw-r--r--test/pdf-fullrewrite.cc78
-rw-r--r--test/pdf-inspector.cc4
-rw-r--r--test/perf-test.cc20
4 files changed, 53 insertions, 53 deletions
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) {