You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2020/04/02 23:54:48 UTC
svn commit: r1876067 [2/2] - in /poi/trunk/src: java/org/apache/poi/hpsf/
java/org/apache/poi/hssf/usermodel/ java/org/apache/poi/poifs/storage/
java/org/apache/poi/sl/image/ java/org/apache/poi/ss/format/
java/org/apache/poi/ss/formula/ptg/ ooxml/java...
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java Thu Apr 2 23:54:48 2020
@@ -27,6 +27,7 @@ import java.util.Locale;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -72,7 +73,7 @@ public final class FileInformationBlock
assert offset == 32;
_csw = LittleEndian.getUShort( mainDocument, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
assert offset == 34;
_fibRgW = new FibRgW97( mainDocument, offset );
@@ -80,7 +81,7 @@ public final class FileInformationBlock
assert offset == 62;
_cslw = LittleEndian.getUShort( mainDocument, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
assert offset == 64;
if ( _fibBase.getNFib() < 105 )
@@ -92,10 +93,10 @@ public final class FileInformationBlock
_cbRgFcLcb = 74;
// skip fibRgFcLcbBlob (read later at fillVariableFields)
- offset += _cbRgFcLcb * LittleEndian.INT_SIZE * 2;
+ offset += _cbRgFcLcb * LittleEndianConsts.INT_SIZE * 2;
_cswNew = LittleEndian.getUShort( mainDocument, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_cswNew = 0;
_nFibNew = -1;
@@ -109,23 +110,23 @@ public final class FileInformationBlock
assert offset == 152;
_cbRgFcLcb = LittleEndian.getUShort( mainDocument, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
assert offset == 154;
// skip fibRgFcLcbBlob (read later at fillVariableFields)
- offset += _cbRgFcLcb * LittleEndian.INT_SIZE * 2;
+ offset += _cbRgFcLcb * LittleEndianConsts.INT_SIZE * 2;
_cswNew = LittleEndian.getUShort( mainDocument, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
if ( _cswNew != 0 )
{
_nFibNew = LittleEndian.getUShort( mainDocument, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
// first short is already read as _nFibNew
final int fibRgCswNewLength = ( _cswNew - 1 )
- * LittleEndian.SHORT_SIZE;
+ * LittleEndianConsts.SHORT_SIZE;
_fibRgCswNew = IOUtils.safelyAllocate(fibRgCswNewLength, MAX_RECORD_LENGTH);
LittleEndian.getByteArray( mainDocument, offset, fibRgCswNewLength, MAX_RECORD_LENGTH );
offset += fibRgCswNewLength;
@@ -144,7 +145,7 @@ public final class FileInformationBlock
{
int nfib = getNFib();
String nfibHex = String.format(Locale.ROOT, "%04X", nfib);
-
+
// Note - CommonCrawl shows there's more variation in these than
// the documentation suggests, so accept common clusters around
// the "correct" value as well
@@ -665,7 +666,7 @@ public final class FileInformationBlock
{
_fieldHandler.setFieldSize(FIBFieldHandler.STTBFFFN, lcbSttbFffn);
}
-
+
public int getFcSttbfRMark()
{
return _fieldHandler.getFieldOffset(FIBFieldHandler.STTBFRMARK);
@@ -675,7 +676,7 @@ public final class FileInformationBlock
{
return _fieldHandler.getFieldSize(FIBFieldHandler.STTBFRMARK);
}
-
+
public void setFcSttbfRMark(int fcSttbfRMark)
{
_fieldHandler.setFieldOffset(FIBFieldHandler.STTBFRMARK, fcSttbfRMark);
@@ -746,7 +747,7 @@ public final class FileInformationBlock
{
_fieldHandler.setFieldSize(FIBFieldHandler.PLFLFO, modifiedHigh);
}
-
+
/**
* How many bytes of the main stream contain real data.
*/
@@ -1081,29 +1082,29 @@ public final class FileInformationBlock
int offset = FibBase.getSize();
LittleEndian.putUShort( mainStream, offset, _csw );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_fibRgW.serialize( mainStream, offset );
offset += FibRgW97.getSize();
LittleEndian.putUShort( mainStream, offset, _cslw );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
( (FibRgLw97) _fibRgLw ).serialize( mainStream, offset );
offset += FibRgLw97.getSize();
LittleEndian.putUShort( mainStream, offset, _cbRgFcLcb );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_fieldHandler.writeTo( mainStream, offset, tableStream );
- offset += _cbRgFcLcb * LittleEndian.INT_SIZE * 2;
+ offset += _cbRgFcLcb * LittleEndianConsts.INT_SIZE * 2;
LittleEndian.putUShort( mainStream, offset, _cswNew );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
if ( _cswNew != 0 )
{
LittleEndian.putUShort( mainStream, offset, _nFibNew );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
System.arraycopy( _fibRgCswNew, 0, mainStream, offset,
_fibRgCswNew.length );
@@ -1113,9 +1114,9 @@ public final class FileInformationBlock
public int getSize()
{
- return FibBase.getSize() + LittleEndian.SHORT_SIZE + FibRgW97.getSize()
- + LittleEndian.SHORT_SIZE + FibRgLw97.getSize()
- + LittleEndian.SHORT_SIZE + _fieldHandler.sizeInBytes();
+ return FibBase.getSize() + LittleEndianConsts.SHORT_SIZE + FibRgW97.getSize()
+ + LittleEndianConsts.SHORT_SIZE + FibRgLw97.getSize()
+ + LittleEndianConsts.SHORT_SIZE + _fieldHandler.sizeInBytes();
}
public FibBase getFibBase()
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/FontTable.java Thu Apr 2 23:54:48 2020
@@ -23,6 +23,7 @@ import java.io.IOException;
import org.apache.poi.hwpf.model.io.HWPFFileSystem;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -55,9 +56,9 @@ public final class FontTable
this.fcSttbfffn = offset;
_stringCount = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_extraDataSz = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_fontNames = new Ffn[_stringCount]; //Ffn corresponds to a Pascal style String in STTBF.
@@ -124,7 +125,7 @@ public final class FontTable
public void writeTo( ByteArrayOutputStream tableStream ) throws IOException
{
- byte[] buf = new byte[LittleEndian.SHORT_SIZE];
+ byte[] buf = new byte[LittleEndianConsts.SHORT_SIZE];
LittleEndian.putShort(buf, 0, _stringCount);
tableStream.write(buf);
LittleEndian.putShort(buf, 0, _extraDataSz);
@@ -146,11 +147,11 @@ public final class FontTable
|| o._extraDataSz != this._extraDataSz
|| o._fontNames.length != this._fontNames.length
) return false;
-
+
for (int i=0; i<o._fontNames.length; i++) {
if (!o._fontNames[i].equals(this._fontNames[i])) return false;
}
-
+
return true;
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/LFOData.java Thu Apr 2 23:54:48 2020
@@ -24,6 +24,7 @@ import java.util.Arrays;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* The LFOData structure contains the Main Document CP of the corresponding LFO,
@@ -49,7 +50,7 @@ public class LFOData
int offset = startOffset;
_cp = LittleEndian.getInt( buf, offset );
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
_rgLfoLvl = new ListFormatOverrideLevel[cLfolvl];
for ( int x = 0; x < cLfolvl; x++ )
@@ -72,7 +73,7 @@ public class LFOData
public int getSizeInBytes()
{
int result = 0;
- result += LittleEndian.INT_SIZE;
+ result += LittleEndianConsts.INT_SIZE;
for ( ListFormatOverrideLevel lfolvl : _rgLfoLvl )
result += lfolvl.getSizeInBytes();
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java Thu Apr 2 23:54:48 2020
@@ -25,6 +25,7 @@ import java.util.Objects;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -56,7 +57,7 @@ public final class ListTables
int offset = lstOffset;
int cLst = LittleEndian.getShort( tableStream, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
int levelOffset = offset + ( cLst * LSTF.getSize() );
for ( int x = 0; x < cLst; x++ )
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/NilPICFAndBinData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/NilPICFAndBinData.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/NilPICFAndBinData.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/NilPICFAndBinData.java Thu Apr 2 23:54:48 2020
@@ -16,12 +16,13 @@
==================================================================== */
package org.apache.poi.hwpf.model;
+import java.util.Arrays;
+
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
-import java.util.Arrays;
-
public class NilPICFAndBinData
{
@@ -39,7 +40,7 @@ public class NilPICFAndBinData
{
int lcb = LittleEndian.getInt( data, offset );
int cbHeader = LittleEndian.getUShort( data, offset
- + LittleEndian.INT_SIZE );
+ + LittleEndianConsts.INT_SIZE );
if ( cbHeader != 0x44 )
{
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFfn.java Thu Apr 2 23:54:48 2020
@@ -21,7 +21,7 @@ import java.nio.charset.Charset;
import org.apache.poi.common.usermodel.fonts.FontCharset;
import org.apache.poi.util.Internal;
-import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.StringUtil;
@@ -74,12 +74,12 @@ public final class OldFfn {
charset = wmfCharset.getCharset();
}
charset = charset == null ? StringUtil.WIN_1252 : charset;
- offset += LittleEndian.BYTE_SIZE;
+ offset += LittleEndianConsts.BYTE_SIZE;
//if this byte here == 7, it _may_ signify existence of
//an altername font name
//not sure what the byte after the _chs does
- offset += LittleEndian.BYTE_SIZE;
+ offset += LittleEndianConsts.BYTE_SIZE;
int fontNameLength = -1;
for (int i = offset; i < fontTableEnd; i++) {
if (buf[i] == 0) {
@@ -109,7 +109,7 @@ public final class OldFfn {
//reset to 0 for length calculation
altFontNameLength = (altFontNameLength < 0) ? 0 : altFontNameLength + 1;//add one for zero byte
- int len = LittleEndian.INT_SIZE + LittleEndian.BYTE_SIZE + LittleEndian.BYTE_SIZE +//6 starting bytes
+ int len = LittleEndianConsts.INT_SIZE + LittleEndianConsts.BYTE_SIZE + LittleEndianConsts.BYTE_SIZE +//6 starting bytes
fontNameLength + altFontNameLength + 1;//+1 is for the zero byte
//this len should == fontDescriptionLength
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldFontTable.java Thu Apr 2 23:54:48 2020
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -46,7 +47,7 @@ public final class OldFontTable {
int fontTableLength = LittleEndian.getShort(buf, offset);
int endOfTableOffset = offset + length;
- int startOffset = offset + LittleEndian.SHORT_SIZE;//first short should == length!
+ int startOffset = offset + LittleEndianConsts.SHORT_SIZE;//first short should == length!
while (true) {
OldFfn oldFfn = OldFfn.build(buf, startOffset, endOfTableOffset);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/OldSectionTable.java Thu Apr 2 23:54:48 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hwpf.model;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* This class holds all of the section formatting
@@ -72,7 +73,7 @@ public final class OldSectionTable exten
// were the new ones, we sometimes "need" more data than we have.
// As a workaround, have a few extra 0 bytes on the end!
byte[] buf = IOUtils.safelyAllocate(sepxSize+2, Short.MAX_VALUE+2);
- fileOffset += LittleEndian.SHORT_SIZE;
+ fileOffset += LittleEndianConsts.SHORT_SIZE;
System.arraycopy(documentStream, fileOffset, buf, 0, buf.length);
sepx = new SEPX(sed, startAt, endAt, buf);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ParagraphHeight.java Thu Apr 2 23:54:48 2020
@@ -25,6 +25,7 @@ import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
@Internal
public final class ParagraphHeight implements Duplicatable {
@@ -50,11 +51,11 @@ public final class ParagraphHeight imple
public ParagraphHeight(byte[] buf, int offset) {
infoField = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
reserved = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
dxaCol = LittleEndian.getInt(buf, offset);
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
dymLineOrHeight = LittleEndian.getInt(buf, offset);
}
@@ -69,11 +70,11 @@ public final class ParagraphHeight imple
byte[] buf = new byte[12];
int offset = 0;
LittleEndian.putShort(buf, offset, infoField);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putShort(buf, offset, reserved);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putInt(buf, offset, dxaCol);
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
LittleEndian.putInt(buf, offset, dymLineOrHeight);
return buf;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PieceDescriptor.java Thu Apr 2 23:54:48 2020
@@ -23,6 +23,7 @@ import java.util.Objects;
import org.apache.poi.common.Duplicatable;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.StringUtil;
@Internal
@@ -54,9 +55,9 @@ public final class PieceDescriptor imple
*/
public PieceDescriptor(byte[] buf, int offset, Charset charset) {
descriptor = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
fc = LittleEndian.getInt(buf, offset);
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
prm = new PropertyModifier(LittleEndian.getShort(buf, offset));
if (charset == null) {
// see if this piece uses unicode.
@@ -125,9 +126,9 @@ public final class PieceDescriptor imple
int offset = 0;
byte[] buf = new byte[8];
LittleEndian.putShort(buf, offset, descriptor);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putInt(buf, offset, tempFc);
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
LittleEndian.putShort(buf, offset, prm.getValue());
return buf;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlexOfCps.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlexOfCps.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlexOfCps.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlexOfCps.java Thu Apr 2 23:54:48 2020
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* Plex of CPs stored in File (PLCF)
@@ -100,7 +101,7 @@ public final class PlexOfCps {
public byte[] toByteArray() {
int size = _props.size();
- int cpBufSize = ((size + 1) * LittleEndian.INT_SIZE);
+ int cpBufSize = ((size + 1) * LittleEndianConsts.INT_SIZE);
int structBufSize = +(_cbStruct * size);
int bufSize = cpBufSize + structBufSize;
@@ -110,15 +111,15 @@ public final class PlexOfCps {
for (int x = 0; x < size; x++) {
GenericPropertyNode node = _props.get(x);
nodeEnd = node.getEnd();
-
+
// put the starting offset of the property into the plcf.
- LittleEndian.putInt(buf, (LittleEndian.INT_SIZE * x), node.getStart());
+ LittleEndian.putInt(buf, (LittleEndianConsts.INT_SIZE * x), node.getStart());
// put the struct into the plcf
System.arraycopy(node.getBytes(), 0, buf, cpBufSize + (x * _cbStruct), _cbStruct);
}
// put the ending offset of the last property into the plcf.
- LittleEndian.putInt(buf, LittleEndian.INT_SIZE * size, nodeEnd);
+ LittleEndian.putInt(buf, LittleEndianConsts.INT_SIZE * size, nodeEnd);
return buf;
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/PlfLfo.java Thu Apr 2 23:54:48 2020
@@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.NoSuchElementException;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -65,7 +66,7 @@ public class PlfLfo
* [MS-DOC] -- v20110315 Word (.doc) Binary File Format
*/
long lfoMacLong = LittleEndian.getUInt( tableStream, offset );
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
if ( lfoMacLong > Integer.MAX_VALUE )
{
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionDescriptor.java Thu Apr 2 23:54:48 2020
@@ -20,6 +20,7 @@ package org.apache.poi.hwpf.model;
import org.apache.poi.common.Duplicatable;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* Section Descriptor (SED)
@@ -64,11 +65,11 @@ public final class SectionDescriptor imp
public SectionDescriptor(byte[] buf, int offset)
{
fn = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
fcSepx = LittleEndian.getInt(buf, offset);
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
fnMpr = LittleEndian.getShort(buf, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
fcMpr = LittleEndian.getInt(buf, offset);
}
@@ -102,11 +103,11 @@ public final class SectionDescriptor imp
byte[] buf = new byte[12];
LittleEndian.putShort(buf, offset, fn);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putInt(buf, offset, fcSepx);
- offset += LittleEndian.INT_SIZE;
+ offset += LittleEndianConsts.INT_SIZE;
LittleEndian.putShort(buf, offset, fnMpr);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putInt(buf, offset, fcMpr);
return buf;
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SectionTable.java Thu Apr 2 23:54:48 2020
@@ -26,6 +26,7 @@ import org.apache.poi.hwpf.model.io.HWPF
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -81,7 +82,7 @@ public class SectionTable
// The first short at the offset is the size of the grpprl.
int sepxSize = LittleEndian.getShort(documentStream, fileOffset);
byte[] buf = IOUtils.safelyAllocate(sepxSize, MAX_RECORD_LENGTH);
- fileOffset += LittleEndian.SHORT_SIZE;
+ fileOffset += LittleEndianConsts.SHORT_SIZE;
System.arraycopy(documentStream, fileOffset, buf, 0, buf.length);
_sections.add(new SEPX(sed, startAt, endAt, buf));
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Sttb.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Sttb.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Sttb.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Sttb.java Thu Apr 2 23:54:48 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hwpf.model;
import java.util.Arrays;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.StringUtil;
@@ -34,7 +35,7 @@ import org.apache.poi.util.StringUtil;
* <p>
* This class is internal. It content or properties may change without notice
* due to changes in our knowledge of internal Microsoft Word binary structures.
- *
+ *
* @author Sergey Vladimirov; according to [MS-DOC] -- v20121003 Word (.doc)
* Binary File Format; Copyright (c) 2012 Microsoft Corporation;
* Release: October 8, 2012
@@ -76,7 +77,7 @@ public class Sttb
public void fillFields( byte[] buffer, int startOffset )
{
short ffff = LittleEndian.getShort( buffer, startOffset );
- int offset = startOffset + LittleEndian.SHORT_SIZE;
+ int offset = startOffset + LittleEndianConsts.SHORT_SIZE;
if ( ffff != (short) 0xffff )
{
@@ -137,20 +138,20 @@ public class Sttb
public int getSize()
{
// ffff
- int size = LittleEndian.SHORT_SIZE;
+ int size = LittleEndianConsts.SHORT_SIZE;
// cData
size += _cDataLength;
// cbExtra
- size += LittleEndian.SHORT_SIZE;
+ size += LittleEndianConsts.SHORT_SIZE;
if ( this._fExtend )
{
for ( String data : _data )
{
// cchData
- size += LittleEndian.SHORT_SIZE;
+ size += LittleEndianConsts.SHORT_SIZE;
// data
size += 2 * data.length();
}
@@ -160,9 +161,9 @@ public class Sttb
for ( String data : _data )
{
// cchData
- size += LittleEndian.BYTE_SIZE;
+ size += LittleEndianConsts.BYTE_SIZE;
// data
- size += 1 * data.length();
+ size += data.length();
}
}
@@ -200,13 +201,13 @@ public class Sttb
{
LittleEndian.putInt( buffer, 2, _data.length );
LittleEndian.putUShort( buffer, 6, _cbExtra );
- offset = 2 + LittleEndian.INT_SIZE + LittleEndian.SHORT_SIZE;
+ offset = 2 + LittleEndianConsts.INT_SIZE + LittleEndianConsts.SHORT_SIZE;
}
else
{
LittleEndian.putUShort( buffer, 2, _data.length );
LittleEndian.putUShort( buffer, 4, _cbExtra );
- offset = 2 + LittleEndian.SHORT_SIZE + LittleEndian.SHORT_SIZE;
+ offset = 2 + LittleEndianConsts.SHORT_SIZE + LittleEndianConsts.SHORT_SIZE;
}
for ( int i = 0; i < _data.length; i++ )
@@ -224,7 +225,7 @@ public class Sttb
if ( _fExtend )
{
LittleEndian.putUShort( buffer, offset, entry.length() );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
StringUtil.putUnicodeLE( entry, buffer, offset );
offset += 2 * entry.length();
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleDescription.java Thu Apr 2 23:54:48 2020
@@ -24,6 +24,7 @@ import org.apache.poi.hwpf.usermodel.Par
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
import org.apache.poi.util.StringUtil;
@@ -91,7 +92,7 @@ public final class StyleDescription {
if (word9) {
nameLength = LittleEndian.getShort(std, nameStart);
multiplier = 2;
- nameStart += LittleEndian.SHORT_SIZE;
+ nameStart += LittleEndianConsts.SHORT_SIZE;
} else {
nameLength = std[nameStart];
}
@@ -107,7 +108,7 @@ public final class StyleDescription {
_upxs = new UPX[countOfUPX];
for (int x = 0; x < countOfUPX; x++) {
int upxSize = LittleEndian.getShort(std, varOffset);
- varOffset += LittleEndian.SHORT_SIZE;
+ varOffset += LittleEndianConsts.SHORT_SIZE;
byte[] upx = IOUtils.safelyAllocate(upxSize, Short.MAX_VALUE);
System.arraycopy(std, varOffset, upx, 0, upxSize);
@@ -199,18 +200,18 @@ public final class StyleDescription {
char[] letters = _name.toCharArray();
LittleEndian.putShort(buf, _baseLength, (short) letters.length);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
for (int x = 0; x < letters.length; x++) {
LittleEndian.putShort(buf, offset, (short) letters[x]);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
}
// get past the null delimiter for the name.
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
for (int x = 0; x < _upxs.length; x++) {
short upxSize = (short) _upxs[x].size();
LittleEndian.putShort(buf, offset, upxSize);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
System.arraycopy(_upxs[x].getUPX(), 0, buf, offset, upxSize);
offset += upxSize + (upxSize % 2);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java Thu Apr 2 23:54:48 2020
@@ -26,6 +26,7 @@ import org.apache.poi.hwpf.usermodel.Cha
import org.apache.poi.hwpf.usermodel.ParagraphProperties;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* Represents a document's stylesheet. A word documents formatting is stored as
@@ -77,11 +78,11 @@ public final class StyleSheet {
public StyleSheet(byte[] tableStream, int offset) {
int startOffset = offset;
_cbStshi = LittleEndian.getShort(tableStream, offset);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
/*
* Count of styles in stylesheet
- *
+ *
* The number of styles in this style sheet. There will be stshi.cstd
* (cbSTD, STD) pairs in the file following the STSHI. Note: styles can
* be empty, i.e. cbSTD==0.
@@ -92,7 +93,7 @@ public final class StyleSheet {
// shall we discard cbLSD and mpstilsd?
- offset = startOffset + LittleEndian.SHORT_SIZE + _cbStshi;
+ offset = startOffset + LittleEndianConsts.SHORT_SIZE + _cbStshi;
_styleDescriptions = new StyleDescription[_stshif.getCstd()];
for (int x = 0; x < _stshif.getCstd(); x++) {
int stdSize = LittleEndian.getShort(tableStream, offset);
@@ -134,7 +135,7 @@ public final class StyleSheet {
byte[] buf = new byte[_cbStshi + 2];
LittleEndian.putUShort(buf, offset, (short) _cbStshi);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_stshif.setCstd(_styleDescriptions.length);
_stshif.serialize(buf, offset);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xst.java Thu Apr 2 23:54:48 2020
@@ -21,6 +21,7 @@ package org.apache.poi.hwpf.model;
import java.util.Arrays;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* The Xst structure is a string. The string is prepended by its length and is
@@ -56,13 +57,13 @@ public class Xst
int offset = startOffset;
_cch = LittleEndian.getUShort( data, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
_rgtchar = new char[_cch];
for ( int x = 0; x < _cch; x++ )
{
_rgtchar[x] = (char) LittleEndian.getShort( data, offset );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
}
}
@@ -114,7 +115,7 @@ public class Xst
public int getSize()
{
- return LittleEndian.SHORT_SIZE + _rgtchar.length * 2;
+ return LittleEndianConsts.SHORT_SIZE + _rgtchar.length * 2;
}
@Override
@@ -127,12 +128,12 @@ public class Xst
int offset = startOffset;
LittleEndian.putUShort( data, offset, _cch );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
for ( char c : _rgtchar )
{
LittleEndian.putShort( data, offset, (short) c );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
}
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xstz.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xstz.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xstz.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/Xstz.java Thu Apr 2 23:54:48 2020
@@ -18,6 +18,7 @@ package org.apache.poi.hwpf.model;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -63,7 +64,7 @@ public class Xstz
public int getSize()
{
- return _xst.getSize() + LittleEndian.SHORT_SIZE;
+ return _xst.getSize() + LittleEndianConsts.SHORT_SIZE;
}
public int serialize( byte[] data, int startOffset )
@@ -74,7 +75,7 @@ public class Xstz
offset += _xst.getSize();
LittleEndian.putUShort( data, offset, _chTerm );
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
return offset - startOffset;
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/ParagraphSprmUncompressor.java Thu Apr 2 23:54:48 2020
@@ -33,6 +33,7 @@ import org.apache.poi.hwpf.usermodel.Sha
import org.apache.poi.hwpf.usermodel.ShadingDescriptor80;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -435,7 +436,7 @@ public final class ParagraphSprmUncompre
for (int x = 0; x < delSize; x++)
{
tabMap.remove(Integer.valueOf(LittleEndian.getShort(grpprl, offset)));
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
}
int addSize = grpprl[offset++];
@@ -445,7 +446,7 @@ public final class ParagraphSprmUncompre
Integer key = Integer.valueOf(LittleEndian.getShort(grpprl, offset));
TabDescriptor val = new TabDescriptor( grpprl, start + ((TabDescriptor.getSize() * addSize) + x) );
tabMap.put(key, val);
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
}
tabPositions = new int[tabMap.size()];
@@ -467,56 +468,4 @@ public final class ParagraphSprmUncompre
pap.setRgdxaTab(tabPositions);
pap.setRgtbd(tabDescriptors);
}
-
-// private static void handleTabsAgain(ParagraphProperties pap, SprmOperation sprm)
-// {
-// byte[] grpprl = sprm.getGrpprl();
-// int offset = sprm.getGrpprlOffset();
-// int delSize = grpprl[offset++];
-// int[] tabPositions = pap.getRgdxaTab();
-// byte[] tabDescriptors = pap.getRgtbd();
-//
-// HashMap tabMap = new HashMap();
-// for (int x = 0; x < tabPositions.length; x++)
-// {
-// tabMap.put(Integer.valueOf(tabPositions[x]), Byte.valueOf(tabDescriptors[x]));
-// }
-//
-// for (int x = 0; x < delSize; x++)
-// {
-// tabMap.remove(Integer.valueOf(LittleEndian.getInt(grpprl, offset)));
-// offset += LittleEndian.INT_SIZE;;
-// }
-//
-// int addSize = grpprl[offset++];
-// for (int x = 0; x < addSize; x++)
-// {
-// Integer key = Integer.valueOf(LittleEndian.getInt(grpprl, offset));
-// Byte val = Byte.valueOf(grpprl[(LittleEndian.INT_SIZE * (addSize - x)) + x]);
-// tabMap.put(key, val);
-// offset += LittleEndian.INT_SIZE;
-// }
-//
-// tabPositions = new int[tabMap.size()];
-// tabDescriptors = new byte[tabPositions.length];
-// ArrayList list = new ArrayList();
-//
-// Iterator keyIT = tabMap.keySet().iterator();
-// while (keyIT.hasNext())
-// {
-// list.add(keyIT.next());
-// }
-// Collections.sort(list);
-//
-// for (int x = 0; x < tabPositions.length; x++)
-// {
-// Integer key = ((Integer)list.get(x));
-// tabPositions[x] = key.intValue();
-// tabDescriptors[x] = ((Byte)tabMap.get(key)).byteValue();
-// }
-//
-// pap.setRgdxaTab(tabPositions);
-// pap.setRgtbd(tabDescriptors);
-// }
-
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SectionSprmCompressor.java Thu Apr 2 23:54:48 2020
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.poi.hwpf.usermodel.SectionProperties;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
@Internal
public final class SectionSprmCompressor
@@ -187,9 +188,9 @@ public final class SectionSprmCompressor
{
byte[] buf = new byte[7];
buf[0] = (byte)(newSEP.getFPropMark() ? 1 : 0);
- int offset = LittleEndian.BYTE_SIZE;
+ int offset = LittleEndianConsts.BYTE_SIZE;
LittleEndian.putShort(buf, 0, (short)newSEP.getIbstPropRMark());
- offset += LittleEndian.SHORT_SIZE;
+ offset += LittleEndianConsts.SHORT_SIZE;
newSEP.getDttmPropRMark().serialize(buf, offset);
size += SprmUtils.addSprm((short)0xD227, -1, buf, sprmList);
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmBuffer.java Thu Apr 2 23:54:48 2020
@@ -23,6 +23,7 @@ import org.apache.poi.common.Duplicatabl
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.Removal;
@Internal
@@ -62,38 +63,38 @@ public final class SprmBuffer implements
}
public void addSprm(short opcode, byte operand) {
- int addition = LittleEndian.SHORT_SIZE + LittleEndian.BYTE_SIZE;
+ int addition = LittleEndianConsts.SHORT_SIZE + LittleEndianConsts.BYTE_SIZE;
ensureCapacity(addition);
LittleEndian.putShort(_buf, _offset, opcode);
- _offset += LittleEndian.SHORT_SIZE;
+ _offset += LittleEndianConsts.SHORT_SIZE;
_buf[_offset++] = operand;
}
public void addSprm(short opcode, byte[] operand) {
- int addition = LittleEndian.SHORT_SIZE + LittleEndian.BYTE_SIZE + operand.length;
+ int addition = LittleEndianConsts.SHORT_SIZE + LittleEndianConsts.BYTE_SIZE + operand.length;
ensureCapacity(addition);
LittleEndian.putShort(_buf, _offset, opcode);
- _offset += LittleEndian.SHORT_SIZE;
+ _offset += LittleEndianConsts.SHORT_SIZE;
_buf[_offset++] = (byte) operand.length;
System.arraycopy(operand, 0, _buf, _offset, operand.length);
}
public void addSprm(short opcode, int operand) {
- int addition = LittleEndian.SHORT_SIZE + LittleEndian.INT_SIZE;
+ int addition = LittleEndianConsts.SHORT_SIZE + LittleEndianConsts.INT_SIZE;
ensureCapacity(addition);
LittleEndian.putShort(_buf, _offset, opcode);
- _offset += LittleEndian.SHORT_SIZE;
+ _offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putInt(_buf, _offset, operand);
- _offset += LittleEndian.INT_SIZE;
+ _offset += LittleEndianConsts.INT_SIZE;
}
public void addSprm(short opcode, short operand) {
- int addition = LittleEndian.SHORT_SIZE + LittleEndian.SHORT_SIZE;
+ int addition = LittleEndianConsts.SHORT_SIZE + LittleEndianConsts.SHORT_SIZE;
ensureCapacity(addition);
LittleEndian.putShort(_buf, _offset, opcode);
- _offset += LittleEndian.SHORT_SIZE;
+ _offset += LittleEndianConsts.SHORT_SIZE;
LittleEndian.putShort(_buf, _offset, operand);
- _offset += LittleEndian.SHORT_SIZE;
+ _offset += LittleEndianConsts.SHORT_SIZE;
}
public void append(byte[] grpprl) {
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmOperation.java Thu Apr 2 23:54:48 2020
@@ -21,6 +21,7 @@ import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
/**
* This class is used to represent a sprm operation from a Word 97/2000/XP
@@ -88,7 +89,7 @@ public final class SprmOperation
{
return _gOffset;
}
-
+
public int getOperand()
{
switch ( getSizeCode() )
@@ -107,7 +108,7 @@ public final class SprmOperation
byte operandLength = _grpprl[_gOffset + 1];
// initialized to zeros by JVM
- byte[] codeBytes = new byte[LittleEndian.INT_SIZE];
+ byte[] codeBytes = new byte[LittleEndianConsts.INT_SIZE];
for ( int i = 0; i < operandLength; i++ )
if ( _gOffset + i < _grpprl.length )
codeBytes[i] = _grpprl[_gOffset + 1 + i];
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/SprmUtils.java Thu Apr 2 23:54:48 2020
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
@Internal
@@ -37,11 +38,11 @@ public final class SprmUtils
public static byte[] shortArrayToByteArray(short[] convert)
{
- byte[] buf = IOUtils.safelyAllocate(convert.length * (long)LittleEndian.SHORT_SIZE, MAX_RECORD_LENGTH);
+ byte[] buf = IOUtils.safelyAllocate(convert.length * (long)LittleEndianConsts.SHORT_SIZE, MAX_RECORD_LENGTH);
for (int x = 0; x < convert.length; x++)
{
- LittleEndian.putShort(buf, x * LittleEndian.SHORT_SIZE, convert[x]);
+ LittleEndian.putShort(buf, x * LittleEndianConsts.SHORT_SIZE, convert[x]);
}
return buf;
@@ -130,7 +131,7 @@ public final class SprmUtils
{
byte[] buf = new byte[4];
LittleEndian.putShort(buf, 0, brc[0]);
- LittleEndian.putShort(buf, LittleEndian.SHORT_SIZE, brc[1]);
+ LittleEndian.putShort(buf, LittleEndianConsts.SHORT_SIZE, brc[1]);
return LittleEndian.getInt(buf);
}
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmCompressor.java Thu Apr 2 23:54:48 2020
@@ -28,6 +28,7 @@ import org.apache.poi.hwpf.usermodel.Tab
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
@Internal
public final class TableSprmCompressor
@@ -82,7 +83,7 @@ public final class TableSprmCompressor
int itcMac = newTAP.getItcMac();
byte[] buf = IOUtils.safelyAllocate(
1
- + (LittleEndian.SHORT_SIZE*((long)itcMac + 1))
+ + (LittleEndianConsts.SHORT_SIZE*((long)itcMac + 1))
+ (TableCellDescriptor.SIZE*(long)itcMac),
MAX_RECORD_LENGTH);
buf[0] = (byte)itcMac;
@@ -90,7 +91,7 @@ public final class TableSprmCompressor
short[] dxaCenters = newTAP.getRgdxaCenter();
for (int x = 0; x < dxaCenters.length; x++)
{
- LittleEndian.putShort(buf, 1 + (x * LittleEndian.SHORT_SIZE),
+ LittleEndian.putShort(buf, 1 + (x * LittleEndianConsts.SHORT_SIZE),
dxaCenters[x]);
}
@@ -98,7 +99,7 @@ public final class TableSprmCompressor
for (int x = 0; x < cellDescriptors.length; x++)
{
cellDescriptors[x].serialize(buf,
- 1+((itcMac+1)*LittleEndian.SHORT_SIZE)+(x*TableCellDescriptor.SIZE));
+ 1+((itcMac+1)* LittleEndianConsts.SHORT_SIZE)+(x*TableCellDescriptor.SIZE));
}
size += SprmUtils.addSpecialSprm((short)0xD608, buf, sprmList);
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/BorderCode.java Thu Apr 2 23:54:48 2020
@@ -21,6 +21,7 @@ import org.apache.poi.common.Duplicatabl
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.Removal;
/**
@@ -52,13 +53,13 @@ public final class BorderCode implements
public BorderCode(byte[] buf, int offset)
{
_info = LittleEndian.getShort(buf, offset);
- _info2 = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE);
+ _info2 = LittleEndian.getShort(buf, offset + LittleEndianConsts.SHORT_SIZE);
}
public void serialize(byte[] buf, int offset)
{
LittleEndian.putShort(buf, offset, _info);
- LittleEndian.putShort(buf, offset + LittleEndian.SHORT_SIZE, _info2);
+ LittleEndian.putShort(buf, offset + LittleEndianConsts.SHORT_SIZE, _info2);
}
public int toInt()
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/DateAndTime.java Thu Apr 2 23:54:48 2020
@@ -23,6 +23,7 @@ import org.apache.poi.common.Duplicatabl
import org.apache.poi.util.BitField;
import org.apache.poi.util.BitFieldFactory;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.Removal;
@@ -50,7 +51,7 @@ public final class DateAndTime implement
public DateAndTime(byte[] buf, int offset) {
_info = LittleEndian.getShort(buf, offset);
- _info2 = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE);
+ _info2 = LittleEndian.getShort(buf, offset + LittleEndianConsts.SHORT_SIZE);
}
public Calendar getDate() {
@@ -68,7 +69,7 @@ public final class DateAndTime implement
public void serialize(byte[] buf, int offset)
{
LittleEndian.putShort(buf, offset, _info);
- LittleEndian.putShort(buf, offset + LittleEndian.SHORT_SIZE, _info2);
+ LittleEndian.putShort(buf, offset + LittleEndianConsts.SHORT_SIZE, _info2);
}
@Override
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/LineSpacingDescriptor.java Thu Apr 2 23:54:48 2020
@@ -19,6 +19,7 @@ package org.apache.poi.hwpf.usermodel;
import org.apache.poi.common.Duplicatable;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.Removal;
/**
@@ -41,7 +42,7 @@ public final class LineSpacingDescriptor
public LineSpacingDescriptor(byte[] buf, int offset) {
_dyaLine = LittleEndian.getShort(buf, offset);
- _fMultiLinespace = LittleEndian.getShort(buf, offset + LittleEndian.SHORT_SIZE);
+ _fMultiLinespace = LittleEndian.getShort(buf, offset + LittleEndianConsts.SHORT_SIZE);
}
@Override
@@ -72,7 +73,7 @@ public final class LineSpacingDescriptor
public void serialize(byte[] buf, int offset)
{
LittleEndian.putShort(buf, offset, _dyaLine);
- LittleEndian.putShort(buf, offset + LittleEndian.SHORT_SIZE, _fMultiLinespace);
+ LittleEndian.putShort(buf, offset + LittleEndianConsts.SHORT_SIZE, _fMultiLinespace);
}
public void setDyaLine(short dyaLine)
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java?rev=1876067&r1=1876066&r2=1876067&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/Range.java Thu Apr 2 23:54:48 2020
@@ -36,6 +36,7 @@ import org.apache.poi.hwpf.sprm.SprmBuff
import org.apache.poi.util.DocumentFormatException;
import org.apache.poi.util.Internal;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.LittleEndianConsts;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
@@ -471,9 +472,9 @@ public class Range {
CharacterProperties baseChp = ss.getCharacterStyle(styleIndex);
byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
- byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
+ byte[] withIndex = new byte[grpprl.length + LittleEndianConsts.SHORT_SIZE];
LittleEndian.putShort(withIndex, 0, (short) styleIndex);
- System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
+ System.arraycopy(grpprl, 0, withIndex, LittleEndianConsts.SHORT_SIZE, grpprl.length);
SprmBuffer buf = new SprmBuffer(withIndex, 2);
_doc.getParagraphTable().insert(_parStart, _start, buf);
@@ -522,9 +523,9 @@ public class Range {
CharacterProperties baseChp = ss.getCharacterStyle(styleIndex);
byte[] grpprl = ParagraphSprmCompressor.compressParagraphProperty(props, baseStyle);
- byte[] withIndex = new byte[grpprl.length + LittleEndian.SHORT_SIZE];
+ byte[] withIndex = new byte[grpprl.length + LittleEndianConsts.SHORT_SIZE];
LittleEndian.putShort(withIndex, 0, (short) styleIndex);
- System.arraycopy(grpprl, 0, withIndex, LittleEndian.SHORT_SIZE, grpprl.length);
+ System.arraycopy(grpprl, 0, withIndex, LittleEndianConsts.SHORT_SIZE, grpprl.length);
SprmBuffer buf = new SprmBuffer(withIndex, 2);
_doc.getParagraphTable().insert(_parEnd, _end, buf);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org