"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xpdf/Lexer.cc" between
xpdf-4.01.01.tar.gz and xpdf-4.02.tar.gz

About: Xpdf is a PDF viewer for X.

Lexer.cc  (xpdf-4.01.01):Lexer.cc  (xpdf-4.02)
skipping to change at line 115 skipping to change at line 115
int Lexer::lookChar() { int Lexer::lookChar() {
if (curStr.isNone()) { if (curStr.isNone()) {
return EOF; return EOF;
} }
return curStr.streamLookChar(); return curStr.streamLookChar();
} }
Object *Lexer::getObj(Object *obj) { Object *Lexer::getObj(Object *obj) {
char *p; char *p;
int c, c2; int c, c2;
GBool comment, neg, doubleMinus, done; GBool comment, neg, doubleMinus, done, invalid;
int numParen; int numParen;
int xi; int xi;
double xf, scale; double xf, scale;
GString *s; GString *s;
int n, m; int n, m;
// skip whitespace and comments // skip whitespace and comments
comment = gFalse; comment = gFalse;
while (1) { while (1) {
if ((c = getChar()) == EOF) { if ((c = getChar()) == EOF) {
skipping to change at line 346 skipping to change at line 346
else else
s->append(tokBuf, n); s->append(tokBuf, n);
obj->initString(s); obj->initString(s);
break; break;
// name // name
case '/': case '/':
p = tokBuf; p = tokBuf;
n = 0; n = 0;
s = NULL; s = NULL;
invalid = gFalse;
while ((c = lookChar()) != EOF && !specialChars[c]) { while ((c = lookChar()) != EOF && !specialChars[c]) {
getChar(); getChar();
if (c == '#') { if (c == '#') {
c2 = lookChar(); c2 = lookChar();
if (c2 >= '0' && c2 <= '9') { if (c2 >= '0' && c2 <= '9') {
c = c2 - '0'; c = c2 - '0';
} else if (c2 >= 'A' && c2 <= 'F') { } else if (c2 >= 'A' && c2 <= 'F') {
c = c2 - 'A' + 10; c = c2 - 'A' + 10;
} else if (c2 >= 'a' && c2 <= 'f') { } else if (c2 >= 'a' && c2 <= 'f') {
c = c2 - 'a' + 10; c = c2 - 'a' + 10;
skipping to change at line 373 skipping to change at line 374
c = (c << 4) + (c2 - '0'); c = (c << 4) + (c2 - '0');
} else if (c2 >= 'A' && c2 <= 'F') { } else if (c2 >= 'A' && c2 <= 'F') {
c = (c << 4) + (c2 - 'A' + 10); c = (c << 4) + (c2 - 'A' + 10);
} else if (c2 >= 'a' && c2 <= 'f') { } else if (c2 >= 'a' && c2 <= 'f') {
c = (c << 4) + (c2 - 'a' + 10); c = (c << 4) + (c2 - 'a' + 10);
} else { } else {
error(errSyntaxError, getPos(), "Invalid hex escape in name"); error(errSyntaxError, getPos(), "Invalid hex escape in name");
goto notEscChar; goto notEscChar;
} }
getChar(); getChar();
if (c == 0) {
invalid = gTrue;
}
} }
notEscChar: notEscChar:
// the PDF spec claims that names are limited to 127 chars, but // the PDF spec claims that names are limited to 127 chars, but
// Distiller 8 will produce longer names, and Acrobat 8 will // Distiller 8 will produce longer names, and Acrobat 8 will
// accept longer names // accept longer names
++n; ++n;
if (n < tokBufSize) { if (n < tokBufSize) {
*p++ = (char)c; *p++ = (char)c;
} else if (n == tokBufSize) { } else if (n == tokBufSize) {
*p = (char)c; *p = (char)c;
s = new GString(tokBuf, n); s = new GString(tokBuf, n);
} else { } else {
s->append((char)c); s->append((char)c);
} }
} }
if (n < tokBufSize) { if (invalid) {
error(errSyntaxError, getPos(), "Null character in name");
obj->initError();
if (s) {
delete s;
}
} else if (n < tokBufSize) {
*p = '\0'; *p = '\0';
obj->initName(tokBuf); obj->initName(tokBuf);
} else { } else {
obj->initName(s->getCString()); obj->initName(s->getCString());
delete s; delete s;
} }
break; break;
// array punctuation // array punctuation
case '[': case '[':
 End of changes. 4 change blocks. 
2 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)