sonarcube fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1771978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
200850c1e4
commit
48ff8e5686
@ -28,15 +28,16 @@ import org.apache.poi.util.POILogger;
|
||||
|
||||
@Internal
|
||||
public class ImageHeaderEMF {
|
||||
private static POILogger LOG = POILogFactory.getLogger(ImageHeaderEMF.class);
|
||||
private static final POILogger LOG = POILogFactory.getLogger(ImageHeaderEMF.class);
|
||||
|
||||
private final static String EMF_SIGNATURE = " EMF"; // 0x464D4520 (LE)
|
||||
private static final String EMF_SIGNATURE = " EMF"; // 0x464D4520 (LE)
|
||||
|
||||
// rectangular inclusive-inclusive bounds, in device units, of the smallest
|
||||
// rectangle that can be drawn around the image stored in the metafile.
|
||||
private final Rectangle deviceBounds;
|
||||
|
||||
public ImageHeaderEMF(byte data[], int offset) {
|
||||
public ImageHeaderEMF(final byte data[], final int off) {
|
||||
int offset = off;
|
||||
int type = (int)LittleEndian.getUInt(data, offset); offset += 4;
|
||||
if (type != 1) {
|
||||
LOG.log(POILogger.WARN, "Invalid EMF picture - invalid type");
|
||||
|
@ -42,9 +42,9 @@ public class ImageHeaderPICT {
|
||||
private final Rectangle bounds;
|
||||
private final double hRes, vRes;
|
||||
|
||||
public ImageHeaderPICT(byte data[], int offset) {
|
||||
public ImageHeaderPICT(byte data[], final int off) {
|
||||
// http://mirrors.apple2.org.za/apple.cabi.net/Graphics/PICT.and_QT.INFO/PICT.file.format.TI.txt
|
||||
|
||||
int offset = off;
|
||||
// low order 16 bits of picture size - can be ignored
|
||||
offset += 2;
|
||||
// rectangular bounding box of picture, at 72 dpi
|
||||
|
@ -46,7 +46,7 @@ import org.apache.poi.util.Units;
|
||||
public class ImageHeaderWMF {
|
||||
|
||||
public static final int APMHEADER_KEY = 0x9AC6CDD7;
|
||||
private static POILogger LOG = POILogFactory.getLogger(ImageHeaderWMF.class);
|
||||
private static final POILogger LOG = POILogFactory.getLogger(ImageHeaderWMF.class);
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final int handle;
|
||||
@ -75,8 +75,9 @@ public class ImageHeaderWMF {
|
||||
reserved = 0;
|
||||
}
|
||||
|
||||
public ImageHeaderWMF(byte[] data, int pos) {
|
||||
int key = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE; //header key
|
||||
public ImageHeaderWMF(byte[] data, final int off) {
|
||||
int offset = off;
|
||||
int key = LittleEndian.getInt(data, offset); offset += LittleEndian.INT_SIZE; //header key
|
||||
if (key != APMHEADER_KEY) {
|
||||
LOG.log(POILogger.WARN, "WMF file doesn't contain a placeable header - ignore parsing");
|
||||
handle = 0;
|
||||
@ -89,16 +90,16 @@ public class ImageHeaderWMF {
|
||||
return;
|
||||
}
|
||||
|
||||
handle = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
left = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
top = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
right = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
bottom = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
handle = LittleEndian.getUShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
left = LittleEndian.getShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
top = LittleEndian.getShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
right = LittleEndian.getShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
bottom = LittleEndian.getShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
|
||||
inch = LittleEndian.getUShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
reserved = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
|
||||
inch = LittleEndian.getUShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
reserved = LittleEndian.getInt(data, offset); offset += LittleEndian.INT_SIZE;
|
||||
|
||||
checksum = LittleEndian.getShort(data, pos); pos += LittleEndian.SHORT_SIZE;
|
||||
checksum = LittleEndian.getShort(data, offset); offset += LittleEndian.SHORT_SIZE;
|
||||
if (checksum != getChecksum()){
|
||||
LOG.log(POILogger.WARN, "WMF checksum does not match the header data");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user