Fixes 09061a2cc4
regression, spaces, and default value for type
This commit is contained in:
parent
85e55b4111
commit
cfda084714
39
pdf.js
39
pdf.js
@ -1444,26 +1444,29 @@ var XRef = (function() {
|
|||||||
for (i = 0; i < n; ++i) {
|
for (i = 0; i < n; ++i) {
|
||||||
var type = 0, offset = 0, generation = 0;
|
var type = 0, offset = 0, generation = 0;
|
||||||
for (j = 0; j < typeFieldWidth; ++j)
|
for (j = 0; j < typeFieldWidth; ++j)
|
||||||
type = (type << 8) | stream.getByte();
|
type = (type << 8) | stream.getByte();
|
||||||
|
// if type field is absent, its default value = 1
|
||||||
|
if (typeFieldWidth == 0)
|
||||||
|
type = 1;
|
||||||
for (j = 0; j < offsetFieldWidth; ++j)
|
for (j = 0; j < offsetFieldWidth; ++j)
|
||||||
offset = (offset << 8) | stream.getByte();
|
offset = (offset << 8) | stream.getByte();
|
||||||
for (j = 0; j < generationFieldWidth; ++j)
|
for (j = 0; j < generationFieldWidth; ++j)
|
||||||
generation = (generation << 8) | stream.getByte();
|
generation = (generation << 8) | stream.getByte();
|
||||||
var entry = new Ref(offset, generation);
|
var entry = {}
|
||||||
if (typeFieldWidth > 0) {
|
entry.offset = offset;
|
||||||
switch (type) {
|
entry.gen = generation;
|
||||||
case 0:
|
switch (type) {
|
||||||
entry.free = true;
|
case 0:
|
||||||
break;
|
entry.free = true;
|
||||||
case 1:
|
break;
|
||||||
entry.uncompressed = true;
|
case 1:
|
||||||
break;
|
entry.uncompressed = true;
|
||||||
case 2:
|
break;
|
||||||
break;
|
case 2:
|
||||||
default:
|
break;
|
||||||
error("Invalid XRef entry type");
|
default:
|
||||||
break;
|
error("Invalid XRef entry type");
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
if (!this.entries[first + i])
|
if (!this.entries[first + i])
|
||||||
this.entries[first + i] = entry;
|
this.entries[first + i] = entry;
|
||||||
|
Loading…
Reference in New Issue
Block a user