Commit 83df127a authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Fix creation of the TOC tree for dvi files

The old code assumed the number of children would be
"-NUMBER "
while this file has
"-NUMBER/"
so what we do now is looping after the - until we find a non digit
All this code would better be done using a regexp and not that many section calls
but i did not want to touch it more than needed
BUGS: 283447
FIXED-IN: 4.7.3
parent 41c57246
......@@ -361,11 +361,18 @@ void dviRenderer::prescan_ParsePSSpecial(const QString& cp)
anchorList[anchorName] = Anchor(current_page+1, l);
}
// The PostScript code defines a bookmark
if (cp.contains("/Dest") && cp.contains("/Title"))
if (cp.contains("/Dest") && cp.contains("/Title")) {
const QString childrenNumberAndMoreStuff = cp.section('-', 1, 1); // Contains from the - symbol to the end of cp, effectively containing the number of children and some stuff after it
int indexOfFirstNonDigit = 0;
foreach(const QChar &c, childrenNumberAndMoreStuff) {
if (c.isDigit()) ++indexOfFirstNonDigit;
else break;
}
prebookmarks.append(PreBookmark(PDFencodingToQString(cp.section('(', 2, 2).section(')', 0, 0)),
cp.section('(', 1, 1).section(')', 0, 0),
cp.section('-', 1, 1).section(' ', 0, 0).toUInt()
childrenNumberAndMoreStuff.left(indexOfFirstNonDigit).toUInt()
));
}
return;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment