mirror of https://github.com/apache/poi.git
try to fix build failure
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1866941 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b6220447d0
commit
9808fd5015
|
@ -304,7 +304,7 @@ public class CellNumberFormatter extends CellFormatter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int maxValue(List<Special> s) {
|
private static int maxValue(List<Special> s) {
|
||||||
return (int) Math.round(Math.pow(10, s.size()) - 1);
|
return Math.toIntExact(Math.round(Math.pow(10, s.size()) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Special> specialsFor(int pos, int takeFirst) {
|
private List<Special> specialsFor(int pos, int takeFirst) {
|
||||||
|
|
|
@ -198,9 +198,9 @@ public class HemfComment {
|
||||||
// Valid comment identifier values are listed in the following table.
|
// Valid comment identifier values are listed in the following table.
|
||||||
//
|
//
|
||||||
// If this field contains any other value, the comment record MUST be an EMR_COMMENT record
|
// If this field contains any other value, the comment record MUST be an EMR_COMMENT record
|
||||||
final int commentIdentifier = Math.toIntExact(leis.readUInt());
|
final long commentIdentifier = leis.readUInt();
|
||||||
// A 32-bit unsigned integer that identifies the type of public comment record.
|
// A 32-bit unsigned integer that identifies the type of public comment record.
|
||||||
final int publicCommentIdentifier = Math.toIntExact(leis.readUInt());
|
final long publicCommentIdentifier = leis.readUInt();
|
||||||
|
|
||||||
final boolean isEmfPublic = (commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
final boolean isEmfPublic = (commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
||||||
leis.reset();
|
leis.reset();
|
||||||
|
@ -322,14 +322,14 @@ public class HemfComment {
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = Math.toIntExact(leis.readUInt());
|
final long commentIdentifier = leis.readUInt();
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
||||||
final int publicCommentIdentifier = Math.toIntExact(leis.readUInt());
|
final long publicCommentIdentifier = leis.readUInt();
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfBeginGroup.id);
|
assert(publicCommentIdentifier == HemfCommentRecordType.emfBeginGroup.id);
|
||||||
HemfDraw.readRectL(leis, bounds);
|
HemfDraw.readRectL(leis, bounds);
|
||||||
|
|
||||||
// The number of Unicode characters in the optional description string that follows.
|
// The number of Unicode characters in the optional description string that follows.
|
||||||
int nDescription = Math.toIntExact(leis.readUInt());
|
long nDescription = leis.readUInt();
|
||||||
|
|
||||||
byte[] buf = IOUtils.safelyAllocate(nDescription * 2L, MAX_RECORD_LENGTH);
|
byte[] buf = IOUtils.safelyAllocate(nDescription * 2L, MAX_RECORD_LENGTH);
|
||||||
leis.readFully(buf);
|
leis.readFully(buf);
|
||||||
|
@ -365,9 +365,9 @@ public class HemfComment {
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = Math.toIntExact(leis.readUInt());
|
final long commentIdentifier = leis.readUInt();
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
||||||
final int publicCommentIdentifier = Math.toIntExact(leis.readUInt());
|
final long publicCommentIdentifier = leis.readUInt();
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfEndGroup.id);
|
assert(publicCommentIdentifier == HemfCommentRecordType.emfEndGroup.id);
|
||||||
return leis.getReadIndex()-startIdx;
|
return leis.getReadIndex()-startIdx;
|
||||||
}
|
}
|
||||||
|
@ -391,15 +391,15 @@ public class HemfComment {
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize)
|
public long init(final LittleEndianInputStream leis, final long dataSize)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = Math.toIntExact(leis.readUInt());
|
final long commentIdentifier = leis.readUInt();
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
||||||
final int publicCommentIdentifier = Math.toIntExact(leis.readUInt());
|
final long publicCommentIdentifier = leis.readUInt();
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfMultiFormats.id);
|
assert(publicCommentIdentifier == HemfCommentRecordType.emfMultiFormats.id);
|
||||||
HemfDraw.readRectL(leis, bounds);
|
HemfDraw.readRectL(leis, bounds);
|
||||||
|
|
||||||
// A 32-bit unsigned integer that specifies the number of graphics formats contained in this record.
|
// A 32-bit unsigned integer that specifies the number of graphics formats contained in this record.
|
||||||
int countFormats = Math.toIntExact(leis.readUInt());
|
long countFormats = leis.readUInt();
|
||||||
for (int i=0; i<countFormats; i++) {
|
for (long pos = 0; pos < countFormats; pos++) {
|
||||||
EmfCommentDataFormat fmt = new EmfCommentDataFormat();
|
EmfCommentDataFormat fmt = new EmfCommentDataFormat();
|
||||||
long readBytes = fmt.init(leis, dataSize, startIdx);
|
long readBytes = fmt.init(leis, dataSize, startIdx);
|
||||||
formats.add(fmt);
|
formats.add(fmt);
|
||||||
|
@ -533,9 +533,9 @@ public class HemfComment {
|
||||||
@Override
|
@Override
|
||||||
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
|
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
|
||||||
final int startIdx = leis.getReadIndex();
|
final int startIdx = leis.getReadIndex();
|
||||||
final int commentIdentifier = Math.toIntExact(leis.readUInt());
|
final long commentIdentifier = leis.readUInt();
|
||||||
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
|
||||||
final int publicCommentIdentifier = Math.toIntExact(leis.readUInt());
|
final long publicCommentIdentifier = leis.readUInt();
|
||||||
assert(publicCommentIdentifier == HemfCommentRecordType.emfWMF.id);
|
assert(publicCommentIdentifier == HemfCommentRecordType.emfWMF.id);
|
||||||
|
|
||||||
// A 16-bit unsigned integer that specifies the WMF metafile version in terms
|
// A 16-bit unsigned integer that specifies the WMF metafile version in terms
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import org.apache.commons.math3.util.ArithmeticUtils;
|
||||||
import org.apache.poi.hemf.draw.HemfDrawProperties;
|
import org.apache.poi.hemf.draw.HemfDrawProperties;
|
||||||
import org.apache.poi.hemf.draw.HemfGraphics;
|
import org.apache.poi.hemf.draw.HemfGraphics;
|
||||||
import org.apache.poi.hwmf.draw.HwmfDrawProperties;
|
import org.apache.poi.hwmf.draw.HwmfDrawProperties;
|
||||||
|
@ -900,7 +901,7 @@ public class HemfMisc {
|
||||||
// contains a DIB.
|
// contains a DIB.
|
||||||
int cbBits = (int) leis.readUInt();
|
int cbBits = (int) leis.readUInt();
|
||||||
|
|
||||||
int size = 6 * LittleEndianConsts.INT_SIZE;
|
int size = ArithmeticUtils.mulAndCheck(6, LittleEndianConsts.INT_SIZE);
|
||||||
|
|
||||||
size += readBitmap(leis, bitmap, startIdx, offBmi, cbBmi, offBits, cbBits);
|
size += readBitmap(leis, bitmap, startIdx, offBmi, cbBmi, offBits, cbBits);
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class HemfRecordIterator implements Iterator<HemfRecord> {
|
||||||
long remBytes = recordSize-HEADER_SIZE;
|
long remBytes = recordSize-HEADER_SIZE;
|
||||||
long readBytes = record.init(stream, remBytes, recordId);
|
long readBytes = record.init(stream, remBytes, recordId);
|
||||||
assert (readBytes <= remBytes);
|
assert (readBytes <= remBytes);
|
||||||
stream.skipFully((int)(remBytes-readBytes));
|
stream.skipFully(Math.toIntExact(remBytes-readBytes));
|
||||||
} catch (IOException|RuntimeException e) {
|
} catch (IOException|RuntimeException e) {
|
||||||
throw new RecordFormatException(e);
|
throw new RecordFormatException(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue