| 110 | | while(reader.hasMore()){ |
|---|
| 111 | | ubyte b; |
|---|
| 112 | | reader.peek(b); |
|---|
| 113 | | debug debugLog("parse() -> {} / {} ; peek = {:X}"\n, reader.getPosition, reader.getData.length, cast(int)b); |
|---|
| 114 | | WKEXT ext; |
|---|
| 115 | | if (ext.parse(reader)) { |
|---|
| 116 | | externs ~= ext; |
|---|
| 117 | | } else { |
|---|
| 118 | | // it seems that OPTLINK can put two weakIndex values into one WKEXT |
|---|
| 119 | | // they both map to the field that resolutionIndex that follows |
|---|
| 120 | | // thus, if there's only one byte left in the reader, the one byte is a resolutionIndex, |
|---|
| 121 | | // while the previous two are both weakIndex |
|---|
| 122 | | // |
|---|
| 123 | | // A query to Walter about this stuff is pending an answer |
|---|
| 124 | | // |
|---|
| 125 | | // - h3r3tic |
|---|
| 126 | | |
|---|
| 127 | | if (externs.length < 1) { |
|---|
| 128 | | throw new Exception("WKEXT record is corrupt"); |
|---|
| 129 | | } |
|---|
| 130 | | |
|---|
| 131 | | WKEXT* prev = &externs[$-1]; |
|---|
| 132 | | ext.resolutionIndex = ext.weakIndex; |
|---|
| 133 | | ext.weakIndex = prev.resolutionIndex; |
|---|
| 134 | | prev.resolutionIndex = ext.resolutionIndex; |
|---|
| 135 | | |
|---|
| 136 | | externs ~= ext; |
|---|
| 137 | | } |
|---|
| | 104 | while (reader.hasMore()){ |
|---|
| | 105 | WKEXT ext; |
|---|
| | 106 | ext.parse(reader); |
|---|
| | 107 | externs ~= ext; |
|---|