~naesten/tex-live/trunk

« back to all changes in this revision

Viewing changes to libs/poppler/poppler-src/poppler/Hints.cc

  • Committer: karl
  • Date: 2018-01-09 18:53:05 UTC
  • Revision ID: svn-v4:c570f23f-e606-0410-a88d-b1316a301751:trunk/Build/source:46257
poppler 0.62.0, requiring C++11; luatex not updated yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
// This file is licensed under the GPLv2 or later
6
6
//
7
7
// Copyright 2010, 2012 Hib Eris <hib@hiberis.nl>
8
 
// Copyright 2010, 2011, 2013, 2014, 2016 Albert Astals Cid <aacid@kde.org>
 
8
// Copyright 2010, 2011, 2013, 2014, 2016, 2017 Albert Astals Cid <aacid@kde.org>
9
9
// Copyright 2010, 2013 Pino Toscano <pino@kde.org>
10
10
// Copyright 2013 Adrian Johnson <ajohnson@redneon.com>
11
11
// Copyright 2014 Fabio D'Urso <fabiodurso@hotmail.it>
181
181
  hintsLength2 = linearization->getHintsLength2();
182
182
 
183
183
  Parser *parser;
184
 
  Object obj;
185
184
 
186
185
  int bufLength = hintsLength + hintsLength2;
187
186
 
188
187
  std::vector<char> buf(bufLength);
189
188
  char *p = &buf[0];
190
189
 
191
 
  obj.initNull();
192
 
  Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, &obj);
 
190
  Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, Object(objNull));
193
191
  s->reset();
194
192
  for (Guint i=0; i < hintsLength; i++) { *p++ = s->getChar(); }
195
193
  delete s;
196
194
 
197
195
  if (hintsOffset2 && hintsLength2) {
198
 
    obj.initNull();
199
 
    s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, &obj);
 
196
    s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, Object(objNull));
200
197
    s->reset();
201
198
    for (Guint i=0; i < hintsLength2; i++) { *p++ = s->getChar(); }
202
199
    delete s;
203
200
  }
204
201
 
205
 
  obj.initNull();
206
 
  MemStream *memStream = new MemStream (&buf[0], 0, bufLength, &obj);
 
202
  MemStream *memStream = new MemStream (&buf[0], 0, bufLength, Object(objNull));
207
203
 
208
 
  obj.initNull();
209
204
  parser = new Parser(xref, new Lexer(xref, memStream), gTrue);
210
205
 
211
206
  int num, gen;
212
 
  if (parser->getObj(&obj)->isInt() &&
213
 
     (num = obj.getInt(), obj.free(), parser->getObj(&obj)->isInt()) &&
214
 
     (gen = obj.getInt(), obj.free(), parser->getObj(&obj)->isCmd("obj")) &&
215
 
     (obj.free(), parser->getObj(&obj, gFalse,
 
207
  Object obj;
 
208
  if ((obj = parser->getObj(), obj.isInt()) &&
 
209
     (num = obj.getInt(), obj = parser->getObj(), obj.isInt()) &&
 
210
     (gen = obj.getInt(), obj = parser->getObj(), obj.isCmd("obj")) &&
 
211
     (obj = parser->getObj(gFalse,
216
212
         secHdlr ? secHdlr->getFileKey() : (Guchar *)NULL,
217
213
         secHdlr ? secHdlr->getEncAlgorithm() : cryptRC4,
218
214
         secHdlr ? secHdlr->getFileKeyLength() : 0,
219
 
         num, gen, 0, gTrue)->isStream())) {
 
215
         num, gen, 0, gTrue), obj.isStream())) {
220
216
    Stream *hintsStream = obj.getStream();
221
217
    Dict *hintsDict = obj.streamGetDict();
222
218
 
238
234
  } else {
239
235
    error(errSyntaxWarning, -1, "Failed parsing hints table object");
240
236
  }
241
 
  obj.free();
242
237
 
243
238
  delete parser;
244
239
}