Skip to content

Commit

Permalink
RangeIntPublisher add explicit cast to int (#1443)
Browse files Browse the repository at this point in the history
Motivation:
RangeIntPublisher relies upon an implict case from long to int which is
gaurded by a `min(int, long)` (where the int is non-negative). CodeQL
highlights this as a warning.

Modifications:
- Add an explicit cast to int to be more clear this is intentional

Result:
CodeQL warning is resovled.
  • Loading branch information
Scottmitch authored Mar 16, 2021
1 parent 627c354 commit ecb85bd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void request(long n) {
return;
}
pendingN = addWithOverflowProtection(pendingN, n);
for (; pendingN > 0 && index < end; --pendingN, index += min(stride, (long) end - index)) {
for (; pendingN > 0 && index < end; --pendingN, index += (int) min(stride, (long) end - index)) {
try {
subscriber.onNext(index);
} catch (Throwable cause) {
Expand Down

0 comments on commit ecb85bd

Please sign in to comment.