pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chao Li <li.evan.chao@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Cc: Bryan Green <dbryan.green@gmail.com>
Subject: Re: Switch buffile.c/h to use pgoff_t
Date: Fri, 26 Dec 2025 09:11:48 +0800
Message-ID: <B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com> (raw)
In-Reply-To: <aU3MfBO_4umfxgE6@paquier.xyz>
References: <aUStrqoOCDRFAq1M@paquier.xyz>
	<85F6E9BB-59E8-4BD5-9FC1-357C3ACD5F87@gmail.com>
	<aUTg-rH4mOVF9rTo@paquier.xyz>
	<CAEoWx2msZLqS7AYhy_qQzw=MJUYcp_5V+mwhRsk8DSXFZDcm+A@mail.gmail.com>
	<aUuE-hAC1qPAnH75@paquier.xyz>
	<CAEoWx2=bkpLbd2=sX6rVsw1OT8FNnp2O+LdpkTbdgbOev-9vgg@mail.gmail.com>
	<aUx6TMczfmwyv_h3@paquier.xyz>
	<CAEoWx2kwZBdsg6Gxck13jPEXvga2aH5fN8__ewgZ-hHwB1XHKA@mail.gmail.com>
	<aU3MfBO_4umfxgE6@paquier.xyz>



> On Dec 26, 2025, at 07:45, Michael Paquier <michael@paquier.xyz> wrote:
> 
> On Thu, Dec 25, 2025 at 10:40:02AM +0800, Chao Li wrote:
>> In attached v3, I have applied int64 to the 2 struct fields and
>> corresponding local variables. I ran a clean build, no warning was
>> introduced, and "make check" passed.
> 
> The advantage of being able to make the code transparently more
> pluggable for max large sizes while we already use 8-byte offsets is
> kind of nice, I guess.  "availbytes" is a clarification bonus as it is
> not an offset per-se.  I can see that you have missed on cast spot, so
> adjusted things a bit, then applied the result.
> --
> Michael

Thanks a lot for pushing.

WRT to the original (int) casts, I intentionally removed them, because file->nbytes, newOffset and file->curOffset are all signed 64 bit integers now. Compiling with -Wextra won’t get a warning, so technically, the type cast is no longer needed.

I saw you changed to:
```
- file->pos = (int) (newOffset - file->curOffset);
+ file->pos = (int64) (newOffset - file->curOffset);

- file->pos = (int) (newOffset - file->curOffset);
+ file->pos = (int64) newOffset - file->curOffset;

- file->nbytes = (int) (newOffset - file->curOffset);
+ file->nbytes = (int64) newOffset - file->curOffset;
``` 

The latter two places missed (), but that should also work, just a little inconsistent.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/









view thread (13+ messages)

Message-ID: <B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com>
Permalink:  ../B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com/
Also on:    postgresql.org/message-id/B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: li.evan.chao@gmail.com, michael@paquier.xyz, dbryan.green@gmail.com
  Subject: Re: Switch buffile.c/h to use pgoff_t
  In-Reply-To: <B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com>
  References: <aUStrqoOCDRFAq1M@paquier.xyz> <85F6E9BB-59E8-4BD5-9FC1-357C3ACD5F87@gmail.com> <aUTg-rH4mOVF9rTo@paquier.xyz> <CAEoWx2msZLqS7AYhy_qQzw=MJUYcp_5V+mwhRsk8DSXFZDcm+A@mail.gmail.com> <aUuE-hAC1qPAnH75@paquier.xyz> <CAEoWx2=bkpLbd2=sX6rVsw1OT8FNnp2O+LdpkTbdgbOev-9vgg@mail.gmail.com> <aUx6TMczfmwyv_h3@paquier.xyz> <CAEoWx2kwZBdsg6Gxck13jPEXvga2aH5fN8__ewgZ-hHwB1XHKA@mail.gmail.com> <aU3MfBO_4umfxgE6@paquier.xyz> <B685F6F2-2372-499B-90B7-213340E3B1DE@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox