View | Details | Raw Unified | Return to bug 34787
Collapse All | Expand All

(-)EscherClientAnchorRecord.java.sav (-14 / +29 lines)
Lines 47-52 Link Here
47
    private short field_8_row2;
47
    private short field_8_row2;
48
    private short field_9_dy2;
48
    private short field_9_dy2;
49
    private byte[] remainingData;
49
    private byte[] remainingData;
50
    private boolean shortRecord = false;
50
51
51
    /**
52
    /**
52
     * This method deserializes the record from a byte array.
53
     * This method deserializes the record from a byte array.
Lines 61-75 Link Here
61
        int bytesRemaining = readHeader( data, offset );
62
        int bytesRemaining = readHeader( data, offset );
62
        int pos            = offset + 8;
63
        int pos            = offset + 8;
63
        int size           = 0;
64
        int size           = 0;
65
66
        // Always find 4 two byte entries. Sometimes find 9
64
        field_1_flag   =  LittleEndian.getShort( data, pos + size );     size += 2;
67
        field_1_flag   =  LittleEndian.getShort( data, pos + size );     size += 2;
65
        field_2_col1   =  LittleEndian.getShort( data, pos + size );     size += 2;
68
        field_2_col1   =  LittleEndian.getShort( data, pos + size );     size += 2;
66
        field_3_dx1    =  LittleEndian.getShort( data, pos + size );     size += 2;
69
        field_3_dx1    =  LittleEndian.getShort( data, pos + size );     size += 2;
67
        field_4_row1   =  LittleEndian.getShort( data, pos + size );     size += 2;
70
        field_4_row1   =  LittleEndian.getShort( data, pos + size );     size += 2;
68
        field_5_dy1    =  LittleEndian.getShort( data, pos + size );     size += 2;
71
        if(bytesRemaining >= 18) {
69
        field_6_col2   =  LittleEndian.getShort( data, pos + size );     size += 2;
72
		    field_5_dy1    =  LittleEndian.getShort( data, pos + size );     size += 2;
70
        field_7_dx2    =  LittleEndian.getShort( data, pos + size );     size += 2;
73
		    field_6_col2   =  LittleEndian.getShort( data, pos + size );     size += 2;
71
        field_8_row2   =  LittleEndian.getShort( data, pos + size );     size += 2;
74
		    field_7_dx2    =  LittleEndian.getShort( data, pos + size );     size += 2;
72
        field_9_dy2    =  LittleEndian.getShort( data, pos + size );     size += 2;
75
		    field_8_row2   =  LittleEndian.getShort( data, pos + size );     size += 2;
76
		    field_9_dy2    =  LittleEndian.getShort( data, pos + size );     size += 2;
77
			shortRecord = false;
78
        } else {
79
			shortRecord = true;
80
		}
73
        bytesRemaining -= size;
81
        bytesRemaining -= size;
74
        remainingData  =  new byte[bytesRemaining];
82
        remainingData  =  new byte[bytesRemaining];
75
        System.arraycopy( data, pos + size, remainingData, 0, bytesRemaining );
83
        System.arraycopy( data, pos + size, remainingData, 0, bytesRemaining );
Lines 92-110 Link Here
92
        if (remainingData == null) remainingData = new byte[0];
100
        if (remainingData == null) remainingData = new byte[0];
93
        LittleEndian.putShort( data, offset, getOptions() );
101
        LittleEndian.putShort( data, offset, getOptions() );
94
        LittleEndian.putShort( data, offset + 2, getRecordId() );
102
        LittleEndian.putShort( data, offset + 2, getRecordId() );
95
        int remainingBytes = remainingData.length + 18;
103
        int remainingBytes = remainingData.length + (shortRecord ? 8 : 18);
96
        LittleEndian.putInt( data, offset + 4, remainingBytes );
104
        LittleEndian.putInt( data, offset + 4, remainingBytes );
97
        LittleEndian.putShort( data, offset + 8, field_1_flag );
105
        LittleEndian.putShort( data, offset + 8, field_1_flag );
98
        LittleEndian.putShort( data, offset + 10, field_2_col1 );
106
        LittleEndian.putShort( data, offset + 10, field_2_col1 );
99
        LittleEndian.putShort( data, offset + 12, field_3_dx1 );
107
        LittleEndian.putShort( data, offset + 12, field_3_dx1 );
100
        LittleEndian.putShort( data, offset + 14, field_4_row1 );
108
        LittleEndian.putShort( data, offset + 14, field_4_row1 );
101
        LittleEndian.putShort( data, offset + 16, field_5_dy1 );
109
        if(!shortRecord) {
102
        LittleEndian.putShort( data, offset + 18, field_6_col2 );
110
            LittleEndian.putShort( data, offset + 16, field_5_dy1 );
103
        LittleEndian.putShort( data, offset + 20, field_7_dx2 );
111
            LittleEndian.putShort( data, offset + 18, field_6_col2 );
104
        LittleEndian.putShort( data, offset + 22, field_8_row2 );
112
            LittleEndian.putShort( data, offset + 20, field_7_dx2 );
105
        LittleEndian.putShort( data, offset + 24, field_9_dy2 );
113
            LittleEndian.putShort( data, offset + 22, field_8_row2 );
106
        System.arraycopy( remainingData, 0, data, offset + 26, remainingData.length );
114
            LittleEndian.putShort( data, offset + 24, field_9_dy2 );
107
        int pos = offset + 8 + 18 + remainingData.length;
115
        }
116
        System.arraycopy( remainingData, 0, data, offset + (shortRecord ? 16 : 26), remainingData.length );
117
        int pos = offset + 8 + (shortRecord ? 8 : 18) + remainingData.length;
108
118
109
        listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
119
        listener.afterRecordSerialize( pos, getRecordId(), pos - offset, this );
110
        return pos - offset;
120
        return pos - offset;
Lines 117-123 Link Here
117
     */
127
     */
118
    public int getRecordSize()
128
    public int getRecordSize()
119
    {
129
    {
120
        return 8 + 18 + (remainingData == null ? 0 : remainingData.length);
130
        return 8 + (shortRecord ? 8 : 18) + (remainingData == null ? 0 : remainingData.length);
121
    }
131
    }
122
132
123
    /**
133
    /**
Lines 249-254 Link Here
249
     */
259
     */
250
    public void setDy1( short field_5_dy1 )
260
    public void setDy1( short field_5_dy1 )
251
    {
261
    {
262
        shortRecord = false;
252
        this.field_5_dy1 = field_5_dy1;
263
        this.field_5_dy1 = field_5_dy1;
253
    }
264
    }
254
265
Lines 265-270 Link Here
265
     */
276
     */
266
    public void setCol2( short field_6_col2 )
277
    public void setCol2( short field_6_col2 )
267
    {
278
    {
279
        shortRecord = false;
268
        this.field_6_col2 = field_6_col2;
280
        this.field_6_col2 = field_6_col2;
269
    }
281
    }
270
282
Lines 281-286 Link Here
281
     */
293
     */
282
    public void setDx2( short field_7_dx2 )
294
    public void setDx2( short field_7_dx2 )
283
    {
295
    {
296
        shortRecord = false;
284
        this.field_7_dx2 = field_7_dx2;
297
        this.field_7_dx2 = field_7_dx2;
285
    }
298
    }
286
299
Lines 297-302 Link Here
297
     */
310
     */
298
    public void setRow2( short field_8_row2 )
311
    public void setRow2( short field_8_row2 )
299
    {
312
    {
313
        shortRecord = false;
300
        this.field_8_row2 = field_8_row2;
314
        this.field_8_row2 = field_8_row2;
301
    }
315
    }
302
316
Lines 313-318 Link Here
313
     */
327
     */
314
    public void setDy2( short field_9_dy2 )
328
    public void setDy2( short field_9_dy2 )
315
    {
329
    {
330
        shortRecord = false;
316
        this.field_9_dy2 = field_9_dy2;
331
        this.field_9_dy2 = field_9_dy2;
317
    }
332
    }
318
333

Return to bug 34787