~ubuntu-branches/ubuntu/precise/poppler/precise-security

« back to all changes in this revision

Viewing changes to qt4/src/poppler-private.cc

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2011-03-08 10:46:40 UTC
  • mfrom: (1.5.5) (4.3.2 experimental)
  • Revision ID: package-import@ubuntu.com-20110308104640-de1rwygu2cx2t0yt
Tags: 0.16.3-1ubuntu1
* Merge with Debian experimental. Remaining Ubuntu changes:
  - debian/control: Lower poppler-data to Suggests: (handled by
    language-selector).
  - Add 10_fix-a4-page-shift-on-brother-ps-printers.patch: Fix page shifts
    when printing on A4 paper with Brother PostScript printers.
    (LP #293832)
  - debian/control, debian/rules: Disable OpenJPEG, it's in universe.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
}
47
47
 
 
48
    static UnicodeMap *utf8Map = 0;
 
49
 
48
50
    void setDebugErrorFunction(PopplerDebugFunc function, const QVariant &closure)
49
51
    {
50
52
        Debug::debugFunction = function ? function : Debug::qDebugDebugFunction;
70
72
    }
71
73
 
72
74
    QString unicodeToQString(Unicode* u, int len) {
73
 
        static UnicodeMap *uMap = 0;
74
 
        static GlobalParams *gParams = globalParams;
75
 
        if (!uMap || gParams != globalParams)
 
75
        if (!utf8Map)
76
76
        {
77
77
                GooString enc("UTF-8");
78
 
                uMap = globalParams->getUnicodeMap(&enc);
79
 
                uMap->incRefCnt();
80
 
                gParams = globalParams;
 
78
                utf8Map = globalParams->getUnicodeMap(&enc);
 
79
                utf8Map->incRefCnt();
81
80
        }
82
81
 
83
82
        // ignore the last character if it is 0x0
90
89
        for (int i = 0; i < len; ++i)
91
90
        {
92
91
            char buf[8];
93
 
            const int n = uMap->mapUnicode(u[i], buf, sizeof(buf));
 
92
            const int n = utf8Map->mapUnicode(u[i], buf, sizeof(buf));
94
93
            convertedStr.append(buf, n);
95
94
        }
96
95
 
223
222
            default: ;
224
223
        }
225
224
    }
 
225
    
 
226
    DocumentData::~DocumentData()
 
227
    {
 
228
        qDeleteAll(m_embeddedFiles);
 
229
        delete (OptContentModel *)m_optContentModel;
 
230
        delete doc;
 
231
        delete m_outputDev;
 
232
        delete m_fontInfoIterator;
 
233
    
 
234
        count --;
 
235
        if ( count == 0 )
 
236
        {
 
237
            utf8Map = 0;
 
238
            delete globalParams;
 
239
        }
 
240
      }
 
241
    
 
242
    void DocumentData::init(GooString *ownerPassword, GooString *userPassword)
 
243
    {
 
244
        m_fontInfoIterator = 0;
 
245
        m_backend = Document::SplashBackend;
 
246
        m_outputDev = 0;
 
247
        paperColor = Qt::white;
 
248
        m_hints = 0;
 
249
        m_optContentModel = 0;
 
250
        // It might be more appropriate to delete these in PDFDoc
 
251
        delete ownerPassword;
 
252
        delete userPassword;
 
253
      
 
254
        if ( count == 0 )
 
255
        {
 
256
            utf8Map = 0;
 
257
            globalParams = new GlobalParams();
 
258
            setErrorFunction(qt4ErrorFunction);
 
259
        }
 
260
        count ++;
 
261
    }
 
262
 
226
263
 
227
264
    void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, GooList * items )
228
265
    {