use skip() instead of getChar() when the return value isn't used anyway

This commit is contained in:
Andreas Gal 2011-05-09 23:47:08 -07:00
parent da1532e0d8
commit 4a7d875495

20
pdf.js
View File

@ -862,7 +862,7 @@ var Lexer = (function() {
// the last character doesn't belong to us // the last character doesn't belong to us
break; break;
} }
stream.getChar(); stream.skip();
} while (true); } while (true);
var value = parseFloat(str); var value = parseFloat(str);
if (isNaN(value)) if (isNaN(value))
@ -923,11 +923,11 @@ var Lexer = (function() {
var x = ch - '0'; var x = ch - '0';
ch = stream.lookChar(); ch = stream.lookChar();
if (ch >= '0' && ch <= '7') { if (ch >= '0' && ch <= '7') {
this.getChar(); this.skip();
x = (x << 3) + (x - '0'); x = (x << 3) + (x - '0');
ch = stream.lookChar(); ch = stream.lookChar();
if (ch >= '0' && ch <= '7') { if (ch >= '0' && ch <= '7') {
stream.getChar(); stream.skip();
x = (x << 3) + (x - '0'); x = (x << 3) + (x - '0');
} }
} }
@ -936,7 +936,7 @@ var Lexer = (function() {
case '\r': case '\r':
ch = stream.lookChar(); ch = stream.lookChar();
if (ch == '\n') if (ch == '\n')
stream.getChar(); stream.skip();
break; break;
case '\n': case '\n':
break; break;
@ -958,12 +958,12 @@ var Lexer = (function() {
var str = ""; var str = "";
var stream = this.stream; var stream = this.stream;
while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) { while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) {
stream.getChar(); stream.skip();
if (ch == "#") { if (ch == "#") {
ch = stream.lookChar(); ch = stream.lookChar();
var x = ToHexDigit(ch); var x = ToHexDigit(ch);
if (x != -1) { if (x != -1) {
stream.getChar(); stream.skip();
var x2 = ToHexDigit(stream.getChar()); var x2 = ToHexDigit(stream.getChar());
if (x2 == -1) if (x2 == -1)
error("Illegal digit in hex char in name"); error("Illegal digit in hex char in name");
@ -1039,7 +1039,7 @@ var Lexer = (function() {
ch = stream.lookChar(); ch = stream.lookChar();
if (ch == '<') { if (ch == '<') {
// dict punctuation // dict punctuation
stream.getChar(); stream.skip();
return new Cmd("<<"); return new Cmd("<<");
} }
return this.getHexString(ch); return this.getHexString(ch);
@ -1047,7 +1047,7 @@ var Lexer = (function() {
case '>': case '>':
ch = stream.lookChar(); ch = stream.lookChar();
if (ch == '>') { if (ch == '>') {
stream.getChar(); stream.skip();
return new Cmd(">>"); return new Cmd(">>");
} }
// fall through // fall through
@ -1061,7 +1061,7 @@ var Lexer = (function() {
// command // command
var str = ch; var str = ch;
while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) { while (!!(ch = stream.lookChar()) && !specialChars[ch.charCodeAt(0)]) {
stream.getChar(); stream.skip();
if (str.length == 128) { if (str.length == 128) {
error("Command token too long"); error("Command token too long");
break; break;
@ -1084,7 +1084,7 @@ var Lexer = (function() {
return; return;
if (ch == "\r") { if (ch == "\r") {
if ((ch = stream.lookChar()) == "\n") if ((ch = stream.lookChar()) == "\n")
stream.getChar(); stream.skip();
return; return;
} }
} }