summaryrefslogtreecommitdiff
path: root/goo
diff options
context:
space:
mode:
Diffstat (limited to 'goo')
-rw-r--r--goo/FixedPoint.cc8
-rw-r--r--goo/FixedPoint.h4
-rw-r--r--goo/GooString.cc52
-rw-r--r--goo/GooString.h20
-rw-r--r--goo/GooTimer.h2
-rw-r--r--goo/gdir.h12
-rw-r--r--goo/gfile.cc10
-rw-r--r--goo/gtypes.h12
8 files changed, 54 insertions, 66 deletions
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
diff --git a/goo/gdir.h b/goo/gdir.h
index 4df9db32..505b4b08 100644
--- a/goo/gdir.h
+++ b/goo/gdir.h
@@ -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.
*/