Skip to content

Commit be99897

Browse files
committed
Introduce fDisplacement in the TBuffer
Used in the TBasket
1 parent 524b57a commit be99897

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

scripts/JSRootIOEvolution.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
kByteCountMask: 0x40000000,
2929
kNewClassTag: 0xFFFFFFFF,
3030
kClassMask: 0x80000000,
31-
Z_DEFLATED: 8,
32-
Z_HDRSIZE: 9,
3331
Mode: "array", // could be string or array, enable usage of ArrayBuffer in http requests
3432
NativeArray: true, // when true, native arrays like Int32Array or Float64Array are used
3533

@@ -46,7 +44,7 @@
4644
StlNames: [ "", "vector", "list", "deque", "map", "multimap", "set", "multiset", "bitset"],
4745

4846
// constants of bits in version
49-
kStreamedMemberWise : JSROOT.BIT(14),
47+
kStreamedMemberWise: JSROOT.BIT(14),
5048

5149
kSplitCollectionOfPointers: 100,
5250

@@ -56,15 +54,15 @@
5654
CustomStreamers: {},
5755

5856
// TOBject bits
59-
kIsReferenced : JSROOT.BIT(4),
57+
kIsReferenced: JSROOT.BIT(4),
6058
kHasUUID: JSROOT.BIT(5),
6159

62-
IsInteger : function(typ) { return ((typ>=this.kChar) && (typ<=this.kLong)) || (typ===this.kCounter) ||
60+
IsInteger: function(typ) { return ((typ>=this.kChar) && (typ<=this.kLong)) || (typ===this.kCounter) ||
6361
((typ>=this.kLegacyChar) && (typ<=this.kBool)); },
6462

65-
IsNumeric : function(typ) { return (typ>0) && (typ<=this.kBool) && (typ!==this.kCharStar); },
63+
IsNumeric: function(typ) { return (typ>0) && (typ<=this.kBool) && (typ!==this.kCharStar); },
6664

67-
GetTypeId : function(typname, norecursion) {
65+
GetTypeId: function(typname, norecursion) {
6866
switch (typname) {
6967
case "bool":
7068
case "Bool_t": return JSROOT.IO.kBool;
@@ -115,7 +113,7 @@
115113
return -1;
116114
},
117115

118-
GetTypeSize : function(typname) {
116+
GetTypeSize: function(typname) {
119117
switch (typname) {
120118
case JSROOT.IO.kBool: return 1;
121119
case JSROOT.IO.kChar: return 1;
@@ -158,8 +156,8 @@
158156
return null;
159157
}
160158

161-
if (getChar(curr) == 'Z' && getChar(curr+1) == 'L' && getCode(curr+2) == JSROOT.IO.Z_DEFLATED) { fmt = "new"; off = 2; } else
162-
if (getChar(curr) == 'C' && getChar(curr+1) == 'S' && getCode(curr+2) == JSROOT.IO.Z_DEFLATED) { fmt = "old"; off = 0; } else
159+
if (getChar(curr) == 'Z' && getChar(curr+1) == 'L' && getCode(curr+2) == 8) { fmt = "new"; off = 2; } else
160+
if (getChar(curr) == 'C' && getChar(curr+1) == 'S' && getCode(curr+2) == 8) { fmt = "old"; off = 0; } else
163161
if (getChar(curr) == 'X' && getChar(curr+1) == 'Z') fmt = "LZMA";
164162

165163
/* C H E C K H E A D E R */
@@ -601,8 +599,6 @@
601599
if (obj.fLast > obj.fBufferSize) obj.fBufferSize = obj.fLast;
602600
var flag = this.ntoi1();
603601

604-
console.log('READ BASKET', ver, flag, obj.fNevBuf, obj.fBufferSize, obj.fNevBufSize, obj.fLast);
605-
606602
if (flag===0) return obj;
607603

608604
if ((flag % 10) != 2) {
@@ -613,10 +609,8 @@
613609
obj.fEntryOffset[i] &= ~kDisplacementMask;
614610
}
615611

616-
if (flag>40) {
612+
if (flag>40)
617613
obj.fDisplacement = this.ReadFastArray(this.ntoi4(), JSROOT.IO.kInt);
618-
console.log('READ DISPLACEMENT', obj.fDisplacement.length);
619-
}
620614
}
621615

622616
if ((flag === 1) || (flag > 10)) {
@@ -660,7 +654,7 @@
660654
tag = this.ntou4();
661655
}
662656
if (!(tag & JSROOT.IO.kClassMask)) {
663-
classInfo.objtag = tag; // indicate that we have deal with objects tag
657+
classInfo.objtag = tag + this.fDisplacement; // indicate that we have deal with objects tag
664658
return classInfo;
665659
}
666660
if (tag == JSROOT.IO.kNewClassTag) {
@@ -671,7 +665,7 @@
671665
this.MapClass(this.fTagOffset + startpos + JSROOT.IO.kMapOffset, classInfo.name);
672666
} else {
673667
// got a tag to an already seen class
674-
var clTag = (tag & ~JSROOT.IO.kClassMask);
668+
var clTag = (tag & ~JSROOT.IO.kClassMask) + this.fDisplacement;
675669
classInfo.name = this.GetMappedClass(clTag);
676670

677671
if (classInfo.name === -1) {

0 commit comments

Comments
 (0)