Skip to content

rework broken TT_SEQUENCE case in parse_pagenode

Sven M. Hallberg requested to merge cstream into master

Working to fix #30 (closed) and (later) #31 (closed) as part of a general cleanup up of the content stream code.

Please see the extensive explanations in the (long) commit messages alongside their respective fine-grained code changes. Quoting the first commit here:

For context, this part of the code is concerned with parsing a content stream as specified by the /Contents entry of a page node. The section being removed by this commit is trying to deal with the case that /Contents is an array (represented as a sequence token by the parser). It was originally introduced in commit 285b6f89 as the else branch of an 'if' that checked for token type TT_Objstm. The sequence case was apparently found to be buggy, so the next commit, ddf109c3, introduced a different case for TT_SEQUENCE that does nothing, leaving this as the new else.

So this code is certainly broken (it tries to access a sequence if and only if that token is not a sequence) and unreachable (no token types appear beside TT_Objstm and TT_SEQUENCE) if we are lucky. As noted correctly by the preceding comment introduced with ddf109c3, this bit of code is at best an incomplete version of a later piece that attempts to accomplish the same thing. We will come back to that one.

Edited by Sven M. Hallberg

Merge request reports