Hi Gerd
Some of the old maps don't have Mdr sections after 19 and 29. Also some
code didn't spot it should test after Mdr19, so Summary, Display and
Check could give errors. I've added logic to stop getting sections
after all the header lengths I've found in the various samples.
Patch attached.
Ticker
Index: src/test/display/MdrCheck.java
===
--- src/test/display/MdrCheck.java (revision 577)
+++ src/test/display/MdrCheck.java (working copy)
@@ -1606,61 +1606,76 @@
codepage = reader.get2u();
charSet = Sort.charsetFromCodepage(codepage);
+ // %%% TODO: might need to get the decoder if strings can be in Format6
Sort sort = SrtTextReader.sortForCodepage(codepage);
isMulti = sort.isMulti();
collator = sort.getCollator();
collator.setStrength(Collator.SECONDARY);
- reader.get2u();
- reader.get2u();
- reader.get2u();
+ reader.get2u(); // id1
+ reader.get2u(); // id2
+ reader.get2u(); // unknown
- Section sect = readSection(1, true, true);
+ Section sect = addSection(1, true, true);
numberOfMaps = sect.getNumberOfRecords();
- readSection(2, true, true);
- readSection(3, true, true);
- readSection(4, true, true);
- readSection(5, true, true);
- readSection(6, true, true);
- readSection(7, true, true);
- readSection(8, true, true);
- readSection(9, true, true);
- readSection(10, false, true);
- readSection(11, true, true);
- readSection(12, true, true);
- readSection(13, true, true);
- readSection(14, true, true);
- readSection(15, false, false);
+ addSection(2, true, true);
+ addSection(3, true, true);
+ addSection(4, true, true);
+ addSection(5, true, true);
+ addSection(6, true, true);
+ addSection(7, true, true);
+ addSection(8, true, true);
+ addSection(9, true, true);
+ addSection(10, false, true);
+ addSection(11, true, true);
+ addSection(12, true, true);
+ addSection(13, true, true);
+ addSection(14, true, true);
+ addSection(15, false, false);
getSection(15).setMagic(reader.get());
- readSection(16, true, true);
- readSection(17, false, true);
- readSection(18, true, true);
- readSection(19, true, true);
-
- if (getHeaderLen() > 286) {
- readSection(20, true, true);
- readSection(21, true, true);
- readSection(22, true, true);
- readSection(23, true, true);
- readSection(24, true, true);
- readSection(25, true, true);
- readSection(26, true, true);
- readSection(27, true, true);
- readSection(28, true, true);
- readSection(29, true, true);
- readSection(30, true, true);
- readSection(31, false, false);
- readSection(32, true, true);
- readSection(33, false, false);
- readSection(34, true, true);
- readSection(35, true, true);
- readSection(36, true, true);
- readSection(37, true, true);
- readSection(38, true, true);
- readSection(39, true, true);
- readSection(40, true, true);
- }
+ addSection(16, true, true);
+ addSection(17, false, true);
+ addSection(18, true, true);
+ addSection(19, true, true);
+ if (getHeaderLen() <= 286) // 0x011e
+ return;
+ addSection(20, true, true);
+ addSection(21, true, true);
+ addSection(22, true, true);
+ addSection(23, true, true);
+ addSection(24, true, true);
+ addSection(25, true, true);
+ addSection(26, true, true);
+ addSection(27, true, true);
+ addSection(28, true, true);
+ addSection(29, true, true);
+ if (getHeaderLen() <= 426) // 0x01aa
+ return;
+ addSection(30, true, true);
+ addSection(31, false, false);
+ addSection(32, true, true);
+ addSection(33, false, false);
+ addSection(34, true, true);
+ addSection(35, true, true);
+ addSection(36, true, true);
+ addSection(37, true, true);
+ addSection(38, true, true);
+ addSection(39, true, true);
+ addSection(40, true, true);
+ //if (getHeaderLen() <= 568) // 0x0238
+ // return;
+ // looks like three sections, two with 4 ints, one with 5 ints
+ //if (getHeaderLen() <= 620) // 0x26c
+ // return;
+ // mostly zeros
+ //if (getHeaderLen() <= 668) // 0x029c
+ // return;
+// possibly some sections, but mostly zeros so difficult to tell
+ //if (getHeaderLen() <= 700) // 0x02bc
+ // return;
+ // at 0x02dc, maybe 5 sections without magic or recsize
+ // haven't seen anything after 772 0x0304
}
/**
@@ -1672,7 +1687,7 @@
* @param hasMagic True if the section has a flags field of 4 bytes. It will be read and saved.
* @return
*/
- private Section readSection(int number, boolean hasRecSize, boolean hasMagic) {
+ private Section addSection(int number, boolean hasRecSize, boolean hasMagic) {
assert number != 0;
int start = reader.get4();
Index: src/test/display/MdrDisplay.java
===
--- src/test/display/MdrDisplay.java (revision 577)
+++ src/test/display/MdrDisplay.java (working copy)
@@ -1782,6 +1782,9 @@
readSection(d, "MDR 27", 27, true, true);
readSection(d, "MDR 28", 28, true, true);