ConnMan network manager
 help / color / mirror / Atom feed
From: Grant Erickson <gerickson@nuovations.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: connman@lists.linux.dev
Subject: Re: [PATCH] Address -Werror=sign-compare compilation errors.
Date: Tue, 7 Nov 2023 07:38:43 -0800	[thread overview]
Message-ID: <0358404F-A450-4090-A724-8105616E8569@nuovations.com> (raw)
In-Reply-To: <41D09C15-1D19-41B5-90B5-DAC7780D8440@holtmann.org>

On Nov 7, 2023, at 7:28 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
>> This addresses -Werror=sign-compare compilation errors surfaced by both
>> GCC and clang/LLVM when --enable-maintainer-mode is asserted.
>> ---
>> src/dnsproxy.c | 14 +++++++-------
>> src/iptables.c |  4 ++--
>> 2 files changed, 9 insertions(+), 9 deletions(-)
>> 
>> diff --git a/src/dnsproxy.c b/src/dnsproxy.c
>> index 4ae485f1..03021ba0 100644
>> --- a/src/dnsproxy.c
>> +++ b/src/dnsproxy.c
>> @@ -436,7 +436,7 @@ static void update_cached_ttl(unsigned char *ptr, int len, int new_ttl)
>> ptr += DNS_HEADER_SIZE;
>> len -= DNS_HEADER_SIZE;
>> 
>> - if (len < DNS_QUESTION_SIZE + 1)
>> + if (len < (int)DNS_QUESTION_SIZE + 1)
>> return;
> 
> I was struggling with these as well and didn’t want to result to just casting everything. Fundamentally once you cast you loose any benefits of the compiler checking things. Sometimes it is enough to re-arrange the statements or pick different variables.

Agreed. I’m happy to take a different approach; however, this seemed the most tactical.

Best,

Grant

-- 
Principal
Nuovations

gerickson@nuovations.com
http://www.nuovations.com/


      reply	other threads:[~2023-11-07 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01  4:34 [PATCH] Address -Werror=sign-compare compilation errors Grant Erickson
2023-11-07 15:28 ` Marcel Holtmann
2023-11-07 15:38   ` Grant Erickson [this message]

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0358404F-A450-4090-A724-8105616E8569@nuovations.com \
    --to=gerickson@nuovations.com \
    --cc=connman@lists.linux.dev \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).