mirror of
https://github.com/apache/poi.git
synced 2025-02-24 19:35:22 +00:00
fix result of multiplication cast to wider type
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859595 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
906c52d81d
commit
928e6937f4
@ -102,9 +102,9 @@ public class BigExample {
|
||||
// create a numeric cell
|
||||
c = r.createCell(cellnum);
|
||||
// do some goofy math to demonstrate decimals
|
||||
c.setCellValue(rownum * 10000 + cellnum
|
||||
+ (((double) rownum / 1000)
|
||||
+ ((double) cellnum / 10000)));
|
||||
c.setCellValue((rownum * 10000.0) + cellnum
|
||||
+ (rownum / 1000.0)
|
||||
+ (cellnum / 10000.0));
|
||||
|
||||
// on every other row
|
||||
if ((rownum % 2) == 0) {
|
||||
|
@ -87,8 +87,8 @@ public final class HSSFReadWrite {
|
||||
|
||||
for (int cellnum = 0; cellnum < 50; cellnum += 2) {
|
||||
HSSFCell c = r.createCell(cellnum);
|
||||
c.setCellValue(rownum * 10000 + cellnum
|
||||
+ (((double) rownum / 1000) + ((double) cellnum / 10000)));
|
||||
c.setCellValue((rownum * 10000.0) + cellnum
|
||||
+ (rownum / 1000.0) + (cellnum / 10000.0));
|
||||
if ((rownum % 2) == 0) {
|
||||
c.setCellStyle(cs);
|
||||
}
|
||||
|
@ -759,6 +759,7 @@ public class POIFSFileSystem extends BlockStore
|
||||
* and buffers. After this, you will be unable to read or
|
||||
* write from the FileSystem.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
_data.close();
|
||||
}
|
||||
@ -834,6 +835,7 @@ public class POIFSFileSystem extends BlockStore
|
||||
*
|
||||
* @return an array of Object; may not be null, but may be empty
|
||||
*/
|
||||
@Override
|
||||
public Object[] getViewableArray() {
|
||||
if (preferArray()) {
|
||||
return getRoot().getViewableArray();
|
||||
@ -850,6 +852,7 @@ public class POIFSFileSystem extends BlockStore
|
||||
* back end store
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Iterator<Object> getViewableIterator() {
|
||||
if (!preferArray()) {
|
||||
return getRoot().getViewableIterator();
|
||||
@ -866,6 +869,7 @@ public class POIFSFileSystem extends BlockStore
|
||||
* a viewer should call getViewableIterator
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean preferArray() {
|
||||
return getRoot().preferArray();
|
||||
}
|
||||
@ -877,6 +881,7 @@ public class POIFSFileSystem extends BlockStore
|
||||
* @return short description
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
return "POIFS FileSystem";
|
||||
}
|
||||
@ -949,4 +954,3 @@ public class POIFSFileSystem extends BlockStore
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,9 @@ final class YearFracCalculator {
|
||||
private static double calculateAdjusted(SimpleDate startDate, SimpleDate endDate, int date1day,
|
||||
int date2day) {
|
||||
double dayCount
|
||||
= (endDate.year - startDate.year) * 360
|
||||
+ (endDate.month - startDate.month) * SHORT_MONTH_LEN
|
||||
+ (date2day - date1day) * 1;
|
||||
= (endDate.year - startDate.year) * 360.0
|
||||
+ (endDate.month - startDate.month) * (double)SHORT_MONTH_LEN
|
||||
+ (date2day - date1day) * 1.0;
|
||||
return dayCount / 360;
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,7 @@ import org.apache.poi.util.LocaleUtil;
|
||||
* @see <a href="https://support.microsoft.com/en-us/kb/235575">DAYS360 Function Produces Different Values Depending on the Version of Excel</a>
|
||||
*/
|
||||
public class Days360 extends Var2or3ArgFunction {
|
||||
@Override
|
||||
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1) {
|
||||
try {
|
||||
double d0 = NumericFunction.singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex);
|
||||
@ -76,6 +77,7 @@ public class Days360 extends Var2or3ArgFunction {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1,
|
||||
ValueEval arg2) {
|
||||
try {
|
||||
@ -95,8 +97,8 @@ public class Days360 extends Var2or3ArgFunction {
|
||||
int[] startingDate = getStartingDate(realStart, method);
|
||||
int[] endingDate = getEndingDate(realEnd, startingDate, method);
|
||||
return
|
||||
(endingDate[0]*360+endingDate[1]*30+endingDate[2])-
|
||||
(startingDate[0]*360+startingDate[1]*30+startingDate[2]);
|
||||
(endingDate[0]*360.0+endingDate[1]*30.0+endingDate[2])-
|
||||
(startingDate[0]*360.0+startingDate[1]*30.0+startingDate[2]);
|
||||
}
|
||||
|
||||
private static Calendar getDate(double date) {
|
||||
@ -110,7 +112,9 @@ public class Days360 extends Var2or3ArgFunction {
|
||||
int mm = realStart.get(Calendar.MONTH);
|
||||
int dd = Math.min(30, realStart.get(Calendar.DAY_OF_MONTH));
|
||||
|
||||
if (!method && isLastDayOfMonth(realStart)) dd = 30;
|
||||
if (!method && isLastDayOfMonth(realStart)) {
|
||||
dd = 30;
|
||||
}
|
||||
|
||||
return new int[]{yyyy,mm,dd};
|
||||
}
|
||||
|
@ -124,11 +124,11 @@ public class DateUtil {
|
||||
// be 4 hours.
|
||||
// E.g. 2004-03-28 04:00 CEST - 2004-03-28 00:00 CET is 3 hours
|
||||
// and 2004-10-31 04:00 CET - 2004-10-31 00:00 CEST is 5 hours
|
||||
double fraction = (((date.get(Calendar.HOUR_OF_DAY) * 60
|
||||
double fraction = (((date.get(Calendar.HOUR_OF_DAY) * 60.0
|
||||
+ date.get(Calendar.MINUTE)
|
||||
) * 60 + date.get(Calendar.SECOND)
|
||||
) * 1000 + date.get(Calendar.MILLISECOND)
|
||||
) / ( double ) DAY_MILLISECONDS;
|
||||
) * 60.0 + date.get(Calendar.SECOND)
|
||||
) * 1000.0 + date.get(Calendar.MILLISECOND)
|
||||
) / DAY_MILLISECONDS;
|
||||
Calendar calStart = dayStart(date);
|
||||
|
||||
double value = fraction + absoluteDay(calStart, use1904windowing);
|
||||
@ -345,6 +345,7 @@ public class DateUtil {
|
||||
// string represents a date format if the same string is passed multiple times.
|
||||
// see https://issues.apache.org/bugzilla/show_bug.cgi?id=55611
|
||||
private static ThreadLocal<Integer> lastFormatIndex = new ThreadLocal<Integer>() {
|
||||
@Override
|
||||
protected Integer initialValue() {
|
||||
return -1;
|
||||
}
|
||||
@ -379,7 +380,9 @@ public class DateUtil {
|
||||
*/
|
||||
public static boolean isADateFormat(ExcelNumberFormat numFmt) {
|
||||
|
||||
if (numFmt == null) return false;
|
||||
if (numFmt == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isADateFormat(numFmt.getIdx(), numFmt.getFormat());
|
||||
}
|
||||
@ -552,13 +555,17 @@ public class DateUtil {
|
||||
* @see #isInternalDateFormat(int)
|
||||
*/
|
||||
public static boolean isCellDateFormatted(Cell cell, ConditionalFormattingEvaluator cfEvaluator) {
|
||||
if (cell == null) return false;
|
||||
if (cell == null) {
|
||||
return false;
|
||||
}
|
||||
boolean bDate = false;
|
||||
|
||||
double d = cell.getNumericCellValue();
|
||||
if ( DateUtil.isValidExcelDate(d) ) {
|
||||
ExcelNumberFormat nf = ExcelNumberFormat.from(cell, cfEvaluator);
|
||||
if(nf==null) return false;
|
||||
if(nf==null) {
|
||||
return false;
|
||||
}
|
||||
bDate = isADateFormat(nf);
|
||||
}
|
||||
return bDate;
|
||||
@ -573,7 +580,9 @@ public class DateUtil {
|
||||
* @see #isInternalDateFormat(int)
|
||||
*/
|
||||
public static boolean isCellInternalDateFormatted(Cell cell) {
|
||||
if (cell == null) return false;
|
||||
if (cell == null) {
|
||||
return false;
|
||||
}
|
||||
boolean bDate = false;
|
||||
|
||||
double d = cell.getNumericCellValue();
|
||||
@ -691,7 +700,7 @@ public class DateUtil {
|
||||
int minutes = parseInt(minStr, "minute", MINUTES_PER_HOUR);
|
||||
int seconds = parseInt(secStr, "second", SECONDS_PER_MINUTE);
|
||||
|
||||
double totalSeconds = seconds + (minutes + (hours) * 60) * 60;
|
||||
double totalSeconds = seconds + (minutes + (hours * 60.0)) * 60.0;
|
||||
return totalSeconds / (SECONDS_PER_DAY);
|
||||
}
|
||||
/**
|
||||
|
@ -16,13 +16,17 @@
|
||||
==================================================================== */
|
||||
package org.apache.poi.ss.usermodel;
|
||||
|
||||
import java.util.*;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormatSymbols;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.*;
|
||||
|
||||
/**
|
||||
* A wrapper around a {@link SimpleDateFormat} instance,
|
||||
* which handles a few Excel-style extensions that
|
||||
@ -152,7 +156,7 @@ public class ExcelStyleDateFormatter extends SimpleDateFormat {
|
||||
}
|
||||
if (s.indexOf(S_BRACKET_SYMBOL) != -1 ||
|
||||
s.indexOf(SS_BRACKET_SYMBOL) != -1) {
|
||||
float seconds = (float) (dateToBeFormatted * 24.0 * 60.0 * 60.0);
|
||||
float seconds = (float) (dateToBeFormatted * 24 * 60 * 60);
|
||||
s = s.replaceAll(
|
||||
String.valueOf(S_BRACKET_SYMBOL),
|
||||
format1digit.format(seconds)
|
||||
@ -165,15 +169,15 @@ public class ExcelStyleDateFormatter extends SimpleDateFormat {
|
||||
|
||||
if (s.indexOf(L_BRACKET_SYMBOL) != -1 ||
|
||||
s.indexOf(LL_BRACKET_SYMBOL) != -1) {
|
||||
float millisTemp = (float) ((dateToBeFormatted - Math.floor(dateToBeFormatted)) * 24.0 * 60.0 * 60.0);
|
||||
float millisTemp = (float) ((dateToBeFormatted - Math.floor(dateToBeFormatted)) * 24 * 60 * 60);
|
||||
float millis = (millisTemp - (int) millisTemp);
|
||||
s = s.replaceAll(
|
||||
String.valueOf(L_BRACKET_SYMBOL),
|
||||
format3digit.format(millis * 10)
|
||||
format3digit.format(millis * 10.0)
|
||||
);
|
||||
s = s.replaceAll(
|
||||
String.valueOf(LL_BRACKET_SYMBOL),
|
||||
format4digits.format(millis * 100)
|
||||
format4digits.format(millis * 100.0)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -122,10 +122,14 @@ public class ImageUtils {
|
||||
NodeList lst;
|
||||
Element node = (Element)r.getImageMetadata(0).getAsTree("javax_imageio_1.0");
|
||||
lst = node.getElementsByTagName("HorizontalPixelSize");
|
||||
if(lst != null && lst.getLength() == 1) hdpi = (int)(mm2inch/Float.parseFloat(((Element)lst.item(0)).getAttribute("value")));
|
||||
if(lst != null && lst.getLength() == 1) {
|
||||
hdpi = (int)(mm2inch/Float.parseFloat(((Element)lst.item(0)).getAttribute("value")));
|
||||
}
|
||||
|
||||
lst = node.getElementsByTagName("VerticalPixelSize");
|
||||
if(lst != null && lst.getLength() == 1) vdpi = (int)(mm2inch/Float.parseFloat(((Element)lst.item(0)).getAttribute("value")));
|
||||
if(lst != null && lst.getLength() == 1) {
|
||||
vdpi = (int)(mm2inch/Float.parseFloat(((Element)lst.item(0)).getAttribute("value")));
|
||||
}
|
||||
|
||||
return new int[]{hdpi, vdpi};
|
||||
}
|
||||
@ -177,7 +181,9 @@ public class ImageUtils {
|
||||
} else {
|
||||
dx2 = (int)((cw-delta)*EMU_PER_PIXEL);
|
||||
}
|
||||
if (dx2 < 0) dx2 = 0;
|
||||
if (dx2 < 0) {
|
||||
dx2 = 0;
|
||||
}
|
||||
}
|
||||
anchor.setCol2(col2);
|
||||
anchor.setDx2(dx2);
|
||||
@ -205,7 +211,9 @@ public class ImageUtils {
|
||||
} else {
|
||||
dy2 = (int)((ch-delta)*EMU_PER_PIXEL);
|
||||
}
|
||||
if (dy2 < 0) dy2 = 0;
|
||||
if (dy2 < 0) {
|
||||
dy2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
anchor.setRow2(row2);
|
||||
@ -244,7 +252,7 @@ public class ImageUtils {
|
||||
}
|
||||
|
||||
if (isHSSF) {
|
||||
w += sheet.getColumnWidthInPixels(col2) * anchor.getDx2()/1024d;
|
||||
w += anchor.getDx2()/1024d * sheet.getColumnWidthInPixels(col2);
|
||||
} else {
|
||||
w += anchor.getDx2()/(double)EMU_PER_PIXEL;
|
||||
}
|
||||
|
@ -116,14 +116,17 @@ public class CellWalk {
|
||||
public int rowNumber;
|
||||
public int colNumber;
|
||||
|
||||
@Override
|
||||
public long getOrdinalNumber() {
|
||||
return ordinalNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowNumber() {
|
||||
return rowNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnNumber() {
|
||||
return colNumber;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ public class StringUtil {
|
||||
}
|
||||
|
||||
public static String readUnicodeLE(LittleEndianInput in, int nChars) {
|
||||
byte[] bytes = IOUtils.safelyAllocate(nChars * 2, MAX_RECORD_LENGTH);
|
||||
byte[] bytes = IOUtils.safelyAllocate(nChars * 2L, MAX_RECORD_LENGTH);
|
||||
in.readFully(bytes);
|
||||
return new String(bytes, UTF16LE);
|
||||
}
|
||||
|
@ -69,7 +69,9 @@ public class HemfComment {
|
||||
|
||||
public static HemfCommentRecordType getById(long id, boolean isEmfPublic) {
|
||||
for (HemfCommentRecordType wrt : values()) {
|
||||
if (wrt.id == id && wrt.isEmfPublic == isEmfPublic) return wrt;
|
||||
if (wrt.id == id && wrt.isEmfPublic == isEmfPublic) {
|
||||
return wrt;
|
||||
}
|
||||
}
|
||||
return emfGeneric;
|
||||
}
|
||||
@ -277,7 +279,7 @@ public class HemfComment {
|
||||
// The number of Unicode characters in the optional description string that follows.
|
||||
int nDescription = (int)leis.readUInt();
|
||||
|
||||
byte[] buf = IOUtils.safelyAllocate(nDescription*2, MAX_RECORD_LENGTH);
|
||||
byte[] buf = IOUtils.safelyAllocate(nDescription * 2L, MAX_RECORD_LENGTH);
|
||||
leis.readFully(buf);
|
||||
description = new String(buf, StandardCharsets.UTF_16LE);
|
||||
|
||||
@ -373,7 +375,9 @@ public class HemfComment {
|
||||
|
||||
public static EmfFormatSignature getById(int id) {
|
||||
for (EmfFormatSignature wrt : values()) {
|
||||
if (wrt.id == id) return wrt;
|
||||
if (wrt.id == id) {
|
||||
return wrt;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public final class QCTextBit extends QCBit {
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
byte[] data = IOUtils.safelyAllocate(text.length() * 2, MAX_RECORD_LENGTH);
|
||||
byte[] data = IOUtils.safelyAllocate(text.length() * 2L, MAX_RECORD_LENGTH);
|
||||
StringUtil.putUnicodeLE(text, data, 0);
|
||||
setData(data);
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ public class CurrentUserAtom
|
||||
LittleEndian.putInt(_contents,28+asciiUN.length,(int)releaseVersion);
|
||||
|
||||
// username in unicode
|
||||
byte [] ucUN = IOUtils.safelyAllocate(lastEditUser.length()*2, MAX_RECORD_LENGTH);
|
||||
byte [] ucUN = IOUtils.safelyAllocate(lastEditUser.length() * 2L, MAX_RECORD_LENGTH);
|
||||
StringUtil.putUnicodeLE(lastEditUser,ucUN,0);
|
||||
System.arraycopy(ucUN,0,_contents,28+asciiUN.length+4,ucUN.length);
|
||||
|
||||
|
@ -92,6 +92,7 @@ public final class MasterTextPropAtom extends RecordAtom {
|
||||
*
|
||||
* @return the record type.
|
||||
*/
|
||||
@Override
|
||||
public long getRecordType() {
|
||||
return RecordTypes.MasterTextPropAtom.typeID;
|
||||
}
|
||||
@ -103,6 +104,7 @@ public final class MasterTextPropAtom extends RecordAtom {
|
||||
* @param out the output stream to write to.
|
||||
* @throws java.io.IOException if an error occurs.
|
||||
*/
|
||||
@Override
|
||||
public void writeOut(OutputStream out) throws IOException {
|
||||
write();
|
||||
out.write(_header);
|
||||
|
@ -48,7 +48,7 @@ public final class TextCharsAtom extends RecordAtom {
|
||||
/** Updates the text in the Atom. */
|
||||
public void setText(String text) {
|
||||
// Convert to little endian unicode
|
||||
_text = IOUtils.safelyAllocate(text.length()*2, MAX_RECORD_LENGTH);
|
||||
_text = IOUtils.safelyAllocate(text.length() * 2L, MAX_RECORD_LENGTH);
|
||||
StringUtil.putUnicodeLE(text,_text,0);
|
||||
|
||||
// Update the size (header bytes 5-8)
|
||||
|
@ -20,7 +20,10 @@ package org.apache.poi.hslf.record;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.apache.poi.util.*;
|
||||
import org.apache.poi.util.BitField;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
import org.apache.poi.util.LittleEndianByteArrayInputStream;
|
||||
|
||||
public class TextSpecInfoRun {
|
||||
|
||||
@ -157,7 +160,7 @@ public class TextSpecInfoRun {
|
||||
if (smartTagFld.isSet(mask)) {
|
||||
// An unsigned integer specifies the count of items in rgSmartTagIndex.
|
||||
int count = source.readInt();
|
||||
smartTagsBytes = IOUtils.safelyAllocate(4+count*4, MAX_RECORD_LENGTH);
|
||||
smartTagsBytes = IOUtils.safelyAllocate(4 + count * 4L, MAX_RECORD_LENGTH);
|
||||
LittleEndian.putInt(smartTagsBytes, 0, count);
|
||||
// An array of SmartTagIndex that specifies the indices.
|
||||
// The count of items in the array is specified by count.
|
||||
@ -190,7 +193,9 @@ public class TextSpecInfoRun {
|
||||
for (int i=0; i<flds.length-1; i+=3) {
|
||||
BitField fld = (BitField)flds[i+0];
|
||||
Object valO = flds[i+1];
|
||||
if (!fld.isSet(mask)) continue;
|
||||
if (!fld.isSet(mask)) {
|
||||
continue;
|
||||
}
|
||||
boolean valid;
|
||||
if (valO instanceof byte[]) {
|
||||
byte[] bufB = (byte[]) valO;
|
||||
@ -220,9 +225,13 @@ public class TextSpecInfoRun {
|
||||
* @return Spelling status of this text. null if not defined.
|
||||
*/
|
||||
public SpellInfoEnum getSpellInfo(){
|
||||
if (spellInfo == -1) return null;
|
||||
if (spellInfo == -1) {
|
||||
return null;
|
||||
}
|
||||
for (SpellInfoEnum si : new SpellInfoEnum[]{SpellInfoEnum.clean,SpellInfoEnum.error,SpellInfoEnum.grammar}) {
|
||||
if (si.bitField.isSet(spellInfo)) return si;
|
||||
if (si.bitField.isSet(spellInfo)) {
|
||||
return si;
|
||||
}
|
||||
}
|
||||
return SpellInfoEnum.correct;
|
||||
}
|
||||
|
@ -266,8 +266,8 @@ public class HwmfDraw {
|
||||
Rectangle2D inner = ctx.getProperties().getRegion().getBounds();
|
||||
double x = inner.getX()-width;
|
||||
double y = inner.getY()-height;
|
||||
double w = inner.getWidth()+2*width;
|
||||
double h = inner.getHeight()+2*height;
|
||||
double w = inner.getWidth()+2.0*width;
|
||||
double h = inner.getHeight()+2.0*height;
|
||||
Rectangle2D outer = new Rectangle2D.Double(x,y,w,h);
|
||||
Area frame = new Area(outer);
|
||||
frame.subtract(new Area(inner));
|
||||
@ -577,7 +577,6 @@ public class HwmfDraw {
|
||||
startAngle += 360;
|
||||
}
|
||||
|
||||
boolean fillShape;
|
||||
int arcClosure;
|
||||
switch (getWmfRecordType()) {
|
||||
default:
|
||||
|
@ -344,11 +344,11 @@ public class WordToHtmlConverter extends AbstractWordConverter
|
||||
|
||||
if ( aspectRatioX > 0 )
|
||||
{
|
||||
imageWidth = picture.getDxaGoal() * aspectRatioX / 1000.f
|
||||
imageWidth = aspectRatioX / 1000.f * picture.getDxaGoal()
|
||||
/ TWIPS_PER_INCH;
|
||||
cropRight = picture.getDxaCropRight() * aspectRatioX / 1000.f
|
||||
cropRight = aspectRatioX / 1000.f * picture.getDxaCropRight()
|
||||
/ TWIPS_PER_INCH;
|
||||
cropLeft = picture.getDxaCropLeft() * aspectRatioX / 1000.f
|
||||
cropLeft = aspectRatioX / 1000.f * picture.getDxaCropLeft()
|
||||
/ TWIPS_PER_INCH;
|
||||
}
|
||||
else
|
||||
@ -360,11 +360,11 @@ public class WordToHtmlConverter extends AbstractWordConverter
|
||||
|
||||
if ( aspectRatioY > 0 )
|
||||
{
|
||||
imageHeight = picture.getDyaGoal() * aspectRatioY / 1000.f
|
||||
imageHeight = aspectRatioY / 1000.f * picture.getDyaGoal()
|
||||
/ TWIPS_PER_INCH;
|
||||
cropTop = picture.getDyaCropTop() * aspectRatioY / 1000.f
|
||||
cropTop = aspectRatioY / 1000.f * picture.getDyaCropTop()
|
||||
/ TWIPS_PER_INCH;
|
||||
cropBottom = picture.getDyaCropBottom() * aspectRatioY / 1000.f
|
||||
cropBottom = aspectRatioY / 1000.f * picture.getDyaCropBottom()
|
||||
/ TWIPS_PER_INCH;
|
||||
}
|
||||
else
|
||||
|
@ -37,7 +37,7 @@ public final class SprmUtils
|
||||
|
||||
public static byte[] shortArrayToByteArray(short[] convert)
|
||||
{
|
||||
byte[] buf = IOUtils.safelyAllocate(convert.length * LittleEndian.SHORT_SIZE, MAX_RECORD_LENGTH);
|
||||
byte[] buf = IOUtils.safelyAllocate(convert.length * (long)LittleEndian.SHORT_SIZE, MAX_RECORD_LENGTH);
|
||||
|
||||
for (int x = 0; x < convert.length; x++)
|
||||
{
|
||||
|
@ -81,7 +81,9 @@ public final class TableSprmCompressor
|
||||
{
|
||||
int itcMac = newTAP.getItcMac();
|
||||
byte[] buf = IOUtils.safelyAllocate(
|
||||
1 + (LittleEndian.SHORT_SIZE*(itcMac + 1)) + (TableCellDescriptor.SIZE*itcMac),
|
||||
1
|
||||
+ (LittleEndian.SHORT_SIZE*((long)itcMac + 1))
|
||||
+ (TableCellDescriptor.SIZE*(long)itcMac),
|
||||
MAX_RECORD_LENGTH);
|
||||
buf[0] = (byte)itcMac;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user