git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Michael Barr <davidbarr@google.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 5/7] vcs-svn: fix cppcheck warning
Date: Thu, 31 May 2012 21:17:03 +1000	[thread overview]
Message-ID: <CAFfmPPPZpH7WMLtE9YVOfzO2pjU8Scudg4hVp-ot+SAFxKLs3Q@mail.gmail.com> (raw)
In-Reply-To: <20120524142058.GA3732@burratino>

On Fri, May 25, 2012 at 12:20 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi,
>
> First, thanks much for this series!  I especially like patch #4.
>
> David Barr wrote:
>
>> [vcs-svn/fast_export.c:211]: (warning) Using sizeof with a numeric constant
>> as function argument might not be what you intended.
> [...]
>> -             assert(!signed_add_overflows(preimage.max_off, 1));
>> +             assert(!signed_add_overflows(preimage.max_off, (off_t) 1));
>
> I think this is due to a typo in the compat-util.h compatibility layer
> you are using.  In git.git there is
>
>        #define signed_add_overflows(a, b) \
>            ((b) > maximum_signed_value_of_type(a) - (a))
>
> so the sizeof() operator is applied to preimage.max_off and all is well.
> By contrast, in svn-dump-fast-export.git it says
>
>        #define signed_add_overflows(a, b) \
>                ((a) > maximum_signed_value_of_type(b) - (b))
>
> Though the comment describing signed_add_overflows() does say that "a"
> and "b" should have the same type, I like being able to ask if
> signed_add_overflows(n, 1) in a non-fussy way that does not introduce
> subtle bugs when the type of "n" changes, so I'd prefer not to take
> this patch.

Thank you for the review. I will queue the typo fix upstream and drop
this patch.

--
David Barr

  reply	other threads:[~2012-05-31 11:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24 14:04 [PATCH 0/7] vcs-svn: housekeeping David Barr
2012-05-24 14:04 ` [PATCH 1/7] vcs-svn: prefer constcmp to prefixcmp David Barr
2012-05-24 14:04 ` [PATCH 2/7] vcs-svn: prefer strstr over memmem David Barr
2012-05-24 14:04 ` [PATCH 3/7] vcs-svn: fix signedness warnings David Barr
2012-05-24 14:48   ` Jonathan Nieder
2012-05-31 13:14     ` David Michael Barr
2012-05-24 14:04 ` [PATCH 4/7] vcs-svn: drop no-op reset methods David Barr
2012-05-24 14:04 ` [PATCH 5/7] vcs-svn: fix cppcheck warning David Barr
2012-05-24 14:20   ` Jonathan Nieder
2012-05-31 11:17     ` David Michael Barr [this message]
2012-05-24 14:04 ` [PATCH 6/7] vcs-svn: fix clang-analyzer error David Barr
2012-05-24 14:04 ` [PATCH 7/7] vcs-svn: fix clang-analyzer warning David Barr
2012-05-24 14:33   ` Jonathan Nieder
2012-05-31 11:34     ` David Michael Barr

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=CAFfmPPPZpH7WMLtE9YVOfzO2pjU8Scudg4hVp-ot+SAFxKLs3Q@mail.gmail.com \
    --to=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).