mirror of https://github.com/apache/poi.git
more int narrowing
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903560 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f1692cc041
commit
9d7d2f26e0
|
@ -709,7 +709,7 @@ public class HemfPlusBrush {
|
|||
// that appears at the center point of the brush. The color of the brush changes gradually from the
|
||||
// boundary color to the center color as it moves from the boundary to the center point.
|
||||
centerColor = readARGB(leis.readInt());
|
||||
int size = 3*LittleEndianConsts.INT_SIZE;
|
||||
long size = 3*LittleEndianConsts.INT_SIZE;
|
||||
|
||||
if (wrapMode == null) {
|
||||
return size;
|
||||
|
@ -785,7 +785,7 @@ public class HemfPlusBrush {
|
|||
size += 3*LittleEndianConsts.INT_SIZE;
|
||||
}
|
||||
|
||||
return size;
|
||||
return Math.toIntExact(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -846,7 +846,7 @@ public class HemfPlusBrush {
|
|||
// across a shape, when the image is smaller than the area being filled.
|
||||
wrapMode = EmfPlusWrapMode.valueOf(leis.readInt());
|
||||
|
||||
int size = 2*LittleEndianConsts.INT_SIZE;
|
||||
long size = 2*LittleEndianConsts.INT_SIZE;
|
||||
|
||||
if (TRANSFORM.isSet(dataFlags)) {
|
||||
size += readXForm(leis, (brushTransform = new AffineTransform()));
|
||||
|
@ -856,7 +856,7 @@ public class HemfPlusBrush {
|
|||
size += (image = new EmfPlusImage()).init(leis, dataSize-size, EmfPlusObjectType.IMAGE, 0);
|
||||
}
|
||||
|
||||
return size;
|
||||
return Math.toIntExact(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -174,7 +174,7 @@ public class HemfPlusObject {
|
|||
EmfPlusObjectType objectType = getObjectType();
|
||||
assert (objectType != null);
|
||||
|
||||
int size = 0;
|
||||
long size = 0;
|
||||
|
||||
totalObjectSize = 0;
|
||||
int dataSize2 = (int) dataSize;
|
||||
|
@ -192,7 +192,7 @@ public class HemfPlusObject {
|
|||
objectData = objectType.constructor.get();
|
||||
size += objectData.init(leis, dataSize2, objectType, flags);
|
||||
|
||||
return size;
|
||||
return Math.toIntExact(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -533,7 +533,7 @@ public class HemfPlusPen {
|
|||
@SuppressWarnings("unused")
|
||||
private long initCustomCap(Consumer<EmfPlusCustomLineCap> setter, LittleEndianInputStream leis) throws IOException {
|
||||
int CustomStartCapSize = leis.readInt();
|
||||
int size = LittleEndianConsts.INT_SIZE;
|
||||
long size = LittleEndianConsts.INT_SIZE;
|
||||
|
||||
EmfPlusGraphicsVersion version = new EmfPlusGraphicsVersion();
|
||||
size += version.init(leis);
|
||||
|
@ -547,13 +547,13 @@ public class HemfPlusPen {
|
|||
|
||||
setter.accept(cap);
|
||||
|
||||
return size;
|
||||
return Math.toIntExact(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyObject(HemfGraphics ctx, List<? extends EmfPlusObjectData> continuedObjectData) {
|
||||
final HemfDrawProperties prop = ctx.getProperties();
|
||||
// TOOD:
|
||||
// TODO:
|
||||
// - set width according unit type
|
||||
// - provide logic for different start and end cap
|
||||
// - provide standard caps like diamond
|
||||
|
|
|
@ -281,19 +281,10 @@ public final class SlideShowDumper {
|
|||
if (recordLen == 8 && atomLen > 8) {
|
||||
// Assume it has children, rather than being corrupted
|
||||
walkEscherDDF((indent + 3), pos + 8, (int) atomLen);
|
||||
|
||||
// Wind on our length + our header
|
||||
pos += atomLen;
|
||||
pos += 8;
|
||||
len -= atomLen;
|
||||
len -= 8;
|
||||
} else {
|
||||
// No children, wind on our real length
|
||||
pos += atomLen;
|
||||
pos += 8;
|
||||
len -= atomLen;
|
||||
len -= 8;
|
||||
}
|
||||
// Wind on our length + our header
|
||||
pos = Math.toIntExact(pos + atomLen) + 8;
|
||||
len = Math.toIntExact(len - atomLen) - 8;
|
||||
|
||||
// Move on to the next one, if we're not at the end yet
|
||||
if (len >= 8) {
|
||||
|
|
|
@ -113,7 +113,7 @@ public class HSLFEscherClientDataRecord extends EscherClientDataRecord {
|
|||
_childRecords.add(r);
|
||||
}
|
||||
long rlen = LittleEndian.getUInt(remainingData,offset+4);
|
||||
offset += 8 + rlen;
|
||||
offset = Math.toIntExact(offset + 8 + rlen);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue