From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: bonneta <bonneta@ensimag.fr>
Cc: <git@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] textconv: support for blame
Date: Tue, 15 Jun 2010 12:51:52 +0200 [thread overview]
Message-ID: <vpqbpbc4lh3.fsf@bauges.imag.fr> (raw)
In-Reply-To: <192517e06785fed4fa799bee9a11ae28@ensimag.fr> (bonneta@ensimag.fr's message of "Tue\, 15 Jun 2010 12\:32\:56 +0200")
bonneta <bonneta@ensimag.fr> writes:
> But we have to do:
> textconv_object(read_from, null_sha1, &buf.buf, (unsigned long *)
> &buf.len))
> where buf.len is size_t.
>
> Is that ok?
I don't think it fixes the problem. You're assuming sizeof(unsigned
long) == sizeof(size_t), otherwise, textconv_object will write the
incorrect number of bytes at the given adress.
If you have to use this pass-by-adress, you want
size_t buf_len; /* textconv_object needs a last parameter of type
(size_t *) */
textconv_object(..., &buf_len); /* <-- no cast here */
buf.len = buf_len; /* This is a cast, but not a pointer cast. The
compiler will do the actual conversion if
needed (while pointer casts are just a matter of
typing, the generate no code). */
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2010-06-15 10:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-07 14:41 [PATCH v2 0/3] textconv support for blame Axel Bonnet
2010-06-07 15:23 ` [PATCH v2 1/3] textconv: make the API public Axel Bonnet
2010-06-07 15:23 ` [PATCH v2 2/3] textconv: support for blame Axel Bonnet
2010-06-07 15:23 ` [PATCH v2 3/3] t/t8006: test textconv " Axel Bonnet
2010-06-11 23:52 ` Junio C Hamano
2010-06-14 7:52 ` Diane Gasselin
2010-06-11 23:52 ` [PATCH v2 2/3] textconv: " Junio C Hamano
2010-06-12 4:11 ` Jeff King
2010-06-14 20:40 ` Junio C Hamano
2010-06-15 9:29 ` Clément Poulain
2010-06-15 9:54 ` Jeff King
2010-06-15 10:32 ` bonneta
2010-06-15 10:51 ` Matthieu Moy [this message]
[not found] ` <aad13a73928536f87879ef7284d6cc75@ensimag.fr>
2010-06-15 11:07 ` Jeff King
2010-06-15 12:13 ` bonneta
2010-06-15 15:00 ` Junio C Hamano
2010-06-15 13:58 ` Axel Bonnet
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=vpqbpbc4lh3.fsf@bauges.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=bonneta@ensimag.fr \
--cc=git@vger.kernel.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 NNTP newsgroup(s).