diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-08-22 07:04:01 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-08-22 07:04:01 +0000 |
commit | 1612bfd9e3f1db86e943626640b71cdf3df5b9a0 (patch) | |
tree | 55b061c358a44ccfce7f8c584a8a876edf864870 /Build/source/libs/poppler/poppler-0.26.3/goo | |
parent | 8ed265a1a7e2e74041cd214aa3acc933484adb01 (diff) |
poppler 0.26.4
git-svn-id: svn://tug.org/texlive/trunk@35006 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/poppler/poppler-0.26.3/goo')
34 files changed, 0 insertions, 5348 deletions
diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/FixedPoint.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/FixedPoint.cc deleted file mode 100644 index 26b2f0fe890..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/FixedPoint.cc +++ /dev/null @@ -1,135 +0,0 @@ -//======================================================================== -// -// FixedPoint.cc -// -// Fixed point type, with C++ operators. -// -// Copyright 2004 Glyph & Cog, LLC -// -//======================================================================== - -#include <config.h> - -#if USE_FIXEDPOINT - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "FixedPoint.h" - -#define ln2 ((FixedPoint)0.69314718) - -#define ln2 ((FixedPoint)0.69314718) - -FixedPoint FixedPoint::sqrt(FixedPoint x) { - FixedPoint y0, y1, z; - - if (x.val <= 0) { - y1.val = 0; - } else { - y1.val = x.val == 1 ? 2 : x.val >> 1; - do { - y0.val = y1.val; - z = x / y0; - y1.val = (y0.val + z.val) >> 1; - } while (::abs(y0.val - y1.val) > 1); - } - return y1; -} - -FixedPoint FixedPoint::pow(FixedPoint x, FixedPoint y) { - FixedPoint t, t2, lnx0, lnx, z0, z; - int d, n, i; - - if (y.val <= 0) { - z.val = 0; - } else { - // y * ln(x) - t = (x - 1) / (x + 1); - t2 = t * t; - d = 1; - lnx = 0; - do { - lnx0 = lnx; - lnx += t / d; - t *= t2; - d += 2; - } while (::abs(lnx.val - lnx0.val) > 2); - lnx.val <<= 1; - t = y * lnx; - // exp(y * ln(x)) - n = floor(t / ln2); - t -= ln2 * n; - t2 = t; - d = 1; - i = 1; - z = 1; - do { - z0 = z; - z += t2 / d; - t2 *= t; - ++i; - d *= i; - } while (::abs(z.val - z0.val) > 2 && d < (1 << fixptShift)); - if (n >= 0) { - z.val <<= n; - } else if (n < 0) { - z.val >>= -n; - } - } - return z; -} - -int FixedPoint::mul(int x, int y) { - FixPtInt64 z; - - z = ((FixPtInt64)x * y) >> fixptShift; - if (z > 0x7fffffffLL) { - return 0x7fffffff; - } else if (z < -0x80000000LL) { - return 0x80000000; - } else { - return (int)z; - } -} - -int FixedPoint::div(int x, int y) { - FixPtInt64 z; - - z = ((FixPtInt64)x << fixptShift) / y; - if (z > 0x7fffffffLL) { - return 0x7fffffff; - } else if (z < -0x80000000LL) { - return 0x80000000; - } else { - return (int)z; - } -} - -GBool 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; - } - result->val = z; - return gTrue; -} - -GBool FixedPoint::checkDet(FixedPoint m11, FixedPoint m12, - FixedPoint m21, FixedPoint m22, - FixedPoint epsilon) { - FixPtInt64 det, e; - - det = (FixPtInt64)m11.val * (FixPtInt64)m22.val - - (FixPtInt64)m12.val * (FixPtInt64)m21.val; - e = (FixPtInt64)epsilon.val << fixptShift; - // NB: this comparison has to be >= not > because epsilon can be - // truncated to zero as a fixed point value. - return det >= e || det <= -e; -} - -#endif // USE_FIXEDPOINT diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/FixedPoint.h b/Build/source/libs/poppler/poppler-0.26.3/goo/FixedPoint.h deleted file mode 100644 index 99749802db7..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/FixedPoint.h +++ /dev/null @@ -1,166 +0,0 @@ -//======================================================================== -// -// FixedPoint.h -// -// Fixed point type, with C++ operators. -// -// Copyright 2004 Glyph & Cog, LLC -// -//======================================================================== - -#ifndef FIXEDPOINT_H -#define FIXEDPOINT_H - -#include "poppler-config.h" - -#if USE_FIXEDPOINT - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include <stdio.h> -#include <stdlib.h> -#include "gtypes.h" - -#define fixptShift 16 -#define fixptMaskL ((1 << fixptShift) - 1) -#define fixptMaskH (~fixptMaskL) - -typedef long long FixPtInt64; - -class FixedPoint { -public: - - FixedPoint() { val = 0; } - FixedPoint(const FixedPoint &x) { val = x.val; } - FixedPoint(double x) { val = (int)(x * (1 << fixptShift) + 0.5); } - FixedPoint(int x) { val = x << fixptShift; } - FixedPoint(long x) { val = x << fixptShift; } - - operator float() - { return (float) val * ((float)1 / (float)(1 << fixptShift)); } - operator double() - { return (double) val * (1.0 / (double)(1 << fixptShift)); } - operator int() - { return val >> fixptShift; } - - int get16Dot16() { return val; } - - FixedPoint operator =(FixedPoint x) { val = x.val; return *this; } - - int operator ==(FixedPoint x) { return val == x.val; } - int operator ==(double x) { return *this == (FixedPoint)x; } - int operator ==(int x) { return *this == (FixedPoint)x; } - int operator ==(long x) { return *this == (FixedPoint)x; } - - int operator !=(FixedPoint x) { return val != x.val; } - int operator !=(double x) { return *this != (FixedPoint)x; } - int operator !=(int x) { return *this != (FixedPoint)x; } - int operator !=(long x) { return *this != (FixedPoint)x; } - - int operator <(FixedPoint x) { return val < x.val; } - int operator <(double x) { return *this < (FixedPoint)x; } - int operator <(int x) { return *this < (FixedPoint)x; } - int operator <(long x) { return *this < (FixedPoint)x; } - - int operator <=(FixedPoint x) { return val <= x.val; } - int operator <=(double x) { return *this <= (FixedPoint)x; } - int operator <=(int x) { return *this <= (FixedPoint)x; } - int operator <=(long x) { return *this <= (FixedPoint)x; } - - int operator >(FixedPoint x) { return val > x.val; } - int operator >(double x) { return *this > (FixedPoint)x; } - int operator >(int x) { return *this > (FixedPoint)x; } - int operator >(long x) { return *this > (FixedPoint)x; } - - int operator >=(FixedPoint x) { return val >= x.val; } - int operator >=(double x) { return *this >= (FixedPoint)x; } - int operator >=(int x) { return *this >= (FixedPoint)x; } - int operator >=(long x) { return *this >= (FixedPoint)x; } - - FixedPoint operator -() { return make(-val); } - - FixedPoint operator +(FixedPoint x) { return make(val + x.val); } - FixedPoint operator +(double x) { return *this + (FixedPoint)x; } - FixedPoint operator +(int x) { return *this + (FixedPoint)x; } - FixedPoint operator +(long x) { return *this + (FixedPoint)x; } - - FixedPoint operator +=(FixedPoint x) { val = val + x.val; return *this; } - FixedPoint operator +=(double x) { return *this += (FixedPoint)x; } - FixedPoint operator +=(int x) { return *this += (FixedPoint)x; } - FixedPoint operator +=(long x) { return *this += (FixedPoint)x; } - - FixedPoint operator -(FixedPoint x) { return make(val - x.val); } - FixedPoint operator -(double x) { return *this - (FixedPoint)x; } - FixedPoint operator -(int x) { return *this - (FixedPoint)x; } - FixedPoint operator -(long x) { return *this - (FixedPoint)x; } - - FixedPoint operator -=(FixedPoint x) { val = val - x.val; return *this; } - FixedPoint operator -=(double x) { return *this -= (FixedPoint)x; } - FixedPoint operator -=(int x) { return *this -= (FixedPoint)x; } - FixedPoint operator -=(long x) { return *this -= (FixedPoint)x; } - - FixedPoint operator *(FixedPoint x) { return make(mul(val, x.val)); } - FixedPoint operator *(double x) { return *this * (FixedPoint)x; } - FixedPoint operator *(int x) { return *this * (FixedPoint)x; } - FixedPoint operator *(long x) { return *this * (FixedPoint)x; } - - FixedPoint operator *=(FixedPoint x) { val = mul(val, x.val); return *this; } - FixedPoint operator *=(double x) { return *this *= (FixedPoint)x; } - FixedPoint operator *=(int x) { return *this *= (FixedPoint)x; } - FixedPoint operator *=(long x) { return *this *= (FixedPoint)x; } - - FixedPoint operator /(FixedPoint x) { return make(div(val, x.val)); } - FixedPoint operator /(double x) { return *this / (FixedPoint)x; } - FixedPoint operator /(int x) { return *this / (FixedPoint)x; } - FixedPoint operator /(long x) { return *this / (FixedPoint)x; } - - FixedPoint operator /=(FixedPoint x) { val = div(val, x.val); return *this; } - FixedPoint operator /=(double x) { return *this /= (FixedPoint)x; } - FixedPoint operator /=(int x) { return *this /= (FixedPoint)x; } - FixedPoint operator /=(long x) { return *this /= (FixedPoint)x; } - - static FixedPoint abs(FixedPoint x) { return make(::abs(x.val)); } - - static int floor(FixedPoint x) { return x.val >> fixptShift; } - - static int ceil(FixedPoint x) - { return (x.val & fixptMaskL) ? ((x.val >> fixptShift) + 1) - : (x.val >> fixptShift); } - - static int round(FixedPoint x) - { return (x.val + (1 << (fixptShift - 1))) >> fixptShift; } - - // Computes (x+y)/2 avoiding overflow and LSbit accuracy issues. - static FixedPoint avg(FixedPoint x, FixedPoint y) - { return make((x.val >> 1) + (y.val >> 1) + ((x.val | y.val) & 1)); } - - - static FixedPoint sqrt(FixedPoint x); - - static FixedPoint pow(FixedPoint x, FixedPoint y); - - // Compute *result = x/y; return false if there is an underflow or - // overflow. - static GBool 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, - FixedPoint m21, FixedPoint m22, - FixedPoint epsilon); - -private: - - static FixedPoint make(int valA) { FixedPoint x; x.val = valA; return x; } - - static int mul(int x, int y); - static int div(int x, int y); - - int val; // fixed point: (n-fixptShift).(fixptShift) -}; - -#endif // USE_FIXEDPOINT - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooHash.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/GooHash.cc deleted file mode 100644 index f4a92f17506..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooHash.cc +++ /dev/null @@ -1,384 +0,0 @@ -//======================================================================== -// -// GooHash.cc -// -// Copyright 2001-2003 Glyph & Cog, LLC -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "gmem.h" -#include "GooString.h" -#include "GooHash.h" - -//------------------------------------------------------------------------ - -struct GooHashBucket { - GooString *key; - union { - void *p; - int i; - } val; - GooHashBucket *next; -}; - -struct GooHashIter { - int h; - GooHashBucket *p; -}; - -//------------------------------------------------------------------------ - -GooHash::GooHash(GBool deleteKeysA) { - int h; - - deleteKeys = deleteKeysA; - size = 7; - tab = (GooHashBucket **)gmallocn(size, sizeof(GooHashBucket *)); - for (h = 0; h < size; ++h) { - tab[h] = NULL; - } - len = 0; -} - -GooHash::~GooHash() { - GooHashBucket *p; - int h; - - for (h = 0; h < size; ++h) { - while (tab[h]) { - p = tab[h]; - tab[h] = p->next; - if (deleteKeys) { - delete p->key; - } - delete p; - } - } - gfree(tab); -} - -void GooHash::add(GooString *key, void *val) { - GooHashBucket *p; - int h; - - // expand the table if necessary - if (len >= size) { - expand(); - } - - // add the new symbol - p = new GooHashBucket; - p->key = key; - p->val.p = val; - h = hash(key); - p->next = tab[h]; - tab[h] = p; - ++len; -} - -void GooHash::add(GooString *key, int val) { - GooHashBucket *p; - int h; - - // expand the table if necessary - if (len >= size) { - expand(); - } - - // add the new symbol - p = new GooHashBucket; - p->key = key; - p->val.i = val; - h = hash(key); - p->next = tab[h]; - tab[h] = p; - ++len; -} - -void GooHash::replace(GooString *key, void *val) { - GooHashBucket *p; - int h; - - if ((p = find(key, &h))) { - p->val.p = val; - if (deleteKeys) { - delete key; - } - } else { - add(key, val); - } -} - -void GooHash::replace(GooString *key, int val) { - GooHashBucket *p; - int h; - - if ((p = find(key, &h))) { - p->val.i = val; - if (deleteKeys) { - delete key; - } - } else { - add(key, val); - } -} - -void *GooHash::lookup(GooString *key) { - GooHashBucket *p; - int h; - - if (!(p = find(key, &h))) { - return NULL; - } - return p->val.p; -} - -int GooHash::lookupInt(GooString *key) { - GooHashBucket *p; - int h; - - if (!(p = find(key, &h))) { - return 0; - } - return p->val.i; -} - -void *GooHash::lookup(const char *key) { - GooHashBucket *p; - int h; - - if (!(p = find(key, &h))) { - return NULL; - } - return p->val.p; -} - -int GooHash::lookupInt(const char *key) { - GooHashBucket *p; - int h; - - if (!(p = find(key, &h))) { - return 0; - } - return p->val.i; -} - -void *GooHash::remove(GooString *key) { - GooHashBucket *p; - GooHashBucket **q; - void *val; - int h; - - if (!(p = find(key, &h))) { - return NULL; - } - q = &tab[h]; - while (*q != p) { - q = &((*q)->next); - } - *q = p->next; - if (deleteKeys) { - delete p->key; - } - val = p->val.p; - delete p; - --len; - return val; -} - -int GooHash::removeInt(GooString *key) { - GooHashBucket *p; - GooHashBucket **q; - int val; - int h; - - if (!(p = find(key, &h))) { - return 0; - } - q = &tab[h]; - while (*q != p) { - q = &((*q)->next); - } - *q = p->next; - if (deleteKeys) { - delete p->key; - } - val = p->val.i; - delete p; - --len; - return val; -} - -void *GooHash::remove(const char *key) { - GooHashBucket *p; - GooHashBucket **q; - void *val; - int h; - - if (!(p = find(key, &h))) { - return NULL; - } - q = &tab[h]; - while (*q != p) { - q = &((*q)->next); - } - *q = p->next; - if (deleteKeys) { - delete p->key; - } - val = p->val.p; - delete p; - --len; - return val; -} - -int GooHash::removeInt(const char *key) { - GooHashBucket *p; - GooHashBucket **q; - int val; - int h; - - if (!(p = find(key, &h))) { - return 0; - } - q = &tab[h]; - while (*q != p) { - q = &((*q)->next); - } - *q = p->next; - if (deleteKeys) { - delete p->key; - } - val = p->val.i; - delete p; - --len; - return val; -} - -void GooHash::startIter(GooHashIter **iter) { - *iter = new GooHashIter; - (*iter)->h = -1; - (*iter)->p = NULL; -} - -GBool GooHash::getNext(GooHashIter **iter, GooString **key, void **val) { - if (!*iter) { - return gFalse; - } - if ((*iter)->p) { - (*iter)->p = (*iter)->p->next; - } - while (!(*iter)->p) { - if (++(*iter)->h == size) { - delete *iter; - *iter = NULL; - return gFalse; - } - (*iter)->p = tab[(*iter)->h]; - } - *key = (*iter)->p->key; - *val = (*iter)->p->val.p; - return gTrue; -} - -GBool GooHash::getNext(GooHashIter **iter, GooString **key, int *val) { - if (!*iter) { - return gFalse; - } - if ((*iter)->p) { - (*iter)->p = (*iter)->p->next; - } - while (!(*iter)->p) { - if (++(*iter)->h == size) { - delete *iter; - *iter = NULL; - return gFalse; - } - (*iter)->p = tab[(*iter)->h]; - } - *key = (*iter)->p->key; - *val = (*iter)->p->val.i; - return gTrue; -} - -void GooHash::killIter(GooHashIter **iter) { - delete *iter; - *iter = NULL; -} - -void GooHash::expand() { - GooHashBucket **oldTab; - GooHashBucket *p; - int oldSize, h, i; - - oldSize = size; - oldTab = tab; - size = 2*size + 1; - tab = (GooHashBucket **)gmallocn(size, sizeof(GooHashBucket *)); - for (h = 0; h < size; ++h) { - tab[h] = NULL; - } - for (i = 0; i < oldSize; ++i) { - while (oldTab[i]) { - p = oldTab[i]; - oldTab[i] = oldTab[i]->next; - h = hash(p->key); - p->next = tab[h]; - tab[h] = p; - } - } - gfree(oldTab); -} - -GooHashBucket *GooHash::find(GooString *key, int *h) { - GooHashBucket *p; - - *h = hash(key); - for (p = tab[*h]; p; p = p->next) { - if (!p->key->cmp(key)) { - return p; - } - } - return NULL; -} - -GooHashBucket *GooHash::find(const char *key, int *h) { - GooHashBucket *p; - - *h = hash(key); - for (p = tab[*h]; p; p = p->next) { - if (!p->key->cmp(key)) { - return p; - } - } - return NULL; -} - -int GooHash::hash(GooString *key) { - const char *p; - unsigned int h; - int i; - - h = 0; - for (p = key->getCString(), i = 0; i < key->getLength(); ++p, ++i) { - h = 17 * h + (int)(*p & 0xff); - } - return (int)(h % size); -} - -int GooHash::hash(const char *key) { - const char *p; - unsigned int h; - - h = 0; - for (p = key; *p; ++p) { - h = 17 * h + (int)(*p & 0xff); - } - return (int)(h % size); -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooHash.h b/Build/source/libs/poppler/poppler-0.26.3/goo/GooHash.h deleted file mode 100644 index eda19e31409..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooHash.h +++ /dev/null @@ -1,92 +0,0 @@ -//======================================================================== -// -// GooHash.h -// -// Copyright 2001-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GHASH_H -#define GHASH_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" - -class GooString; -struct GooHashBucket; -struct GooHashIter; - -//------------------------------------------------------------------------ - -class GooHash { -public: - - GooHash(GBool deleteKeysA = gFalse); - ~GooHash(); - void add(GooString *key, void *val); - void add(GooString *key, int val); - void replace(GooString *key, void *val); - void replace(GooString *key, int val); - void *lookup(GooString *key); - int lookupInt(GooString *key); - void *lookup(const char *key); - int lookupInt(const char *key); - void *remove(GooString *key); - int removeInt(GooString *key); - void *remove(const char *key); - int removeInt(const char *key); - int getLength() { return len; } - void startIter(GooHashIter **iter); - GBool getNext(GooHashIter **iter, GooString **key, void **val); - GBool getNext(GooHashIter **iter, GooString **key, int *val); - void killIter(GooHashIter **iter); - -private: - GooHash(const GooHash &other); - GooHash& operator=(const GooHash &other); - - void expand(); - GooHashBucket *find(GooString *key, int *h); - GooHashBucket *find(const char *key, int *h); - int hash(GooString *key); - int hash(const char *key); - - GBool deleteKeys; // set if key strings should be deleted - int size; // number of buckets - int len; // number of entries - GooHashBucket **tab; -}; - -#define deleteGooHash(hash, T) \ - do { \ - GooHash *_hash = (hash); \ - { \ - GooHashIter *_iter; \ - GooString *_key; \ - void *_p; \ - _hash->startIter(&_iter); \ - while (_hash->getNext(&_iter, &_key, &_p)) { \ - delete (T*)_p; \ - } \ - delete _hash; \ - } \ - } while(0) - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooLikely.h b/Build/source/libs/poppler/poppler-0.26.3/goo/GooLikely.h deleted file mode 100644 index 724ccf00870..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooLikely.h +++ /dev/null @@ -1,22 +0,0 @@ -//======================================================================== -// -// GooLikely.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2008 Kees Cook <kees@outflux.net> -// -//======================================================================== - -#ifndef GOOLIKELY_H -#define GOOLIKELY_H - -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -# define likely(x) __builtin_expect((x), 1) -# define unlikely(x) __builtin_expect((x), 0) -#else -# define likely(x) (x) -# define unlikely(x) (x) -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooList.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/GooList.cc deleted file mode 100644 index 6ce4952dc6a..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooList.cc +++ /dev/null @@ -1,122 +0,0 @@ -//======================================================================== -// -// GooList.cc -// -// Copyright 2001-2003 Glyph & Cog, LLC -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <string.h> -#include "gmem.h" -#include "GooList.h" - -//------------------------------------------------------------------------ -// GooList -//------------------------------------------------------------------------ - -GooList::GooList() { - size = 8; - data = (void **)gmallocn(size, sizeof(void*)); - length = 0; - inc = 0; -} - -GooList::GooList(int sizeA) { - size = sizeA ? sizeA : 8; - data = (void **)gmallocn(size, sizeof(void*)); - length = 0; - inc = 0; -} - -GooList::~GooList() { - gfree(data); -} - -GooList *GooList::copy() { - GooList *ret; - - ret = new GooList(length); - ret->length = length; - memcpy(ret->data, data, length * sizeof(void *)); - ret->inc = inc; - return ret; -} - -void GooList::append(void *p) { - if (length >= size) { - expand(); - } - data[length++] = p; -} - -void GooList::append(GooList *list) { - int i; - - while (length + list->length > size) { - expand(); - } - for (i = 0; i < list->length; ++i) { - data[length++] = list->data[i]; - } -} - -void GooList::insert(int i, void *p) { - if (length >= size) { - expand(); - } - if (i < 0) { - i = 0; - } - if (i < length) { - memmove(data+i+1, data+i, (length - i) * sizeof(void *)); - } - data[i] = p; - ++length; -} - -void *GooList::del(int i) { - void *p; - - p = data[i]; - if (i < length - 1) { - memmove(data+i, data+i+1, (length - i - 1) * sizeof(void *)); - } - --length; - if (size - length >= ((inc > 0) ? inc : size/2)) { - shrink(); - } - return p; -} - -void GooList::sort(int (*cmp)(const void *obj1, const void *obj2)) { - qsort(data, length, sizeof(void *), cmp); -} - -void GooList::reverse() { - void *t; - int n, i; - - n = length / 2; - for (i = 0; i < n; ++i) { - t = data[i]; - data[i] = data[length - 1 - i]; - data[length - 1 - i] = t; - } -} - -void GooList::expand() { - size += (inc > 0) ? inc : size; - data = (void **)greallocn(data, size, sizeof(void*)); -} - -void GooList::shrink() { - size -= (inc > 0) ? inc : size/2; - data = (void **)greallocn(data, size, sizeof(void*)); -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooList.h b/Build/source/libs/poppler/poppler-0.26.3/goo/GooList.h deleted file mode 100644 index c83a0e36a8a..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooList.h +++ /dev/null @@ -1,120 +0,0 @@ -//======================================================================== -// -// GooList.h -// -// Copyright 2001-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GLIST_H -#define GLIST_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "gtypes.h" - -//------------------------------------------------------------------------ -// GooList -//------------------------------------------------------------------------ - -class GooList { -public: - - // Create an empty list. - GooList(); - - // Create an empty list with space for <size1> elements. - GooList(int sizeA); - - // Destructor - does not free pointed-to objects. - ~GooList(); - - //----- general - - // Get the number of elements. - int getLength() { return length; } - - // Returns a (shallow) copy of this list. - GooList *copy(); - - //----- ordered list support - - // Return the <i>th element. - // Assumes 0 <= i < length. - void *get(int i) { return data[i]; } - - // Replace the <i>th element. - // Assumes 0 <= i < length. - void put(int i, void *p) { data[i] = p; } - - // Append an element to the end of the list. - void append(void *p); - - // Append another list to the end of this one. - void append(GooList *list); - - // Insert an element at index <i>. - // Assumes 0 <= i <= length. - void insert(int i, void *p); - - // Deletes and returns the element at index <i>. - // Assumes 0 <= i < length. - void *del(int i); - - // Sort the list accoring to the given comparison function. - // NB: this sorts an array of pointers, so the pointer args need to - // be double-dereferenced. - void sort(int (*cmp)(const void *ptr1, const void *ptr2)); - - // Reverse the list. - void reverse(); - - //----- control - - // Set allocation increment to <inc>. If inc > 0, that many - // elements will be allocated every time the list is expanded. - // If inc <= 0, the list will be doubled in size. - void setAllocIncr(int incA) { inc = incA; } - -private: - GooList(const GooList &other); - GooList& operator=(const GooList &other); - - void expand(); - void shrink(); - - void **data; // the list elements - int size; // size of data array - int length; // number of elements on list - int inc; // allocation increment -}; - -#define deleteGooList(list, T) \ - do { \ - GooList *_list = (list); \ - { \ - int _i; \ - for (_i = 0; _i < _list->getLength(); ++_i) { \ - delete (T*)_list->get(_i); \ - } \ - delete _list; \ - } \ - } while (0) - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooMutex.h b/Build/source/libs/poppler/poppler-0.26.3/goo/GooMutex.h deleted file mode 100644 index b2714b048c7..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooMutex.h +++ /dev/null @@ -1,85 +0,0 @@ -//======================================================================== -// -// GooMutex.h -// -// Portable mutex macros. -// -// Copyright 2002-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> -// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2013 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> -// Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> -// Copyright (C) 2014 Peter Breitenlohner <peb@mppmu.mpg.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GMUTEX_H -#define GMUTEX_H - -// Usage: -// -// GooMutex m; -// gInitMutex(&m); -// ... -// gLockMutex(&m); -// ... critical section ... -// gUnlockMutex(&m); -// ... -// gDestroyMutex(&m); - -#ifdef _WIN32 -#ifndef NOMINMAX -#define NOMINMAX -#endif -#include <windows.h> - -typedef CRITICAL_SECTION GooMutex; - -#define gInitMutex(m) InitializeCriticalSection(m) -#define gDestroyMutex(m) DeleteCriticalSection(m) -#define gLockMutex(m) EnterCriticalSection(m) -#define gUnlockMutex(m) LeaveCriticalSection(m) - -#else // assume pthreads - -#include <pthread.h> - -typedef pthread_mutex_t GooMutex; - -inline void gInitMutex(GooMutex *m) { - pthread_mutexattr_t mutexattr; - pthread_mutexattr_init(&mutexattr); - pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(m, &mutexattr); - pthread_mutexattr_destroy(&mutexattr); -} -#define gDestroyMutex(m) pthread_mutex_destroy(m) -#define gLockMutex(m) pthread_mutex_lock(m) -#define gUnlockMutex(m) pthread_mutex_unlock(m) - -#endif - -class MutexLocker { -public: - MutexLocker(GooMutex *mutexA) : mutex(mutexA) { gLockMutex(mutex); } - ~MutexLocker() { gUnlockMutex(mutex); } - -private: - GooMutex *mutex; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooString.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/GooString.cc deleted file mode 100644 index 8591d95cd3e..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooString.cc +++ /dev/null @@ -1,952 +0,0 @@ -//======================================================================== -// -// GooString.cc -// -// Simple variable-length string type. -// -// Copyright 1996-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> -// Copyright (C) 2007 Jeff Muizelaar <jeff@infidigm.net> -// Copyright (C) 2008-2011 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2011 Kenji Uno <ku@digitaldolphins.jp> -// Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2012 Pino Toscano <pino@kde.org> -// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <ctype.h> -#include <assert.h> -#include <math.h> -#include "gmem.h" -#include "GooString.h" - -static const int MAXIMUM_DOUBLE_PREC = 16; - -//------------------------------------------------------------------------ - -union GooStringFormatArg { - int i; - Guint ui; - long l; - Gulong ul; -#ifdef LLONG_MAX - long long ll; -#endif -#ifdef ULLONG_MAX - unsigned long long ull; -#endif - double f; - char c; - char *s; - GooString *gs; -}; - -enum GooStringFormatType { - fmtIntDecimal, - fmtIntHex, - fmtIntHexUpper, - fmtIntOctal, - fmtIntBinary, - fmtUIntDecimal, - fmtUIntHex, - fmtUIntHexUpper, - fmtUIntOctal, - fmtUIntBinary, - fmtLongDecimal, - fmtLongHex, - fmtLongHexUpper, - fmtLongOctal, - fmtLongBinary, - fmtULongDecimal, - fmtULongHex, - fmtULongHexUpper, - fmtULongOctal, - fmtULongBinary, -#ifdef LLONG_MAX - fmtLongLongDecimal, - fmtLongLongHex, - fmtLongLongHexUpper, - fmtLongLongOctal, - fmtLongLongBinary, -#endif -#ifdef ULLONG_MAX - fmtULongLongDecimal, - fmtULongLongHex, - fmtULongLongHexUpper, - fmtULongLongOctal, - fmtULongLongBinary, -#endif - fmtDouble, - fmtDoubleTrimSmallAware, - fmtDoubleTrim, - fmtChar, - fmtString, - fmtGooString, - fmtSpace -}; - -static const char *formatStrings[] = { - "d", "x", "X", "o", "b", "ud", "ux", "uX", "uo", "ub", - "ld", "lx", "lX", "lo", "lb", "uld", "ulx", "ulX", "ulo", "ulb", -#ifdef LLONG_MAX - "lld", "llx", "llX", "llo", "llb", -#endif -#ifdef ULLONG_MAX - "ulld", "ullx", "ullX", "ullo", "ullb", -#endif - "f", "gs", "g", - "c", - "s", - "t", - "w", - NULL -}; - -//------------------------------------------------------------------------ - -int inline GooString::roundedSize(int len) { - int delta; - if (len <= STR_STATIC_SIZE-1) - return STR_STATIC_SIZE; - delta = len < 256 ? 7 : 255; - return ((len + 1) + delta) & ~delta; -} - -// Make sure that the buffer is big enough to contain <newLength> characters -// plus terminating 0. -// We assume that if this is being called from the constructor, <s> was set -// to NULL and <length> was set to 0 to indicate unused string before calling us. -void inline GooString::resize(int newLength) { - char *s1 = s; - - if (!s || (roundedSize(length) != roundedSize(newLength))) { - // requires re-allocating data for string - if (newLength < STR_STATIC_SIZE) { - s1 = sStatic; - } else { - // allocate a rounded amount - if (s == sStatic) - s1 = (char*)gmalloc(roundedSize(newLength)); - else - s1 = (char*)grealloc(s, roundedSize(newLength)); - } - if (s == sStatic || s1 == sStatic) { - // copy the minimum, we only need to if are moving to or - // from sStatic. - // assert(s != s1) the roundedSize condition ensures this - if (newLength < length) { - memcpy(s1, s, newLength); - } else { - memcpy(s1, s, length); - } - if (s != sStatic) - gfree(s); - } - - } - - s = s1; - length = newLength; - s[length] = '\0'; -} - -GooString* GooString::Set(const char *s1, int s1Len, const char *s2, int s2Len) -{ - int newLen = 0; - char *p; - - if (s1) { - if (CALC_STRING_LEN == s1Len) { - s1Len = strlen(s1); - } else - assert(s1Len >= 0); - newLen += s1Len; - } - - if (s2) { - if (CALC_STRING_LEN == s2Len) { - s2Len = strlen(s2); - } else - assert(s2Len >= 0); - newLen += s2Len; - } - - resize(newLen); - p = s; - if (s1) { - memcpy(p, s1, s1Len); - p += s1Len; - } - if (s2) { - memcpy(p, s2, s2Len); - p += s2Len; - } - return this; -} - -GooString::GooString() { - s = NULL; - length = 0; - Set(NULL); -} - -GooString::GooString(const char *sA) { - s = NULL; - length = 0; - Set(sA, CALC_STRING_LEN); -} - -GooString::GooString(const char *sA, int lengthA) { - s = NULL; - length = 0; - Set(sA, lengthA); -} - -GooString::GooString(GooString *str, int idx, int lengthA) { - s = NULL; - length = 0; - assert(idx + lengthA <= str->length); - Set(str->getCString() + idx, lengthA); -} - -GooString::GooString(const GooString *str) { - s = NULL; - length = 0; - Set(str->getCString(), str->length); -} - -GooString::GooString(GooString *str1, GooString *str2) { - s = NULL; - length = 0; - Set(str1->getCString(), str1->length, str2->getCString(), str2->length); -} - -GooString *GooString::fromInt(int x) { - char buf[24]; // enough space for 64-bit ints plus a little extra - char *p; - int len; - formatInt(x, buf, sizeof(buf), gFalse, 0, 10, &p, &len); - return new GooString(p, len); -} - -GooString *GooString::format(const char *fmt, ...) { - va_list argList; - GooString *s; - - s = new GooString(); - va_start(argList, fmt); - s->appendfv(fmt, argList); - va_end(argList); - return s; -} - -GooString *GooString::formatv(const char *fmt, va_list argList) { - GooString *s; - - s = new GooString(); - s->appendfv(fmt, argList); - return s; -} - -GooString::~GooString() { - if (s != sStatic) - gfree(s); -} - -GooString *GooString::clear() { - resize(0); - return this; -} - -GooString *GooString::append(char c) { - return append((const char*)&c, 1); -} - -GooString *GooString::append(GooString *str) { - return append(str->getCString(), str->getLength()); -} - -GooString *GooString::append(const char *str, int lengthA) { - int prevLen = length; - if (CALC_STRING_LEN == lengthA) - lengthA = strlen(str); - resize(length + lengthA); - memcpy(s + prevLen, str, lengthA); - return this; -} - -GooString *GooString::appendf(const char *fmt, ...) { - va_list argList; - - va_start(argList, fmt); - appendfv(fmt, argList); - va_end(argList); - return this; -} - -GooString *GooString::appendfv(const char *fmt, va_list argList) { - GooStringFormatArg *args; - int argsLen, argsSize; - GooStringFormatArg arg; - int idx, width, prec; - GBool reverseAlign, zeroFill; - GooStringFormatType ft; - char buf[65]; - int len, i; - const char *p0, *p1; - char *str; - - argsLen = 0; - argsSize = 8; - args = (GooStringFormatArg *)gmallocn(argsSize, sizeof(GooStringFormatArg)); - - p0 = fmt; - while (*p0) { - if (*p0 == '{') { - ++p0; - if (*p0 == '{') { - ++p0; - append('{'); - } else { - - // parse the format string - if (!(*p0 >= '0' && *p0 <= '9')) { - break; - } - idx = *p0 - '0'; - for (++p0; *p0 >= '0' && *p0 <= '9'; ++p0) { - idx = 10 * idx + (*p0 - '0'); - } - if (*p0 != ':') { - break; - } - ++p0; - if (*p0 == '-') { - reverseAlign = gTrue; - ++p0; - } else { - reverseAlign = gFalse; - } - width = 0; - zeroFill = *p0 == '0'; - for (; *p0 >= '0' && *p0 <= '9'; ++p0) { - width = 10 * width + (*p0 - '0'); - } - if (width < 0) { - width = 0; - } - if (*p0 == '.') { - ++p0; - prec = 0; - for (; *p0 >= '0' && *p0 <= '9'; ++p0) { - prec = 10 * prec + (*p0 - '0'); - } - } else { - prec = 0; - } - for (ft = (GooStringFormatType)0; - formatStrings[ft]; - ft = (GooStringFormatType)(ft + 1)) { - if (!strncmp(p0, formatStrings[ft], strlen(formatStrings[ft]))) { - break; - } - } - if (!formatStrings[ft]) { - break; - } - p0 += strlen(formatStrings[ft]); - if (*p0 != '}') { - break; - } - ++p0; - - // fetch the argument - if (idx > argsLen) { - break; - } - if (idx == argsLen) { - if (argsLen == argsSize) { - argsSize *= 2; - args = (GooStringFormatArg *)greallocn(args, argsSize, - sizeof(GooStringFormatArg)); - } - switch (ft) { - case fmtIntDecimal: - case fmtIntHex: - case fmtIntHexUpper: - case fmtIntOctal: - case fmtIntBinary: - case fmtSpace: - args[argsLen].i = va_arg(argList, int); - break; - case fmtUIntDecimal: - case fmtUIntHex: - case fmtUIntHexUpper: - case fmtUIntOctal: - case fmtUIntBinary: - args[argsLen].ui = va_arg(argList, Guint); - break; - case fmtLongDecimal: - case fmtLongHex: - case fmtLongHexUpper: - case fmtLongOctal: - case fmtLongBinary: - args[argsLen].l = va_arg(argList, long); - break; - case fmtULongDecimal: - case fmtULongHex: - case fmtULongHexUpper: - case fmtULongOctal: - case fmtULongBinary: - args[argsLen].ul = va_arg(argList, Gulong); - break; -#ifdef LLONG_MAX - case fmtLongLongDecimal: - case fmtLongLongHex: - case fmtLongLongHexUpper: - case fmtLongLongOctal: - case fmtLongLongBinary: - args[argsLen].ll = va_arg(argList, long long); - break; -#endif -#ifdef ULLONG_MAX - case fmtULongLongDecimal: - case fmtULongLongHex: - case fmtULongLongHexUpper: - case fmtULongLongOctal: - case fmtULongLongBinary: - args[argsLen].ull = va_arg(argList, unsigned long long); - break; -#endif - case fmtDouble: - case fmtDoubleTrim: - case fmtDoubleTrimSmallAware: - args[argsLen].f = va_arg(argList, double); - break; - case fmtChar: - args[argsLen].c = (char)va_arg(argList, int); - break; - case fmtString: - args[argsLen].s = va_arg(argList, char *); - break; - case fmtGooString: - args[argsLen].gs = va_arg(argList, GooString *); - break; - } - ++argsLen; - } - - // format the argument - arg = args[idx]; - switch (ft) { - case fmtIntDecimal: - formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 10, &str, &len); - break; - case fmtIntHex: - formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 16, &str, &len); - break; - case fmtIntHexUpper: - formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 16, &str, &len, - gTrue); - break; - case fmtIntOctal: - formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 8, &str, &len); - break; - case fmtIntBinary: - formatInt(arg.i, buf, sizeof(buf), zeroFill, width, 2, &str, &len); - break; - case fmtUIntDecimal: - formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 10, - &str, &len); - break; - case fmtUIntHex: - formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 16, - &str, &len); - break; - case fmtUIntHexUpper: - formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 16, - &str, &len, gTrue); - break; - case fmtUIntOctal: - formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 8, &str, &len); - break; - case fmtUIntBinary: - formatUInt(arg.ui, buf, sizeof(buf), zeroFill, width, 2, &str, &len); - break; - case fmtLongDecimal: - formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 10, &str, &len); - break; - case fmtLongHex: - formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 16, &str, &len); - break; - case fmtLongHexUpper: - formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 16, &str, &len, - gTrue); - break; - case fmtLongOctal: - formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 8, &str, &len); - break; - case fmtLongBinary: - formatInt(arg.l, buf, sizeof(buf), zeroFill, width, 2, &str, &len); - break; - case fmtULongDecimal: - formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 10, - &str, &len); - break; - case fmtULongHex: - formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 16, - &str, &len); - break; - case fmtULongHexUpper: - formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 16, - &str, &len, gTrue); - break; - case fmtULongOctal: - formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 8, &str, &len); - break; - case fmtULongBinary: - formatUInt(arg.ul, buf, sizeof(buf), zeroFill, width, 2, &str, &len); - break; -#ifdef LLONG_MAX - case fmtLongLongDecimal: - formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 10, &str, &len); - break; - case fmtLongLongHex: - formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 16, &str, &len); - break; - case fmtLongLongHexUpper: - formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 16, &str, &len, - gTrue); - break; - case fmtLongLongOctal: - formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 8, &str, &len); - break; - case fmtLongLongBinary: - formatInt(arg.ll, buf, sizeof(buf), zeroFill, width, 2, &str, &len); - break; -#endif -#ifdef ULLONG_MAX - case fmtULongLongDecimal: - formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 10, - &str, &len); - break; - case fmtULongLongHex: - formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 16, - &str, &len); - break; - case fmtULongLongHexUpper: - formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 16, - &str, &len, gTrue); - break; - case fmtULongLongOctal: - formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 8, - &str, &len); - break; - case fmtULongLongBinary: - formatUInt(arg.ull, buf, sizeof(buf), zeroFill, width, 2, - &str, &len); - break; -#endif - case fmtDouble: - formatDouble(arg.f, buf, sizeof(buf), prec, gFalse, &str, &len); - break; - case fmtDoubleTrim: - formatDouble(arg.f, buf, sizeof(buf), prec, gTrue, &str, &len); - break; - case fmtDoubleTrimSmallAware: - formatDoubleSmallAware(arg.f, buf, sizeof(buf), prec, gTrue, &str, &len); - break; - case fmtChar: - buf[0] = arg.c; - str = buf; - len = 1; - reverseAlign = !reverseAlign; - break; - case fmtString: - str = arg.s; - len = strlen(str); - reverseAlign = !reverseAlign; - break; - case fmtGooString: - str = arg.gs->getCString(); - len = arg.gs->getLength(); - reverseAlign = !reverseAlign; - break; - case fmtSpace: - str = buf; - len = 0; - width = arg.i; - break; - } - - // append the formatted arg, handling width and alignment - if (!reverseAlign && len < width) { - for (i = len; i < width; ++i) { - append(' '); - } - } - append(str, len); - if (reverseAlign && len < width) { - for (i = len; i < width; ++i) { - append(' '); - } - } - } - - } else if (*p0 == '}') { - ++p0; - if (*p0 == '}') { - ++p0; - } - append('}'); - - } else { - for (p1 = p0 + 1; *p1 && *p1 != '{' && *p1 != '}'; ++p1) ; - append(p0, p1 - p0); - p0 = p1; - } - } - - gfree(args); - return this; -} - -static const char lowerCaseDigits[17] = "0123456789abcdef"; -static const char upperCaseDigits[17] = "0123456789ABCDEF"; - -#ifdef LLONG_MAX -void GooString::formatInt(long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase) { -#else -void GooString::formatInt(long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase) { -#endif - const char *vals = upperCase ? upperCaseDigits : lowerCaseDigits; - GBool neg; - int start, i, j; -#ifdef LLONG_MAX - unsigned long long abs_x; -#else - unsigned long abs_x; -#endif - - i = bufSize; - if ((neg = x < 0)) { - abs_x = -x; - } else { - abs_x = x; - } - start = neg ? 1 : 0; - if (abs_x == 0) { - buf[--i] = '0'; - } else { - while (i > start && abs_x) { - buf[--i] = vals[abs_x % base]; - abs_x /= base; - } - } - if (zeroFill) { - for (j = bufSize - i; i > start && j < width - start; ++j) { - buf[--i] = '0'; - } - } - if (neg) { - buf[--i] = '-'; - } - *p = buf + i; - *len = bufSize - i; -} - -#ifdef ULLONG_MAX -void GooString::formatUInt(unsigned long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase) { -#else -void GooString::formatUInt(Gulong x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase) { -#endif - const char *vals = upperCase ? upperCaseDigits : lowerCaseDigits; - int i, j; - - i = bufSize; - if (x == 0) { - buf[--i] = '0'; - } else { - while (i > 0 && x) { - buf[--i] = vals[x % base]; - x /= base; - } - } - if (zeroFill) { - for (j = bufSize - i; i > 0 && j < width; ++j) { - buf[--i] = '0'; - } - } - *p = buf + i; - *len = bufSize - i; -} - -void GooString::formatDouble(double x, char *buf, int bufSize, int prec, - GBool trim, char **p, int *len) { - GBool neg, started; - double x2; - int d, i, j; - - if ((neg = x < 0)) { - x = -x; - } - x = floor(x * pow(10.0, prec) + 0.5); - i = bufSize; - started = !trim; - for (j = 0; j < prec && i > 1; ++j) { - x2 = floor(0.1 * (x + 0.5)); - d = (int)floor(x - 10 * x2 + 0.5); - if (started || d != 0) { - buf[--i] = '0' + d; - started = gTrue; - } - x = x2; - } - if (i > 1 && started) { - buf[--i] = '.'; - } - if (i > 1) { - do { - x2 = floor(0.1 * (x + 0.5)); - d = (int)floor(x - 10 * x2 + 0.5); - buf[--i] = '0' + d; - x = x2; - } while (i > 1 && x); - } - if (neg) { - buf[--i] = '-'; - } - *p = buf + i; - *len = bufSize - i; -} - -void GooString::formatDoubleSmallAware(double x, char *buf, int bufSize, int prec, - GBool trim, char **p, int *len) -{ - double absX = fabs(x); - if (absX >= 0.1) { - formatDouble(x, buf, bufSize, prec, trim, p, len); - } else { - while (absX < 0.1 && prec < MAXIMUM_DOUBLE_PREC) - { - absX = absX * 10; - prec++; - } - formatDouble(x, buf, bufSize, prec, trim, p, len); - } -} - -GooString *GooString::insert(int i, char c) { - return insert(i, (const char*)&c, 1); -} - -GooString *GooString::insert(int i, GooString *str) { - return insert(i, str->getCString(), str->getLength()); -} - -GooString *GooString::insert(int i, const char *str, int lengthA) { - int prevLen = length; - if (CALC_STRING_LEN == lengthA) - lengthA = strlen(str); - - resize(length + lengthA); - memmove(s+i+lengthA, s+i, prevLen-i); - memcpy(s+i, str, lengthA); - return this; -} - -GooString *GooString::del(int i, int n) { - int j; - - if (i >= 0 && n > 0 && i + n > 0) { - if (i + n > length) { - n = length - i; - } - for (j = i; j <= length - n; ++j) { - s[j] = s[j + n]; - } - resize(length - n); - } - return this; -} - -GooString *GooString::upperCase() { - int i; - - for (i = 0; i < length; ++i) { - if (islower(s[i])) - s[i] = toupper(s[i]); - } - return this; -} - -GooString *GooString::lowerCase() { - int i; - - for (i = 0; i < length; ++i) { - if (isupper(s[i])) - s[i] = tolower(s[i]); - } - return this; -} - -int GooString::cmp(GooString *str) const { - int n1, n2, i, x; - char *p1, *p2; - - n1 = length; - n2 = str->length; - for (i = 0, p1 = s, p2 = str->s; i < n1 && i < n2; ++i, ++p1, ++p2) { - x = *p1 - *p2; - if (x != 0) { - return x; - } - } - return n1 - n2; -} - -int GooString::cmpN(GooString *str, int n) const { - int n1, n2, i, x; - char *p1, *p2; - - n1 = length; - n2 = str->length; - for (i = 0, p1 = s, p2 = str->s; - i < n1 && i < n2 && i < n; - ++i, ++p1, ++p2) { - x = *p1 - *p2; - if (x != 0) { - return x; - } - } - if (i == n) { - return 0; - } - return n1 - n2; -} - -int GooString::cmp(const char *sA) const { - int n1, i, x; - const char *p1, *p2; - - n1 = length; - for (i = 0, p1 = s, p2 = sA; i < n1 && *p2; ++i, ++p1, ++p2) { - x = *p1 - *p2; - if (x != 0) { - return x; - } - } - if (i < n1) { - return 1; - } - if (*p2) { - return -1; - } - return 0; -} - -int GooString::cmpN(const char *sA, int n) const { - int n1, i, x; - const char *p1, *p2; - - n1 = length; - for (i = 0, p1 = s, p2 = sA; i < n1 && *p2 && i < n; ++i, ++p1, ++p2) { - x = *p1 - *p2; - if (x != 0) { - return x; - } - } - if (i == n) { - return 0; - } - if (i < n1) { - return 1; - } - if (*p2) { - return -1; - } - return 0; -} - -GBool GooString::endsWith(const char *suffix) const { - int suffixLen = strlen(suffix); - - if (length < suffixLen) - return gFalse; - - return strcmp(s + length - suffixLen, suffix) == 0; -} - -GBool GooString::hasUnicodeMarker(void) -{ - return length > 1 && (s[0] & 0xff) == 0xfe && (s[1] & 0xff) == 0xff; -} - -GooString *GooString::sanitizedName(GBool psmode) -{ - GooString *name; - char buf[8]; - int i; - char c; - - name = new GooString(); - - if (psmode) - { - // ghostscript chokes on names that begin with out-of-limits - // numbers, e.g., 1e4foo is handled correctly (as a name), but - // 1e999foo generates a limitcheck error - c = getChar(0); - if (c >= '0' && c <= '9') { - name->append('f'); - } - } - - for (i = 0; i < getLength(); ++i) { - c = getChar(i); - if (c <= (char)0x20 || c >= (char)0x7f || - c == ' ' || - c == '(' || c == ')' || c == '<' || c == '>' || - c == '[' || c == ']' || c == '{' || c == '}' || - c == '/' || c == '%' || c == '#') { - sprintf(buf, "#%02x", c & 0xff); - name->append(buf); - } else { - name->append(c); - } - } - return name; -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooString.h b/Build/source/libs/poppler/poppler-0.26.3/goo/GooString.h deleted file mode 100644 index b8020b62992..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooString.h +++ /dev/null @@ -1,224 +0,0 @@ -//======================================================================== -// -// GooString.h -// -// Simple variable-length string type. -// -// Copyright 1996-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com> -// Copyright (C) 2008-2010, 2012 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2012-2014 Fabio D'Urso <fabiodurso@hotmail.it> -// Copyright (C) 2013 Jason Crain <jason@aquaticape.us> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GooString_H -#define GooString_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include <limits.h> // for LLONG_MAX and ULLONG_MAX - -/* <limits.h> and/or the compiler may or may not define these. */ -/* Minimum and maximum values a `signed long long int' can hold. */ -#ifndef LLONG_MAX -# define LLONG_MAX 9223372036854775807LL -#endif -#ifndef LLONG_MIN -# define LLONG_MIN (-LLONG_MAX - 1LL) -#endif - -/* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */ -#ifndef ULLONG_MAX -# define ULLONG_MAX 18446744073709551615ULL -#endif - -#include <stdarg.h> -#include <stdlib.h> // for NULL -#include "gtypes.h" - -#ifdef __clang__ -# define GOOSTRING_FORMAT __attribute__((__annotate__("gooformat"))) -#else -# define GOOSTRING_FORMAT -#endif - -class GooString { -public: - - // Create an empty string. - GooString(); - - // Create a string from a C string. - explicit GooString(const char *sA); - - // Create a string from <lengthA> chars at <sA>. This string - // can contain null characters. - GooString(const char *sA, int lengthA); - - // Create a string from <lengthA> chars at <idx> in <str>. - GooString(GooString *str, int idx, int lengthA); - - // Set content of a string to concatination of <s1> and <s2>. They can both - // be NULL. if <s1Len> or <s2Len> is CALC_STRING_LEN, then length of the string - // will be calculated with strlen(). Otherwise we assume they are a valid - // length of string (or its substring) - GooString* Set(const char *s1, int s1Len=CALC_STRING_LEN, const char *s2=NULL, int s2Len=CALC_STRING_LEN); - - // Copy a string. - explicit GooString(const GooString *str); - GooString *copy() const { return new GooString(this); } - - // Concatenate two strings. - GooString(GooString *str1, GooString *str2); - - // Convert an integer to a string. - static GooString *fromInt(int x); - - // Create a formatted string. Similar to printf, but without the - // string overflow issues. Formatting elements consist of: - // {<arg>:[<width>][.<precision>]<type>} - // where: - // - <arg> is the argument number (arg 0 is the first argument - // following the format string) -- NB: args must be first used in - // order; they can be reused in any order - // - <width> is the field width -- negative to reverse the alignment; - // starting with a leading zero to zero-fill (for integers) - // - <precision> is the number of digits to the right of the decimal - // point (for floating point numbers) - // - <type> is one of: - // d, x, X, o, b -- int in decimal, lowercase hex, uppercase hex, octal, binary - // ud, ux, uX, uo, ub -- unsigned int - // ld, lx, lX, lo, lb, uld, ulx, ulX, ulo, ulb -- long, unsigned long - // lld, llx, llX, llo, llb, ulld, ullx, ullX, ullo, ullb - // -- long long, unsigned long long - // f, g, gs -- floating point (float or double) - // f -- always prints trailing zeros (eg 1.0 with .2f will print 1.00) - // g -- omits trailing zeros and, if possible, the dot (eg 1.0 shows up as 1) - // gs -- is like g, but treats <precision> as number of significant - // digits to show (eg 0.0123 with .2gs will print 0.012) - // c -- character (char, short or int) - // s -- string (char *) - // t -- GooString * - // w -- blank space; arg determines width - // To get literal curly braces, use {{ or }}. - static GooString *format(const char *fmt, ...) GOOSTRING_FORMAT; - static GooString *formatv(const char *fmt, va_list argList); - - // Destructor. - ~GooString(); - - // Get length. - int getLength() { return length; } - - // Get C string. - char *getCString() const { return s; } - - // Get <i>th character. - char getChar(int i) { return s[i]; } - - // Change <i>th character. - void setChar(int i, char c) { s[i] = c; } - - // Clear string to zero length. - GooString *clear(); - - // Append a character or string. - GooString *append(char c); - GooString *append(GooString *str); - GooString *append(const char *str, int lengthA=CALC_STRING_LEN); - - // Append a formatted string. - GooString *appendf(const char *fmt, ...) GOOSTRING_FORMAT; - GooString *appendfv(const char *fmt, va_list argList); - - // Insert a character or string. - GooString *insert(int i, char c); - GooString *insert(int i, GooString *str); - GooString *insert(int i, const char *str, int lengthA=CALC_STRING_LEN); - - // Delete a character or range of characters. - GooString *del(int i, int n = 1); - - // Convert string to all-upper/all-lower case. - GooString *upperCase(); - GooString *lowerCase(); - - // Compare two strings: -1:< 0:= +1:> - int cmp(GooString *str) const; - int cmpN(GooString *str, int n) const; - int cmp(const char *sA) const; - int cmpN(const char *sA, int n) const; - - // Return true if string ends with suffix - GBool endsWith(const char *suffix) const; - - GBool hasUnicodeMarker(void); - - // 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); - -private: - GooString(const GooString &other); - GooString& operator=(const GooString &other); - - // you can tweak this number for a different speed/memory usage tradeoffs. - // In libc malloc() rounding is 16 so it's best to choose a value that - // results in sizeof(GooString) be a multiple of 16. - // 24 makes sizeof(GooString) to be 32. - static const int STR_STATIC_SIZE = 24; - // a special value telling that the length of the string is not given - // so it must be calculated from the strings - static const int CALC_STRING_LEN = -1; - - int roundedSize(int len); - - char sStatic[STR_STATIC_SIZE]; - int length; - char *s; - - void resize(int newLength); -#ifdef LLONG_MAX - static void formatInt(long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase = gFalse); -#else - static void formatInt(long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase = gFalse); -#endif -#ifdef ULLONG_MAX - static void formatUInt(unsigned long long x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase = gFalse); -#else - static void formatUInt(Gulong x, char *buf, int bufSize, - GBool zeroFill, int width, int base, - char **p, int *len, GBool upperCase = gFalse); -#endif - static void formatDouble(double x, char *buf, int bufSize, int prec, - GBool trim, char **p, int *len); - static void formatDoubleSmallAware(double x, char *buf, int bufSize, int prec, - GBool trim, char **p, int *len); -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooTimer.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/GooTimer.cc deleted file mode 100644 index c766c6bf2e4..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooTimer.cc +++ /dev/null @@ -1,95 +0,0 @@ -//======================================================================== -// -// GooTimer.cc -// -// This file is licensed under GPLv2 or later -// -// Copyright 2005 Jonathan Blandford <jrb@redhat.com> -// Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com> -// Copyright 2010 Hib Eris <hib@hiberis.nl> -// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team -// -//======================================================================== - -#include <config.h> - -#ifdef USE_GCC_PRAGMAS -#pragma implementation -#endif - -#include "GooTimer.h" -#include <string.h> - -#define USEC_PER_SEC 1000000 - -//------------------------------------------------------------------------ -// GooTimer -//------------------------------------------------------------------------ - -GooTimer::GooTimer() { - start(); -} - -void GooTimer::start() { -#ifdef HAVE_GETTIMEOFDAY - gettimeofday(&start_time, NULL); -#elif defined(_WIN32) - QueryPerformanceCounter(&start_time); -#endif - active = true; -} - -void GooTimer::stop() { -#ifdef HAVE_GETTIMEOFDAY - gettimeofday(&end_time, NULL); -#elif defined(_WIN32) - QueryPerformanceCounter(&end_time); -#endif - active = false; -} - -#ifdef HAVE_GETTIMEOFDAY -double GooTimer::getElapsed() -{ - double total; - struct timeval elapsed; - - if (active) - gettimeofday(&end_time, NULL); - - if (start_time.tv_usec > end_time.tv_usec) { - end_time.tv_usec += USEC_PER_SEC; - end_time.tv_sec--; - } - - elapsed.tv_usec = end_time.tv_usec - start_time.tv_usec; - elapsed.tv_sec = end_time.tv_sec - start_time.tv_sec; - - total = elapsed.tv_sec + ((double) elapsed.tv_usec / 1e6); - if (total < 0) - total = 0; - - return total; -} -#elif defined(_WIN32) -double GooTimer::getElapsed() -{ - LARGE_INTEGER freq; - double time_in_secs; - QueryPerformanceFrequency(&freq); - - if (active) - QueryPerformanceCounter(&end_time); - - time_in_secs = (double)(end_time.QuadPart-start_time.QuadPart)/(double)freq.QuadPart; - return time_in_secs * 1000.0; - -} -#else -double GooTimer::getElapsed() -{ -#warning "no support for GooTimer" - return 0; -} -#endif - diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/GooTimer.h b/Build/source/libs/poppler/poppler-0.26.3/goo/GooTimer.h deleted file mode 100644 index ac64f6b4868..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/GooTimer.h +++ /dev/null @@ -1,62 +0,0 @@ -//======================================================================== -// -// GooTimer.cc -// -// This file is licensed under GPLv2 or later -// -// Copyright 2005 Jonathan Blandford <jrb@redhat.com> -// Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com> -// Copyright 2010 Hib Eris <hib@hiberis.nl> -// Copyright 2011 Albert Astals cid <aacid@kde.org> -// Copyright 2014 Bogdan Cristea <cristeab@gmail.com> -// Copyright 2014 Peter Breitenlohner <peb@mppmu.mpg.de> -// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team -// -//======================================================================== - -#ifndef GOOTIMER_H -#define GOOTIMER_H - -#ifdef USE_GCC_PRAGMAS -#pragma interface -#endif - -#include "poppler-config.h" -#include "gtypes.h" -#ifdef HAVE_GETTIMEOFDAY -#include <sys/time.h> -#endif - -#ifdef _WIN32 -#ifndef NOMINMAX -#define NOMINMAX -#endif -#include <windows.h> -#endif - -//------------------------------------------------------------------------ -// GooTimer -//------------------------------------------------------------------------ - -class GooTimer { -public: - - // Create a new timer. - GooTimer(); - - void start(); - void stop(); - double getElapsed(); - -private: -#ifdef HAVE_GETTIMEOFDAY - struct timeval start_time; - struct timeval end_time; -#elif defined(_WIN32) - LARGE_INTEGER start_time; - LARGE_INTEGER end_time; -#endif - GBool active; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/ImgWriter.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/ImgWriter.cc deleted file mode 100644 index a30d26d89ad..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/ImgWriter.cc +++ /dev/null @@ -1,15 +0,0 @@ -//======================================================================== -// -// ImgWriter.cpp -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org> -// -//======================================================================== - -#include "ImgWriter.h" - -ImgWriter::~ImgWriter() -{ -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/ImgWriter.h b/Build/source/libs/poppler/poppler-0.26.3/goo/ImgWriter.h deleted file mode 100644 index 8feb3511e4d..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/ImgWriter.h +++ /dev/null @@ -1,33 +0,0 @@ -//======================================================================== -// -// ImgWriter.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com> -// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de> -// -//======================================================================== - -#ifndef IMGWRITER_H -#define IMGWRITER_H - -#include <stdio.h> - -class ImgWriter -{ -public: - virtual ~ImgWriter(); - virtual bool init(FILE *f, int width, int height, int hDPI, int vDPI) = 0; - - virtual bool writePointers(unsigned char **rowPointers, int rowCount) = 0; - virtual bool writeRow(unsigned char **row) = 0; - - virtual bool close() = 0; - virtual bool supportCMYK() { return false; } -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/JpegWriter.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/JpegWriter.cc deleted file mode 100644 index 9b7c5051838..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/JpegWriter.cc +++ /dev/null @@ -1,184 +0,0 @@ -//======================================================================== -// -// JpegWriter.cc -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2012 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> -// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de> -// Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de> -// -//======================================================================== - -#include "JpegWriter.h" - -#ifdef ENABLE_LIBJPEG - -extern "C" { -#include <jpeglib.h> -} - -#include "poppler/Error.h" - -struct JpegWriterPrivate { - bool progressive; - int quality; - JpegWriter::Format format; - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; -}; - -void outputMessage(j_common_ptr cinfo) -{ - char buffer[JMSG_LENGTH_MAX]; - - // Create the message - (*cinfo->err->format_message) (cinfo, buffer); - - // Send it to poppler's error handler - error(errInternal, -1, "{0:s}", buffer); -} - -JpegWriter::JpegWriter(int q, bool p, Format formatA) -{ - priv = new JpegWriterPrivate; - priv->progressive = p; - priv->quality = q; - priv->format = formatA; -} - -JpegWriter::JpegWriter(Format formatA) -{ - priv = new JpegWriterPrivate; - priv->progressive = false; - priv->quality = -1; - priv->format = formatA; -} - -JpegWriter::~JpegWriter() -{ - // cleanup - jpeg_destroy_compress(&priv->cinfo); - delete priv; -} - -bool JpegWriter::init(FILE *f, int width, int height, int hDPI, int vDPI) -{ - // Setup error handler - priv->cinfo.err = jpeg_std_error(&priv->jerr); - priv->jerr.output_message = &outputMessage; - - // Initialize libjpeg - jpeg_create_compress(&priv->cinfo); - - // First set colorspace and call jpeg_set_defaults() since - // jpeg_set_defaults() sets default values for all fields in - // cinfo based on the colorspace. - switch (priv->format) { - case RGB: - priv->cinfo.in_color_space = JCS_RGB; - break; - case GRAY: - priv->cinfo.in_color_space = JCS_GRAYSCALE; - break; - case CMYK: - priv->cinfo.in_color_space = JCS_CMYK; - break; - default: - return false; - } - jpeg_set_defaults(&priv->cinfo); - - // Set destination file - jpeg_stdio_dest(&priv->cinfo, f); - - // Set libjpeg configuration - priv->cinfo.image_width = width; - priv->cinfo.image_height = height; - priv->cinfo.density_unit = 1; // dots per inch - priv->cinfo.X_density = hDPI; - priv->cinfo.Y_density = vDPI; - switch (priv->format) { - case GRAY: - priv->cinfo.input_components = 1; - break; - case RGB: - priv->cinfo.input_components = 3; - break; - case CMYK: - priv->cinfo.input_components = 4; - jpeg_set_colorspace(&priv->cinfo, JCS_YCCK); - priv->cinfo.write_JFIF_header = TRUE; - break; - default: - return false; - } - - // Set quality - if (priv->quality >= 0 && priv->quality <= 100) { - jpeg_set_quality(&priv->cinfo, priv->quality, TRUE); - } - - // Use progressive mode - if (priv->progressive) { - jpeg_simple_progression(&priv->cinfo); - } - - // Get ready for data - jpeg_start_compress(&priv->cinfo, TRUE); - - return true; -} - -bool JpegWriter::writePointers(unsigned char **rowPointers, int rowCount) -{ - if (priv->format == CMYK) { - for (int y = 0; y < rowCount; y++) { - unsigned char *row = rowPointers[y]; - for (unsigned int x = 0; x < priv->cinfo.image_width; x++) { - for (int n = 0; n < 4; n++) { - *row = 0xff - *row; - row++; - } - } - } - } - // Write all rows to the file - jpeg_write_scanlines(&priv->cinfo, rowPointers, rowCount); - - return true; -} - -bool JpegWriter::writeRow(unsigned char **rowPointer) -{ - if (priv->format == CMYK) { - unsigned char *row = rowPointer[0]; - for (unsigned int x = 0; x < priv->cinfo.image_width; x++) { - for (int n = 0; n < 4; n++) { - *row = 0xff - *row; - row++; - } - } - } - // Write the row to the file - jpeg_write_scanlines(&priv->cinfo, rowPointer, 1); - - return true; -} - -bool JpegWriter::close() -{ - jpeg_finish_compress(&priv->cinfo); - - return true; -} - -bool JpegWriter::supportCMYK() -{ - return priv->format == CMYK; -} - - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/JpegWriter.h b/Build/source/libs/poppler/poppler-0.26.3/goo/JpegWriter.h deleted file mode 100644 index d69bbbb8dda..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/JpegWriter.h +++ /dev/null @@ -1,59 +0,0 @@ -//======================================================================== -// -// JpegWriter.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2012 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2010 Jürg Billeter <j@bitron.ch> -// Copyright (C) 2010 Harry Roberts <harry.roberts@midnight-labs.org> -// Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com> -// Copyright (C) 2011 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de> -// -//======================================================================== - -#ifndef JPEGWRITER_H -#define JPEGWRITER_H - -#include "poppler-config.h" - -#ifdef ENABLE_LIBJPEG - -#include <sys/types.h> -#include "ImgWriter.h" - -struct JpegWriterPrivate; - -class JpegWriter : public ImgWriter -{ -public: - /* RGB - 3 bytes/pixel - * GRAY - 1 byte/pixel - * CMYK - 4 bytes/pixel - */ - enum Format { RGB, GRAY, CMYK }; - - JpegWriter(int quality, bool progressive, Format format = RGB); - JpegWriter(Format format = RGB); - ~JpegWriter(); - - bool init(FILE *f, int width, int height, int hDPI, int vDPI); - - bool writePointers(unsigned char **rowPointers, int rowCount); - bool writeRow(unsigned char **row); - - bool close(); - bool supportCMYK(); - -private: - JpegWriter(const JpegWriter &other); - JpegWriter& operator=(const JpegWriter &other); - - JpegWriterPrivate *priv; -}; - -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/Makefile.am b/Build/source/libs/poppler/poppler-0.26.3/goo/Makefile.am deleted file mode 100644 index a48b20ec493..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -noinst_LTLIBRARIES = libgoo.la - -if ENABLE_XPDF_HEADERS - -poppler_goo_includedir = $(includedir)/poppler/goo -poppler_goo_include_HEADERS = \ - GooHash.h \ - GooList.h \ - GooTimer.h \ - GooMutex.h \ - GooString.h \ - gtypes.h \ - gmem.h \ - gfile.h \ - FixedPoint.h \ - NetPBMWriter.h \ - PNGWriter.h \ - JpegWriter.h \ - TiffWriter.h \ - ImgWriter.h \ - GooLikely.h \ - gstrtod.h \ - grandom.h - -endif - -if BUILD_LIBJPEG -libjpeg_includes = $(LIBJPEG_CFLAGS) -endif - -if BUILD_LIBTIFF -libtiff_includes = $(LIBTIFF_CFLAGS) -endif - -if BUILD_LIBOPENJPEG -libjpeg2000_includes = $(LIBOPENJPEG_CFLAGS) -endif - -if BUILD_LIBPNG -libpng_includes = $(LIBPNG_CFLAGS) -endif - -INCLUDES = \ - -I$(top_srcdir) \ - $(libjpeg_includes) \ - $(libtiff_includes) \ - $(libjpeg2000_includes) \ - $(libpng_includes) - -libgoo_la_SOURCES = \ - gfile.cc \ - gmempp.cc \ - GooHash.cc \ - GooList.cc \ - GooTimer.cc \ - GooString.cc \ - gmem.cc \ - FixedPoint.cc \ - NetPBMWriter.cc \ - PNGWriter.cc \ - JpegWriter.cc \ - TiffWriter.cc \ - ImgWriter.cc \ - gtypes_p.h \ - gstrtod.cc \ - grandom.cc diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/NetPBMWriter.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/NetPBMWriter.cc deleted file mode 100644 index fca00b26b1a..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/NetPBMWriter.cc +++ /dev/null @@ -1,84 +0,0 @@ -//======================================================================== -// -// NetPBMWriter.h -// -// Copyright 1998-2003 Glyph & Cog, LLC -// -//======================================================================== -// -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2005, 2007, 2011 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2006 Rainer Keller <class321@gmx.de> -// Copyright (C) 2008 Timothy Lee <timothy.lee@siriushk.com> -// Copyright (C) 2008 Vasile Gaburici <gaburici@cs.umd.edu> -// Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org> -// Copyright (C) 2009 William Bader <williambader@hotmail.com> -// Copyright (C) 2010 Jakob Voss <jakob.voss@gbv.de> -// Copyright (C) 2012, 2013 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2013 Thomas Fischer <fischer@unix-ag.uni-kl.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include "poppler-config.h" - -#include "NetPBMWriter.h" - -// Writer for the NetPBM formats (PBM and PPM) -// This format is documented at: -// http://netpbm.sourceforge.net/doc/pbm.html -// http://netpbm.sourceforge.net/doc/ppm.html - -NetPBMWriter::NetPBMWriter(Format formatA) : format(formatA) -{ -} - -bool NetPBMWriter::init(FILE *f, int widthA, int heightA, int hDPI, int vDPI) -{ - file = f; - width = widthA; - if (format == MONOCHROME) { - fprintf(file, "P4\n"); - fprintf(file, "%d %d\n", widthA, heightA); - } else { - fprintf(file, "P6\n"); - fprintf(file, "%d %d\n", widthA, heightA); - fprintf(file, "255\n"); - } - return true; -} - -bool NetPBMWriter::writePointers(unsigned char **rowPointers, int rowCount) -{ - for (int i = 0; i < rowCount; i++) - writeRow(&rowPointers[i]); - return true; -} - -bool NetPBMWriter::writeRow(unsigned char **row) -{ - if (format == MONOCHROME) { - // PBM uses 0 = white, 1 = black so we need to invert the colors - int size = (width + 7)/8; - for (int i = 0; i < size; i++) - fputc((*row)[i] ^ 0xff, file); - } else { - fwrite(*row, 1, width*3, file); - } - return true; -} - - -bool NetPBMWriter::close() -{ - return true; -} - diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/NetPBMWriter.h b/Build/source/libs/poppler/poppler-0.26.3/goo/NetPBMWriter.h deleted file mode 100644 index 21a19ee7508..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/NetPBMWriter.h +++ /dev/null @@ -1,52 +0,0 @@ -//======================================================================== -// -// NetPBMWriter.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2010, 2013 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2010 Brian Cameron <brian.cameron@oracle.com> -// Copyright (C) 2011 Thomas Freitag <Thomas.Freitag@alfa.de> -// -//======================================================================== - -#ifndef NETPBMWRITER_H -#define NETPBMWRITER_H - -#include "poppler-config.h" - -#include "ImgWriter.h" - -// Writer for the NetPBM formats (PBM and PPM) -// This format is documented at: -// http://netpbm.sourceforge.net/doc/pbm.html -// http://netpbm.sourceforge.net/doc/ppm.html - -class NetPBMWriter : public ImgWriter -{ -public: - - /* RGB - 3 bytes/pixel - * MONOCHROME - 8 pixels/byte - */ - enum Format { RGB, MONOCHROME }; - - NetPBMWriter(Format formatA = RGB); - ~NetPBMWriter() {}; - - bool init(FILE *f, int width, int height, int hDPI, int vDPI); - - bool writePointers(unsigned char **rowPointers, int rowCount); - bool writeRow(unsigned char **row); - - bool close(); - -private: - FILE *file; - Format format; - int width; -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/PNGWriter.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/PNGWriter.cc deleted file mode 100644 index c9d5199d040..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/PNGWriter.cc +++ /dev/null @@ -1,189 +0,0 @@ -//======================================================================== -// -// PNGWriter.cc -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Warren Toomey <wkt@tuhs.org> -// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> -// Copyright (C) 2009, 2011 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2011, 2013 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2011 Thomas Klausner <wiz@danbala.tuwien.ac.at> -// Copyright (C) 2012 Pino Toscano <pino@kde.org> -// -//======================================================================== - -#include "PNGWriter.h" - -#ifdef ENABLE_LIBPNG - -#include <zlib.h> -#include <stdlib.h> -#include <string.h> - -#include "poppler/Error.h" -#include "goo/gmem.h" - -#include <png.h> - -struct PNGWriterPrivate { - PNGWriter::Format format; - png_structp png_ptr; - png_infop info_ptr; - unsigned char *icc_data; - int icc_data_size; - char *icc_name; - bool sRGB_profile; -}; - -PNGWriter::PNGWriter(Format formatA) -{ - priv = new PNGWriterPrivate; - priv->format = formatA; - priv->icc_data = NULL; - priv->icc_data_size = 0; - priv->icc_name = NULL; - priv->sRGB_profile = false; -} - -PNGWriter::~PNGWriter() -{ - /* cleanup heap allocation */ - png_destroy_write_struct(&priv->png_ptr, &priv->info_ptr); - if (priv->icc_data) { - gfree(priv->icc_data); - free(priv->icc_name); - } - - delete priv; -} - -void PNGWriter::setICCProfile(const char *name, unsigned char *data, int size) -{ - priv->icc_data = (unsigned char *)gmalloc(size); - memcpy(priv->icc_data, data, size); - priv->icc_data_size = size; - priv->icc_name = strdup(name); -} - -void PNGWriter::setSRGBProfile() -{ - priv->sRGB_profile = true; -} - -bool PNGWriter::init(FILE *f, int width, int height, int hDPI, int vDPI) -{ - /* libpng changed the png_set_iCCP() prototype in 1.5.0 */ -#if PNG_LIBPNG_VER < 10500 - png_charp icc_data_ptr = (png_charp)priv->icc_data; -#else - png_const_bytep icc_data_ptr = (png_const_bytep)priv->icc_data; -#endif - - /* initialize stuff */ - priv->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!priv->png_ptr) { - error(errInternal, -1, "png_create_write_struct failed"); - return false; - } - - priv->info_ptr = png_create_info_struct(priv->png_ptr); - if (!priv->info_ptr) { - error(errInternal, -1, "png_create_info_struct failed"); - return false; - } - - if (setjmp(png_jmpbuf(priv->png_ptr))) { - error(errInternal, -1, "png_jmpbuf failed"); - return false; - } - - /* write header */ - png_init_io(priv->png_ptr, f); - if (setjmp(png_jmpbuf(priv->png_ptr))) { - error(errInternal, -1, "Error during writing header"); - return false; - } - - // Set up the type of PNG image and the compression level - png_set_compression_level(priv->png_ptr, Z_BEST_COMPRESSION); - - // Silence silly gcc - png_byte bit_depth = -1; - png_byte color_type = -1; - switch (priv->format) { - case RGB: - bit_depth = 8; - color_type = PNG_COLOR_TYPE_RGB; - break; - case RGBA: - bit_depth = 8; - color_type = PNG_COLOR_TYPE_RGB_ALPHA; - break; - case GRAY: - bit_depth = 8; - color_type = PNG_COLOR_TYPE_GRAY; - break; - case MONOCHROME: - bit_depth = 1; - color_type = PNG_COLOR_TYPE_GRAY; - break; - } - png_byte interlace_type = PNG_INTERLACE_NONE; - - png_set_IHDR(priv->png_ptr, priv->info_ptr, width, height, bit_depth, color_type, interlace_type, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - - png_set_pHYs(priv->png_ptr, priv->info_ptr, hDPI/0.0254, vDPI/0.0254, PNG_RESOLUTION_METER); - - if (priv->icc_data) - png_set_iCCP(priv->png_ptr, priv->info_ptr, priv->icc_name, PNG_COMPRESSION_TYPE_BASE, icc_data_ptr, priv->icc_data_size); - else if (priv->sRGB_profile) - png_set_sRGB(priv->png_ptr, priv->info_ptr, PNG_sRGB_INTENT_RELATIVE); - - png_write_info(priv->png_ptr, priv->info_ptr); - if (setjmp(png_jmpbuf(priv->png_ptr))) { - error(errInternal, -1, "error during writing png info bytes"); - return false; - } - - return true; -} - -bool PNGWriter::writePointers(unsigned char **rowPointers, int rowCount) -{ - png_write_image(priv->png_ptr, rowPointers); - /* write bytes */ - if (setjmp(png_jmpbuf(priv->png_ptr))) { - error(errInternal, -1, "Error during writing bytes"); - return false; - } - - return true; -} - -bool PNGWriter::writeRow(unsigned char **row) -{ - // Write the row to the file - png_write_rows(priv->png_ptr, row, 1); - if (setjmp(png_jmpbuf(priv->png_ptr))) { - error(errInternal, -1, "error during png row write"); - return false; - } - - return true; -} - -bool PNGWriter::close() -{ - /* end write */ - png_write_end(priv->png_ptr, priv->info_ptr); - if (setjmp(png_jmpbuf(priv->png_ptr))) { - error(errInternal, -1, "Error during end of write"); - return false; - } - - return true; -} - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/PNGWriter.h b/Build/source/libs/poppler/poppler-0.26.3/goo/PNGWriter.h deleted file mode 100644 index 90a298e7ef3..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/PNGWriter.h +++ /dev/null @@ -1,61 +0,0 @@ -//======================================================================== -// -// PNGWriter.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2009 Warren Toomey <wkt@tuhs.org> -// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com> -// Copyright (C) 2009, 2011-2013 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com> -// Copyright (C) 2010, 2011, 2013 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2012 Pino Toscano <pino@kde.org> -// -//======================================================================== - -#ifndef PNGWRITER_H -#define PNGWRITER_H - -#include "poppler-config.h" - -#ifdef ENABLE_LIBPNG - -#include "ImgWriter.h" - -struct PNGWriterPrivate; - -class PNGWriter : public ImgWriter -{ -public: - - /* RGB - 3 bytes/pixel - * RGBA - 4 bytes/pixel - * GRAY - 1 byte/pixel - * MONOCHROME - 8 pixels/byte - */ - enum Format { RGB, RGBA, GRAY, MONOCHROME }; - - PNGWriter(Format format = RGB); - ~PNGWriter(); - - void setICCProfile(const char *name, unsigned char *data, int size); - void setSRGBProfile(); - - - bool init(FILE *f, int width, int height, int hDPI, int vDPI); - - bool writePointers(unsigned char **rowPointers, int rowCount); - bool writeRow(unsigned char **row); - - bool close(); - -private: - PNGWriter(const PNGWriter &other); - PNGWriter& operator=(const PNGWriter &other); - - PNGWriterPrivate *priv; -}; - -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/TiffWriter.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/TiffWriter.cc deleted file mode 100644 index 316008778b1..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/TiffWriter.cc +++ /dev/null @@ -1,236 +0,0 @@ -//======================================================================== -// -// TiffWriter.cc -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2010, 2012 William Bader <williambader@hotmail.com> -// Copyright (C) 2012 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2012 Pino Toscano <pino@kde.org> -// Copyright (C) 2014 Steven Lee <roc.sky@gmail.com> -// -//======================================================================== - -#include "TiffWriter.h" - -#if ENABLE_LIBTIFF - -#include <string.h> - -#ifdef _WIN32 -#include <io.h> -#endif - -extern "C" { -#include <tiffio.h> -} - -struct TiffWriterPrivate { - TIFF *f; // LibTiff file context - int numRows; // number of rows in the image - int curRow; // number of rows written - const char *compressionString; // compression type - TiffWriter::Format format; // format of image data -}; - -TiffWriter::~TiffWriter() -{ - delete priv; -} - -TiffWriter::TiffWriter(Format formatA) -{ - priv = new TiffWriterPrivate; - priv->f = NULL; - priv->numRows = 0; - priv->curRow = 0; - priv->compressionString = NULL; - priv->format = formatA; -} - -// Set the compression type - -void TiffWriter::setCompressionString(const char *compressionStringArg) -{ - priv->compressionString = compressionStringArg; -} - -// Write a TIFF file. - -bool TiffWriter::init(FILE *openedFile, int width, int height, int hDPI, int vDPI) -{ - unsigned int compression; - uint16 photometric = 0; - uint32 rowsperstrip = (uint32) -1; - int bitspersample; - uint16 samplesperpixel = 0; - const struct compression_name_tag { - const char *compressionName; // name of the compression option from the command line - unsigned int compressionCode; // internal libtiff code - const char *compressionDescription; // descriptive name - } compressionList[] = { - { "none", COMPRESSION_NONE, "no compression" }, - { "ccittrle", COMPRESSION_CCITTRLE, "CCITT modified Huffman RLE" }, - { "ccittfax3", COMPRESSION_CCITTFAX3,"CCITT Group 3 fax encoding" }, - { "ccittt4", COMPRESSION_CCITT_T4, "CCITT T.4 (TIFF 6 name)" }, - { "ccittfax4", COMPRESSION_CCITTFAX4, "CCITT Group 4 fax encoding" }, - { "ccittt6", COMPRESSION_CCITT_T6, "CCITT T.6 (TIFF 6 name)" }, - { "lzw", COMPRESSION_LZW, "Lempel-Ziv & Welch" }, - { "ojpeg", COMPRESSION_OJPEG, "!6.0 JPEG" }, - { "jpeg", COMPRESSION_JPEG, "%JPEG DCT compression" }, - { "next", COMPRESSION_NEXT, "NeXT 2-bit RLE" }, - { "packbits", COMPRESSION_PACKBITS, "Macintosh RLE" }, - { "ccittrlew", COMPRESSION_CCITTRLEW, "CCITT modified Huffman RLE w/ word alignment" }, - { "deflate", COMPRESSION_DEFLATE, "Deflate compression" }, - { "adeflate", COMPRESSION_ADOBE_DEFLATE, "Deflate compression, as recognized by Adobe" }, - { "dcs", COMPRESSION_DCS, "Kodak DCS encoding" }, - { "jbig", COMPRESSION_JBIG, "ISO JBIG" }, - { "jp2000", COMPRESSION_JP2000, "Leadtools JPEG2000" }, - { NULL, 0, NULL } - }; - - // Initialize - - priv->f = NULL; - priv->curRow = 0; - - // Store the number of rows - - priv->numRows = height; - - // Set the compression - - compression = COMPRESSION_NONE; - - if (priv->compressionString == NULL || strcmp(priv->compressionString, "") == 0) { - compression = COMPRESSION_NONE; - } else { - int i; - for (i = 0; compressionList[i].compressionName != NULL; i++) { - if (strcmp(priv->compressionString, compressionList[i].compressionName) == 0) { - compression = compressionList[i].compressionCode; - break; - } - } - if (compressionList[i].compressionName == NULL) { - fprintf(stderr, "TiffWriter: Unknown compression type '%.10s', using 'none'.\n", priv->compressionString); - fprintf(stderr, "Known compression types (the tiff library might not support every type)\n"); - for (i = 0; compressionList[i].compressionName != NULL; i++) { - fprintf(stderr, "%10s %s\n", compressionList[i].compressionName, compressionList[i].compressionDescription); - } - } - } - - // Set bits per sample, samples per pixel, and photometric type from format - - bitspersample = (priv->format == MONOCHROME ? 1 : 8); - - switch (priv->format) { - case MONOCHROME: - case GRAY: - samplesperpixel = 1; - photometric = PHOTOMETRIC_MINISBLACK; - break; - - case RGB: - samplesperpixel = 3; - photometric = PHOTOMETRIC_RGB; - break; - - case RGBA_PREMULTIPLIED: - samplesperpixel = 4; - photometric = PHOTOMETRIC_RGB; - break; - - case CMYK: - samplesperpixel = 4; - photometric = PHOTOMETRIC_SEPARATED; - break; - } - - // Open the file - - if (openedFile == NULL) { - fprintf(stderr, "TiffWriter: No output file given.\n"); - return false; - } - -#ifdef _WIN32 - //Convert C Library handle to Win32 Handle - priv->f = TIFFFdOpen(_get_osfhandle(fileno(openedFile)), "-", "w"); -#else - priv->f = TIFFFdOpen(fileno(openedFile), "-", "w"); -#endif - - - if (!priv->f) { - return false; - } - - // Set TIFF tags - - TIFFSetField(priv->f, TIFFTAG_IMAGEWIDTH, width); - TIFFSetField(priv->f, TIFFTAG_IMAGELENGTH, height); - TIFFSetField(priv->f, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); - TIFFSetField(priv->f, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel); - TIFFSetField(priv->f, TIFFTAG_BITSPERSAMPLE, bitspersample); - TIFFSetField(priv->f, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); - TIFFSetField(priv->f, TIFFTAG_PHOTOMETRIC, photometric); - TIFFSetField(priv->f, TIFFTAG_COMPRESSION, (uint16) compression); - TIFFSetField(priv->f, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(priv->f, rowsperstrip)); - TIFFSetField(priv->f, TIFFTAG_XRESOLUTION, (double) hDPI); - TIFFSetField(priv->f, TIFFTAG_YRESOLUTION, (double) vDPI); - TIFFSetField(priv->f, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); - - if (priv->format == RGBA_PREMULTIPLIED) { - uint16 extra = EXTRASAMPLE_ASSOCALPHA; - TIFFSetField(priv->f, TIFFTAG_EXTRASAMPLES, 1, &extra); - } - - if (priv->format == CMYK) { - TIFFSetField(priv->f, TIFFTAG_INKSET, INKSET_CMYK); - TIFFSetField(priv->f, TIFFTAG_NUMBEROFINKS, 4); - } - - return true; -} - -bool TiffWriter::writePointers(unsigned char **rowPointers, int rowCount) -{ - // Write all rows to the file - - for (int row = 0; row < rowCount; row++) { - if (TIFFWriteScanline(priv->f, rowPointers[row], row, 0) < 0) { - fprintf(stderr, "TiffWriter: Error writing tiff row %d\n", row); - return false; - } - } - - return true; -} - -bool TiffWriter::writeRow(unsigned char **rowData) -{ - // Add a single row - - if (TIFFWriteScanline(priv->f, *rowData, priv->curRow, 0) < 0) { - fprintf(stderr, "TiffWriter: Error writing tiff row %d\n", priv->curRow); - return false; - } - - priv->curRow++; - - return true; -} - -bool TiffWriter::close() -{ - // Close the file - - TIFFClose(priv->f); - - return true; -} - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/TiffWriter.h b/Build/source/libs/poppler/poppler-0.26.3/goo/TiffWriter.h deleted file mode 100644 index 52fdd53efa5..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/TiffWriter.h +++ /dev/null @@ -1,60 +0,0 @@ -//======================================================================== -// -// TiffWriter.h -// -// This file is licensed under the GPLv2 or later -// -// Copyright (C) 2010, 2012 William Bader <williambader@hotmail.com> -// Copyright (C) 2011, 2012 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2012 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2012 Pino Toscano <pino@kde.org> -// -//======================================================================== - -#ifndef TIFFWRITER_H -#define TIFFWRITER_H - -#include "poppler-config.h" - -#ifdef ENABLE_LIBTIFF - -#include <sys/types.h> -#include "ImgWriter.h" - -struct TiffWriterPrivate; - -class TiffWriter : public ImgWriter -{ -public: - /* RGB - 3 bytes/pixel - * RGBA_PREMULTIPLIED - 4 bytes/pixel premultiplied by alpha - * GRAY - 1 byte/pixel - * MONOCHROME - 8 pixels/byte - * CMYK - 4 bytes/pixel - */ - enum Format { RGB, RGBA_PREMULTIPLIED, GRAY, MONOCHROME, CMYK }; - - TiffWriter(Format format = RGB); - ~TiffWriter(); - - void setCompressionString(const char *compressionStringArg); - - bool init(FILE *openedFile, int width, int height, int hDPI, int vDPI); - - bool writePointers(unsigned char **rowPointers, int rowCount); - bool writeRow(unsigned char **rowData); - - bool supportCMYK() { return true; } - - bool close(); - -private: - TiffWriter(const TiffWriter &other); - TiffWriter& operator=(const TiffWriter &other); - - TiffWriterPrivate *priv; -}; - -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gfile.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/gfile.cc deleted file mode 100644 index 6fd4cbad105..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gfile.cc +++ /dev/null @@ -1,815 +0,0 @@ -//======================================================================== -// -// gfile.cc -// -// Miscellaneous file and directory name manipulation. -// -// Copyright 1996-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2008 Adam Batkin <adam@batkin.net> -// Copyright (C) 2008, 2010, 2012, 2013 Hib Eris <hib@hiberis.nl> -// Copyright (C) 2009, 2012, 2014 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> -// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2013 Peter Breitenlohner <peb@mppmu.mpg.de> -// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> - -#ifdef _WIN32 -# include <time.h> -#else -# if defined(MACOS) -# include <sys/stat.h> -# elif !defined(ACORN) -# include <sys/types.h> -# include <sys/stat.h> -# include <fcntl.h> -# endif -# include <time.h> -# include <limits.h> -# include <string.h> -# if !defined(VMS) && !defined(ACORN) && !defined(MACOS) -# include <pwd.h> -# endif -# if defined(VMS) && (__DECCXX_VER < 50200000) -# include <unixlib.h> -# endif -#endif // _WIN32 -#include <stdio.h> -#include <limits> -#include "GooString.h" -#include "gfile.h" - -// Some systems don't define this, so just make it something reasonably -// large. -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif - -//------------------------------------------------------------------------ - -GooString *getCurrentDir() { - char buf[PATH_MAX+1]; - -#if defined(__EMX__) - if (_getcwd2(buf, sizeof(buf))) -#elif defined(_WIN32) - if (GetCurrentDirectory(sizeof(buf), buf)) -#elif defined(ACORN) - if (strcpy(buf, "@")) -#elif defined(MACOS) - if (strcpy(buf, ":")) -#else - if (getcwd(buf, sizeof(buf))) -#endif - return new GooString(buf); - return new GooString(); -} - -GooString *appendToPath(GooString *path, const char *fileName) { -#if defined(VMS) - //---------- VMS ---------- - //~ this should handle everything necessary for file - //~ requesters, but it's certainly not complete - char *p0, *p1, *p2; - char *q1; - - p0 = path->getCString(); - p1 = p0 + path->getLength() - 1; - if (!strcmp(fileName, "-")) { - if (*p1 == ']') { - for (p2 = p1; p2 > p0 && *p2 != '.' && *p2 != '['; --p2) ; - if (*p2 == '[') - ++p2; - path->del(p2 - p0, p1 - p2); - } else if (*p1 == ':') { - path->append("[-]"); - } else { - path->clear(); - path->append("[-]"); - } - } else if ((q1 = strrchr(fileName, '.')) && !strncmp(q1, ".DIR;", 5)) { - if (*p1 == ']') { - path->insert(p1 - p0, '.'); - path->insert(p1 - p0 + 1, fileName, q1 - fileName); - } else if (*p1 == ':') { - path->append('['); - path->append(']'); - path->append(fileName, q1 - fileName); - } else { - path->clear(); - path->append(fileName, q1 - fileName); - } - } else { - if (*p1 != ']' && *p1 != ':') - path->clear(); - path->append(fileName); - } - return path; - -#elif defined(_WIN32) - //---------- Win32 ---------- - GooString *tmp; - char buf[256]; - char *fp; - - tmp = new GooString(path); - tmp->append('/'); - tmp->append(fileName); - GetFullPathName(tmp->getCString(), sizeof(buf), buf, &fp); - delete tmp; - path->clear(); - path->append(buf); - return path; - -#elif defined(ACORN) - //---------- RISCOS ---------- - char *p; - int i; - - path->append("."); - i = path->getLength(); - path->append(fileName); - for (p = path->getCString() + i; *p; ++p) { - if (*p == '/') { - *p = '.'; - } else if (*p == '.') { - *p = '/'; - } - } - return path; - -#elif defined(MACOS) - //---------- MacOS ---------- - char *p; - int i; - - path->append(":"); - i = path->getLength(); - path->append(fileName); - for (p = path->getCString() + i; *p; ++p) { - if (*p == '/') { - *p = ':'; - } else if (*p == '.') { - *p = ':'; - } - } - return path; - -#elif defined(__EMX__) - //---------- OS/2+EMX ---------- - int i; - - // appending "." does nothing - if (!strcmp(fileName, ".")) - return path; - - // appending ".." goes up one directory - if (!strcmp(fileName, "..")) { - for (i = path->getLength() - 2; i >= 0; --i) { - if (path->getChar(i) == '/' || path->getChar(i) == '\\' || - path->getChar(i) == ':') - break; - } - if (i <= 0) { - if (path->getChar(0) == '/' || path->getChar(0) == '\\') { - path->del(1, path->getLength() - 1); - } else if (path->getLength() >= 2 && path->getChar(1) == ':') { - path->del(2, path->getLength() - 2); - } else { - path->clear(); - path->append(".."); - } - } else { - if (path->getChar(i-1) == ':') - ++i; - path->del(i, path->getLength() - i); - } - return path; - } - - // otherwise, append "/" and new path component - if (path->getLength() > 0 && - path->getChar(path->getLength() - 1) != '/' && - path->getChar(path->getLength() - 1) != '\\') - path->append('/'); - path->append(fileName); - return path; - -#else - //---------- Unix ---------- - int i; - - // appending "." does nothing - if (!strcmp(fileName, ".")) - return path; - - // appending ".." goes up one directory - if (!strcmp(fileName, "..")) { - for (i = path->getLength() - 2; i >= 0; --i) { - if (path->getChar(i) == '/') - break; - } - if (i <= 0) { - if (path->getChar(0) == '/') { - path->del(1, path->getLength() - 1); - } else { - path->clear(); - path->append(".."); - } - } else { - path->del(i, path->getLength() - i); - } - return path; - } - - // otherwise, append "/" and new path component - if (path->getLength() > 0 && - path->getChar(path->getLength() - 1) != '/') - path->append('/'); - path->append(fileName); - return path; -#endif -} - -GooString *grabPath(char *fileName) { -#ifdef VMS - //---------- VMS ---------- - char *p; - - if ((p = strrchr(fileName, ']'))) - return new GooString(fileName, p + 1 - fileName); - if ((p = strrchr(fileName, ':'))) - return new GooString(fileName, p + 1 - fileName); - return new GooString(); - -#elif defined(__EMX__) || defined(_WIN32) - //---------- OS/2+EMX and Win32 ---------- - char *p; - - if ((p = strrchr(fileName, '/'))) - return new GooString(fileName, p - fileName); - if ((p = strrchr(fileName, '\\'))) - return new GooString(fileName, p - fileName); - if ((p = strrchr(fileName, ':'))) - return new GooString(fileName, p + 1 - fileName); - return new GooString(); - -#elif defined(ACORN) - //---------- RISCOS ---------- - char *p; - - if ((p = strrchr(fileName, '.'))) - return new GooString(fileName, p - fileName); - return new GooString(); - -#elif defined(MACOS) - //---------- MacOS ---------- - char *p; - - if ((p = strrchr(fileName, ':'))) - return new GooString(fileName, p - fileName); - return new GooString(); - -#else - //---------- Unix ---------- - char *p; - - if ((p = strrchr(fileName, '/'))) - return new GooString(fileName, p - fileName); - return new GooString(); -#endif -} - -GBool isAbsolutePath(char *path) { -#ifdef VMS - //---------- VMS ---------- - return strchr(path, ':') || - (path[0] == '[' && path[1] != '.' && path[1] != '-'); - -#elif defined(__EMX__) || defined(_WIN32) - //---------- OS/2+EMX and Win32 ---------- - return path[0] == '/' || path[0] == '\\' || path[1] == ':'; - -#elif defined(ACORN) - //---------- RISCOS ---------- - return path[0] == '$'; - -#elif defined(MACOS) - //---------- MacOS ---------- - return path[0] != ':'; - -#else - //---------- Unix ---------- - return path[0] == '/'; -#endif -} - -time_t getModTime(char *fileName) { -#ifdef _WIN32 - //~ should implement this, but it's (currently) only used in xpdf - return 0; -#else - struct stat statBuf; - - if (stat(fileName, &statBuf)) { - return 0; - } - return statBuf.st_mtime; -#endif -} - -GBool openTempFile(GooString **name, FILE **f, const char *mode) { -#if defined(_WIN32) - //---------- Win32 ---------- - char *tempDir; - GooString *s, *s2; - FILE *f2; - int t, i; - - // this has the standard race condition problem, but I haven't found - // a better way to generate temp file names with extensions on - // Windows - if ((tempDir = getenv("TEMP"))) { - s = new GooString(tempDir); - s->append('\\'); - } else { - s = new GooString(); - } - s->appendf("x_{0:d}_{1:d}_", - (int)GetCurrentProcessId(), (int)GetCurrentThreadId()); - t = (int)time(NULL); - for (i = 0; i < 1000; ++i) { - s2 = s->copy()->appendf("{0:d}", t + i); - if (!(f2 = fopen(s2->getCString(), "r"))) { - if (!(f2 = fopen(s2->getCString(), mode))) { - delete s2; - delete s; - return gFalse; - } - *name = s2; - *f = f2; - delete s; - return gTrue; - } - fclose(f2); - delete s2; - } - delete s; - return gFalse; -#elif defined(VMS) || defined(__EMX__) || defined(ACORN) || defined(MACOS) - //---------- non-Unix ---------- - char *s; - - // There is a security hole here: an attacker can create a symlink - // with this file name after the tmpnam call and before the fopen - // call. I will happily accept fixes to this function for non-Unix - // OSs. - if (!(s = tmpnam(NULL))) { - return gFalse; - } - *name = new GooString(s); - if (!(*f = fopen((*name)->getCString(), mode))) { - delete (*name); - *name = NULL; - return gFalse; - } - return gTrue; -#else - //---------- Unix ---------- - char *s; - int fd; - -#if HAVE_MKSTEMP - if ((s = getenv("TMPDIR"))) { - *name = new GooString(s); - } else { - *name = new GooString("/tmp"); - } - (*name)->append("/XXXXXX"); - fd = mkstemp((*name)->getCString()); -#else // HAVE_MKSTEMP - if (!(s = tmpnam(NULL))) { - return gFalse; - } - *name = new GooString(s); - fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600); -#endif // HAVE_MKSTEMP - if (fd < 0 || !(*f = fdopen(fd, mode))) { - delete *name; - *name = NULL; - return gFalse; - } - return gTrue; -#endif -} - -#ifdef WIN32 -GooString *fileNameToUTF8(char *path) { - GooString *s; - char *p; - - s = new GooString(); - for (p = path; *p; ++p) { - if (*p & 0x80) { - s->append((char)(0xc0 | ((*p >> 6) & 0x03))); - s->append((char)(0x80 | (*p & 0x3f))); - } else { - s->append(*p); - } - } - return s; -} - -GooString *fileNameToUTF8(wchar_t *path) { - GooString *s; - wchar_t *p; - - s = new GooString(); - for (p = path; *p; ++p) { - if (*p < 0x80) { - s->append((char)*p); - } else if (*p < 0x800) { - s->append((char)(0xc0 | ((*p >> 6) & 0x1f))); - s->append((char)(0x80 | (*p & 0x3f))); - } else { - s->append((char)(0xe0 | ((*p >> 12) & 0x0f))); - s->append((char)(0x80 | ((*p >> 6) & 0x3f))); - s->append((char)(0x80 | (*p & 0x3f))); - } - } - return s; -} -#endif - -FILE *openFile(const char *path, const char *mode) { -#ifdef WIN32 - OSVERSIONINFO version; - wchar_t wPath[_MAX_PATH + 1]; - char nPath[_MAX_PATH + 1]; - wchar_t wMode[8]; - const char *p; - size_t i; - - // NB: _wfopen is only available in NT - version.dwOSVersionInfoSize = sizeof(version); - GetVersionEx(&version); - if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { - for (p = path, i = 0; *p && i < _MAX_PATH; ++i) { - if ((p[0] & 0xe0) == 0xc0 && - p[1] && (p[1] & 0xc0) == 0x80) { - wPath[i] = (wchar_t)(((p[0] & 0x1f) << 6) | - (p[1] & 0x3f)); - p += 2; - } else if ((p[0] & 0xf0) == 0xe0 && - p[1] && (p[1] & 0xc0) == 0x80 && - p[2] && (p[2] & 0xc0) == 0x80) { - wPath[i] = (wchar_t)(((p[0] & 0x0f) << 12) | - ((p[1] & 0x3f) << 6) | - (p[2] & 0x3f)); - p += 3; - } else { - wPath[i] = (wchar_t)(p[0] & 0xff); - p += 1; - } - } - wPath[i] = (wchar_t)0; - for (i = 0; (i < sizeof(mode) - 1) && mode[i]; ++i) { - wMode[i] = (wchar_t)(mode[i] & 0xff); - } - wMode[i] = (wchar_t)0; - return _wfopen(wPath, wMode); - } else { - for (p = path, i = 0; *p && i < _MAX_PATH; ++i) { - if ((p[0] & 0xe0) == 0xc0 && - p[1] && (p[1] & 0xc0) == 0x80) { - nPath[i] = (char)(((p[0] & 0x1f) << 6) | - (p[1] & 0x3f)); - p += 2; - } else if ((p[0] & 0xf0) == 0xe0 && - p[1] && (p[1] & 0xc0) == 0x80 && - p[2] && (p[2] & 0xc0) == 0x80) { - nPath[i] = (char)(((p[1] & 0x3f) << 6) | - (p[2] & 0x3f)); - p += 3; - } else { - nPath[i] = p[0]; - p += 1; - } - } - nPath[i] = '\0'; - return fopen(nPath, mode); - } -#else - return fopen(path, mode); -#endif -} - -char *getLine(char *buf, int size, FILE *f) { - int c, i; - - i = 0; - while (i < size - 1) { - if ((c = fgetc(f)) == EOF) { - break; - } - buf[i++] = (char)c; - if (c == '\x0a') { - break; - } - if (c == '\x0d') { - c = fgetc(f); - if (c == '\x0a' && i < size - 1) { - buf[i++] = (char)c; - } else if (c != EOF) { - ungetc(c, f); - } - break; - } - } - buf[i] = '\0'; - if (i == 0) { - return NULL; - } - return buf; -} - -int Gfseek(FILE *f, Goffset offset, int whence) { -#if HAVE_FSEEKO - return fseeko(f, offset, whence); -#elif HAVE_FSEEK64 - return fseek64(f, offset, whence); -#elif defined(__MINGW32__) - return fseeko64(f, offset, whence); -#elif _WIN32 - return _fseeki64(f, offset, whence); -#else - return fseek(f, offset, whence); -#endif -} - -Goffset Gftell(FILE *f) { -#if HAVE_FSEEKO - return ftello(f); -#elif HAVE_FSEEK64 - return ftell64(f); -#elif defined(__MINGW32__) - return ftello64(f); -#elif _WIN32 - return _ftelli64(f); -#else - return ftell(f); -#endif -} - -Goffset GoffsetMax() { -#if HAVE_FSEEKO - return (std::numeric_limits<off_t>::max)(); -#elif HAVE_FSEEK64 || defined(__MINGW32__) - return (std::numeric_limits<off64_t>::max)(); -#elif _WIN32 - return (std::numeric_limits<__int64>::max)(); -#else - return (std::numeric_limits<long>::max)(); -#endif -} - -//------------------------------------------------------------------------ -// GooFile -//------------------------------------------------------------------------ - -#ifdef _WIN32 - -int GooFile::read(char *buf, int n, Goffset offset) const { - DWORD m; - - LARGE_INTEGER largeInteger = {0}; - largeInteger.QuadPart = offset; - - OVERLAPPED overlapped = {0}; - overlapped.Offset = largeInteger.LowPart; - overlapped.OffsetHigh = largeInteger.HighPart; - - return FALSE == ReadFile(handle, buf, n, &m, &overlapped) ? -1 : m; -} - -Goffset GooFile::size() const { - LARGE_INTEGER size = {(DWORD)-1,-1}; - - GetFileSizeEx(handle, &size); - - return size.QuadPart; -} - -GooFile* GooFile::open(const GooString *fileName) { - HANDLE handle = CreateFile(fileName->getCString(), - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - - return handle == INVALID_HANDLE_VALUE ? NULL : new GooFile(handle); -} - -GooFile* GooFile::open(const wchar_t *fileName) { - HANDLE handle = CreateFileW(fileName, - GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - - return handle == INVALID_HANDLE_VALUE ? NULL : new GooFile(handle); -} - -#else - -int GooFile::read(char *buf, int n, Goffset offset) const { -#ifdef HAVE_PREAD64 - return pread64(fd, buf, n, offset); -#else - return pread(fd, buf, n, offset); -#endif -} - -Goffset GooFile::size() const { -#ifdef HAVE_LSEEK64 - return lseek64(fd, 0, SEEK_END); -#else - return lseek(fd, 0, SEEK_END); -#endif -} - -GooFile* GooFile::open(const GooString *fileName) { -#ifdef VMS - int fd = ::open(fileName->getCString(), Q_RDONLY, "ctx=stm"); -#else - int fd = ::open(fileName->getCString(), O_RDONLY); -#endif - - return fd < 0 ? NULL : new GooFile(fd); -} - -#endif // _WIN32 - -//------------------------------------------------------------------------ -// GDir and GDirEntry -//------------------------------------------------------------------------ - -GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) { -#ifdef VMS - char *p; -#elif defined(_WIN32) - DWORD fa; -#elif defined(ACORN) -#else - struct stat st; -#endif - - name = new GooString(nameA); - dir = gFalse; - fullPath = new GooString(dirPath); - appendToPath(fullPath, nameA); - if (doStat) { -#ifdef VMS - if (!strcmp(nameA, "-") || - ((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5))) - dir = gTrue; -#elif defined(ACORN) -#else -#ifdef _WIN32 - fa = GetFileAttributes(fullPath->getCString()); - dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY)); -#else - if (stat(fullPath->getCString(), &st) == 0) - dir = S_ISDIR(st.st_mode); -#endif -#endif - } -} - -GDirEntry::~GDirEntry() { - delete fullPath; - delete name; -} - -GDir::GDir(char *name, GBool doStatA) { - path = new GooString(name); - doStat = doStatA; -#if defined(_WIN32) - GooString *tmp; - - tmp = path->copy(); - tmp->append("/*.*"); - hnd = FindFirstFile(tmp->getCString(), &ffd); - delete tmp; -#elif defined(ACORN) -#elif defined(MACOS) -#else - dir = opendir(name); -#ifdef VMS - needParent = strchr(name, '[') != NULL; -#endif -#endif -} - -GDir::~GDir() { - delete path; -#if defined(_WIN32) - if (hnd != INVALID_HANDLE_VALUE) { - FindClose(hnd); - hnd = INVALID_HANDLE_VALUE; - } -#elif defined(ACORN) -#elif defined(MACOS) -#else - if (dir) - closedir(dir); -#endif -} - -GDirEntry *GDir::getNextEntry() { - GDirEntry *e; - -#if defined(_WIN32) - if (hnd != INVALID_HANDLE_VALUE) { - e = new GDirEntry(path->getCString(), ffd.cFileName, doStat); - if (!FindNextFile(hnd, &ffd)) { - FindClose(hnd); - hnd = INVALID_HANDLE_VALUE; - } - } else { - e = NULL; - } -#elif defined(ACORN) -#elif defined(MACOS) -#elif defined(VMS) - struct dirent *ent; - e = NULL; - if (dir) { - if (needParent) { - e = new GDirEntry(path->getCString(), "-", doStat); - needParent = gFalse; - return e; - } - ent = readdir(dir); - if (ent) { - e = new GDirEntry(path->getCString(), ent->d_name, doStat); - } - } -#else - struct dirent *ent; - e = NULL; - if (dir) { - do { - ent = readdir(dir); - } - while (ent && (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))); - if (ent) { - e = new GDirEntry(path->getCString(), ent->d_name, doStat); - } - } -#endif - - return e; -} - -void GDir::rewind() { -#ifdef _WIN32 - GooString *tmp; - - if (hnd != INVALID_HANDLE_VALUE) - FindClose(hnd); - tmp = path->copy(); - tmp->append("/*.*"); - hnd = FindFirstFile(tmp->getCString(), &ffd); - delete tmp; -#elif defined(ACORN) -#elif defined(MACOS) -#else - if (dir) - rewinddir(dir); -#ifdef VMS - needParent = strchr(path->getCString(), '[') != NULL; -#endif -#endif -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gfile.h b/Build/source/libs/poppler/poppler-0.26.3/goo/gfile.h deleted file mode 100644 index 1365a9cf2ab..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gfile.h +++ /dev/null @@ -1,209 +0,0 @@ -//======================================================================== -// -// gfile.h -// -// Miscellaneous file and directory name manipulation. -// -// Copyright 1996-2003 Glyph & Cog, LLC -// -//======================================================================== - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com> -// Copyright (C) 2009, 2011, 2012 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net> -// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> -// Copyright (C) 2014 Bogdan Cristea <cristeab@gmail.com> -// Copyright (C) 2014 Peter Breitenlohner <peb@mppmu.mpg.de> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GFILE_H -#define GFILE_H - -#include "poppler-config.h" -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -extern "C" { -#if defined(_WIN32) -# include <sys/stat.h> -# ifdef FPTEX -# include <win32lib.h> -# else -# ifndef NOMINMAX -# define NOMINMAX -# endif -# include <windows.h> -# endif -#elif defined(ACORN) -#elif defined(MACOS) -# include <ctime.h> -#else -# include <unistd.h> -# include <sys/types.h> -# ifdef VMS -# include "vms_dirent.h" -# elif HAVE_DIRENT_H -# include <dirent.h> -# define NAMLEN(d) strlen((d)->d_name) -# else -# define dirent direct -# define NAMLEN(d) (d)->d_namlen -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif -# if HAVE_NDIR_H -# include <ndir.h> -# endif -# endif -#endif -} -#include "gtypes.h" - -class GooString; - -//------------------------------------------------------------------------ - -// Get current directory. -extern GooString *getCurrentDir(); - -// Append a file name to a path string. <path> may be an empty -// string, denoting the current directory). Returns <path>. -extern GooString *appendToPath(GooString *path, const char *fileName); - -// Grab the path from the front of the file name. If there is no -// directory component in <fileName>, returns an empty string. -extern GooString *grabPath(char *fileName); - -// Is this an absolute path or file name? -extern GBool isAbsolutePath(char *path); - -// Get the modification time for <fileName>. Returns 0 if there is an -// error. -extern time_t getModTime(char *fileName); - -// Create a temporary file and open it for writing. If <ext> is not -// NULL, it will be used as the file name extension. Returns both the -// name and the file pointer. For security reasons, all writing -// should be done to the returned file pointer; the file may be -// reopened later for reading, but not for writing. The <mode> string -// should be "w" or "wb". Returns true on success. -extern GBool openTempFile(GooString **name, FILE **f, const char *mode); - -#ifdef WIN32 -// Convert a file name from Latin-1 to UTF-8. -extern GooString *fileNameToUTF8(char *path); - -// Convert a file name from UCS-2 to UTF-8. -extern GooString *fileNameToUTF8(wchar_t *path); -#endif - -// Open a file. On Windows, this converts the path from UTF-8 to -// UCS-2 and calls _wfopen (if available). On other OSes, this simply -// calls fopen. -extern FILE *openFile(const char *path, const char *mode); - -// Just like fgets, but handles Unix, Mac, and/or DOS end-of-line -// conventions. -extern char *getLine(char *buf, int size, FILE *f); - -// Like fseek/ftell but uses platform specific variants that support large files -extern int Gfseek(FILE *f, Goffset offset, int whence); -extern Goffset Gftell(FILE *f); - -// Largest offset supported by Gfseek/Gftell -extern Goffset GoffsetMax(); - -//------------------------------------------------------------------------ -// GooFile -//------------------------------------------------------------------------ - -class GooFile -{ -public: - int read(char *buf, int n, Goffset offset) const; - Goffset size() const; - - static GooFile *open(const GooString *fileName); - -#ifdef _WIN32 - static GooFile *open(const wchar_t *fileName); - - ~GooFile() { CloseHandle(handle); } - -private: - GooFile(HANDLE handleA): handle(handleA) {} - HANDLE handle; -#else - ~GooFile() { close(fd); } - -private: - GooFile(int fdA) : fd(fdA) {} - int fd; -#endif // _WIN32 -}; - -//------------------------------------------------------------------------ -// GDir and GDirEntry -//------------------------------------------------------------------------ - -class GDirEntry { -public: - - GDirEntry(char *dirPath, char *nameA, GBool doStat); - ~GDirEntry(); - GooString *getName() { return name; } - GooString *getFullPath() { return fullPath; } - GBool isDir() { return dir; } - -private: - GDirEntry(const GDirEntry &other); - GDirEntry& operator=(const GDirEntry &other); - - GooString *name; // dir/file name - GooString *fullPath; - GBool dir; // is it a directory? -}; - -class GDir { -public: - - GDir(char *name, GBool doStatA = gTrue); - ~GDir(); - GDirEntry *getNextEntry(); - void rewind(); - -private: - GDir(const GDir &other); - GDir& operator=(const GDir &other); - - GooString *path; // directory path - GBool doStat; // call stat() for each entry? -#if defined(_WIN32) - WIN32_FIND_DATA ffd; - HANDLE hnd; -#elif defined(ACORN) -#elif defined(MACOS) -#else - DIR *dir; // the DIR structure from opendir() -#ifdef VMS - GBool needParent; // need to return an entry for [-] -#endif -#endif -}; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gmem.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/gmem.cc deleted file mode 100644 index c1c607ac3f3..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gmem.cc +++ /dev/null @@ -1,326 +0,0 @@ -/* - * gmem.c - * - * Memory routines with out-of-memory checking. - * - * Copyright 1996-2003 Glyph & Cog, LLC - */ - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2005 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2007-2010, 2012 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2008 Jonathan Kew <jonathan_kew@sil.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <limits.h> -#include "gmem.h" - -#ifdef DEBUG_MEM - -typedef struct _GMemHdr { - unsigned int magic; - int size; - int index; - struct _GMemHdr *next, *prev; -} GMemHdr; - -#define gMemHdrSize ((sizeof(GMemHdr) + 7) & ~7) -#define gMemTrlSize (sizeof(long)) - -#define gMemMagic 0xabcd9999 - -#if gmemTrlSize==8 -#define gMemDeadVal 0xdeadbeefdeadbeefUL -#else -#define gMemDeadVal 0xdeadbeefUL -#endif - -/* round data size so trailer will be aligned */ -#define gMemDataSize(size) \ - ((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize) - -static GMemHdr *gMemHead = NULL; -static GMemHdr *gMemTail = NULL; - -static int gMemIndex = 0; -static int gMemAlloc = 0; -static int gMemInUse = 0; - -#endif /* DEBUG_MEM */ - -inline static void *gmalloc(size_t size, bool checkoverflow) { -#ifdef DEBUG_MEM - int size1; - char *mem; - GMemHdr *hdr; - void *data; - unsigned long *trl, *p; - - if (size == 0) { - return NULL; - } - size1 = gMemDataSize(size); - if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) { - fprintf(stderr, "Out of memory\n"); - if (checkoverflow) return NULL; - else exit(1); - } - hdr = (GMemHdr *)mem; - data = (void *)(mem + gMemHdrSize); - trl = (unsigned long *)(mem + gMemHdrSize + size1); - hdr->magic = gMemMagic; - hdr->size = size; - hdr->index = gMemIndex++; - if (gMemTail) { - gMemTail->next = hdr; - hdr->prev = gMemTail; - gMemTail = hdr; - } else { - hdr->prev = NULL; - gMemHead = gMemTail = hdr; - } - hdr->next = NULL; - ++gMemAlloc; - gMemInUse += size; - for (p = (unsigned long *)data; p <= trl; ++p) { - *p = gMemDeadVal; - } - return data; -#else - void *p; - - if (size == 0) { - return NULL; - } - if (!(p = malloc(size))) { - fprintf(stderr, "Out of memory\n"); - if (checkoverflow) return NULL; - else exit(1); - } - return p; -#endif -} - -void *gmalloc(size_t size) { - return gmalloc(size, false); -} - -void *gmalloc_checkoverflow(size_t size) { - return gmalloc(size, true); -} - -inline static void *grealloc(void *p, size_t size, bool checkoverflow) { -#ifdef DEBUG_MEM - GMemHdr *hdr; - void *q; - int oldSize; - - if (size == 0) { - if (p) { - gfree(p); - } - return NULL; - } - if (p) { - hdr = (GMemHdr *)((char *)p - gMemHdrSize); - oldSize = hdr->size; - q = gmalloc(size, checkoverflow); - memcpy(q, p, size < oldSize ? size : oldSize); - gfree(p); - } else { - q = gmalloc(size, checkoverflow); - } - return q; -#else - void *q; - - if (size == 0) { - if (p) { - free(p); - } - return NULL; - } - if (p) { - q = realloc(p, size); - } else { - q = malloc(size); - } - if (!q) { - fprintf(stderr, "Out of memory\n"); - if (checkoverflow) return NULL; - else exit(1); - } - return q; -#endif -} - -void *grealloc(void *p, size_t size) { - return grealloc(p, size, false); -} - -void *grealloc_checkoverflow(void *p, size_t size) { - return grealloc(p, size, true); -} - -inline static void *gmallocn(int nObjs, int objSize, bool checkoverflow) { - int n; - - if (nObjs == 0) { - return NULL; - } - n = nObjs * objSize; - if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { - fprintf(stderr, "Bogus memory allocation size\n"); - if (checkoverflow) return NULL; - else exit(1); - } - return gmalloc(n, checkoverflow); -} - -void *gmallocn(int nObjs, int objSize) { - return gmallocn(nObjs, objSize, false); -} - -void *gmallocn_checkoverflow(int nObjs, int objSize) { - return gmallocn(nObjs, objSize, true); -} - -inline static void *gmallocn3(int a, int b, int c, bool checkoverflow) { - int n = a * b; - if (b <= 0 || a < 0 || a >= INT_MAX / b) { - fprintf(stderr, "Bogus memory allocation size\n"); - if (checkoverflow) return NULL; - else exit(1); - } - return gmallocn(n, c, checkoverflow); -} - -void *gmallocn3(int a, int b, int c) { - return gmallocn3(a, b, c, false); -} - -void *gmallocn3_checkoverflow(int a, int b, int c) { - return gmallocn3(a, b, c, true); -} - -inline static void *greallocn(void *p, int nObjs, int objSize, bool checkoverflow) { - int n; - - if (nObjs == 0) { - if (p) { - gfree(p); - } - return NULL; - } - n = nObjs * objSize; - if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) { - fprintf(stderr, "Bogus memory allocation size\n"); - if (checkoverflow) { - gfree(p); - return NULL; - } else { - exit(1); - } - } - return grealloc(p, n, checkoverflow); -} - -void *greallocn(void *p, int nObjs, int objSize) { - return greallocn(p, nObjs, objSize, false); -} - -void *greallocn_checkoverflow(void *p, int nObjs, int objSize) { - return greallocn(p, nObjs, objSize, true); -} - -void gfree(void *p) { -#ifdef DEBUG_MEM - int size; - GMemHdr *hdr; - unsigned long *trl, *clr; - - if (p) { - hdr = (GMemHdr *)((char *)p - gMemHdrSize); - if (hdr->magic == gMemMagic && - ((hdr->prev == NULL) == (hdr == gMemHead)) && - ((hdr->next == NULL) == (hdr == gMemTail))) { - if (hdr->prev) { - hdr->prev->next = hdr->next; - } else { - gMemHead = hdr->next; - } - if (hdr->next) { - hdr->next->prev = hdr->prev; - } else { - gMemTail = hdr->prev; - } - --gMemAlloc; - gMemInUse -= hdr->size; - size = gMemDataSize(hdr->size); - trl = (unsigned long *)((char *)hdr + gMemHdrSize + size); - if (*trl != gMemDeadVal) { - fprintf(stderr, "Overwrite past end of block %d at address %p\n", - hdr->index, p); - } - for (clr = (unsigned long *)hdr; clr <= trl; ++clr) { - *clr = gMemDeadVal; - } - free(hdr); - } else { - fprintf(stderr, "Attempted to free bad address %p\n", p); - } - } -#else - if (p) { - free(p); - } -#endif -} - -#ifdef DEBUG_MEM -void gMemReport(FILE *f) { - GMemHdr *p; - - fprintf(f, "%d memory allocations in all\n", gMemIndex); - if (gMemAlloc > 0) { - fprintf(f, "%d memory blocks left allocated:\n", gMemAlloc); - fprintf(f, " index size\n"); - fprintf(f, "-------- --------\n"); - for (p = gMemHead; p; p = p->next) { - fprintf(f, "%8d %8d\n", p->index, p->size); - } - } else { - fprintf(f, "No memory blocks left allocated\n"); - } -} -#endif - -char *copyString(const char *s) { - char *s1; - - s1 = (char *)gmalloc(strlen(s) + 1); - strcpy(s1, s); - return s1; -} - -char *gstrndup(const char *s, size_t n) { - char *s1 = (char*)gmalloc(n + 1); /* cannot return NULL for size > 0 */ - s1[n] = '\0'; - memcpy(s1, s, n); - return s1; -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gmem.h b/Build/source/libs/poppler/poppler-0.26.3/goo/gmem.h deleted file mode 100644 index 898f33933f9..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gmem.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * gmem.h - * - * Memory routines with out-of-memory checking. - * - * Copyright 1996-2003 Glyph & Cog, LLC - */ - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2005 Takashi Iwai <tiwai@suse.de> -// Copyright (C) 2007-2010 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2008 Jonathan Kew <jonathan_kew@sil.org> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GMEM_H -#define GMEM_H - -#include <stdio.h> -#include "poppler-config.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Same as malloc, but prints error message and exits if malloc() - * returns NULL. - */ -extern void *gmalloc(size_t size); -extern void *gmalloc_checkoverflow(size_t size); - -/* - * Same as realloc, but prints error message and exits if realloc() - * returns NULL. If <p> is NULL, calls malloc instead of realloc(). - */ -extern void *grealloc(void *p, size_t size); -extern void *grealloc_checkoverflow(size_t size); - -/* - * These are similar to gmalloc and grealloc, but take an object count - * and size. The result is similar to allocating nObjs * objSize - * bytes, but there is an additional error check that the total size - * doesn't overflow an int. - * The gmallocn_checkoverflow variant returns NULL instead of exiting - * the application if a overflow is detected - */ -extern void *gmallocn(int nObjs, int objSize); -extern void *gmallocn_checkoverflow(int nObjs, int objSize); -extern void *gmallocn3(int a, int b, int c); -extern void *gmallocn3_checkoverflow(int a, int b, int c); -extern void *greallocn(void *p, int nObjs, int objSize); -extern void *greallocn_checkoverflow(void *p, int nObjs, int objSize); - -/* - * Same as free, but checks for and ignores NULL pointers. - */ -extern void gfree(void *p); - -#ifdef DEBUG_MEM -/* - * Report on unfreed memory. - */ -extern void gMemReport(FILE *f); -#else -#define gMemReport(f) -#endif - -/* - * Allocate memory and copy a string into it. - */ -extern char *copyString(const char *s); - -/* - * Allocate memory and copy a limited-length string to it. - */ -extern char *gstrndup(const char *s, size_t n); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gmempp.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/gmempp.cc deleted file mode 100644 index a70338ca3ce..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gmempp.cc +++ /dev/null @@ -1,32 +0,0 @@ -//======================================================================== -// -// gmempp.cc -// -// Use gmalloc/gfree for C++ new/delete operators. -// -// Copyright 1996-2003 Glyph & Cog, LLC -// -//======================================================================== - -#include <config.h> -#include "gmem.h" - -#ifdef DEBUG_MEM - -void *operator new(size_t size) { - return gmalloc((int)size); -} - -void *operator new[](size_t size) { - return gmalloc((int)size); -} - -void operator delete(void *p) { - gfree(p); -} - -void operator delete[](void *p) { - gfree(p); -} - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/grandom.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/grandom.cc deleted file mode 100644 index 1237175420b..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/grandom.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - * grandom.cc - * - * This file is licensed under the GPLv2 or later - * - * Pseudo-random number generation - * - * Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> - */ - -#include <config.h> -#include "grandom.h" -#include "gtypes.h" - -#ifdef HAVE_RAND_R // rand_r backend (POSIX) - -static GBool initialized = gFalse; - -#include <stdlib.h> -#include <time.h> -static unsigned int seed; - -static void initialize() { - if (!initialized) { - seed = time(NULL); - initialized = gTrue; - } -} - -void grandom_fill(Guchar *buff, int size) -{ - initialize(); - while (size--) - *buff++ = rand_r(&seed) % 256; -} - -double grandom_double() -{ - initialize(); - return rand_r(&seed) / (1 + (double)RAND_MAX); -} - -#else // srand+rand backend (unsafe, because it may interfere with the application) - -static GBool initialized = gFalse; - -#include <stdlib.h> -#include <time.h> - -static void initialize() { - if (!initialized) { - srand(time(NULL)); - initialized = gTrue; - } -} - -void grandom_fill(Guchar *buff, int size) -{ - initialize(); - while (size--) - *buff++ = rand() % 256; -} - -double grandom_double() -{ - initialize(); - return rand() / (1 + (double)RAND_MAX); -} - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/grandom.h b/Build/source/libs/poppler/poppler-0.26.3/goo/grandom.h deleted file mode 100644 index 45fa791aba8..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/grandom.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * grandom.h - * - * This file is licensed under the GPLv2 or later - * - * Pseudo-random number generation - * - * Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it> - */ - -#ifndef GRANDOM_H -#define GRANDOM_H - -#include "gtypes.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Fills the given buffer with random bytes - */ -extern void grandom_fill(Guchar *buff, int size); - -/* - * Returns a random number in [0,1) - */ -extern double grandom_double(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gstrtod.cc b/Build/source/libs/poppler/poppler-0.26.3/goo/gstrtod.cc deleted file mode 100644 index cd1d5b554f7..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gstrtod.cc +++ /dev/null @@ -1,147 +0,0 @@ -/* This file is part of Libspectre. - * - * Copyright (C) 2007, 2012 Albert Astals Cid <aacid@kde.org> - * Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org> - * - * Libspectre is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * Libspectre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* This function comes from spectre-utils from libspectre */ - -#include "gstrtod.h" - -#include <locale.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -#define ascii_isspace(c) \ - (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v') -#define ascii_isdigit(c) \ - (c >= '0' && c <= '9') - -double gatof(const char *nptr) -{ - return gstrtod(nptr, NULL); -} - -double gstrtod(const char *nptr, char **endptr) -{ - char *fail_pos; - double val; - struct lconv *locale_data; - const char *decimal_point; - int decimal_point_len; - const char *p, *decimal_point_pos; - const char *end = NULL; /* Silence gcc */ - int strtod_errno; - - fail_pos = NULL; - - locale_data = localeconv (); - decimal_point = locale_data->decimal_point; - decimal_point_len = strlen (decimal_point); - - decimal_point_pos = NULL; - end = NULL; - - if (decimal_point[0] != '.' || decimal_point[1] != 0) { - p = nptr; - /* Skip leading space */ - while (ascii_isspace (*p)) - p++; - - /* Skip leading optional sign */ - if (*p == '+' || *p == '-') - p++; - - if (ascii_isdigit (*p) || *p == '.') { - while (ascii_isdigit (*p)) - p++; - - if (*p == '.') - decimal_point_pos = p++; - - while (ascii_isdigit (*p)) - p++; - - if (*p == 'e' || *p == 'E') - p++; - if (*p == '+' || *p == '-') - p++; - while (ascii_isdigit (*p)) - p++; - - end = p; - } - /* For the other cases, we need not convert the decimal point */ - } - - if (decimal_point_pos) { - char *copy, *c; - - /* We need to convert the '.' to the locale specific decimal point */ - copy = (char *) malloc (end - nptr + 1 + decimal_point_len); - - c = copy; - memcpy (c, nptr, decimal_point_pos - nptr); - c += decimal_point_pos - nptr; - memcpy (c, decimal_point, decimal_point_len); - c += decimal_point_len; - memcpy (c, decimal_point_pos + 1, end - (decimal_point_pos + 1)); - c += end - (decimal_point_pos + 1); - *c = 0; - - errno = 0; - val = strtod (copy, &fail_pos); - strtod_errno = errno; - - if (fail_pos) { - if (fail_pos - copy > decimal_point_pos - nptr) - fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1); - else - fail_pos = (char *)nptr + (fail_pos - copy); - } - - free (copy); - } else if (end) { - char *copy; - - copy = (char *) malloc (end - (char *)nptr + 1); - memcpy (copy, nptr, end - nptr); - *(copy + (end - (char *)nptr)) = 0; - - errno = 0; - val = strtod (copy, &fail_pos); - strtod_errno = errno; - - if (fail_pos) { - fail_pos = (char *)nptr + (fail_pos - copy); - } - - free (copy); - } else { - errno = 0; - val = strtod (nptr, &fail_pos); - strtod_errno = errno; - } - - if (endptr) - *endptr = fail_pos; - - errno = strtod_errno; - - return val; -} diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gstrtod.h b/Build/source/libs/poppler/poppler-0.26.3/goo/gstrtod.h deleted file mode 100644 index e8abdadf53e..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gstrtod.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of Libspectre. - * - * Copyright (C) 2007 Albert Astals Cid <aacid@kde.org> - * Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org> - * - * Libspectre is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * Libspectre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -/* This function comes from spectre-utils from libspectre */ - -#ifndef GSTRTOD_H -#define GSTRTOD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* This function behaves like the standard atof()/(strtod() function - * does in the C locale. It does this without actually changing - * the current locale, since that would not be thread-safe. - * A limitation of the implementation is that this function - * will still accept localized versions of infinities and NANs. - */ -double gatof(const char *nptr); -double gstrtod(const char *nptr, char **endptr); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gtypes.h b/Build/source/libs/poppler/poppler-0.26.3/goo/gtypes.h deleted file mode 100644 index a8d4519497e..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gtypes.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * gtypes.h - * - * Some useful simple types. - * - * Copyright 1996-2003 Glyph & Cog, LLC - */ - -//======================================================================== -// -// Modified under the Poppler project - http://poppler.freedesktop.org -// -// All changes made under the Poppler project to this file are licensed -// under GPL version 2 or later -// -// Copyright (C) 2010 Patrick Spendrin <ps_ml@gmx.de> -// Copyright (C) 2010 Albert Astals Cid <aacid@kde.org> -// Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com> -// -// To see a description of the changes please see the Changelog file that -// came with your tarball or type make ChangeLog if you are building from git -// -//======================================================================== - -#ifndef GTYPES_H -#define GTYPES_H - -#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. - */ -typedef unsigned char Guchar; -typedef unsigned short Gushort; -typedef unsigned int Guint; -typedef unsigned long Gulong; -typedef long long Goffset; - -#endif diff --git a/Build/source/libs/poppler/poppler-0.26.3/goo/gtypes_p.h b/Build/source/libs/poppler/poppler-0.26.3/goo/gtypes_p.h deleted file mode 100644 index cc4866e1389..00000000000 --- a/Build/source/libs/poppler/poppler-0.26.3/goo/gtypes_p.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * gtypes_p.h - * - * Some useful simple types. - * - * Copyright (C) 2011 Adrian Johnson <ajohnson@redneon.com> - */ - -#ifndef GTYPES_P_H -#define GTYPES_P_H - -#include "config.h" - -/* - * Define precise integer types. - */ -#if HAVE_STDINT_H -#include <stdint.h> -#elif _MSC_VER -typedef signed __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef signed __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef signed __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; -#endif - -#endif |