ss: fix common node header size and check free space
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / internal / statesystem / core / backend / historytree / HTNode.java
index 9cada2d4f4e989f8ea981490187fd168b34ba40e..fe52f636311834a6b37e2205105a299046b22598 100644 (file)
@@ -99,14 +99,13 @@ public abstract class HTNode {
      * <pre>
      *  1 - byte (type)
      * 16 - 2x long (start time, end time)
-     * 16 - 4x int (seq number, parent seq number, intervalcount,
-     *              strings section pos.)
+     * 16 - 3x int (seq number, parent seq number, intervalcount)
      *  1 - byte (done or not)
      * </pre>
      */
     private static final int COMMON_HEADER_SIZE = Byte.BYTES
             + 2 * Long.BYTES
-            + 4 * Integer.BYTES
+            + 3 * Integer.BYTES
             + Byte.BYTES;
 
     // ------------------------------------------------------------------------
@@ -268,7 +267,9 @@ public abstract class HTNode {
 
             /* Back to us, we write the intervals */
             fIntervals.forEach(i -> i.writeInterval(buffer));
-
+            if (blockSize - buffer.position() != getNodeFreeSpace()) {
+                throw new IllegalStateException("Wrong free space: Actual: " + (blockSize - buffer.position()) + ", Expected: " + getNodeFreeSpace()); //$NON-NLS-1$ //$NON-NLS-2$
+            }
             /*
              * Fill the rest with zeros
              */
This page took 0.026374 seconds and 5 git commands to generate.