X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FLexer.cc;h=9f0c3ca8f361d46e151c00e3e0857d3f0a1dac5b;hb=85c46a8011c7fd5e4bda282266006c972ea7606b;hp=4ca8cfe9f51e323d3fa41fd16bf6a7fddbcb0f8f;hpb=fc554a43712b76d16b41ec77dd311b4a78b1ef6b;p=swftools.git diff --git a/pdf2swf/xpdf/Lexer.cc b/pdf2swf/xpdf/Lexer.cc index 4ca8cfe..9f0c3ca 100644 --- a/pdf2swf/xpdf/Lexer.cc +++ b/pdf2swf/xpdf/Lexer.cc @@ -2,11 +2,13 @@ // // Lexer.cc // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma implementation #endif @@ -44,22 +46,22 @@ static char specialChars[256] = { // Lexer //------------------------------------------------------------------------ -Lexer::Lexer(Stream *str) { +Lexer::Lexer(XRef *xref, Stream *str) { Object obj; curStr.initStream(str); - streams = new Array(); + streams = new Array(xref); streams->add(curStr.copy(&obj)); strPtr = 0; freeArray = gTrue; curStr.streamReset(); } -Lexer::Lexer(Object *obj) { +Lexer::Lexer(XRef *xref, Object *obj) { Object obj2; if (obj->isStream()) { - streams = new Array(); + streams = new Array(xref); freeArray = gTrue; streams->add(obj->copy(&obj2)); } else { @@ -169,6 +171,13 @@ Object *Lexer::getObj(Object *obj) { scale = 0.1; while (1) { c = lookChar(); + if (c == '-') { + // ignore minus signs in the middle of numbers to match + // Adobe's behavior + error(getPos(), "Badly formatted number"); + getChar(); + continue; + } if (!isdigit(c)) { break; } @@ -204,11 +213,15 @@ Object *Lexer::getObj(Object *obj) { case '(': ++numParen; + c2 = c; break; case ')': - if (--numParen == 0) + if (--numParen == 0) { done = gTrue; + } else { + c2 = c; + } break; case '\\': @@ -466,3 +479,7 @@ void Lexer::skipToNextLine() { } } } + +GBool Lexer::isSpace(int c) { + return c >= 0 && c <= 0xff && specialChars[c] == 1; +}