Re: File descriptors are int, not short

Thomas Dickey <[email protected]> Mon, 22 Jun 2026 04:03:15 -0400
Newsgroups gmane.comp.lib.ncurses.bugs
Message-ID <[email protected]>
--86nMCWBUhDeNmuuR
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 22, 2026 at 12:31:06AM +0000, Antonio Ni=F1o D=EDaz wrote:
> Hello,
>=20
> I've noticed that a few lines of the library are treating file descriptor=
s as short instead of int. I've downloaded the 6.6 tarball, and the affecte=
d lines are:
>=20
> ncurses/term.priv.h:143
> ncurses/tinfo/lib_setup.c:957ncurses/tinfo/lib_setup.c:1007
>=20
> You can find them with "grep -rn Filedes | grep short"
>=20
> The fix would involve changing the type of the variable in term.priv.h to=
 int, and removing the two casts to short in lib_setup.c.

I see (thanks).  That was leftover from 1995, declared in term.h (which
meant that changing the type would be a binary compatibility issue).

In 2010, I added the casts per gcc warnings.

In 2021 I moved the definition into term.priv.h as part of making TERMINAL
opaque (to allow for 32-bit integer values for capabilities).  I was able
to make it opaque because only the first member of TERMINAL was used in
calling applications.

So it wasn't (my) error, but rather a missed opportunity to make a fix
without side-effects.

--=20
Thomas E. Dickey <[email protected]>
https://invisible-island.net

--86nMCWBUhDeNmuuR
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEEGYgtkt2kxADCLA1WzCr0RyFnvgMFAmo47D8ACgkQzCr0RyFn
vgPYEAwAhiatPJbGrvslkHvuIlJOs0xpMA/VzSKzi7L5yfWoMlXPJMYWPfEaxADP
WsnaBiS/frkeNUi+qF48xO7quOaBRJ4Oip9ftw1nYHBfuX9225AHQEQpuqIcHqD7
k/ydb9SCPg7LPb3GQYvW2AW+ZdG/FNfQlQizfBcdhdM2LBvrFZwV2zxovmyYWFhI
iXjauCQsGbpfkW3KHEW+8Fl4UwiokHKqbNGqo/d9X6dBXpF3k5APijlu7LSNRSdO
o1u5qwFN/lL8jah8LnhlZ59nlPr2mZf0X5qB8LxdjrxWSBU9On7rPrMNPPpU5KDM
dxj0rb2EKDQSUX9ASLqnFUeJHIUdWnHL2/dyixBvNmkdOfRB9iOjJ3yyabAr0Gok
bJ+090QsZ0Nx1aJz+yh8OjvPIYCDyuMndufGKZazZgHW6iYKlD+IbZ+he7osBHoY
WUtNXtY+MGS9K3dRYOiFDJAYvcRGWavEKP8ZFWPmx/vJm/aOoxP4hoImdMSHeaO7
tWldEYda
=UX/D
-----END PGP SIGNATURE-----

--86nMCWBUhDeNmuuR--