Re: Fix port/pg_iovec.h building extensions on x86_64-darwin - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Fix port/pg_iovec.h building extensions on x86_64-darwin
Date
Msg-id Zy5t5FAmNKsJGf44@nathan
Whole thread Raw
List pgsql-hackers
On Fri, Nov 08, 2024 at 08:08:06PM +0100, Wolfgang Walther wrote:
> @@ -68,7 +68,7 @@ pg_preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
>          }
>          sum += part;
>          offset += part;
> -        if (part < iov[i].iov_len)
> +        if ((size_t) part < iov[i].iov_len)
>              return sum;
>      }
>      return sum;
> @@ -107,7 +107,7 @@ pg_pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
>          }
>          sum += part;
>          offset += part;
> -        if (part < iov[i].iov_len)
> +        if ((size_t) part < iov[i].iov_len)
>              return sum;
>      }
>      return sum;

This looks correct to me.  At this point in the code, we know that part >=
0, so casting it to an unsigned long ought to be okay.

-- 
nathan



pgsql-hackers by date:

Previous
From: "Daniel Verite"
Date:
Subject: Re: New "single" COPY format
Next
From: "Joel Jacobson"
Date:
Subject: Re: New "single" COPY format