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
@@ -72,7 +72,7 @@ public class Base64 {
}
int numberQuadruple = base64Data.length / FOURBYTE;
byte decodedData[] = null;
byte[] decodedData = null;
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0;
// Throw away anything not in base64Data
@@ -150,7 +150,7 @@ public class Base64 {
* @return The data, less non-base64 characters (see RFC 2045).
*/
static byte[] discardNonBase64(byte[] data) {
byte groomedData[] = new byte[data.length];
byte[] groomedData = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
@@ -159,7 +159,7 @@ public class Base64 {
}
}
byte packedData[] = new byte[bytesCopied];
byte[] packedData = new byte[bytesCopied];
System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
@@ -91,7 +91,7 @@ public class PermissionCheckActivity extends Activity {
@Override
public void onRequestPermissionsResult(final int requestCode,
@NonNull final String permissions[],
@NonNull final String[] permissions,
@NonNull final int[] grantResults) {
if (requestCode == REQUIRED_PERMISSIONS_REQUEST_CODE) {
// We do not use grantResults as some of the granted permissions might have been
@@ -762,7 +762,7 @@ public class ConversationFragment extends Fragment implements ConversationDataLi
final View targetView = getActivity().findViewById(R.id.action_call);
Point centerPoint;
if (targetView != null) {
final int screenLocation[] = new int[2];
final int[] screenLocation = new int[2];
targetView.getLocationOnScreen(screenLocation);
final int centerX = screenLocation[0] + targetView.getWidth() / 2;
final int centerY = screenLocation[1] + targetView.getHeight() / 2;
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -120,7 +121,7 @@ class AudioMediaChooser extends MediaChooser implements
@Override
protected void onRequestPermissionsResult(
final int requestCode, final String permissions[], final int[] grantResults) {
final int requestCode, final String[] permissions, final int[] grantResults) {
if (requestCode == MediaPicker.RECORD_AUDIO_PERMISSION_REQUEST_CODE) {
final boolean permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
// onRequestPermissionsResult can sometimes get called before createView().
@@ -257,7 +257,7 @@ class CameraMediaChooser extends MediaChooser implements
@Override
protected void onRequestPermissionsResult(
final int requestCode, final String permissions[], final int[] grantResults) {
final int requestCode, final String[] permissions, final int[] grantResults) {
if (requestCode == MediaPicker.CAMERA_PERMISSION_REQUEST_CODE) {
final boolean permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
updateForPermissionState(permissionGranted);
@@ -97,7 +97,7 @@ class ContactMediaChooser extends MediaChooser {
@Override
protected void onRequestPermissionsResult(
final int requestCode, final String permissions[], final int[] grantResults) {
final int requestCode, final String[] permissions, final int[] grantResults) {
if (requestCode == MediaPicker.READ_CONTACT_PERMISSION_REQUEST_CODE) {
final boolean permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
mEnabledView.setVisibility(permissionGranted ? View.VISIBLE : View.GONE);
@@ -224,7 +224,7 @@ class GalleryMediaChooser extends MediaChooser implements
@Override
protected void onRequestPermissionsResult(
final int requestCode, final String permissions[], final int[] grantResults) {
final int requestCode, final String[] permissions, final int[] grantResults) {
if (requestCode == MediaPicker.GALLERY_PERMISSION_REQUEST_CODE) {
final boolean permissionGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
if (permissionGranted) {
@@ -209,5 +209,5 @@ abstract class MediaChooser extends BasePagerViewHolder
public void onPause() { }
public void onResume() { }
protected void onRequestPermissionsResult(
final int requestCode, final String permissions[], final int[] grantResults) { }
final int requestCode, final String[] permissions, final int[] grantResults) { }
}
@@ -674,7 +674,7 @@ public class MediaPicker extends Fragment implements DraftMessageSubscriptionDat
@Override
public void onRequestPermissionsResult(final int requestCode,
@NonNull final String permissions[],
@NonNull final String[] permissions,
@NonNull final int[] grantResults) {
if (mSelectedChooser != null) {
mSelectedChooser.onRequestPermissionsResult(requestCode, permissions, grantResults);
@@ -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;