Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix implicit cast from long to int #4209

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public void removeDeletedLedgers() throws IOException {
}

private ReentrantLock lockForLedger(long ledgerId) {
return locks[Math.abs((int) ledgerId) % locks.length];
return locks[(int) (Math.abs(ledgerId) % locks.length)];
}

int getStorageStateFlags() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public FastTimer(int timeWindowSeconds, Buckets buckets) {
// initialize buckets
int bucketCnt = 0;
for (int i = 0; bucketSpec != null && i < bucketSpec.length; i++) {
bucketCnt += bucketSpec[i][BS_NUMBUCKETS];
bucketCnt += (int) bucketSpec[i][BS_NUMBUCKETS];
}
numBuckets = (bucketCnt > 0 ? bucketCnt + 1 : 0);
if (numBuckets > 0) {
Expand Down Expand Up @@ -349,7 +349,7 @@ public int getBucket(long duration) {
if (duration <= bucketBounds[i]) {
return bucket + (int) ((duration - lowbound - 1) / bucketSpec[i][BS_RESOLUTION]);
} else {
bucket += bucketSpec[i][BS_NUMBUCKETS];
bucket += (int) bucketSpec[i][BS_NUMBUCKETS];
lowbound = bucketBounds[i];
}
}
Expand All @@ -371,7 +371,7 @@ public long getBucketBound(int b) {
if (b < bucket + bucketSpec[i][BS_NUMBUCKETS]) {
return lowbound + ((long) ((b + 1) - bucket)) * bucketSpec[i][BS_RESOLUTION];
} else {
bucket += bucketSpec[i][BS_NUMBUCKETS];
bucket += (int) bucketSpec[i][BS_NUMBUCKETS];
lowbound = bucketBounds[i];
}
}
Expand Down
Loading