@Override
public long init(LittleEndianInputStream leis, long recordSize, long recordId) throws IOException {
int startIdx = leis.getReadIndex();
- data = new EmfCommentDataIterator(leis, Math.toIntExact(recordSize), true).next();
+ data = new EmfCommentDataIterator(leis, (int)recordSize, true).next();
return leis.getReadIndex()-startIdx;
}
// 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
- final long commentIdentifier = leis.readUInt();
+ final int commentIdentifier = (int)leis.readUInt();
// A 32-bit unsigned integer that identifies the type of public comment record.
- final long publicCommentIdentifier = leis.readUInt();
+ final int publicCommentIdentifier = (int)leis.readUInt();
final boolean isEmfPublic = (commentIdentifier == HemfCommentRecordType.emfPublic.id);
leis.reset();
final EmfCommentData record = commentType.constructor.get();
long readBytes = record.init(leis, dataSize);
- final int skipBytes = Math.toIntExact(recordSize-4-readBytes);
+ final int skipBytes = (int)(recordSize-4-readBytes);
assert (skipBytes >= 0);
leis.skipFully(skipBytes);
long startIdx = leis.getReadIndex();
int commentIdentifier = leis.readInt();
assert (commentIdentifier == HemfCommentRecordType.emfPlus.id);
- new HemfPlusRecordIterator(leis, Math.toIntExact(dataSize-LittleEndianConsts.INT_SIZE)).forEachRemaining(records::add);
+ new HemfPlusRecordIterator(leis, (int)dataSize-LittleEndianConsts.INT_SIZE).forEachRemaining(records::add);
return leis.getReadIndex()-startIdx;
}
public long init(final LittleEndianInputStream leis, final long dataSize)
throws IOException {
final int startIdx = leis.getReadIndex();
- final long commentIdentifier = leis.readUInt();
+ final int commentIdentifier = (int)leis.readUInt();
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
- final long publicCommentIdentifier = leis.readUInt();
+ final int publicCommentIdentifier = (int)leis.readUInt();
assert(publicCommentIdentifier == HemfCommentRecordType.emfBeginGroup.id);
HemfDraw.readRectL(leis, bounds);
// The number of Unicode characters in the optional description string that follows.
- long nDescription = leis.readUInt();
+ int nDescription = (int)leis.readUInt();
byte[] buf = IOUtils.safelyAllocate(nDescription * 2L, MAX_RECORD_LENGTH);
leis.readFully(buf);
public long init(final LittleEndianInputStream leis, final long dataSize)
throws IOException {
final int startIdx = leis.getReadIndex();
- final long commentIdentifier = leis.readUInt();
+ final int commentIdentifier = (int)leis.readUInt();
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
- final long publicCommentIdentifier = leis.readUInt();
+ final int publicCommentIdentifier = (int)leis.readUInt();
assert(publicCommentIdentifier == HemfCommentRecordType.emfEndGroup.id);
return leis.getReadIndex()-startIdx;
}
public long init(final LittleEndianInputStream leis, final long dataSize)
throws IOException {
final int startIdx = leis.getReadIndex();
- final long commentIdentifier = leis.readUInt();
+ final int commentIdentifier = (int)leis.readUInt();
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
- final long publicCommentIdentifier = leis.readUInt();
+ final int publicCommentIdentifier = (int)leis.readUInt();
assert(publicCommentIdentifier == HemfCommentRecordType.emfMultiFormats.id);
HemfDraw.readRectL(leis, bounds);
// A 32-bit unsigned integer that specifies the number of graphics formats contained in this record.
- long countFormats = leis.readUInt();
- for (long pos = 0; pos < countFormats; pos++) {
+ int countFormats = (int)leis.readUInt();
+ for (int i=0; i<countFormats; i++) {
EmfCommentDataFormat fmt = new EmfCommentDataFormat();
long readBytes = fmt.init(leis, dataSize, startIdx);
formats.add(fmt);
@Override
public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
final int startIdx = leis.getReadIndex();
- final long commentIdentifier = leis.readUInt();
+ final int commentIdentifier = (int)leis.readUInt();
assert(commentIdentifier == HemfCommentRecordType.emfPublic.id);
- final long publicCommentIdentifier = leis.readUInt();
+ final int publicCommentIdentifier = (int)leis.readUInt();
assert(publicCommentIdentifier == HemfCommentRecordType.emfWMF.id);
// A 16-bit unsigned integer that specifies the WMF metafile version in terms
// A 32-bit unsigned integer that specifies the size, in bytes, of the
// WMF metafile in the WinMetafile field.
- int winMetafileSize = Math.toIntExact(leis.readUInt());
+ int winMetafileSize = (int)leis.readUInt();
wmfData = IOUtils.safelyAllocate(winMetafileSize, MAX_RECORD_LENGTH);
// some emf comments are truncated, so we don't use readFully here
}
@Override
- public long init(final LittleEndianInputStream leis, final long dataSize) throws IOException {
+ public long init(final LittleEndianInputStream leis, final long dataSize)
+ throws IOException {
throw new RecordFormatException("UNICODE_STRING/UNICODE_END values are reserved in CommentPublic records");
}