Add table-xref's associated stream-xrefs

- If an XrefTable has an associated stream, as indicated via the XrefStm-property, then read and add that XrefStream
- Any table can have 0 or 1 such associated streams
- A caveat: such an associated stream might also theoretically be part of the Parts-sequence in which case it would be encountered both by looping through all those parts along with all the regular tables and now also by association to any of those tables. It doesn't seem harmful since the offsets are flattened eventually anyway and stored by their offset-key into a mapping-table.
This commit is contained in:
ricflams
2025-09-29 17:46:52 +02:00
committed by BobLd
parent 397ccb15d6
commit 5a6b3970f0
2 changed files with 27 additions and 0 deletions

View File

@@ -153,6 +153,23 @@ internal static partial class FirstPassParser
{
results.Add(table);
nextLocation = table.GetPrevious();
// Also add any optional associated Stream
var xRefStm = table.GetXRefStm();
if (xRefStm is long xRefStmValue)
{
var stream = GetXrefStreamOrTable(
offset,
input,
scanner,
xRefStmValue,
log);
if (stream != null)
{
results.Add(stream);
}
}
}
else if (streamOrTable is XrefStream stream)
{

View File

@@ -44,4 +44,14 @@ internal sealed class XrefTable : IXrefSection
return null;
}
public long? GetXRefStm()
{
if (Dictionary != null && Dictionary.TryGet(NameToken.XrefStm, out NumericToken xRefStm))
{
return xRefStm.Long;
}
return null;
}
}