Skip to content

Commit

Permalink
[XrdEc] Fix comparison of narrow type with wide type in loop condition
Browse files Browse the repository at this point in the history
  • Loading branch information
amadio committed Nov 26, 2024
1 parent e0081b7 commit 50aec7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/XrdEc/XrdEcRedundancyProvider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ RedundancyProvider::CodingTable& RedundancyProvider::getCodingTable( const std::
/* Expand pattern */
int nerrs = 0, nsrcerrs = 0;
unsigned char err_indx_list[objcfg.nbparity];
for (std::uint8_t i = 0; i < pattern.size(); i++) {
/* Avoid narrowing cast warning, size is always < 256 */
uint8_t n = static_cast<uint8_t>(pattern.size() & 0xff);
for (uint8_t i = 0; i < n; i++) {
if (pattern[i]) {
err_indx_list[nerrs++] = i;
if (i < objcfg.nbdata) { nsrcerrs++; }
Expand Down

0 comments on commit 50aec7f

Please sign in to comment.