Skip to content

Commit

Permalink
Update array declarations/usages
Browse files Browse the repository at this point in the history
This commit replaces C-style array declaration with Java-style.
It also uses a 0-sized array for initialization.
  • Loading branch information
MGaetan89 committed Dec 22, 2024
1 parent 248be7d commit 6c44ae4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public PackageResourceTable buildResourceTable(AndroidManifest appManifest) {

return new ResourceTableFactory()
.newResourceTable(
appManifest.getPackageName(),
allResourcePaths.toArray(new ResourcePath[allResourcePaths.size()]));
appManifest.getPackageName(), allResourcePaths.toArray(new ResourcePath[0]));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ private static class ThemeType {
static final int SIZEOF_WITHOUT_ENTRIES = 8;

int entry_count;
ThemeEntry entries[];
ThemeEntry[] entries;
}

// static final int kPackageCount = std.numeric_limits<byte>.max() + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static int localeDataCompareRegions(
int[] request_ancestors = new int[MAX_PARENT_DEPTH + 1];
final Ref<Long> left_right_indexRef = new Ref<Long>(null);
// Find the parents of the request, but stop as soon as we saw left or right
final int left_and_right[] = {left, right};
final int[] left_and_right = {left, right};
final int ancestor_count =
findAncestors(
request_ancestors, left_right_indexRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ static final int compareLocales(final ResTable_config l, final ResTable_config r
// systems should happen very infrequently (if at all.)
// The comparison code relies on memcmp low-level optimizations that make it
// more efficient than strncmp.
final byte emptyScript[] = {'\0', '\0', '\0', '\0'};
final byte[] emptyScript = {'\0', '\0', '\0', '\0'};
final byte[] lScript = l.localeScriptWasComputed ? emptyScript : l.localeScript;
final byte[] rScript = r.localeScriptWasComputed ? emptyScript : r.localeScript;
// int script = memcmp(lScript, rScript);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ static class IdmapEntry_header extends WithOffset {
short overlay_type_id;
short entry_count;
short entry_id_offset;
int entries[];
int[] entries;

IdmapEntry_header(ByteBuffer buf, int offset) {
super(buf, offset);
Expand Down

0 comments on commit 6c44ae4

Please sign in to comment.