Messaging: Fix C-style array declarations

Change-Id: Ie7381dc5280ab4d907000ef551df9ea80553ddb4
This commit is contained in:
Michael W
2024-12-26 15:54:37 +01:00
parent 5403d02b5d
commit 6d11a6658c
17 changed files with 30 additions and 29 deletions
@@ -31,7 +31,7 @@ class CountedDataInputStream extends FilterInputStream {
private int mCount = 0;
// allocate a byte buffer for a long value;
private final byte mByteArray[] = new byte[8];
private final byte[] mByteArray = new byte[8];
private final ByteBuffer mByteBuffer = ByteBuffer.wrap(mByteArray);
protected CountedDataInputStream(InputStream in) {
@@ -129,13 +129,13 @@ class CountedDataInputStream extends FilterInputStream {
}
public String readString(int n) throws IOException {
byte buf[] = new byte[n];
byte[] buf = new byte[n];
readOrThrow(buf);
return new String(buf, StandardCharsets.UTF_8);
}
public String readString(int n, Charset charset) throws IOException {
byte buf[] = new byte[n];
byte[] buf = new byte[n];
readOrThrow(buf);
return new String(buf, charset);
}
@@ -154,7 +154,7 @@ class ExifModifier {
mByteBuffer.position(offset + mOffsetBase);
switch (tag.getDataType()) {
case ExifTag.TYPE_ASCII:
byte buf[] = tag.getStringByte();
byte[] buf = tag.getStringByte();
if (buf.length == tag.getComponentCount()) {
buf[buf.length - 1] = 0;
mByteBuffer.put(buf);
@@ -486,7 +486,7 @@ class ExifOutputStream extends FilterOutputStream {
throws IOException {
switch (tag.getDataType()) {
case ExifTag.TYPE_ASCII:
byte buf[] = tag.getStringByte();
byte[] buf = tag.getStringByte();
if (buf.length == tag.getComponentCount()) {
buf[buf.length - 1] = 0;
dataOutputStream.write(buf);
@@ -675,7 +675,7 @@ public class ExifParser {
switch (tag.getDataType()) {
case ExifTag.TYPE_UNSIGNED_BYTE:
case ExifTag.TYPE_UNDEFINED: {
byte buf[] = new byte[tag.getComponentCount()];
byte[] buf = new byte[tag.getComponentCount()];
read(buf);
tag.setValue(buf);
}
@@ -684,7 +684,7 @@ public class ExifParser {
tag.setValue(readString(tag.getComponentCount()));
break;
case ExifTag.TYPE_UNSIGNED_LONG: {
long value[] = new long[tag.getComponentCount()];
long[] value = new long[tag.getComponentCount()];
for (int i = 0, n = value.length; i < n; i++) {
value[i] = readUnsignedLong();
}
@@ -692,7 +692,7 @@ public class ExifParser {
}
break;
case ExifTag.TYPE_UNSIGNED_RATIONAL: {
Rational value[] = new Rational[tag.getComponentCount()];
Rational[] value = new Rational[tag.getComponentCount()];
for (int i = 0, n = value.length; i < n; i++) {
value[i] = readUnsignedRational();
}
@@ -700,7 +700,7 @@ public class ExifParser {
}
break;
case ExifTag.TYPE_UNSIGNED_SHORT: {
int value[] = new int[tag.getComponentCount()];
int[] value = new int[tag.getComponentCount()];
for (int i = 0, n = value.length; i < n; i++) {
value[i] = readUnsignedShort();
}
@@ -708,7 +708,7 @@ public class ExifParser {
}
break;
case ExifTag.TYPE_LONG: {
int value[] = new int[tag.getComponentCount()];
int[] value = new int[tag.getComponentCount()];
for (int i = 0, n = value.length; i < n; i++) {
value[i] = readLong();
}
@@ -716,7 +716,7 @@ public class ExifParser {
}
break;
case ExifTag.TYPE_RATIONAL: {
Rational value[] = new Rational[tag.getComponentCount()];
Rational[] value = new Rational[tag.getComponentCount()];
for (int i = 0, n = value.length; i < n; i++) {
value[i] = readRational();
}
@@ -68,7 +68,7 @@ class ExifReader {
exifData.getIfdData(tag.getIfd()).setTag(tag);
break;
case ExifParser.EVENT_COMPRESSED_IMAGE:
byte buf[] = new byte[parser.getCompressedImageSize()];
byte[] buf = new byte[parser.getCompressedImageSize()];
if (buf.length == parser.read(buf)) {
exifData.setCompressedThumbnail(buf);
} else {
@@ -72,7 +72,7 @@ public class ExifTag {
public static final short TYPE_RATIONAL = 10;
private static final Charset US_ASCII = StandardCharsets.US_ASCII;
private static final int TYPE_TO_SIZE_MAP[] = new int[11];
private static final int[] TYPE_TO_SIZE_MAP = new int[11];
private static final int UNSIGNED_SHORT_MAX = 65535;
private static final long UNSIGNED_LONG_MAX = 4294967295L;
private static final long LONG_MAX = Integer.MAX_VALUE;