terminfo numeric parameters promoted from short to int

15 Mar 2020 • 1 min read

POSIX mandates implementations must support upto a short but may exceed it. When NetBSD terminfo was implemented, no terminfo description used over a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for screen-256color went up to 65536 which exposed a bug in the existing implementation where it was set to zero. Because the number might mean something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks to C int promotion, the ABI has. Also the underlying database structure has changed as well - we now store the numeric parameter inside a uint32_t field rather than a uint16_t one. Whilst this change can still read the old style database, the old one cannot read the new one and thus we now maintain the database as terminfo2.cdb, leaving the old library and database alone so old programs still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to accomoate this change.