Skip to content

Commit

Permalink
[XrdPosix] Fix Clang -Wtautological-constant-out-of-range-compare war…
Browse files Browse the repository at this point in the history
…ning

src/XrdPosix/XrdPosixAdmin.cc:71:10: warning: result of comparison of constant
32940614417338485 with expression of type 'unsigned int' is always false
[-Wtautological-constant-out-of-range-compare]

   if (i > std::numeric_limits<ptrdiff_t>::max() / sizeof(XrdCl::URL))
       ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here std::numeric_limits<ptrdiff_t>::max() / sizeof(XrdCl::URL) == 32940614417338485,
which is bigger than the largest unsigned int, therefore the
comparison will always be false. We need i to be able to hold large
enough values. Fixes 0dc292f.
  • Loading branch information
amadio authored and abh3 committed Apr 17, 2023
1 parent 422b123 commit d5bc449
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/XrdPosix/XrdPosixAdmin.cc
Expand Up @@ -51,7 +51,7 @@ XrdCl::URL *XrdPosixAdmin::FanOut(int &num)
XrdCl::URL *uVec;
XrdNetAddr netLoc;
const char *hName;
unsigned int i;
unsigned long i;

// Make sure admin is ok
//
Expand Down

0 comments on commit d5bc449

Please sign in to comment.