Hi Albrecht!
On 03/14/2022 04:56:42 PM Mon, Albrecht Dreß via balsa-list wrote:
Hi Andreas,
thanks a lot for your report!
Am 14.03.22 13:52 schrieb(en) AS via balsa-list:
mailbox_imap.c: In function ‘libbalsa_mailbox_imap_fetch_headers’:
mailbox_imap.c:2333:15: error: comparison of integer expressions of
different signedness: ‘glong’ {aka ‘long int’} and ‘unsigned int’
[-Werror=sign-compare]
2333 | if (msgno > imap_mbox_handle_get_exists(mimap->handle))
| ^
cc1: all warnings being treated as errors
Yes, that's a bug in the code! Which probably slipped through with older
compilers than on Debian unstable…
I'm not really familiar with the IMAP code, but I *think* the trivial solution
would be to declare msgno as unsigned in line 2328, and to add a cast to
unsigned in line 2330, as all the imap_* functions use unsigned as parameters.
Peter?
Best,
Albrecht.
Yes, that should fix it!
But I'm left with a few questions:
• First, why didn't I get that warning/error when I committed that test a year ago? Meson sets
"-Wall", which implies "-Wsign-compare", and even including "-Wsign-compare"
explicitly doesn't result in the warning!
• Also, why does Balsa use a signed type for message numbers? They are
1-based, and zero is already used as the invalid value, so all negative values
are presumably unused.
• And "glong" (aka "long int", or "long") seems extravagant; it's presumably left over
from when 16-bit ints were common but a mailbox with more than 32,767 messages was possible; surely
"unsigned" would be adequate today.
Peter
_______________________________________________
balsa-list mailing list
balsa-list@gnome.org
https://mail.gnome.org/mailman/listinfo/balsa-list