Ignore:
Timestamp:
Aug 27, 2010, 11:00:52 AM (11 years ago)
Author:
Silvan Scherrer
Message:

poppler update to 0.14.2

Location:
trunk/poppler/mypoppler/goo
Files:
4 added
1 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/poppler/mypoppler/goo/GooMutex.h

    r290 r461  
    4848#define gUnlockMutex(m) LeaveCriticalSection(m)
    4949
    50 /* Lucide */
    5150#elif defined(OS2)
    5251
  • trunk/poppler/mypoppler/goo/GooString.cc

    r277 r461  
    1919// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
    2020// Copyright (C) 2007 Jeff Muizelaar <jeff@infidigm.net>
    21 // Copyright (C) 2008, 2009 Albert Astals Cid <aacid@kde.org>
     21// Copyright (C) 2008-2010 Albert Astals Cid <aacid@kde.org>
    2222//
    2323// To see a description of the changes please see the Changelog file that
     
    198198}
    199199
    200 GooString::GooString(GooString *str) {
     200GooString::GooString(const GooString *str) {
    201201  s = NULL;
    202202  length = 0;
     
    685685}
    686686
    687 int GooString::cmp(GooString *str) {
     687int GooString::cmp(GooString *str) const {
    688688  int n1, n2, i, x;
    689689  char *p1, *p2;
     
    700700}
    701701
    702 int GooString::cmpN(GooString *str, int n) {
     702int GooString::cmpN(GooString *str, int n) const {
    703703  int n1, n2, i, x;
    704704  char *p1, *p2;
     
    720720}
    721721
    722 int GooString::cmp(const char *sA) {
     722int GooString::cmp(const char *sA) const {
    723723  int n1, i, x;
    724724  const char *p1, *p2;
     
    740740}
    741741
    742 int GooString::cmpN(const char *sA, int n) {
     742int GooString::cmpN(const char *sA, int n) const {
    743743  int n1, i, x;
    744744  const char *p1, *p2;
  • trunk/poppler/mypoppler/goo/GooString.h

    r277 r461  
    1818// Copyright (C) 2006 Kristian HÞgsberg <krh@redhat.com>
    1919// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
    20 // Copyright (C) 2008, 2009 Albert Astals Cid <aacid@kde.org>
     20// Copyright (C) 2008-2010 Albert Astals Cid <aacid@kde.org>
    2121//
    2222// To see a description of the changes please see the Changelog file that
     
    4343
    4444  // Create a string from a C string.
    45   GooString(const char *sA);
     45  explicit GooString(const char *sA);
    4646
    4747  // Create a string from <lengthA> chars at <sA>.  This string
     
    5959
    6060  // Copy a string.
    61   GooString(GooString *str);
    62   GooString *copy() { return new GooString(this); }
     61  explicit GooString(const GooString *str);
     62  GooString *copy() const { return new GooString(this); }
    6363
    6464  // Concatenate two strings.
     
    9999
    100100  // Get C string.
    101   char *getCString() { return s; }
     101  char *getCString() const { return s; }
    102102
    103103  // Get <i>th character.
     
    132132
    133133  // Compare two strings:  -1:<  0:=  +1:>
    134   int cmp(GooString *str);
    135   int cmpN(GooString *str, int n);
    136   int cmp(const char *sA);
    137   int cmpN(const char *sA, int n);
     134  int cmp(GooString *str) const;
     135  int cmpN(GooString *str, int n) const;
     136  int cmp(const char *sA) const;
     137  int cmpN(const char *sA, int n) const;
    138138
    139139  GBool hasUnicodeMarker(void);
     
    146146
    147147private:
     148  GooString(const GooString &other);
     149  GooString& operator=(const GooString &other);
     150
    148151  // you can tweak this number for a different speed/memory usage tradeoffs.
    149152  // In libc malloc() rounding is 16 so it's best to choose a value that
  • trunk/poppler/mypoppler/goo/GooTimer.cc

    r257 r461  
    77// Copyright 2005 Jonathan Blandford <jrb@redhat.com>
    88// Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
     9// Copyright 2010 Hib Eris <hib@hiberis.nl>
    910// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team
    1011//
     
    3334#ifdef HAVE_GETTIMEOFDAY
    3435  gettimeofday(&start_time, NULL);
    35 #elif defined(_MSC_VER)
     36#elif defined(_WIN32)
    3637  QueryPerformanceCounter(&start_time);
    3738#endif
     
    4243#ifdef HAVE_GETTIMEOFDAY
    4344  gettimeofday(&end_time, NULL);
    44 #elif defined(_MSC_VER)
     45#elif defined(_WIN32)
    4546  QueryPerformanceCounter(&end_time);
    4647#endif
     
    7172  return total;
    7273}
    73 #elif defined(_MSC_VER)
     74#elif defined(_WIN32)
    7475double GooTimer::getElapsed()
    7576{
  • trunk/poppler/mypoppler/goo/GooTimer.h

    r257 r461  
    77// Copyright 2005 Jonathan Blandford <jrb@redhat.com>
    88// Copyright 2007 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
     9// Copyright 2010 Hib Eris <hib@hiberis.nl>
    910// Inspired by gtimer.c in glib, which is Copyright 2000 by the GLib Team
    1011//
     
    2324#endif
    2425
    25 #ifdef _MSC_VER
     26#ifdef _WIN32
    2627#include <windows.h>
    2728#endif
     
    4546  struct timeval start_time;
    4647  struct timeval end_time;
    47 #elif defined(_MSC_VER)
     48#elif defined(_WIN32)
    4849  LARGE_INTEGER start_time;
    4950  LARGE_INTEGER end_time;
  • trunk/poppler/mypoppler/goo/GooVector.h

    r257 r461  
    11//========================================================================
    22//
    3 // This file comes from pdftohtml project
    4 // http://pdftohtml.sourceforge.net
     3// GooVector.h
    54//
    6 // Copyright from:
    7 // Gueorgui Ovtcharov
    8 // Rainer Dorsch <http://www.ra.informatik.uni-stuttgart.de/~rainer/>
    9 // Mikhail Kruk <meshko@cs.brandeis.edu>
     5// This file is licensed under the GPLv2 or later
     6//
     7// Copyright 2010 David Benjamin <davidben@mit.edu>
     8// Copyright 2010 Albert Astals Cid <aacid@kde.org>
    109//
    1110//========================================================================
    1211
    13 #ifndef GOO_VECTOR_H
    14 #define GOO_VECTOR_H
    15 #include "goo/gtypes.h"
    1612
    1713
    18 template<class T>
    19 class GooVector{
    20 private:
    21    
    22    int _size;
    23    T*  last;
    24    T*  storage;
    25  
    26    void resize(){
    27      if (_size==0) _size=2;else _size=2*_size;
    28       T *tmp=new T[_size];
    29      if (storage){
    30        last=copy(storage,last,tmp);
    31        delete [] storage;
    32       }
    33      else last=tmp;
    34      storage=tmp;
    35     }
     14#ifndef GOO_GOOVECTOR_H
     15#define GOO_GOOVECTOR_H
    3616
    37    T* copy(T* src1,T* src2,T* dest){
    38      T* tmp=src1;
    39      T* d=dest;
    40       while(tmp!=src2){
    41         *d=*tmp;
    42          d++;tmp++;
    43        }
    44       return d;
    45    }
    46 
    47 public:
    48  typedef T* iterator;
    49 
    50  GooVector(){
    51   _size=0;
    52   last=0;
    53   storage=0;
    54 }
    55 
    56 
    57 
    58 virtual ~GooVector(){
    59   delete[] storage ;
    60 
    61 
    62 void reset(){
    63   last=storage;
    64 }
    65 
    66 int size(){
    67   return (last-storage);
    68 }   
    69 void push_back(const T& elem){
    70   if (!storage||(size() >=_size)) resize();
    71         *last=elem;
    72          last++;
    73  
    74      
    75 }
    76 
    77 
    78 T pop_back() {
    79     if (last!=storage) last--;
    80 
    81     return *last;
    82 }
    83 
    84 
    85 T operator[](unsigned int i){
    86  return *(storage+i);
    87 }
    88  
    89 
    90 GBool isEmpty() const{
    91  return !_size || (last==storage) ;
    92 }
    93 
    94 
    95 
    96 iterator begin() const{
    97  return storage;
    98 }
    99 
    100 iterator end() const {
    101   return last;
    102 }
    103 };
     17#ifdef USE_GCC_PRAGMAS
     18#pragma interface
    10419#endif
    10520
     21#include <new> // vector implementations need placement-new
    10622
     23#include <assert.h>
     24#include <stdlib.h>
    10725
    108    
     26/* Mostly STL-compatible vector class. Should correctly call constructors and
     27 * destructors, but does not carefully handle alignment requirements. */
     28
     29template<class T> class GooVector {
     30public:
     31  /* various STL-compatible typedefs */
     32  typedef T value_type;
     33  typedef T* pointer;
     34  typedef T& reference;
     35  typedef const T& const_reference;
     36  typedef size_t size_type;
     37  typedef int difference_type;
     38  typedef T* iterator;
     39  typedef const T* const_iterator;
     40  // TODO: reverse_iterator, if we feel like it
    10941 
    110  
     42  GooVector() : m_data(NULL), m_capacity(0), m_size(0) {}
     43  explicit GooVector(size_type n) : m_data(NULL), m_capacity(0), m_size(0) {
     44    resize(n);
     45  }
     46  explicit GooVector(size_type n, const T& t) : m_data(NULL), m_capacity(0), m_size(0) {
     47    resize(n, t);
     48  }
     49  explicit GooVector(const GooVector& gv) : m_data(NULL), m_capacity(0), m_size(0) {
     50    reserve(gv.size());
     51    for (size_type i = 0; i < m_size; i++) {
     52      push_back(gv[i]);
     53    }
     54  }
    11155
     56  ~GooVector() {
     57    clear();
     58  }
    11259
     60  iterator begin() { return m_data; }
     61  const_iterator begin() const { return m_data; }
     62  iterator end() { return m_data + m_size; }
     63  const_iterator end() const { return m_data + m_size; }
    11364
     65  size_type size() const { return m_size; }
     66  size_type capacity() const { return m_capacity; }
     67
     68  bool empty() const { return m_size == 0; }
     69
     70  reference operator[] (size_type n) { return m_data[n]; }
     71  const_reference operator[] (size_type n) const { return m_data[n]; }
     72
     73  reference at(size_type n) {
     74    assert(n < m_size);
     75    return m_data[n];
     76  }
     77  const_reference at(size_type n) const {
     78    assert(n < m_size);
     79    return m_data[n];
     80  }
     81
     82  reference front() { assert(!empty()); return m_data[0]; }
     83  const_reference front() const { assert(!empty()); return m_data[0]; }
     84
     85  reference back() { assert(!empty()); return m_data[m_size-1]; }
     86  const_reference back() const { assert(!empty()); return m_data[m_size-1]; }
     87
     88  void push_back(const T& v) {
     89    reserve(m_size + 1);
     90    place_new(m_data + m_size, v);
     91    m_size++;
     92  }
     93  void pop_back() {
     94    assert(!empty());
     95    m_size--;
     96    destruct(m_data + m_size);
     97  }
     98
     99  void clear() {
     100    for (size_t i = 0; i < m_size; i++) {
     101      destruct(m_data + i);
     102    }
     103    m_size = 0;
     104    free(m_data);
     105    m_data = NULL;
     106    m_capacity = 0;
     107  }
     108
     109  void reserve(size_type cap) {
     110    if (m_capacity >= cap) return;
     111    // make sure we always at least double
     112    if (m_capacity*2 > cap)
     113      cap = m_capacity*2;
     114    resize_internal(cap);
     115  }
     116
     117  void resize(size_type n) { resize(n, T()); }
     118  void resize(size_type n, const T& t) {
     119    reserve(n);
     120    while (m_size < n)
     121      push_back(t);
     122    while (m_size > n)
     123      pop_back();
     124  }
     125
     126private:
     127  T *m_data;
     128  size_type m_capacity;
     129  size_type m_size;
     130
     131  inline void destruct(T *obj) {
     132    obj->~T();
     133  }
     134  inline void place_new(T *loc, const T& v) {
     135    new (loc) T(v);
     136  }
     137
     138  inline void resize_internal(size_type new_cap) {
     139    assert(new_cap >= m_capacity);
     140    // To be correct with ctors and dtors, we do not use realloc and friends.
     141    // A more efficient implementation would specialize for POD types and just
     142    // realloc() or something. Meh, if we care, we ought to use just STL's
     143    T *new_data = (T*) malloc(sizeof(T) * new_cap);
     144    assert(new_data);
     145    // Move over old data
     146    if (m_data) {
     147      for (size_type i = 0; i < m_size; i++) {
     148        place_new(new_data + i, m_data[i]);
     149        destruct(m_data + i);
     150      }
     151      free(m_data);
     152    }
     153    // And set the new values
     154    m_data = new_data;
     155    m_capacity = new_cap;
     156  }
     157};
     158
     159#endif
  • trunk/poppler/mypoppler/goo/PNGWriter.cc

    r277 r461  
    88// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com>
    99// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
     10// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
     11// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com>
    1012//
    1113//========================================================================
     
    2729}
    2830
    29 bool PNGWriter::init(FILE *f, int width, int height)
     31bool PNGWriter::init(FILE *f, int width, int height, int hDPI, int vDPI)
    3032{
    3133        /* initialize stuff */
     
    6365        png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, color_type, interlace_type, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
    6466
     67        // PNG_RESOLUTION_UNKNOWN means dots per inch
     68        png_set_pHYs(png_ptr, info_ptr, hDPI, vDPI, PNG_RESOLUTION_UNKNOWN);
     69
    6570        png_write_info(png_ptr, info_ptr);
    6671        if (setjmp(png_jmpbuf(png_ptr))) {
     
    7277}
    7378
    74 bool PNGWriter::writePointers(png_bytep *rowPointers)
     79bool PNGWriter::writePointers(unsigned char **rowPointers, int rowCount)
    7580{
    7681        png_write_image(png_ptr, rowPointers);
     
    8489}
    8590
    86 bool PNGWriter::writeRow(png_bytep *row)
     91bool PNGWriter::writeRow(unsigned char **row)
    8792{
    8893        // Write the row to the file
  • trunk/poppler/mypoppler/goo/PNGWriter.h

    r277 r461  
    88// Copyright (C) 2009 Shen Liang <shenzhuxi@gmail.com>
    99// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
     10// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
     11// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com>
    1012//
    1113//========================================================================
     
    2022#include <cstdio>
    2123#include <png.h>
     24#include "ImgWriter.h"
    2225
    23 class PNGWriter
     26class PNGWriter : public ImgWriter
    2427{
    2528        public:
     
    2730                ~PNGWriter();
    2831               
    29                 bool init(FILE *f, int width, int height);
     32                bool init(FILE *f, int width, int height, int hDPI, int vDPI);
    3033               
    31                 bool writePointers(png_bytep *rowPointers);
    32                 bool writeRow(png_bytep *row);
     34                bool writePointers(unsigned char **rowPointers, int rowCount);
     35                bool writeRow(unsigned char **row);
    3336               
    3437                bool close();
  • trunk/poppler/mypoppler/goo/gfile.cc

    r292 r461  
    1919// Copyright (C) 2006 Kristian HÞgsberg <krh@redhat.com>
    2020// Copyright (C) 2008 Adam Batkin <adam@batkin.net>
    21 // Copyright (C) 2008 Hib Eris <hib@hiberis.nl>
     21// Copyright (C) 2008, 2010 Hib Eris <hib@hiberis.nl>
    2222// Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
    2323// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
     
    4242#  include <limits.h>
    4343#  include <string.h>
    44 /* Lucide */
    4544#  if !defined(VMS) && !defined(ACORN) && !defined(MACOS) && !defined(OS2)
    4645#    include <pwd.h>
     
    6665  return new GooString("SYS$LOGIN:");
    6766
    68 /* Lucide */
    6967#elif defined(__EMX__) || defined(_WIN32) || defined(OS2)
    7068  //---------- OS/2+EMX and Win32 ----------
     
    216214  return path;
    217215
    218 /* Lucide */
    219216#elif defined(__EMX__) || defined(OS2)
    220217  //---------- OS/2+EMX ----------
     
    304301  return new GooString();
    305302
    306 /* Lucide */
    307303#elif defined(__EMX__) || defined(_WIN32) || defined(OS2)
    308304  //---------- OS/2+EMX and Win32 ----------
     
    349345         (path[0] == '[' && path[1] != '.' && path[1] != '-');
    350346
    351 /* Lucide */
    352347#elif defined(__EMX__) || defined(_WIN32) || defined(OS2)
    353348  //---------- OS/2+EMX and Win32 ----------
     
    382377#elif defined(_WIN32)
    383378  //---------- Win32 ----------
    384   char buf[_MAX_PATH];
     379  char buf[MAX_PATH];
    385380  char *fp;
    386381
    387382  buf[0] = '\0';
    388   if (!GetFullPathName(path->getCString(), _MAX_PATH, buf, &fp)) {
     383  if (!GetFullPathName(path->getCString(), MAX_PATH, buf, &fp)) {
    389384    path->clear();
    390385    return path;
     
    404399  return path;
    405400
    406 /* Lucide */
    407401#elif defined(OS2)
    408402  //---------- OS/2 -----------
     
    516510  delete s;
    517511  return gFalse;
    518 /* Lucide */
     512
    519513#elif defined(VMS) || defined(__EMX__) || defined(ACORN) || defined(MACOS) || defined(OS2)
    520514  //---------- non-Unix ----------
  • trunk/poppler/mypoppler/goo/gfile.h

    r290 r461  
    6262#      include <ndir.h>
    6363#    endif
    64 /* Lucide */
    6564#    if HAVE_DIRECT_H
    6665#      include <direct.h>
  • trunk/poppler/mypoppler/goo/gstrtod.cc

    r367 r461  
    2323#include "gstrtod.h"
    2424
    25 /* Lucide */
     25#if !defined(OS2)
     26#include <clocale>
     27#include <cerrno>
     28#include <cstdlib>
     29#include <cstring>
     30#else
    2631#include <locale.h>
    2732#include <errno.h>
    2833#include <stdlib.h>
    2934#include <string.h>
     35#endif
    3036
    3137#define ascii_isspace(c) \
  • trunk/poppler/mypoppler/goo/gtypes.h

    r2 r461  
    66 * Copyright 1996-2003 Glyph & Cog, LLC
    77 */
     8
     9//========================================================================
     10//
     11// Modified under the Poppler project - http://poppler.freedesktop.org
     12//
     13// All changes made under the Poppler project to this file are licensed
     14// under GPL version 2 or later
     15//
     16// Copyright (C) 2010 Patrick Spendrin <ps_ml@gmx.de>
     17//
     18// To see a description of the changes please see the Changelog file that
     19// came with your tarball or type make ChangeLog if you are building from git
     20//
     21//========================================================================
    822
    923#ifndef GTYPES_H
     
    1832#define gFalse 0
    1933
     34#ifdef _MSC_VER
     35#pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
     36#endif
     37
    2038/*
    2139 * These have stupid names to avoid conflicts with <sys/types.h>,
Note: See TracChangeset for help on using the changeset viewer.