~ubuntu-branches/ubuntu/jaunty/cups/jaunty

« back to all changes in this revision

Viewing changes to debian/local/filters/pdf-filters/pdftopdf/P2PObject.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Till Kamppeter, Martin Pitt
  • Date: 2009-02-15 18:39:03 UTC
  • mfrom: (6.1.30 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090215183903-i0nhvqyqj4vyn52a
Tags: 1.3.9-13
[ Till Kamppeter ]
* debian/local/filters/pdf-filters/filter/imagetopdf.c: Added support for
  the new "fit-to-page" option (new, more intuitive name for "fitplot").
* debian/filters/pstopdf: Only apply paper size if the "fitplot" or the
  "fit-to-page" option is set.
* debian/local/filters/cpdftocps: Only the last digit of the number of
  copies was used (LP: #309314).
* debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Do not preceed the
  PDF output with a newline (LP: #303691). Only impose the page size from
  the PPD file to all pages if the "fitplot" or the "fit-to-page" option is 
  set. This prevented from automatic paper tray switching to the correct paper
  sizes when a multiple-page-size document is printed (partial fix for
  LP: #310575).
* debian/patches/pdftops-cups-1.4.dpatch: Updated from CUPS 1.4 SVN. Contains
  fixes for multiple-page-size document printing (partial fix for
  LP: #310575).
* debian/patches/pdftops-dont_fail_on_cancel.dpatch: Removed, should be
  fixed in the new upstream version of pdftops.

[ Martin Pitt ]
* debian/patches/pdftops-cups-1.4.dpatch: Add definition of
  HAVE_PDFTOPS and CUPS_PDFTOPS, so that the filter actually gets
  again built with pdftops support. (Fixes Till's change from above).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Copyright (c) 2006-2007, BBR Inc.  All rights reserved.
 
4
 
 
5
Permission is hereby granted, free of charge, to any person obtaining
 
6
a copy of this software and associated documentation files (the
 
7
"Software"), to deal in the Software without restriction, including
 
8
without limitation the rights to use, copy, modify, merge, publish,
 
9
distribute, sublicense, and/or sell copies of the Software, and to
 
10
permit persons to whom the Software is furnished to do so, subject to
 
11
the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included
 
14
in all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
17
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
19
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 
20
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 
21
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 
22
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
23
 
 
24
*/
 
25
/*
 
26
 P2PObject.cc
 
27
 pdftopdf Object
 
28
*/
 
29
 
 
30
#include <config.h>
 
31
#include <string.h>
 
32
#include "goo/gmem.h"
 
33
#include "P2PObject.h"
 
34
#include "P2PXRef.h"
 
35
 
 
36
/* orginal number hash table size. should be 2^n */
 
37
#define ORGTABLESIZE 4096
 
38
 
 
39
P2PObject **P2PObject::orgTable = 0;
 
40
 
 
41
int P2PObject::hash(int orgNumA, int orgGenA)
 
42
{
 
43
  return orgNumA & (ORGTABLESIZE-1);
 
44
}
 
45
 
 
46
void P2PObject::put()
 
47
{
 
48
  if (orgTable == 0) {
 
49
    /* first time, alloc table */
 
50
    orgTable = new P2PObject *[ORGTABLESIZE];
 
51
    memset(orgTable,0,ORGTABLESIZE*sizeof(P2PObject *));
 
52
  }
 
53
 
 
54
  if (orgNum > 0 && orgGen >=0) {
 
55
    /* put this into hashtable */
 
56
    int hv = hash(orgNum, orgGen);
 
57
    P2PObject **p;
 
58
 
 
59
    for (p = &orgTable[hv];*p != 0;p = &((*p)->next));
 
60
    *p = this;
 
61
  }
 
62
}
 
63
 
 
64
void P2PObject::remove()
 
65
{
 
66
  if (orgNum > 0 && orgGen >=0) {
 
67
    /* remove this from hashtable */
 
68
    int hv = hash(orgNum, orgGen);
 
69
    P2PObject **p;
 
70
 
 
71
    for (p = &orgTable[hv];*p != 0;p = &((*p)->next)) {
 
72
      if (*p == this) {
 
73
        *p = next;
 
74
        next = 0;
 
75
        break;
 
76
      }
 
77
    }
 
78
  }
 
79
}
 
80
 
 
81
P2PObject *P2PObject::find(int orgNumA, int orgGenA)
 
82
{
 
83
  if (orgNumA > 0 && orgGenA >=0) {
 
84
    /* remove this from hashtable */
 
85
    int hv = hash(orgNumA, orgGenA);
 
86
    P2PObject *p;
 
87
 
 
88
    for (p = orgTable[hv];p != 0;p = p->next) {
 
89
      if (p->orgNum == orgNumA && p->orgGen == orgGenA) {
 
90
        return p;
 
91
      }
 
92
    }
 
93
  }
 
94
  return 0;
 
95
}
 
96
 
 
97
void P2PObject::outputBegin(P2POutputStream *str)
 
98
{
 
99
  int num, gen;
 
100
 
 
101
  P2PXRef::put(this,str);
 
102
  getNum(&num,&gen);
 
103
  str->printf("%d %d obj\n",num,gen);
 
104
}
 
105
 
 
106
void P2PObject::outputEnd(P2POutputStream *str)
 
107
{
 
108
  str->puts("endobj\n");
 
109
}
 
110
 
 
111
void P2PObject::outputRef(P2POutputStream *str)
 
112
{
 
113
  int num, gen;
 
114
 
 
115
  getNum(&num,&gen);
 
116
  str->printf("%d %d R",num,gen);
 
117
}