Print

Print


@amadio commented on this pull request.



> @@ -51,7 +51,7 @@ XrdCl::URL *XrdPosixAdmin::FanOut(int &num)
    XrdCl::URL                    *uVec;
    XrdNetAddr netLoc;
    const char *hName;
-   unsigned int i;
+   unsigned long i;

It's not clang that needs it, it just warns that the condition `i > std::numeric_limits<ptrdiff_t>::max() / sizeof(XrdCl::URL)` in the [`if` below](https://github.com/xrootd/xrootd/pull/1997/files#diff-71e5adaf610226018b09990d066c0888d3f3ed551809561d057b4cecf6214da0R71) is never going to trigger because `std::numeric_limits<ptrdiff_t>::max() / sizeof(XrdCl::URL)` is much larger than the largest `int`. We are checking there that we are not trying to allocate more memory (i.e. `i * sizeof(XrdCl::URL)`) than `std::numeric_limits<ptrdiff_t>::max()` bytes, but we can only do so if `i` can actually hold up to that value itself. The "solution" is to make `i` big enough for that.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/pull/1997#discussion_r1168679117
You are receiving this because you are subscribed to this thread.

Message ID: <[log in to unmask]>

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1