Skip to content

Commit f89bde0

Browse files
committed
Fix - in I/O check ver==0 in ReadVersion
It is indication of foreign class, which stores extra 4-bytes checksum
1 parent 8b3b226 commit f89bde0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/JSRootIOEvolution.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175

176176
this.last_read_version = ver.val = this.ntou2();
177177
ver.off = this.o;
178+
if (ver.val === 0) ver.checksum = this.ntou4(); // this is foreign class, extra stored checksum
178179
return ver;
179180
}
180181

@@ -471,10 +472,23 @@
471472

472473
if (streamer !== null) {
473474

475+
var debug = (classname == "TXmlEx1");
476+
477+
if (debug) {
478+
console.log('Before read version', classname, 'pos', this.o, this.length);
479+
for (var i=0;i<36;++i) console.log(i, 'code', this.codeAt(i));
480+
}
474481
var ver = this.ReadVersion();
475482

476-
for (var n = 0; n < streamer.length; ++n)
483+
if (debug)
484+
console.log('Read version', classname, ver, 'pos', this.o, this.length);
485+
486+
for (var n = 0; n < streamer.length; ++n) {
487+
if (debug) console.log('Read member', streamer[n].name, 'pos', this.o);
477488
streamer[n].func(this, obj);
489+
}
490+
491+
if (debug) console.log('Check bytecount pos', this.o);
478492

479493
this.CheckBytecount(ver, classname);
480494
// methods will be assigned by last entry in the streamer

0 commit comments

Comments
 (0)